Move the reviewer protocol into agents/review-protocol.md
This commit is contained in:
+14
-23
@@ -9,7 +9,7 @@ You orchestrate, fix, and ship; the reviewer agents only report. Run every revie
|
||||
|
||||
**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 the global git rules (`gh` on GitHub, `tea` on Gitea); 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.
|
||||
|
||||
**Declining a finding** (every reviewer below, and the external one in §10). A 🔴 is not declinable: fix it, or show it is factually wrong. Anything less you may decline yourself where your reason is sound and sits consistently with the repo's stated goals, and your confidence is very high; the decline, its reason and the goals it rests on go to the decision log (`docs/decisions.md`). A reason that contradicts a goal, or that no goal speaks to and you are not confident in, is a gap in the goals rather than a judgment call — so propose the goal or rule that would settle this whole class of finding, show what falls out of it for this instance, and take the human's answer; or simply fix the finding. Never a silent drop, and never a decline argued from convenience or from the size of the fix.
|
||||
Verdicts, severities, round caps, declining a finding and where decisions are recorded: ~/.claude/agents/review-protocol.md. It binds every reviewer below, the external one in §10 included.
|
||||
|
||||
## 0. Preconditions
|
||||
|
||||
@@ -54,7 +54,7 @@ Launch **systems-architect**: review the system as a whole entered through this
|
||||
- **Stage 0 questions returned** (goals/audience/horizon unrecorded): relay them to the user, record the answers where the agent expects them (README), re-run once. No user → skip the pass, carry the questions into the summary.
|
||||
- **BLOCK** → the restructure precedes everything below. Confirm with the user first when it materially reshapes their PR; apply it; re-run systems-architect once, scoped to verifying its own findings. Still BLOCK → stop and report: `needs input`.
|
||||
- **ALIGN** → apply what is cheap now; ask the user about the rest — each item becomes a fix, a ticket, or a documented decision, never a silent drop.
|
||||
- **APPROVE** → proceed.
|
||||
- **APPROVE** / **APPROVE WITH NITS** → proceed; nits per the protocol's rounds.
|
||||
|
||||
It does not re-run for what the loops below change: nothing a security, stability or consumer-experience fix decides is architectural. A fix that fires a §2 signal of its own — a new dependency, a new module, a moved boundary — re-gates at §2 and runs the pass once more.
|
||||
|
||||
@@ -63,8 +63,8 @@ It does not re-run for what the loops below change: nothing a security, stabilit
|
||||
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.
|
||||
|
||||
- **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 decline rule above.
|
||||
- **LOW** → treat as a nit (§5's rule).
|
||||
- **MEDIUM** → fix in this chunk, under the protocol's decline rule.
|
||||
- **LOW** → treat as a 🟢.
|
||||
- A **MEDIUM or LOW** outside this chunk's scope → a `todo.md` item at the top under `## Security`, naming the exposure and the path it reaches, per the global todo rules. Say whether it is in this chunk's blast radius; filing it is not fixing it.
|
||||
|
||||
A fix made later in the flow re-runs this pass over that change where it opens a new untrusted-input boundary, or touches authn/authz, secrets or crypto.
|
||||
@@ -73,21 +73,20 @@ A fix made later in the flow re-runs this pass over that change where it opens a
|
||||
|
||||
**Do not over-read a clean result.** This pass is single-repo and static: it does not trace authorization across services, does not run the application, and deliberately excludes dependency CVEs in third-party libraries — Renovate/Dependabot owns those, per the global pinning rules. Never point an automated reviewer or scan at an untrusted fork's PR content; a PR body is untrusted input to it (CVE-2025-59536, CVE-2026-21852).
|
||||
|
||||
## 5. Stability loop (max 3 rounds)
|
||||
## 5. Stability loop
|
||||
|
||||
1. Launch **stability-reviewer**. From round 2 on, its prompt includes: the previous round's findings verbatim, what changed since, and "verify each previously-reported 🔴 and 🟡 is resolved before the fresh pass".
|
||||
2. Fix every 🔴 **and every 🟡** along its Fix guidance (delete > simplify > modify > add). Keep test changes and implementation changes separately reviewable.
|
||||
3. **Exit when no 🔴 and no 🟡 remain.** The remaining 🟢 nits and ❓ questions are then addressed in that same final round — fixed, answered, or recorded — and do **not** trigger another round; §9's gate verifies what they changed. Leaving one unfixed is a decline only where the rule above allows it; otherwise it is filed as a `todo.md` item, never silently dropped. A "nit" whose fix changes behaviour is not a nit: it is a fresh finding, and it re-enters the loop as one of the three rounds.
|
||||
4. Commit and push each round's fixes so CI feedback accumulates while the loop runs.
|
||||
5. Carry any 🔀 product-owner escalation into §6. Round 3 still holding a 🔴 or 🟡 → stop and list what is open: `needs input`. (A 🟡 you are confident the goals settle is declined per the rule above, not carried.)
|
||||
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.
|
||||
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)
|
||||
|
||||
A 🔀 product-owner-reviewer escalation from any pass above is an instruction, not a suggestion: run it. Nothing escalated and no external surface changed → 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. From round 2 on, its prompt carries the previous round's findings verbatim and what changed since.
|
||||
2. Apply what it asks for, under the decline rule above. 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.
|
||||
3. Commit and push each round. Exit on no 🔴 and no 🟡, nits addressed in that round under §5.3's rule; max 3 rounds. Still holding one at round 3 → stop, list what is open: `needs input`.
|
||||
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 decline rule. 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.
|
||||
3. Commit and push each round; it exits and caps per the protocol.
|
||||
4. Approved having changed nothing → you are done here; there is nothing to re-verify.
|
||||
5. Otherwise close with one **stability-reviewer** round over what this loop changed, prompted with that scope and why it changed. 🔴 or 🟡 → back into §5 for those findings, then this step again. Architecture (§3) and security (§4) do not re-run for the consumer-experience change itself; a fix made here that fires a signal of its own — a new dependency, a moved boundary, a new untrusted input — re-gates there as any other change would.
|
||||
|
||||
@@ -111,14 +110,7 @@ When §2's gate says the architecture pass is warranted, this pass widens with i
|
||||
|
||||
## 8. The repo carries the state
|
||||
|
||||
Reviews converge only because decisions live where the reviewers already look — never in chat history or agent memory:
|
||||
|
||||
- **`docs/decisions.md`** — every standing decision, the ones this review settles included: accepted risks, declined findings, rejected alternatives. Format and indexing per the global documentation rules.
|
||||
- **AGENTS.md** — reviewer- and contributor-facing conventions (how to work in this repo), plus the decision log's one-line index.
|
||||
- **README** — the project's goals and audience (global working loop) and the rest of the Stage 0 artifacts (scale & horizon, glossary).
|
||||
- **Code comment** — a single-site footgun or invariant, per the comment rules (a WHY the code cannot show).
|
||||
|
||||
Record only decisions the user actually made, plus the declines you made under the rule above. Reviewer ❓ questions the user answers get recorded the same way — an unrecorded answer gets asked again next review.
|
||||
Reviews converge only because decisions live where the reviewers already look: the protocol's "Documenting decisions" says where.
|
||||
|
||||
## 9. Green gate, PR ready
|
||||
|
||||
@@ -133,8 +125,7 @@ Marking the PR ready is what summons CodeRabbit and its kind, so this follows §
|
||||
|
||||
- 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 same decline rule as every reviewer above — it has no more authority than they do, and no less. Fix → commit → push, then wait up to **5 minutes** for its re-review of the new commit.
|
||||
- Max 3 rounds. Still unresolved → stop and list what is open: `needs input`.
|
||||
- Its findings follow the protocol like every reviewer above — no more authority, and no less. Fix → commit → push, then wait up to **5 minutes** for its re-review of the new commit.
|
||||
|
||||
## 11. Goal alignment, then merge
|
||||
|
||||
|
||||
Reference in New Issue
Block a user