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

This commit is contained in:
2026-10-28 09:43:39 +01:00
parent ecff799cb6
commit 44974bcd02
4 changed files with 10 additions and 6 deletions
+1
View File
@@ -2,6 +2,7 @@
## Unreleased
- larv-review's skill now has the worker enter the chunk's worktree with `EnterWorktree` before its first pass, so the security pass's `/security-review` and the full scan read the branch's diff. Launched from the checkout root, they used to find an empty one.
- `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
+1 -1
View File
@@ -142,7 +142,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. The skill, like the full scan, reads the diff of the session's working directory, and a subagent starts there. So before the first pass, enter the chunk's worktree with the `EnterWorktree` tool, `path` set to it, unless the session already works there. 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.
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.