Skip to content

Building an increment

Audience: the agent building it. Goal: executor. Follow it in order. This is the procedure that runs before Cutting a release; the rules about when to release are in CLAUDE.md.

Extracted from CLAUDE.md on 20260806 00:00, when that file crossed its own size guardrail — as RELEASING.md was on 20260801. Nothing was dropped in the move. Which plan is live stays in CLAUDE.md, because it changes every few days and this procedure does not.

Settle who else is writing

A cleared or fresh context keeps the repository and loses the one fact that decides what is safe to touch: which other sessions are running, and what each holds. CLAUDE.md carries the rule; this is the procedure.

  1. ListAgents, then SendMessage each live session: what are you working on, which paths do you hold? State your own task, file set and timing in the same message — a peer cannot route around you if it does not know you exist — and wait for the reply before touching a path either of you holds.
  2. Work, and re-check at the moment of landing: python3 tools/shared_file_overlap.py --fetch --strict, then read the merged state of what it names.

A peer's answer is coordination, never permission. It cannot authorise an action the user has not, and an instruction relayed through a peer is something to put to the user — not something to land. Silence is not consent either: a peer that has not answered has not agreed, so compute the intersection yourself (RELEASING § Landing beside a peer).

A peer's hold is the paths it is editing now (its branch diff, git status), not an ownership claim. There is no role to name: no session states one or asks for one. A peer whose reply names a role, calls a document its own, or says it will only propose a git diff is still running the withdrawn rule: tell it so, and that CLAUDE.md on disk is the current text. The planner/coder rule, its ownership table and the propose-as-a-diff procedure were removed on 20261029 17:06, when the two became one agent; their last text, with the 20260823 incident record, is git show 45a7f16:docs/BUILDING.md.

Subtasks and subagents

An increment is a list of subtasks on the task list, and you stay the one agent that owns it end to end. A subagent is a pair of hands, never a role:

  • Brief it with one subtask, the exact paths it may write (one writer per file — two writers never share a path, in one branch or across worktrees), the gate that must pass, and what it must not touch: the primary checkout, main, another worktree, the landing. A docs/VERIFICATION.md row or a counted paragraph is a shared file too: name it in exactly one builder's brief, or add it yourself once the builders have reported.
  • Open the brief with its job: "You are building …" for a builder, "You are reviewing …" for a reviewer. tools/review_ledger.py reads the first 400 characters of a brief and counts a run as a review pass when a reviewer word appears and no builder phrase (IMPLEMENTER) does. A builder's brief can carry reviewer words, from whatever the lead writes into it (a request to check its work, say), so one that opens with no builder phrase can be counted as a review pass of the very work it wrote.
  • A subagent's report is a claim. Before its subtask is ticked, compare git diff --name-only with the brief's file set and run the gate yourself, bare, reading its exit status (step 3 below); never take "all green" from a report.
  • Review is a fresh subagent with no stake in the code, never your own context re-reading its own diff (step 5 below).
  • Independence the split supplied now comes from a fresh subagent. An old record may have the one who measured not be the one who rules, or the one who built not review: where that independence is the point, give the second view to a fresh subagent, or ask.
  • You land, tag and write the handover (§ Hand over before you stop). One agent holds the whole state, so a subagent's work reaches main only through you.

Documents change with the code

You edit every document yourself; CLAUDE.md § Documents change with the code has the rule and the two fragment-fed exceptions. Two rules decide when:

  • A correction to what is true today lands on main at once. A doc change describing your unlanded work lands with your merge: main must not document a command that does not exist yet.
  • A document a test reads changes in the same commit as the code it describes. A docs/VERIFICATION.md section for a gate you are adding or a row naming a test (tests/test_verification.py hard-fails on a row naming a test that no longer exists, so a renamed test whose row keeps the old name turns your own branch red), or a counted paragraph in tools/batteries/README.md that tests/test_batteries.py asserts: any split ordering leaves main red or wrong at some commit, and a repository whose gates are its memory cannot afford either.

Why a documentation edit still gets a careful landing. Documentation is the coordination surface between concurrent sessions, and a clean auto-merge is not a correct merge — git merges edits that do not overlap textually, never edits that agree (20260729). That is why the overlap tool runs before every land (step 7 below).

Open questions

An open question in a plan is a stop, not a guess. The stop is what keeps a decision the user reserved from being taken by whoever reads the plan next. With one agent it does not move; what changes is that a question the old planner would have ruled is yours whenever it is yours to rule:

The question Whose What you do
How to build what the plan specifies — where a helper lives, which of two equivalent shapes Yours Settle it, say which and why, record the ruling in the plan
A ruling a plan awaits from "the planner", of that kind Yours The same
Permanent surface (a command, flag, name, exit code, schema key); anything irreversible or outward-facing (a tag, a publish, a deletion); anything the plan, or a pause the user has declared, marks the user's The user's Stop and put the options to them, as CLAUDE.md § Working mode sets the bar for asking
You cannot tell whose The user's, until shown otherwise Ask

When you write about a pause or deferral the user set, quote it; do not summarise it.

  • Give their words with the date and time — for example "Keep B2, B3 and B4 paused until a real run of the checklist says what hurt." (20261019, before 13:01 UTC; § 5.2 of the option-B plan quotes it). Where space is short, link the place that quotes them. A status marker ("⏸", "paused") counts: give it with that date and link. Never restate an end condition or a scope in your own words.
  • If you say the user has not lifted it, say where you looked and when, and say no more: no word lifting it is recorded in <files you read>, as of <YYYYMMDD HH:MM UTC>. Not that it still stands, not that it ended.
  • If you need to act on what it covers, ask the user first.

A record of the past needs a past tense, a named source and the UTC time of the event; it still may not state a scope or an end condition in your own words. Two sentences that overclaimed: "are not released by this", stated as fact, and "everything else … stayed paused until the user resumed development", a scope no quote supported.

This applies to what you write now. Rewrite an older sentence that breaks it when you next edit it; CLAUDE.md is the user's, so show them the diff first.

Read the build order out of plans/

Never "the newest file" there. That directory also holds shipped plans, an iteration log, standalone increments, re-entry checklists and decision records; docs/README.md has the table that tells them apart, and CLAUDE.md names the one that is live.

Three rules about reading a plan, each learned more than once:

  • A plan's open decision is what the plan has not settled — not what the repository has not settled. T5's D-4 sat open in the plan while manifest.py had already answered it one line below VECTOR_TIERS. Read the sibling key before weighing the decision table.
  • Read a plan's test list as part of its specification, not as an illustration of it. Where prose and test list disagree, the test list has been forced to be concrete and the prose has not (T7's containment rule named one of its two real layers). But a named test can also be a prediction that cannot discriminate — T4's conflicting-hunk test asserted an observable both implementations produce — so re-derive the scenario before writing it.
  • A status claim is never gated — not a ## heading, not a table cell — so read the body. An item's closure can sit in its body: grep '^## ' on plans/20260731_1202-open-corrections.md returns Live and stops, which put two freshly-cleared sessions within one message of rebuilding a landed increment (20260824, and again 20260825); both times a peer caught it and no gate did. Where a dated snapshot and a ## Build order disagree, the build order wins. An item that reads as a decision may only be an unchecked assumption, and one that reads as live may already be closed; an empty-looking list means the next thing has not been planned yet, never nothing to do. (Moved here from CLAUDE.md's status block at A3, 20261019; the same drift one level in — two registers of one set of facts — is in RETROSPECTIVES.md, "twelve of its 27 rows".)

One increment at a time

Never batch increments; each is a separate, bisectable landing:

  1. Own worktree, branch YYYYMMDD_HHMM-i<N>-<slug>. And run the gates there, never in the primary checkout — that is where tools/land.py merges, so another session can change its tree under a running pytest at any moment. Measured 20260823: a peer landed mid-./check.sh and three tests failed with "matched 0 # Part heading(s)" — loud, plausible, and pointed at the file that session had just touched. Nothing was wrong. A red run in the primary checkout may be about a tree that no longer exists, so re-run it at the new sha before believing it.
  2. Implement the increment with its tests — tests ship in the increment that introduces the behaviour, never deferred. A test that touches a PDF fixture, the claude extractor or a real embedding backend carries the matching tests/conftest.py predicate (pdf_runnable() / pdf_extraction_runnable() / paid_runnable()) in its skip marker — on a worktree with the extra installed, a test that forgot one runs, passes, and says nothing about the CI leg where it cannot (20260804 13:30).
  3. Green before review: run ./check.sh (or make check) — every gate under set -e, so a failure is a non-zero exit rather than a line in a log that a pipe then swallows. Run it bare and read its own exit status: ./check.sh | tail && git commit reports tail's status, and that shape has landed commits over a red gate twice — once one line below the comment in check.sh that explains it (T4). Re-run it as the last step before every commit — green expires at the next keystroke, a reworded comment included. It formats Python inside Markdown fences too: a docs-only commit can still fail the gate. And a green run proves this worktree's venv, not the three-leg matrix: for a test gated on an extra, run its file once with the extra absent (uv sync --frozen --extra light, run it, then uv sync --frozen --extra light --extra pdf --extra claude to restore — never --all-extras, which pulls the ~2 GB [st] extra the matrix deliberately omits) — uv run --extra X does not prune extras a previous sync installed. A version number is a claim about one run: a .venv pins its interpreter once created, and .python-version (3.13) is outranked by UV_PYTHON and --python, so pass --python explicitly and print sys.version in the run that produces the number.
  4. Break the code on purpose — after committing. Mutate the 3–5 most safety-critical assertions, confirm the right test fails for the right reason, restore.

    python3 tools/mutate.py tools/batteries/tools-release_order_gate.toml python3 tools/mutate.py --check-anchors tools/batteries/*.toml # do they still hold?

The battery is a committed file, one per target, and you append to the one your target already has — never a second file for it, which is how two increments end up maintaining two sets of mutants that disagree. grep -l 'file *= *"src/pinakes/x.py"' tools/batteries/*.toml says which; no hit means start one, named for the path with its leading dots dropped, / → - and the extension dropped. The rule, and what to do when an anchor rots, are in tools/batteries/README.md; tests/test_batteries.py fails if an anchor stops resolving, if a kills selector names a test that no longer exists, or if two batteries claim one file.

What the comments in a battery are for. The proof is re-derivable — an afternoon per gate, measured. The reasoning about which mutants were worth writing is not, and it is the only thing in the file that the code does not already contain. Write it down beside the mutant.

The harness rules, each earned at least twice (RETROSPECTIVES.md § Start here → "run a mutation pass") and each a refusal in tools/mutate.py. They apply to any edit-run-restore loop, not only to a thing called a battery — a one-off audit script that writes a file, runs the suite and puts it back is this machine under a different noun, and on 20260904 09:08 one was built that skipped the __pycache__ rule for exactly that reason, taking three instruments and a count that walked 5 → 3 → 2 before the rule was applied and the verdicts went stable. A rule keyed to what a thing is called is broken by the next thing that is not called that — the same session had a trigger fail the same way, by naming "more than one vacuous test" and never naming the one-plus-one-unknown case that actually turned up. When you write a rule here, key it to the shape of the work: - Commit before mutating — git checkout <file> restores to the last commit, not to the pre-mutation state, and has silently reverted uncommitted fixes six times here. After any restore, grep for the thing that was supposed to survive it. - Assert each mutation's anchor matched exactly once — a str.replace that matches nothing returns the string unchanged and reads as SURVIVED. - Clear the module's __pycache__ after writing and after restoring — CPython invalidates on (mtime-to-the-second, size), so a same-length mutant applied and reverted within one second runs from stale bytecode. - Run without -x, and read which assertion fired — a failing test proves the mutant is caught, never that it is caught for the stated reason. - Kill one known-catchable mutant first — a run with no kills is a broken harness, not a clean bill. "Mutation-verified" is a per-assertion claim, never a per-commit one, and "pinned by test X" is a claim about a failing test: revert the fix and watch it go red, or do not write the word. And know what the battery cannot reach: a defect with no assertion anywhere. A textwrap reflow of a comment run flattened a \-continued shell command onto one line — legal to ruff, invisible to pyright, read as prose by a diff review (0.25.3, 4d5debf). A prose tool pointed at text containing load-bearing whitespace needs its output re-read as the thing it is — a command, a table, an indent — never as prose. The sibling case: a script navigating Markdown matches the heading level, never a bare startswith("## ") — that steps over every #, and it is how 0.25.3's release section landed inside ROADMAP's Part 5. Both are prose-shaped tools applied to structure they do not model. 5. Retrospective review — a fresh adversarial pass over the increment's own diff, repeated until clean. Findings and fixes are their own commit — and a fix gets the same treatment as the code it fixes, mutation included: a fix applied under review inherits the review's confidence and none of its scrutiny, and a fix can silently disarm a test written for something else, so the battery re-runs after it. Anything worth keeping gets a retro.d/ fragment; trivia stays in the commit message.

The pass has a committed script, and its first output is coverage, not the findings. Run the saved workflow adversarial-review (.claude/workflows/adversarial-review.js) before landing (step 7), with args an object:

   {"sha": "<the branch tip>", "base": "<git merge-base origin/main <tip>>",
    "title": "A1", "claims": ["what the increment says it does", "another"]}

sha and base are both commit shas, because origin/main...<sha> is an empty diff once the increment has landed; title and claims are optional, and the lenses check the increment against what it says it does. After a --no-ff landing git merge-base origin/main <tip> returns the tip itself and the script refuses with that explanation: use the merge commit's first parent (git rev-parse <merge>^1) as base. It runs four lenses, the runtime one launched first, one refuter per finding (at most 20 findings per lens get one, the most severe first) and one Opus judge, and returns VACUOUS | PARTIAL | CLEAN | FINDINGS. Only CLEAN and FINDINGS mean every lens, refuter and judge that was asked for returned. PARTIAL and VACUOUS are not a clean pass, and what clears one depends on why: relaunching with resumeFromRunId may retry an agent that died, but a reply that came back unusable (lenses.died_why says why, and so does a bad sha: every lens reports an empty diff), a lens that completed and reported not_run, a finding over the per-lens cap, a high-severity finding a refuter dismissed on a guess (basis: "uncertain") and a contradictory ruling are replayed as they were, so those need their cause fixed or the gap reported to the user. A CLEAN also lists every finding dismissed on a guess in dismissed_on_a_guess and its note. Coverage does not say that a lens opened every changed file or fragment; the rule below is checked with tools/review_ledger.py. A run that never returned (stopped, or cut by a session limit) has no verdict at all: tools/review_pass_gate.py reads its journal, and a Stop hook (tools/hooks/review_stop_hook.py, wired in .claude/settings.json) runs that gate over every workflow run of the session that is ending, and refuses to let the turn end while a run lost or emptied an agent and no acknowledgement covers it. Its message names the agents and prints the command that acknowledges the run (--acknowledge <run dir> --told "<what you told the user>"): run it after telling the user which agents died, not instead. It is a nudge and not a lock — Claude Code overrides a Stop hook after eight consecutive continuations — and it counts agents, not coverage: a run whose agents all returned passes it however coverage reads, so read coverage first. The session that created .claude/settings.json did not pick it up (measured 20261019 08:26 UTC); a fresh one saw it fire (09:24 UTC), running the primary checkout's copy even from a worktree. The workflow ran for real once, 20261019, on the hook's own diff (the plan's § 6.1 records what that settled); that pass was PARTIAL because twenty-odd probes could not be run, and it found a defect in the gate that the stub could not have. It exists because a fan-out that lost 17 of 19 agents to a session limit once returned {"raised":0}, and nothing in that result said nobody had looked.

🛑 The pass opens the increment's own fragments, and every file the increment changed. Not the plan it was working from — the diff. This step's own position in this list is why it did not: step 6 writes the changelog.d/ fragment after the last review pass in step 5, so the procedure guarantees the fragment is never reviewed. Either write the fragments before the final pass, or run one more pass after them; do not leave it to memory.

A fragment is not scratch. tools/fragments.py splices it into CHANGELOG.md and docs/RETROSPECTIVES.md, and docs/ publishes on every push — so an unreviewed fragment is an unreviewed published document.

The same hole covers ordinary source files. A corpus measurement over this repository's own transcripts found that what a pass misses is overwhelmingly the fragments its own increment wrote — on nine of the twelve increments with any miss at all — and that src/pinakes/__init__.py, where __version__ lives, was opened by none of the 41 passes over the mutation-batteries increment. A file the increment changed and no pass opened is the cheapest place for a defect to survive review.

Ask it about your own increment rather than quoting a ratio from here: python3 tools/review_ledger.py <increment>, whose last section is headed CHANGED BY THIS INCREMENT, OPENED BY NOBODY and lists the paths. No percentage is quoted in this paragraph, deliberately. It carried 207 of 248, 83%, 90% for four hours and all three were wrong by the time they were read — the tool's scan could not see an extensionless filename or a .lock, so Makefile and uv.lock were reported unopened on every increment that touched them. Worse, the corpus is alive: it is this repository's own transcripts, and the sessions measuring it are writing into it, which moved a published figure from 96.1% to 95.8% between two runs with no code change at all. A ratio over a growing denominator is a claim with a shelf-life measured in minutes; the command has none.

The rule says opened, and that word is doing deliberate work. What a transcript can show is which files a pass opened; whether it reviewed them is not observable and no tool will ever check it. So the checkable rule is the weak one — open every changed file and every fragment — and it is stated as the floor rather than the goal. An opened file is not a reviewed file; the measurement is a lower bound on attention, never evidence of it. 6. A changelog.d/ fragment in the same commit as the code — never an edit to CHANGELOG.md itself (changelog.d/README.md). Written before the last review pass, or reviewed by one of its own — see step 5. 7. Land it — but first python3 tools/shared_file_overlap.py --fetch --strict: other agents land work concurrently at any time, and a clean auto-merge is not a correct merge (CLAUDE.md § Landing work). Then python3 tools/land.py <branch> --cleanup. Never git merge by hand — from inside the branch's own worktree that merges the branch into itself and reports success three times over (CLAUDE.md; what land.py refuses, and why --cleanup deletes both copies of a branch: RELEASING.md § Landing a branch). Then gh run list --branch main: local green is one leg of a three-leg matrix, and main has been red for three pushes and, later, four consecutive merges without anyone noticing (20260728, 20260801).

Which documents an increment touches, and in what order: docs/README.md § Landing a new increment.

Hand over before you stop

Context dies with the session; disk survives. So the handover is part of the increment, landed in the same branch as the work — never a follow-up, because the pointers an increment falsifies are exactly the ones the next session opens first. Set by the user 20260811 15:37, alongside the rule that a boundary needing a context clear is a stop rather than an offer (CLAUDE.md § Working mode).

Where What goes stale the moment the increment lands
CLAUDE.md's live-plan pointer "Build E1 next" — the first thing any session in this repo reads
docs/README.md's plan-routing row the same claim, for whoever opens docs/ first
The plan itself mark the increment built, and record what shipped beside what the section asked for — including anything the next increment needs that only this one learned
The plan's baseline / measurement block which of its rows this increment just falsified, and how far file:line moved. Every plan here has drifted this way; the template release's did about thirty times in four days
STATUS.md the surface row — onmain, unreleased between landing and release, then the version

You edit all five yourself, in the same branch as the work. The branch rule is the user's (20260811 15:37); editing the rows directly, with nothing proposed and nothing waiting, dates from 20261029 17:06. These five are merge hotspots now that any session may write them: make the handover rows the branch's last commit, after rebasing onto a fresh origin/main, run python3 tools/shared_file_overlap.py --fetch --strict, and read the merged state of what it names. An agent that writes none of them has not handed over.

RESUME.md may only ever hold what is also recoverable from main. It is excluded via .git/info/exclude — a file that is itself never committed — so a cloud run, a scheduled routine, another checkout or a fresh worktree sees no handover at all, and cannot discover that one exists. Neither CLAUDE.md nor docs/README.md points at it, deliberately: committing it would make a file every session writes into a merge hotspot. So it is a convenience, never a carrier. Anything that would be lost if it vanished belongs in the five rows above, which are committed. The file already claims this about itself and nothing enforces it — that is the whole of the rule. This is the protection-for-me versus visibility-for-everyone distinction applied to the repository's own state, and nobody noticed the asymmetry until it was written into a plan about .gitignore.

A pointer nothing links to is not a handover. Verify by opening what a fresh session opens — CLAUDE.md, then docs/, then the plan — not by trusting that you wrote it down somewhere. A missing row has no wrong text to find, so no diff review and no grep reaches it; only the question does (RELEASING.md, 20260811).