You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Comparison against nWave-ai/nWave's review agents and skills. Their reviewers are uniformly small (~600–1400 words), all on haiku, with criteria factored into shared *-critique-dimensions / *-review-criteria skills. Ours are already mostly haiku (21 of 29 agents/*review*.md), so model routing is not the gap. Three structural differences are.
1. A countable pass gates the qualitative pass. Every nWave reviewer runs Phase 2 as pure arithmetic — count behaviors from AC, budget = 2 × behaviors, count actual tests, check gates G1–G9, diff RED-vs-GREEN test files — before Phase 3 judgment. A Phase-2 blocker aborts Phase 3 outright ("G9 violation = instant REJECTED, no other review dimensions matter"). Arithmetic is model-independent and short-circuits the expensive reading. Our heavy lenses (correctness-review opus/2.6k words, test-review 2.2k + 6 cited knowledge files, test-smell-review 2.2k, security-review opus/1.7k) load everything and judge everything in one pass, with no cheap-first abort inside the agent.
2. Review is a gate between steps, not a terminal event, and approvals persist.*deliver runs 9 phases; each artifact (baseline, roadmap, each step file, each TDD step) is reviewed at creation by a single scoped reviewer — 3+3N reviews per feature — sequential, verdict-gated (APPROVED/NEEDS_REVISION/REJECTED), max 2 retries, stop-on-failure. .deliver-progress.json carries validation.status, so re-invocation skips anything already approved and resumes at the failure point.
We already have most of the gating half: /build has complexity-scaled checkpoints (sub-step 4 per-step for complex, sub-step 6 batched at slice boundary), cheap-first lens ordering, narrowed verification-mode payloads, and a 5-iteration fix loop; plan-review-* and spec-compliance-review criteria mode gate before code exists. What we lack is the persistence. hooks/agent_dispatch_ledger.py records that a lens fired, bound to a subject_hash — knowledge/telemetry-schema.md explicitly documents the record decision as "non-verdict, observational". So a second /code-review re-runs every selected lens over every target file from scratch, and /build's Step 6 backstop re-reviews files already cleared at sub-steps 4/6 — --backstop-review=skip is the only lever and it is all-or-nothing.
3. Output-side tiering.nw-density-resolution-contract emits Tier-1 [REF] sections always and Tier-2 [WHY]/[HOW] expansions only on --expand. Our findings always carry full rationale and evidence.
Honest caveat on the comparison: nWave's flow costs more in aggregate (3+3N reviews, dual reviewers on the roadmap). The win is that each review carries one small artifact instead of the whole diff, and a rejection at phase 4 never pays for phases 5–7.
Goal
Keep our panel breadth and parallel dispatch; add nWave's persistence, early abort, and output tiering. Target: a repeat review pass costs the delta, not the full target set, with no reduction in findings quality.
Do not overload the record decision.telemetry-schema.md documents it as non-verdict and warns consumers to exclude record rows or badly overcount dispatch activity. Verdicts need their own decision or their own store.
A skip-authorizing store must not be consent-gated. Most boundary-event streams are opt-in (~/.claude/telemetry.json, off by default). Slice 2 must resolve whether the verdict store rides boundary-events at all, and if it does, whether consent-off degrades to "never skip" (safe) rather than "skip everything" (unsafe).
A pass row must never become a self-certification shortcut.fix(hooks): pre_commit_review.py's .review-passed gate can be self-written #1461 exists precisely to stop an agent claiming review without dispatching. A verdict row must be writable only as the recorded outcome of a genuine dispatch, and must not by itself satisfy pre_pr_review.py's corroboration.
Shipped code is stdlib-only Python 3.10+ (ADR 0014/0015/0031); tests are pytest under the plugin's tests/ tree; /agent-audit runs after any agent or skill change.
Slices
Slice 0 gates slices 1–2 — per this repo's measure-friction-don't-assume-it norm, and #1618's precedent of scoping the measurement separately from the fix. Slices 3, 4 and 5 are independent of the ledger and of each other; they can land in any order.
Measure re-review duplication across checkpoints and repeat runs (gates 1–2)
Record per-lens verdicts bound to a content hash
Consume the verdict ledger to scope the backstop and repeat runs to the delta
Abort remaining panel dispatches on a cheap-lens blocker
Countable pre-phase inside a review agent (test-review pilot)
Tiered findings output
Acceptance criteria
A measured re-review duplication figure from real rounds, posted to slice 0, with a stated threshold that decides whether slices 1–2 proceed.
If they proceed: a second /code-review over an unchanged target set dispatches zero lenses; changing one file dispatches only the lenses select_lenses.py returns for that file.
/build Step 6's backstop scopes to files not already cleared at sub-steps 4/6, and --backstop-review=skip is no longer the only granularity available.
pre_pr_review.py's gate behavior is unchanged for every existing case, demonstrated by the existing hook tests staying green without modification.
No reduction in findings: a fixture diff reviewed with the ledger cold and warm produces identical findings.
Context
Comparison against nWave-ai/nWave's review agents and skills. Their reviewers are uniformly small (~600–1400 words), all on
haiku, with criteria factored into shared*-critique-dimensions/*-review-criteriaskills. Ours are already mostlyhaiku(21 of 29agents/*review*.md), so model routing is not the gap. Three structural differences are.1. A countable pass gates the qualitative pass. Every nWave reviewer runs Phase 2 as pure arithmetic — count behaviors from AC, budget =
2 × behaviors, count actual tests, check gates G1–G9, diff RED-vs-GREEN test files — before Phase 3 judgment. A Phase-2 blocker aborts Phase 3 outright ("G9 violation = instant REJECTED, no other review dimensions matter"). Arithmetic is model-independent and short-circuits the expensive reading. Our heavy lenses (correctness-reviewopus/2.6k words,test-review2.2k + 6 cited knowledge files,test-smell-review2.2k,security-reviewopus/1.7k) load everything and judge everything in one pass, with no cheap-first abort inside the agent.2. Review is a gate between steps, not a terminal event, and approvals persist.
*deliverruns 9 phases; each artifact (baseline, roadmap, each step file, each TDD step) is reviewed at creation by a single scoped reviewer — 3+3N reviews per feature — sequential, verdict-gated (APPROVED/NEEDS_REVISION/REJECTED), max 2 retries, stop-on-failure..deliver-progress.jsoncarriesvalidation.status, so re-invocation skips anything already approved and resumes at the failure point.We already have most of the gating half:
/buildhas complexity-scaled checkpoints (sub-step 4 per-step forcomplex, sub-step 6 batched at slice boundary), cheap-first lens ordering, narrowed verification-mode payloads, and a 5-iteration fix loop;plan-review-*andspec-compliance-reviewcriteria mode gate before code exists. What we lack is the persistence.hooks/agent_dispatch_ledger.pyrecords that a lens fired, bound to asubject_hash—knowledge/telemetry-schema.mdexplicitly documents therecorddecision as "non-verdict, observational". So a second/code-reviewre-runs every selected lens over every target file from scratch, and/build's Step 6 backstop re-reviews files already cleared at sub-steps 4/6 —--backstop-review=skipis the only lever and it is all-or-nothing.3. Output-side tiering.
nw-density-resolution-contractemits Tier-1[REF]sections always and Tier-2[WHY]/[HOW]expansions only on--expand. Our findings always carry full rationale and evidence.Honest caveat on the comparison: nWave's flow costs more in aggregate (3+3N reviews, dual reviewers on the roadmap). The win is that each review carries one small artifact instead of the whole diff, and a rejection at phase 4 never pays for phases 5–7.
Goal
Keep our panel breadth and parallel dispatch; add nWave's persistence, early abort, and output tiering. Target: a repeat review pass costs the delta, not the full target set, with no reduction in findings quality.
Prior art in this repo
scripts/measure_full_file_duplication.py(PR feat(scripts): measure duplicate full-file-read token cost across review rounds #1698) measures the same-round case. This epic addresses the orthogonal across-round / across-checkpoint case, which that work did not cover.subject_hash_normalizedmatch. That is the narrow precedent this epic generalizes from one whole-diff hash to per-(lens, file) granularity.hooks/lib/review_gate_corroboration.py+hooks/pre_pr_review.py(fix(hooks): pre_commit_review.py's .review-passed gate can be self-written #1461, fix(hooks): move the review-corroboration gate from git commit to PR creation #1886, fix(hooks): pre_pr_review gate requires 2 code-review dispatches that current /code-review never records #2147) are the existing hash-bound gate consumers a verdict ledger must not weaken.Design constraints
telemetry-schema.mdalready notes thesubject_hashalgorithm has changed twice (fix(hooks): cosmetic-delta normalizer reads a reindented heredoc body as formatting #1638, fix(hooks): heredoc grammars for Lua long brackets, SQL dollar-quoting, XML CDATA, PHP inline HTML #1660–fix(hooks): bound heredoc-normalizer — --unified=100000 has no size cap or subprocess timeout #1663), so a version bump invalidates carry-forward and costs one extra dispatch rather than one silent skip. Same bar here.recorddecision.telemetry-schema.mddocuments it as non-verdict and warns consumers to excluderecordrows or badly overcount dispatch activity. Verdicts need their own decision or their own store.~/.claude/telemetry.json, off by default). Slice 2 must resolve whether the verdict store rides boundary-events at all, and if it does, whether consent-off degrades to "never skip" (safe) rather than "skip everything" (unsafe).passrow must never become a self-certification shortcut. fix(hooks): pre_commit_review.py's .review-passed gate can be self-written #1461 exists precisely to stop an agent claiming review without dispatching. A verdict row must be writable only as the recorded outcome of a genuine dispatch, and must not by itself satisfypre_pr_review.py's corroboration.tests/tree;/agent-auditruns after any agent or skill change.Slices
Slice 0 gates slices 1–2 — per this repo's measure-friction-don't-assume-it norm, and #1618's precedent of scoping the measurement separately from the fix. Slices 3, 4 and 5 are independent of the ledger and of each other; they can land in any order.
test-reviewpilot)Acceptance criteria
/code-reviewover an unchanged target set dispatches zero lenses; changing one file dispatches only the lensesselect_lenses.pyreturns for that file./buildStep 6's backstop scopes to files not already cleared at sub-steps 4/6, and--backstop-review=skipis no longer the only granularity available.pre_pr_review.py's gate behavior is unchanged for every existing case, demonstrated by the existing hook tests staying green without modification.Out of scope