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.
git clone --depth 1 https://github.com/CBirkbeck/mathlib-qualityWrote 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.
[](https://agentmods.dev/commands/cbirkbeck/mathlib-quality/cleanup-all)<a href="https://agentmods.dev/commands/cbirkbeck/mathlib-quality/cleanup-all"><img src="https://agentmods.dev/badge/commands/cbirkbeck/mathlib-quality/cleanup-all/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.
<a href="https://agentmods.dev/commands/cbirkbeck/mathlib-quality/cleanup-all"><img src="https://agentmods.dev/badge/commands/cbirkbeck/mathlib-quality/cleanup-all.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00120 | $0.04903 |
| Opus 5.5 | $0.00048 | $0.01961 |
| Sonnet 5.5 | $0.00024 | $0.00981 |
| Haiku 4.5 | $0.00012 | $0.00490 |
Grade A, and why
cleanup-all 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.
How it starts
The opening of the file, as written. The whole thing — 489 lines — stays where its author put it; the contents beside it link to each section on GitHub.
/cleanup-all — Project-Wide Cleanup (Orchestrator Mode)
Run the full /cleanup workflow over every .lean file in the project, sustained
across hours or days, without exhausting the orchestrator's context.
The trick: the main session is an orchestrator, not an implementer. The
orchestrator dispatches batched Agent calls, each with a tight prompt and a
concrete target, then narrates progress in one-line scoreboards between
dispatches. The file reading, the LSP calls, the edits, and the per-declaration
golf all happen in subagent contexts — each starts fresh, does its batch,
returns a summary. The orchestrator never holds the work in its own context.
This pattern was observed in a real production session that ran for 28 days across 23 active days, dispatched 395 Agent calls, spawned 790 subagent contexts (workers spawning sub-workers), and survived 3 auto-compactions without losing the through-line. The mechanism is the orchestrator/worker split, not heroic context management.
Usage
/cleanup-all [directory]
If no argument, processes all .lean files under the project root (excluding
.lake/, build/, .git/).
The orchestrator's role (binding)
You are the orchestrator. Your job is to dispatch and track. You do NOT:
- Read project
.leanfiles — workers do that, they need the fresh context for it - Run
lean_diagnostic_messages,lean_goal,lean_multi_attempt, or anylean_*LSP query - Use
EditorWriteon project files - Run
lake buildyourself (workers do that as the first check of every batch) - Spot-check the worker's diff or rerun their LSP queries
You DO:
- Enumerate files (one
findcall, once) - Bucket files by size for batched dispatch
- Dispatch
Agentcalls following the verbatim prompt template below - Maintain a one-line scoreboard between dispatches
- Collect per-batch summaries from the workers' reports
- Dispatch one final verification Agent at the end
- Print the consolidated report at the very end
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.
- 1mo ago First seen · 489 lines · 120 tokens per session scan A db7e5785d936
cleanup-all is a command published in the GitHub repository CBirkbeck/mathlib-quality (35 stars, last pushed 5d ago), licensed MIT. It adds 120 tokens to every session and 4,903 once invoked, about $0.0005 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.
Other commands, from other repositories
safe-debug
Run Rigor Debug on a research repository failure before patching.
ctp-doctor
Check CellTypePilot environment — dependencies, capabilities, MCP status.
thesis-fallback-log
View thesis workflow fallback history showing tier switches, reasons, and quality impact.
gpd:debug
Systematic debugging of physics calculations with persistent state across context resets.
qa-changes
This skill should be used when the user asks to "QA a pull request", "test PR changes", "verify a PR works", "functionally test changes", or when an automated workflow triggers QA validation of code changes. Provides a structured methodology for setting up the environment, exercising changed behavior, and reporting…
doctor
Diagnosticar y reparar problemas del framework Don Cheli, git y entorno. Usa cuando el usuario dice "doctor", "problemas del framework", "don cheli no funciona", "repair Don Cheli", "debug setup", "setup broken", "framework broken", "reparar entorno". Detecta y repara issues de configuración, git y dependencias…