Launch a round's reviewers in up to three waves, each in one message #377

Merged
lilleman merged 2 commits from item-232 into main 2026-10-28 02:22:57 +01:00
4 changed files with 11 additions and 9 deletions
+1
View File
@@ -2,6 +2,7 @@
## Unreleased
- larv-review now launches a round's reviewers in up to three waves, each wave's reviewers in one message, in place of one reviewer at a time: first the architect, then the principles auditors with the security and overrides passes, then the stability, product-owner and prose passes. Each wave now lasts as long as its slowest reviewer, where a round used to last as long as all its reviewers one after another.
- loop-claude's worker, and every subagent it launches, now run with a 200k auto-compact window, handed as `CLAUDE_CODE_AUTO_COMPACT_WINDOW`: Claude Code compacts their context at about 170k tokens, where it used to let it grow to about 967k. loop-claude's judge no longer reads a compaction summary as words you typed. `CLAUDE.md` has a new section, "Compact instructions", saying what a summary keeps.
- On Linux, `run-heavy` now caps the memory of a container its command makes with `docker run` or `docker create`. A container that sets no limit gets a memory limit and a swap limit, both the slot's share: three quarters of the machine's memory, split across the heavy slots. A container that sets one of the two limits keeps it, and gets the other as large. This covers containers a project's own scripts start, which rule-hook can't see. A `docker compose` service, and a docker named by its full path, get no cap. rule-hook's `docker-run-memory` now lets a `docker run` under run-heavy pass.
- rule-hook has a new rule, `docker-run-memory`. It blocks a `docker run` or `docker create` that lacks a memory limit or a swap limit, such as `--memory 4g --memory-swap 4g`, sized to what the work needs. `--memory-swap -1`, unlimited swap, counts as none. `CLAUDE.md` asks for the same limits on a container a script or a compose file starts, which rule-hook can't see. rule-hook's `run-heavy` rule also now reads docker's `--tlscacert`, `--tlscert`, `--tlskey` and buildx's `--builder` as options that take a value, and reads `docker container run` as a run: `docker --tlscacert ca.pem build .` was not blocked outside run-heavy before.
+1 -1
View File
@@ -95,7 +95,7 @@ The trials: four stability rounds and five principles rounds archived on 2026-10
Quality. 19 chunks compacted between 2026-10-10 and 2026-10-22, at the compaction points Claude Code set then, 214k to 972k tokens. Per 100 worker messages they took a median 3.6 review rounds past each pass's first against 4.0 for the 68 uncompacted chunks of 100 messages or more, and 13.9 🔴 and 🟡 findings against 16.6. 4 of 19 had an unfinished verdict against 3 of 68, each 8 to 10 hours after the compaction and followed by a finished verdict within minutes; in those four verdicts the judge quoted the worker's own passages and the human's typed answers, never a summary. One cause was possible and is closed here: Claude Code writes the summary as a user entry, which `bin/claude_code/entries.py` read as the human's words, so the judge would see a `[human]` line of thousands of words and `/talk` would count it as typed; it now reads as Claude Code's. Whether compaction raises unfinished verdicts stays open until `todo.md` item 235 measures it. Two summaries read whole kept the chunk's intent, files, errors and next step in 12k to 20k characters, and the worker resumed without re-reading.
Hours. A chunk ran a median 0.7 hours from its first message to its last, one in ten past 12 hours, mostly waiting for the human or a usage limit. No option here changes that: a compaction takes 51 to 83 seconds, under a minute per chunk at 0.7 each, and a smaller context saves seconds per turn at most. The hours lever is `todo.md` item 232, since waiting on subagents took 66% of a worker's active time.
Hours. A chunk ran a median 0.7 hours from its first message to its last, one in ten past 12 hours, mostly waiting for the human or a usage limit. No option here changes that: a compaction takes 51 to 83 seconds, under a minute per chunk at 0.7 each, and a smaller context saves seconds per turn at most. Waiting on subagents took 66% of a worker's active time, so the hours lever is launching a round's reviewers together: larv-review §3 → "Waves" now launches each wave's reviewers in one message.
Valid while cache reads cost a twentieth of input and Claude Code's compaction keeps the worker's task.
+9 -3
View File
@@ -5,7 +5,7 @@ description: Ship a work chunk through review to a merged PR; decisions land in
# larv-review — ship the chunk, review until clean, gate green, merge
You orchestrate, fix, and ship; reviewers only report. Run every reviewer synchronously (`run_in_background: false`) and watch CI in the foreground: a headless run exits when the turn ends, and a background watcher dies with it. Never schedule a wakeup: a pending one keeps a headless run from exiting, so loop-claude neither runs its judge nor asks the human. The turn runs on until §6.
You orchestrate, fix, and ship; reviewers only report. Run every reviewer in the foreground (`run_in_background: false`), each wave's reviewers in one message (§3 → "Waves"), and watch CI in the foreground: a headless run exits when the turn ends, and a background watcher dies with it. Never schedule a wakeup: a pending one keeps a headless run from exiting, so loop-claude neither runs its judge nor asks the human. The turn runs on until §6.
**Forge-neutral.** Five PR operations recur below: read a PR's diff, open a draft PR, read check status, mark ready, merge. Resolve the tooling from the remote per `~/.claude/CLAUDE.md` → "Git, commits, and PRs"; on any other forge, achieve the same intents through its CLI or API — discover how rather than assuming. A forge without a native draft state gets the closest equivalent (a `WIP:`/`Draft:` title prefix); note any approximation in the summary.
@@ -41,7 +41,13 @@ A pass is one kind of review, a row of the table, named by its first column. Its
| 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 | changes prose a reader reads, such as docs, comments, help or error text, or the plan; 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.
A comment is prose, not code.
**Waves.** Launch a round's passes in up to three waves. Launch each wave's reviewers in one message: Agent calls in one message run together, so a wave lasts as long as its slowest reviewer. Start a wave only once every pass of the waves before it is done ("Round cap" → "Done"): line-level polish on code the architect wants restructured, or on a call the security pass will rewrite, is wasted work. Skip a wave none of whose passes runs.
1. Architecture.
2. Principles, every auditor, with Full scan or Security, and Overrides.
3. Stability, Product-owner and Prose.
Give a reviewer without Bash the branch diff and `git ls-files`'s output in its prompt: some harnesses grant it Read alone.
@@ -70,7 +76,7 @@ Give a reviewer without Bash the branch diff and `git ls-files`'s output in its
- **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. rule-hook refuses a round commit titled past round 3 unless its `round-cap` override quotes the yes.
**Re-entry.** A fix is a change no pass has seen. A fix for a 🟢, a ❓ or a prose finding reruns no pass, whatever it changes. A round's fixes for 🔴 and 🟡 findings re-enter together: run, in the pass table's order, every pass that a row below names for any of them, a done pass included, then §4. A pass at its cap gets "Round cap" → "Cap"'s ask instead.
**Re-entry.** A fix is a change no pass has seen. A fix for a 🟢, a ❓ or a prose finding reruns no pass, whatever it changes. A round's fixes for 🔴 and 🟡 findings re-enter together: run every pass that a row below names for any of them, a done pass included, in the waves of "Waves", then §4. A pass at its cap gets "Round cap" → "Cap"'s ask instead.
| The fix | Reruns |
|---------|--------|
-5
View File
@@ -12,7 +12,6 @@
| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 232 | 0.4.0 | | decision | **Launch a round's review passes in one message, except a pass that must wait for another's findings, so a round lasts about as long as its slowest reviewers, not their sum.** | 3 | 2 | 3 | 6 | 3 | 1.5 by 6 | 5.8 |
| 238 | 0.4.0 | | defect | **Run the security pass's skill in the chunk's worktree, so it scans the branch's diff: invoked from a subagent, it runs in the session's working directory, the main checkout, and scans nothing.** | 2 | 2 | 3 | 5 | 3 | 1.1 by 5 | 5.3 |
| 233 | 0.4.0 | | decision | **Run one principles-auditor per round that checks the goals and every principles file that applies, in place of one auditor for each, so the principles pass reads the project once per round.** | 3 | 2 | 3 | 6 | 3 | 1.4 by 3, 1.5 by 2 | 4.9 |
| 234 | 0.4.0 | | | **Report the routing figures in dollars, cache reads included, from the cost each archived run records.** | 2 | 2 | 2 | 4 | 3 | 1.4 by 3 | 3.0 |
@@ -80,10 +79,6 @@
## Details
### 232. Launch a round's review passes in one message, except a pass that must wait for another's findings, so a round lasts about as long as its slowest reviewers, not their sum.
Since 2026-10-21, all 1,372 Agent calls in workers' transcripts were one per message, 94% of them in the foreground, and waiting on subagents took 66% of a worker's active time. larv-review §3 orders the passes so no polish goes into code the architect restructures or the security pass rewrites. Keep that: a pass waits only for a pass whose findings could make its review a waste. Launch the rest of the round's passes, the principles auditors among them, in one message. Do the same for the passes a fix reruns, per §3 → "Re-entry".
### 238. Run the security pass's skill in the chunk's worktree, so it scans the branch's diff: invoked from a subagent, it runs in the session's working directory, the main checkout, and scans nothing.
Found while reviewing PR #376. larv-review §3 → "Security" launches a general-purpose subagent that invokes `/security-review` through the Skill tool. The skill runs its git commands in the session's working directory, the checkout root, where the branch's diff is empty, and the subagent then reads the worktree's diff itself, which the skill's own text forbids as a substitute. The archived security subagents of items 198 and 223 and of PR #376 all report it. It sits in 0.4.0 so the release's remaining chunks get a scan that reads their diff; until then larv-review §3 → "Security" says to run the skill in the worktree. A fix may run the skill as a process in the worktree from larv-review, or have the worker enter the worktree with Claude Code's `EnterWorktree` tool so every subagent runs there.