Plan: a hard tier of heisenbug specimens for commit review and plan review, calibrated to about 80 %
Closes: #1016 (wave 1 of #1013). Relates to: #1013, #1008, #999, #429. Branches: test/battery-specimens, test/battery-specimens-rust, test/battery-specimens-ts, test/battery-specimens-calibration, test/battery-specimens-records. Status: Done (2026-12-03) — Wave 1 specimens, Opus 5.5 calibration, and 396-call 3-run confirmation landed; both tasks froze above 95 % effectiveness on today’s frontier (98 % commit, 100 % plan), next rung tracked in #1017.
Erratum (2026-12-02): after three 264-call calibration rounds stayed at 100 % defect recall across all three frontier models despite 35–38 file bases, 200-line padded chain modules, and surface distractors, the operator directed redesigning all 11 specimens with claude-fable-5-2 (author: vertex-anthropic/claude-fable-5-2) as minimal 1–4 line stealth pairs where buggy implements the expected safeguard with a subtle cross-file flaw. Round 4 (j580, 264 calls, $95.16) still measured 99.2 % true defect recall (90.9 % commit / 95.5 % plan best frontier effectiveness). Under D8 step 4, the operator ruled (question #5) to accept the Fable-5.2 stealth suite as measured, land MR 4 (Opus 5.5 calibration) and MR 5 (3-run confirmation), and open #1017 for a multi-hundred-file / 150 KB+ diff rung under #1013.
Context
The operator’s target (#1013, 2026-12-01): about 80 % effectiveness for today’s best model, on spaghetti code with heisenbugs; a tier near 100 % is not hard enough. Agreed in conversation: commit review and plan review first, built on shared specimens; the band is read on effectiveness (D4). What the tree says, by reading:
-
tools/model-battery/store/summary.json:reviewer0.95 (Fable 5.2) and 0.98 (Carbon);planning-hard0.97 to 1.00;planning-deep0.92 to 0.98. -
What frontier subjects miss in
store/revieweris low salience, not concurrency: a swallowed error beside louder defects, a suppression, a weakened test. The cross-file racers-ingest-lock/reentrant-by-pidis missed once in the 15 reviews of it by Fable 5.2, Opus 5.5, Carbon and Neon (two levels). A race is not hard by being a race, so difficulty has to be measured and tuned. -
No task scores P5 or P6 (#1008): the keys under
cases/planning,cases/planning-hardandcases/planning-deepplant P1, P2 and P3 defects only. -
No control is the corrected form of a planted defect, so a reviewer that fails every race-shaped hunk is charged only on decoys.
-
A planted defect is proven by argument (
proofliterals incases/planning-deep, nothing incases/reviewer). Near 80 % a disputable key and a real miss read the same. -
tools/model-battery/drivers/review.mjsstages a commit case from wholebefore/andafter/trees (stageCase) and serves a plan case fromcontext/(planTree,contextFiles).tools/model-battery/cli.mjsre-scores the committed store only (rescorereadsroot;RESCORABLE).
Design
D1. A specimen: one legacy tree, one change, written twice
tools/model-battery/cases/specimens/<name>/ holds:
| Entry | What it is |
|---|---|
|
The legacy project, 15 to 40 files, its own tests passing. All the mess lives here. |
|
Two overlays of the same small change (files added or replaced over |
|
The commit message of each variant. |
|
The same change as a plan over |
|
The key (D2). |
Three properties carry the design:
-
The change is tidy and the mess is old. A FAIL on the fixed variant is then a false flag, not a fair complaint about ugly new code.
-
The witness. The fixed variant’s test of the property, run on
base/+buggy/, fails; onbase/+fixed/it passes (H2). Every planted defect is thereby executable fact. -
The twin. Each task reads both variants as separate cases. The fixed one is a control that differs from the defect case only in the flaw.
Both plans satisfy planShapeProblems (packages/pi-workflow/plan-shape.ts) and name only paths in base/ or their overlay (H5), so nothing mechanical fails and the planted flaw is the P5 or P6 finding.
Two shapes were set aside. Whole before/ and after/ trees a case (#429) would carry each legacy tree five times. Plans over the pinned repositories (#999) have no witness: a design flaw in an unimplemented plan over real code stays an argument.
D2. specimen.json, and the four cases it yields
{
"class": "rmw-two-stores", "language": "rust", "author": "vertex-gemini/gemini-4-neon",
"chain": ["src/reserve.rs", "src/snapshot.rs", "src/jobs/registry.rs", "src/jobs/reconcile.rs"],
"witness": { "files": ["tests/reserve_interleaved.rs"], "fails": ["holds_quota_when_reconcile_interleaves"] },
"commit": {
"defects": [{ "id": "check-outside-txn", "rubric": "J3", "blocking": true, "tier": "cross-file",
"source": "#1013 (read-modify-write across two stores)", "evidence": ["src/jobs/reconcile.rs"], "what": "...",
"anchors": { "files": ["src/jobs/reconcile.rs"], "terms": ["reconcile", "outside with_txn"] } }],
"decoys": [{ "id": "saturating-remaining", "what": "...", "justification": "DESIGN.md", "anchors": { "terms": ["saturating_sub"] } }]
},
"plan": { "context": ["src/ledger.rs", "src/snapshot.rs", "src/txn.rs"], "defects": ["one, same shape, rubric P5 or P6"], "decoys": [] }
}
-
classis one of the eleven in D5;authoris the model that wrote the specimen. -
chainis the path from the changed code to the conflicting actor, in reading order: its first entry is a path of the buggy overlay, the rest are inbase/. -
witness.filesare paths both overlays hold;witness.failsare the tests that fail on the buggy tree. -
Each kind plants exactly one defect, tier
cross-file, with non-emptyanchors.terms. Defects and decoys keep the shapescorers/anchors.mjsscores today.evidence,justificationandplan.contextpaths are inbase/.
For a task of kind commit or plan, a specimen yields two cases in the existing key shape, so scoreReview is not touched:
| Case | defects |
decoys |
|---|---|---|
|
the kind’s defect |
the kind’s decoys |
|
none (a control) |
the kind’s decoys, plus the twin: |
kind is the task’s, context is plan.context for a plan and empty for a commit, sha is treeDigest of the specimen directory.
D3. Loader, driver, command line
New tools/model-battery/lib/specimen.mjs:
-
CLASSES;isSpecimens(casesDir): a subdirectory holdsspecimen.json. -
specimenCases(casesDir, kind): the cases of D2, each withspecimen: { dir, variant }. It refuses at load, naming the specimen and the field (T2): a missing field, an unknown class, a kind without exactly one defect, a defect without terms, tier or evidence, an empty overlay, a missing message or plan, and any path that is not where D2 places it. -
materialise(specimenDir, variant, { witness }): a temporary copy ofbase/with the variant’s overlay on it, and withwitness: truethe fixed overlay’s witness files on top; returns{ cwd, dispose }. The honesty suite builds and tests there.
In drivers/review.mjs:
-
stageCasetakes(before, change, { overlay }): withoverlayit copies the change over the baseline instead of replacing it. Its existing callers pass a case’sbefore/andafter/. -
cases()returnsspecimenCases(casesDir, spec.specimens)whenisSpecimens(casesDir). -
A specimen commit case is staged from
base/and its overlay, withcommit.<variant>.txtas the message. A specimen plan case sendsplan.<variant>.adoc, supplieskey.contextread frombase/, and serves the snapshot frombase/on disk, asplanTreeservescontext/today. -
specimenDiff(kase)besidecaseDiff, for the honesty suite.
In lib/task.mjs, checkReviewArmFields accepts two fields on a review task and refuses them elsewhere (K2): "specimens", which is "commit" or "plan", and "band" (D4). In cli.mjs, RESCORABLE gains the two tasks and rescore honours --store (parseCommon(rest).opts.store ?? root), because calibration tunes anchors against a scratch store.
Two task files, both "path": "single-call", "driver": "review", "cases": "cases/specimens", "scorer": "anchors":
| File | specimens |
experiment |
typicalTokens (corrected from the first pilot) |
|---|---|---|---|
|
|
|
120000 |
|
|
|
200000 |
D4. Effectiveness, the band, the freeze rule
aggregate in scorers/anchors.mjs adds three fields, computed from what a record’s score already holds:
-
controls: records that planted nothing;controlsClean: those with no false flag and no error. -
effectiveness:(caught + controlsClean) / (planted + controls), undefined when the denominator is 0.
On specimens, a reviewer that reports the flaw on both variants and one that passes both each score 0.5. The fields appear in every review task’s cell; only band tasks render them. (A planning key whose defects are all gate also counts as a control there; no band task has one.)
Both task files carry:
"band": { "min": 0.75, "max": 0.85, "freezeAt": 0.95,
"frontier": ["vertex-anthropic/claude-fable-5-2", "vertex-gemini/gemini-4-carbon", "vertex-gemini/gemini-4-neon"] }
checkReviewArmFields requires 0 < min < max < freezeAt ⇐ 1 and a non-empty frontier. The frontier cells are the bare subjects, at the level levelFor sends for each.
render.mjs gains bandTable, placed after reachTable in renderPage, for every arm whose task has a band. Columns: Effectiveness, Defects caught, Twins clean, Hit call cap, Over 600 s. Under it one line a task from bandStatus(best, band), where best is the highest effectiveness among the frontier cells:
| Best frontier cell | The line says |
|---|---|
none measured |
not measured |
below |
below the band: audit the keys, then soften |
|
in the band |
above |
above the band: harden |
|
freeze this tier as a regression floor and open the next rung |
Freezing is an issue of its own when a model first reaches 95 %: the tier’s cases and records stay, and a harder task is added beside it. This plan adds no frozen marker.
D5. The eleven specimens
Six Rust, five TypeScript; one class each. Every chain crosses a table, a registry or a late override. Each row gives the base and the change, then the flaw, the chain, the twin, the witness and a decoy.
| Specimen (class) | Base, and the change | Flaw, chain, twin, witness, decoy |
|---|---|---|
|
Tenant metering: a file ledger, an in-memory |
Checks |
|
Job spool with lease files; hooks registered by event name from |
Reads the lease, fires |
|
Scheduler with its own zone table ( |
Next run is the last local time plus 86,400 s under the current offset: twice on the fall-back day, skipped on spring-forward. Chain: |
|
Client stack: |
The op’s policy is idempotent, so three layers retry, each attempt with a fresh timeout, past the deadline. Chain: |
|
Step table built from config; |
Apply calls |
|
Message dedupe: |
Uses |
|
Log pipeline: stages registered by name, order from |
In |
|
Hot reload: |
The factory destructures |
|
Document model with a synchronous emitter ( |
The handler calls |
|
Stream client: |
Advances the cursor after |
|
Middleware chain from |
On a backend error returns |
D6. Authoring rules
-
The change is 40 to 200 changed lines, tidy and tested; every line of the buggy diff is locally reasonable.
-
base/uses at least three devices: table- or config-driven dispatch on the chain, a helper whose name promises what it does not do, a dead near-duplicate of a live function, a default overridden late, a stale comment about something else. -
The buggy variant’s commit message and plan state the property with confidence, and its own test of the property passes because it drives another seam.
-
A witness is deterministic and platform-neutral: an injected clock, store, hook or scheduler; no sleep, no wall clock, no thread timing, no symlink, no POSIX-only path (the suite runs on Windows and macOS nightly, #281). It uses only what both variants export, so on the buggy tree it fails as a test, not as a build (H2).
-
Rust is std-only with a
Cargo.lock; TypeScript uses Node built-ins and vitest. -
No comment, message or plan line says where the flaw is or marks a variant. H7 checks the mechanical part (the specimen’s name and the key’s ids); the rest is the author’s and the commit review’s to hold.
-
Anchors are written before any model reads the case; D8 step 2 is the only later tuning. Terms name the mechanism (the conflicting actor or the window); a FAIL that says only "untested" is an extra.
whatis written for a reader who has not seen the anchors.
D7. The honesty suite
New tools/model-battery/test/specimens.test.mjs, per specimen, building with materialise and running cargo or vitest as test/cases.test.mjs does (its own cargo target directory a tree, describe.skipIf(!CARGO), times through bound() of tools/lib/test-bounds.mjs):
| Id | Property |
|---|---|
H1 |
The project’s own tests pass on |
H2 |
With the witness files on the buggy tree the run reports every |
H3 |
|
H4 |
Every |
H5 |
Both plans pass |
H6 |
The fixed diff’s paths include every path of the buggy diff; |
H7 |
No file of |
D8. Calibration: pilot, read, tune, confirm
Every model run is the operator’s go after a --dry-run, as a job, into .pi/scratch/hard-tier/:
node tools/task.mjs battery run --task reviewer-heisenbug --task planning-p5p6-hard \ --model vertex-anthropic/claude-fable-5-2 --model vertex-gemini/gemini-4-carbon --model vertex-gemini/gemini-4-neon \ --runs 2 --store .pi/scratch/hard-tier --budget <the operator's figure> --dry-run
-
Pilot. Two runs: 44 scored opportunities a subject and task.
-
Read. Every pilot review goes to an independent reader: a fresh-context helper on
vertex-anthropic/claude-opus-5-5(outside the frontier), one specimen at a time, given each defect’s and decoy’swhatand the reviews, not the anchors. For each review it records whatverdictCellscompares: the defect caught or missed, every decoy (the twin among them) flagged or clear, and on a fixed variant the number of FAIL blocks. Where reader and scorer differ, the implementing agent reads the review and corrects the anchors, then runsbattery rescore --store .pi/scratch/hard-tier. A twin FAIL that names a real residual flaw is fixed in the specimen. -
Decide, per task, on the best frontier cell:
Effectiveness Next 0.75 to 0.85
Confirm.
above 0.85
Harden the most-caught specimens first. Levers, in order: one more hop through the table or registry; a blind test that drives a wrong seam more convincingly; a dead near-name sibling of the conflicting actor; a confident comment or Risks line; a larger legitimate change around the flaw; an easy surface defect in the buggy variant only, absent from the key (a FAIL naming only it is an extra).
below 0.75
For each specimen no subject caught in any run, a reader with the tree confirms the flaw is findable within the budget; then remove a hop, or put the actor’s file in
plan.context. If more than a third of the misses hit the call cap, shorten chains first. -
Re-pilot only what changed (
--force --case <name>/buggy --case <name>/fixed): a change tobase/or an overlay in both tasks, a change to a plan or a message in its own. At most three rounds, each reported on the issue (effectiveness by subject and task, catches by specimen, what was changed). After the third, a task still outside the band goes to the operator: accept as measured, another round, or replace specimens. -
Confirm. Three fresh runs into the committed store through the manifest (
battery fill --task …): 66 opportunities a subject and task, a standard error of about 5 points at 0.80. Tuning on pilot outcomes regresses toward the mean, so the confirmation is accepted between 0.70 and 0.90; outside that it is reported as measured and the operator rules. -
Record. The reader’s verdicts and the review texts land as
cases/calibration/2026-12-specimens.jsonin the shape of2026-10.json, withkindon each review;calibrateSpecimens(file)inscorers/anchors.mjsdiffs them against the scorer throughverdictCells, andprintCalibrationprints it.
Planning figure for spend: US$250 to 550 over all rounds; each invocation’s projection is printed first and refused above --budget.
Scope
Paths without a directory are under tools/model-battery/. MR 1 first; 2 and 3 in either order; 4 after both; 5 last.
| MR | Work | Files |
|---|---|---|
1 |
This plan and its nav entry; D2 to D4 and D7; |
|
2 |
The other five Rust specimens |
|
3 |
The five TypeScript specimens |
|
4 |
D8 steps 1 to 4 and 6: specimen and anchor edits, the calibration file, corrected |
|
5 |
D8 step 5: two manifest entries (three runs, the three frontier subjects), the records, the summary, the page head and the rendered page; plan Done |
|
Out of scope, each its own plan under #1013: coder-heisenbug (the buggy tree, a symptom report, the witness as hidden suite), explore-spaghetti (questions over base/), judge-hard. Also out: any matrix threshold or shipped default, a model grader in place of anchors, a frozen-tier marker.
Tests
| Category | File | Property |
|---|---|---|
contract |
|
T1 a specimen yields a buggy case with its defect and a fixed case with none and the twin decoy. T2 a specimen that breaks a rule of D3’s list is refused at load, naming specimen and field. T3 a commit case’s repository is |
contract |
|
K1 the seventeen packaged tasks load. K2 |
unit |
|
S1 effectiveness is caught defects plus clean controls over planted defects plus controls; an errored control is not clean. S2 (MR 4) the scorer reads the hand-scored specimen reviews as the reader did, the count of disagreements left pinned and each named in |
unit |
|
R1 the band line reads each of the five rows of D4 from the best frontier cell. |
unit |
|
C1 |
concurrency |
each specimen’s witness, run by |
H2: the planted race or ordering flaw fails a deterministic interleaving test and its twin passes it. |
regression |
|
H1 and H3 to H7 of D7. The existing driver tests (a read answered from the index, |
Risks
| Risk | Mode | Mitigation |
|---|---|---|
A planted defect is not real, so a correct PASS is scored a miss |
silent |
H2: the witness fails on the buggy tree and passes on the twin |
A twin is not clean, so a fair FAIL is scored a false flag |
silent |
D6.1; D8 step 2 reads every twin FAIL and fixes a real one in the specimen |
Anchors misread a finding worded another way, in either direction |
silent |
D8 step 2 reads every pilot review; S2 pins the result |
Hard for the wrong reason: the read budget does not reach the chain |
silent |
H3; Hit call cap in the band table; the third-of-misses rule in D8 |
Tuning fits pilot noise |
silent |
the confirmation is fresh runs and is what the page shows; its wider acceptance range is stated |
The three frontier cells are in-sample for difficulty |
silent |
stated on the page ( |
The author’s model is one of the subjects |
silent |
|
The key, a plan or the other overlay reaches the reviewer |
silent |
T3, T4, T5, H7; the snapshot root is the staged repository or |
A malformed specimen runs and scores nonsense |
fail-closed |
T2: refused at load, before any call |
A refused or errored call on a security-shaped specimen |
fail-closed |
an errored record scores the defect missed and is not a clean control (S1); the Errors column shows it |
cargo absent, so Rust witnesses do not run on that box |
loud |
|
|
loud |
the fields are additive; a page diff outside the two arms and the band table is reported and left out |
Spend above the projection |
fail-closed |
|
The tier does not reach the band in three rounds |
loud |
reported on the issue; the operator rules (D8 step 4) |
Delivery
-
Canonical page:
docs/modules/ROOT/pages/local-dev.adoc, a subsection "Specimens and the hard tier" under "The reviewer and planning cases": the layout, the honesty rules, effectiveness, the band and the freeze rule (MR 1).tools/model-battery/page-head.adocexplains effectiveness and the band, anddocs/modules/ROOT/pages/model-battery.adocis generated bybattery render(MR 5). -
CHANGELOG.adoc== Unreleased: a "Repo only" line with each MR. -
This plan committed as
docs/modules/ROOT/pages/plans/battery-hard-tier-specimens.adoc, listed indocs/modules/ROOT/nav.adoc; Status In progress at MR 1, Done at MR 5’s merge. -
Validate before each push; MRs through the merge train with squash off. The wave-1 issue is closed by MR 5, with its merge SHA and the result noted on it; #1013 gets the same note and stays open for the other roles.