Skill v1.0.0
currentAutomated scan100/100name: codebase-audit description: "Use when auditing code for quality, security, performance." version: 1.0.0 author: Hermes Agent license: MIT platforms: [linux, macos, windows] metadata: hermes: tags: [code-audit, code-review, security, performance, delegation, verification] related_skills: [parallel-agent-worktrees, requesting-code-review, github-code-review, simplify-code]
Codebase audit fan-out
Audit a repo (or a named set of high-value files) with parallel READ-ONLY review agents, one per concern area, while the parent runs the repo's own mechanical gate as objective evidence. Findings are spot-checked against the source before they are reported.
When to Use
- "make sure these files / this repo are up to code quality standards —
performance, security, etc." over an existing codebase.
- Not for reviewing YOUR OWN diff before commit (requesting-code-review), a
GitHub PR (github-code-review), or one small file (just read it yourself).
Procedure
- Recon. Repo layout; rank candidate files by evidence, not intuition:
size, churn (git log --since=<months> --name-only | sort | uniq -c), and panic/unsafe density (grep counts of unwrap/expect/panic per file). Then read the repo's own DEFECT HISTORY — a FIXES.md-style ledger, CHANGELOG, handoff notes. A defect the ledger marks fixed is off limits to re-report (spot-checking that its fix is present is welcome); a gap it marks deferred is a finding only beyond its stated deferral.
- Partition by CONCERN, one agent per area, disjoint file lists: trust/IPC
boundaries, capture/privacy, per-frame hot paths, state & concurrency, input, config/startup & process spawning, FFI/unsafe, hardware/backend, frontend/UI. The panic-density counts from step 1 set each brief's focus (a file with 140 unwrap sites is a panic-reachability classification job). Name the files each agent may cross-check but not edit.
- Start the repo's mechanical gate first (its lint/typecheck/test steps) as
a background job, before dispatching reviewers.
- Dispatch every review agent in ONE delegate_task call. Each brief:
read-only (no edits, no builds — see pitfalls), read assigned files in full, findings schema = severity (critical/high/medium/low), category, file:line, the code quoted as evidence, suggested fix, and a confirmed flag (true = you read the code and are sure). Full report to /tmp/<area>.md; final message = top findings plus a coverage line (read fully / skimmed / skipped). Point every brief at the defect ledger from step 1.
- Classify gate failures while they run: re-run a red test with the
documented environment workaround before calling it a product bug. One failing test often aborts a whole-suite run, leaving later crates unrun — re-run to completion before judging the gate red or green.
- Consolidate: dedupe findings reported by more than one area; spot-check
every critical/high finding against the real source yourself; mark findings [verified] vs [agent-reported].
- Report: gate status; findings by severity; an explicit list of what was
checked and found CLEAN (the assurance half of an audit is what proves the rest is trustworthy); coverage gaps (paths never read, runtime-only behavior not exercised).
- Fix wave on request: hand the finding groups to
parallel-agent-worktrees — one worktree per concern area, the same disjoint file lists, each fix brief citing its audit report file for detail. Enumerate each brief's findings WITH the recommended fix: the enumerated list is authoritative for scope, the report file is for depth. Where a finding offers options, the parent picks one and states the decision in the brief — children must not re-litigate it. Unconfirmed findings travel as verify-first, with a requirement to report what the verification found.
Pitfalls
- Review agents' claims are self-reports. Never present an unverified
finding as fact: spot-check every critical/high against the real source and label the rest agent-reported.
- Two agents contradicting each other on exploitability is normal (one read
the guard, the other the caller). Settle it by reading the VALIDATING layer's source at the pinned dependency version — the vendored checkout under the package cache — not by adopting the scarier report.
- Ban builds in review children. Parallel cargo/npm invocations contend on
the build lock and starve the gate the parent is running; children read, the parent compiles. The fix wave (which must build) goes in per-child worktrees with their own build dirs instead.
- One report file per agent, capped summaries. A single merged findings doc
floods the parent's context; per-agent files plus a top-N summary keeps both halves usable.
- A confirmed=false finding still belongs in the report — labelled, and the
fix-wave agent verifies it before changing behavior around it.