Plan: plan-review cases above the ceiling, and round two as it runs, to decide Neon against Carbon
Closes: #911. Relates to: #886, #887, #858, #878. Branch: test/battery-plan-round-two. Status: Done (2026-11-26) — measured; by the rule every Neon level passes, Carbon missed nothing (still at the ceiling), and the controls held real defects Carbon found; the swap is the operator’s decision
Context
The operator asked (2026-11-22) whether vertex-gemini/gemini-4-neon can replace Carbon as planSecondReviewer with results at least as good. Approach and decision rule agreed in conversation (2026-11-26). What the tree says today, by reading:
-
The
planningtask (tools/model-battery/tasks/planning.json, five cases undercases/planning, 12 scored defects) cannot separate them: both caught 36 of 36 over three runs with no false flag (store/planning/none). -
Carbon reviews a plan at medium (
REVIEW_THINKING_LEVELinpackages/pi-workflow/reflection-review.ts), not at high as #911 says; the level moved with #858. -
Neon has a floor (
REVIEW_THINKING_FLOOR, plan: medium) and no level of its own, sowantedThinkingwould send it the session’s level: xhigh for a plan written at xhigh. A swap would therefore come with a plan level for Neon, which this run chooses among medium, high and xhigh. Low is below the floor and is not measured. -
Production’s round two reads the edited draft with round one’s review beside it (#886):
plan-pause.tspassesearlier: { reviewer, text },buildPlanReviewPromptrenders it (renderEarlier) andplanReviewSystemPrompt(budget, true)adds its framing. The battery’s review driver (tools/model-battery/drivers/review.mjs) sends neither. -
Adding cases to
cases/planningwould leave every packaged model owing them and its rows no longer comparable. #878 solved the same problem with experiment tasks (tasks/reviewer-large.json,"experiment": "reviewer").
Design
Two experiment tasks
| Task file | Cases | round |
typicalTokens |
|---|---|---|---|
|
|
absent |
30000 |
|
|
|
33000 |
Both: "path": "single-call", "driver": "review", "scorer": "anchors", "experiment": "planning", and a // saying what the task is. battery.json gains one permutation entry per task: "runs": 5, "subjects": ["vertex-gemini/gemini-4-carbon", "vertex-gemini/gemini-4-neon", "vertex-gemini/gemini-4-neon:high", "vertex-gemini/gemini-4-neon:xhigh"]. The two bare subjects are sent medium by production’s own rules (levelFor). experimentNote in battery.json gains one sentence naming the two arms. RESCORABLE in tools/model-battery/cli.mjs gains both names. The planning task, its cases and its records are not changed.
The driver sends round two as production does
-
Key. A round-two case’s
key.jsoncarries"earlier": { "reviewer": "vertex-anthropic/claude-fable-5-2", "file": "earlier-review.txt" }; the file sits in the case directory, besideplan.adoc. -
subjectFor(plan branch): when the key hasearlier, it reads the file, addsearlier: { reviewer, text }to the input ofbuildPlanReviewPrompt, and takes the system prompt fromplanReviewSystemPrompt(budget, true). Without it, nothing changes. -
cases(casesDir, spec):loadTask(tools/model-battery/lib/task.mjs) passes the task’s spec. Withspec.round === 2every case must be a plan whoseearliernames a reviewer and a file that exists and is not empty; without it, a case carryingearlieris refused. The error names the case and is thrown when the cases are listed, before any lane is planned or priced. -
promptText(spec): withspec.round === 2it appendsplanReviewSystemPrompt(budget, true)andrenderEarlier.toString(), each after a\n---\n, at the end of the list. -
checkSpec:roundis the number 2, on areviewtask, or absent.
The case tree
All 12 cases carry one tree under context/: the 15 files of cases/planning/plan-rs-control/context, with four additions. Plan-case trees are read by the reviewer, not built, as today.
-
core/src/spool.rs: a#[cfg(test)] mod testswithdrain_takes_oldest_first(three items enqueued,drain(10), asserts ids 1, 2, 3) anddrain_removes_item_files(afterdrain(10)no<id>.itemremains). -
New
core/tests/spool_len.rs: one test,len_follows_enqueue_and_drain(two enqueued,len()is 2,drain(10),len()is 0). -
daemon/src/settings.rs: a#[cfg(test)] mod testswithdefaults_when_file_missing(load_settings(Path::new("/nonexistent"))givespoll_secs5 andmax_batch100). -
DESIGN.md, decision 4: "Signals only set a flag. A signal handler sets an atomic flag and returns; the main loop acts on it at the top of its next pass."
The cold cases (cases/planning-hard)
Each bullet under a case is id · rubric · tier · what is planted; a cross-file defect’s evidence file is named and is its evidence. "Supplied" is the key’s context.
hard-requeue: requeue an item the uploader rejects (#318). Supplied: daemon/src/main.rs, DESIGN.md, docs/spool.adoc, CHANGELOG.adoc.
-
private-index-seam· P2 · cross-file · the daemon callsSpool::index()andSpool::write_index(); both are private incore/src/spool.rs. -
drain-keeps-files-claim· P2 · cross-file · "`drain` leaves each item’s file until the next pass, so a rejected item’s bytes are still on disk";drainremoves each file as it reads it (core/src/spool.rs). -
Decoy
index-rewritten-whole: the plan rewrites the whole index on each requeue;DESIGN.mddecision 1 makes that the rule.
hard-crash-safe: a crash mid-pass loses no item (#322); drain becomes peek and ack. Supplied: core/src/spool.rs, daemon/src/main.rs, docs/spool.adoc, CHANGELOG.adoc.
-
never-without-test· P2 · surface · "an item file is never removed before the uploader has acknowledged it" names no test, while the plan’s other never ("`ack` never removes an id that was not peeked") names a property test. -
race-unit-tested· P1 · surface · the lock that stops two daemons draining one spool is tested by "unit: the second open returns an error": a race with no concurrency test. -
part-guard-absent· P2 · cross-file · "`watch::poll` already skips files still being written (names ending.part)";daemon/src/watch.rsskips only what is not a file.
hard-byte-budget: drain by a byte budget (#327); drain(max: usize) becomes drain(budget: Budget). Supplied: core/src/spool.rs, daemon/src/main.rs, docs/spool.adoc, CHANGELOG.adoc.
-
integration-test-caller-missed· P2 · cross-file · Scope listscore/src/spool.rsanddaemon/src/main.rsas "the only callers ofdrain`"; `core/tests/spool_len.rscallsdrain(10)and is not in Scope. -
stop-vs-skip· P2 · surface · Design: a batch stops at the first item over the byte budget, which stays pending. The Steps row: such an item is skipped and the batch goes on. -
rides-along-331· P1 · surface · a "while here" step renames themax_batchkey tobatch.itemsfor #331: another issue’s work.
hard-reload: reload settings on SIGHUP (#335). Supplied: daemon/src/main.rs, daemon/src/settings.rs, docs/spool.adoc, DESIGN.md, CHANGELOG.adoc.
-
load-never-fails-claim· P2 · cross-file · "`core::config::load` never fails: a file it cannot read or parse is skipped";core/src/config.rsskips only a missing file and returns an error naming one it cannot read or parse. -
default-ten· P2 · cross-file · "`poll_secs` keeps its default of 10 seconds";docs/spool.adocanddaemon/src/settings.rssay 5. -
left-to-implementer· P2 · surface · what is logged on a rejected reload, and whether the daemon keeps the old settings or exits, "is left to the implementer". -
Decoy
flag-not-handler: the handler only sets a flag and the loop reloads at the top of its next pass, up topoll_secslate;DESIGN.mddecision 4 makes that the rule.
hard-size-cap: refuse inbox files over a size cap (#341). Supplied: daemon/src/watch.rs, docs/spool.adoc, CHANGELOG.adoc.
-
keys-read-in-settings· P2 · cross-file · “max_item_bytes` is read incore/src/config.rs, next topoll_secsandmax_batch”; those keys are read in `daemon/src/settings.rs, andconfig.rsreads no key. -
enqueue-returns-id· P2 · cross-file · "the stored item’s path, asSpool::enqueuereturns it, is logged";enqueuereturns the id,io::Result<u64>(core/src/spool.rs). -
old-index-reader· P3 · surface · the index gains a size column and "a reader for the old one-column format stays for one release".
hard-control: spool inbox files oldest first (#346). Supplied: daemon/src/watch.rs, core/src/spool.rs, docs/spool.adoc, CHANGELOG.adoc. No defect and no decoy: every seam is described as the tree has it.
The round-two cases (cases/planning-round-two)
Each case states what round one’s review (earlier-review.txt) failed, what the author’s edit did, and what the edited plan.adoc therefore holds. A decoy whose justification is plan.adoc is a round-one FAIL the edit fixed: raising it again is a false flag.
r2-unfixed: a dead-letter directory for rejected items (#352). Supplied: daemon/src/main.rs, docs/spool.adoc, CHANGELOG.adoc. Round one: P2 FAIL, the plan calls Spool::remove(id), which core/src/spool.rs lacks, and step 3’s test names no category. The edit: names the category; renames the call to "the existing Spool::discard(id)`"; changes the Design to write rejected items to `<spool>/dead/.
-
discard-does-not-exist· P2 · cross-file ·Spoolhasopen,enqueue,drainandlen, and nodiscard(core/src/spool.rs). -
dead-vs-rejected-dir· P2 · surface · the Design says<spool>/dead/; the Steps row still says<spool>/rejected/. -
Decoy
test-category-fixed(plan.adoc): step 3’s test now names its category.
r2-cited-test: cap each pass at max_batch uploads, retries counted (#357). Supplied: daemon/src/main.rs, docs/spool.adoc, CHANGELOG.adoc. Round one: P2 FAIL, "a pass never uploads more than max_batch items" names no test. The edit: "pinned by the existing test `drain_takes_oldest_first`"; and a new risk written as a sentence under the Risks table.
-
cited-test-does-not-pin· P2 · cross-file · that test drains with amaxof 10 over three items and asserts their order: it never reaches the cap (core/src/spool.rs). -
settings-read-once· P2 · cross-file · "a changedmax_batchapplies to the next pass, as today";daemon/src/main.rsreads the settings once, before the loop. In both drafts; round one missed it. -
prose-risk-no-mode· P1 · surface · "if the uploader is slow the spool grows without bound", under the table, with no mode and no mitigation.
r2-round-one-wrong: a user configuration layer (#361). Supplied: daemon/src/settings.rs, daemon/src/main.rs, docs/spool.adoc, CHANGELOG.adoc. Round one: P2 FAIL, "`core::config::load` takes one path; the plan passes two" (wrong: it takes &[&Path]); P3 FAIL, load_settings(system) kept as a wrapper. The edit: removes the wrapper, main.rs moving in the same step; leaves the load call; finds the user file with dirs::config_dir(), "which the daemon already depends on".
-
user-listed-first-loses· P2 · cross-file · the plan callsload(&[user, system])"so the user file wins"; later layers win (core/src/merge.rs), so the system file wins. In both drafts; round one missed it. -
dirs-not-a-dependency· P2 · cross-file ·daemon/Cargo.tomldepends onspool-corealone, and no step addsdirs. -
Decoy
load-takes-a-slice(core/src/config.rs): round one’s FAIL was wrong; repeating it is a false flag. -
Decoy
wrapper-removed(plan.adoc): the wrapper is gone.
r2-half-fixed: the oldest pending item’s age in spoold status (#366). Supplied: daemon/src/main.rs, docs/spool.adoc, CHANGELOG.adoc. Round one: P1 FAIL, the plan also changes the uploader’s retry count for #368; P2 FAIL, Spool::oldest() does not exist. The edit: drops the #368 paragraph from the Design and leaves its Steps row; adds a step that adds pub fn oldest.
-
still-carries-368· P1 · surface · Steps row 5 still retries a failed upload three times, "(#368)". -
open-creates-dir· P2 · cross-file · “Spool::open` fails when the directory is missing, sostatusprintsno spool”; `opencreates it (core/src/spool.rs). In both drafts; round one missed it. -
Decoy
oldest-now-added(plan.adoc): the plan now addsSpool::oldest.
r2-new-always: skip inbox files still being written (#371). Supplied: daemon/src/main.rs, docs/spool.adoc, CHANGELOG.adoc. Round one: P2 FAIL, "`poll` handles .part files today"; daemon/src/watch.rs has no such check. The edit: step 1 adds the check; the Design gains "a file is always spooled within one pass of its rename".
-
always-untested· P2 · surface · that always names no test; step 1’s test covers "a.partfile is left in the inbox" alone. -
poll-returns-count· P2 · cross-file · "`poll` returns the names of the files it moved, whichmainlogs"; it returns a count,io::Result<usize>(daemon/src/watch.rs). In both drafts; round one missed it. -
Decoy
part-check-now-added(plan.adoc): the plan now adds the check.
r2-control: log each pass’s counts (#376). Supplied: daemon/src/main.rs, daemon/src/watch.rs, docs/spool.adoc, CHANGELOG.adoc. Round one: P2 FAIL, the plan names daemon/src/poll.rs where the file is daemon/src/watch.rs; P1 FAIL, step 2’s test names no category. The edit fixes both. No defect and no decoy.
| Task | Scored defects | Cross-file | Decoys | Controls |
|---|---|---|---|---|
|
14 |
8 |
2 |
1 |
|
11 |
7 |
5 |
1 |
Authoring rules
-
Each
plan.adocfollows the form ofcases/planning/plan-rs-helper-claim/plan.adoc(header line, TL;DR, Design, a Steps table with a Test column, a Risks table with a Direction column, a last step namingdocs/spool.adoc,CHANGELOG.adocand the close), in 45 to 90 lines, and passesplanShapeProblems(packages/pi-workflow/plan-shape.ts): no case plants what the shape check owns. -
A planted claim is written once, as the author’s plain statement. A case plants what its bullets list and nothing else the tree contradicts; a control’s plan is checked against every file of the tree, its tests included, so that nothing it changes breaks a caller or a test it does not name.
-
Each
key.jsonfollowsplan-rs-helper-claim/key.json:kind,context, and per defectid,rubric,blocking: true,tier,source(the class of mistake, one phrase),what,evidencefor a cross-file one, andanchors; per decoyid,what,justification,anchors. A defect’s or decoy’swhatcontains at least one of its own anchor terms. -
Each
earlier-review.txtreviews the draft before the edit, in production’s answer form: aVERDICT:line, P1 to P4 each with PASS or FAIL and a sentence, then the "Beyond the declared context the reviewer read …" line production appends.
The run, and the rule that reads it
The run is the operator’s. node tools/task.mjs battery fill --task planning-hard --task planning-round-two --dry-run gives the projection: 12 cases x 5 runs x 4 subjects = 240 calls, about $38 by the stored per-call costs of the same subjects on planning. With his go, the same command without --dry-run, then one --retry-errors --jobs 1 pass for rate limits and timeouts.
The decision rule, fixed here. Per subject and per task, over its five runs: R is pooled recall (caught over planted); S is the highest per-run recall minus the lowest; X is pooled cross-file recall; F is the sum of false flags (FAIL blocks on the control, and flagged decoys); E is the number of calls that ended with no review. Neon at a level is at least as good as Carbon when, on both tasks:
| # | Condition |
|---|---|
a |
R(Neon) is not below R(Carbon) by more than the larger of the two S |
b |
X(Neon) is not below X(Carbon) by more than that same margin |
c |
F(Neon) is not above F(Carbon) |
d |
E(Neon) is not above E(Carbon) |
-
Neon can replace Carbon, at the level that passes with the lowest mean cost per call; wall time breaks a tie.
-
Carbon stays when no level passes.
-
Still at the ceiling: when Carbon misses nothing on both tasks, the rule’s answer is reported with that caveat. This plan adds no further cases.
Erratum (2026-11-26): neither control is clean. hard-control’s Risks row says "the next pass tries again", but `main propagates poll’s error with `? and the daemon exits. r2-control’s Step 1 test needs a single-pass function and a writer seam that `main lacks, and the plan leaves that to the implementer. Carbon flagged these in 7 of its 10 control runs, and Neon at xhigh in 1; condition c counts them as false flags. They are reported on #911 with the result, and the cases stay as measured.
Scoring protocol, fixed here. A prediction goes on #911 before the run. After it, every miss and every false flag of all four subjects is read. An anchor changes only to credit a FAIL block that plainly names the defect in other words, or to stop a decoy matching a block that names a real defect; a defect all four subjects miss in every run is re-read against the tree, and one the tree does not support is removed from its key. Every such change is applied to every subject by battery rescore and listed on #911. The swap is the operator’s decision and its own issue.
Scope
-
MR 1 (
Relates to #911), branchtest/battery-plan-round-two: the two task files, the driver,checkSpec,loadTask,RESCORABLE, the two manifest entries and theexperimentNotesentence, the 12 cases, the tests below,battery render(the eight new rows read not measured), and the CHANGELOG line. -
The dry run and the prediction on #911; the operator’s go; the run.
-
MR 2 (
Closes #911), branchtest/battery-plan-round-two-records: the records undertools/model-battery/store/planning-hardandstore/planning-round-two,battery summariseandbattery render, any key change the protocol made, the CHANGELOG line, and the result on #911 by the rule.
Tests
In tools/model-battery/test/, vitest. New file plan-round-two.test.mjs unless a row names another. budget below is snapshotBudget(DEFAULT_WORKFLOW_CONFIG) from packages/pi-workflow/workflow-config.ts, as the driver computes it.
| Category | Test | Pins |
|---|---|---|
contract |
|
round two is sent as production sends it; a cold case is sent as before |
contract |
|
no existing task’s fingerprint moves |
contract |
|
the spec’s shape |
contract |
in |
the reviewer cannot read the earlier review or the key through its tools |
contract |
in |
the two bare subjects' level |
contract |
the manifest lists both tasks, each with 5 runs and exactly the four subjects |
the permutation |
regression |
|
a round-two case is never run cold, and a cold case never as round two |
regression |
|
the corpus is what this plan says: the shape check owns nothing planted, and all 12 cases carry the one tree |
regression |
per task, the scored defects, cross-file defects, decoys and controls counted from the keys equal the table above |
the totals the rule divides by |
regression |
for every defect and decoy of the 12 keys, a FAIL block whose text is its |
an anchor that cannot match its own description |
regression |
|
the lists that name every task |
Mutants, each to fail its test: subjectFor ignoring earlier; the loader guard removed; promptText appending for every task.
Risks
| Risk | Mode | Mitigation |
|---|---|---|
An anchor misses a correct finding worded another way, understating one subject |
silent |
the |
A decoy’s anchor matches a block about a real defect, overstating false flags |
silent |
the scorer skips a block that names a defect; the protocol reads every false flag |
A round-two case run cold, or a cold case as round two |
fail-closed |
the loader refuses before any call (regression test) |
The round-two framing leaks into existing fingerprints |
silent |
the fingerprint contract test |
A planted defect the tree does not support |
silent |
cross-file evidence must exist ( |
Hand-written round-one reviews differ from real ones |
silent |
production’s answer form is pinned by test; stated as a limit in the result |
The set is still at the ceiling |
loud |
the rule’s third outcome; reported, no further cases here |
Calls fail at Neon’s higher levels, as Carbon’s did at high |
loud |
condition d; one |
|
loud |
rendered in MR 1 first: a diff outside planning’s experiments table and the note is reported on #911 and left out |
Cost above the projection |
fail-closed |
the battery refuses over its $300 budget before any call; the dry run is on #911 before the go |
Delivery
-
Canonical page:
docs/modules/ROOT/pages/model-battery.adoc, generated bybattery renderfrom the store andbattery.json; the arms' sentence isexperimentNote.Erratum (2026-11-26):
experimentNoteis read by no code, so the sentence there never reaches the page. The page names the two arms through its source,tools/model-battery/page-head.adoc(the Experiments bullet). TheexperimentNotesentence stays, beside its sibling. -
CHANGELOG.adoc== Unreleased: a "Repo only" line with each MR. -
This plan committed as
docs/modules/ROOT/pages/plans/battery-plan-round-two.adoc, listed indocs/modules/ROOT/nav.adoc; Status In progress at start, Done at MR 2’s merge. -
Validate before each push; MRs merged with squash off; #911 is closed by MR 2, with its merge SHA and the result noted on the issue.