feat(implement-loop): tier the quality review by independently-measured diff size

qual+repairs are the pipeline's largest cost pool (51M of 164.5M real
tokens, 31%, in the 206-run corpus), with opus weighing ~5x on the
quota side. The opus pin's own rationale (consequence-of-a-miss,
agent-template § model) scales with diff size — so the tier now does
too: the spec-reviewer, which runs before quality, reads the diff
itself and is independent of the implementer, reports diff_magnitude
(git diff HEAD --shortstat) and touches_contract; <=25 changed lines
and no contract-referenced path -> sonnet/high, anything larger,
contract-touching, or unmeasured -> opus/xhigh (fail conservative).
The independent end-verify/mini-verify suite gate is the
deterministic backstop that makes the lower tier defensible; the
chosen tier is logged per task (qual_tier) in the end-report.

Sampling phase per the issue's acceptance: the first ~10 real
small-diff iterations get a one-off opus second review; important+
divergences are recorded on the issue before the threshold counts as
proven.

closes #30
This commit is contained in:
2026-07-17 15:37:28 +02:00
parent 1cb52fb821
commit 44f45d16a9
4 changed files with 94 additions and 10 deletions
+10 -1
View File
@@ -127,7 +127,16 @@ Assignment rule, in priority order:
3. **Volume × wall-clock** — agents dispatched per-task inside
loops or fanned out in parallel swarms multiply their model's
latency; they run `sonnet` unless rule 1 overrides (currently
only `quality-reviewer`, the loop's last correctness gate).
only `quality-reviewer`, the loop's last correctness review).
That override is itself **size-conditioned** (issue #30):
consequence-of-a-miss scales with diff size, so the
implement-loop dispatches the quality phase at `sonnet`/`high`
when the spec-reviewer independently measured the diff at ≤25
changed lines touching no contract-referenced path, and at
`opus`/`xhigh` otherwise (including whenever the measurement is
missing). The deterministic end-verify/mini-verify suite gate
is what makes the lower tier defensible; the agent-file
frontmatter keeps the opus default.
Current distribution: `opus` — architect, bencher, debugger,
fieldtester, grounding-check, plan-recon, quality-reviewer,