/mathlib-quality:pre-submitfrom mathlib-quality
Runs a structured pre-submission checklist for mathlib PRs, verifying compilation, file quality, code quality, documentation, linter compliance, and PR metadata. Reports NOT READY FOR SUBMISSION on any hard-stop failure.
Ships in mathlib-quality. Installing the plugin adds it to Claude Code.
Final verification before submitting a PR to mathlib.
/pre-submit [file_path or directory]
/pre-submit --reset-intake (re-ask the Step 0a chain questions and rewrite the session file)
On Tau Ceti, use
/tauprinstead. It is the same discipline specialised to that repo's actual mechanics —tauceti-reviewon your own subscription, contests in the rubric thread,--force-with-leasepushes, target markers and author claims, scoreboard polling./pre-submitstays the generic checklist for mathlib and everything else.
example probe)lake build succeeds without errorssorry removed#check, #print, #eval debugging statementsFor each modified file:
simp (use simp only)set_option maxHeartbeats (a proof that needs one is slow — run /buzz to
diagnose and fix it; never raise the limit)set_option trace.*set_option pp.*@[nolint] is justifiedfeat/fix/refactor/docs(area): description--no-post), not on an open PRgh pr createEach step has a required artifact (a status block) and a hard-stop condition.
Skipping a step is detectable in the missing artifact; the per-step status blocks roll up
into the final report. Hard-stop on any step means /pre-submit reports NOT READY FOR SUBMISSION — the user has to fix the issue before re-running.
The observed failure mode is specific and worth naming, because it does not look like skipping from the inside: a worker runs the early steps, then opens a PR and waits for the server reviewer instead of running Step 8 locally. It feels like progress — the PR exists, CI is running, there is something to watch — which is exactly why instruction text alone does not prevent it. Three mechanisms, in increasing order of strength:
Required artifacts. Every one of the 10 steps must appear in the final report with
its status block filled in. n/a: <reason> is valid for Steps 0 and 8; blank is
not. A missing block means the step did not run — treat it as FAIL on that step and
re-dispatch, exactly as /cleanup-all re-dispatches a worker whose phase checklist has
holes.
Cited tool-call gates. Steps 1, 3, 7 and 8 are cited gates: the artifact must carry the literal invocation and its exit status, not a summary. "Build passed" is not an artifact; the command and its exit code are. A worker that cannot produce the citation did not run the gate.
The PR gate hook. gh pr create is mechanically blocked until Step 8's receipt is
green for the current commit (see Step 8). This is the only mechanism that does not
depend on the worker's compliance, and it is why the workflow holds up under a long
chain of PRs where attention drifts.
Forbidden substitutions, each of which has been observed standing in for Step 8:
| Instead of Step 8, the worker... | Why it doesn't count |
|---|---|
| opens the PR and waits for the server review | That is the thing the workflow exists to avoid — it spends a review round on findings readable locally |
runs gh pr checks --watch | Watches CI, not the review rubric; different gate |
| reasons about what the reviewer will probably say | The engine is cheap to run; a prediction is not a result |
| reuses a green receipt from the previous PR in the chain | The receipt is bound to one head_sha; the hook rejects it |
| checks open PRs at Step 0b only, hours before creating | The list moves while you work — that's the window the duplicate slips through |
None of these produce a receipt, so none of them open a PR.
Only applies to projects whose roadmap names upstream sources (research repos, sibling
formalisation projects). Skip with n/a: no roadmap for a plain mathlib PR.
Step 0a — Chain intake: asked ONCE, then persisted.
A PR chain shares its provenance. Re-asking the same three questions on every branch is noise, so the intake is chain-scoped state, not a per-run prompt.
First, look for .mathlib-quality/pr-session.json.
If it exists → ask nothing. Load it, echo what is being reused, and continue:
[Step 0a] Intake (reused from chain session, started <date>):
Chain goal: <what this run of PRs is collectively delivering>
Roadmap area: <the layer / target family these PRs land in>
Source: <repo + license + pinned revision, or "original work">
This PR: <one-line description — DERIVED from the branch diff, not asked>
Target marker: <specific marker — DERIVED from the roadmap area + this diff>
(Re-ask with `/pre-submit --reset-intake`.)
If it is absent → ask the three questions, once, and write the file. Use
AskUserQuestion, offering inferred candidates as options (branch name, changed files,
the roadmap's open targets) but letting the user correct them:
references/tauceti.md.)Then write:
{
"chain_goal": "<answer 1>",
"roadmap_area": "<answer 2>",
"source": {"repo": "<...>", "revision": "<...>", "license": "<...>"},
"started": "<ISO date>"
}
This file is also the sentinel that arms the PR gate (see Step 8) — without it the
gh pr create hook is inert, so writing it is what opts the chain into enforcement.
What is derived, never asked. Per branch, the one-line description of this PR and its specific target marker come from the diff plus the chain's roadmap area. State them in the artifact; do not prompt. Only the three chain-level facts above ever require the user, and only once.
Re-ask only when the chain changes. --reset-intake re-runs the questions and
rewrites the file — use it when the source or roadmap area actually changes, not per PR.
Step 0b — Verify against those answers. This is a retrospective check — the source
work should have happened before the code was written (references/pr-workflow.md § 0).
What /pre-submit verifies is that the named source was actually used and that new
declarations are genuinely new:
Open PRs count as sources. A declaration can be absent from main, absent from
mathlib, and still already written — sitting in someone's open PR, or in your own earlier
branch from this same chain. Step 6 of the workflow deliberately keeps several branches in
flight at once, which is exactly what makes this collision likely rather than theoretical.
gh pr list --state open --json number,title,headRefName,files,body --limit 100
Compare against what this branch introduces, in descending order of sharpness:
Prefer the project's native dedup where one exists. On Tau Ceti the mechanism is not a
heuristic: PRs carry <!--tauceti-target:v1 {"focus":..,"id":..}--> and authors take a
author/<focus>/<target-id> claim ref before writing. Match on that marker id and the
question is settled — the duplicate sweeper itself closes a newer duplicate only when both
PRs carry the same marker, keeping the lower number. A PR without the marker is invisible
to dedup, so emitting it is part of not-duplicating. See references/tauceti.md.
Where no such mechanism exists, fall back to these signals:
| Signal | Why it matters |
|---|---|
| Same roadmap target marker | Two PRs claiming one target is a direct duplicate — the sharpest signal, check it first |
| Same declaration names | The same lemma under the same name, written twice |
| Same files touched | Not duplication by itself, but predicts a merge conflict and is worth knowing |
| Same source + same section ported | Two branches porting one chunk of the upstream repo |
An overlap is not automatically fatal — a deliberate follow-up to your own open PR is fine — but it must be resolved before writing more code: rebase onto the open branch, narrow this PR's scope, or close the older one. Record the decision.
The source sweep is a cited gate too. "Checked FLT ✓" is not an artifact — it is a box.
Per source, the block below must carry the pinned revision (a worker who never cloned
cannot produce one) and the literal queries run. The six-step method, and the table of
things that don't count as a sweep, are in references/pr-workflow.md § "The source
sweep": pin and clone, read the index before grepping, search three vocabularies (yours,
the source's, and the operator that cannot be renamed away), read the neighbourhood rather
than the hits, check whether your result is a step inside a bigger proof, then port rather
than rederive.
[Step 0b] Sources before code:
Roadmap sources checked: <list, or "n/a: no roadmap">
per source:
<repo>@<sha> index read: <blueprint/dep-graph/docstrings/README — which>
queries: <the literal greps, all three vocabularies>
modules read: <paths — the neighbourhood, not just hits>
sub-lemma check: <bigger proof read, or "n/a: none applies">
verdict: <absent / present → ported / present → adapted>
Named source used: <yes — ported from <source>@<sha> / n/a — original work>
Open PRs examined: <#N, #M, ... — or "(none open)">
Overlaps found: <none / #N: <kind> — <resolution>>
New decls in this branch: N
Ported (provenance recorded): M — source repo + license + revision + decl names
Believed absent from mathlib: K
- untruncated full-name grep run: <yes / no>
- compiled `example` absence probe: <yes / no>
Result: <PASS> / <FAIL — K decls claim mathlib-absence without the compiled probe>
<FAIL — unresolved overlap with open PR #N>
<FAIL — source swept without a pinned revision or without recorded queries>
Hard stop on an unresolved overlap. "I'll mention it in the PR body" is not a resolution; the duplicated work still exists.
Hard stop on a source claimed as swept without repo@sha and its queries. A sweep you
cannot cite is a sweep that did not constrain what you wrote.
Hard stop if any declaration claims mathlib-absence on a search-only basis. A name
grep plus a statement grep, both clean, still let three duplicates of mathlib results
through in one file — mathlib supplies facts generically via typeclasses and
auto-generated lemmas that appear as text nowhere. See references/mathlib-search.md
§ "Proving absence is a compile-checked claim".
lake build 2>&1 | tee /tmp/pre-submit-build.log
Print the artifact:
[Step 1] lake build: <PASS — exit 0, 0 errors, N warnings>
OR
<FAIL — exit X, M errors; see /tmp/pre-submit-build.log>
Hard stop on FAIL. The project must compile before any further check makes sense.
/cleanup [modified_files]
/cleanup runs its full 11-phase workflow — Doctor (Phase 0) → audit → file-level fixes →
per-decl golf → refactoring (5a + 5b) → final verification → simplify pass → buzz
performance pass → report. Capture /cleanup's Phase-7 report and embed its summary here:
[Step 2] /cleanup: <PASS-CLEAN — diagnostics clean, all gates pass, simplify pass-through, buzz FAST-BOARD>
<PASS-WITH-CHANGES — N issues fixed; gates clean; simplify fixed M things; buzz fixed K slow decls>
<FAIL — /cleanup ended in Overall: FAIL on gate <name>>
Hard stop on FAIL. Do not proceed if /cleanup couldn't reach a clean state.
If /cleanup was already run this session (e.g., the user ran it manually), confirm
its Phase-7 report is dated within this session and re-run if not.
lake exe runLinter [modified_files] 2>&1 | tee /tmp/pre-submit-linter.log
[Step 3] runLinter: <PASS — 0 errors, 0 warnings>
<PASS-WITH-NOLINT — 0 errors; N suppressed via @[nolint], all justified>
<FAIL — N errors; see /tmp/pre-submit-linter.log>
Hard stop on FAIL. Linter errors block CI; fix or justify with a @[nolint] (and
record the justification — bare suppression without reason is itself a defect).
Grep the modified files (or whole project) for forbidden patterns:
grep -rn "sorry\b" --include="*.lean" .
grep -rn "^\s*#\(check\|print\|eval\|reduce\)\b" --include="*.lean" .
grep -rn "set_option \(trace\.\|pp\.\|maxHeartbeats\|maxRecDepth\)" --include="*.lean" .
grep -rn "^\s*axiom \|^\s*constant " --include="*.lean" .
Required artifact:
[Step 4] Debug-artifact scan:
sorry: <count> — files: <list, or "(none)">
#check / #print / #eval / #reduce: <count> — locations: <or "(none)">
set_option (trace/pp/maxHeartbeats/maxRecDepth): <count> — locations: <or "(none)">
axiom / constant declarations: <count> — locations: <or "(none)">
Result: <PASS — all counts zero>
<FAIL — list non-zero categories>
Hard stop on any non-zero count unless:
set_option linter.* false in <decl> is the only set_option (acceptable when
justified with a comment explaining why).axiom).For every public theorem in the modified files:
#print axioms decl_name
Acceptable axioms: propext, Quot.sound, Classical.choice. Anything else (especially
sorryAx) is a defect.
[Step 5] Axiom check on public decls:
Total decls checked: N
Standard axioms only: M
Hidden sorryAx found: <count>; decls: <list>
Other unexpected axioms: <count>; decls: <list>
Result: <PASS — only standard axioms> / <FAIL — see lists>
Hard stop on any sorryAx. A sorryAx in a "public" theorem means a have somewhere
in its proof has sorry — a hidden incomplete proof. Find and prove it.
For each public declaration in modified files:
[Step 6] Public-API documentation:
Total public decls: N
With docstring (1+ sentence): M
Missing docstring: <count>; decls: <list>
Result: <PASS — every public decl documented> / <FAIL — list missing>
Hard stop on missing docstrings for theorem / def / structure / class. Helper
lemmas (private / _aux suffix) should NOT have docstrings — that's a separate check
already done by /cleanup Phase 4.
lake build 2>&1 | tee /tmp/pre-submit-build-final.log
[Step 7] lake build (final): <PASS / FAIL>
Hard stop on FAIL. This re-checks after Step 2's /cleanup may have made changes.
Applies to projects gated behind a scriptable reviewer (an AI review bot, a scope/roadmap
checker, a house-rules linter). Mathlib has a human review queue rather than a scriptable
rubric — record n/a: no scriptable review engine there.
Never open a PR that has not already passed the review rubric locally. A review engine
that accepts a diff on a flag does not need a PR to exist: if it takes --diff-file /
--pr-desc-file / --no-post, it runs against a local branch with nothing on GitHub.
Know which layer you are driving — they differ. On Tau Ceti (verified against
TauCetiReview, see references/tauceti.md):
| Layer | Pre-PR? | Notes |
|---|---|---|
tauceti-review <PR#> (documented CLI) | No — pr is a required positional and the head/diff/description are fetched from GitHub | Defaults to a dry run already; --post is the opt-in. Value is running on your subscription instead of metered API keys |
runner/review.py (inner engine) | Yes | This is the layer with --diff-file / --pr-desc-file / --no-post, against a staged --tool-cwd (code/, roadmap/, mathlib/) plus --store / --rubrics-dir. --pr is required but need not name a live PR when the diff and description come from files |
So the pre-PR dry run is real, but it is the inner engine, not the documented command.
A worker that reaches for tauceti-review will find it wants a PR number — that is
expected, not a reason to give up and open the PR. If you deliberately choose the
post-PR flow instead, PR_GATE_OVERRIDE=1 lets the PR through and the review happens
after; you then owe the same iterate-until-green loop on the open PR.
Stage what the engine reads, then invoke it with --no-post (and whatever its manual mode
is). Nothing touches GitHub:
| Item | Contents |
|---|---|
code/ | git archive of the branch head — not the dirty working tree |
| roadmap clone | a fresh clone; a stale checkout yields a false scope BLOCK |
mathlib/ | symlink to the project's pinned .lake/packages/mathlib |
diff.txt | merge-base diff vs the base branch, not a two-dot diff |
pr_desc.txt | the PR body you intend to use |
This is a cited tool-call gate, in the sense /cleanup's build gates are: the artifact
is the actual invocation and its exit status, not a claim that it went well.
[Step 8] Local review-rubric dry run:
Engine + invocation: <the literal command run, or "n/a: no scriptable review engine">
Exit status: <code>
Reviewed commit: <git rev-parse HEAD>
Round count: N
Rubrics: <name: green|red, one per rubric — every rubric named>
Remaining findings: <list, or "(none)">
Result: <PASS — every rubric green> / <FAIL — list non-green rubrics>
Hard stop on FAIL. Iterate Step 8 until every rubric is green — re-running the earlier
steps as fixes require — and only then gh pr create. At that point the PR is known to
pass, because it already has.
gh pr create)On a green run, write .mathlib-quality/review-receipt.json:
{
"head_sha": "<git rev-parse HEAD — the exact commit reviewed>",
"all_green": true,
"rubrics": {"<rubric name>": "green", "...": "green"},
"invocation": "<the literal engine command>",
"exit_code": 0,
"rounds": 3,
"timestamp": "<ISO>",
"duplication_check": {
"checked_at": "<ISO — must be recent; the open-PR list moves while you work>",
"open_prs_examined": [12, 13, 14],
"overlaps": []
},
"source_sweep": [
{"repo": "github.com/org/FLT", "revision": "<full sha>",
"queries": ["<literal grep 1>", "<literal grep 2>", "<literal grep 3>"],
"verdict": "absent"}
]
}
source_sweep is [] only when the chain's source is genuinely "original work". Otherwise
each roadmap-named source appears with a full revision sha and the literal queries
run — the gate rejects an entry missing either, because a sweep that can't be cited did
not constrain what got written.
Re-run the open-PR check here, not just at Step 0b. Step 0b's check happened before you wrote the code; by the time you are ready to create, hours have passed and — because step 6 keeps a queue of branches moving — other PRs have opened, including your own. This is the check that catches the race.
If an overlap is real but you intend to proceed anyway (a deliberate follow-up to your own open PR, say), record it as acknowledged rather than deleting it, and say why in the PR body:
"overlaps": [{"pr": 13, "kind": "same-files", "acknowledged": true,
"note": "stacked on #13; rebase once it merges"}]
The plugin ships a PreToolUse hook (hooks/pr_gate.sh) that blocks gh pr create
unless this receipt exists, reports all_green: true, carries a fresh duplication check
with no unacknowledged overlaps, and has a head_sha matching the current HEAD. So:
duplication_check, or an unacknowledged overlap → blocked, naming the colliding
PR.PR_GATE_DUP_MAX_AGE_MIN (default 60) → blocked. The
remedy is one gh pr list and a refreshed checked_at; the window exists because a
duplication check is a claim about now, and in a pipelined chain "now" expires fast.The hook is armed by .mathlib-quality/pr-session.json from Step 0a, so it is inert in
any repo not running this workflow. Escapes, for when the gate is wrong rather than you:
PR_GATE_OVERRIDE=1 gh pr create ... for one call, or
touch .mathlib-quality/pr_gate_disabled for the repo. It fails open on infrastructure
trouble (no python3, not a git repo, unreadable receipt) — a broken gate must never wedge
you out of your own repo.
Do not write the receipt by hand to get past the gate. The receipt asserts the rubric ran and passed; fabricating it converts a mechanical guarantee back into an honour system, and the next thing that happens is a server review round you already paid for locally.
For API-design questions (which shape the reviewer will prefer), ask the same model
beforehand via the ask_chatgpt_math MCP rather than discovering the preference in
round four.
The PR body must carry the roadmap attribution line, the exact layer/target, full provenance (source repo, license, pinned revision, file and declaration names), and the project's machine-readable target marker — kept in sync with the code, since a drifted body is itself a review finding.
Waiting on review is not a reason to stop working.
[Step 9] Pipeline status:
PR watch: <10-min cron on open PRs, reading scoreboard states/head_sha>
Next candidates: <branches queued through Steps 0–8>
Read the scoreboard states / head_sha, never the label — labels lag and lie. Between
server rounds, take the next candidates through Steps 0–8 locally so a queue of
locally-green branches is always ready while the earlier ones merge. Advisory only: it
never blocks submission of the current branch.
## Pre-Submit Check: [project/files]
[Step 0] Intake + sources: <PASS / FAIL / n/a: no roadmap>
└ contributing / target / source: <one line each, from Step 0a>
[Step 1] lake build: <PASS / FAIL>
[Step 2] /cleanup: <PASS-CLEAN / PASS-WITH-CHANGES / FAIL>
[Step 3] runLinter: <PASS / PASS-WITH-NOLINT / FAIL>
[Step 4] Debug-artifact scan: <PASS / FAIL>
[Step 5] Axiom check: <PASS / FAIL>
[Step 6] Public-API documentation: <PASS / FAIL>
[Step 7] lake build (final): <PASS / FAIL>
[Step 8] Local review-rubric: <PASS / FAIL / n/a: no scriptable review engine>
[Step 9] Pipeline status: <advisory — never blocks>
### ✓ Build Status (Step 1 + 7)
- Compilation: ✓ Successful (initial + final)
- Warnings: 0
- Errors: 0
### ✓ Cleanup Result (Step 2)
- /cleanup Overall: pass
- Issues fixed across phases: <count>
- Simplify-pass outcome: <pass-through / issues-found-and-fixed>
### ✓ File Quality (collected from /cleanup Phase 7 + Step 6)
| File | Lines | Max Line | Header | Docstring (% public) |
|------|-------|----------|--------|----------------------|
| Foo.lean | 234 | 98 | ✓ | 100% |
| Bar.lean | 456 | 95 | ✓ | 100% |
### ✓ Debug-artifact scan (Step 4)
- sorry: 0 found
- #check / #print / #eval: 0 found
- set_option (debug): 0 found
- axiom / constant: 0 found
### ✓ Axiom check (Step 5)
- Public decls inspected: N
- Standard axioms only: N
- sorryAx: 0
- Other unexpected: 0
### ✓ Documentation (Step 6)
- Public declarations: 15
- With docstrings: 15
- Missing: 0
### ✓ Linters (Step 3)
- Errors: 0
- Warnings: 0
- @[nolint] suppressions: <count, with one-line justification per>
### Ready for submission: ✓
---
To submit:
1. Create branch: `git checkout -b feat/foo-bar`
2. Commit changes: `git commit -m "feat(Algebra): add FooBar lemmas"`
3. Push: `git push -u origin feat/foo-bar`
4. Create PR via GitHub — on a review-gated repo, only after Step 8 is green
Ready for submission: ✓ is printed only when every step's artifact reports PASS (or
PASS-WITH-CHANGES / PASS-WITH-NOLINT). A single FAIL elsewhere means the report ends with:
### NOT READY FOR SUBMISSION
Failing steps:
- [Step N] <step name>: <one-line reason>
Run /cleanup to fix code-quality issues. Address linter errors. Add missing docstrings.
Re-run /pre-submit when fixed.
Required-artifact discipline: if any of the 10 step blocks is missing from the report,
that step wasn't run — that's a /pre-submit defect, treat as FAIL on that step. n/a
with a stated reason is a valid artifact for Steps 0 and 8; blank is not.
✗ Found sorry at:
- Foo.lean:45
- Bar.lean:123
Action: Complete these proofs before submission
✗ Found debug options:
- Foo.lean:12: set_option trace.Meta.Tactic.simp true
- Bar.lean:34: set_option maxHeartbeats 400000
Action: Remove debug options
✗ Missing docstrings:
- Foo.lean:67: def importantFunction
- Bar.lean:89: theorem keyResult
Action: Add docstrings for public API
✗ Linter errors:
- Foo.lean:45: unused argument 'x'
- Bar.lean:67: simp lemma not in normal form
Action: Fix linter errors or add justified @[nolint]
type(scope): description
Types:
- feat: New feature
- fix: Bug fix
- refactor: Code restructuring
- docs: Documentation only
- style: Formatting only
- perf: Performance improvement
- test: Adding tests
- chore: Maintenance
Scope: Area of mathlib (Algebra, Topology, Analysis, etc.)
Examples:
- feat(Algebra/Ring): add comm_ring instance for Foo
- fix(Topology): correct definition of LocallyCompact
- docs(Analysis/Calculus): improve docstrings for derivative lemmas
- refactor(Data/List): simplify proof of length_append
references/style-rules.mdreferences/naming-conventions.mdreferences/linter-checks.mdreferences/pr-workflow.mdreferences/mathlib-search.mdAfter completing the pre-submit check and showing the report, capture any notable findings.
For each significant issue found, write a JSON entry to .mathlib-quality/learnings.jsonl (create the file and directory if they don't exist):
{
"id": "<generate a short unique id>",
"timestamp": "<current ISO timestamp>",
"command": "pre-submit",
"type": "<style_correction|naming_fix|golf_pattern|failed_pattern>",
"before_code": "<the problematic code, max 500 chars>",
"after_code": "<the fix if applied, max 500 chars>",
"pattern_tags": ["<relevant pattern names>"],
"description": "<1-2 sentence description of what was caught in pre-submit>",
"math_area": "<analysis|algebra|topology|number_theory|combinatorics|order|category_theory|measure_theory|other>",
"accepted": true,
"source": "agent_suggestion",
"context": {
"file_path": "<relative path>",
"theorem_name": "<if applicable>"
}
}
What to capture from pre-submit:
What NOT to capture:
/cleanup runsKeep it lightweight - only 1-3 entries per command run, focusing on lessons for future runs.
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub cbirkbeck/mathlib-quality --plugin mathlib-quality24 commands in this plugin
/beastmodeMarathon work session. Pick up a ticket and stop at nothing to discharge it — fill every sorry, develop whatever API is needed, invoke /develop to plan more tickets whenever the path forks, and immediately work those tickets too. The session ends only when the target is fully proven or the work is genuinely outside the project's scope. No depth caps, no time caps, no "this is hard"./blueprintAuthor or update the project's verso-blueprint — a Verso-based Lean module pairing each declaration with its mathematical statement and a paragraph-level proof sketch, producing an interactive HTML dep-graph + progress summary. Uses the standard `leanprover/verso-blueprint` tooling (the one behind verso-sphere-packing, verso-flt, verso-carleson, verso-noperthedron); this skill focuses on authoring high-quality unformalisations. Statements use Verso directives (`:::theorem "label" (lean := "Foo.bar")`), dep-graph edges use `{uses "label"}[]`, math is KaTeX (``$`...` `` inline, ``$$`...` `` display). Lean status (sorry-free vs. in-progress) is auto-computed from the `(lean := …)` reference — no manual `\leanok` to keep in sync. Reads the Lean source, docstrings, project references in `.mathlib-quality/references/`, and any existing `decomposition.md` / `plan.md` artifacts from `/develop`. Per-declaration orchestrator-worker pattern with a final cross-link / `{uses}` validation pass./bump-mathlibBump mathlib version and fix resulting breakage/buzzProfile Lean declarations, find the slow ones, trace-diagnose the root cause, and fix them until each elaborates fast — ideally under a second. Statements never change; maxHeartbeats never goes up./cleanupFull file cleanup to mathlib standards (style audit + golf, methodical, no skipping)/cleanup-allProject-wide cleanup using an orchestrator-worker pattern. The main session is the orchestrator — it does NOT read files, run lean_* tools, or edit. It dispatches batched per-file Agent calls with tight prompts (working dir + branch + build state + sequence + target), then narrates progress in one-line scoreboards between dispatches. Actual work happens in fresh subagent contexts so the orchestrator's context stays light and the session sustains across many hours / days. The proven pattern from a 28-day, 9000-message, 395-dispatch marathon.Other plugins' commands for the same job