diff¶
Review a local git diff: staged changes, a commit range, or a branch comparison.
Usage¶
If ref is omitted, reviews the staged diff (git diff --cached).
Flags¶
| Flag | Description |
|---|---|
--files <pattern> |
Restrict review to files matching a glob pattern |
--format <fmt> |
Output format: markdown (default), json, annotations |
--output <file> |
Output file (default: REVIEW.md) |
--model <model> |
Claude model to use |
--agents <n> |
Number of parallel finder agents |
--focus <areas> |
Comma-separated focus areas |
--estimate |
Print cost estimate and exit without running |
--memory |
Enable memory-augmented review |
--verbose |
Show per-agent debug output |
Examples¶
Review staged changes¶
Review the last commit¶
Review the last N commits¶
Review a branch diff¶
This is equivalent to git diff main..feature/my-branch.
Review specific files only¶
# Only review Go source files
claude-review diff HEAD~1 --files "*.go"
# Only review files in the auth package
claude-review diff --files "internal/auth/**"
Estimate cost before running¶
Output:
Estimated cost for this review:
Diff size: 4,823 chars (~1,206 tokens per agent)
Agents: 5 finders + verifier + ranker
Model: claude-haiku-4-5-20251001
Estimated cost: $0.18 โ $0.32
JSON output for CI¶
GitHub Checks annotations¶
See Output Formats for annotation JSON structure.
Focused security review with Sonnet¶
claude-review diff main..release/v2 \
--focus security \
--model claude-sonnet-4-6 \
--output security-review.md
Memory-augmented review¶
Before sending prompts to finder agents, the memory layer retrieves relevant past findings from the same files and injects them as context. New findings from this run are stored in the memory DB after the review completes.
How ref resolution works¶
| Input | Equivalent git command |
|---|---|
| (none) | git diff --cached (staged) |
HEAD~1 |
git diff HEAD~1 HEAD |
HEAD~3 |
git diff HEAD~3 HEAD |
main..feature |
git diff main..feature |
a1b2c3d |
git diff a1b2c3d HEAD |
Output¶
By default, a REVIEW.md file is written to the current directory. The terminal shows a summary table and the path to the report.