Have the worker enter the chunk's worktree before the security pass, so the skill scans the branch's diff #379

Merged
lilleman merged 2 commits from item-238 into main 2026-10-28 09:48:01 +01:00
4 changed files with 12 additions and 6 deletions
+1
View File
@@ -2,6 +2,7 @@
## Unreleased
- A session running larv-review now enters the chunk's worktree with `EnterWorktree` before the first review pass, so `/security-review` and the full scan read the branch's diff. Run from the checkout root, they used to find it empty.
- `loop-claude` now stops with exit 2 when the judge rules one chunk unfinished 6 cycles running, so a worker and a judge that disagree can no longer cycle unattended without end. Rerunning resumes the chunk and gives it 6 more cycles.
- 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.
+8
View File
@@ -867,3 +867,11 @@ Read most (opens and searches):
## Reading cost, chunk e94dd7a98ff8, finished 2026-10-23T12:59:22Z
71809 new input tokens before the first commit.
## Reading cost, chunk 53a20666ad09, finished 2026-10-28T08:42:33Z
141210 new input tokens before the first commit.
Read most (opens and searches):
- `bin/transcript_archive/outcomes.py` 1
+3 -1
View File
@@ -24,6 +24,8 @@ The bar a chunk is reviewed to: ~/.claude/skills/larv-review/standards/quality.m
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.
**Work in the worktree.** Enter the chunk's worktree with the `EnterWorktree` tool, `path` set to it, unless the session already works there. A reviewer, a seat and the security pass's skill read the diff of the session's working directory, and a subagent starts there; from the checkout root they find the branch's diff empty.
**Reading cost.** Run `~/.claude/bin/reading-cost` in the chunk's worktree, unless loop-claude's prompt shows that `chunk-preflight` already ran it there, 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 a chunk reads most before its first commit.**`, scored per `~/.claude/rules/todo-items.md` 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
@@ -142,7 +144,7 @@ The comprehension check records how hard the project is for its contributor to r
### Security
`/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. The skill runs in the session's working directory, so where the chunk's worktree is another directory, run `claude -p /security-review` in the worktree on the project's rung instead (`todo.md` item 238 fixes the launch). Invoked in your own context, the skill ends your turn on that report. Open its prompt, and that of any subagent that runs the full scan, with `You are the security pass for this chunk.`: rule-hook reads that sentence as a security launch.
`/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. Open this subagent's prompt, and that of any subagent that runs the full scan, with `You are the security pass for this chunk.`: rule-hook reads that sentence as a security launch.
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.
-5
View File
@@ -12,7 +12,6 @@
| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 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 |
| 239 | 0.4.0 | | owner | **Block a Read, `cat`, `sed` or `head` of a file range already in the session's context, with a note saying so, and let it through once a compaction dropped the range or the file changed.** | 3 | 2 | 3 | 6 | 4 | 1.4 by 3 | 2.0 |
@@ -78,10 +77,6 @@
## Details
### 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.
### 233. 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.
Since 2026-10-21, 342 principles-auditor runs, 3.8 per chunk, cost $274 at list prices, 23% of all spend: $129 of 5-minute cache writes, $92 of output and $53 of cache reads. Each read the project anew. Today larv-review §3 → "Principles" launches one auditor for the README's goals and code health, and one per file in `~/.claude/principles/` that applies. The merged auditor must find what the separate ones found: replay archived rounds with `review-replay`, and keep separate auditors where the merged one misses a 🔴 or 🟡. Rename the report files, `principles-<yardstick>-round-<n>.md` today (§3 → "Reports"), to one per round.