self-review

self-review is a command for Claude Code from CBirkbeck/mathlib-quality. It costs 109 tokens per session (5,515 once invoked), scanned A, original, MIT.

A command that has fresh review agents inspect your changes in several rounds before a pull request, then applies their suggestions.

In plain words
What is it for?
Use it to review Lean proofs and code repeatedly before submitting a pull request.
Why use it?
It reduces the risk of overlooking poor names, unnecessary definitions, weak generalisation, or missed automation because the author is reviewing their own work.

Command for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions CLAUDE.md.

Part of the mathlib-quality plugin — 2 skills, 24 commands, 2 hooks shipped together

Good fit Use it to review Lean proofs and code repeatedly before submitting a pull request.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/cbirkbeck/mathlib-quality/self-review
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.

Clone the repo
git clone --depth 1 https://github.com/CBirkbeck/mathlib-quality

Made for: Claude Code.

Or install mathlib-quality, the plugin that ships this one along with the rest of its 2 skills, 24 commands, 2 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for self-review

README.md
[![agentmods](https://agentmods.dev/badge/commands/cbirkbeck/mathlib-quality/self-review/github.svg)](https://agentmods.dev/commands/cbirkbeck/mathlib-quality/self-review)
Your own site
<a href="https://agentmods.dev/commands/cbirkbeck/mathlib-quality/self-review"><img src="https://agentmods.dev/badge/commands/cbirkbeck/mathlib-quality/self-review/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for self-review

Your own site · 80×15
<a href="https://agentmods.dev/commands/cbirkbeck/mathlib-quality/self-review"><img src="https://agentmods.dev/badge/commands/cbirkbeck/mathlib-quality/self-review.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 109 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,515 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00109 $0.05515
Opus 5.5 $0.00044 $0.02206
Sonnet 5.5 $0.00022 $0.01103
Haiku 4.5 $0.00011 $0.00551

Measured 1mo ago against content hash 30c82b6455d8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

self-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 1mo 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.

commands/self-review.md · 395 lines

How it starts

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

/self-review — Independent, Multi-Round Self-Review Before PR

Review your own changes the way a good external reviewer would — by not being the instance that wrote them. /self-review spawns a fresh, neutral review agent each round, reports its findings to you, implements every suggestion it makes, reports what changed, and relaunches for the next round. It runs a fixed number of rounds (default 3) and stops there, even if the code still isn't perfect.

The whole point is structural objectivity. The instance that wrote a proof is the worst judge of whether it is well-named, well-generalised, or best closed by automation — it is anchored on the choices it already made. So the reviewer is a separate agent, spawned fresh every round, with no access to the author's rationalisations and no stake in the existing code. The driving instance (you) is the implementer, not the reviewer, and implements what the independent reviewer asks.

Non-negotiable rules

  • The reviewer is a fresh, independent agent every round. A new Agent dispatch per round — not SendMessage continuity — so no round is anchored on the previous one and no reviewer has an ego stake in comments it made last time. Never let the implementer grade its own homework.
  • Exactly N rounds. One round = one review + one implementation. Default N = 3. The loop terminates after the Nth implementation, even if findings remain. N is a hard cap, not "until perfect".
  • The round number never changes the reviewer's standard. On the final round the reviewer reviews exactly as it would on the first. It does not declare the code done, soften findings, or withhold warranted feedback because the review budget is ending. Termination is the loop's decision, never the reviewer's.
  • Implement every suggestion. The implementer applies all of the reviewer's requested changes. The only thing it may decline is a change it cannot make without breaking the build or introducing an error — and even then it must be attempted, reverted, and documented for the next round, never silently skipped. Disagreement is not grounds to skip: defeating the author's bias is the entire reason the reviewer is separate.
  • Report twice per round. First report the reviewer's requested changes to the user; then, after implementing, report a summary of what changed. Both are mandatory, both in chat.
  • Feedback lands on the PR thread when there is one. If the branch has an open PR, each round's findings are posted as a PR comment; otherwise they are reported in chat only.
  • No commits, no pushes. /self-review edits the working tree and (optionally) comments on the PR. Committing and pushing stay with you, /pre-submit, or /fix-pr-feedback.

Read the full file on GitHub · 395 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. 1mo ago First seen · 395 lines · 109 tokens per session scan A 30c82b6455d8

Subscribe to this mod's changes

self-review is a command published in the GitHub repository CBirkbeck/mathlib-quality (35 stars, last pushed 5d ago), licensed MIT. It adds 109 tokens to every session and 5,515 once invoked, about $0.0004 per session on Opus 5.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.