Elegance
A cleanup that proves it changed nothing. By Alex Adamczyk.
Code written with AI help grows fast. An AI agent has to read the code before it can change it, and it pays for that reading every time. Elegance is the routine I use to make a codebase smaller to read while proving, each time, that the program still does exactly what it did.
This page is the long version, written for someone who wants to run it on their own code. The whole skill file, the one my AI pilot loads, is at the bottom.
The score is what a builder must read
Line count is the wrong score. A file can lose a thousand lines and be no easier to change.
The score is the read set: pick a real change someone will make (say, "change how the selling price is set"), start at the function that does it, follow every call it makes, and count the text an agent must read to make that change safely. A small tool does the counting. It is measured before a pass, after it, and in the report.
Three or four named changes are enough. If their read sets do not go down, the pass did not help, whatever it deleted.
Two kinds of pass, two kinds of proof
| Pass | What changes | What must hold |
|---|---|---|
| Prose pass | Comments only: history, dates, review notes and text that repeats the code | The compiled program is identical, and the source with comments stripped is identical |
| Code pass | The code's shape: dead code out, a long function cut into named parts | For the same input, the same output, every time |
A prose pass never touches code, so its proof is exact: two fingerprints, before and after, that must match. A code pass does touch code, so its proof is behaviour: every automated check, recorded sessions replayed and compared byte for byte, and thousands of random inputs run through the old code and the new.
The rules
- One file or one seam per pass, one writer, the full set of checks after each. Never several writers at once. A pass is kept or thrown away whole.
- Keep the comment that guards a line. Remove the story. A comment stays if deleting the line it sits on would still pass every check: it is the only thing protecting that line. History, dates and "why we changed this" go.
- Nothing is deleted. It is moved. Removed history goes word for word into one history file, with a pointer to the design record. A later reader can still find it.
- The cheapest model that does the job gets the job. I measured it: on comment passes the cheapest model found 71% of the savings alone, and nearly all of it once it was shown examples of what it had missed.
- Find the holes in the tests before changing code. A code pass is judged by the tests coming out the same, so first I learn what the tests do not notice.
Finding the holes: the mutant hunt
Before a code pass, one agent makes hundreds of small deliberate mistakes in the code, one at a time: a "less than" turned into "less than or equal", a limit changed, a condition dropped. After each one it runs the checks.
- If a check fails, the tests already guard that line.
- If every check still passes, the tests have a hole. The agent writes a check that fails with the mistake and passes without it.
- If the mistake changes no output at all, the code was doing nothing. That line goes on the dead-code list.
Then I replay every one of those mistakes myself, on a clean copy, and confirm each result. The agent's word is not the proof. The replay is.
| Hunt | Tried | Caught | Holes | Dead |
|---|---|---|---|---|
| The function that builds the action queue | 428 | 248 | 135 | 45 |
| The functions that gather its inputs and price each post | 355 | 188 | 155 | 11 |
Tried: mistakes planted. Caught: the tests already failed. Holes: no test noticed, so a check was added. Dead: the line changed no output. Both hunts were on the market copilot. Between them they added 220 checks. In the second hunt one hole was left open on purpose: it pointed at a real display fault, which was then fixed.
Which model should hunt
A hunt is "go in and break things", so I guessed the cheapest model might do it as well as a dearer one. I tested that. The same hunt ran twice on the same code, with the same written brief word for word: once by Sonnet, a mid-priced model, and once by Haiku, the cheapest. Neither could see the other's results.
| Sonnet | Haiku | |
|---|---|---|
| Mistakes planted | 152 | 150 |
| Already caught by the tests | 39 (26%) | 95 (63%) |
| Real holes found | 95 | 43 |
| Time | 71 minutes | 35 minutes |
| Tokens used | 599,000 | 502,000 |
| Tokens per hole found | about 6,300 | about 11,700 |
| The checks to close them | Written and run | Sketched, not run |
The mid-priced model paid off. Breaking code is easy. Breaking it where no test is looking is the skill, and three in four of Sonnet's mistakes got past the tests, against about one in three of Haiku's. Sonnet found more than twice the holes for a fifth more tokens, and it wrote and ran the checks that closed them.
But the two models broke different things. I ran Haiku's 55 survivors against the code after Sonnet's checks were in: 33 were holes Sonnet had already found, 10 changed no output, 3 no longer applied, and 9 were new. Three of those nine were on paths that handle money.
So the order I use is one Sonnet hunt, then one Haiku hunt over what the first left, then stop. That first pair of hunts closed 104 holes with 113 new checks.
Results
Each pair is drawn against its own before figure. Codebase two's figure is one pass, the removal of a second client's code path.
- Codebase one (a market tool, Python): seven comment passes, zero code lines changed, about 1,100 facts moved to the history file. One named change went from 50,663 tokens of reading to 35,402.
- Codebase two (the market copilot, Lua): seventeen comment passes, then code passes. Its longest function went from 1,140 lines to 49, calling 21 named parts. The proof for that one cut: every check, 80,000 random inputs with no difference between old and new, and all 428 planted mistakes replayed.
One night that shows why it matters
On the evening the long function was split, I sat down to use the copilot for the first time in a week. The game's server had changed under it, and I kept finding things I wanted.
| Releases that evening | 18, in under four hours |
| Checks run before each release | 4,737 at the start, 4,783 at the end |
| What they covered | Four live faults, a new card in the queue, two new switches, a settings panel, and five changes to how one part learns |
| Caught by the checks before release | A repair that would have touched old saved data it should have left alone, and a crash when one file loads without another. Both fixed before they shipped. |
| Faults that reached me anyway | Four, all in new code written that night. Each was found from the program's own saved data within minutes, and fixed in a later release that night. |
Eighteen releases in one sitting is only safe when every one of them passes the same full set of checks, and when the code is small enough that the agent making the change can read all of what it touches. The cleanup is what makes the speed safe. The four faults that got through are the honest part: checks catch what they were written to catch, so each of those faults became a new check.
What did not pay
- Merging small repeated helpers and chains of conditions: under 1% on both codebases. Not worth a pass.
- Shared helpers for test assertions: three helpers at 24 places saved 126 tokens of 434,000. Reverted.
- Comment passes on a small, tidy website: about 100 tokens saved for 200,000 spent. There the win was telling search tools to skip retired folders.
- The strongest model on comment work: it found 3% of the savings.
To run it on your own code
- Have checks first. A test suite, and if you can, a recorded session that can be replayed and compared exactly. Without these there is nothing to prove a cleanup against.
- Measure. Name three or four real changes. Count what must be read for each. Sort the files by how much they add.
- Freeze the inputs of your proofs in the repository, so a replay next month compares against the same bytes.
- Start with the biggest file's comments, then the file headers across the small files. Headers were worth about twice what the measurement predicted.
- One pass at a time. The builder runs the proofs and reports. You run them again yourself before keeping the work.
- Before any code pass, run a mutant hunt on the code you are about to change.
- Write each pass down in one line: what, the numbers before and after, what was moved, what the proofs said.
The skill file, whole
This is the file my AI pilot loads when I say "elegance". It is the working document, written for an AI to follow, so it is dense. In it, GE Brain is codebase one above and KrabsPulse is codebase two. A local folder path and one clause naming an unrelated project are removed. Nothing else is changed.
# /elegance
Alex's name for it (2026-10-10): "parity enforced elegantification passes where we attempt to compact the codebase and
retain output parity, so LLMs can digest it easier." First patient: GE Brain, passes 0 to 2
on 2026-10-10; the record is DESIGN.md 18:19, 18:20, 20:42 and 22:04 there, the measurement
`relay/hermes/reports/elegance-pass0.md`, the tool `tools/read_set.py`.
## The rules (Alex's, recorded; do not re-litigate)
- **The score is the READ SET per task**, not line count: the tokens a builder must read, by static closure from an
entry function, to make a named change. Measure before, after, and in the report of every pass.
- **One module (or one seam) per pass, one writer, the full gate after each.** Sequential, never a fan-out. Commit or
revert; nothing lands on a partial gate.
- **Prose rule: retain micro comments, kill the narrative.** Keep a comment that guards a line (deleting the line it
sits on would still pass the suite), one line, no date, no reviewer. Keep a contract per module (at most about
150 tokens) and per public function (takes, returns, invariant, a few lines). Kill history and provenance (dates,
waves, review rounds, hotfixes, "Alex ruled"): they move word for word to `CODE-HISTORY.md` at the repo root, one
paragraph per fact with the design record's entry in brackets, and the code keeps a one-line pointer
(`# DESIGN <date> <entry>`) only where the why is non-obvious. Kill prose that restates the code.
- **A comment that reduces the read is kept (Alex, 2026-11-29, about 2:10 am: "comments should be retained when
they save time on a family of changes an agent would make. So they can be used when they ultimately reduce
read.").** A third kept class beside the contract and the guard: the signpost. It tells an agent making a kind
of change where that change is made, or what a block does so the block need not be read ("every price rule is
in this table; a new one goes here", "these four parts only read ctx"). The test is the score itself: name the
family of changes, and the comment must save more reading across it than it costs to read every time. It stays
short, says nothing of history, and is checked against the code like a contract. A pass may ADD one where a
measured read set shows agents reading a block only to learn it is not theirs.
- **Nothing a builder relies on is deleted; it is relocated.** If a moved fact is not in the design record, the
appendix says "(not in the record)" so the pilot can add it.
- **Code does not change in a prose pass.** Two proofs, both required: an AST digest (the tree minus docstrings)
identical before and after, AND a code-text diff (docstrings and comments stripped, whitespace kept) identical,
because an editor can drop a space the AST cannot see (GE Brain pass 3 caught the Edit tool doing it). A seam pass
that changes code records a new golden set on purpose and says why. A language with no AST tool: see the Lua
section below. A code pass is gated on input-output parity, never on identical code.
## Procedure
0. **Measure** (read-only, one scout): per-module tokens and prose share; the read set for three or four named
tasks (strict lower bound, a plausible figure, the blind spots named); a prose inventory classifying every
docstring and comment block as contract / guard / history / restate / pointer, with a reading check on a sample;
a history map (which facts the record already holds); the harness's dependencies (what an independent oracle the
repo has, and what retiring it would lose); a ranked pass plan by read-set saved per unit of risk. In GE Brain:
module headers held 74% of the savings and pass 2 proved them worth twice the closure's estimate (headers are the
cheap big win: do the header seam second); the biggest module led 3.4x; the parity oracle's retirement ranked last.
1. **Freeze the gate's inputs in the repo** before pass 1 (GE Brain: the recorded streams and both golden sets under
`server/tests/parity/frozen/`). A golden check runs on the frozen recording only; a fresh recording differs in
run-specific bytes and proves nothing (the one false alarm of 2a's gate).
2. **Pass brief** (from the template below), one module, launched to one builder: **a prose pass goes to Sonnet at
effort max**, its brief showing examples of history that carries no tag (see "Who does a prose pass" in the Lua
section); a code seam goes to Opus. The builder runs the gate itself and reports; the pilot re-runs the digest
against the committed tree and spot-reads the header and the appendix before committing.
3. **Order**: the biggest module's prose, then the module-header seam across the small modules, then the next
modules by the plan, then the seams, then the oracle's retirement last and as its own phase with Sol's read.
4. **Record** each pass in the design record with the real clock: tokens and prose share before and after, the four
read sets, facts moved and how many were already recorded, the gate's figures, any stop the builder left.
## Brief template (fill the brackets; keep the gate verbatim)
```
# Brief: elegantification pass N, <scope> (parity-enforced; the code does not change)
Scope: <the module(s) or seam>; bodies untouched except docstrings that must take a sentence the header carried,
and re-pointing lines elsewhere ("see the module docstring").
The rule, applied: header <= 150 tokens of contract; function docstrings to contracts; tags out; guards kept;
history word for word to CODE-HISTORY.md under ## <module> with the record's entry in brackets; pointers re-pointed.
Traps: anything that reads a module's __doc__ at runtime (grep first; stop if found).
Gate, in this order, every one byte-identical: the AST digest before and after; the code-text diff (prose stripped,
whitespace kept); any runtime __doc__ reader's output before and after; the read sets against the baseline;
the suite on every interpreter the repo names; parity; the golden checks on the FROZEN streams against the frozen sets.
Rules: the repo's standing builder rules (no data folders, no live ports, no commits, no network, stdlib, no heredocs,
scratch under the session's folder); a paragraph that fits no class: stop, leave it, report it.
Verification: per module tokens before/after, facts moved, pointers; the digest lines; the read sets; suite; parity;
golden digests. Report under 300 words plus evidence.
```
## Scorecard (one line per pass in the record)
| pass | scope | tokens before -> after | prose before -> after | read sets before -> after | facts moved (recorded) | gate |
|---|---|---|---|---|---|---|
| 1 (GE Brain) | brain.py | 50,398 -> 41,689 | 43% -> 32% | sell_floor 50,663 -> 42,391; journal_field 81,175 -> 72,463 | 123 (122) | all byte-identical |
| 2 (GE Brain) | nine module headers | headers 7,418 -> 1,215 | market 36% -> 32%, flips 53% -> 45%, dedupe 52% -> 42% | sell_floor 42,391 -> 39,039; adopt_route 22,278 -> 17,819; journal_field 72,463 -> 66,892 | 103 (93) | all byte-identical |
| 3 (GE Brain) | book.py | 32,409 -> 26,649 | 48% -> 36% | sell_floor 39,039 -> 35,402; journal_field 66,892 -> 62,802 | 232 (226) | all byte-identical |
| 4 (GE Brain) | fund.py (schema blocks verbatim) | 18,589 -> 16,202 | 35% -> 26% | fund_order 8,563 -> 5,546; adopt_route 17,819 -> 14,559 | 90 (90) | all byte-identical |
| 5 (GE Brain) | suggest.py | 17,567 -> 14,409 | 46% -> 34% | journal_field 62,802 -> 60,139 | 140 (133) | all byte-identical |
| 6 (GE Brain) | core seam (projection, assemble, adopt, fund_shadow) | 33,037 -> 29,154 | 30-44% -> 22-34% | adopt_route 14,559 -> 13,321; journal_field 60,139 -> 57,996 | 183 (177) | all byte-identical |
| 7 (GE Brain) | app, relay, migrate + 13 queued corrections | 50,351 -> 45,932 | 27-37% -> 22-30% | unchanged strictly (pass 0 predicted 0) | 245 (225) | all byte-identical; one tool label changed on purpose |
| 8 (GE Brain) | the phase 2b delta (entries.py + seven touches), right after the build | 2b's 24,622 added -> 338 trimmed (entries 10,144 -> 10,022) | entries 23% -> 22%, headers 202/211 -> 145/150 | entry_rule (new task) 8,381 -> 8,301; journal_field 59,227 -> 59,139 | 45 (39) | all byte-identical |
| 9 (GE Brain) | the v1 retirement (core/v1 deleted, harness v2-only, frozen v1 folders as bytes, decision figures in the golden check) | tree -62,641 (core/v1 57,445; harness 11,653 -> 9,574) | n/a (a code pass) | unchanged strictly (35,466/5,556/13,320/59,139/8,301) | 56 paragraphs of v1 history + 9 allow-list reasons | golden digests exact by v2-only replay; code text identical on the six decision modules; suite 1,342 -> 1,336 (8 retired by name, 2 added) |
| total (GE Brain, 7 passes) | the server | 264,865 -> 231,450 | 40% -> 31% | 50,663/13,076/26,364/81,175 -> 35,402/5,556/13,320/58,000 | about 1,100 (96% recorded) | zero code lines changed |
## Lessons from GE Brain's nine passes
- Edit by a script that replaces exact AST and tokenize spans and keeps each file's line endings; the Edit tool dropped
a space on code lines once (pass 3). The code-text diff is the proof the digest cannot give.
- Builders stop on prose that drifted from the code (a comment that says the opposite of the line). Rule them as
prose corrections and batch them into the last pass; never let a builder decide what the code should say.
- A module that parses its own docstring at import (fund._schema) is a trap: find every runtime __doc__ reader before
pass 1, keep that text verbatim, and compare the reader's output before and after.
- Headers are worth about twice what the static read-set closure predicts; the big module's prose about what it predicts.
- A pass right after a build whose brief carried the rule is a trim (2b's 24,622 added tokens were 23% prose; pass 8
removed 338): still run it, for the headers (202 and 211 tokens over the 150 line) and the tags, but expect the
read sets to move by tens, not thousands. Add the new feature's read-set task BEFORE the pass so it has a judge.
- One builder listed the data folders with grep -r from the root before excluding them: say "search by explicit
path" in every brief.
- Retiring the oracle (pass 9) is a code pass with three things frozen BEFORE the delete, each gated with the oracle
still present: every figure the golden check silently skipped (GE Brain's fifth element: a direct call's journal
fields, 54 steps at 0 differ), the recording-vs-replay fidelity notes as a file, and every data folder the oracle's
code used to build, as bytes with a manifest and `* -text` in .gitattributes (autocrlf would rewrite them). Then the
replay must reproduce the frozen digests exactly with the oracle gone; the suite count change is explained test by
name (retired vs ported vs added), never as a total.
- Test consolidation: measure the net at a helper's call site, never the clone tokens. GE Brain's tests pass 1
(2026-10-11): the scout counted 5,761 recoverable in repeated assertion pairs; under the sound-inlining rule (every
operand an argument, in source order, proved by inlining every site and comparing the module's AST with HEAD's) three
helpers at 24 sites netted 126 tokens of 434K and were reverted. A helper saves only `self.assertX(` and the shared
literal. Consolidation mass lives in setup families (a store built, a journal read back), not in assertions. The
inventory tool (`tools/test_inventory.py`: ids equal to the loader's, a mapping for every gone name, coverage line
sets, a recorder that pins wall time AND uuid4) is what a tests-only pass is gated on.
## A patient with no syntax-tree tool (Lua 5.1; KrabsPulse, 2026-11-19)
His question that set the bar (2026-11-19, 2:05 am): "Does the stripped bytecode need to be exact, or just the
input-output parity? ... its grammar could change." The answer, now the rule: **a prose pass leaves the compiled
form identical; a code pass is gated on input-output parity.**
- **The prose proof is two things, both required.** (1) A line-blind bytecode digest: `luac -s` strips names and
line info, but Lua 5.1's dump still writes each function's first and last line, so the raw digest moves whenever
a comment line goes. Zero those two integers in every function, then hash (`tools/elegance/read_set.py --digest`,
the `line_blind` column; tested: a deleted comment line moves only the raw digest, a changed number moves both).
(2) A code-text diff with every comment removed (`--code-text`, then `diff -rB`): bytecode cannot see a renamed
local or a changed space. Then the suite, the lints' verdicts (their text carries line numbers and moves) and
the read sets.
- **The pilot re-runs the proof on `git archive` copies** of the base and of the builder's commit before the
cherry-pick, not on the builder's files.
- **A code pass** (a seam, a merged helper, a retirement) is judged by the goldens and the suite. First break the
gate on purpose, once, to see that it reads the code being changed: KrabsPulse's golden walks ran none of the
press path or the mail path (`doPost`, `processMail`: unit suites only) and 45 top-level functions ran in no
suite. Code the gate does not read gets a test before a rewrite.
- **The score needs an exact resolver, not the call graph.** graphify's graph confirmed 99% of the edges it had
and lacked 31% of the references (functions handed to pcall, to timers and to event tables; a function assigned
to a forward-declared local has no node), so its read sets came out 1/1.7 to 1/18 of the exact ones. Resolve
module tables (`local Q = KP.Queue` -> `Q.Build`), same-file names and functions passed as values, to a fixed
point. Keep graphify for the lint and as an alarm (the ratio of its set to the exact one). Read the two rebuild
entry points at their contract only, or every task's set swallows the whole rebuild.
- **Classify comments by reading.** A first-guess classifier was right on 43% of blocks: a tag made it call a
contract "history". Half the blocks were mixed (three quarters of the prose tokens): cut the leading tag, take
out the parenthetical with the date, save, measurement or quote, take out the "was X" sentence, keep the
contract or guard sentence, **changed by deletion only**. The edit script checks word by word that what stays
is a deletion of the original, and that every span it touches is comment-only (a real lexer: `--` occurs inside
strings and long brackets).
- **Who does a prose pass (Alex, 2026-11-19, 3:31 am: "Sonnets can go until they can find no more elegance ...
then we can see if the opus or the fable can find any"; measured that night).** Sonnet at effort max, alone, with
the examples in its brief. On Queue.lua, run as a ladder on what each rung left: Sonnet 905 tokens, Opus 335,
Fable 41 (71%, 26%, 3%). What Sonnet missed had no tag: history told by tense ("as before", "used to", "ran X and
allocated for it"), a reviewer's argument kept inside a guard, an incident's names, a guard that says its rule
twice. Shown those as examples, Sonnet took 3,213 tokens from Executor.lua and the Opus look after it added 87.
So: no Opus look for more tokens (it pays only for comments that are wrong about the code, about one per 400
lines, and those are stops the Sonnet reports anyway); no Fable look. The brief that carries the examples:
`briefs/elegance-prose-pass.md` in KrabsPulse.
- **What to expect.** 31% prose; the removable part was the history mixed into contracts and guards, about a
quarter of the prose, 7% of the addon. The only large code win was retiring a second client's code path. Merging
duplicated helpers, if-chains and test-only functions was under 1% and not worth a pass.
- **A side effect to expect:** a check that depends on where the garbage collector lands fails once tests are
added in front of it. Hold the collector for the one step the check describes.
| pass | scope | tokens before -> after | prose before -> after | read sets before -> after | facts moved (recorded) | gate |
|---|---|---|---|---|---|---|
| 1 (KrabsPulse) | Core/ExecutorModern.lua | 34,285 -> 32,140 | 30% -> 26%, head 426 -> 172 | post_price 65,227 -> 64,383; buy_press 46,472 -> 45,021 | 182 (170 fully, 12 partly) | line-blind digest 50 of 50, code text identical, suite 4,259 |
| 9 (KrabsPulse) | Core/Init.lua (the settings file: one comment per setting, a tag on most) | 6,401 -> 5,522 | 64% -> 59%, signals 97 -> 6 | post_price 72,070 -> 71,620; buy_press 72,261 -> 71,811; scan_read 24,541 -> 24,091; slot_price 38,674 -> 38,224 | 100 (79 fully in the record, 17 in the docket, 2 partly, 2 not) | line-blind digest 51 of 51, code text identical, suite 4,823 |
| 11 (KrabsPulse) | the Era retirement, a code pass (3 files, the client check in 13 files, 3 suites) | addon 389,669 -> 361,283 | n/a | post_price 75,314 -> 74,418; buy_press 72,401 -> 71,767; mail_book 15,244 -> 13,322; slot_price 38,509 -> 37,717 | 307 tests left by name, 296 moved or ported, 1 added | suite 4,823 -> 4,517 by name; goldens untouched; Executor diff read whole; 6 pilot mutants killed |
Retiring a second client (pass 11, one Opus builder, 58 minutes): order it map, move, delete, simplify, tests. The map
(coverage of the dying files by the surviving suites, plus the suite run with those files unloaded) found two
functions the live client took from a dead file. Constant-fold the state only the dead code wrote, and have the
pilot verify that claim by search before trusting the fold. Compare the two suite outputs name by name yourself.
Rebuild the code graph before the before-figures: a stale graph shifts read sets by thousands.
Pick the next file by measurement, not by the old plan: `signals.py` per file ranks what the builds since the last
pass have added (2026-11-25: Init.lua led with 97 lines and sat in four of five read sets). Passes 2 to 8 are in
the repo's `briefs/elegance-ledger.md`.
## Code passes on a long function (KrabsPulse, 2026-11-28)
Order: mutant hunt, dead code, split. `Queue.Build` went from 1,140 lines to 49 calling 21 file-local parts.
- **Hunt first** (one Sonnet at effort max, tests only, whole lines recorded in a `mutants.jsonl`; the order and the
Sonnet-then-Haiku figures are in the `nitpick-relay` skill). 428 mutants on `Build`: 248 already killed, 135 holes
closed by 110 checks, 45 equivalent; 355 on `Executor.Rebuild` and `vendorPass`: 188, 155, 11, and one left open
as a finding. The pilot replays every mutant on `git archive` copies of both commits. The hunt's hand-back also
gives the map of the function's parts and the dead-code list: both are the code pass's inputs.
- **A finding is never fixed inside the pass.** A mutant that shows the code looks wrong goes to him.
- **Dead code second, by the pilot**: only what the hunt proved (an equivalent that is unreachable), each read
against the code before it is cut, and things that rest on another file's behaviour are left with the reason.
- **The split goes to one Opus**: one context table made once per call, per-item values as arguments and returns,
code moved and never rewritten, comments travel, a seam that cannot be cut without changing an expression is left
whole and named. After the split the mutant table is replayed **re-keyed by line text** (line numbers are dead):
count the ones that cannot be placed and explain each.
- **The gate for a code pass**: the suite's last line exact; a random differential, old file against new, tens of
thousands of generated inputs with 0 differ; lints and the 200-local headroom; the read sets. **Prove the
differential's modes are distinct** before quoting a count (a `lot` mode that ran as `all` made "60,000 worlds"
40,000). For a function that reads state through a fake client, the frozen golden walks are the differential.
- **Put the timing gate on real inputs.** The split cost 6 to 7% on six-item random worlds and 2% on a recorded
rebuild's inputs; a 5% line on the toy worlds made the builder stop before the commit. Say which inputs the
line is on, and let the pilot rule a miss.
- **A split adds tokens** (the file grew 14%). What it buys is that a change inside the function reads one part and
the short body; the named tasks' read sets may not move at all. Say so in the report.
- **Live work between passes moves the ground.** After a night of quick patches: re-key the mutant table, give the
hurried code a shared helper where two copies of one rule appeared, and run a prose trim of the delta before the
next code pass.
## A static site (Elbow Room, 2026-11-25)
- **The mass is not comments.** Comments were 14% of the code; 60% of the repo's text was one retired folder (a
2.2 MB page with images embedded as text). Measure the SEARCH set (tracked text files a grep for the task's words
lands on), not a call-graph closure: `scripts/read-set.mjs` there.
- **First pass: a `.rgignore`** listing retired and vendored trees (and the history file itself). Nothing moves, the
served files stay byte-identical, and the Grep tool honors it. "Change a host" went 846,458 -> 232,011 tokens.
- **Ask what can be retired.** He retired four owners' pages on sight (archive bytes in the wiki repo with a hash
manifest and `archive/** -text`, then delete): another 80,000.
- **The proof is the served manifest** (sha256 of every file the deploy serves, via the repo's `.assetsignore`
reader). A comments pass on JS or CSS: `scripts/prose-proof.mjs` (esbuild-minified output identical, and code lines
identical).
- **A comments pass paid almost nothing** (Sonnet max on nine Worker files: about 100 tokens for 200K spent). On a
site this tidy, skip the comment passes unless the scout finds dated notes in bulk.
- The README is read on every task but is mostly rules; history out of it saved 14%, not half.
## A production repo: scripts, data and a running log (Karla Marx, 2026-11-28 and 29)
- **Two measures, both kept as a tool** (`tools/search_set.py` there): the search set for five task words, and every
text file a search with no path reads. The second found what the first could not: half the text (45.1 -> 23.7 MB)
was data, not code or record (map geometry, colour tables, plans and face tracks old builds wrote).
- **The running log regrows.** A day-by-day log is in every search; roll the older days out again on each pass
(`tools/canon_roll.py`, word for word, proved by bytes). Two days of it had become the heaviest thing in all five.
- **Measure the prose before ordering a comments pass** (`tools/prose_proof.py share`: share per file and the lines
that carry a date or a name). 22% prose with 485 dated lines in 191 files, and file heads that are commands and
data formats, means no pass: a builder needs those heads.
- **A per-episode copy of a tool is promoted with a byte proof**: the shared tool run on the old inputs gives the
same file (md5), and a mutant gives a different one. Merging saves almost no search bytes; what it buys is one
place to fix.
- Leave source texts visible to search; hide snapshots and data. A hidden folder is still searched when named.
## What not to do
- Do not aim for "a tenth prose": contracts and guards were 30% of GE Brain's server; the rule keeps them. The read
set judges; if a builder opens the record for every third function, the cut went too deep.
- Do not fan out writers; do not widen an allow-list to pass a gate. A builder never commits to the branch he
runs: in its own worktree it may commit on its own branch, and the pilot's proof on `git archive` copies and the
pilot's cherry-pick are what land the work.
- Do not retire the independent oracle (v1 code the harness compares against) until every prose pass is done.