Skip to content

feat(review): hybrid review flow — verdict ledger spine, cheap-gate phase, tiered findings #2164

Description

@bdfinst

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-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.

Prior art in this repo

Design constraints

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.

  1. Measure re-review duplication across checkpoints and repeat runs (gates 1–2)
  2. Record per-lens verdicts bound to a content hash
  3. Consume the verdict ledger to scope the backstop and repeat runs to the delta
  4. Abort remaining panel dispatches on a cheap-lens blocker
  5. Countable pre-phase inside a review agent (test-review pilot)
  6. 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.

Out of scope

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions