Plan the rebuild of loop-claude and the review process on the rebuild branch #92

Merged
lilleman merged 2 commits from plan-rebuild into main 2026-09-28 10:27:21 +02:00
3 changed files with 43 additions and 14 deletions
+7
View File
@@ -1,5 +1,7 @@
# Working here
**⚠️ THE REBUILD NEVER MERGES INTO MAIN WITHOUT THE HUMAN'S EXPLICIT APPROVAL.** Every rebuild chunk is a worktree based on `origin/rebuild` with its PR into `rebuild`, never into main. Other sessions run on `~/.claude` main throughout; only the human merges `rebuild` into main, once they have approved the finished whole. larv-review leaves a PR from `rebuild` into main ready and unmerged.
Decisions live in `docs/decisions.md`:
- larv-review: a project under the comprehension floor is fixed at the capping dimension
@@ -17,3 +19,8 @@ Decisions live in `docs/decisions.md`:
- loop-claude: a reload into an older file is unsupported
- loop-claude: a CR-only README.md is reported at line 1
- loop-claude: each project's model lives in loop-claude's own file
- rebuild: loop-claude and the review process are rebuilt on `rebuild` and merge to main whole
- review: the round cap counts a pass's runs per chunk
- loop-claude: the judge is retried alone, on its own counter
- loop-claude: the judge loads `CLAUDE.md`
- loop-claude: the archive keeps the raw transcript, and a failed archive stops the loop
+22 -2
View File
@@ -34,7 +34,7 @@
## 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. The 2026-09-28 run, Junior A, Mid A, the maintainability senior and the inherited architect at depth 1 over every non-test file, blind to `todo.md` and this log, scored Navigation 7.25, Locality 6.0, Shape 6.5, Self-sufficiency 6.25, overall 6.25; on 2026-09-26 they were 7.75, 6.25, 7.0, 6.75, 6.75. Every seat scored Locality 6, and three of four named `run_cycle`'s three-way return and larv-review's re-entry rules, split across the passes on 2026-09-28. The places named sit in `todo.md` under 0.1.0, and a later chunk may not lower any dimension. Valid until the next scoring run, which uses the same four seats.
2026-09-27, lilleman, restating the 2026-09-24 target and extending it to the overall. Serves goal 4. The 2026-09-28 run, Junior A, Mid A, the maintainability senior and the inherited architect at depth 1 over every non-test file, blind to `todo.md` and this log, scored Navigation 7.25, Locality 6.0, Shape 6.5, Self-sufficiency 6.25, overall 6.25; on 2026-09-26 they were 7.75, 6.25, 7.0, 6.75, 6.75. Every seat scored Locality 6, and three of four named `run_cycle`'s three-way return and larv-review's re-entry rules, split across the passes on 2026-09-28. The rebuild planned in `todo.md` under 0.1.0 answers the places named, and a later chunk may not lower any dimension. Valid until the next scoring run, which uses the same four seats.
## loop-claude: the five section headers stay
@@ -46,7 +46,7 @@
## larv-review: a re-entered loop takes a fresh round cap
2026-09-24, larv-review. Serves goal 4. The cap stops a loop that does not converge on one set of findings; a re-entry is a new set. A cap shared across the whole flow would skip §6.5's closing round exactly when §5 ran long. Valid while the protocol caps rounds per loop.
2026-09-24, larv-review. Serves goal 4. The cap stops a loop that does not converge on one set of findings; a re-entry is a new set. A cap shared across the whole flow would skip §6.5's closing round exactly when §5 ran long. Valid until the rebuild merges; superseded then by "review: the round cap counts a pass's runs per chunk".
## loop-claude: a reload into an older file is unsupported
@@ -59,3 +59,23 @@
## loop-claude: each project's model lives in loop-claude's own file
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. Valid while Claude Code keeps rewriting the settings' model from inside a session.
## rebuild: loop-claude and the review process are rebuilt on `rebuild` and merge to main whole
2026-09-28, lilleman. Serves goal 4. Three scoring runs held Locality at 6 while about thirty chunks fixed the places the seats named, and two blind judges scored main's loop-claude 5 and its review process 4 against 7 for sketches designed from the target result. Other sessions run on `~/.claude` main throughout, so every rebuild chunk merges into `rebuild`, never main, and `rebuild` reaches main only when it passes the comprehension floor and **the human has explicitly approved the whole and merges it themselves**. Valid until the rebuild merges.
## review: the round cap counts a pass's runs per chunk
2026-09-28, lilleman, for the rebuild. Serves goal 4. A pass runs at most three times per chunk, re-entries included, and a fourth run asks the human; one counter, and no fix bounces between two passes without end. Valid while one human answers the ask.
## loop-claude: the judge is retried alone, on its own counter
2026-09-28, lilleman, for the rebuild. Serves goal 4. A failed verdict reruns the judge on the same transcript; rerunning the worker would spend a worker run on a judge's fault. Valid while a judge run costs far less than a worker run.
## loop-claude: the judge loads `CLAUDE.md`
2026-09-28, lilleman, for the rebuild. Serves goal 4. The judge rules on chunks, releases and premises, which `CLAUDE.md` → "Vocabulary" and "Working loop" define; `--bare` would leave it the prompt's words alone. Valid while those definitions live in `CLAUDE.md`.
## loop-claude: the archive keeps the raw transcript, and a failed archive stops the loop
2026-09-28, lilleman, for the rebuild. Serves goal 2. A copy of the `.jsonl`, deduplicated by content hash, with the verdict beside it; a rendering drops tool results, and a second-resolution stamp collapses two states. 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.
+14 -12
View File
@@ -2,16 +2,18 @@
## 0.1.0
Ships when a four-seat scoring run puts every dimension and the overall at 7.0 or above (`docs/decisions.md`). Ordered by the dimension each item lifts, lowest first, per the 2026-09-28 panel; each is one chunk.
**⚠️ THE REBUILD NEVER MERGES INTO MAIN WITHOUT THE HUMAN'S EXPLICIT APPROVAL.** Every rebuild chunk is a worktree based on `origin/rebuild` with its PR into `rebuild`, never into main. Other sessions run on `~/.claude` main throughout; only the human merges `rebuild` into main, once they have approved the finished whole.
- **Give `loop-claude` one failure channel, so `run_loop` reads `run_cycle`'s result without decoding it.** Four seats: today `run_cycle` (`bin/loop-claude:141`) returns a `Stop`, a failure string or `""`, `replace_json` an `OSError` or `None`, and `strike` (`:134`) sleeps under a name that hides it.
- **State larv-review's re-entry rules in one place a fix's path reads from.** Three seats drew the graph by hand from `skills/larv-review/SKILL.md:8`, `:46`, `:63`, `:85`, `:91`, `:112` and `:122`; the 2026-09-28 split into the passes is what they read.
- **Make the model resolution one unit, so `project_model` returns no sentinel `model_args` must know.** Three seats: `project_model` (`bin/loop-claude:297`) returns `""` when both env vars are set, safe only because `model_args` (`:246`) prefers the env var.
- **Validate the reload state without relying on `field.type` being a real type.** Three seats: `loop_state` (`bin/loop-claude:274`) breaks on `from __future__ import annotations`, and nothing marks it.
- **State the session lifecycle where the session id is made.** Two seats assembled it from `run_loop:126`, `session_open`, `worker_args` and `delete_transcript_files`: finishing deletes the transcript, so the fixed id starts fresh.
- **Say in `typed` (`bin/loop-claude:415`) what each dropped entry kind is in Claude Code.** Three seats trusted the clauses without understanding them; the architect's least-want-to-modify, and `interruption` reads as the loop's interrupt.
- **Make the reviewer agents agree with larv-review and `CLAUDE.md` on who writes docs and where decisions go.** `agents/product-owner-reviewer.md:27` and `agents/systems-architect.md:103` have the agent update the README, against larv-review's "reviewers only report"; `agents/systems-architect.md:111` and `:217` put decisions and the glossary in the README, against `docs/decisions.md` and `CLAUDE.md` → "Vocabulary".
- **Name `loop-claude`'s helpers for what they do.** Four seats: `typed`, `said`, `strike`, `chosen`, `handed`.
- **Head `bin/loop-claude:95-251` by job.** Two seats: thirteen functions of loop control, README parsing, archiving and I/O sit under no header, and the worker and the interrupt sit under headers for the file they touch (`:429`, `:534`), which the five-headers decision keeps.
- **Place `principles/review-protocol.md` where `agents/stability-reviewer.md:12` stops listing the principles files as code rules.** The architect: the protocol is the review process's contract, and the list at `:12` omits it.
- **Rerun the four-seat panel and score every dimension and the overall at 7.0 or above.** A dimension under it gets its places filed above, and this item stays last.
Ships when a four-seat scoring run puts every dimension and the overall at 7.0 or above (`docs/decisions.md`). The rebuild lifts every dimension: each item below is one chunk on a worktree based on `origin/rebuild`, its PR into `rebuild`, until the last item merges `rebuild` into main. The sketches, the judges' verdicts and what to take from each: `~/code/claude-handoffs/claude-config_2026-09-28.md`.
- **Pin loop-claude's behaviour in black-box tests that pass against main's script.** Run `bin/loop-claude` as a subprocess with a fake `claude` on `PATH` and temporary `HOME` and checkout: premises refusals, exit codes, the worker's and the judge's three strikes, an ungrounded verdict, the interrupt off a terminal, the session resumed while unfinished and fresh after finishing, the models file and `~/.claude.json` rewritten with their modes, the reload at a cycle boundary.
- **Lay out `bin/loop-claude` as a launcher over a `bin/loop_claude/` package, with the loop, checkout and premises moved in.** The launcher resolves its own symlink, injects `Paths` and the environment, and is the only thing that exits; `main` owns the loop state, carries it across a reload on argv, and maps `Stop | Retry | Continue`. The black-box tests pass unchanged.
- **Move the transcript, the session and the worker into their own modules.** `UserEntryKind` names each entry Claude Code writes; a malformed line is skipped; an unreadable transcript is its own error, never "typed nothing"; `session` states the lifecycle once, where the id is made.
- **Move the judge, the interrupt, trust and model resolution into their own modules.** The judge is retried alone and checks evidence on every verdict against the rendered transcript; `models` owns the whole resolution, env overrides included, with no sentinel; `trust` names a `projects` entry that is not an object; `input()` at end of file is exit 2.
- **Archive the raw transcript, deduplicated by content hash, with the verdict beside it, and stop on a failed archive.** Tests first; the changelog line says what the archive now holds.
- **Replace `bin/test_loop_claude.py`'s internal-function tests with the black-box tests plus unit tests of the pure parsers.**
- **Hold every reviewer to one findings document, `principles/review-findings.md`.** Severity, verdict, rounds with round 2 verifying each earlier finding, the per-chunk round cap, declining, and `/security-review`'s HIGH/MEDIUM/LOW mapped onto the scale; it replaces `principles/review-protocol.md`.
- **Rewrite larv-review around one pass table and one re-entry rule.** A trigger per pass, each stated only there; the re-entry paragraph classifies a fix by the widest thing it touches; forge neutrality, the draft PR, CI watched in the foreground, the comprehension floor, the auto-reviewer's waits and the goal-alignment check carried over.
- **Make the three reviewer agents pure reporters in the findings document's vocabulary.** Keep their names and checklists; remove every README- and decision-writing duty and every private severity or verdict scale.
- **Bring `CLAUDE.md` → "Vocabulary", the README and `docs/decisions.md` in line with the rebuild.** Trigger covers every pass, round cap counts per chunk, "looping reviewer" goes if the rule no longer needs it; superseded decisions leave the log.
- **Score `rebuild` with the four-seat panel at 7.0 or above on every dimension and the overall, none below the 2026-09-28 run, and open its PR into main for the human.** ⚠️ Leave that PR ready and unmerged: only the human merges it, after approving the whole rebuild. A dimension under the floor gets its places filed above this item. Before merging, a loop running main's script reloads into the new one at its next cycle boundary: accept main's `--reloaded` state, or say in the changelog that running loops stop once.