Split larv-review's re-entry rules into the passes they re-enter #83

Merged
lilleman merged 2 commits from split-reentry into main 2026-09-28 00:36:14 +02:00
2 changed files with 17 additions and 26 deletions
+16 -25
View File
@@ -5,17 +5,17 @@ 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; the reviewer agents only report. Run every reviewer synchronously (`run_in_background: false`) — each step depends on the previous result. Watch CI in the foreground too: a headless run exits when the turn ends, and a background watcher or a scheduled wakeup dies with it. A reviewer's report is input to the next step; the turn runs on until §12. Architecture strictly before security, security before stability: line-level polish on code the architect wants restructured, or on a call the security pass will rewrite, is wasted work.
You orchestrate, fix, and ship; the reviewer agents only report. Run every reviewer synchronously (`run_in_background: false`) — each step depends on the previous result. Watch CI in the foreground too: a headless run exits when the turn ends, and a background watcher or a scheduled wakeup dies with it. A reviewer's report is input to the next step; the turn runs on until §11. Architecture strictly before security, security before stability: line-level polish on code the architect wants restructured, or on a call the security pass will rewrite, is wasted work. A fix made in any pass is a change the passes before it in this order never saw; a pass it re-enters says so, and a re-entry is a new loop with its own round cap.
**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.
Words: `~/.claude/CLAUDE.md` → "Vocabulary". Verdicts, severities, round caps, declining a finding and where decisions are recorded: ~/.claude/principles/review-protocol.md. Its Declining section also binds `/security-review` and the external reviewer in §10.
Words: `~/.claude/CLAUDE.md` → "Vocabulary". Verdicts, severities, round caps, declining a finding and where decisions are recorded: ~/.claude/principles/review-protocol.md. Its Declining section also binds `/security-review` and the external reviewer in §9.
## 0. Preconditions
- Not a git repo → say so and stop.
- Someone else's PR, or the user asked for opinions only → single stability pass, report findings, done (skip shipping, fixing, the loops and the merge).
- Prose only — markdown, docs, comments, no code — → the reviewer loops add nothing: ship the branch (§1), the prose pass (§8), green gate (§9), merge (§11). Say so in the summary. Prose an outside reader lands on — public API docs, README, CHANGELOG, error or deprecation text — still takes §6's product-owner pass.
- Prose only — markdown, docs, comments, no code — → the reviewer loops add nothing: ship the branch (§1), the prose pass (§7), green gate (§8), merge (§10). Say so in the summary. Prose an outside reader lands on — public API docs, README, CHANGELOG, error or deprecation text — still takes §6's product-owner pass.
- Issue trackers are project-specific — the project's own docs say whether it has one. When it does and the work has a ticket, follow that tracker's conventions for assignment and status.
- **Premises first**, per `~/.claude/CLAUDE.md` → "Working loop". Missing, or too vague to settle a decision → this chunk cannot be judged: stop, say so, and write them with the user as the chunk instead. That chunk's whole review is the human's approval, since a reviewer's findings on it could only be declined by citing the goals it exists to write; a later change to a goal takes the full review. Only what that section lets through without them reaches review.
@@ -43,7 +43,7 @@ Otherwise, any one of these is grounds for the pass:
- diff > ~400 non-generated lines, or touching > ~5 modules
- a previous stability round escalated to systems-architect
No signal fires → skip it, say so in the summary, don't ask. A signal fires with no record behind it → ask the user (AskUserQuestion) with the evidence and your recommendation. No user reachable → run the pass.
No signal fires → skip it, say so in the summary, don't ask. A signal fires with no record behind it → ask the user (AskUserQuestion) with the evidence and your recommendation. No user reachable → run the pass. A fix made in any pass after §3 takes this trigger again on what it changed.
## 3. Architecture pass (when warranted)
@@ -60,7 +60,7 @@ Invoke the `comprehension-panel` skill's scoring run (`~/.claude/skills/comprehe
## 4. Security pass (whenever the chunk changed anything but test code)
Run the built-in **`/security-review`** skill over the branch diff. It is the pass of record here: its value is a tuned exclusion list and a ≥0.8 confidence floor, which a hand-written reviewer would reproduce worse.
Run the built-in **`/security-review`** skill over the branch diff. It is the pass of record here: its value is a tuned exclusion list and a ≥0.8 confidence floor, which a hand-written reviewer would reproduce worse. A fix made in any pass after it re-enters it only where it opens a new untrusted-input boundary or touches authn/authz, secrets or crypto.
- **HIGH** → verify it is real, then fix it before this chunk ships: inside this chunk's blast radius it is fixed here, outside it on its own branch and PR with this chunk waiting behind it. Say which. A verified HIGH is never filed for later and never put to the human as a question. Verification showing it is not real is no decline but a disproof — record what disproved it, since a finding that is factually wrong needs no goal to reject.
- **MEDIUM** → fix in this chunk, under the protocol's Declining section.
@@ -73,14 +73,16 @@ Run the built-in **`/security-review`** skill over the branch diff. It is the pa
## 5. Stability loop
A fix sent back here opens its loop with a round prompted with the fix's scope and why it changed.
1. Launch **stability-reviewer**, prompted per the protocol's rounds.
2. Fix every 🔴 **and every 🟡** along its Fix guidance (delete > simplify > modify > add). Keep test changes and implementation changes separately reviewable. §9's gate verifies what the final round's nits changed.
2. Fix every 🔴 **and every 🟡** along its Fix guidance (delete > simplify > modify > add). Keep test changes and implementation changes separately reviewable. §8's gate verifies what the final round's nits changed.
3. Commit and push each round's fixes so CI feedback accumulates while the loop runs.
4. Carry any 🔀 product-owner escalation into §6.
## 6. Product-owner loop (when a reviewer escalates to it)
## 6. Product-owner loop (when escalated to, or an external surface changed)
A 🔀 product-owner-reviewer escalation from any pass above runs it. Nothing escalated and no external surface changed → skip it, say so in the summary.
A 🔀 product-owner-reviewer escalation from any pass runs it, and so does a change to an external surface, a fix from any pass after it included. Neither → skip it, say so in the summary.
1. Launch **product-owner-reviewer** with the change and the external surface it touches — API, CLI, UI, error and deprecation text a consumer reads, README and docs an outside reader lands on — prompted per the protocol's rounds.
2. Apply what it asks for, under the protocol's Declining section. Its findings are about the consumer's experience (wording, discoverability, upgrade path, the edge case a persona hits), so the fix is as often a message or a doc as it is code.
@@ -88,18 +90,7 @@ A 🔀 product-owner-reviewer escalation from any pass above runs it. Nothing es
4. Approved having changed nothing → you are done here; there is nothing to re-verify.
5. Otherwise re-enter §5 over what this loop changed.
## 7. Re-entry
A fix made in any pass is a change the passes before it never saw. It re-enters:
- §3 only where it fires a §2 signal of its own.
- §4 only where it opens a new untrusted-input boundary or touches authn/authz, secrets or crypto.
- §5 where §6.5 or §9 sends it there, prompted with the fix's scope and why it changed.
- §6 where it changed an external surface or a reviewer escalated 🔀 to it, as at first entry.
A re-entry is a new loop with its own round cap.
## 8. Prose pass (every chunk)
## 7. Prose pass (every chunk)
Two scopes:
@@ -115,22 +106,22 @@ The bar is `~/.claude/CLAUDE.md` → "Comments and documentation"; per paragraph
When §2's trigger says the architecture pass is warranted, this pass widens with it: the fresh-context agent reads every prose file the repo owns rather than only the cited sections. That is the only sweep that catches accretion, since no diff shows a file that grew a paragraph per chunk.
## 9. Green gate, PR ready
## 8. Green gate, PR ready
- Run the project's test suite locally unless the final stability round already left it verified green; fix, commit, push.
- Watch the forge's checks until every one passes. A red check is a finding: fix → commit → push → watch again. A CI fix that changes behavior (not config or a flake) re-enters §5.
- No CI configured → the gate is local tests only; note it in the summary (a missing merge gate on a production-horizon project is architect-finding material).
- Everything green → mark the PR ready, dropping any `WIP:`/`Draft:` title prefix.
## 10. External auto-reviewer (when the repo has one)
## 9. External auto-reviewer (when the repo has one)
Marking the PR ready is what summons CodeRabbit and its kind, so this follows §9.
Marking the PR ready is what summons CodeRabbit and its kind, so this follows §8.
- Detect one from the repo — a reviewer's config file (`.coderabbit.yaml` and the like), or its comments on the repo's earlier PRs. None found → skip, say so.
- Wait up to **10 minutes** for its first review, checking about once a minute. Nothing by then → note it in the summary and carry on; a reviewer that arrives later is read the next time anyone visits the PR, never waited on twice.
- Its findings follow the protocol like every reviewer above — no more authority, and no less; anything it marks blocking is a 🔴. Fix → commit → push, then wait up to **5 minutes** for its re-review of the new commit.
## 11. Goal alignment, then merge
## 10. Goal alignment, then merge
1. Read the finished PR against the README goals: does anything in it work against one? Misaligned → do not merge; ask the human, stating the conflict.
2. The item ships into a release later than one that is finished and uncut → leave the PR ready and unmerged; tell the human that release is ready to cut.
@@ -138,6 +129,6 @@ Marking the PR ready is what summons CodeRabbit and its kind, so this follows §
4. Merged → tick the item off `todo.md` per `~/.claude/CLAUDE.md` → "Working loop". Ticking it off emptied its release → the summary says the release is ready to cut.
5. Stop. The next chunk gets a fresh session. A release is the human's — prepare it, never cut it.
## 12. Wrap up
## 11. Wrap up
Summarize: PR URL and final state, every reviewer's verdict, rounds used per loop, findings fixed vs declined vs open — each decline with the goal it rests on — CI status, decisions recorded (file paths), `todo.md`/`CHANGELOG.md` updated, and any 🔀 escalation left for the user.
+1 -1
View File
@@ -6,7 +6,6 @@ Ships when a four-seat scoring run puts every dimension and the overall at 7.0 o
Shape, 7.0:
- **Split `larv-review` §7 so a fix's re-entry reads without the whole skill open.**
- **Keep the fits-in-a-head thresholds in one place in `agents/systems-architect.md`.** Today four.
Then:
@@ -16,4 +15,5 @@ Then:
- **Scope `JUDGE_RULES`' "The question must be one the agent itself raised" to the rules where the agent raises one.** Today it contradicts the assumption, release and alternatives rules. Drop "A sensible preference is not a derivation" too.
- **Define chunk in `loop-claude --help` beside cycle, interrupt and premises.** Name it in the vocabulary decision too.
- **Close every file `bin/loop-claude` and `bin/test_loop_claude.py` open, so the suite runs without a ResourceWarning.**
- **Route an external auto-reviewer's behaviour-changing fix in `larv-review` §9 back through §5.** Today nothing sends it there.
- **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.