Compare commits

...

92 Commits

Author SHA1 Message Date
lilleman 37db225514 Rescore: PR #229's paired ruling is worse on PR #228's rules; lilleman ships it below the ratchet, as for PR #228 2026-10-08 23:14:15 +02:00
lilleman 5cc37dd861 Answer prose round 1: allow a bare :line in the history's format, date the shortened paths, say slots for top k, list the notes in --help, say no run could be scored, plainer item 85, 73 and 77 text, and the tools' path line 2026-10-08 23:11:36 +02:00
lilleman a69cfd2624 Answer product-owner round 2: fixes in 737d58a 2026-10-08 23:09:10 +02:00
lilleman 84aa3e6b20 Answer stability round 2: fixes in 737d58a 2026-10-08 23:09:10 +02:00
lilleman 737d58ad9f Answer architecture round 4: count only what a target assigns, end each log entry with a newline, and give the larv-review hint only for the default history 2026-10-08 23:09:10 +02:00
lilleman e67c882a08 Answer product-owner round 1: fixes in 527aef3 2026-10-08 23:04:12 +02:00
lilleman e58c98a30f Answer stability round 1: fixes in 527aef3 2026-10-08 23:04:12 +02:00
lilleman 527aef3495 Answer stability, product-owner and architecture round 3: resolve every place in order and count the dropped ones once, let a full path win, name unparsed files and unscored runs below the table, show chance and constant metrics, leave sweeps of more than 30 files out of change spread, count tuple and loop writes and self recursion, and say what a missing history or folder means 2026-10-08 23:04:12 +02:00
lilleman 1fca6137c2 Answer architecture round 2: split main into read_history and bench_runs, state why score dispatches in one function and lift inside out of it, count unresolved places once, name git's reason for a skipped run, and say to call each tool by its path 2026-10-08 22:52:14 +02:00
lilleman 6240f82857 Answer security round 1: nothing to fix 2026-10-08 22:49:45 +02:00
lilleman 7d440c6ee1 Answer architecture round 1: make cognitive complexity a pure recursion, share a tied top-k cut evenly, count unresolved places, skip a run whose commit is gone, fail on a file that does not parse, link the history's format and its reader both ways, reword item 85's order, and record the worse ruling 2026-10-08 21:48:05 +02:00
lilleman 8a2dbd70f1 Split metric-bench's main into run_scores and measured, find the checkout from the history, drop an ambiguous shortened path, write places from the repository root, and give item 85 the history's reader 2026-10-08 21:35:54 +02:00
lilleman 382472bd39 Measure what would lower review's token use: bench static metrics against the panel's hardest places, and rescore item 73 by its reports' measured cost 2026-10-08 21:28:38 +02:00
lilleman c7c5ec083f Merge pull request 'Decide the ratchet by a paired ruling, and check the floor on each release's last item' (#228) from item-75 into main 2026-10-08 21:06:59 +02:00
lilleman d95c8548aa Rescore: PR #228's paired ruling is worse; lilleman ships it below the ratchet, and item 85 moves the ratchet's rules into a tested tool 2026-10-08 21:06:52 +02:00
lilleman 50249b1a59 Answer stability round 3: state the base rule in the decision and the changelog as the skill does 2026-10-08 20:55:33 +02:00
lilleman 7d3906181b Answer product-owner round 2: narrow item 29 to the floor's block, and name the placeless vote in the changelog 2026-10-08 20:54:58 +02:00
lilleman 3efbca09f0 Answer stability round 2: read the history one merged change at a time, and count a change that adds a scoring run or whose last ruling is better 2026-10-08 20:54:58 +02:00
lilleman ccf9c00e9c Answer prose round 1: fixes in dbe7bd3 2026-10-08 20:50:31 +02:00
lilleman 3bac4c4df4 Answer product-owner round 1: fixes in dbe7bd3 2026-10-08 20:50:31 +02:00
lilleman 8055a33b48 Answer stability round 1: fixes in dbe7bd3 2026-10-08 20:50:31 +02:00
lilleman 4c8dbe8da2 Answer security round 1: nothing to fix 2026-10-08 20:50:31 +02:00
lilleman d3071455d8 Answer architecture round 3: fixes in dbe7bd3 2026-10-08 20:50:31 +02:00
lilleman dbe7bd3abd Answer stability, product-owner, prose and architecture round 3: count only a commit's last history entry toward the base, merge the default branch in before each ruling, judge the scoring run's trigger on the plan as the chunk leaves it, count a vote naming no place as same, say in the changelog what a worse ruling and the floor do to the owner, and correct item 29 2026-10-08 20:50:19 +02:00
lilleman 51949a06dd Answer architecture round 2: merge the default branch in when the base is newer than the branch point, fall back to the first ruling's base, state the floor's trigger in the pass table, name the comprehension check once, and record the round's ruling of same 2026-10-08 20:46:46 +02:00
lilleman 96aebc74a0 Record the paired ruling of architecture round 1 at the time its seats finished 2026-10-08 20:42:14 +02:00
lilleman c1978a4738 Record the paired ruling of architecture round 1 2026-10-08 20:42:05 +02:00
lilleman fbe753e1b5 Answer architecture round 1: move the base only past a scoring run or a ruling of better, take it from the default branch, run the scoring run when a release's items run out or an item names the floor, rename the seat prompts, and fold the changelog's comprehension entries into the paired ruling 2026-10-08 20:41:13 +02:00
lilleman 26826685e2 Answer architecture round 1: rule against the last measured commit, launch the third and fourth seats together, name the floor's chunk by the plan, skip the whole check in the bench, and correct the history's writer and the paired brief 2026-10-08 20:36:25 +02:00
lilleman 9ae7b07620 Wrap the paired ruling's paragraph 2026-10-08 20:33:17 +02:00
lilleman c28fac088d Decide the ratchet by a paired ruling, and check the floor on each release's last item 2026-10-08 20:32:15 +02:00
lilleman 88f1671388 Merge pull request 'Plan item 73: measure first, then choose between write access and a wrapper' (#227) from item-73-detail into main 2026-10-08 19:47:21 +02:00
lilleman eb4dc7ab72 Answer prose round 1: name what each route asks, correct which reviewers lack Write, and record that a subagent cannot start another 2026-10-08 19:47:19 +02:00
lilleman 12ed8053df Plan item 73: measure first, then choose between write access and a wrapper 2026-10-08 19:46:37 +02:00
lilleman 1881190be9 Merge pull request 'Spend larv-review's rounds only where a fix can change the outcome' (#226) from review-rounds into main 2026-10-08 19:43:34 +02:00
lilleman a3ecbacaab Answer prose round 1: close prose on its fixes, name which fixes rerun which pass, tie the full scan's replacement of /security-review to the change it runs on, and keep prose-reviewer's growth check within its one round 2026-10-08 19:43:28 +02:00
lilleman fc3170e0ec Record the reading cost of the chunks loop-claude finished 2026-10-08 19:41:41 +02:00
lilleman 6b8f55136b Rerun after a fix only the passes it answers or fires, and run one security pass per round 2026-10-08 19:41:35 +02:00
lilleman 12d6d75462 Merge pull request 'Measure each chunk's reading cost from loop-claude's archive and keep it in its own record' (#225) from reading-cost into main 2026-10-08 19:29:58 +02:00
lilleman c7333c05ee Rescore: PR #225 passes the ratchet; lilleman ships it under the floor 2026-10-08 19:29:52 +02:00
lilleman 8c9bf090f1 Answer architecture round 4: anchor the record's headings to a UTC stamp, import the archive's names from their owner, keep docs/reading-cost.md out of the panel's reading, and order the decision's reasons 2026-10-08 18:02:03 +02:00
lilleman 946daf5e3f Answer architecture round 4: give the figures their own docs/reading-cost.md, and package the tool as bin/reading-cost with one module that reads loop-claude's archive 2026-10-08 17:59:19 +02:00
lilleman 60353275f6 Answer architecture round 4: record the rescore, which fell under the ratchet on Locality and Shape 2026-10-08 17:54:46 +02:00
lilleman 1fc91a5535 Answer prose round 3: drop the claim that no later run deletes the reading-cost item 2026-10-08 16:47:31 +02:00
lilleman f35e525b9c Answer prose round 2: score the reading-cost item like any other, and name the question item a failed run refreshes 2026-10-08 16:47:03 +02:00
lilleman 35907caefa Answer prose round 1: mark the reading-cost item decision, split the rise rule's reasons, and say the trend counts since the last reset 2026-10-08 16:46:20 +02:00
lilleman 5e5eea21e5 Answer product-owner round 1: keep the help's history path on one line 2026-10-08 16:43:38 +02:00
lilleman da1ef19795 Answer product-owner round 1: name the figure's new input tokens, label the places' counts, give a usage error one line, and say where the reading-cost item goes 2026-10-08 16:43:22 +02:00
lilleman f33704872f Answer stability round 1: name the tool's medians in larv-review 2026-10-08 16:40:31 +02:00
lilleman 5062a97158 Answer stability round 1: compare medians, refuse unknown options, name the archive read, repair a failed run, and pass the clock and home in from main 2026-10-08 16:40:26 +02:00
lilleman 24efce674c Answer architecture round 2: keep reading_cost's main to finding, updating and reporting 2026-10-08 16:32:39 +02:00
lilleman aa062da0bd Answer architecture round 2: split reading_cost's main, reset the trend when the reading-cost item ships, order figures by finish time, share the archive's stamp format 2026-10-08 16:31:37 +02:00
lilleman 471350d388 Answer architecture round 1: give the transcript archive one module that writes and reads it, anchor the finished line to its stamp, build Reads once, and record the scoring run 2026-10-08 16:28:49 +02:00
lilleman 13d8b167a7 Answer architecture round 1: measure from loop-claude's archive in the CLI, file the reading-cost item only on a rise, keep only tracked files 2026-10-08 16:22:14 +02:00
lilleman 1b8142e7e5 Measure each chunk's reading cost from its transcript and keep it in the comprehension history 2026-10-08 15:40:43 +02:00
lilleman cefb297e14 Merge pull request 'Keep every scoring run in an append-only comprehension history' (#224) from comprehension-history into main 2026-10-08 15:26:30 +02:00
lilleman f199118e74 Answer architecture round 2: the rescore fell within the panel's noise; lilleman decided to ship, recorded in the comprehension floor entry 2026-10-08 15:26:20 +02:00
lilleman 9ea4f0abf6 Answer prose round 3: nothing to fix; moving the stand-in into the Ratchet bullet declined, the term is defined five lines below and a fourth round costs more 2026-10-08 14:59:43 +02:00
lilleman 7b86497a93 Answer product-owner round 3: nothing to fix 2026-10-08 14:59:43 +02:00
lilleman a483e8d637 Answer stability round 2: nothing to fix 2026-10-08 14:59:04 +02:00
lilleman aff4ba6651 Answer prose round 2: cut the contrastive tail, phrase the conflict rule as an instruction, let the moved heading carry a date or time 2026-10-08 14:59:04 +02:00
lilleman 4f0f801ba0 Answer product-owner round 2: the old scores stand in while the default branch's history is empty, and means carry two decimals 2026-10-08 14:59:04 +02:00
lilleman 897c6e9552 Answer stability round 1: an appended run re-enters no pass, and a conflict keeps the default branch's runs first 2026-10-08 14:57:33 +02:00
lilleman c2c5d4b885 Answer prose round 1: the old scores' move is a paragraph of its own, the mean row is the seats' mean, the ratchet's empty case names both records 2026-10-08 14:56:48 +02:00
lilleman 7426f84aff Answer product-owner round 1: move an old entry's five scores whatever its wording, keep the rest of the entry, label each seat's places 2026-10-08 14:55:55 +02:00
lilleman 894f99e55b Answer architecture round 1 (scoring run): record the run, list the floor's records as one set, inline the README's reason for the floor Python 2026-10-08 14:53:27 +02:00
lilleman a58a0a8262 Answer architecture round 1: stamp runs in UTC, define a moved run's shape, correct the changelog, file three findings outside the chunk 2026-10-08 14:43:18 +02:00
lilleman c14707da54 Keep every scoring run in an append-only comprehension history 2026-10-08 14:37:48 +02:00
lilleman 3f5e0bb1ae Merge pull request 'Plan cutting review cost and measuring comprehension cheaply from real work' (#223) from plan-review-cost into main 2026-10-08 14:33:30 +02:00
lilleman 6750d24c6d Answer prose round 2: nothing to fix; the repeated 'need' in item 76 declined, a third round for one sentence costs more than it reads better (goal 1.4) 2026-10-08 14:32:46 +02:00
lilleman d983d0ef11 Answer prose round 1: name item 75's seats and settle rule, state what needs item 76, cut restatements 2026-10-08 14:32:20 +02:00
lilleman 961d8e6bfb Plan cutting review cost and measuring comprehension cheaply from real work 2026-10-08 14:31:31 +02:00
lilleman 6bb432f52a Merge pull request 'Put quality with the fewest interrupts first in the goals' (#222) from goals-quality-first into main 2026-10-08 14:31:24 +02:00
lilleman 88d146aeda Answer prose round 2: nothing to fix 2026-10-08 14:30:31 +02:00
lilleman 17b46d80e8 Answer product-owner round 2: its nit's sentence is cut in prose round 1 2026-10-08 14:30:10 +02:00
lilleman 8154026efc Answer prose round 1: the changelog line states only the goal order, and the decision names why the weights depart from position 2026-10-08 14:30:05 +02:00
lilleman 9bf32c6b44 Answer product-owner round 1: state the goal weights as values, and say items serving goal 1 now rank first 2026-10-08 14:29:12 +02:00
lilleman 2f2fb60626 Put quality with the fewest interrupts first in the goals 2026-10-08 14:13:25 +02:00
lilleman 8260a54969 Merge pull request 'Rerun larv-review's scoring run before merge when a fix landed after it, and make a score under the floor or the ratchet a 🔴' (#220) from scoring-rerun into main 2026-10-08 12:26:42 +02:00
lilleman 1d39416481 Answer stability round 4 and product-owner round 4: nothing to fix; the auto-reviewer line's pointer to Count declined, Count states the exception on the next line 2026-10-08 12:26:34 +02:00
lilleman 8e2cfa59a9 Merge pull request 'Make DRY a guide: break it where the code reads, reasons or maintains better, and let a surface people write accept a second spelling' (#221) from dry-guide into main 2026-10-07 23:17:16 +02:00
lilleman 94dd717b51 Answer prose round 2: the surface exception is a sentence of its own, and the guide's limit names spellings 2026-10-07 23:16:51 +02:00
lilleman 95fd2588c0 Answer prose round 1: DRY's guide names what it breaks, yields to copies that cannot disagree, and the rejection rule names the surface exception 2026-10-07 23:16:14 +02:00
lilleman fe916873f6 Make DRY a guide: break it where the code reads, reasons or maintains better, and let a surface people write accept a second spelling 2026-10-07 23:15:08 +02:00
lilleman 5ce2feec1a Answer prose round 3: nothing to fix 2026-10-07 12:49:00 +02:00
lilleman 04a92346a3 Answer prose round 2: the Round list reads as rounds, plainer wording in Fresh and the changelog 2026-10-07 12:48:32 +02:00
lilleman d489ad75a1 Answer prose round 1: one name for the Rescore commit, a rescore is no round per Round, the changelog states the cap rule plainly 2026-10-07 12:47:44 +02:00
lilleman 44acfee149 Answer stability round 3 and product-owner round 3: a ship decision ends a floor 🔴, the changelog's cap line matches Fresh, a scores-only commit's auto-review is no round, a fall never ships 2026-10-07 12:45:56 +02:00
lilleman 4a4dadeec7 Answer stability round 2 and product-owner round 2: a ship decision answers only the floor, a rerun under an answered floor is no round, the scores commit is pushed and checked before merge 2026-10-07 12:44:57 +02:00
lilleman ee9da2fb07 Answer stability round 1 and product-owner round 1: a floor or ratchet score is never filed or declined, Fresh alone reruns the scoring run, a clean rerun is no round, the scores commit re-enters no pass 2026-10-07 12:43:23 +02:00
lilleman fb8ba8a187 Rerun larv-review's scoring run before merge when a fix landed after it, and make a score under the floor or the ratchet a 🔴 2026-10-07 12:39:02 +02:00
lilleman e360c0ca87 Merge pull request 'Give README an Update section that moves a machine's checkout to the latest tag' (#218) from update-command into main 2026-10-07 00:45:18 +02:00
36 changed files with 2127 additions and 132 deletions
+6
View File
@@ -24,7 +24,13 @@
!bin/loop_claude/**/
!bin/loop_claude/**/*.py
!bin/markdown_sections.py
!bin/metric-bench
!bin/metric_bench/
!bin/metric_bench/*.py
!bin/rank_todo.py
!bin/reading-cost
!bin/reading_cost/
!bin/reading_cost/*.py
!bin/statusline.py
!bin/test_*.py
!docs/
+7 -4
View File
@@ -11,19 +11,22 @@ Decisions live in `docs/decisions.md`:
- comprehension floor: every dimension and the overall at 7.0 or above, and 0.1.0 waits on it
- loop-claude: each project's model lives in `~/.claude/loop-claude-models.json`, which only loop-claude writes
- review: a pass gets at most three rounds per chunk; instead of a fourth, the run asks the human
- review: a fix for a 🟢 or ❓ re-enters review like any fix
- review: a project decision may suspend the scoring run for the plan items it names
- review: a fix for a 🔴 or 🟡 reruns the pass that found it and each pass whose trigger names fixes like it; a fix for a 🟢, a ❓ or a prose finding reruns none
- review: a paired ruling against the last measured commit decides the ratchet; the four-seat scoring run checks the floor when a release's items run out or an item names the floor
- review: a project decision may suspend the comprehension check for the plan items it names
- review: a pass skips only on a precedent: a decision, or a plan item crediting the pass, that the repo held before the chunk began
- loop-claude: the archive keeps the raw transcript, and a failed archive stops the loop
- loop-claude: a `claude` that cannot start is a failed worker run, retried
- review: an ask no user answers leaves the PR unmerged
- loop-claude: every claude it starts bypasses permissions inside its sandbox
- review: `/security-review` is the security pass of record
- review: `/security-review` is the security pass of record, except where the full scan runs on the same change and replaces it
- review: the premises chunk's whole review is the human's approval
- workflow-bench/: the remote may show the bench cases' names and commit SHAs
- settings.json: Claude Code runs in auto mode with the dangerous-mode prompt skipped
- the repo may name bender, bender-infra and ai-sandbox
- todo.md: one table of items scored by the formula and goal weights it states, held to its bar, ranked by `bin/rank_todo.py`
- reading cost: larv-review measures each finished chunk from loop-claude's archive and appends the figure to `docs/reading-cost.md` in the next chunk's PR
- reading cost: a rise is the last 5 chunks' median above the 5 before them, and files or refreshes one plan item
## Working rules
@@ -31,7 +34,7 @@ Decisions live in `docs/decisions.md`:
## Scoring run
The project values for `skills/comprehension-panel/scoring-run.md`:
The project values for `skills/comprehension-panel/seat-prompts.md`:
- `{language}`: Python
- `{kind}`: a Claude Code configuration with an agent loop and review skills
+10 -3
View File
@@ -2,14 +2,21 @@
## Unreleased
- larv-review skips the comprehension scoring run for a chunk whose plan items a project decision names. The decision also names the later item whose scoring run ends the suspension. Neither the comprehension floor nor the ratchet can block a skipped chunk, its summary cites the decision, and a chunk shipping its release's last item is always measured.
- The new `bin/metric-bench` benches cheap static metrics of a project's Python against the places its comprehension history names as hardest: cognitive complexity, length, shared state and change spread, each scored by how well it ranks the named functions above the rest. No metric enters review yet.
- larv-review blocks a merge when simulated readers rule that the PR makes the project read worse than the last measured commit: the default branch's newest merged change that added a scoring run to `docs/comprehension-history.md`, or whose last ruling there is better. A ruling of same leaves that commit in place, so a worse ruling may name places earlier chunks wrote. In each architecture pass Mid A and the inherited architect vote better, same or worse; when they disagree, the maintainability senior and Junior A vote too. A ruling needs a lead of two or more votes, else it is same, and a vote that names no place counts as same. A worse ruling never ships: after three rounds larv-review asks you for another round, a no leaves the PR unmerged, and so does an unattended run. The four-seat scoring run checks the comprehension floor only when a chunk ships or removes a release's last plan item, or ships an item naming the floor; between those runs the floor blocks nothing. A score under the floor blocks the merge until fixed or until you decide to ship; a decision in `docs/decisions.md` that lets every chunk ship under the floor counts as yours.
- larv-review reruns fewer passes after a fix. A fix reruns the pass whose 🔴 or 🟡 it answers, plus stability when the fix changes behaviour, security when it opens an untrusted-input boundary or touches authn/authz, secrets or crypto, and architecture when it carries an architectural decision. A rerun reviews only what changed since that pass last reviewed. A fix for a 🟢, a ❓ or any prose finding reruns no pass, and prose takes one round.
- larv-review runs one security pass on each change: the full scan alone when it runs, else `/security-review`.
- larv-review runs the new `bin/reading-cost`, which measures each chunk `loop-claude` finished from its archive: the new input tokens the worker and its subagents took in before the worker's first commit, and the files git tracks that they read most. It appends each figure the project's `docs/reading-cost.md` lacks. Once 10 chunks are measured, and the last 5 chunks' median is above the 5 before them, larv-review files one plan item naming the files read most, or refreshes it. The chunk that ships it runs `reading-cost --reset`, so the trend counts only chunks that finished after it.
- larv-review appends every paired ruling and scoring run to the project's `docs/comprehension-history.md`: the commit the seats read, a ruling's base, each seat's vote or scores, and the places each seat named. The PR summary gives each ruling with its base and votes. The `comprehension floor:` entry in `docs/decisions.md` keeps only the decisions to ship under the floor; a project's next scoring run moves the last scores the entry still holds into the history. The seats do not read the history.
- The README's goals put quality with the fewest interrupts first, as goal 1; sharing the setup, backups and leaking nothing follow as goals 2–4.
- larv-review reruns the comprehension check before merge when any commit since its last run changes more than `docs/decisions.md`, `docs/comprehension-history.md`, `docs/reading-cost.md`, `todo.md` or `CHANGELOG.md`, so the recorded result is the merged commit's. A result that blocks the merge is never filed in `todo.md`. A rerun counts toward the three-round cap only when it reports a block that no decision of yours covers.
- larv-review skips the comprehension check for a chunk whose plan items a project decision names. The decision also names the later item whose check ends the suspension. A skipped chunk cannot be blocked for reading worse or for the floor, and its summary cites the decision. A chunk that ships or removes a release's last plan item, or ships an item naming the floor, still gets the scoring run.
- README → Install and Update give the commands that check the latest tag out into `~/.claude`: on a new machine, whether or not Claude Code has already created the directory, and on one already on an older tag.
- A session commits changes Claude Code made to `settings.json` only once their diff holds no credential, and asks you to move any credential out of the file first.
- A technical principle, "Sane defaults, where a default serves better than an explicit ask". A default suits a value most callers want, does no harm when wrong, and can be seen and changed. It lives at the program's edge, such as a CLI; a library still asks for data, the clock and randomness.
- larv-review's principles audit reads only the files under `~/.claude/principles/` that apply to the project, launching a file's auditor when unsure. A file's `Applies to` line says what it covers; one without the line covers every project. The summary names each file left out. After its first round, the architecture pass reruns the scoring run and only the reviewers whose 🔴 or 🟡 the fixes answer, unless the fixes carry an architectural decision.
- larv-review's principles audit reads only the files under `~/.claude/principles/` that apply to the project, launching a file's auditor when unsure. A file's `Applies to` line says what it covers; one without the line covers every project. The summary names each file left out. After its first round, the architecture pass reruns only the reviewers whose 🔴 or 🟡 the fixes answer, unless the fixes carry an architectural decision.
- When `loop-claude`'s judge rules a chunk unfinished, the resumed worker is shown the passage the judge quoted as the work remaining. A loop started before this change exits 1 at its next reload; rerun it.
- larv-review's architecture pass and full security scan get short names, `Architecture` and `Full scan`. Each round's commit is titled with its pass's name in lower case: `Answer full scan round 1: …`.
- larv-review's comprehension floor now says, without another file open, what the scoring run measures. A project's `docs/decisions.md` keeps the last scoring run's scores, and a later run scoring below them blocks the merge until fixed. After three rounds larv-review asks you; an unattended run leaves the PR unmerged with the question. A PR under the floor that scores no lower than the last run merges once you decide to ship. A decision in `docs/decisions.md` that lets every chunk ship under the floor counts as yours. A project without those scores gets them at its next scoring run.
- `loop-claude`'s judge reads your `~/.claude/CLAUDE.md` beside the project's `AGENTS.md` and `docs/decisions.md`. It no longer interrupts for a choice that file settles, and it answers the worker's questions from it.
- `loop-claude`'s judge holds a chunk open until each answer you typed in it that a later chunk could need is recorded. An answer counts as recorded once the README's goals or audience, `AGENTS.md`, `docs/decisions.md` or `~/.claude/CLAUDE.md` hold it. It also counts once the transcript shows the worker writing it into the README's goals or audience, `AGENTS.md`, `docs/decisions.md`, `todo.md` or a code comment. The worker writing to `~/.claude/CLAUDE.md` does not count, since new rules there are yours. The resumed worker is told this rule.
- `loop-claude` archives each answer the judge quotes, with the question it answers and its UTC time, in `<sha256>.outcomes.md`.
+2 -2
View File
@@ -34,10 +34,10 @@ How work proceeds in any repo, unless the repo's `AGENTS.md` says otherwise. The
## Quality
Quality is proven by review. Every change is reviewed as a diff. The whole project is measured when a change carries an architectural decision, and before each release, because a project can drift from the principles one clean diff at a time. A project decision may suspend only the comprehension panel's scoring run (`larv-review` §3 → "Architecture" → "Suspended"). `larv-review` §3 says which review runs when. Quality has three parts. When two pull against each other, the earlier one wins.
Quality is proven by review. Every change is reviewed as a diff. The whole project is measured when a change carries an architectural decision, and before each release, because a project can drift from the principles one clean diff at a time. `larv-review` §3 says which review runs when. Quality has three parts. When two pull against each other, the earlier one wins.
1. **Correct.** The work does what the goals and the plan say, and tests prove it.
2. **True to the technical principles** (`~/.claude/principles/technical-principles.md`). The `comprehension-panel` skill scores KISS; a score under the comprehension floor (`larv-review` §3 → "Architecture") blocks a merge. **Comprehension never falls:** a chunk starts from the last panel recorded on the default branch, and when its own panel scores any dimension or the overall lower, even within the panel's noise, improve what the readers named and score again. An equal score passes. After three such rounds, stop and ask the human.
2. **True to the technical principles** (`~/.claude/principles/technical-principles.md`). The `comprehension-panel` skill measures KISS in `larv-review`'s comprehension check (§3 → "Architecture"), which a project decision may suspend, unlike any other review. **Comprehension never falls:** when readers comparing the chunk with the last commit the panel scored or ruled better rule that it reads worse, improve what they named and rule again. After three such rounds, stop and ask the human. At a release's end, or for an item naming it, a score under the comprehension floor blocks a merge.
3. **Plainly written**, per "Prose".
## Prose
+9 -5
View File
@@ -1,18 +1,18 @@
# Claude Code configuration
My personal `~/.claude`, version controlled: `CLAUDE.md` and `AGENTS.md` for instructions, the words under `CLAUDE.md` → "Vocabulary"; `agents/` and `skills/`; `principles/` for what the reviewer agents hold projects to; `docs/` for decisions; `settings.json` for the harness and `.claude/settings.json` for the harness inside this repo; `CHANGELOG.md` and `todo.md`; the tools in `bin/`; and `workflow-bench/`, the scripts and prompts of the 2026-09-30 bench of larv-review.
My personal `~/.claude`, version controlled: `CLAUDE.md` and `AGENTS.md` for instructions, the words under `CLAUDE.md` → "Vocabulary"; `agents/` and `skills/`; `principles/` for what the reviewer agents hold projects to; `docs/` for decisions and the comprehension history; `settings.json` for the harness and `.claude/settings.json` for the harness inside this repo; `CHANGELOG.md` and `todo.md`; the tools in `bin/`; and `workflow-bench/`, the scripts and prompts of the 2026-09-30 bench of larv-review.
## Goals
1. Make my claude setup shareable between computers.
2. Keep my claude setup and the transcripts of unattended runs, the bench's included, backed up.
3. Leak nothing to the remote — no credentials, no transcripts, no memory files.
4. Get the highest quality out of Claude Code while interrupting me the least, so development scales.
1. Get the highest quality out of Claude Code while interrupting me the least, so development scales.
1. Proven, stellar output quality: code, documentation and plans.
2. Decide by the project's goals when confident; ask me when not, and never the same thing twice.
3. The same rules in every project and every session.
4. Add cost only where it meaningfully raises quality; otherwise work to lower cost.
5. Delivery speed.
2. Make my claude setup shareable between computers.
3. Keep my claude setup and the transcripts of unattended runs, the bench's included, backed up.
4. Leak nothing to the remote — no credentials, no transcripts, no memory files.
## Audience
@@ -65,8 +65,12 @@ Rename `## Unreleased` in `CHANGELOG.md` to the version, commit, tag that commit
## Tools
Install puts only `loop-claude` on `PATH`; call the others by their path, such as `~/.claude/bin/metric-bench`, from the project's checkout.
- `loop-claude <task>` runs a project's next chunk cycle after cycle; `loop-claude --help` states its contract.
- `metric-bench [history]` benches cheap static metrics of a project's Python against the places its comprehension history names as hardest; `metric-bench --help` states the metrics and the scores.
- `rank_todo.py [--check] [todo.md]` scores and ranks a project's `todo.md`; `rank_todo.py --help` states the format.
- `reading-cost [--reset] [record]` appends a figure for each chunk `loop-claude` finished to a project's `docs/reading-cost.md`, and says whether the figures rise; `reading-cost --help` states the measure.
- `statusline.py` renders Claude Code's status line; `settings.json` → `statusLine` runs it.
Test on the host, with `uv` on `PATH` to fetch mypy and the Python version Install names (`docs/decisions.md` → `bin/`): `python3 -m unittest discover -s bin -p 'test_*.py'`
+1 -1
View File
@@ -21,7 +21,7 @@ Also report a sentence contradicting another, a claim the code shows false, and
## Growth
Report the lines each file gained and lost. From round 2, a fix that added words without naming what a reader could not understand without them is a finding.
Report the lines each file gained and lost. A line an earlier pass's fix added that names no reader need is a finding.
## Scopes
+2 -2
View File
@@ -2,7 +2,7 @@ import dataclasses
import typing
from loop_claude.cycle.states import Active, Archived, Closing, Ended, Event, HumanAnswered, Interrupting, Judging, QUOTED_ANSWERS_PER_CYCLE, Ruled, State, transition, WorkerRan, Working
from loop_claude.cycle.archive import archive
from loop_claude.transcript_archive import archive, FINISHED, UNFINISHED
from loop_claude.claude_code.session import delete_session, Session, session_open, transcript_file
from loop_claude.effects import Effects
from failure import Failure
@@ -109,7 +109,7 @@ def question_for(ruling: Interrupt | QuotedAnswer) -> str:
def close(cycle: Cycle, transcript_path: str, verdict: Finished | Unfinished) -> Archived | Stop:
finished = isinstance(verdict, Finished)
if failure := archive(cycle.project_key, transcript_path, cycle.task, f"Verdict: {'finished' if finished else 'unfinished'}\n\nEvidence:\n{quoted(verdict.evidence)}", cycle.effects.now(), cycle.paths):
if failure := archive(cycle.project_key, transcript_path, cycle.task, f"{FINISHED if finished else UNFINISHED}\n\nEvidence:\n{quoted(verdict.evidence)}", cycle.effects.now(), cycle.paths):
return Stop(1, failure.reason)
if finished and (failure := delete_session(cycle.session)):
return Stop(1, failure.reason)
@@ -1,6 +1,8 @@
import dataclasses
import hashlib
import os
import pathlib
import re
import sys
import time
@@ -10,6 +12,20 @@ from file_writes import make_private, replace_file
from loop_claude.paths import Paths
from loop_claude.claude_code.session import session_files
FINISHED = "Verdict: finished"
UNFINISHED = "Verdict: unfinished"
STAMP = "%Y-%m-%dT%H:%M:%SZ"
STAMPED = r"\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ"
FINISHED_AT = re.compile(rf"^({STAMPED}) {re.escape(FINISHED)}$", re.MULTILINE)
@dataclasses.dataclass(frozen=True)
class FinishedChunk:
folder: str
finished: str
transcript: pathlib.Path
subagents: list[pathlib.Path]
def archive(project_key: str, path: str, task: str, outcome: str, at: float, paths: Paths) -> Failure | None:
try:
@@ -25,7 +41,7 @@ def archive(project_key: str, path: str, task: str, outcome: str, at: float, pat
return unkept
copy = folder / f"{hashlib.sha256(raw).hexdigest()}.jsonl"
outcomes = copy.with_suffix(".outcomes.md")
stamped = f"{time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(at))} {outcome}"
stamped = f"{utc(at)} {outcome}"
if copy.exists() and outcomes.exists():
return add_outcome(outcomes, stamped)
# The copy lands last, so a copy on disk always has its outcomes and its session's files beside it.
@@ -85,3 +101,21 @@ def copy_for(copy: pathlib.Path, data: bytes) -> pathlib.Path | None:
return copy if data != kept else None
beside = copy.with_name(f"{copy.name}.{hashlib.sha256(data).hexdigest()}")
return None if beside.exists() else beside
def utc(at: float) -> str:
return time.strftime(STAMP, time.gmtime(at))
# One per chunk folder, its latest finished copy, in the order they finished.
def finished_chunks(project_archive: pathlib.Path) -> list[FinishedChunk] | Failure:
found = []
try:
for folder in sorted(path for path in project_archive.glob("*") if path.is_dir()):
copies = sorted((stamps[-1], outcomes) for outcomes in folder.glob("*.outcomes.md") if (stamps := FINISHED_AT.findall(outcomes.read_text(encoding="utf-8"))))
if copies:
finished, outcomes = copies[-1]
found.append(FinishedChunk(folder.name, finished, outcomes.with_name(outcomes.name.removesuffix(".outcomes.md") + ".jsonl"), sorted(folder.glob("session/*/subagents/*.jsonl"))))
except (OSError, UnicodeDecodeError) as failure:
return Failure(f"could not read the archive {project_archive}: {failure}")
return sorted(found, key=lambda chunk: (chunk.finished, chunk.folder))
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env python3
import pathlib
import sys
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
from metric_bench import main
sys.exit(main.main(sys.argv[1:]))
View File
+83
View File
@@ -0,0 +1,83 @@
from typing import Callable
import collections
import dataclasses
import statistics
from metric_bench.places import Place
from metric_bench.python_units import Unit
METRICS: dict[str, Callable[[Unit, dict[str, int]], int]] = {
"cognitive complexity": lambda unit, spread: unit.cognitive,
"length": lambda unit, spread: unit.length,
"shared state": lambda unit, spread: unit.shared_state,
"change spread": lambda unit, spread: spread.get(unit.path, 0),
}
# Code Maat's default --max-changeset-size: a sweep across the tree couples every file to every other.
LARGEST_CHANGESET = 30
@dataclasses.dataclass(frozen=True)
class Score:
auc: float
top_k: float
constant: bool
@dataclasses.dataclass(frozen=True)
class RunScores:
units: int
named: int
unmeasured: int
scores: dict[str, Score]
def co_changed(log: str) -> dict[str, int]:
"""For each file, how many other files changed in a commit with it, commits of more than LARGEST_CHANGESET files left out; log is `git log --format=tformat:@@ --name-only`."""
partners: dict[str, set[str]] = collections.defaultdict(set)
for commit in log.split("@@\n"):
files = set(filter(None, commit.split("\n")))
if len(files) > LARGEST_CHANGESET:
continue
for path in files:
partners[path] |= files - {path}
return {path: len(others) for path, others in partners.items()}
def bench(units: list[Unit], places: list[Place], unresolved: int, spread: dict[str, int]) -> RunScores | None:
"""How well each metric ranks the units the seats named above the rest; None when the named units are none or all of them. unresolved counts the places that named no tracked file."""
names = {(place.path, place.name) for place in places}
named = [unit for unit in units if (unit.path, unit.name) in names]
if not named or len(named) == len(units):
return None
rest = [unit for unit in units if (unit.path, unit.name) not in names]
found = {(unit.path, unit.name) for unit in named}
unmeasured = unresolved + len({place for place in places if (place.path, place.name) not in found})
scores = {}
for metric, value in METRICS.items():
named_values = [value(unit, spread) for unit in named]
rest_values = [value(unit, spread) for unit in rest]
scores[metric] = Score(auc(named_values, rest_values), top_k(named_values, rest_values), len(set(named_values + rest_values)) == 1)
return RunScores(len(units), len(named), unmeasured, scores)
def auc(named: list[int], rest: list[int]) -> float:
"""The chance a named unit outranks one not named, a tie counting half: 0.5 is a coin toss, 1.0 a perfect ranking."""
wins = sum((a > b) + 0.5 * (a == b) for a in named for b in rest)
return wins / (len(named) * len(rest))
def top_k(named: list[int], rest: list[int]) -> float:
"""The share of the metric's k highest units the seats named, k being how many they named. Units tied at the cut share its remaining slots evenly, as a random order of them would."""
k = len(named)
cut = sorted(named + rest, reverse=True)[k - 1]
above = sum(value > cut for value in named)
slots = k - above - sum(value > cut for value in rest)
tied_named = sum(value == cut for value in named)
tied = tied_named + sum(value == cut for value in rest)
return (above + slots * tied_named / tied) / k
def medians(runs: list[RunScores]) -> dict[str, Score]:
return {metric: Score(statistics.median(run.scores[metric].auc for run in runs), statistics.median(run.scores[metric].top_k for run in runs), all(run.scores[metric].constant for run in runs)) for metric in METRICS}
+153
View File
@@ -0,0 +1,153 @@
"""Bench cheap static metrics against the places a project's comprehension panel named as hardest.
usage: metric-bench [history]
history defaults to docs/comprehension-history.md in the checkout it runs in, and the bench reads
the checkout that holds the history. For each scoring run in it, at the commit the panel read, it
measures each module-level function and each method of a module-level class in the Python files git
tracks, leaving out test_*.py, *_test.py and anything under a tests/ folder:
- cognitive complexity: SonarSource's white paper, read for Python;
- length: lines;
- shared state: attributes on self that another method of the class also writes, plus names
declared global or nonlocal;
- change spread: how many other files changed in a commit with the unit's file, up to that commit,
leaving out commits of more than 30 files.
It then prints, for each metric, how well it ranks the units the panel named above the rest: AUC
(0.5 is a coin toss, 1.0 a perfect ranking) and top k (the share of the metric's k highest units
the panel named, k being how many it named; Chance is what top k scores at random). A metric that
gave every unit one value reads "constant". A last row gives the medians. Unmeasured counts the
distinct places that name no Python function or method, such as a section of a markdown file, or no
single tracked file.
Below the table it names:
- each run it skipped because its commit is not in the checkout;
- each run it could not score because its places name no measured unit, or every one;
- each file left out of its run because it does not parse on this Python.
Exit 1, saying why, on unknown arguments, or when git cannot start or finds no checkout, the history
cannot be read, or no scoring run could be scored.
"""
import pathlib
import statistics
import subprocess
import sys
from metric_bench.bench import bench, co_changed, medians, METRICS, RunScores, Score
from failure import Failure
from metric_bench.python_units import measured, python_units, Unit
from metric_bench.places import resolved, scoring_runs, ScoringRun
def main(argv: list[str]) -> int:
if argv in (["-h"], ["--help"]):
print(__doc__.strip())
return 0
if len(argv) > 1 or argv[:1] and argv[0].startswith("-"):
print(f"unknown arguments {' '.join(argv)}; usage: metric-bench [history]", file=sys.stderr)
return 1
read = read_history(pathlib.Path(argv[0]).resolve() if argv else None)
if isinstance(read, Failure):
return failed(read)
top, history, text = read
benched = bench_runs(text, top)
if isinstance(benched, Failure):
return failed(benched)
rows, notes = benched
if not rows:
return failed(Failure(f"no scoring run in {history} could be scored; its format: ~/.claude/skills/larv-review/SKILL.md → \"History\"{noted(notes)}"))
print(table(rows) + noted(notes))
return 0
def read_history(given: pathlib.Path | None) -> tuple[str, pathlib.Path, str] | Failure:
"""The checkout that holds the history, the history's path and its text."""
if given and not given.parent.is_dir():
return Failure(f"could not read {given}: no folder {given.parent}")
found = git(["rev-parse", "--show-toplevel"], str(given.parent) if given else None)
if isinstance(found, Failure):
return found
history = given or pathlib.Path(found.strip(), "docs", "comprehension-history.md")
if not given and not history.exists():
return Failure(f"no comprehension history at {history}; larv-review writes one at a project's first paired ruling or scoring run")
try:
return found.strip(), history, history.read_text(encoding="utf-8")
except (OSError, UnicodeDecodeError) as failure:
return Failure(f"could not read {history}: {failure}")
def bench_runs(text: str, top: str) -> tuple[list[tuple[str, RunScores]], list[str]] | Failure:
"""Each scored run's heading and scores, and a note for each run skipped or not scored and each file left out."""
rows = []
notes = []
for run in scoring_runs(text):
if isinstance(missing := git(["cat-file", "-e", f"{run.commit}^{{commit}}"], top), Failure):
notes.append(f"Skipped, its commit is not in {top}: {run.heading} ({missing.reason})")
continue
scored = run_scores(run, top)
if isinstance(scored, Failure):
return scored
scores, unparsed = scored
notes += [f"Left out of {run.heading}: {reason}" for reason in unparsed]
if scores:
rows.append((run.heading, scores))
else:
notes.append(f"Not scored, its places name no measured unit or every one: {run.heading}")
return rows, notes
def noted(notes: list[str]) -> str:
return "\n\n" + "\n".join(notes) if notes else ""
def run_scores(run: ScoringRun, top: str) -> tuple[RunScores | None, list[str]] | Failure:
"""The run's scores, and why each file that does not parse was left out."""
listed = git(["ls-tree", "-r", "-z", "--name-only", run.commit], top)
if isinstance(listed, Failure):
return listed
tracked = list(filter(None, listed.split("\0")))
units: list[Unit] = []
unparsed = []
for path in filter(measured, tracked):
source = git(["show", f"{run.commit}:{path}"], top)
if isinstance(source, Failure):
return source
found = python_units(path, source)
if isinstance(found, Failure):
unparsed.append(found.reason)
else:
units += found
log = git(["-c", "core.quotePath=false", "log", "--no-merges", "--format=tformat:@@", "--name-only", run.commit], top)
if isinstance(log, Failure):
return log
places, dropped = resolved(run.places, tracked)
return bench(units, places, len(set(dropped)), co_changed(log)), unparsed
def table(rows: list[tuple[str, RunScores]]) -> str:
head = ["Scoring run", "Units", "Named", "Unmeasured", "Chance", *METRICS]
lines = ["| " + " | ".join(head) + " |", "|" + "---|" * len(head)]
for heading, run in rows:
lines.append("| " + " | ".join([heading, str(run.units), str(run.named), str(run.unmeasured), f"top k {run.named / run.units:.2f}", *(cell(run.scores[metric]) for metric in METRICS)]) + " |")
medianed = medians([run for _, run in rows])
chance = statistics.median(run.named / run.units for _, run in rows)
lines.append("| " + " | ".join(["Median", "", "", "", f"top k {chance:.2f}", *(cell(medianed[metric]) for metric in METRICS)]) + " |")
return "\n".join(lines)
def cell(score: Score) -> str:
return "constant" if score.constant else f"AUC {score.auc:.2f}, top k {score.top_k:.2f}"
def git(args: list[str], cwd: str | None) -> str | Failure:
try:
ran = subprocess.run(["git", *args], capture_output=True, cwd=cwd, encoding="utf-8", errors="replace")
except OSError as failure:
return Failure(f"could not start git: {failure.strerror}")
return ran.stdout if ran.returncode == 0 else Failure(f"git {' '.join(args)}: {ran.stderr.strip()}")
def failed(failure: Failure) -> int:
print(failure.reason, file=sys.stderr)
return 1
+73
View File
@@ -0,0 +1,73 @@
import dataclasses
import os
import re
from markdown_sections import sections
# The format: skills/larv-review/SKILL.md §3 → "History", which names this reader.
RUN = re.compile(r"^(.+), (.+) at ([0-9a-f]{7,40})$")
SEAT_PLACES = re.compile(r"^.+, (hardest first|would restructure first):$")
# `path:line` or `:line`, then the unit's name where one follows.
PLACE = re.compile(r"`([^`\s]*):\d+`(?: `(\w+)`)?")
@dataclasses.dataclass(frozen=True)
class Place:
path: str
name: str | None
@dataclasses.dataclass(frozen=True)
class ScoringRun:
heading: str
commit: str
places: list[Place]
def scoring_runs(history: str) -> list[ScoringRun]:
"""Each scoring run in a comprehension history, with the places its seats named, as they wrote them; paired rulings name what changed, not what is hard, and are left out."""
runs = []
for heading, bodies in sections(history).items():
if (named := RUN.match(heading)) and ", against " not in heading:
runs.append(ScoringRun(heading, named.group(3), [place for body in bodies for place in seat_places(body)]))
return runs
def seat_places(body: str) -> list[Place]:
places = []
listing = False
for line in body.splitlines():
if SEAT_PLACES.match(line):
listing = True
elif listing and line.startswith("- "):
places += bullet_places(line)
elif not line.startswith(" "):
listing = False
return places
def bullet_places(bullet: str) -> list[Place]:
"""A `:line` with no path is in the file named before it in the bullet."""
places = []
path = ""
for match in PLACE.finditer(bullet):
path = match.group(1) or path
if path:
places.append(Place(path, match.group(2)))
return places
def resolved(places: list[Place], tracked: list[str]) -> tuple[list[Place], list[Place]]:
"""Entries written before paths were written from the repository's root shorten a path once they have named its folder: `cycle/run.py` after `bin/loop_claude/cycle/states.py`. Each place resolves to the one tracked file it names, or, where several match, the one in the folder of the place resolved before it; a place naming no file, or several, is dropped. Returns the resolved places and the dropped ones."""
found = []
dropped = []
before = ""
for place in places:
candidates = [place.path] if place.path in tracked else [path for path in tracked if path.endswith("/" + place.path)]
nearest = [path for path in candidates if path.startswith(os.path.dirname(before) + "/")] if len(candidates) > 1 else candidates
if len(nearest) == 1:
before = nearest[0]
found.append(Place(before, place.name))
else:
dropped.append(place)
return found, dropped
+127
View File
@@ -0,0 +1,127 @@
import ast
import collections
import dataclasses
import sys
from failure import Failure
FUNCTION = (ast.FunctionDef, ast.AsyncFunctionDef)
@dataclasses.dataclass(frozen=True)
class Unit:
path: str
name: str
cognitive: int
length: int
shared_state: int
def measured(path: str) -> bool:
"""A Python file outside the tests."""
folders, _, name = path.rpartition("/")
return name.endswith(".py") and not name.startswith("test_") and not name.endswith("_test.py") and "tests" not in folders.split("/")
def python_units(path: str, source: str) -> list[Unit] | Failure:
"""Each module-level function and each method of a module-level class in source, with its metrics."""
try:
tree = ast.parse(source)
except (SyntaxError, ValueError) as failure:
return Failure(f"{path} does not parse on Python {sys.version_info[0]}.{sys.version_info[1]}: {failure}")
units = []
for node in tree.body:
if isinstance(node, FUNCTION):
units.append(unit(path, node, 0))
elif isinstance(node, ast.ClassDef):
shared = shared_writes(node)
units += [unit(path, method, shared[method.name]) for method in node.body if isinstance(method, FUNCTION)]
return units
def unit(path: str, node: ast.FunctionDef | ast.AsyncFunctionDef, shared: int) -> Unit:
globals_written = sum(len(statement.names) for statement in ast.walk(node) if isinstance(statement, ast.Global | ast.Nonlocal))
return Unit(path, node.name, cognitive(node), (node.end_lineno or node.lineno) - node.lineno + 1, shared + globals_written)
def shared_writes(cls: ast.ClassDef) -> collections.Counter[str]:
"""For each method, how many of the attributes it writes on self another method of the class writes too."""
writers = collections.defaultdict(set)
for method in cls.body:
if isinstance(method, FUNCTION):
for node in ast.walk(method):
for target in written(node):
if isinstance(target, ast.Attribute) and isinstance(target.value, ast.Name) and target.value.id == "self":
writers[target.attr].add(method.name)
return collections.Counter(method for methods in writers.values() if len(methods) > 1 for method in methods)
def written(node: ast.AST) -> list[ast.expr]:
if isinstance(node, ast.Assign):
targets = node.targets
elif isinstance(node, ast.AugAssign | ast.AnnAssign | ast.For | ast.AsyncFor | ast.comprehension):
targets = [node.target]
elif isinstance(node, ast.withitem) and node.optional_vars:
targets = [node.optional_vars]
else:
return []
return [leaf for target in targets for leaf in assigned(target)]
def assigned(target: ast.expr) -> list[ast.expr]:
"""What a target writes: each part of an unpacking, and for `x[i] = …` the x."""
if isinstance(target, ast.Tuple | ast.List):
return [leaf for element in target.elts for leaf in assigned(element)]
if isinstance(target, ast.Starred | ast.Subscript):
return assigned(target.value)
return [target]
# SonarSource's "Cognitive Complexity" white paper (G. Ann Campbell, 2017), read for Python: a comprehension counts as a loop and each of its `if` clauses as a condition.
def cognitive(function: ast.FunctionDef | ast.AsyncFunctionDef) -> int:
return inside(function.body, 0, function.name)
# One case per node type, as the white paper gives one rule per structure.
def score(node: ast.AST, nesting: int, name: str) -> int:
"""The cognitive complexity `node` adds, its children included, at nesting depth `nesting`; a call to `name`, the function's own, counts as recursion."""
if isinstance(node, ast.If):
return 1 + nesting + branches(node, nesting, name)
if isinstance(node, ast.For | ast.AsyncFor | ast.While):
head = node.test if isinstance(node, ast.While) else node.iter
return 1 + nesting + score(head, nesting, name) + inside(node.body, nesting + 1, name) + (1 + inside(node.orelse, nesting + 1, name) if node.orelse else 0)
if isinstance(node, ast.Try | ast.TryStar):
handlers = sum(1 + nesting + inside(handler.body, nesting + 1, name) for handler in node.handlers)
return inside(node.body + node.orelse + node.finalbody, nesting, name) + handlers
if isinstance(node, ast.Match):
return 1 + nesting + score(node.subject, nesting, name) + sum(inside(case.body, nesting + 1, name) for case in node.cases)
if isinstance(node, ast.IfExp):
return 1 + nesting + inside([node.test, node.body, node.orelse], nesting + 1, name)
if isinstance(node, ast.ListComp | ast.SetComp | ast.DictComp | ast.GeneratorExp):
return sum(1 + nesting + len(generator.ifs) for generator in node.generators) + inside(list(ast.iter_child_nodes(node)), nesting + 1, name)
if isinstance(node, ast.FunctionDef | ast.AsyncFunctionDef | ast.Lambda):
return inside(node.body if isinstance(node.body, list) else [node.body], nesting + 1, name)
return (isinstance(node, ast.BoolOp) or called(node) == name) + inside(list(ast.iter_child_nodes(node)), nesting, name)
def called(node: ast.AST) -> str | None:
"""The function a call names, or the method it calls on self."""
if not isinstance(node, ast.Call):
return None
if isinstance(node.func, ast.Name):
return node.func.id
if isinstance(node.func, ast.Attribute) and isinstance(node.func.value, ast.Name) and node.func.value.id == "self":
return node.func.attr
return None
def inside(nodes: list, nesting: int, name: str) -> int:
return sum(score(node, nesting, name) for node in nodes)
def branches(node: ast.If, nesting: int, name: str) -> int:
"""An if's test and bodies; an elif or else adds 1 at no extra depth."""
total = score(node.test, nesting, name) + inside(node.body, nesting + 1, name)
if len(node.orelse) == 1 and isinstance(node.orelse[0], ast.If):
return total + 1 + branches(node.orelse[0], nesting, name)
return total + (1 + inside(node.orelse, nesting + 1, name) if node.orelse else 0)
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env python3
import pathlib
import sys
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
from reading_cost import main
sys.exit(main.main(sys.argv[1:]))
View File
+20
View File
@@ -0,0 +1,20 @@
import pathlib
import typing
from failure import Failure
from loop_claude.transcript_archive import FinishedChunk
from loop_claude.paths import paths_from
from loop_claude.project.checkout import project_key
def project_archive(checkout_root: str, home: pathlib.Path, env: typing.Mapping[str, str]) -> pathlib.Path:
paths = paths_from(home, env)
return paths.transcript_archive / project_key(checkout_root, paths.code)
def read_threads(chunk: FinishedChunk) -> list[bytes] | Failure:
"""The worker's transcript, then each subagent's."""
try:
return [path.read_bytes() for path in (chunk.transcript, *chunk.subagents)]
except OSError as failure:
return Failure(f"could not read {failure.filename}: {failure.strerror}")
+71
View File
@@ -0,0 +1,71 @@
import collections
import re
import statistics
from failure import Failure
from loop_claude.transcript_archive import FinishedChunk, STAMPED
from reading_cost.measure import Reading
from markdown_sections import sections
FIGURE = re.compile(rf"^Reading cost, chunk (\w+), finished ({STAMPED})$")
PLACE = re.compile(r"^- `(.+)` (\d+)$")
PLACES_KEPT = 10
RESET = "Reading cost reset, "
RESET_AT = re.compile(rf"^{RESET}({STAMPED})$")
TOKENS = re.compile(r"^(\d+) new input tokens before the first commit\.$")
WINDOW = 5
def unheld(chunks: list[FinishedChunk], record: str) -> list[FinishedChunk]:
held = {match.group(1) for heading in sections(record) if (match := FIGURE.match(heading))}
return [chunk for chunk in chunks if chunk_id(chunk) not in held]
def chunk_id(chunk: FinishedChunk) -> str:
return chunk.folder[:12]
def figure(chunk: FinishedChunk, reading: Reading) -> str:
places = "".join(f"- `{path}` {times}\n" for path, times in ranked(reading.places))
return f"## Reading cost, chunk {chunk_id(chunk)}, finished {chunk.finished}\n\n{reading.tokens} new input tokens before the first commit.\n" + (f"\nRead most (opens and searches):\n\n{places}" if places else "")
# The figures after the last reset, in the order their chunks finished: each machine appends its own archive's chunks.
def readings_of(record: str) -> list[Reading] | Failure:
dated = []
resets = [""]
for heading, bodies in sections(record).items():
if reset := RESET_AT.match(heading):
resets.append(reset.group(1))
elif named := FIGURE.match(heading):
lines = bodies[0].splitlines() if bodies else []
tokens = [int(match.group(1)) for line in lines if (match := TOKENS.match(line))]
if len(tokens) != 1:
return Failure(f"the figure under \"## {heading}\" holds no single tokens line; restore it from git history")
dated.append((named.group(2), heading, Reading(tokens[0], collections.Counter({match.group(1): int(match.group(2)) for line in lines if (match := PLACE.match(line))}))))
elif heading.startswith("Reading cost"):
return Failure(f"\"## {heading}\" names no chunk and UTC time, or no reset time; restore it from git history")
return [reading for finished, _, reading in sorted(dated, key=lambda item: item[:2]) if finished > max(resets)]
def ranked(places: collections.Counter[str]) -> list[tuple[str, int]]:
return sorted(places.items(), key=lambda item: (-item[1], item[0]))[:PLACES_KEPT]
def merged(record: str, figures: list[str]) -> str:
return record.rstrip("\n") + "\n\n" + "\n".join(figures)
def trend(readings: list[Reading]) -> str:
if len(readings) < 2 * WINDOW:
return f"{len(readings)} chunks measured since the last reset; the trend needs {2 * WINDOW}."
last, earlier = median_tokens(readings[-WINDOW:]), median_tokens(readings[-2 * WINDOW:-WINDOW])
medians = f"the last {WINDOW} chunks' median is {last} new input tokens before their first commit, the {WINDOW} before them {earlier}."
if last <= earlier:
return f"Not rising: {medians}"
read_most = "".join(f"\n- `{path}` {times}" for path, times in ranked(sum((reading.places for reading in readings[-WINDOW:]), collections.Counter())))
return f"Rising: {medians}\n\nRead most over the last {WINDOW} (opens and searches):\n{read_most}"
def median_tokens(readings: list[Reading]) -> int:
return round(statistics.median(reading.tokens for reading in readings))
+132
View File
@@ -0,0 +1,132 @@
"""Measure each chunk loop-claude finished, append the figures to a project's record, and say whether they rise.
usage: reading-cost [--reset] [record]
Run it inside a project checkout or one of its worktrees. record defaults to docs/reading-cost.md
there, created when missing. It reads loop-claude's archive of the project,
$LOOP_CLAUDE_TRANSCRIPTS/<key> (default ~/.claude/loop-claude-transcripts), <key> being the
checkout's path relative to ~/code, or to / outside it. For each finished chunk the record does not
yet hold, it measures what the worker and its subagents read before the worker's first commit: their
new input tokens (uncached and cache-written; cache reads excluded), and how often they opened or
searched each file git tracks in the checkout. A chunk whose worker never committed is not measured.
Each figure is appended under a "## Reading cost, chunk <id>, finished <UTC time>" heading, in the
order the chunks finished.
--reset also appends a "## Reading cost reset, <UTC time>" heading: the trend then counts only
figures of chunks that finished after it.
It then compares the median tokens of the record's last 5 figures with the 5 before them, in the
order their chunks finished, and prints "Rising:" or "Not rising:" with both medians. Rising, it
lists the files the last 5 chunks read most. With fewer than 10 figures, it says so.
Exit 1, saying why, on unknown arguments, or when git cannot start or finds no checkout, the
archive or the record cannot be read or written, or a figure in the record cannot be read back.
"""
import dataclasses
import os
import pathlib
import subprocess
import sys
import time
from reading_cost.measure import Checkout, measure, Reading
from failure import Failure
from reading_cost.figures import figure, merged, readings_of, RESET, trend, unheld
from loop_claude.transcript_archive import finished_chunks, utc
from reading_cost.archive import project_archive, read_threads
from file_writes import replace_file
@dataclasses.dataclass(frozen=True)
class Updated:
appended: int
readings: list[Reading]
def main(argv: list[str]) -> int:
reset = argv[:1] == ["--reset"]
given = argv[1:] if reset else argv
if given in (["-h"], ["--help"]):
print(__doc__.strip())
return 0
if len(given) > 1 or given[:1] and given[0].startswith("-"):
print(f"unknown arguments {' '.join(given)}; usage: reading-cost [--reset] [record]", file=sys.stderr)
return 1
checkout = located()
if isinstance(checkout, Failure):
return failed(checkout)
home = pathlib.Path.home()
archive = project_archive(checkout.root, home, os.environ)
record = pathlib.Path(given[0]) if given else pathlib.Path(checkout.top, "docs", "reading-cost.md")
updated = update(record, archive, checkout, str(home), utc(time.time()) if reset else None)
if isinstance(updated, Failure):
return failed(updated)
print(f"Appended {updated.appended} reading-cost figure{'' if updated.appended == 1 else 's'} from {archive}{' and a reset' if reset else ''} to {record}.")
print(trend(updated.readings))
return 0
def update(record: pathlib.Path, archive: pathlib.Path, checkout: Checkout, home: str, reset_at: str | None) -> Updated | Failure:
text = read_record(record)
if isinstance(text, Failure):
return text
figures = new_figures(text, archive, checkout, home)
if isinstance(figures, Failure):
return figures
marks = [*figures, f"## {RESET}{reset_at}\n"] if reset_at else figures
text = merged(text, marks) if marks else text
readings = readings_of(text)
if isinstance(readings, Failure):
return readings
if marks and (unwritten := write_record(record, text)):
return unwritten
return Updated(len(figures), readings)
def new_figures(record: str, archive: pathlib.Path, checkout: Checkout, home: str) -> list[str] | Failure:
chunks = finished_chunks(archive)
if isinstance(chunks, Failure):
return chunks
figures = []
for chunk in unheld(chunks, record):
threads = read_threads(chunk)
if isinstance(threads, Failure):
return threads
if reading := measure(threads, checkout, home):
figures.append(figure(chunk, reading))
return figures
def write_record(record: pathlib.Path, text: str) -> Failure | None:
try:
record.parent.mkdir(parents=True, exist_ok=True)
except OSError as failure:
return Failure(f"could not write {record}: {failure.strerror}")
unwritten = replace_file(record, text.encode())
return Failure(f"could not write {record}: {unwritten.reason}") if unwritten else None
def failed(failure: Failure) -> int:
print(failure.reason, file=sys.stderr)
return 1
def located() -> Checkout | Failure:
try:
found = subprocess.run(["git", "rev-parse", "--path-format=absolute", "--show-toplevel", "--git-common-dir"], capture_output=True, text=True)
if found.returncode != 0:
return Failure(found.stderr.strip())
top, common = found.stdout.splitlines()
listed = subprocess.run(["git", "ls-files", "-z"], capture_output=True, cwd=top, text=True)
except (OSError, ValueError) as failure:
return Failure(f"could not find the checkout: {failure}")
if listed.returncode != 0:
return Failure(listed.stderr.strip())
# The common dir is the checkout's .git, whichever worktree runs this.
return Checkout(str(pathlib.Path(common).parent), top, frozenset(filter(None, listed.stdout.split("\0"))))
def read_record(record: pathlib.Path) -> str | Failure:
try:
return record.read_text(encoding="utf-8") if record.exists() else "# Reading cost\n"
except (OSError, UnicodeDecodeError) as failure:
return Failure(f"could not read {record}: {failure}")
+80
View File
@@ -0,0 +1,80 @@
import collections
import dataclasses
import re
from loop_claude.claude_code.entries import assistant_parts, parse_entry, tool_call
from reading_cost.shell_reads import Reads, resolved, shell_reads
COMMIT = re.compile(r"(^|[\s;&|(])git\s+(-C\s+\S+\s+)?commit\b")
@dataclasses.dataclass(frozen=True)
class Reading:
"""What the worker and its subagents took in before the worker's first commit."""
tokens: int
places: collections.Counter[str]
@dataclasses.dataclass(frozen=True)
class Checkout:
root: str
top: str
tracked: frozenset[str]
def measure(threads: list[bytes], checkout: Checkout, home: str) -> Reading | None:
worker, *subagents = [entries_of(thread) for thread in threads]
commit = commit_time(worker)
if commit is None:
return None
before = [[entry for entry in thread if entry.get("type") == "assistant" and str(entry.get("timestamp", "")) < commit] for thread in (worker, *subagents)]
reads = [reads_of(part, str(entry.get("cwd") or "/"), home) for thread in before for entry in thread for part in assistant_parts(entry)]
roots = [checkout.root, *(added for found in reads for added in found.added)]
places = collections.Counter(place for found in reads for path in found.read if (place := relative(path, roots)) in checkout.tracked)
return Reading(sum(map(tokens_in, before)), places)
def entries_of(raw: bytes) -> list[dict]:
return [entry for line in raw.splitlines() if (entry := parse_entry(line))]
def commit_time(worker: list[dict]) -> str | None:
for entry in worker:
for part in assistant_parts(entry):
name, arguments = call_of(part)
if name == "Bash" and COMMIT.search(str(arguments.get("command", ""))):
return str(entry.get("timestamp", ""))
return None
def tokens_in(entries: list[dict]) -> int:
# Claude Code writes one entry per content block of a message, each with the message's usage.
usages = {str(message.get("id") or entry.get("uuid")): message.get("usage") for entry in entries if isinstance(message := entry.get("message"), dict)}
return sum(count(usage, "input_tokens") + count(usage, "cache_creation_input_tokens") for usage in usages.values() if isinstance(usage, dict))
# A count Claude Code left out or wrote as another type adds nothing, so one odd entry leaves the rest of the figure standing.
def count(usage: dict, field: str) -> int:
value = usage.get(field)
return value if isinstance(value, int) else 0
def call_of(part: object) -> tuple[object, dict]:
call = tool_call(part)
return (call[0], call[1]) if call and isinstance(call[1], dict) else (None, {})
def reads_of(part: object, cwd: str, home: str) -> Reads:
name, arguments = call_of(part)
path = arguments.get("file_path") if name == "Read" else arguments.get("path") if name == "Grep" else None
if path:
return Reads([resolved(cwd, str(path), home)], [])
return shell_reads(str(arguments.get("command", "")), cwd, home) if name == "Bash" else Reads([], [])
# Relative to the deepest root holding it, so the checkout and each worktree name a file alike.
def relative(path: str, roots: list[str]) -> str | None:
holding = [root for root in roots if path.startswith(root.rstrip("/") + "/")]
return path[len(max(holding, key=len).rstrip("/")) + 1:] if holding else None
+91
View File
@@ -0,0 +1,91 @@
"""The files a shell command reads, and the worktrees it adds, as absolute paths."""
import dataclasses
import posixpath
import re
import shlex
import typing
NOT_A_PATH = re.compile(r"[*?\[\]{}$\\'\",=()<>|;&]|://|^\d+$")
# Their first operand is a pattern or a program, unless -e or -f gives it.
PATTERN_FIRST = {"awk", "egrep", "grep", "rg", "sed"}
READERS = {"awk", "bat", "cat", "egrep", "grep", "head", "less", "more", "nl", "rg", "sed", "tail", "wc"}
WORKTREE_OPTIONS_WITH_VALUE = {"-b", "-B", "--reason"}
@dataclasses.dataclass(frozen=True)
class Reads:
read: list[str]
added: list[str]
def shell_reads(command: str, cwd: str, home: str) -> Reads:
read: list[str] = []
added: list[str] = []
base = cwd
for tokens in shell_lines(command):
for words in segments(tokens):
if words[0] == "cd" and len(words) == 2:
base = resolved(base, words[1], home)
read += [resolved(base, word, home) for word in operands(words)]
added += [resolved(base, path, home) for path in worktree_added(words)]
return Reads(read, added)
def shell_lines(command: str) -> typing.Iterator[list[str]]:
"""Each line's tokens, skipping a heredoc's body, which feeds a program."""
ends = None
for line in command.splitlines():
if ends is not None:
ends = None if line.strip() == ends else ends
continue
try:
lexer = shlex.shlex(line, posix=True, punctuation_chars=True)
lexer.whitespace_split = True
tokens = list(lexer)
except ValueError:
continue
# The lexer splits <<-EOF into << and -EOF.
ends = next((tokens[index + 1].removeprefix("-") for index, token in enumerate(tokens[:-1]) if token == "<<"), None)
yield tokens
def segments(tokens: list[str]) -> list[list[str]]:
found: list[list[str]] = [[]]
target = False
for token in tokens:
if target:
target = False
elif all(char in "();<>|&" for char in token):
# A redirect's target is not an operand, so it does not count as a read.
target = "<" in token or ">" in token
found.append([])
else:
found[-1].append(token)
return [words for words in found if words]
def operands(words: list[str]) -> list[str]:
program = posixpath.basename(words[0])
if program not in READERS or (program == "sed" and any(word.startswith("-i") for word in words)):
return []
given = [word for word in words[1:] if not word.startswith("-")]
if program in PATTERN_FIRST and not {"-e", "-f"} & set(words):
given = given[1:]
return [word for word in given if ("/" in word or re.search(r"\.[A-Za-z0-9]+$", word)) and not NOT_A_PATH.search(word)]
# git worktree add [-b <branch>] <path> [<commit>]
def worktree_added(words: list[str]) -> list[str]:
if words[:1] != ["git"] or "worktree" not in words or words[words.index("worktree") + 1:][:1] != ["add"]:
return []
after = iter(words[words.index("worktree") + 2:])
for word in after:
if word in WORKTREE_OPTIONS_WITH_VALUE:
next(after, None)
elif not word.startswith("-"):
return [word]
return []
def resolved(base: str, path: str, home: str) -> str:
return posixpath.normpath(posixpath.join(base, home + path[1:] if path == "~" or path.startswith("~/") else path))
+1 -1
View File
@@ -8,7 +8,7 @@ CITATION = re.compile(r'`?CLAUDE\.md`? → ("[^"]+"(?:,? (?:and )?"[^"]+")*)')
HEADING = re.compile(r"^#+ (.+?)(?: \(.*\))?$", re.MULTILINE)
LEAD = re.compile(r"^(?:- )?\*\*(.+?)(?:\*\*|[:.](?=\*\*| )| —)", re.MULTILINE)
NAME = re.compile(r'"([^"]+)"')
STRAY = re.compile(r'CLAUDE\.md(?!`? → ")[^\n"]{1,5}"')
STRAY = re.compile(r'CLAUDE\.md(?!`? → "|:\d)[^\n"]{1,5}"')
class Citations(unittest.TestCase):
+2 -1
View File
@@ -16,12 +16,13 @@ import uuid
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
from loop_claude.cycle import archive, interrupt, judge, retry, run, states, worker
from loop_claude import transcript_archive as archive
from loop_claude.project import checkout, model_choice, records
from loop_claude.effects import Effects
from loop_claude.claude_code import entries, session, transcript, trust
from failure import Failure
from loop_claude.cycle.judge_reply import Finished, Interrupt, QuotedAnswer, Unfinished, verdict_from
from loop_claude.cycle import interrupt, judge, retry, run, states, worker
from loop_claude.cycle.retry import Limited
from loop_claude.loop import main, reload
from loop_claude import paths
+6 -1
View File
@@ -18,6 +18,11 @@ import unittest
BIN = pathlib.Path(__file__).resolve().parent
TASK = "Do the next chunk."
# A git hook's GIT_DIR, the host's LOOP_CLAUDE_* or PYTHONPATH would point the program under test at the host's own state.
def host_env() -> dict[str, str]:
return {name: value for name, value in os.environ.items() if not name.startswith(("GIT_", "LOOP_CLAUDE_", "PYTHON"))}
# Plays claude from FAKE_CLAUDE_SCENARIO, one step per call, logging each call; a step for another role,
# or none left, is Ctrl-C to loop-claude, which otherwise loops forever.
FAKE_CLAUDE = """#!{python}
@@ -155,7 +160,7 @@ class Checkout:
self.root.mkdir(parents=True)
(self.root / "README.md").write_text(PREMISES)
self.script = BIN / "loop-claude"
self.env = {name: value for name, value in os.environ.items() if not name.startswith(("GIT_", "LOOP_CLAUDE_", "PYTHON"))}
self.env = host_env()
fake = self.temp / "fake-bin"
fake.mkdir()
(fake / "claude").write_text(FAKE_CLAUDE.format(python=sys.executable))
+249
View File
@@ -0,0 +1,249 @@
import ast
import os
import pathlib
import subprocess
import sys
import tempfile
import textwrap
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
from metric_bench.bench import auc, bench, co_changed, top_k
from metric_bench.python_units import cognitive, measured, python_units, Unit
from failure import Failure
from test_loop_claude_black_box import host_env
from metric_bench.places import Place, resolved, scoring_runs
TOOL = pathlib.Path(__file__).resolve().parent / "metric-bench"
def scored(source: str) -> int:
function = ast.parse(textwrap.dedent(source)).body[0]
assert isinstance(function, ast.FunctionDef)
return cognitive(function)
class Cognitive(unittest.TestCase):
def test_scores_the_white_papers_sum_of_primes_without_its_labelled_continue(self):
self.assertEqual(scored("""
def sum_of_primes(limit):
total = 0
for i in range(1, limit + 1):
for j in range(2, i):
if i % j == 0:
break
total += i
return total
"""), 6)
def test_counts_elif_and_else_flat_and_a_nested_ternary_by_its_depth(self):
self.assertEqual(scored("""
def f(a):
if a:
return 1 if a > 1 else 2
elif a is None:
return 3
else:
return 4
"""), 5)
def test_counts_each_boolean_operator_sequence_a_handler_a_match_and_recursion(self):
self.assertEqual(scored("""
def f(a, b, c):
try:
if a and b and c or a:
match a:
case 1:
return f(b, c, a)
except ValueError:
pass
"""), 1 + 2 + 2 + 1 + 1)
def test_nests_a_while_a_lambda_and_an_inner_function(self):
self.assertEqual(scored("""
def f(a):
while a:
g = lambda b: 1 if b else 2
def h():
if a:
pass
"""), 1 + 3 + 3)
def test_counts_a_call_to_itself_on_self_as_recursion(self):
self.assertEqual(scored("""
def walk(self, node):
return self.walk(node.child)
"""), 1)
def test_counts_a_comprehension_as_a_loop_and_its_conditions(self):
self.assertEqual(scored("""
def f(rows):
return [row for row in rows if row if row > 1]
"""), 3)
class Units(unittest.TestCase):
def test_measures_functions_and_methods_with_the_state_methods_share(self):
units = python_units("a.py", textwrap.dedent("""
COUNT = 0
def bump():
global COUNT
COUNT += 1
class Box:
def __init__(self):
self.size = 0
def grow(self):
self.size += 1
self.name = "x"
def rename(self):
self.name, self.other = "y", 1
self.buf[self.size] = 0
"""))
self.assertEqual(units, [Unit("a.py", "bump", 0, 3, 1), Unit("a.py", "__init__", 0, 2, 1), Unit("a.py", "grow", 0, 3, 2), Unit("a.py", "rename", 0, 3, 1)])
def test_measures_python_files_outside_the_tests(self):
self.assertEqual([path for path in ["a.py", "bin/test_a.py", "a_test.py", "tests/b.py", "e2e-tests/c.py", "README.md"] if measured(path)], ["a.py", "e2e-tests/c.py"])
def test_a_source_that_does_not_parse_is_a_failure_naming_it(self):
failure = python_units("a.py", "def (")
assert isinstance(failure, Failure)
self.assertIn("a.py does not parse on Python", failure.reason)
class Places(unittest.TestCase):
HISTORY = textwrap.dedent("""
# Comprehension history
## 2026-10-08T12:50:49Z, PR #224 at a58a0a8
| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |
|---|---|---|---|---|---|
| Mean | 7 | 7 | 7 | 7 | 7 |
Junior A, hardest first:
- `skills/x/SKILL.md:77` "Architecture"
- `bin/tool/cycle/states.py:69` `transition`, with `cycle/run.py:55` `step` and `:90` `close`
Inherited architect, would restructure first:
- `bin/tool/cycle/judge.py:31` `run_judge`
## 2026-10-08T18:37:21Z, PR #228 at 2682668, against 8c9bf09
Mid A, decided by:
- `bin/tool/cycle/run.py:1` `step`
""")
def test_reads_each_scoring_runs_places_and_leaves_paired_rulings_out(self):
runs = scoring_runs(self.HISTORY)
self.assertEqual([(run.heading, run.commit) for run in runs], [("2026-10-08T12:50:49Z, PR #224 at a58a0a8", "a58a0a8")])
self.assertEqual(runs[0].places, [Place("skills/x/SKILL.md", None), Place("bin/tool/cycle/states.py", "transition"), Place("cycle/run.py", "step"), Place("cycle/run.py", "close"), Place("bin/tool/cycle/judge.py", "run_judge")])
def test_resolves_a_shortened_path_to_the_file_nearest_the_one_before_it(self):
tracked = ["bin/tool/cycle/states.py", "bin/tool/cycle/run.py", "bin/other/cycle/run.py"]
places = [Place("bin/tool/cycle/states.py", "transition"), Place("cycle/run.py", "step"), Place("gone.py", "x")]
self.assertEqual(resolved(places, tracked), ([Place("bin/tool/cycle/states.py", "transition"), Place("bin/tool/cycle/run.py", "step")], [Place("gone.py", "x")]))
def test_a_full_path_wins_over_a_file_in_the_folder_before_it(self):
self.assertEqual(resolved([Place("pkg/x.py", "a"), Place("main.py", "f")], ["pkg/x.py", "main.py", "pkg/main.py"])[0][-1], Place("main.py", "f"))
def test_resolves_a_shortened_path_after_a_repeated_place_by_the_repeat(self):
tracked = ["bin/a/main.py", "bin/b/main.py", "bin/b/bench.py"]
places = [Place("bin/a/main.py", "main"), Place("bin/b/bench.py", "bench"), Place("bin/a/main.py", "main"), Place("main.py", "figures")]
self.assertEqual(resolved(places, tracked)[0][-1], Place("bin/a/main.py", "figures"))
def test_drops_a_shortened_path_two_files_match_with_no_place_before_it(self):
self.assertEqual(resolved([Place("cycle/run.py", "step")], ["bin/tool/cycle/run.py", "bin/other/cycle/run.py"]), ([], [Place("cycle/run.py", "step")]))
class Bench(unittest.TestCase):
def test_auc_is_one_for_a_perfect_ranking_and_counts_a_tie_half(self):
self.assertEqual(auc([5, 4], [1, 2]), 1.0)
self.assertEqual(auc([3], [3]), 0.5)
def test_co_changed_counts_each_files_distinct_partners_past_a_sweep(self):
sweep = "".join(f"f{i}.py\n" for i in range(31))
self.assertEqual(co_changed(f"@@\na.py\nmy b.py\n@@\na.py\nc.py\n@@\na.py\n@@\n{sweep}"), {"a.py": 2, "my b.py": 1, "c.py": 1})
def test_top_k_shares_the_seats_at_a_tied_cut_evenly(self):
self.assertEqual(top_k([0, 0], [0, 0, 0, 0]), 1 / 3)
self.assertEqual(top_k([5, 1], [1, 1]), 2 / 3)
def test_scores_the_named_units_and_counts_places_no_unit_measures(self):
units = [Unit("a.py", "hard", 9, 40, 0), Unit("a.py", "easy", 1, 5, 0), Unit("b.py", "plain", 2, 6, 0)]
run = bench(units, [Place("a.py", "hard"), Place("doc.md", None)], 2, {"a.py": 1})
assert run is not None
self.assertEqual((run.units, run.named, run.unmeasured), (3, 1, 3))
self.assertEqual((run.scores["cognitive complexity"].auc, run.scores["cognitive complexity"].top_k), (1.0, 1.0))
self.assertEqual((run.scores["shared state"].auc, run.scores["shared state"].top_k), (0.5, 1 / 3))
def test_a_run_naming_no_unit_or_every_unit_is_not_scored(self):
self.assertIsNone(bench([Unit("a.py", "f", 1, 1, 0)], [Place("doc.md", None)], 0, {}))
self.assertIsNone(bench([Unit("a.py", "f", 1, 1, 0)], [Place("a.py", "f")], 0, {}))
class BlackBox(unittest.TestCase):
def project(self, history: str) -> str:
directory = tempfile.TemporaryDirectory()
self.addCleanup(directory.cleanup)
top = directory.name
env = host_env()
for args in (["init", "-q"], ["config", "user.email", "t@t"], ["config", "user.name", "t"]):
subprocess.run(["git", *args], cwd=top, check=True, env=env)
pathlib.Path(top, "a.py").write_text("def hard(a):\n\tif a:\n\t\tfor x in a:\n\t\t\tif x:\n\t\t\t\treturn x\n\n\ndef easy():\n\treturn 1\n")
pathlib.Path(top, "test_a.py").write_text("def test_hard():\n\tif 1:\n\t\tpass\n")
subprocess.run(["git", "add", "."], cwd=top, check=True, env=env)
subprocess.run(["git", "commit", "-qm", "a"], cwd=top, check=True, env=env)
commit = subprocess.run(["git", "rev-parse", "--short", "HEAD"], cwd=top, check=True, capture_output=True, text=True, env=env).stdout.strip()
os.makedirs(pathlib.Path(top, "docs"))
pathlib.Path(top, "docs", "comprehension-history.md").write_text(history.replace("COMMIT", commit))
return top
def run_tool(self, top: str, *args: str) -> subprocess.CompletedProcess:
return subprocess.run([sys.executable, str(TOOL), *args], cwd=top, capture_output=True, text=True, env=host_env())
def test_prints_each_metrics_score_on_each_run_and_the_medians(self):
top = self.project("# Comprehension history\n\n## 2026-10-08T12:50:49Z, PR #1 at COMMIT\n\nJunior A, hardest first:\n\n- `a.py:1` `hard`\n")
ran = self.run_tool(top)
self.assertEqual(ran.returncode, 0, ran.stderr)
self.assertIn("| 2026-10-08T12:50:49Z, PR #1 at ", ran.stdout)
self.assertIn("| 2 | 1 | 0 | top k 0.50 | AUC 1.00, top k 1.00 | AUC 1.00, top k 1.00 | constant | constant |", ran.stdout)
self.assertIn("| Median |", ran.stdout)
def test_exits_1_when_no_run_names_a_measured_unit(self):
top = self.project("# Comprehension history\n\n## 2026-10-08T12:50:49Z, PR #1 at COMMIT\n\nJunior A, hardest first:\n\n- `README.md:1` \"Install\"\n")
ran = self.run_tool(top)
self.assertEqual((ran.returncode, ran.stdout), (1, ""))
self.assertIn("no scoring run in", ran.stderr)
def test_exits_1_naming_a_history_it_cannot_read_and_unknown_arguments(self):
top = self.project("")
self.assertIn("could not read", self.run_tool(top, str(pathlib.Path(top, "missing.md"))).stderr)
pathlib.Path(top, "docs", "comprehension-history.md").unlink()
self.assertIn("no comprehension history at", self.run_tool(top).stderr)
self.assertIn("could not read", self.run_tool(top, str(pathlib.Path(top, "gone", "x.md"))).stderr)
self.assertEqual(self.run_tool(top, "--x").returncode, 1)
def test_skips_and_names_a_run_whose_commit_the_checkout_lacks(self):
top = self.project("# Comprehension history\n\n## 2026-10-07T12:00:00Z, PR #0 at 0123456\n\nJunior A, hardest first:\n\n- `a.py:1` `hard`\n\n## 2026-10-08T12:50:49Z, PR #1 at COMMIT\n\nJunior A, hardest first:\n\n- `a.py:1` `hard`\n")
ran = self.run_tool(top)
self.assertEqual(ran.returncode, 0, ran.stderr)
self.assertIn("Skipped, its commit is not in", ran.stdout)
self.assertIn("PR #0 at 0123456", ran.stdout.split("Skipped")[1])
def test_names_a_run_it_cannot_score_below_the_table(self):
top = self.project("# Comprehension history\n\n## 2026-10-07T12:00:00Z, PR #0 at COMMIT\n\nJunior A, hardest first:\n\n- `README.md:1` \"Install\"\n\n## 2026-10-08T12:50:49Z, PR #1 at COMMIT\n\nJunior A, hardest first:\n\n- `a.py:1` `hard`\n")
ran = self.run_tool(top)
self.assertIn("Not scored, its places name no measured unit or every one: 2026-10-07T12:00:00Z, PR #0", ran.stdout)
def test_reads_the_checkout_that_holds_a_history_named_from_elsewhere(self):
top = self.project("# Comprehension history\n\n## 2026-10-08T12:50:49Z, PR #1 at COMMIT\n\nJunior A, hardest first:\n\n- `a.py:1` `hard`\n")
ran = self.run_tool(tempfile.gettempdir(), str(pathlib.Path(top, "docs", "comprehension-history.md")))
self.assertEqual(ran.returncode, 0, ran.stderr)
+161
View File
@@ -0,0 +1,161 @@
import collections
import contextlib
import hashlib
import io
import json
import os
import pathlib
import subprocess
import sys
import tempfile
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
from loop_claude.transcript_archive import archive, FINISHED, FINISHED_AT, finished_chunks, FinishedChunk, UNFINISHED, utc
from reading_cost.measure import Checkout, Reading
from failure import Failure
from reading_cost import figures, measure
from test_loop_claude_black_box import host_env
from loop_claude.paths import paths_from
from reading_cost.shell_reads import Reads, shell_reads
TOOL = pathlib.Path(__file__).resolve().parent / "reading-cost"
def said(timestamp, message_id, command=None, tokens=0, cwd="/c/p", **call):
part = {"type": "tool_use", "name": "Bash", "input": {"command": command}} if command else {"type": "tool_use", **call}
return {"type": "assistant", "timestamp": timestamp, "cwd": cwd, "message": {"id": message_id, "content": [part], "usage": {"input_tokens": tokens, "cache_creation_input_tokens": 2 * tokens, "cache_read_input_tokens": 1000}}}
def jsonl(entries):
return b"".join(json.dumps(entry).encode() + b"\n" for entry in entries)
def folder_name():
return hashlib.sha256(os.urandom(8)).hexdigest()
class ShellReads(unittest.TestCase):
def test_reads_operands_past_a_cd_and_skips_patterns_redirect_targets_and_heredoc_bodies(self):
command = "cd ../w && sed -n 1,5p src/a.py | grep -n x\ngrep -rn 'def x' bin/t.py > out.txt\npython3 - <<'EOF'\ncat secret.py\nEOF\ncat ~/README.md\nsed -i s/a/b/ c.py"
self.assertEqual(shell_reads(command, "/c/p", "/h"), Reads(["/c/w/src/a.py", "/c/w/bin/t.py", "/h/README.md"], []))
def test_ends_a_dashed_heredoc_at_its_marker(self):
self.assertEqual(shell_reads("cat <<-EOF > x.md\ncat secret.py\nEOF\ncat a.py", "/c/p", "/h"), Reads(["/c/p/a.py"], []))
def test_names_the_worktree_a_git_worktree_add_makes(self):
self.assertEqual(shell_reads("git worktree add -q -b topic ../p-topic origin/main", "/c/p", "/h"), Reads([], ["/c/p-topic"]))
class Measure(unittest.TestCase):
def test_counts_each_message_once_and_the_tracked_files_read_before_the_first_commit(self):
worker = [
said("1", "m1", tokens=10, name="Read", input={"file_path": "/c/p/README.md"}),
said("2", "m1", tokens=10, name="Read", input={"file_path": "/c/p/.env"}),
said("3", "m2", command="git worktree add ../w && cd ../w && cat src/a.py && cd src && cat b.py"),
said("4", "m3", command="cd /tmp && cat x.py"),
said("5", "m4", command="git -C ../w commit -m 'x'", tokens=100),
said("6", "m5", tokens=100, name="Read", input={"file_path": "/c/p/late.py"}),
]
subagent = [said("2", "s1", tokens=1, name="Grep", input={"path": "/c/w/src/a.py"}), said("7", "s2", tokens=100, name="Read", input={"file_path": "/c/p/late.py"})]
checkout = Checkout("/c/p", "/c/w", frozenset({"README.md", "late.py", "src/a.py", "src/b.py", "x.py"}))
self.assertEqual(measure.measure([jsonl(worker), jsonl(subagent)], checkout, "/h"), Reading(33, collections.Counter({"src/a.py": 2, "README.md": 1, "src/b.py": 1})))
def test_measures_nothing_for_a_worker_that_never_committed(self):
self.assertIsNone(measure.measure([jsonl([said("1", "m1", command="git log --grep commit")])], Checkout("/c/p", "/c/p", frozenset()), "/h"))
def test_skips_a_usage_that_is_not_a_count(self):
self.assertEqual(measure.tokens_in([{"message": {"id": "m", "usage": {"input_tokens": "7", "cache_creation_input_tokens": 2}}}]), 2)
class Figures(unittest.TestCase):
def test_rises_only_above_the_five_before_and_needs_ten(self):
flat = [Reading(100, collections.Counter({"a.py": 1}))] * 10
self.assertEqual(figures.trend(flat[:9]), "9 chunks measured since the last reset; the trend needs 10.")
self.assertTrue(figures.trend(flat).startswith("Not rising: the last 5 chunks' median is 100 new input tokens"))
self.assertTrue(figures.trend(flat[:9] + [Reading(3000000, collections.Counter())]).startswith("Not rising:"))
self.assertEqual(figures.trend(flat[:5] + [Reading(101, collections.Counter({"b.py": 2}))] * 5), "Rising: the last 5 chunks' median is 101 new input tokens before their first commit, the 5 before them 100.\n\nRead most over the last 5 (opens and searches):\n\n- `b.py` 10")
def test_a_figure_reads_back_as_the_reading_it_was_written_from_and_a_damaged_one_fails(self):
reading = Reading(7, collections.Counter({"b.py": 1, "a.py": 3}))
written = figures.figure(FinishedChunk("abcdef0123456789", "2026-10-08T00:00:00Z", pathlib.Path(), []), reading)
self.assertEqual(written, "## Reading cost, chunk abcdef012345, finished 2026-10-08T00:00:00Z\n\n7 new input tokens before the first commit.\n\nRead most (opens and searches):\n\n- `a.py` 3\n- `b.py` 1\n")
self.assertEqual(figures.readings_of(written), [reading])
self.assertEqual(figures.readings_of(written.replace("7 new", "seven new")), Failure('the figure under "## Reading cost, chunk abcdef012345, finished 2026-10-08T00:00:00Z" holds no single tokens line; restore it from git history'))
for damaged in (written.replace(", finished", ""), "## Reading cost reset, x\n"):
with self.subTest(damaged=damaged):
self.assertIsInstance(figures.readings_of(damaged), Failure)
def test_counts_only_figures_finished_after_the_last_reset_in_the_order_they_finished(self):
def written(chunk, finished, tokens):
return figures.figure(FinishedChunk(chunk, finished, pathlib.Path(), []), Reading(tokens, collections.Counter()))
history = "\n".join([written("a", "2026-10-01T00:00:00Z", 1), written("c", "2026-10-03T00:00:00Z", 3), "## Reading cost reset, 2026-10-02T00:00:00Z\n", written("b", "2026-10-04T00:00:00Z", 2)])
self.assertEqual(figures.readings_of(history), [Reading(3, collections.Counter()), Reading(2, collections.Counter())])
def test_the_archive_stamps_what_it_reads_back(self):
self.assertRegex(f"{utc(1790000000)} {FINISHED}", FINISHED_AT)
class ReadingCostTool(unittest.TestCase):
def setUp(self):
temp = tempfile.TemporaryDirectory()
self.addCleanup(temp.cleanup)
self.home = pathlib.Path(os.path.realpath(temp.name))
self.env = {**host_env(), "GIT_CONFIG_GLOBAL": os.devnull, "HOME": str(self.home)}
self.checkout = self.home / "code" / "proj"
self.checkout.mkdir(parents=True)
(self.checkout / "a.py").write_text("")
self.git("init", "-q")
self.git("add", "a.py")
self.git("-c", "user.name=t", "-c", "user.email=t@t", "commit", "-q", "-m", "x")
self.paths = paths_from(self.home, {})
def git(self, *args):
subprocess.run(["git", *args], cwd=self.checkout, check=True, env=self.env)
def archive_chunk(self, at, outcome=FINISHED):
transcript = self.home / ".claude" / "projects" / "-proj" / f"{folder_name()}.jsonl"
(transcript.with_suffix("") / "subagents").mkdir(parents=True)
worker = [said("1", "m1", tokens=10, cwd=str(self.checkout), name="Read", input={"file_path": str(self.checkout / "a.py")}), said("2", "m2", command="git commit -m x")]
transcript.write_bytes(jsonl([{"timestamp": str(at)}, *worker]))
(transcript.with_suffix("") / "subagents" / "agent-a.jsonl").write_bytes(jsonl([said("1", "s1", tokens=1)]))
with contextlib.redirect_stderr(io.StringIO()):
self.assertIsNone(archive("proj", str(transcript), "Do it.", f"{outcome}\n\nEvidence:\n> merged", at, self.paths))
def run_tool(self, cwd, *args):
return subprocess.run([sys.executable, str(TOOL), *args], capture_output=True, cwd=cwd, env=self.env, text=True)
def test_appends_each_finished_chunk_once_in_the_order_they_finished_from_a_worktree(self):
self.archive_chunk(1790000200)
self.archive_chunk(1790000100)
self.archive_chunk(1790000000, UNFINISHED)
chunks = finished_chunks(self.paths.transcript_archive / "proj")
self.assertEqual([chunk.finished for chunk in chunks], ["2026-09-21T14:15:00Z", "2026-09-21T14:16:40Z"])
worktree = self.home / "code" / "proj-wt"
self.git("worktree", "add", "-q", str(worktree))
ran = self.run_tool(worktree)
self.assertEqual(ran.returncode, 0, ran.stderr)
history = worktree / "docs" / "reading-cost.md"
self.assertEqual(ran.stdout, f"Appended 2 reading-cost figures from {self.home / '.claude' / 'loop-claude-transcripts' / 'proj'} to {history}.\n2 chunks measured since the last reset; the trend needs 10.\n")
figure = "## Reading cost, chunk {}, finished {}\n\n33 new input tokens before the first commit.\n\nRead most (opens and searches):\n\n- `a.py` 1\n"
self.assertEqual(history.read_text(), "# Reading cost\n\n" + "\n".join(figure.format(chunk.folder[:12], chunk.finished) for chunk in chunks))
self.assertTrue(self.run_tool(worktree).stdout.startswith(f"Appended 0 reading-cost figures from"))
self.assertEqual(history.read_text().count("## Reading cost"), 2)
reset = self.run_tool(worktree, "--reset")
self.assertEqual(reset.stdout, f"Appended 0 reading-cost figures from {self.home / '.claude' / 'loop-claude-transcripts' / 'proj'} and a reset to {history}.\n0 chunks measured since the last reset; the trend needs 10.\n")
self.assertRegex(history.read_text(), r"\n## Reading cost reset, \d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ\n$")
def test_refuses_an_option_it_does_not_know(self):
ran = self.run_tool(self.checkout, "--rest")
self.assertEqual((ran.returncode, ran.stdout), (1, ""))
def test_exits_1_outside_a_checkout(self):
ran = self.run_tool(self.home)
self.assertEqual(ran.returncode, 1)
self.assertIn("not a git repository", ran.stderr)
if __name__ == "__main__":
unittest.main()
+1 -1
View File
@@ -11,5 +11,5 @@ class Types(unittest.TestCase):
self.assertIsNotNone(floor, "README.md's Install names `Python 3.N or newer`")
if shutil.which("uv") is None:
self.fail("uv on PATH fetches mypy; see README.md's Test line")
ran = subprocess.run(["uv", "tool", "run", "--python", "%d.%d" % floor, "mypy==2.3.1", "--cache-dir=/dev/null", "--check-untyped-defs", "--disallow-untyped-defs", "-m", "rank_todo", "-m", "statusline", "-p", "loop_claude"], capture_output=True, cwd=ROOT / "bin", text=True)
ran = subprocess.run(["uv", "tool", "run", "--python", "%d.%d" % floor, "mypy==2.3.1", "--cache-dir=/dev/null", "--check-untyped-defs", "--disallow-untyped-defs", "-p", "loop_claude", "-p", "metric_bench", "-m", "rank_todo", "-p", "reading_cost", "-m", "statusline"], capture_output=True, cwd=ROOT / "bin", text=True)
self.assertEqual(ran.returncode, 0, ran.stdout + ran.stderr)
+424
View File
@@ -0,0 +1,424 @@
# Comprehension history
## 2026-10-04T18:28:07Z, PR #215 merged at 5baedb5
| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |
|---|---|---|---|---|---|
| Mean | 7.38 | 6.63 | 7.00 | 6.88 | 6.88 |
## 2026-10-08T12:50:49Z, PR #224 at a58a0a8
| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |
|---|---|---|---|---|---|
| Junior A | 7 | 6.5 | 7 | 6.5 | 7 |
| Mid A | 7.5 | 7 | 7 | 7 | 7 |
| Maintainability senior | 7.5 | 6.5 | 7 | 6.5 | 7 |
| Inherited architect | 7.5 | 7 | 7 | 7 | 7 |
| Mean | 7.38 | 6.75 | 7.00 | 6.75 | 7.00 |
Junior A, hardest first:
- `skills/larv-review/SKILL.md:77` "Architecture": Ratchet, the history move, Fresh, Suspended
- `skills/larv-review/SKILL.md:51` "Round cap", with "Re-entry"
- `bin/loop_claude/cycle/judge_reply.py:90` `verdict_from`, `cycle/judge.py:31` `run_judge`, `cycle/states.py:69` `transition`
- `bin/loop_claude/cycle/states.py:9` the `quoted_answers` counter
- `bin/loop_claude/cycle/archive.py:14` `archive`
- `bin/loop_claude/claude_code/entries.py:28` `written_by_human`
- `bin/loop_claude/loop/reload.py:50` `exec_if_edited`
- `CLAUDE.md:22` (Todo items), with `bin/rank_todo.py:235` `check_citations`
Mid A, hardest first:
- `skills/larv-review/SKILL.md:86` "Architecture"
- `bin/loop_claude/cycle/states.py:69` `transition`, with `cycle/run.py:55` `step`
- `bin/loop_claude/cycle/worker.py:41` `worker_args`
- `bin/loop_claude/cycle/judge.py:31` `run_judge`
- `bin/loop_claude/claude_code/entries.py:28` `written_by_human`
- `bin/loop_claude/cycle/archive.py:14` `archive`
- `bin/rank_todo.py:161` `rank`, `:408` `rank_details`
- `bin/loop_claude/cycle/judge_reply.py:12` `JUDGE_RULES`
Maintainability senior, hardest first:
- `skills/larv-review/SKILL.md:77` "Architecture"
- `skills/larv-review/SKILL.md:56` "Round cap" → "Count"
- `bin/loop_claude/cycle/judge_reply.py:12` `JUDGE_RULES`
- `bin/loop_claude/cycle/states.py:69` `transition`, with `cycle/run.py:104` `question_for`
- `bin/loop_claude/cycle/archive.py:14` `archive`
- `bin/loop_claude/claude_code/entries.py:28` `written_by_human`
- `bin/loop_claude/loop/reload.py:50` `exec_if_edited`
- `bin/rank_todo.py:161` `rank`, `:408` `rank_details`
Inherited architect, would restructure first:
- `skills/larv-review/SKILL.md:51` "Round cap" and `:77` "Architecture"
- `bin/loop_claude/cycle/judge_reply.py:12` `JUDGE_RULES`
- `bin/` flat folder: tools, shared modules and repo checks
- `bin/loop_claude/project/checkout.py:32` `read_utf8`
- `bin/loop_claude/loop/main.py:127` `remaining`, `cycle/run.py:96` `ruling`
## 2026-10-08T13:03:40Z, PR #224 at 9ea4f0a
| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |
|---|---|---|---|---|---|
| Junior A | 7 | 6.5 | 7 | 6 | 6.5 |
| Mid A | 7 | 6.5 | 7 | 6.5 | 7 |
| Maintainability senior | 7 | 6.5 | 7 | 6.5 | 6.5 |
| Inherited architect | 7 | 6.5 | 7 | 7 | 7 |
| Mean | 7.00 | 6.50 | 7.00 | 6.50 | 6.75 |
Junior A, hardest first:
- `skills/larv-review/SKILL.md:77` "Architecture", with `:51` "Round cap"
- `bin/loop_claude/cycle/judge_reply.py:12` `JUDGE_RULES`, `:90` `verdict_from`
- `bin/loop_claude/cycle/archive.py:14` `archive`
- `bin/loop_claude/loop/reload.py:50` `exec_if_edited`
- `bin/rank_todo.py:187` `read_scoring`, `:408` `rank_details`
- `bin/loop_claude/claude_code/entries.py:28` `written_by_human`
- `bin/loop_claude/cycle/run.py:69` `work`
- `bin/loop-claude:7` the `sys.path` insert
Mid A, hardest first:
- `skills/larv-review/SKILL.md:86` "Architecture"
- `skills/larv-review/SKILL.md:51` "Round cap" → "Count"
- `bin/loop_claude/cycle/judge_reply.py:12` `JUDGE_RULES`
- `bin/loop_claude/cycle/archive.py:14` `archive`
- `bin/loop_claude/claude_code/entries.py:28` `written_by_human`
- `bin/rank_todo.py:408` `rank_details`
- `bin/loop_claude/cycle/states.py:69` `transition`
- `bin/loop_claude/loop/reload.py:50` `exec_if_edited`
Maintainability senior, hardest first:
- `skills/larv-review/SKILL.md:51` "Round cap", with `:77` "Architecture"
- `bin/loop_claude/cycle/states.py:69` `transition`
- `bin/loop_claude/cycle/judge_reply.py:12` `JUDGE_RULES`, `cycle/judge.py:31` `run_judge`
- `bin/loop_claude/cycle/archive.py:14` `archive`
- `bin/loop_claude/claude_code/entries.py:28` `written_by_human`
- `bin/rank_todo.py:408` `rank_details`
- `bin/loop_claude/loop/reload.py:50` `exec_if_edited`
- `bin/loop_claude/loop/main.py:1` the `--help` docstring
Inherited architect, would restructure first:
- `bin/loop_claude/cycle/judge.py:53` `judge_prompt` and `judge_reply.py:12` `JUDGE_RULES`: one home for the judge's prompt
- `bin/` flat folder: shared modules and tests
- `skills/larv-review/SKILL.md:27` §3: bold labels to addressable headings
- `bin/loop_claude/loop/main.py:5` `--help` and `cycle/retry.py:40`: numbers restating constants
- `bin/loop_claude/project/checkout.py:32` `read_utf8`
- `agents/stability-reviewer.md:3`, `agents/systems-architect.md:3`: house style
- `workflow-bench/bench.py:26`: not runnable from the repo
## 2026-10-08T14:28:39Z, PR #225 at 13d8b16
| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |
|---|---|---|---|---|---|
| Junior A | 7 | 6 | 7 | 6 | 6.5 |
| Mid A | 7 | 6.5 | 7 | 6 | 6.5 |
| Maintainability senior | 7.5 | 7 | 7.5 | 7 | 7 |
| Inherited architect | 7 | 6.5 | 6.5 | 7 | 7 |
| Mean | 7.13 | 6.50 | 7.00 | 6.50 | 6.75 |
Junior A, hardest first:
- `skills/larv-review/SKILL.md:79` "Architecture": Floor, Ratchet, Fresh, Suspended, and the history paragraph at `:95`
- `skills/larv-review/SKILL.md:53` "Round cap", with `:64` "Re-entry"
- `bin/loop_claude/cycle/judge.py:31` `run_judge`, with `grounded`, `verbatim` and `plain`
- `bin/loop_claude/cycle/states.py:69` `transition`, with `cycle/run.py:55` `step` and `:104` `question_for`
- `bin/loop_claude/claude_code/entries.py:28` `written_by_human`
- `bin/loop_claude/cycle/archive.py:28` `archive`, with `copy_for` and `finished_chunks`
- `bin/reading_cost.py:145` `measure`, with `bin/shell_reads.py:52` `segments` and `:67` `operands`
- `bin/rank_todo.py:408` `rank_details`
Mid A, hardest first:
- `skills/larv-review/SKILL.md:53` "Round cap", with "History", "Ratchet", "Fresh" and "Suspended"
- `bin/loop_claude/cycle/judge_reply.py:12` `JUDGE_RULES`, with `QUOTE_SOURCES`, `ANSWER_DESTINATIONS` and `ANSWERS_RECORDED`
- `bin/loop_claude/cycle/states.py:69` `transition`
- `bin/loop_claude/cycle/archive.py:28` `archive`, with `finished_chunks` and `FINISHED_AT`
- `bin/reading_cost.py:145` `measure`, with `located`, `relative` and `commit_time`
- `bin/shell_reads.py:67` `operands`
- `bin/loop_claude/claude_code/entries.py:28` `written_by_human`
- `bin/rank_todo.py:408` `rank_details`
Maintainability senior, hardest first:
- `skills/larv-review/SKILL.md:79` "Architecture"
- `bin/loop_claude/cycle/judge_reply.py:12` `JUDGE_RULES`, with `cycle/worker.py:41` `worker_args`
- `bin/loop_claude/cycle/judge.py:31` `run_judge`
- `bin/loop_claude/claude_code/entries.py:28` `written_by_human`
- `bin/loop_claude/cycle/archive.py:17` `FINISHED_AT`, with `finished_chunks` and `cycle/run.py:110` `close`
- `bin/reading_cost.py:145` `measure`, with `located`
- `bin/shell_reads.py:67` `operands`
- `bin/rank_todo.py:408` `rank_details`, with `read_scoring`
Inherited architect, would restructure first:
- `skills/larv-review/SKILL.md:53` "Round cap", and `:88` "Architecture" from History to Suspended
- `bin/loop_claude/cycle/archive.py:109` `finished_chunks`, with `bin/reading_cost.py:106` `located` and `bin/loop_claude/project/checkout.py:7` `checkout_root`
- `bin/` flat folder: tools, shared modules and tests
- `bin/loop_claude/project/checkout.py:32` `read_utf8`, `claude_code/transcript.py:27` `render`, `judge_reply.py:87` `Verdict` beside `states.py:24` `ruling`
- `bin/loop_claude/loop/main.py:9` the recorded-answers rule, beside `judge_reply.py:11` `ANSWERS_RECORDED`
## 2026-10-08T15:54:46Z, PR #225 at 1fc91a5
| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |
|---|---|---|---|---|---|
| Junior A | 7 | 6 | 6.5 | 6 | 6.5 |
| Mid A | 7 | 6.5 | 7 | 6.5 | 7 |
| Maintainability senior | 7.5 | 6.5 | 7 | 6.5 | 7 |
| Inherited architect | 7 | 6 | 6.5 | 7 | 6.5 |
| Mean | 7.13 | 6.25 | 6.75 | 6.50 | 6.75 |
Junior A, hardest first:
- `skills/larv-review/SKILL.md:53` "Round cap", through "Re-entry", "Fresh" and "Suspended"
- `bin/loop_claude/cycle/states.py:69` `transition`, with `cycle/run.py:55` `step`
- `bin/reading_cost.py:180` `measure`
- `bin/reading_cost.py:242` `readings_of`, with `:171` `unheld` and `:236` `figure`
- `bin/loop_claude/cycle/judge.py:31` `run_judge`
- `bin/loop_claude/transcript_archive.py:29` `archive`, with `copy_for` and `finished_chunks`
- `bin/loop_claude/cycle/judge_reply.py:12` `JUDGE_RULES`
- `bin/rank_todo.py:408` `rank_details`
Mid A, hardest first:
- `skills/larv-review/SKILL.md:53` "Round cap", with "Architecture" from Floor to Suspended
- `bin/loop_claude/cycle/judge.py:31` `run_judge`
- `bin/loop_claude/cycle/states.py:69` `transition`
- `bin/reading_cost.py:180` `measure`, and `:242` `readings_of`
- `bin/loop_claude/transcript_archive.py:29` `archive`, `:95` `copy_for` and `:110` `finished_chunks`
- `bin/loop_claude/claude_code/entries.py:28` `written_by_human`
- `bin/loop_claude/loop/reload.py:50` `exec_if_edited`
- `bin/rank_todo.py:408` `rank_details`
Maintainability senior, hardest first:
- `skills/larv-review/SKILL.md:79` "Architecture"
- `skills/larv-review/SKILL.md:95` the move of an old entry's scores into the history
- `bin/loop_claude/cycle/judge_reply.py:12` `JUDGE_RULES`
- `bin/loop_claude/cycle/judge.py:31` `run_judge`
- `bin/reading_cost.py:180` `measure`, and `:242` `readings_of`
- `bin/loop_claude/transcript_archive.py:18` `FINISHED_AT`, with `finished_chunks` and `cycle/run.py:110` `close`
- `bin/reading_cost.py:141` `located`, beside `bin/loop_claude/project/checkout.py:7` `checkout_root`
- `bin/shell_reads.py:52` `segments`, and `:67` `operands`
Inherited architect, would restructure first:
- `bin/` by kind: tools, shared modules and tests
- `bin/loop_claude/transcript_archive.py:110` `finished_chunks`, read by `bin/reading_cost.py` through four `loop_claude` modules
- `docs/comprehension-history.md`, written by `bin/reading_cost.py:242` and by `skills/larv-review/SKILL.md:92`'s prose
- `skills/larv-review/SKILL.md:53` "Round cap"
- `bin/loop_claude/cycle/judge_reply.py:87` `Verdict` beside `states.py` `ruling`, and `project/checkout.py:32` `read_utf8`
## 2026-10-08T17:29:52Z, PR #225 at 8c9bf09
| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |
|---|---|---|---|---|---|
| Junior A | 7 | 6.5 | 7 | 6.5 | 6.5 |
| Mid A | 7 | 7 | 7 | 6.5 | 7 |
| Maintainability senior | 7.5 | 6.5 | 7 | 7 | 7 |
| Inherited architect | 7.5 | 7 | 7 | 7.5 | 7 |
| Mean | 7.25 | 6.75 | 7.00 | 6.88 | 6.88 |
Junior A, hardest first:
- `bin/loop_claude/cycle/judge_reply.py:12` `JUDGE_RULES`, with `Reply` and `verdict_from`
- `bin/loop_claude/cycle/judge.py:31` `run_judge`, with `grounded`, `verbatim` and `plain`
- `bin/loop_claude/cycle/states.py:69` `transition`
- `bin/loop_claude/transcript_archive.py:30` `archive`, `copy_for` and `finished_chunks`
- `bin/reading_cost/measure.py:27` `measure`, with `bin/reading_cost/main.py:113` `located`
- `skills/larv-review/SKILL.md:95` the old entry's scores, and `:108` "Fresh"
- `bin/reading_cost/shell_reads.py:21` `shell_reads`, with `operands`, `segments` and `shell_lines`
- `bin/loop_claude/claude_code/entries.py:28` `written_by_human`
Mid A, hardest first:
- `skills/larv-review/SKILL.md:53` "Round cap", through "Architecture", "Fresh" and "Suspended"
- `bin/loop_claude/cycle/judge_reply.py:12` `JUDGE_RULES`, and `:90` `verdict_from`
- `bin/loop_claude/cycle/states.py:69` `transition`, with `cycle/run.py:35` `run_cycle` and `:104` `question_for`
- `bin/loop_claude/transcript_archive.py:30` `archive`, `copy_for` and `finished_chunks`
- `bin/loop_claude/claude_code/entries.py:28` `written_by_human`
- `bin/reading_cost/figures.py:34` `readings_of`
- `bin/reading_cost/shell_reads.py:52` `segments`, and `:67` `operands`
- `bin/reading_cost/main.py:113` `located`, beside `bin/loop_claude/project/checkout.py:7` `checkout_root`
Maintainability senior, hardest first:
- `bin/loop_claude/transcript_archive.py:30` `archive`, and `:111` `finished_chunks`
- `bin/reading_cost/figures.py:34` `readings_of`
- `bin/reading_cost/shell_reads.py:52` `segments`, and `:67` `operands`
- `bin/loop_claude/cycle/judge.py:31` `run_judge`
- `bin/reading_cost/main.py:113` `located`, and `measure.py:21` `Checkout`
- `skills/larv-review/SKILL.md:53` "Round cap", and `:108` "Fresh" and "Suspended"
- `bin/loop_claude/cycle/judge_reply.py:12` `JUDGE_RULES`
- `bin/rank_todo.py:408` `rank_details`
Inherited architect, would restructure first:
- `bin/loop_claude/claude_code/` and the read side of `bin/loop_claude/transcript_archive.py`, into a package both tools import
- `skills/larv-review/SKILL.md:58` "Count", with a checker
- `bin/loop_claude/cycle/judge_reply.py:12` `JUDGE_RULES`, beside `judge.py:53` `judge_prompt`
- `bin/loop_claude/project/checkout.py:7` `checkout_root` and `bin/reading_cost/main.py:113` `located`, and `checkout.py:32` `read_utf8`
- `bin/failure.py`, `bin/file_writes.py` and `bin/markdown_sections.py`, into one package
## 2026-10-08T18:37:21Z, PR #228 at 2682668, against 8c9bf09
Ruling: worse
| Seat | Vote |
|---|---|
| Mid A | worse |
| Inherited architect | worse |
Mid A, decided by:
- `skills/larv-review/SKILL.md:91` "Paired ruling": the base, its fallbacks, a two-stage vote and a tie rule in one paragraph
- `skills/comprehension-panel/scoring-run.md:1` and `:67` "Paired ruling": one file name over two kinds of prompt
- `skills/comprehension-panel/SKILL.md:102` "The paired ruling": the procedure spread over three files
- `skills/larv-review/SKILL.md:89` "Architecture": the comprehension check, paired ruling, scoring run, ratchet and floor to hold at once
- `skills/larv-review/SKILL.md:105` "History": two record shapes in one bullet
- `skills/larv-review/SKILL.md:66` "Re-entry", better: "Rerun" names its mechanism
Inherited architect, decided by:
- `skills/larv-review/SKILL.md:89` "Architecture": two mechanisms, each with its own trigger and seats, and a three-way rule for the base
- `skills/larv-review/SKILL.md:105` "History": two entry shapes, and which commit of a paired entry is the next base
- `CHANGELOG.md:5` against `:11`, `:16`, `:19`: two accounts of what blocks a merge
- `CLAUDE.md:37` and `:40` "Quality": "comprehension check" undefined, and one sentence packing the floor and the ruling
- `skills/comprehension-panel/scoring-run.md:1` "Paired ruling": the name no longer says what is inside
- `AGENTS.md:15`: the new decision title packs both mechanisms and the vote rule
- `skills/larv-review/SKILL.md:35` and `:64` "Re-entry", better: a rerun traces from the table alone
## 2026-10-08T18:46:12Z, PR #228 at fbe753e, against c7333c0
Ruling: same
| Seat | Vote |
|---|---|
| Mid A | worse |
| Inherited architect | better |
| Maintainability senior | same |
| Junior A | worse |
Mid A, decided by:
- `skills/larv-review/SKILL.md:89` "Architecture": two kinds of run under one umbrella, each with its own trigger, and a vote rule to work through by example
- `skills/larv-review/SKILL.md:93` "Base": the comparison point found by how earlier chunks appended to the history
- `skills/larv-review/SKILL.md:35` the Architecture row: a forward reference to the scoring run's trigger
- `CLAUDE.md:37` and `:40` "Quality": one concept under several names, and "the last measured commit" undefined
- `skills/comprehension-panel/SKILL.md:102` "The paired ruling": who votes is left to the caller
- `skills/comprehension-panel/seat-prompts.md:1`, better: the name tells the truth, and `{forbidden}` serves both briefs
- `skills/larv-review/SKILL.md:64` "Re-entry", better: the rerun rule is explicit
Inherited architect, decided by:
- `skills/larv-review/SKILL.md:64` "Re-entry", better: why a pass ran a fourth time is answered in one paragraph
- `skills/larv-review/SKILL.md:33` the pass table, better: each pass's rule for fixes sits in its own Trigger cell
- `skills/larv-review/SKILL.md:37` and `:123` "Security", better: when each security pass runs
- `skills/larv-review/SKILL.md:93` "Base": base selection depends at a distance on the wording of a line in the history format
- `skills/larv-review/SKILL.md:35` the Architecture row: a pointer 60 lines down
- `skills/larv-review/SKILL.md:95` "Ruling": the vote margin worked out by hand
- `CLAUDE.md:37` and `AGENTS.md:16`: one concept, three names
Maintainability senior, decided by:
- `skills/larv-review/SKILL.md:89` "Paired ruling": the base defined by an action, and the vote arithmetic
- `skills/larv-review/SKILL.md:35` and `:97`: a forward reference, though one definition
- `skills/larv-review/SKILL.md:64` "Re-entry", better: deterministic reruns
- `skills/larv-review/SKILL.md:59` "Later rounds", better: every rerun reviews only its diff
- `skills/comprehension-panel/seat-prompts.md:3`, better: the briefs cannot drift apart
- `AGENTS.md:35` "Scoring run": the heading no longer matches its use
- `CLAUDE.md:40`: "last measured commit" defined only in larv-review
Junior A, decided by:
- `skills/larv-review/SKILL.md:91` "Paired ruling": the base, the escalation and the vote rule in three rereads
- `skills/larv-review/SKILL.md:35` the Architecture row: a forward reference to a two-condition rule
- `skills/larv-review/SKILL.md:35`, `:51`, `:89`, `CLAUDE.md:37`: four names for the comprehension machinery
- `skills/larv-review/SKILL.md:36` the Full scan and Security rows: read together now
- `skills/comprehension-panel/seat-prompts.md:8`: placeholders nesting placeholders
## 2026-10-08T18:57:27Z, PR #228 at 50249b1, against 12d6d75
Ruling: worse
| Seat | Vote |
|---|---|
| Mid A | worse |
| Inherited architect | worse |
Mid A, decided by:
- `skills/larv-review/SKILL.md:93` "Base": a `git log` command, a two-way condition, a forward reference to the history's format and two fallbacks
- `skills/larv-review/SKILL.md:89` "Architecture": two kinds of run, four sub-bullets and a vote rule; the section's fan-out roughly doubled
- `skills/larv-review/SKILL.md:35`, `:98` and `:120`: one trigger written out three times
- `CLAUDE.md:40` "Quality": "the last commit the panel scored or ruled better" reads two ways
- `AGENTS.md:35` "Scoring run": the heading no longer names what it feeds
- `CHANGELOG.md:5`: ten sentences in one entry
- `skills/larv-review/SKILL.md:66` "Re-entry", `:37` and `:124` "Security", `skills/comprehension-panel/seat-prompts.md:7`, better
Inherited architect, decided by:
- `skills/larv-review/SKILL.md:93` "Base": finding the base at 3am takes git archaeology across merge commits
- `CHANGELOG.md:5` against `skills/larv-review/SKILL.md:93` and `:107`: only the changelog says a ruling of same leaves the base, so a chunk may be told to fix places it never touched
- `skills/larv-review/SKILL.md:95` "Seats" and `:96` "Ruling": the vote table built in the head
- `CLAUDE.md:40` "Quality": a folded noun phrase in the charter
- `skills/larv-review/SKILL.md:35`, `:98` and `:120`: the trigger three times, and seven concepts where there were three
- `AGENTS.md:35` "Scoring run": the heading not renamed with the file
- `skills/larv-review/SKILL.md:64` "Re-entry" and `:40` the Prose row, `:37` and `:124` "Security", better
## 2026-10-08T19:48:05Z, PR #229 at 8a2dbd7, against 12d6d75
Ruling: worse
| Seat | Vote |
|---|---|
| Mid A | worse |
| Inherited architect | worse |
Mid A, decided by:
- `skills/larv-review/SKILL.md:93` "Paired ruling" → "Base": the base found by a prose `git log` search with two fallbacks
- `skills/larv-review/SKILL.md:95` "Seats" and "Ruling": vote arithmetic written as prose, with no example
- `skills/larv-review/SKILL.md:89` "Architecture": two kinds of run, each with its own trigger, seats and block
- `CLAUDE.md:40` "Quality": a clause folded into a noun phrase
- `bin/metric_bench/places.py:7` `RUN`, `SEAT_PLACES`, `PLACE` and `:30` `scoring_runs`: a second reader of a format defined only in prose, linked from neither side
Inherited architect, decided by:
- `skills/larv-review/SKILL.md:93` "Paired ruling" → "Base": "worse than what?" means running the base search in your head
- `skills/larv-review/SKILL.md:95` "Seats" and "Ruling": a two-stage panel and vote arithmetic with nothing to run or test it
- `skills/larv-review/SKILL.md:35`, `:98` "Scoring run" and `:120` "Suspended": the scoring run's trigger written out in four places
- `skills/larv-review/SKILL.md:36` the Full scan and Security rows: each row's trigger depends on the other
- `bin/metric_bench/places.py:7` `RUN`, `SEAT_PLACES`, `PLACE`: a regex reader of the history linked from neither side
- `bin/metric_bench/places.py:59` `resolved`: a result that depends on the place resolved before it
- `bin/metric_bench/python_units.py:69` `Cognitive`: nesting bookkeeping spread over its methods
## 2026-10-08T21:14:15Z, PR #229 at 5cc37dd, against 12d6d75
Ruling: worse
| Seat | Vote |
|---|---|
| Mid A | worse |
| Inherited architect | worse |
Mid A, decided by:
- `skills/larv-review/SKILL.md:93` "Paired ruling" → "Base": a rule over git history, a `git log` command and two fallbacks to hold at once
- `CLAUDE.md:40` "Quality": a garden-path sentence read three times
- `skills/larv-review/SKILL.md:89` "Architecture": two kinds of run, each with its own trigger, meeting "Fresh", "Suspended" and "Round cap"
- `bin/metric_bench/places.py:60` `resolved`: order-dependent, readable only with the history format in mind
- `bin/metric_bench/main.py:43` `main`, better: the shape of `bin/reading_cost/main.py`, one for one
- `skills/larv-review/SKILL.md:111` "History", better: the format and its reader name each other
Inherited architect, decided by:
- `skills/larv-review/SKILL.md:93` "Paired ruling" → "Base": the ratchet's outcome rests on state spread across many past commits
- `skills/larv-review/SKILL.md:89` "Architecture": one mechanism became two, with different triggers and blocks
- `CLAUDE.md:40` "Quality": a clause folded into a noun phrase
- `bin/metric_bench/places.py:7` `RUN`, `SEAT_PLACES`, `PLACE` and `:60` `resolved`: a regex reader of a prose format, and a historical quirk to know first
- `AGENTS.md:35` "Scoring run": the section's name no longer covers its use by paired rulings
- `skills/larv-review/SKILL.md:64` "Re-entry", better: which passes a fix reruns is explicit
+45 -29
View File
@@ -2,25 +2,25 @@
## larv-review: a project under the comprehension floor is fixed at the lowest dimension
2026-09-20, lilleman. Serves goal 4. Across six projects scored with the four seats, Locality or Self-sufficiency was the lowest dimension at every seat and Navigation at none, so a layout fix would not lift a project under the floor. Valid while the scoring run keeps those four seats.
2026-09-20, lilleman. Serves goal 1. Across six projects scored with the four seats, Locality or Self-sufficiency was the lowest dimension at every seat and Navigation at none, so a layout fix would not lift a project under the floor. Valid while the scoring run keeps those four seats.
## loop-claude: a judge decides each interrupt and each quoted answer from the transcript, the README's premises, `AGENTS.md`, `docs/decisions.md` and `~/.claude/CLAUDE.md`, and holds a chunk open while an answer the human typed in it is recorded nowhere; the worker's own account of which goal settles a choice decides nothing
2026-09-21, lilleman. Serves goal 4. Asked to name the goal behind each choice, the worker cites a real goal for a choice that goal does not settle, and under-reports its own decisions; the judge's bar is whether the README discriminates between the alternatives. Valid while the worker's self-report stays unreliable.
2026-09-21, lilleman. Serves goal 1. Asked to name the goal behind each choice, the worker cites a real goal for a choice that goal does not settle, and under-reports its own decisions; the judge's bar is whether the README discriminates between the alternatives. Valid while the worker's self-report stays unreliable.
2026-10-01, lilleman: the judge reads `docs/decisions.md` and `AGENTS.md` too, so an answer recorded there is not asked again (goal 4.2); its bar becomes whether the README or those files discriminate. 2026-10-03, implemented: when the README's premises or those files answer the worker's question, the judge quotes the answer verbatim and the worker resumes with it. The judge then sees the quote as a `[loop]` line. The worker asking it again shows the quote did not settle it, and the judge sends it to the human. A backstop of three quoted answers per cycle bounds what the judge misses, such as a reworded repeat or a worker asking without end, so the worker cannot loop unattended (goal 4.4); the fourth question that the README's premises or those files answer in one cycle goes to the human with the judge's quote. An interrupt does not reset the count, so every later question those files answer in that cycle also goes to the human. Valid while the worker writes records only in a worktree, as `CLAUDE.md` → "Working with the codebase" has it, so the records the judge reads from the checkout root are merged ones.
2026-10-01, lilleman: the judge reads `docs/decisions.md` and `AGENTS.md` too, so an answer recorded there is not asked again (goal 1.2); its bar becomes whether the README or those files discriminate. 2026-10-03, implemented: when the README's premises or those files answer the worker's question, the judge quotes the answer verbatim and the worker resumes with it. The judge then sees the quote as a `[loop]` line. The worker asking it again shows the quote did not settle it, and the judge sends it to the human. A backstop of three quoted answers per cycle bounds what the judge misses, such as a reworded repeat or a worker asking without end, so the worker cannot loop unattended (goal 1.4); the fourth question that the README's premises or those files answer in one cycle goes to the human with the judge's quote. An interrupt does not reset the count, so every later question those files answer in that cycle also goes to the human. Valid while the worker writes records only in a worktree, as `CLAUDE.md` → "Working with the codebase" has it, so the records the judge reads from the checkout root are merged ones.
2026-10-03, lilleman: the judge is to read `~/.claude/CLAUDE.md` whole too. The worker follows that file, so a question it answers should not reach the human (goal 4.2). Reading the whole file is safe, because the judge may quote only words that appear in it. A list of sections would need keeping current. Implemented the same day.
2026-10-03, lilleman: the judge is to read `~/.claude/CLAUDE.md` whole too. The worker follows that file, so a question it answers should not reach the human (goal 1.2). Reading the whole file is safe, because the judge may quote only words that appear in it. A list of sections would need keeping current. Implemented the same day.
2026-10-03, lilleman: the judge rules a chunk finished only once every answer the human typed in it is recorded. A finished chunk's session is deleted, and its answers with it, so an answer recorded nowhere would be asked again in a later chunk (goal 4.2). Implemented the same day by claude, which settled two choices the ruling left open. First, an answer counts as recorded where the files the judge reads hold it, `~/.claude/CLAUDE.md` included, or where the transcript shows the worker writing it into `README.md`'s premises, `AGENTS.md`, `docs/decisions.md`, `todo.md` or a code comment. A worker's write to `~/.claude/CLAUDE.md` does not count: `CLAUDE.md` → "Maintaining this file" leaves new rules in it to the human. The judge cannot read a code comment or `todo.md`. Yet `CLAUDE.md` → "Working loop", "Ask, don't guess" puts a standing choice made in one place in a comment there. And the human's approval of a release's items, which "Working loop" requires, is the set of rows `todo.md` names for that release. The judge also reads the records once a cycle from the main checkout. That checkout may not yet hold an answer the worker wrote and merged. A judge that refused any of these would hold the chunk open every cycle. Second, only an answer a later chunk could need must be recorded, so an approval such as "merge it" holds nothing open. The worker's resume prompt states the rule, so a worker whose chunk is held open knows it.
2026-10-03, lilleman: the judge rules a chunk finished only once every answer the human typed in it is recorded. A finished chunk's session is deleted, and its answers with it, so an answer recorded nowhere would be asked again in a later chunk (goal 1.2). Implemented the same day by claude, which settled two choices the ruling left open. First, an answer counts as recorded where the files the judge reads hold it, `~/.claude/CLAUDE.md` included, or where the transcript shows the worker writing it into `README.md`'s premises, `AGENTS.md`, `docs/decisions.md`, `todo.md` or a code comment. A worker's write to `~/.claude/CLAUDE.md` does not count: `CLAUDE.md` → "Maintaining this file" leaves new rules in it to the human. The judge cannot read a code comment or `todo.md`. Yet `CLAUDE.md` → "Working loop", "Ask, don't guess" puts a standing choice made in one place in a comment there. And the human's approval of a release's items, which "Working loop" requires, is the set of rows `todo.md` names for that release. The judge also reads the records once a cycle from the main checkout. That checkout may not yet hold an answer the worker wrote and merged. A judge that refused any of these would hold the chunk open every cycle. Second, only an answer a later chunk could need must be recorded, so an approval such as "merge it" holds nothing open. The worker's resume prompt states the rule, so a worker whose chunk is held open knows it.
## loop-claude: one session per project, its id derived from the checkout's path relative to `~/code`, or to `/` outside it
2026-09-21, lilleman; revised 2026-09-30 by lilleman. Serves goal 4. One fixed id per project keeps the session picker at one entry per project and makes any transcript under that id loop-claude's own to delete. A checkout outside `~/code` mirroring a path inside it shares that id, and a second loop on it is not refused. Once `todo.md` item 5 lands, the id comes from the full path, so no two checkouts share one, and `loop-claude` refuses to start while another session on that id is active. Moving the checkout orphans its open sessions, archive folder and models entry: sessions stay in the picker until the human deletes them, migration code not being worth a one-human audience. Valid while claude takes `--session-id` and resumes by it.
2026-09-21, lilleman; revised 2026-09-30 by lilleman. Serves goal 1. One fixed id per project keeps the session picker at one entry per project and makes any transcript under that id loop-claude's own to delete. A checkout outside `~/code` mirroring a path inside it shares that id, and a second loop on it is not refused. Once `todo.md` item 5 lands, the id comes from the full path, so no two checkouts share one, and `loop-claude` refuses to start while another session on that id is active. Moving the checkout orphans its open sessions, archive folder and models entry: sessions stay in the picker until the human deletes them, migration code not being worth a one-human audience. Valid while claude takes `--session-id` and resumes by it.
## loop-claude: before an interrupt, it marks the checkout and each of its worktrees trusted in `~/.claude.json`
2026-09-21, lilleman; the lost-write risk accepted 2026-09-24 by larv-review. Serves goal 4. A write by another claude inside `trust`'s read-modify-write window is lost.
2026-09-21, lilleman; the lost-write risk accepted 2026-09-24 by larv-review. Serves goal 1. A write by another claude inside `trust`'s read-modify-write window is lost.
2026-09-24, lilleman, extending it to every worktree. `claude --resume` re-enters the worktree the worker last entered, recorded in the transcript's `worktree-state` entry, and Claude Code asks trust per path, so trusting the checkout alone still lands the human in the dialog; trusting every worktree `git worktree list` names spares reading which one from the transcript. Valid while resume re-enters a recorded worktree and trust is kept per path.
@@ -28,17 +28,15 @@
## bin/: the tests rerun themselves on a `uv`-fetched Python at README Install's floor
2026-09-26, larv-review. Serves goal 1. The suite reruns itself on a `uv`-fetched interpreter of the version Install names: `ast.parse(feature_version=)` on the host's Python accepts the nested f-string 186181a fixed, a compile check passes a call newer than the floor, like 3.12's `itertools.batched`, and a `python3.N` on `PATH` is installed by hand on every machine and again at each bump. Valid while `uv` can fetch the floor interpreter and no machine taking the checkout ships an older Python.
2026-09-26, larv-review. Serves goal 2. The suite reruns itself on a `uv`-fetched interpreter of the version Install names: `ast.parse(feature_version=)` on the host's Python accepts the nested f-string 186181a fixed, a compile check passes a call newer than the floor, like 3.12's `itertools.batched`, and a `python3.N` on `PATH` is installed by hand on every machine and again at each bump. Valid while `uv` can fetch the floor interpreter and no machine taking the checkout ships an older Python.
## bin/: the tools and their tests run on the host's Python, with no container
2026-09-24, larv-review. Serves goals 1 and 4. The tools drive the host's claude CLI and read the host's session files, which a container cannot see; the tests run on the same host Python the tools meet. Valid while claude runs on the host.
2026-09-24, larv-review. Serves goals 1 and 2. The tools drive the host's claude CLI and read the host's session files, which a container cannot see; the tests run on the same host Python the tools meet. Valid while claude runs on the host.
## comprehension floor: every dimension and the overall at 7.0 or above, and 0.1.0 waits on it
2026-09-27, lilleman, restating the 2026-09-24 target and extending it to the overall. Serves goal 4. Valid while the scoring run keeps its four seats. The decisions to ship under the floor, listed below, stand until `todo.md` item 62 lifts the project to it.
The last scoring run, which the next may not score below (`CLAUDE.md` → "Quality"): PR #215, 2026-10-04, Navigation 7.38, Locality 6.63, Shape 7.0, Self-sufficiency 6.88, overall 6.88.
2026-09-27, lilleman, restating the 2026-09-24 target and extending it to the overall. Serves goal 1. Valid while the scoring run keeps its four seats. The decisions to ship under the floor, listed below, stand until `todo.md` item 62 lifts the project to it.
lilleman decided to ship each of these under the floor on the day listed. Each line gives its last scores (Navigation, Locality, Shape, Self-sufficiency, overall):
@@ -50,63 +48,81 @@ lilleman decided to ship each of these under the floor on the day listed. Each l
- 2026-10-03, PR #202: 7.5, 7.0, 7.0, 6.75, 7.0.
- 2026-10-03, PR #208: 7.5, 7.0, 7.13, 6.63, 6.88.
- 2026-10-04, PR #215: 7.38, 6.63, 7.0, 6.88, 6.88.
- 2026-10-08, PR #224: 7.00, 6.50, 7.00, 6.50, 6.75. lilleman shipped it below the ratchet as well: its 20 lines of skill prose left the code as it was, so the fall is the panel's noise between runs, which the paired ruling cancels.
- 2026-10-08, PR #225: 7.25, 6.75, 7.00, 6.88, 6.88. Above PR #224's run on every score but Shape, which held.
- 2026-10-08, PR #228: no scoring run; its last paired ruling, against 12d6d75, was worse, 2 votes to 0. lilleman shipped it below the ratchet: the seats blamed the new ratchet's own rules, which `todo.md` item 85 moves into a tested tool.
- 2026-10-08, PR #229: no scoring run; its last paired ruling, against 12d6d75, was worse, 2 votes to 0. lilleman shipped it below the ratchet for PR #228's reason: the seats' decisive places were still PR #228's rules, which item 85 moves into a tested tool.
## loop-claude: each project's model lives in `~/.claude/loop-claude-models.json`, which only loop-claude writes
2026-09-26, lilleman. Serves goal 4. Claude Code rewrites the user settings' `model` whenever one is picked inside a session, so a loop reading settings runs whatever was picked last; `~/.claude/loop-claude-models.json` has loop-claude as its one writer, and every claude it starts gets that model as `--model`. The file is per machine, outside the synced allowlist, since a tracked file the loop writes would dirty the checkout. 2026-10-02, lilleman: goal 1 shares the setup across machines, and a project's model is each machine's own choice, so a new machine asks once per project, which is not asking the same thing twice (goal 4.2). Valid while Claude Code keeps rewriting the settings' model from inside a session.
2026-09-26, lilleman. Serves goal 1. Claude Code rewrites the user settings' `model` whenever one is picked inside a session, so a loop reading settings runs whatever was picked last; `~/.claude/loop-claude-models.json` has loop-claude as its one writer, and every claude it starts gets that model as `--model`. The file is per machine, outside the synced allowlist, since a tracked file the loop writes would dirty the checkout. 2026-10-02, lilleman: goal 2 shares the setup across machines, and a project's model is each machine's own choice, so a new machine asks once per project, which is not asking the same thing twice (goal 1.2). Valid while Claude Code keeps rewriting the settings' model from inside a session.
## review: a pass gets at most three rounds per chunk; instead of a fourth, the run asks the human
2026-09-28, lilleman. Serves goal 4. One counter per pass per chunk, so no fix bounces between two passes without end. Valid while one human answers the ask, in the session or from the unmerged PR.
2026-09-28, lilleman. Serves goal 1. One counter per pass per chunk, so no fix bounces between two passes without end. Valid while one human answers the ask, in the session or from the unmerged PR.
## review: a fix for a 🟢 or ❓ re-enters review like any fix
## review: a fix for a 🔴 or 🟡 reruns the pass that found it and each pass whose trigger names fixes like it; a fix for a 🟢, a ❓ or a prose finding reruns none
2026-09-30, lilleman. Serves goal 4: no human reads an unattended chunk before it merges, so every change it makes, a nit's wording included, is reviewed. In the 2026-09-30 bench this cost four of nine rounds in one run and drove two passes to the round cap. Valid while a pass is the only reader of a fix before merge.
2026-10-08, lilleman, replacing the 2026-09-30 rule that every fix, a nit's included, re-enters review. Serves goal 1.4. An audit of the four costliest archived chunks (2026-10-08) found nearly every finding that mattered in a pass's first round; later rounds mostly re-checked the last fix, reworded what an earlier round wrote, or contradicted another round on the same line. A round 2 caught real bugs only where a fix changed behaviour, so stability still reruns on every fix that does, and security on every fix that opens an untrusted-input boundary or touches authn/authz, secrets or crypto. Valid while round-2 reviews of nit and prose fixes keep changing nothing a user would notice.
## review: a project decision may suspend the scoring run for the plan items it names
## review: a paired ruling against the last measured commit decides the ratchet; the four-seat scoring run checks the floor when a release's items run out or an item names the floor
2026-10-04, lilleman. Serves goal 4.4. In a restructure, each step's scoring run measures code the next step deletes. It costs a run and, below the floor, blocks the step, yet says nothing about what the restructure buys. The scoring run after the last step measures that. Valid while such a decision names its items and the plan item that ends it.
2026-10-08, lilleman. Serves goals 1.1 and 1.4. Two independent four-seat runs moved up to 0.4 on near-identical code, so a fall within that noise forced rounds that changed nothing (PR #224). A seat reading both versions judges the difference on the same material, so the noise the versions share cancels. No conventional significance level lets a sign test settle with four votes, so the human chose a lead of two votes over every other ruling, same included. Two seats that agree settle it, so a PR that leaves the reading as it was costs two seats. A third seat alone can never settle it, so the third and fourth launch together. The base is the default branch's newest merged change that adds a scoring run to the history, or whose last added paired ruling is better. The human chose the last measured commit on the architect's finding that with a merge base as the base, chunks without an architecture pass, and a suspended restructure's steps, could each lower comprehension unseen. A ruling of same leaves the base where it was, or a run of small falls each ruled same would add up unseen. A scoring run moves it too: otherwise a project never ruled better would compare against its first ruling forever, and a release's floor check is where the human sees the absolute level. Reading the default branch one merged change at a time keeps the rule working for merge commits and squash merges alike: a branch's own early ruling of better never counts, only the merged change's last ruling. The scoring run also runs on a chunk shipping an item that names the floor, so the chunk that lifts a project to the floor can prove it. A chunk that removes a release's last item without shipping it runs it too, so no release ends unmeasured. Valid while seats reading both versions agree more often than two absolute runs do.
## review: a project decision may suspend the comprehension check for the plan items it names
2026-10-04, lilleman. Serves goal 1.4. In a restructure, each step's scoring run measures code the next step deletes. It costs a run and, below the floor, blocks the step, yet says nothing about what the restructure buys. The scoring run after the last step measures that. 2026-10-08: the paired ruling replaced the scoring run in most chunks, and the suspension covers it too; the ruling after the last step compares with the commit measured before the first step. Valid while such a decision names its items and the plan item that ends it.
## review: a pass skips only on a precedent: a decision, or a plan item crediting the pass, that the repo held before the chunk began
2026-09-30, lilleman. Serves goal 4: a decision the chunk writes is the chunk's own and unreviewed, and an unattended run has no human to catch it. Valid while a pass is the only reader of a chunk before merge.
2026-09-30, lilleman. Serves goal 1: a decision the chunk writes is the chunk's own and unreviewed, and an unattended run has no human to catch it. Valid while a pass is the only reader of a chunk before merge.
## loop-claude: the archive keeps the raw transcript, and a failed archive stops the loop
2026-09-28, lilleman. Serves goals 2 and 4: saving each transcript locally is the first step of backing it up, and it shows afterwards what an unattended run did. A copy of the `.jsonl`, deduplicated by content hash, with its outcomes beside it; a rendering drops tool results, and a second-resolution stamp names two states within one second as one file. A failed archive exits 1, since a loop that loses its record silently fails the backup goal. Valid while transcripts stay small enough to copy whole.
2026-09-28, lilleman. Serves goals 1 and 3: saving each transcript locally is the first step of backing it up, and it shows afterwards what an unattended run did. A copy of the `.jsonl`, deduplicated by content hash, with its outcomes beside it; a rendering drops tool results, and a second-resolution stamp names two states within one second as one file. A failed archive exits 1, since a loop that loses its record silently fails the backup goal. Valid while transcripts stay small enough to copy whole.
## loop-claude: a `claude` that cannot start is a failed worker run, retried
2026-09-28, larv-review, declining a product-owner nit to exit at once when `claude` is missing. Serves goal 4. Claude Code's updater repoints `~/.local/bin/claude` at each new version under running loops, and a start that meets it mid-update fails with the same error as a broken install; the retry costs two minutes on the second and saves an unattended loop on the first. Valid while Claude Code updates by repointing its link.
2026-09-28, larv-review, declining a product-owner nit to exit at once when `claude` is missing. Serves goal 1. Claude Code's updater repoints `~/.local/bin/claude` at each new version under running loops, and a start that meets it mid-update fails with the same error as a broken install; the retry costs two minutes on the second and saves an unattended loop on the first. Valid while Claude Code updates by repointing its link.
## review: an ask no user answers leaves the PR unmerged
2026-09-30, claude. Serves goal 4: the round cap, a BLOCK's restructure, Stage 0's questions and a goal conflict are the human's call, and an unmerged PR is what brings it to them; merging would make the call for them. Where an option reviews more — run the pass, fix under the floor, fix a finding no goal lets the run decline — the run takes it; a ❓, or a fix changing a goal or a decision, is filed in `todo.md`, which reaches the human without holding the chunk. Valid while a human reads every unmerged PR an unattended run leaves.
2026-09-30, claude. Serves goal 1: the round cap, a BLOCK's restructure, Stage 0's questions and a goal conflict are the human's call, and an unmerged PR is what brings it to them; merging would make the call for them. Where an option reviews more — run the pass, fix under the floor, fix a finding no goal lets the run decline — the run takes it; a ❓, or a fix changing a goal or a decision, is filed in `todo.md`, which reaches the human without holding the chunk. Valid while a human reads every unmerged PR an unattended run leaves.
## loop-claude: every claude it starts bypasses permissions inside its sandbox
2026-09-30, lilleman. Applies "Always grant explicit access to data": the sandbox `loop-claude` runs in is where access is granted, so the worker and the interrupt run with `bypassPermissions`. The worker may read `~/.claude/.credentials.json`: it holds Claude Code's own credentials, which claude reads to run anyway. Its one seam to production is the forge: what it pushes or merges can publish through CI. Valid while `loop-claude` runs only in the sandbox README → Install names.
## review: `/security-review` is the security pass of record
## review: `/security-review` is the security pass of record, except where the full scan runs on the same change and replaces it
2026-09-20, lilleman. Serves goal 4.1. Its value is a tuned exclusion list and a ≥0.8 confidence floor, which a hand-written reviewer would reproduce worse. Valid while `/security-review` ships both.
2026-09-20, lilleman. Serves goal 1.1. Its value is a tuned exclusion list and a ≥0.8 confidence floor, which a hand-written reviewer would reproduce worse. Valid while `/security-review` ships both.
2026-10-08, lilleman. Serves goal 1.4: run beside the full scan, `/security-review` started seconds apart from it each round and returned a near-identical report. Valid while the full scan covers what `/security-review` reports.
## review: the premises chunk's whole review is the human's approval
2026-09-20, lilleman. Serves goal 4.1. A reviewer's finding on that chunk could only be declined by citing the goals the chunk exists to write. Valid while every decline must name a goal or a technical principle.
2026-09-20, lilleman. Serves goal 1.1. A reviewer's finding on that chunk could only be declined by citing the goals the chunk exists to write. Valid while every decline must name a goal or a technical principle.
## workflow-bench/: the remote may show the bench cases' names and commit SHAs
2026-10-02, lilleman. Serves goal 3, which keeps credentials, transcripts and memory files off the remote; a private project's name and commit ids are none of those. Valid while the bench names only cases and commits, never their code or results.
2026-10-02, lilleman. Serves goal 4, which keeps credentials, transcripts and memory files off the remote; a private project's name and commit ids are none of those. Valid while the bench names only cases and commits, never their code or results.
## todo.md: one table of items scored by the formula and goal weights it states, held to its bar, ranked by `bin/rank_todo.py`
2026-10-02, lilleman. Serves goal 4: findings were filed faster than chunks closed them, so the plan grew without telling what mattered. Each item is scored as `CLAUDE.md` → "Todo items" says; this repo's formula counts value highest and size least. An item under the bar is not kept; this repo's bar started at 10 and was set to 9 the same day, purging the 17 items under it. An Exempt cell keeps a row past the bar where a rule needs it kept. lilleman retired the two decisions whose plans the purge removed: the stats line in the transcript archive, and three benches before a workflow change merges. A finding under the bar is recorded nowhere, so a later review may raise it again, and the run rescores it. That costs one scoring; a ledger of dropped findings would regrow the list the bar caps. larv-review's "Round cap" → "Done" counts a finding named under the bar as settled, so one raised again holds no pass open. `rank_todo.py --check` is part of larv-review's gate, since only a check keeps the stored Score from going stale. The format is mandatory in every project, as the premises are (goal 4.3); the formula, bar and weights are each project's own. A script ranks the table so a re-rank after each addition or edit is deterministic and cheap. A 🟡 against a technical principle is exempt as `principle`, because its audience value scores low and the bar would drop every one. A 🟢 against a principle is scored like any other finding. Valid while one human sets the bar and reads the ranking, and while the items marked `principle` stay few enough to rank.
2026-10-02, lilleman. Serves goal 1: findings were filed faster than chunks closed them, so the plan grew without telling what mattered. Each item is scored as `CLAUDE.md` → "Todo items" says; this repo's formula counts value highest and size least. An item under the bar is not kept; this repo's bar started at 10 and was set to 9 the same day, purging the 17 items under it. An Exempt cell keeps a row past the bar where a rule needs it kept. lilleman retired the two decisions whose plans the purge removed: the stats line in the transcript archive, and three benches before a workflow change merges. A finding under the bar is recorded nowhere, so a later review may raise it again, and the run rescores it. That costs one scoring; a ledger of dropped findings would regrow the list the bar caps. larv-review's "Round cap" → "Done" counts a finding named under the bar as settled, so one raised again holds no pass open. `rank_todo.py --check` is part of larv-review's gate, since only a check keeps the stored Score from going stale. The format is mandatory in every project, as the premises are (goal 1.3); the formula, bar and weights are each project's own. A script ranks the table so a re-rank after each addition or edit is deterministic and cheap. A 🟡 against a technical principle is exempt as `principle`, because its audience value scores low and the bar would drop every one. A 🟢 against a principle is scored like any other finding. 2026-10-08, lilleman: the goal weights in `todo.md` depart from an even spread by position, which would weigh goal 4, leaking nothing, at 0.11. Valid while one human sets the bar and reads the ranking, and while the items marked `principle` stay few enough to rank.
## settings.json: Claude Code runs in auto mode with the dangerous-mode prompt skipped
2026-10-04, lilleman, answering the principles audit of PR #215. Serves goal 4: this setup is meant to run in a sandbox and to work autonomously, so tool access is granted by the sandbox, as "Always grant explicit access to data" in `principles/technical-principles.md` asks. Valid while every machine taking this checkout is such a sandbox.
2026-10-04, lilleman, answering the principles audit of PR #215. Serves goal 1: this setup is meant to run in a sandbox and to work autonomously, so tool access is granted by the sandbox, as "Always grant explicit access to data" in `principles/technical-principles.md` asks. Valid while every machine taking this checkout is such a sandbox.
## the repo may name bender, bender-infra and ai-sandbox
2026-10-04, lilleman, answering the principles audit of PR #215. Serves goal 3, which keeps credentials, transcripts and memory files off the remote; the names of the host, its infrastructure project and the sandbox VM are none of those. Valid while the repo names them without their addresses or credentials.
2026-10-04, lilleman, answering the principles audit of PR #215. Serves goal 4, which keeps credentials, transcripts and memory files off the remote; the names of the host, its infrastructure project and the sandbox VM are none of those. Valid while the repo names them without their addresses or credentials.
## reading cost: larv-review measures each finished chunk from loop-claude's archive and appends the figure to `docs/reading-cost.md` in the next chunk's PR
2026-10-08, lilleman. Serves goal 1.1: comprehension measured from real work, at no model cost (goal 1.4). loop-claude archives from the main checkout, outside any PR, so a tracked file it wrote there would dirty that checkout. So `bin/reading-cost` measures each finished chunk `docs/reading-cost.md` lacks from the archive, in the next chunk's worktree. A PR that never merges then loses no figure, and loop-claude needs no change. The figures keep a file of their own, so `docs/comprehension-history.md` keeps one writer, the comprehension check. Serves goal 4 by naming only files git tracks, and token counts. Rejected: loop-claude opening a PR of its own, one more PR per chunk and a tie to the forge; the worker measuring its own transcript before merging, which misses the chunk's tail. The figure counts new input tokens, uncached and cache-written, because workers read mostly through Bash and subagents, where parsed paths alone miss what they read. Valid while loop-claude archives every finished chunk with its subagents' transcripts.
## reading cost: a rise is the last 5 chunks' median above the 5 before them, and files or refreshes one plan item
2026-10-08, lilleman. Serves goal 1.1: comprehension never falls, so any rise counts. Per-chunk figures are noisy: a flat trend rises about every other chunk. So a rise refreshes the item and never refiles it, and a chunk that sees no rise leaves the item as it is. The chunk that ships the item resets the trend, so later figures do not refile it for work that chunk already did (goal 1.4). A median, because one chunk that ran a panel of readers before its first commit measured 2.99M tokens against a typical 80k–370k, and a mean let it decide the trend alone. No published standard sets this threshold. Valid while figures arrive once per chunk.
+113
View File
@@ -0,0 +1,113 @@
# Reading cost
## Reading cost, chunk 049a6293013b, finished 2026-10-04T10:18:42Z
115833 new input tokens before the first commit.
Read most (opens and searches):
- `bin/test_loop_claude.py` 6
- `bin/test_loop_claude_black_box.py` 6
- `docs/decisions.md` 3
- `todo.md` 3
- `bin/loop_claude/loop/main.py` 2
- `AGENTS.md` 1
- `CHANGELOG.md` 1
- `README.md` 1
- `bin/loop-claude` 1
- `bin/loop_claude/cycle/judge_reply.py` 1
## Reading cost, chunk 3654f457da26, finished 2026-10-04T15:04:37Z
62197 new input tokens before the first commit.
Read most (opens and searches):
- `docs/decisions.md` 4
- `skills/comprehension-panel/SKILL.md` 4
- `CLAUDE.md` 2
- `AGENTS.md` 1
- `CHANGELOG.md` 1
- `README.md` 1
- `skills/comprehension-panel/scoring-run.md` 1
- `skills/larv-review/SKILL.md` 1
- `todo.md` 1
## Reading cost, chunk 12210530d1d1, finished 2026-10-04T15:17:47Z
80898 new input tokens before the first commit.
Read most (opens and searches):
- `bin/test_loop_claude.py` 8
- `bin/test_loop_claude_black_box.py` 5
- `bin/loop_claude/loop/main.py` 4
- `bin/loop-claude` 2
- `todo.md` 2
- `CHANGELOG.md` 1
- `README.md` 1
- `bin/loop_claude/cycle/judge.py` 1
- `bin/loop_claude/cycle/judge_reply.py` 1
- `bin/loop_claude/cycle/run.py` 1
## Reading cost, chunk 8f69670791e6, finished 2026-10-04T18:30:08Z
49451 new input tokens before the first commit.
Read most (opens and searches):
- `docs/decisions.md` 2
- `CHANGELOG.md` 1
- `README.md` 1
- `agents/principles-auditor.md` 1
- `principles/frontend.md` 1
- `principles/logging.md` 1
- `principles/rest-apis.md` 1
- `principles/technical-principles.md` 1
- `skills/larv-review/SKILL.md` 1
- `skills/larv-review/review-findings.md` 1
## Reading cost, chunk 3979e0345234, finished 2026-10-04T20:25:40Z
56802 new input tokens before the first commit.
Read most (opens and searches):
- `README.md` 2
- `docs/decisions.md` 2
- `todo.md` 2
- `.gitignore` 1
- `AGENTS.md` 1
- `CHANGELOG.md` 1
- `agents/stability-reviewer.md` 1
- `agents/systems-architect.md` 1
- `principles/technical-principles.md` 1
- `skills/larv-review/SKILL.md` 1
## Reading cost, chunk b4eea97f6667, finished 2026-10-07T10:37:56Z
46081 new input tokens before the first commit.
Read most (opens and searches):
- `README.md` 2
- `agents/stability-reviewer.md` 2
- `CHANGELOG.md` 1
- `agents/systems-architect.md` 1
- `skills/larv-review/SKILL.md` 1
- `todo.md` 1
## Reading cost, chunk 90755de2f601, finished 2026-10-08T13:29:17Z
50762 new input tokens before the first commit.
Read most (opens and searches):
- `docs/decisions.md` 3
- `.gitignore` 1
- `AGENTS.md` 1
- `CHANGELOG.md` 1
- `README.md` 1
- `skills/larv-review/SKILL.md` 1
- `skills/larv-review/review-findings.md` 1
- `todo.md` 1
+2 -2
View File
@@ -61,9 +61,9 @@
- An import sorts on its first binding, not its path, so moving or renaming a module reorders nothing. Where lines already group by kind — type imports, host packages — the key sorts within each group.
* Keep It Simple, Stupid (KISS): keep solutions simple, so a reader new to the project understands each part on one read.
- Keep a size or complexity limit only while the comprehension panel's readers (`~/.claude/skills/comprehension-panel/`) find the code it flags hard.
* Don't Repeat Yourself (DRY): one authoritative home per piece of knowledge, one obvious way per need.
* Don't Repeat Yourself (DRY) is a guide, not an absolute rule. It aims at one authoritative home per piece of knowledge, one obvious way per need. Before applying it, ask whether the code would be easier to understand, easier to reason about, or easier to maintain if DRY were broken; if so, break it, so long as the spellings cannot disagree (below). A surface people write — a template, data, an API — may accept a second spelling where that makes it easier to use.
- A value, rule, definition or concept lives in one place, and everywhere else derives it from there or points at it. A copy that can drift is a second spelling: derive it from its owner, or, for config a human writes, reject it where it is read and name the owner.
- Before adding a way to do something, find the existing one and use it. The same goes for tests: extend an existing test with an assertion before writing a new one. Where two spellings serve the same caller for the same need, keep one and reject the other as early as possible — at load, parse or compile — with an error naming the one to use: `token {p} renders a level that {p.first} reads a path into; name the fields you want instead`.
- Before adding a way to do something, find the existing one and use it. The same goes for tests: extend an existing test with an assertion before writing a new one. Where two spellings serve the same caller for the same need, keep one and reject the other as early as possible — at load, parse or compile — with an error naming the one to use: `token {p} renders a level that {p.first} reads a path into; name the fields you want instead`. A second spelling that makes a surface people write easier to use stays (above).
- Different needs may have different ways. A public API may offer a convenience beside the general form — a one-line call for the common case over the primitive for the rest — where each serves a caller or scenario its docs name, and the convenience is built from the primitive. Code that looks alike but encodes different knowledge is not a second spelling: merging it is the wrong abstraction.
- Two spellings that can disagree are a correctness bug, whatever the reason for having both: derive one from the other, or reject the combination.
* All critical flows should have good traces, from where something was initiated until it completed.
+10 -2
View File
@@ -95,9 +95,17 @@ the end. Tell everyone not to manufacture confusion.
A scoring run needs four seats — Junior A, Mid A, the maintainability senior and the inherited
architect — plus the calibration seat ("The score") when more than one project is in play. Build
the four seats' prompts from `scoring-run.md`, filled in from the project's `AGENTS.md` → "Scoring
the four seats' prompts from `seat-prompts.md`, filled in from the project's `AGENTS.md` → "Scoring
run". Change neither between runs, or the scores are not comparable. A project without that
section gets it at its first scoring run.
section gets it at its first scoring run or paired ruling.
## The paired ruling
A paired ruling asks whether a change makes a project read better, the same or worse. Each seat
reads both versions, so what the two versions share cannot move the ruling. Check out the older
version as a detached worktree in your scratchpad, and remove it afterwards. Build each seat's
prompt from `seat-prompts.md` → "Paired ruling"; the seats and the rule for adding one are the
caller's.
## What the seven report
@@ -1,10 +1,12 @@
# The scoring run's seat prompts
# The comprehension seats' prompts
Each seat's prompt is the four parts below, in order: the opening, the seat's background, the shared brief, and the report for its kind of seat. Copy the text verbatim and replace each `{placeholder}`:
A scoring-run seat's prompt is the opening, the seat's background, the shared brief, and the report for its kind of seat, in that order. Copy the text verbatim and replace each `{placeholder}`:
- `{checkout}` and `{branch}`: the worktree the seats read, and its branch.
- `{main}`: the project's main checkout.
- `{files}`: every tracked non-test file but `todo.md` and `docs/decisions.md`, from `git -C {checkout} ls-files`, listed as one recursive glob per top-level source directory, such as `bin/loop_claude/**/*.py`.
- `{forbidden}`: `todo.md, docs/decisions.md, docs/comprehension-history.md or docs/reading-cost.md (the plan, the decision log, past panels' records and past chunks' reading cost)`.
- `{git}`: `git -C {checkout} ls-files`, and for a paired seat also `git -C {base checkout} ls-files`, each in backticks.
- `{files}`: every tracked non-test file but those `{forbidden}` names, from `git -C {checkout} ls-files`, listed as one recursive glob per top-level source directory, such as `bin/loop_claude/**/*.py`.
- `{preloaded}`: the files the harness pre-loads into a seat, found per `SKILL.md` → "What makes the result trustworthy".
- `{anchors}` and `{dimensions}`: the six anchor bullets and the four dimension bullets in `SKILL.md` → "The score", verbatim, without bold and each on one line.
- `{language}`, `{kind}`, `{domain}`, `{domain docs}` and `{3am question}`: the project's `AGENTS.md` → "Scoring run".
@@ -12,7 +14,7 @@ Each seat's prompt is the four parts below, in order: the opening, the seat's ba
## Opening
```
You are one seat of a comprehension panel. Tools: Read, Grep, Glob, and Bash only for `git -C {checkout} ls-files` and `ls`. Never write, edit, run, build or test anything.
You are one seat of a comprehension panel. Tools: Read, Grep, Glob, and Bash only for {git} and `ls`. Never write, edit, run, build or test anything.
```
## Backgrounds
@@ -27,7 +29,7 @@ You are one seat of a comprehension panel. Tools: Read, Grep, Glob, and Bash onl
```
Target: the project checked out at {checkout} (branch `{branch}`). Read ONLY there — never {main}, which is a different version.
Depth 1, the whole project: read README.md, AGENTS.md and CLAUDE.md (the charter), then every non-test tracked file: {files}. Do NOT open todo.md or docs/decisions.md (the plan and decision log), nor any review output. You may open a test file when the code does not answer a question; say when you did.
Depth 1, the whole project: read README.md, AGENTS.md and CLAUDE.md (the charter), then every non-test tracked file: {files}. Do NOT open {forbidden}, nor any review output. You may open a test file when the code does not answer a question; say when you did.
Your harness pre-loads these files into your context before your first tool call, from a DIFFERENT version (main): {preloaded}. Treat the worktree's own copies as the ones under review. A pre-loaded AGENTS.md may list decision titles; do not use them as evidence.
@@ -63,3 +65,30 @@ Enforce this order:
3. Read enough implementation to check the map (depth 1: every non-test file is in scope, but your job is shape).
Report: the verbatim map; where it was wrong and how costly each correction was; level-by-level fan-out with the worst level named; names that mislead, concepts with two names, one name over two concepts, areas you could not name; what you would restructure, ranked, with files and costs; what the structure gets right. The 3am question: {3am question} — walking in cold, how long to the right file and unit? Where does it rot first, and where would the next two features land? Close with Navigation, Locality, Shape, Self-sufficiency and overall, each with one sentence naming its anchor and the concrete thing holding it there.
```
## Paired ruling
A paired seat's prompt is the opening, the seat's background, and the paired brief below. Its placeholders besides those above:
- `{base}` and `{head}`: the commits of the older and the newer version; `{base checkout}`: the worktree holding `{base}`.
- `{changed}`: the output of `git -C {checkout} diff --name-status {base} {head}`, less the files `{forbidden}` names.
```
Target: two versions of one project. The older, commit {base}, is checked out at {base checkout}; the newer, commit {head}, at {checkout}. Read ONLY there — never {main}, which is a different version.
Depth 1, the whole project in both versions: read README.md, AGENTS.md and CLAUDE.md (the charter), then every non-test tracked file at {checkout}: {files}. These files differ between the versions; read each at {base checkout} too, where it exists there:
{changed}
Do NOT open {forbidden}, nor any review output. You may open a test file when the code does not answer a question; say when you did.
Your harness pre-loads these files into your context before your first tool call, from main, which may match either version or neither: {preloaded}. Treat the two worktrees' own copies as the ones under review. A pre-loaded AGENTS.md may list decision titles; do not use them as evidence.
No running anything, no builds, no tests, no edits of any kind.
Rule whether the project as a whole reads better, the same or worse at {head} than at {base}, judged on these four dimensions:
{dimensions}
Same means a reader of either version would find it as easy to understand and change. Do not manufacture a difference.
Report, in this shape:
1. Your ruling: better, same or worse.
2. The places that decided it, most decisive first. Each: path:line and the unit's name, in the version the place is in, and one or two sentences on what reads easier or harder there than in the other version. A better or worse ruling with no named place is discarded.
```
+40 -19
View File
@@ -24,18 +24,20 @@ Words: `~/.claude/CLAUDE.md` → "Vocabulary". What a reviewer reports: ~/.claud
Follow `~/.claude/CLAUDE.md` → "Git, commits, and PRs". Never commit to the default branch. Commit, push with upstream set, and open a **draft** PR so CI cycles while the review runs. No remote → review locally and say so in the summary.
**Reading cost.** Run `~/.claude/bin/reading-cost` in the chunk's worktree and commit what it appends to `docs/reading-cost.md`; the commit re-enters no pass. Resolve a merge conflict in that file by putting the default branch's figures first and dropping a figure for a chunk the default branch already holds. On `Rising:`, file a plan item titled `**Lower the reading cost of the files chunks read most before their first commit.**`, scored per `~/.claude/CLAUDE.md` → "Todo items" with the tool's medians and files as its detail; where the plan already holds it, refresh its detail instead. The item names the next release, or the one after when this chunk ships the next release's last item. On exit 1, repair what its message names and run it again; when the message names no repair, file it as a `question` item, or refresh the question item an earlier run filed, and go on. Leave the plan as it is on any other output. The chunk that ships that item runs the tool with `--reset` instead, so the next rise is measured on chunks that finished after it.
## 3. Passes
A pass is one kind of review, a row of the table, named by its first column. Its trigger says when it runs on a change it has not seen; its reviewer reports the findings.
| Pass | Reviewer | Trigger |
|------|----------|----------------------------------------|
| Architecture | systems-architect, then principles-auditor and the scoring run | ships its release's last item, or carries an architectural decision: a new, restructured or moved component, module, service or boundary; a new dependency or first use of an infrastructure pattern (queue, cron, cache, websocket, …); a new or changed external contract (routes, request/response shapes, events, webhooks, published file formats, CLI flags and exit codes); a schema change beyond an additive column |
| Security | `/security-review` | changes code or config; a fix, only where it opens an untrusted-input boundary or touches authn/authz, secrets or crypto |
| Architecture | systems-architect, then principles-auditor and the comprehension check | ships or removes the last plan item of a release that has work landed towards it, or ships an item naming the comprehension floor; or carries an architectural decision: a new, restructured or moved component, module, service or boundary; a new dependency or first use of an infrastructure pattern (queue, cron, cache, websocket, …); a new or changed external contract (routes, request/response shapes, events, webhooks, published file formats, CLI flags and exit codes); a schema change beyond an additive column; a fix, only where it carries an architectural decision |
| Full scan | the `claude-security` plugin at high effort: `/claude-security scan this branch's changes at high` | touches authn/authz, secrets or crypto, opens an untrusted-input boundary, or adds an external surface |
| Security | `/security-review` | changes code or config, unless the full scan runs on the same change; a fix, only where it opens an untrusted-input boundary or touches authn/authz, secrets or crypto, and the full scan does not rerun on it |
| Stability | stability-reviewer | changes code, config or tests; a fix, only where it changes behaviour: what the code or its tests do |
| Product-owner | product-owner-reviewer | changes an external surface: API, CLI, UI, error or deprecation text a consumer reads, README and docs an outside reader lands on |
| Prose | prose-reviewer | every chunk; a fix, where it touches prose |
| Prose | prose-reviewer | every chunk, one round |
A comment is prose, not code. Passes run in this order: line-level polish on code the architect wants restructured, or on a call the security pass will rewrite, is wasted work.
@@ -46,23 +48,24 @@ Give a reviewer without Bash the branch diff and `git ls-files`'s output in its
- **Skip.** A precedent is a `docs/decisions.md` entry, or a plan item crediting the pass, that the repo held before the chunk began. Where one holds the decision this change executes, skip the pass and cite that entry or item.
- **Departure.** A change that departs from the precedent is unreviewed, however thorough the precedent is.
- **Ask.** Fired and not skipped → ask the user whether to run it, with the evidence and your recommendation; no user reachable → run it. For the full scan, give the evidence and your recommendation, then launch it: the plugin asks the user to confirm its cost, and that prompt is the ask.
- **Audit.** A precedent or the user's no skips only the architect, never the principles audit: no precedent checked the code this chunk writes. The scoring run skips only as "Architecture" → "Suspended" says.
- **Audit.** A precedent or the user's no skips only the architect, never the principles audit: no precedent checked the code this chunk writes. The comprehension check skips only as "Architecture" → "Suspended" says.
**Round cap.**
- **Round.** A round is one launch of a pass's reviewer: the first, each re-entry, and the rerun after the architect returns Stage 0 questions ("Architecture" below).
- **Architecture round.** The architecture pass's first round is the architect (unless skipped), the principles audit and the scoring run, which "Architecture" → "Suspended" may skip. A later round relaunches the scoring run, where one ran, and each reviewer whose 🔴 or 🟡 the previous round's fixes answer. Where those fixes carry an architectural decision, the whole round runs again, the architect included.
- **Round.** A round is one launch of a pass's reviewer: the first, each re-entry, and the rerun after the architect returns Stage 0 questions ("Architecture" below). A rescore is a round only as "Architecture" → "Fresh" says.
- **Architecture round.** The architecture pass's first round is the architect (unless skipped), the principles audit and the comprehension check, which "Architecture" → "Suspended" may skip. A later round relaunches each reviewer whose 🔴 or 🟡 the previous round's fixes answer, the comprehension check only as "Architecture" → "Fresh" says. Where those fixes carry an architectural decision, the architect and the principles audit run again.
- **Auto-reviewer.** The external auto-reviewer (§4) is a pass of its own, each review it posts a round.
- **Count.** Close each round with one commit that holds the round's fixes and is titled `Answer <pass> round <n>: …`, `<pass>` being the pass's name in lower case, such as `full scan`. A round that changed nothing gets an empty commit (`git commit --allow-empty`). Push the commits when §4 runs next, where there is a remote. A pass's count is the highest `<n>` among titles holding `Answer <pass> round <n>:` in `git log origin/<default branch>..HEAD` after a `git fetch`, or in `git log <default branch>..HEAD` with no remote. The auto-reviewer's count is the number of its reviews on the PR.
- **Later rounds.** From round 2, prompt an agent under `~/.claude/agents/` with its own last round's findings verbatim and what changed since: `git diff <the commit that round reviewed> HEAD`, since the fixes may be unpushed.
- **Done.** A pass is done when its latest round leaves no 🔴 or 🟡 standing: none was reported, or each was shown factually wrong, declined, filed, or named under the bar per "Findings". Resolve that round's 🟢s and ❓s per "Findings" too.
- **Count.** Close each round with one commit that holds the round's fixes and is titled `Answer <pass> round <n>: …`, `<pass>` being the pass's name in lower case, such as `full scan`. A round that changed nothing gets an empty commit (`git commit --allow-empty`). Push the commits when §4 runs next, where there is a remote. A pass's count is the highest `<n>` among titles holding `Answer <pass> round <n>:` in `git log origin/<default branch>..HEAD` after a `git fetch`, or in `git log <default branch>..HEAD` with no remote. The auto-reviewer's count is the number of its reviews on the PR, less its reviews of a `Rescore:` commit.
- **Later rounds.** A rerun pass reviews only what changed since it last reviewed: `git diff <the commit it last reviewed, or else the commit before this round's fixes> HEAD`, since the fixes may be unpushed. The comprehension check's seats still read the whole project. From round 2, prompt an agent under `~/.claude/agents/` with its own last round's findings verbatim too.
- **Done.** A pass is done when its latest round leaves no 🔴 or 🟡 standing: none was reported, or each was shown factually wrong, declined, filed, or named under the bar per "Findings", or, for the prose pass, fixed. Resolve that round's 🟢s and ❓s per "Findings" too.
- **Cap.** A pass takes at most three rounds per chunk. Instead of a fourth, list what is open and ask the user. For the auto-reviewer, ask before the push that would summon its fourth, and hold the fixes unpushed until the answer.
- **Answer.** A yes grants that pass one more round, after which the ask repeats; a no leaves the PR unmerged.
**Re-entry.**
- **Fix.** A fix is a change no pass has seen, a 🟢's or ❓'s included.
- **Rerun.** A round's fixes re-enter together: run, in table order, each pass whose trigger they fire, a done pass included, and each pass whose 🔴 or 🟡 they answer; a pass at its cap gets "Round cap" → "Cap"'s ask instead. Then §4.
- **Fix.** A fix is a change no pass has seen.
- **Rerun.** A round's fixes for 🔴 and 🟡 findings outside the prose pass re-enter together. Run, in table order, each pass whose 🔴 or 🟡 they answer, and each pass whose trigger has an "a fix, only where …" clause they meet, a done pass included. A pass at its cap gets "Round cap" → "Cap"'s ask instead. Then §4.
- **No rerun.** A fix for a 🟢, a ❓ or any prose finding reruns no pass. Its commit still calls for a rescore per "Architecture" → "Fresh".
**Findings.** A reviewer rates each finding 🔴 must fix, 🟡 should fix, 🟢 nit, ❓ question, or 🔀 escalation naming the reviewer whose concern it is.
@@ -83,24 +86,42 @@ Launch systems-architect: review the system as a whole entered through this chan
Then the principles audit: one principles-auditor for the README's goals, and one per file in `~/.claude/principles/` whose `Applies to` line the project meets, judged from the README, `git ls-files` and the branch diff. A file without the line applies to every project. Unsure → launch it.
Then the comprehension floor, which the scoring run measures. Four simulated readers — Junior A, Mid A, the maintainability senior and the inherited architect — each read the whole project, not the diff, and score it from 1 to 10 overall and on four dimensions: Navigation, Locality, Shape and Self-sufficiency. A seat's overall may not exceed its lowest dimension by more than 1. Each score is the mean of the four seats, to two decimals. Launch the seats per `~/.claude/skills/comprehension-panel/SKILL.md` → "The scoring run".
Then the comprehension check: simulated readers, launched per `~/.claude/skills/comprehension-panel/SKILL.md`, each read the whole project, not the diff. It has two kinds of run.
The project's `docs/decisions.md` keeps one entry whose title opens `comprehension floor:`. It holds the last scoring run's scores, and each decision to ship under the floor, with its scores.
**Paired ruling**, in every architecture pass. Each seat votes whether the project reads better, the same or worse at this branch's head than at the base.
- **Base.** The last measured commit: the newest commit on `origin/<default branch>`, after a `git fetch`, whose change to the history (below) adds a scoring run, or whose last added paired ruling is better. Read each merged change whole, a merge commit as one change: `git log --first-parent --diff-merges=first-parent -p origin/<default branch> -- docs/comprehension-history.md`; with no remote, use `<default branch>`. No such commit → the base the first paired ruling in that history names; no ruling either → the merge base of the head and the default branch.
- **Head.** Before each ruling, merge `origin/<default branch>` into this branch unless the head already holds it, so the seats see only this branch's change on top of the base.
- **Seats.** Mid A and the inherited architect. When their votes differ, the maintainability senior and Junior A vote too, launched together.
- **Ruling.** The vote that leads each other vote by two or more; without one, same. A better or worse vote that names no place counts as same.
**Scoring run**, when the chunk ships or removes the last plan item of a release that has work landed towards it, or ships an item naming the comprehension floor. Junior A, Mid A, the maintainability senior and the inherited architect each score the project at the head from 1 to 10 overall and on four dimensions: Navigation, Locality, Shape and Self-sufficiency. A seat's overall may not exceed its lowest dimension by more than 1. Each score is the mean of the four seats, to two decimals.
The chunk does not merge while either holds:
- **Floor.** Any dimension or the overall is below 7.0.
- **Ratchet.** Any score is below the entry's last scoring run as it stands on the default branch, even within the panel's noise. An equal score passes, and so does every run while the default branch has no entry.
- **Ratchet.** The paired ruling is worse.
- **Floor.** The scoring run puts any dimension or the overall below 7.0.
Fix the places the seats name under the lowest dimension and under each dimension that fell. When only the floor holds, the user may decide to ship instead. A decision that lets every chunk ship under the floor, held in the project's `docs/decisions.md` before the chunk began, counts as theirs while it stands. A decision to ship listed in the `comprehension floor:` entry covers only the chunk it names. No user reachable → fix. A fall is never shipped without the user: after three rounds, "Round cap" → "Cap" asks them.
Each is a 🔴 of the comprehension check. It is never filed, and stands until a later run clears it or, for the floor, a decision to ship answers it.
Put each run's five scores in the summary, and replace the entry's last scoring run with them on this branch. List in the entry each decision to ship under the floor, and file its places in `todo.md` per `~/.claude/CLAUDE.md` → "Todo items". A project without the entry gets it at its first scoring run, titled `comprehension floor: every dimension and the overall at 7.0 or above` and applying KISS (`~/.claude/principles/technical-principles.md`).
Fix a worse ruling at the places the seats voting worse name, and the floor at the places the seats name under the lowest dimension. Under the floor alone, the user may decide to ship instead. A decision that lets every chunk ship under the floor, held in the project's `docs/decisions.md` before the chunk began, counts as theirs while it stands. A decision to ship listed in the `comprehension floor:` entry covers only the chunk it names. No user reachable → fix. A worse ruling never ships: after three rounds, "Round cap" → "Cap" asks the user for another round.
**Suspended.** A decision in the project's `docs/decisions.md`, held before the chunk began, may name plan items to ship without a scoring run. A named item counts as `todo.md` worded it before the chunk began. The decision must name the later plan item whose chunk ends the suspension with a scoring run. A chunk may ship named items only with each other. Such a chunk skips the scoring run, so neither the floor nor the ratchet can block it, and its summary cites the decision. A chunk shipping its release's last item runs the scoring run, even when every item it ships is named.
Two files of the project keep the records:
- **History.** `docs/comprehension-history.md` keeps every paired ruling and scoring run, appended and never edited. Each opens with a `## <UTC time, ISO 8601>, <PR or branch> at <commit>` heading naming when the seats finished and the commit they read; a paired ruling's heading ends `, against <base>`. A paired ruling holds a `Ruling: <better, same or worse>` line, a table of each seat's vote, and under each seat, labelled `<seat>, decided by:`, its places. A scoring run holds a table of each seat's five scores, with a last row holding the four seats' mean of each, and under each seat, labelled `<seat>, hardest first:` or, for the architect, `<seat>, would restructure first:`, its places. A place is `path:line` and the unit's name, the path written from the repository's root. A bare `:line` is in the path named before it in the same bullet. `bin/metric_bench/places.py` reads this format: change both together. Appending re-enters no pass. Resolve a merge conflict in the file by putting the default branch's entries first.
- **Entry.** `docs/decisions.md` keeps one entry whose title opens `comprehension floor:`. It holds each decision to ship under the floor, with its scores.
A `comprehension floor:` entry written before the history may still hold a scoring run's five scores. The next scoring run moves them, and only them, into the history as its first run: a heading of the date or time the entry gives and whatever it names the run by, its commit included where named, and a table with the mean alone. The rest of the entry stays.
Put each ruling with its base and votes, and each run's five scores, in the summary, and append them to the history on this branch. List in the entry each decision to ship under the floor, and file its places in `todo.md` per `~/.claude/CLAUDE.md` → "Todo items". A project without the entry gets it at its first scoring run, titled `comprehension floor: every dimension and the overall at 7.0 or above` and applying KISS (`~/.claude/principles/technical-principles.md`).
**Fresh.** Where the chunk ran a comprehension check, the architecture pass is done only once its last paired ruling, and its last scoring run where it ran one, read the commit to merge. They may predate commits that change only `docs/decisions.md`, `docs/comprehension-history.md`, `docs/reading-cost.md`, `todo.md` or `CHANGELOG.md`. Any other commit after them, a prose fix included, because the seats read the docs, calls for a rescore: the comprehension check again, once every other pass is done, the auto-reviewer included. A rescore reporting a 🔴 that no decision to ship answers is an architecture round. Any other rescore is not a round: append only its results to the history, in a commit titled `Rescore: …`. A `Rescore:` commit re-enters no pass: push it and wait for the forge's checks (§4 step 3), not for an auto-review.
**Suspended.** A decision in the project's `docs/decisions.md`, held before the chunk began, may name plan items to ship without a comprehension check. A named item counts as `todo.md` worded it before the chunk began. The decision must name the later plan item whose chunk ends the suspension with a comprehension check. A chunk may ship named items only with each other. Such a chunk skips the comprehension check, so neither the ratchet nor the floor can block it, and its summary cites the decision. A chunk that meets the scoring run's trigger runs it, even when every item it ships is named.
### Security
`/security-review` over the branch diff is the pass of record. Launch a general-purpose subagent that invokes it through the Skill tool, edits nothing, and replies with the skill's report, or that the skill is unavailable. Invoked in your own context, the skill ends your turn on that report.
`/security-review` over the branch diff is the pass of record, except where the full scan runs on the same change and replaces it. Where the full scan fires but does not run — skipped on a precedent, declined at its cost prompt, or unavailable — `/security-review` runs. Launch a general-purpose subagent that invokes it through the Skill tool, edits nothing, and replies with the skill's report, or that the skill is unavailable. Invoked in your own context, the skill ends your turn on that report.
A verified HIGH inside this chunk's blast radius is fixed here, outside it on its own branch and PR with this chunk waiting behind it. Say which.
+118 -52
View File
@@ -6,65 +6,75 @@
`Bar = 9`
`Next ID = 72`
`Next ID = 86`
| Goal | W |
|---|---|
| 1 | 1.00 |
| 2 | 0.89 |
| 3 | 0.78 |
| 4 | 0.67 |
| 4.1 | 0.56 |
| 4.2 | 0.44 |
| 4.3 | 0.33 |
| 4.4 | 0.22 |
| 4.5 | 0.11 |
| 1.1 | 0.99 |
| 1.2 | 0.98 |
| 1.3 | 0.97 |
| 1.4 | 0.96 |
| 1.5 | 0.95 |
| 2 | 0.90 |
| 3 | 0.85 |
| 4 | 0.80 |
## Items
| ID | Release | Exempt | Item | R | S | A | G | Goals | Score |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 0.1.0 | question | **Say in README → Install how the transcript archive is backed up, once bender-infra backs up ai-sandbox's data volume.** | 3 | 5 | 8 | 9 | 2, 3 | 27.8 |
| 60 | 0.1.0 | | **Rerun the scoring run before merge whenever a fix landed after the last scoring run, and count a score under the floor or the ratchet as the scoring run's 🔴.** | 3 | 3 | 6 | 7 | 4.1 | 16.1 |
| 62 | 0.1.0 | defect | **Lift Locality, Self-sufficiency and the overall to the comprehension floor, at the places the seats name.** | 4 | 6 | 6 | 8 | 4.1 | 15.5 |
| 65 | 0.1.0 | | **Archive each judge reply the loop rejects.** | 3 | 4 | 4 | 5 | 2 | 12.9 |
| 21 | 0.1.0 | | **Give `settings.json`'s model one writer, and sort its keys.** | 3 | 3 | 6 | 7 | 4.3 | 12.9 |
| 49 | 0.1.0 | principle | **Check that `AGENTS.md` lists exactly the titles of `docs/decisions.md`.** | 1 | 2 | 5 | 6 | 4.3 | 12.5 |
| 12 | 0.1.0 | | **Run the test suite in CI on every PR, or record in `docs/decisions.md` why the local run is enough.** | 2 | 4 | 4 | 6 | 4.1 | 11.7 |
| 59 | 0.1.0 | | **Bound a run of unfinished verdicts on one chunk, so a worker and judge that disagree cannot cycle unattended without end.** | 3 | 3 | 6 | 6 | 4.4 | 10.9 |
| 5 | 0.1.0 | decision | **Key a project on its checkout's full path, and refuse to start while another session uses that key.** | 5 | 5 | 5 | 6 | 4.1 | 10.5 |
| 66 | 0.1.0 | principle | **Hold systems-architect's method thresholds only while the comprehension panel finds the flagged code hard.** | 3 | 3 | 4 | 5 | 4.1 | 9.9 |
| 4 | 0.1.0 | | **Name each chunk's archive folder by the chunk's start time, so `<key>/` lists chunks in the order they ran.** | 3 | 2 | 4 | 3 | 2 | 9.8 |
| 50 | 0.1.0 | principle | **Grant the bench's runs only the tools a review needs, in place of skipping every permission.** | 2 | 2 | 3 | 4 | 3 | 9.7 |
| 69 | 0.1.0 | principle | **Measure test coverage, so a chunk that lowers it is seen.** | 3 | 4 | 4 | 5 | 4.1 | 9.6 |
| 29 | 0.1.0 | | **Make the contributor a standing member of every project's audience, unless its `## Audience` says maintainability does not matter.** | 2 | 2 | 3 | 5 | 4.1, 4.4 | 9.1 |
| 68 | 0.1.0 | principle | **Test `workflow-bench/compare.py`'s blinding and `bench.py`'s run plan.** | 2 | 4 | 3 | 5 | 4.1 | 8.6 |
| 67 | 0.1.0 | principle | **Point stability-reviewer at the technical principles in place of its own restatement of them.** | 2 | 3 | 4 | 5 | 4.3 | 8.6 |
| 52 | 0.1.0 | principle | **Record why this checkout lives in Claude Code's own directory, or move it out and link it in.** | 6 | 6 | 3 | 5 | 1 | 8.5 |
| 6 | 0.1.0 | decision | **Move what `loop-claude` writes out of `~/.claude.json`, and ask the human about each write that must stay.** | 5 | 5 | 4 | 5 | 4.1 | 7.4 |
| 51 | 0.1.0 | principle | **Hand loop-claude's terminal output to an injected effect, so no storage or retry function prints.** | 3 | 5 | 3 | 5 | 4.1 | 7.4 |
| 78 | 0.1.0 | | **Generate comprehension questions with deterministic scripts — from symbols, the call graph and the tests, each answer checkable by a tool — and bench the scores an agent gets on them against the panel, reading cost and static metrics.** | 3 | 7 | 9 | 8 | 1.1, 1.4 | 29.1 |
| 85 | 0.1.0 | decision | **Move larv-review's mechanical rules — the paired ruling's base and vote count, each pass's round count, the scoring run's trigger and the comprehension history's format — into one tested tool under `bin/`, so the skill says only when to run it and what each answer means.** | 4 | 7 | 8 | 9 | 1.1 | 28.1 |
| 1 | 0.1.0 | question | **Say in README → Install how the transcript archive is backed up, once bender-infra backs up ai-sandbox's data volume.** | 3 | 5 | 8 | 9 | 3, 4 | 27.0 |
| 62 | 0.1.0 | defect | **Lift Locality, Self-sufficiency and the overall to the comprehension floor, at the places the seats name.** | 4 | 6 | 6 | 8 | 1.1 | 22.3 |
| 21 | 0.1.0 | | **Give `settings.json`'s model one writer, and sort its keys.** | 3 | 3 | 6 | 7 | 1.3 | 21.8 |
| 49 | 0.1.0 | principle | **Check that `AGENTS.md` lists exactly the titles of `docs/decisions.md`.** | 1 | 2 | 5 | 6 | 1.3 | 20.1 |
| 59 | 0.1.0 | | **Bound a run of unfinished verdicts on one chunk, so a worker and judge that disagree cannot cycle unattended without end.** | 3 | 3 | 6 | 6 | 1.4 | 19.8 |
| 12 | 0.1.0 | | **Run the test suite in CI on every PR, or record in `docs/decisions.md` why the local run is enough.** | 2 | 4 | 4 | 6 | 1.1 | 16.9 |
| 80 | 0.1.0 | | **State in README → Install that every machine taking this checkout must be a sandbox, as `settings.json`'s auto mode assumes.** | 1 | 1 | 5 | 5 | 4 | 16.8 |
| 83 | 0.1.0 | | **Group `bin/` by tool, so each tool's modules and tests sit together.** | 3 | 4 | 4 | 6 | 1.1 | 15.9 |
| 5 | 0.1.0 | decision | **Key a project on its checkout's full path, and refuse to start while another session uses that key.** | 5 | 5 | 5 | 6 | 1.1 | 15.6 |
| 84 | 0.1.0 | | **Check, at each release's scoring run, that seats in a paired ruling agree more often than two scoring runs on near-identical code do, as the paired-ruling decision assumes.** | 2 | 2 | 4 | 5 | 1.4 | 15.1 |
| 67 | 0.1.0 | principle | **Point stability-reviewer at the technical principles in place of its own restatement of them.** | 2 | 3 | 4 | 5 | 1.3 | 14.9 |
| 66 | 0.1.0 | principle | **Hold systems-architect's method thresholds only while the comprehension panel finds the flagged code hard.** | 3 | 3 | 4 | 5 | 1.1 | 14.2 |
| 69 | 0.1.0 | principle | **Measure test coverage, so a chunk that lowers it is seen.** | 3 | 4 | 4 | 5 | 1.1 | 13.9 |
| 29 | 0.1.0 | | **Make the contributor a standing member of every project's audience, unless its `## Audience` says maintainability does not matter.** | 2 | 2 | 3 | 5 | 1.1, 1.4 | 13.4 |
| 68 | 0.1.0 | principle | **Test `workflow-bench/compare.py`'s blinding and `bench.py`'s run plan.** | 2 | 4 | 3 | 5 | 1.1 | 12.9 |
| 65 | 0.1.0 | | **Archive each judge reply the loop rejects.** | 3 | 4 | 4 | 5 | 3 | 12.5 |
| 82 | 0.1.0 | principle | **Sort `AGENTS.md`'s decision titles and `docs/decisions.md`'s entries by title.** | 1 | 2 | 3 | 4 | 1.3 | 12.3 |
| 73 | 0.1.0 | | **Have each reviewer write its full report to a file and return the worker only its findings' one-line summaries.** | 3 | 4 | 4 | 4 | 1.4 | 11.7 |
| 6 | 0.1.0 | decision | **Move what `loop-claude` writes out of `~/.claude.json`, and ask the human about each write that must stay.** | 5 | 5 | 4 | 5 | 1.1 | 11.7 |
| 51 | 0.1.0 | principle | **Hand loop-claude's terminal output to an injected effect, so no storage or retry function prints.** | 3 | 5 | 3 | 5 | 1.1 | 11.7 |
| 50 | 0.1.0 | principle | **Grant the bench's runs only the tools a review needs, in place of skipping every permission.** | 2 | 2 | 3 | 4 | 4 | 9.9 |
| 81 | 0.1.0 | principle | **Have `workflow-bench/bench.py` return each run's failure as a value, so one failed clone does not hide the later runs' results.** | 2 | 2 | 3 | 4 | 4 | 9.9 |
| 4 | 0.1.0 | | **Name each chunk's archive folder by the chunk's start time, so `<key>/` lists chunks in the order they ran.** | 3 | 2 | 4 | 3 | 3 | 9.6 |
| 52 | 0.1.0 | principle | **Record why this checkout lives in Claude Code's own directory, or move it out and link it in.** | 6 | 6 | 3 | 5 | 2 | 7.5 |
| 77 | 0.2.0 | | **Teach `bin/metric-bench` Go and TypeScript, rerun it once two projects' comprehension histories name places, and bring into review only a metric that tracks the panel.** | 3 | 6 | 6 | 7 | 1.1, 1.4 | 21.4 |
## Details
### 78. Generate comprehension questions with deterministic scripts — from symbols, the call graph and the tests, each answer checkable by a tool — and bench the scores an agent gets on them against the panel, reading cost and static metrics.
A hand-written question bank goes stale as the project grows and leaves everything it does not ask about unmeasured. A script that samples symbols at random each run ("what calls X?", "where is Y validated?", "which test fails if Z changes?") covers the whole project over time, and the call graph, grep and the tests hold the answers, so no judge is needed. Each answer names the code it rests on, so a question whose code changed is regenerated. Keep the method only where the bench shows it tracks the panel at a lower cost.
### 85. Move larv-review's mechanical rules — the paired ruling's base and vote count, each pass's round count, the scoring run's trigger and the comprehension history's format — into one tested tool under `bin/`, so the skill says only when to run it and what each answer means.
2026-10-08, lilleman: next after item 78, which lowers token use. Every comprehension run since PR #224 named `skills/larv-review/SKILL.md` §3 "Architecture" the hardest place, and PR #228's paired ruling ruled worse on rules a program should hold: the base's `git log` search and fallbacks, the vote arithmetic, a trigger written out three times, and the round count PR #225's seats said only prose enforces. PR #228's reviewers found about twenty edge cases in that text, among them squash against merge commits, entry order, a vote with no place, and a trigger judged before items are removed; tests can hold each, prose could not. Keep the skill's judgement calls in prose, and give the tool the history's format, so the base search does not hang on the wording of a line. The history's reader in `bin/metric_bench/places.py` moves into that tool, so the format has one reader.
### 1. Say in README → Install how the transcript archive is backed up, once bender-infra backs up ai-sandbox's data volume.
It lives under `~/.claude`, which `.gitignore` keeps from the remote, so a lost disk loses every unattended run's record. Back it up only to a destination private to me and encrypted at rest: the worker runs with permissions bypassed, so the archived tool results can hold credentials it read.
2026-10-02, the human: ai-sandbox is the VM `loop-claude` will run on, hosted on the server bender. bender-infra, the infrastructure-as-code project that manages bender, will back up ai-sandbox's data volume once ai-sandbox is rebuilt. The item waits for the human to say the rebuild has landed; do not remind them. Before writing the README line, check that `~/.claude` lives on that volume and that the backup is private and encrypted at rest.
The README line covers the bench's transcripts in `workflow-bench/logs/` too (goal 2).
### 60. Rerun the scoring run before merge whenever a fix landed after the last scoring run, and count a score under the floor or the ratchet as the scoring run's 🔴.
Raised by the systems-architect review of PR #215. A stability, product-owner, prose or auto-reviewer fix reruns no scoring run unless it carries an architectural decision or answers an architecture 🔴 or 🟡. It merges unscored, so the `comprehension floor:` entry records scores for an earlier commit, and the next chunk's ratchet inherits a fall it did not cause. "Round cap" → "Done" and "Re-entry" → "Rerun" count only 🔴 and 🟡, and nothing makes a score under the floor one. A commit that only edits `docs/decisions.md`, `todo.md` or `CHANGELOG.md` needs no rerun.
The README line covers the bench's transcripts in `workflow-bench/logs/` too (goal 3).
### 62. Lift Locality, Self-sufficiency and the overall to the comprehension floor, at the places the seats name.
Raised by the principles audit of PR #215 against KISS, in `principles/technical-principles.md`, and goal 4.1: the `comprehension floor:` entry in `docs/decisions.md` lists seven decisions to ship under the floor, and 0.1.0 waits on the floor. PR #215's last run put Locality at 6.63 and Self-sufficiency and the overall at 6.88. Its seats named, under Locality: the judge's contract spread over `cycle/judge_reply.py`, `cycle/worker.py` and `cycle/run.py`; `remaining`, which is `Unfinished.evidence` under another name, threaded through `loop/main.py`, `loop/reload.py`'s `LoopRun`, `cycle/run.py` and `worker_args`; the `quoted_answers` cap held by case order in `cycle/states.py`'s `transition` and restated in `run.py`'s `question_for`; the four outcome texts `run.py` builds inline for `archive`. Under Self-sufficiency: `skills/larv-review/SKILL.md`, which needs `CLAUDE.md` → "Vocabulary" open beside it; the archive layout, defined only in `bin/loop_claude/loop/main.py`'s docstring and not at `cycle/archive.py`; `JUDGE_RULES`' precedence in `cycle/judge_reply.py`, restated by `verdict_from`'s branch order and the `Reply` field descriptions; the `sys.path` insert in `bin/loop-claude` that the `from failure import` lines rely on, unstated at the import sites.
Raised by the principles audit of PR #215 against KISS, in `principles/technical-principles.md`, and goal 1.1: the `comprehension floor:` entry in `docs/decisions.md` lists seven decisions to ship under the floor, and 0.1.0 waits on the floor. PR #215's last run put Locality at 6.63 and Self-sufficiency and the overall at 6.88. Its seats named, under Locality: the judge's contract spread over `cycle/judge_reply.py`, `cycle/worker.py` and `cycle/run.py`; `remaining`, which is `Unfinished.evidence` under another name, threaded through `loop/main.py`, `loop/reload.py`'s `LoopRun`, `cycle/run.py` and `worker_args`; the `quoted_answers` cap held by case order in `cycle/states.py`'s `transition` and restated in `run.py`'s `question_for`; the four outcome texts `run.py` builds inline for `archive`. Under Self-sufficiency: `skills/larv-review/SKILL.md`, which needs `CLAUDE.md` → "Vocabulary" open beside it; the archive layout, defined only in `bin/loop_claude/loop/main.py`'s docstring and not at `transcript_archive.py`; `JUDGE_RULES`' precedence in `cycle/judge_reply.py`, restated by `verdict_from`'s branch order and the `Reply` field descriptions; the `sys.path` insert in `bin/loop-claude` that the `from failure import` lines rely on, unstated at the import sites.
### 65. Archive each judge reply the loop rejects.
Goal 2, raised by the principles audit of PR #215: the judge runs with `--no-session-persistence`, and the first two rejected replies reach only stderr, so the archive cannot answer the 3am question of why the loop rejected a verdict.
PR #225's last run, at 8c9bf09, put Locality at 6.75 and Self-sufficiency and the overall at 6.88. Its seats named: the judge's policy spread over `loop/main.py`'s docstring, `cycle/judge_reply.py`'s `JUDGE_RULES`, `cycle/judge.py`'s `judge_prompt` and `cycle/worker.py`'s `worker_args`; `loop_claude/claude_code/` and the read side of `transcript_archive.py`, which `bin/reading_cost/` also imports; two meanings of a checkout's root in `project/checkout.py`'s `checkout_root` and `reading_cost/main.py`'s `located`; and `skills/larv-review/SKILL.md` §3's round count, which only prose enforces.
### 21. Give `settings.json`'s model one writer, and sort its keys.
@@ -76,49 +86,72 @@ Every write Claude Code makes to the file rewrites `"model"`, `claude plugin ins
DRY, in `principles/technical-principles.md`: the list is copied by hand, and sessions work from the copy.
### 59. Bound a run of unfinished verdicts on one chunk, so a worker and judge that disagree cannot cycle unattended without end.
Raised by the product-owner review of PR #211. The resumed worker gets the judge's quote of the work remaining, but a worker that still thinks the chunk done can answer each cycle the same way, and each cycle costs a worker and a judge run (goal 1.4).
### 12. Run the test suite in CI on every PR, or record in `docs/decisions.md` why the local run is enough.
The repo has no CI, so larv-review's gate is the local run, and larv-review's Gate skips even that when the last stability round left the suite green: an unattended chunk can merge on the worker's own word.
### 59. Bound a run of unfinished verdicts on one chunk, so a worker and judge that disagree cannot cycle unattended without end.
### 80. State in README → Install that every machine taking this checkout must be a sandbox, as `settings.json`'s auto mode assumes.
Raised by the product-owner review of PR #211. The resumed worker gets the judge's quote of the work remaining, but a worker that still thinks the chunk done can answer each cycle the same way, and each cycle costs a worker and a judge run (goal 4.4).
Raised by the principles audit of PR #224. The `settings.json` decision is valid while every machine taking this checkout is a sandbox, but Install asks for a sandbox only for `loop-claude`, so a new machine is never told.
### 83. Group `bin/` by tool, so each tool's modules and tests sit together.
Raised by the architect on PR #225 and by the inherited architect of PR #224's scoring run: `bin/` is one flat folder of tools, the modules they share and the repo's checks, with `loop_claude`'s tests beside them instead of beside the package. `loop_claude/claude_code/` parses Claude Code's own formats and `bin/reading_cost/measure.py` imports it too, so it is a package of its own.
### 5. Key a project on its checkout's full path, and refuse to start while another session uses that key.
The key names the project's session, archive folder and models entry. `project_key` drops the leading `/`, so `~/code/a` and `/a` share all three, and one loop can resume or delete the other's session.
`bin/reading-cost` keys the archive by the main checkout, the parent of git's common dir, since it runs in a chunk's worktree; `loop-claude` keys it by `--show-toplevel`, so a loop started inside a worktree archives where `reading-cost` never looks. Derive both keys one way.
### 84. Check, at each release's scoring run, that seats in a paired ruling agree more often than two scoring runs on near-identical code do, as the paired-ruling decision assumes.
Raised by the principles audit of PR #228: the `review: a paired ruling …` entry in `docs/decisions.md` is valid only while that holds, and `docs/comprehension-history.md` keeps every vote, yet nothing reads the agreement rate. Scoring runs on near-identical code are rare now, so compare with those already in the history, such as PR #224's and PR #225's, or make a second run for the check.
### 67. Point stability-reviewer at the technical principles in place of its own restatement of them.
DRY, in `principles/technical-principles.md`: `agents/stability-reviewer.md` restates principles in its own words, and the copy has drifted: it asks for "properly randomised UUIDs" where the principle requires UUID v7.
### 66. Hold systems-architect's method thresholds only while the comprehension panel finds the flagged code hard.
KISS, in `principles/technical-principles.md`, which keeps a limit only while readers find the flagged code hard. `agents/systems-architect.md` makes cyclomatic 7 and 24 lines gate rules from the first commit, a 🔴 unless a reason is stated.
### 4. Name each chunk's archive folder by the chunk's start time, so `<key>/` lists chunks in the order they ran.
Today the folder is the SHA-256 of the transcript's first timestamped line, which tells the human nothing; that line carries the start time. Drop the fallback to the first line, which every chunk of a project shares, and give the tests' fake transcripts ISO timestamps.
### 50. Grant the bench's runs only the tools a review needs, in place of skipping every permission.
"Always grant explicit access to data", in `principles/technical-principles.md`: `workflow-bench/bench.py` starts claude with `--dangerously-skip-permissions`, and no rule confines it to a sandbox, so a run on the host reaches the host's credentials and other checkouts.
### 69. Measure test coverage, so a chunk that lowers it is seen.
"Test coverage should not decline", in `principles/technical-principles.md`: nothing reports coverage, so a chunk that deletes a test or adds untested code passes unseen.
### 29. Make the contributor a standing member of every project's audience, unless its `## Audience` says maintainability does not matter.
State that in `CLAUDE.md`'s goals-and-audience rule, and have larv-review's comprehension floor name the contributor as the reader it serves. The floor then gates every chunk while the contributor stands, and a project that drops them skips it.
State that in `CLAUDE.md`'s goals-and-audience rule, and have larv-review's comprehension floor name the contributor as the reader it serves. The floor's block then applies to a project whose audience includes the contributor, and a project that drops them skips it.
### 68. Test `workflow-bench/compare.py`'s blinding and `bench.py`'s run plan.
"Most, if not all, code should have automated tests", in `principles/technical-principles.md`: `compare.blind()` keeps the comparison blind, and a version name it misses invalidates the bench silently.
### 67. Point stability-reviewer at the technical principles in place of its own restatement of them.
### 65. Archive each judge reply the loop rejects.
DRY, in `principles/technical-principles.md`: `agents/stability-reviewer.md` restates principles in its own words, and the copy has drifted: it asks for "properly randomised UUIDs" where the principle requires UUID v7.
Goal 3, raised by the principles audit of PR #215: the judge runs with `--no-session-persistence`, and the first two rejected replies reach only stderr, so the archive cannot answer the 3am question of why the loop rejected a verdict.
### 52. Record why this checkout lives in Claude Code's own directory, or move it out and link it in.
### 82. Sort `AGENTS.md`'s decision titles and `docs/decisions.md`'s entries by title.
"One owner per value" and "Prefer the vendor-neutral option", in `principles/technical-principles.md`: git, Claude Code and loop-claude all write `~/.claude`, kept apart only by the `.gitignore` allowlist, and the repo's records live in a vendor directory.
"Deterministic order", in `principles/technical-principles.md`, raised by the principles audit of PR #224: their order carries no meaning, so two chunks adding a decision conflict at the end, and a reader cannot find a title by scanning.
### 73. Have each reviewer write its full report to a file and return the worker only its findings' one-line summaries.
2026-10-08, lilleman: rescored from A10/G8 to A4/G4 on the measurement below, so other items that lower token use go first.
Measured over the 68 transcripts in loop-claude's archive on 2026-10-08, matching each Agent call to its tool result and to any `<task-notification>` naming its tool-use id. No report reached the worker twice: 813 arrived once as the hand-back, and 363 once as a notification after Claude Code ran the agent in the background. Reports took a median 19k tokens per chunk, 8% of the worker's peak context (24% at most). Lines carrying a severity mark are 9–24% of a reviewer's report, and the worker would still open the file for each 🔴 or 🟡 it fixes. A third of the report volume is the comprehension seats', whose votes and places the worker copies into the history. File reads fill more of the worker's context: `sed -n` output is 30% of its Bash results and `grep` output 11%, which item 78 and `reading-cost` target.
The reports would live in the session's scratchpad, such as `<scratchpad>/larv-review/prose-round-1.md`, so no project's checkout sees them. A later round gets the path of that pass's earlier report in place of the findings pasted in. How a report reaches the file:
- **Write access.** Grant each reviewer Write. No reviewer under `agents/` holds it today, an agent's tool list cannot confine Write to one folder, and `~/.claude/CLAUDE.md` → "Working with the codebase" denies edits to a reviewer that only reads. Check whether a PreToolUse hook can tell a subagent's call from the worker's and deny a Write outside the scratchpad.
- **A wrapper.** A general-purpose subagent launches the reviewer, saves the report and returns only the summary lines. Claude Code's documentation says a subagent cannot start another; drop this route unless a test shows one can.
This risks goal 1.1: a worker fixing from a one-line summary can miss context it needs.
### 6. Move what `loop-claude` writes out of `~/.claude.json`, and ask the human about each write that must stay.
@@ -127,3 +160,36 @@ Claude Code owns that file and writes it. `trust` reads it, changes it and write
### 51. Hand loop-claude's terminal output to an injected effect, so no storage or retry function prints.
"Functional core, imperative shell", in `principles/technical-principles.md`: `archive`, `trust`, `retried`, the worker, `interrupt` and `model_choice` print to stderr themselves, and the tests swap the global stream.
### 50. Grant the bench's runs only the tools a review needs, in place of skipping every permission.
"Always grant explicit access to data", in `principles/technical-principles.md`: `workflow-bench/bench.py` starts claude with `--dangerously-skip-permissions`, and no rule confines it to a sandbox, so a run on the host reaches the host's credentials and other checkouts.
### 81. Have `workflow-bench/bench.py` return each run's failure as a value, so one failed clone does not hide the later runs' results.
"Errors as values", in `principles/technical-principles.md`, raised by the principles audit of PR #224: `bench.py` raises `KeyError` and `CalledProcessError`, and `pool.map` re-raises the first while the other threads run on unreported.
### 4. Name each chunk's archive folder by the chunk's start time, so `<key>/` lists chunks in the order they ran.
Today the folder is the SHA-256 of the transcript's first timestamped line, which tells the human nothing; that line carries the start time. Drop the fallback to the first line, which every chunk of a project shares, and give the tests' fake transcripts ISO timestamps. `bin/reading-cost` takes a chunk's id from the folder's first 12 characters and skips a chunk whose id `docs/reading-cost.md` holds, so give it a way to match a figure written under the old name.
### 52. Record why this checkout lives in Claude Code's own directory, or move it out and link it in.
"One owner per value" and "Prefer the vendor-neutral option", in `principles/technical-principles.md`: git, Claude Code and loop-claude all write `~/.claude`, kept apart only by the `.gitignore` allowlist, and the repo's records live in a vendor directory.
### 77. Teach `bin/metric-bench` Go and TypeScript, rerun it once two projects' comprehension histories name places, and bring into review only a metric that tracks the panel.
2026-10-08, lilleman: no metric enters review until a rerun on more data shows it tracking the panel.
Before the rerun, set the AUC and top-k lift over chance that count as tracking, from a published threshold, so the rerun ends in a decision. The rerun needs places from a project in Go or TypeScript, the languages most other projects use, so the bench first measures those languages, run through each project's own tooling. Function and file length stay warnings to look into, never limits: a plain long function can be simple, and a hard one may need five-line pieces.
On 2026-10-08 only this repo's history named places: five scoring runs, all that day. The medians:
| Metric | AUC | Top k |
|---|---|---|
| Cognitive complexity | 0.66 | 0.26 |
| Length | 0.74 | 0.18 |
| Shared state | constant | constant |
| Change spread | 0.67 | 0.18 |
AUC is 0.5 for a coin toss, and top k scores 0.10 by chance. Shared state cannot be judged here: every unit in `bin/` scores 0 on it. Every run's first place was a section of `skills/larv-review/SKILL.md`, which no code metric sees.
+1 -1
View File
@@ -16,7 +16,7 @@ Report: write it to `{report}`.
- Launch every agent in the foreground (`run_in_background: false`): background agents die when this headless turn ends.
- No remote and no forge: skip the PR, CI, the external auto-reviewer and the merge; review locally.
- Do not run the repo's test suites. A targeted probe is fine, in the repo's own container tooling.
- Skip the comprehension floor's scoring run; say so in the report.
- Skip the comprehension check; say so in the report.
- No human is reachable. Where the process names a no-human branch, take it; where it names none, take your recommendation and list the question in the report.
- Commit each round's fixes on `chunk`, messages prefixed `{case} - review: `. Touch nothing outside this repository except the report.