Skip to content

Latest commit

 

History

History

README.md

CodeInspectus agent rules

Drop-in rules that make your AI coding agent run CodeInspectus's scan → surface → consent → fix → rescan loop (PRD §12): the tool reports the findings, your agent surfaces them to you and asks before changing code, and fixes only what you approve. Scans and reports never edit or delete your source code or repository (engine data and scan history stay under ~/.codeinspectus). Only codeinspectus_apply_cleanup and codeinspectus_rollback_cleanup change a repository, and only for an exact cleanup plan the user approved; codeinspectus_generate_sbom writes to a managed directory or an absolute .json path the user chooses; your agent applies any fix, with your consent. Each scan also returns a read-only git-safety advisory: if you have uncommitted work — or no git repo — your agent will offer, with your approval, to checkpoint first so any fix can be rolled back cleanly (CodeInspectus itself never runs git commands that change your repository). All clients use the same MCP server; only the rule file location differs. Remediation is deliberately one finding at a time: a triage state never authorizes reproduction or edits, and test evidence stays separate from CodeInspectus rescan evidence.

1. Register the MCP server (once per machine)

The server command is shared across clients, but the configuration format is client-specific. JSON-based MCP clients use:

{
  "mcpServers": {
    "codeinspectus": { "command": "npx", "args": ["-y", "codeinspectus"] }
  }
}
Client Where
Claude Code claude mcp add-json codeinspectus '{"command":"npx","args":["-y","codeinspectus"]}'
Cursor ~/.cursor/mcp.json (or project .cursor/mcp.json)
VS Code code --add-mcp '{"name":"codeinspectus","command":"npx","args":["-y","codeinspectus"]}'
Codex codex mcp add codeinspectus -- npx -y codeinspectus, or use Codex settings / TOML below
Windsurf / Cline / Aider that client's JSON MCP configuration

Codex can also be configured through Settings → MCP servers → Add server (STDIO; command npx; arguments -y, codeinspectus) or with:

[mcp_servers.codeinspectus]
command = "npx"
args = ["-y", "codeinspectus"]
tool_timeout_sec = 600

Codex defaults MCP tool calls to 60 seconds. CodeInspectus allows each security engine up to five minutes, so 600 seconds prevents premature client timeouts on larger repositories. This Codex-only setting does not alter other clients.

First run: npx codeinspectus setup (or codeinspectus_setup from the agent) reviews, fetches and verifies the engine binaries and offline Trivy DB after approval. Later scans expose structured engine_setup state; if it is not ready, the agent must explain the coverage impact and ask before running this networked setup.

2. Install the rule

Client File
Claude Code append claude-code.md to your project CLAUDE.md
Cursor copy cursor.mdc to .cursor/rules/codeinspectus.mdc
Windsurf append windsurf.md to .windsurfrules
Codex append codex-AGENTS.md to your AGENTS.md
Cline add cline.md to your Cline custom instructions

Skill-capable agents can install the self-contained codeinspectus-fix-one/ directory using that client's local skill installation mechanism. The folder includes SKILL.md and agents/openai.yaml; copying it is a client configuration action, not part of a scan.

Two other installable skills are deliberately opt-in:

  • codeinspectus-threat-model/ uses project documentation as untrusted explanatory context while preserving the raw finding set unchanged.
  • codeinspectus-multi-review/ orchestrates a bounded review whose agent output stays outside the deterministic result set.

All three skill directories ship in the npm artifact. Installing or invoking an optional skill is an agent-client action; CodeInspectus never invokes an LLM during a normal scan.

You can also just say "use codeinspectus to check my code" — it resolves to the same codeinspectus_scan tool.

See the one-finding remediation workflow for approval gates, outcome boundaries, and the separate investigation/regression/test/rescan evidence contract. See also the threat-model workflow and bounded multi-agent review.