MechanismsPlugins
code-review plugin
Multi-agent partitioned code review with deterministic hygiene checks, risk-based routing, caching, and GitHub PR inline comments.
The code-review plugin runs automated code review on a branch, a staged change, specific files, or a GitHub PR.
Command
claude /code-review:start [scope] [--github] [--hygiene-only] [--base <ref>] [--since-last-review] [--full-review]Scopes:
- no argument — review the current branch vs main
staged— review staged changesfile1 file2 ...— review specific files123— review PR #123
Flags:
--github— CI handoff mode, posts inline comments viagh--hygiene-only— run only the deterministic hygiene pass--base <ref>— override the base ref--since-last-review— incremental review since the last stored review hash--full-review— ignore the incremental cache
How it works
- Hygiene pass — deterministic checks (file size, trailing whitespace, TODO density, and so on).
- Partitioning — splits the diff into partitions for parallel review.
- Risk-based routing — picks models for each partition based on risk signals.
- Parallel review — launches
code:code-review-workersubagents concurrently withrun_in_background: true. - Finding collection — aggregates findings into
code-review-findings.json. - Validation — runs Pydantic validation (reusing
validate_judge_report.pyfromjudges). - Summary and verdict — writes
code-review-summary.mdandverdict.json(approve | needs_attention | changes_requested). - GitHub posting (
--github) — posts inline comments and a summary comment to the PR viagh, resolves outdated threads.
Caching
- Hash-based cache — findings are keyed by a hash of the diff, so re-running on the same diff is instant.
- Incremental —
--since-last-reviewonly reviews new changes since the last cached review. - Session work directory —
.closedloop-ai/code-review/cr-<random>/.
Outputs
| File | Purpose |
|---|---|
code-review-findings.json | Validated inline findings. |
code-review-threads.json | Outdated review thread IDs to resolve. |
code-review-summary.md | PR summary comment. |
verdict.json | Final verdict. |
Dependencies on other plugins
code:code-review-workerandcode:code-review-guidelines— subagent and guidelines bundle.judges— reusesvalidate_judge_reportandJUDGE_REGISTRYbysys.pathimport.
Python tooling
plugins/code-review/tools/python/code_review_helpers.py exposes a 20-plus subcommand CLI:
setup parse-diff hygiene partition route validate compute-hashes
cache-check cache-update auto-incremental finalize-cache
review-state-read review-state-write post-comments resolve-threads
session-tokens footer resolve-scope fetch-intent classify-intent
collect-findings verdict prep-assets extract-patchesFix skill
The code-review:fix skill (under skills/fix/) provides a remediation playbook when you want an agent to address the findings.
When to run
- On every PR via CI (the
--githubflag is designed for this). - Locally before pushing, to catch issues before they hit the PR.
- Incrementally during development to review the current branch.
Use --since-last-review in long-lived branches to avoid re-reviewing unchanged code.