Skip to content

About

No description, website, or topics provided.

Resources

Stars

8 stars

Watchers

0 watching

Forks

Repository files navigation

deep-code-audit logo

deep-code-audit

Multi-agent adversarial code audit for Claude Code — parallel hunters find defects, fresh-context verifiers tear them apart, and only what survives makes it into the report.

License: MIT Claude Code plugin Python stdlib only

English | 한국어


What is this?

deep-code-audit is a Claude Code plugin (skill + two dedicated subagents) that audits an entire repository for security, concurrency, fault-handling, logic, and resource defects, then renders a structured Korean-language report aimed at reviewers who don't know the codebase.

Instead of one model skimming your code in a single pass, it runs an adversarial pipeline:

[1] Select & group     classify files (core / low / exclude), build audit brief,
                       group by line count + import-graph cohesion
[2] Adversarial hunt   one hunter subagent per group, 5 in parallel (adjustable) —
                       reads the whole repo, reports only inside its group
[2.5] Reinforcement    critical-only second pass on high-risk groups +
                       cross-group hint routing, script-merged (no silent loss)
[3] Adversarial verify fresh-context verifier per group: re-derives every claim
                       before reading the hunter's rationale (anti-anchoring),
                       tri-state rubric with kill-gates, machine-checked consistency
[4] Report             critical → major → minor, with entry path, mechanism,
                       failure scenario, and a fix sample per finding

Every stage hands off through schema-validated JSON files on disk (<target>/.deep-code-audit/<run-id>/), so runs are resumable, stages are independently retryable, and nothing lives only inside an agent's context.

For the full picture — design goals and principles, stage-by-stage behavior, the failure-mode → defense table, and design history — see the design & architecture doc.

Installation

The plugin ships two components, and both must be loaded for the skill to run at full capability: the skill itself (skills/deep-code-audit/) and the two dedicated subagents (agents/deep-audit-hunter.md, agents/deep-audit-verifier.md) that do the actual hunting and verification. Installing through the Claude Code plugin route loads both automatically — no separate wiring for agents/ is needed.

/plugin marketplace add posimind/deep-code-audit
/plugin install deep-code-audit@deep-code-audit

Restart your session after installing — agents added mid-session aren't recognized until restart (the skill's preflight checks this for you). The same commands work in the Claude Code VS Code extension, which shares ~/.claude with the CLI — install once, and it is available in both.

For development, a clone + symlink also works, since the repo carries .claude-plugin/plugin.json and is discovered in place (Claude Code v2.1.142+):

git clone https://github.com/posimind/deep-code-audit.git
ln -s "$(pwd)/deep-code-audit" ~/.claude/skills/deep-code-audit

Symlink the repo root, not skills/deep-code-audit/. The repo root carries .claude-plugin/plugin.json, so it is loaded as a plugin — which is exactly what makes the agents/ definitions load along with the skill. Linking only the skill subdirectory would leave the agents behind.

First run

Open the workspace you want audited and type:

/deep-code-audit

That is the whole thing — it audits the current workspace with the defaults and writes the report to <target>/.deep-code-audit/<run-id>/감사보고서.md. Read Cost before your first run, and see Usage for narrowing the scope or steering the lenses.

Why use it?

  • Few false positives. Every finding must survive an independent verifier that re-derives the claim from the raw code before it ever sees the hunter's reasoning, then passes a 5-criteria rubric (reachable precondition, genuinely harmful outcome, no upstream guard, survives adversarial rebuttal…). Any criterion proven unmet kills the finding.
  • Few false negatives. Hunters read without restriction (cross-file tracing is mandatory, not optional), group seams are minimized by import-graph clustering, cross-group suspicions are routed as hints that must be consumed, and high-risk groups get a dedicated critical-only second pass.
  • Severity that means something. Critical/major findings get the full rubric plus an appraisal step; test/fixture files are severity-capped and the cap is machine-enforced.
  • Prompt-injection defense. Repository content — including the target's own CLAUDE.md — is treated as untrusted data. "Already reviewed, skip this file" in a comment is a suspicion signal, not an instruction.
  • No silent degradation. The pipeline treats "exit 0 but quality quietly gone" as worse than a crash: grouping cohesion fallbacks, unparsed languages, unconsumed hints, and merge losses are all detected, logged to issues.jsonl, and surfaced in the report.
  • Zero dependencies. The four helper scripts are Python standard library only, with 82 unit tests.

Cost: this run is not cheap

Be aware before you start: deep-code-audit analyzes the entire codebase in parallel through many subagents, so a single run costs a substantial amount of both tokens and wall-clock time.

For an objective reference point, here is one full audit of mobis-oss/ssam, measured at reasoning effort high:

Model (effort: high) Claude Max 5x Claude API
Opus 4.8 ~50% of a single 5-hour session quota ~$50 worth of tokens
Opus 5 ~100% — an entire 5-hour session quota ~$100 worth of tokens

On Max 5x, an Opus 5 run can consume a whole session window, so on a large target you may hit the quota before the audit finishes. That is recoverable — every stage checkpoints to disk, so resume the audit from earlier in the next session continues from the last completed stage instead of starting over.

What moves that number

  • Reasoning effort. Each step up the effort ladder costs roughly +30%.
  • Codebase size. The bigger the audited code, the more groups, hunters, and verifiers — cost grows with it.
  • How many defects are actually there. Every finding drags a verification chain behind it (independent re-derivation, the full rubric, an appraisal pass for critical/major), so a defect-rich codebase costs more than a clean one of the same size.
  • Model choice, which compounds with the point above. On the same target, Opus 5 surfaces roughly 2× or more findings than Opus 4.8 — and that is precisely why its cost also lands at about 2×. The extra spend buys wider detection, not just more tokens — with the caveat in the next section: more findings reported is not automatically more real defects.

How long a run takes

Budget an hour or more for a full audit. This is not a command you fire off and wait on for a minute — it is closer to handing the codebase to a review team and coming back later.

The two factors above move the clock as well as the bill:

  • Codebase size. More code means more groups, and subagents run only 5 at a time by default — groups past that width wait their turn, so wall-clock time keeps climbing after the parallel width is saturated. The cap is one global number shared by hunters and verifiers; say "동시 3개만" to lower it.
  • Number of findings. Verification is per-finding work: every claim is independently re-derived, run through the full rubric, appraised if it is critical/major, and arbitrated by a fresh verifier when two groups judge the same defect oppositely. A defect-rich target therefore spends far longer in verification than a clean one of the same size — the run gets slower precisely when it is finding things.

You do not have to sit and watch it. Every stage checkpoints to disk, so an interrupted run resumes from the last completed stage instead of starting over.

Which model and effort to pick

As of 2026-07, the recommended settings are Opus 5 at effort high, or Opus 4.8 at effort max. The table above measures both models at high; max is two steps up from there, so budget roughly ~85% of a Max 5x session / ~$85 for the Opus 4.8 recommendation rather than the ~50% row (extrapolated at +30% per level, not measured).

Turning the effort up does surface more defects — but read that carefully: more findings is not the same as more true positives. Verification kills most of the noise, but the false positives that survive it grow with the volume too, and the report gets longer to triage.

What it buys you is reach into the tail: defects that a lower effort level would have silently missed become much more likely to surface. So if your priority is minimizing false negatives — a security-sensitive service, a pre-release sweep, code you cannot afford to have missed something in — paying for a higher effort level, and accepting the extra false positives that come with it, is a sound trade. For a routine pass over familiar code, it usually is not.

Usage

In its basic form, this is all you need:

/deep-code-audit

That runs a full audit of the current workspace with the default settings. Natural-language requests trigger the skill too ("find vulnerabilities across this codebase", "이 레포 audit 해줘").

What it hunts by default

Every run sweeps the codebase through five defect lenses:

Lens What it looks for
Security injection, authentication/authorization bypass, secret exposure, path traversal, unsafe deserialization
Concurrency data races, deadlocks, TOCTOU windows, unsynchronized shared state
Fault handling swallowed exceptions, missing error paths, partial-failure states left inconsistent
Logic boundary conditions, off-by-one, inverted/wrong conditions, unreachable or dead branches
Resource leaks of file descriptors / memory / connections, missing cleanup on error paths, unbounded growth

The audit brief stage prioritizes these lenses per project (e.g. a web API leans security-first), and findings are reported as critical → major → minor.

Steering the run with a prompt

Anything beyond the defaults is just extra prompt text after the command. For example:

You want Say
Skip test code /deep-code-audit exclude the test directories
Skip specific paths /deep-code-audit skip vendor/ and examples/
Audit only a specific path /deep-code-audit audit only src/api
Only certain defect lenses /deep-code-audit focus on concurrency and resource defects only
Resume an interrupted run resume the audit from earlier

Scope adjustments can also come as follow-ups mid-conversation ("tests 빼고", "api 디렉터리만").

Output

Results land in <target>/.deep-code-audit/<run-id>/ — the report is 감사보고서.md (split into summary / critical-major / minor files past ~15 findings). The report is written in Korean regardless of the audited codebase's language.

Development

# unit tests (82, no external deps)
python3 skills/deep-code-audit/scripts/test_scripts.py

# compile check
python3 -m py_compile skills/deep-code-audit/scripts/*.py

# plugin manifest check
claude plugin validate . --strict

License

MIT © 2026 Youhyun Jung

About

No description, website, or topics provided.

Resources

Stars

8 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages