diff-review

A command that reviews a Git difference, meaning the changes between versions of a project, file, branch, or commit range.

In plain words
What is it for?
Use it on staged or working-tree changes, a file or directory, or a branch or commit range. It checks the surrounding code only when needed to understand a change.
Why use it?
It helps catch bugs, dead code, unfinished work, and edge cases in the exact changes being considered before they are merged.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/hamr0/liteagents/diff-review
Clone the repo
git clone --depth 1 https://github.com/hamr0/liteagents
Per session 13 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 983 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00013 $0.00983
Opus 5 $0.00006 $0.00491
Sonnet 5 $0.00003 $0.00197
Haiku 4.5 $0.00001 $0.00098

Measured 2d ago against content hash e3338b5733ef, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

diff-review scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

packages/ampcode/commands/diff-review.md · 79 lines

How it starts

The opening of the file, as written. The whole thing — 79 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Review $ARGUMENTS. Interpret in this order:

  1. Empty → staged diff (git diff --staged); if empty, working-tree diff (git diff).
  2. A range like main..HEAD or origin/main...HEADgit diff <range>.
  3. A single ref (branch / tag / SHA — confirm with git rev-parse --verify) → diff that ref's merge-base against HEAD (i.e. everything on the current branch since it diverged: git diff $(git merge-base <ref> HEAD)..HEAD). This is the common "review my branch before merging" path.
  4. A file or directory path → that target.
  5. Otherwise → ask.

The diff is the subject; widen to surrounding code only as needed to judge a hunk. For multi-commit ranges, also skim git log <range> to understand intent before judging.

Check For

  • Bugs needing a fix. Logic errors, off-by-one, null/undefined paths, races, wrong defaults, broken edge cases. Concrete failure modes only — not vibes.
  • Dead code. Unreferenced functions / vars / imports / params, unreachable branches, commented-out blocks, legacy paths the diff just obsoleted. git grep the symbol before flagging — easy to be wrong.
  • Loose ends. TODO / FIXME / XXX added by this diff, half-finished branches, silently swallowed errors, stub bodies, mocked-out paths, "temporary" names, abandoned feature flags.
  • Correctness. Edge cases, error handling, type / contract violations, broken invariants.
  • Security. OWASP Top 10, auth, data exposure. (/security for depth.)
  • Performance. N+1, blocking calls in hot paths, unbounded loops, indexes the diff actually touches.
  • Maintainability. Complexity, naming, duplication — only when material.

Output Format

🚨 Critical (blocks merge)

⚠️ Warnings (should fix)

💡 Suggestions (nice to have)

Each finding: Location (file:line), What's wrong, Why it matters, Concrete fix — not "consider improving".

After the review — verify, then fix

Findings are claims, not facts. Validate before acting; validate again after.

Read the full file on GitHub · 79 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 79 lines · 13 tokens per session scan A e3338b5733ef

Subscribe to this mod's changes

diff-review is a command published in the GitHub repository hamr0/liteagents (22 stars, last pushed 3d ago), licensed Apache-2.0. It adds 13 tokens to every session and 983 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.