Skip to content

feat(offload): extract_llm_sweep — co-reference index, economic trigger, and the fixes that let it act - #186

Merged
amiddavid merged 85 commits into
mainfrom
feat/coref-recut
Sep 17, 2026
Merged

amiddavid merged 85 commits into
mainfrom
feat/coref-recut

Conversation

@amiddavid

@amiddavid amiddavid commented Sep 3, 2026 •

Copy link
Copy Markdown
Collaborator

Enable it

pipeline: [extract_llm_sweep]
components:
  extract_llm_sweep:
    econ_trigger: true    # without this it will almost never fire under load
    evidence: true        # co-reference index into the inventory line

econ_trigger is not optional in practice — see "Why the trigger matters" below.

What extract_llm_sweep is

A cold-sweep adjudicator. On a turn where the request's cached prefix is about to expire — or where the economics justify paying for the invalidation — it asks the request's own model, over its own cached transcript, a single question covering every candidate tool output at once: which of these are spent?

Three properties make that affordable and safe:

  • The ask carries no output content. Only an inventory line per candidate: label, tool_use id, size, and one head line to locate it. The model reads the outputs from its own prompt cache, so nothing is paid for twice. Asserted by TestThePrefixAskShipsAnInventoryAndNotTheOutputs.
  • One ask, many candidates. Judgement quality is a function of how many outputs the model compares: shown one, 6% live-kept on haiku and 14% on sonnet — both inside a drop-everything null's error bar; shown ~15, 58% at the lowest cost per output. Hence min_inventory, below which it declines rather than guesses.
  • Every failure path resolves toward keep. A drop that names an outstanding obligation is refused; an unparseable or unusable verdict keeps; a fabricated quote is counted, never acted on. Removals are marker-based and recoverable.

What this PR contributes

extract_sweep.go exists on main, but as a component that could not fire under realistic load. This PR adds the parts that let it act, and the fixes without which it disables itself:

internal/coref (new, 392 + 403 test lines) the co-reference index — which outputs have been referenced since, how long ago, how much of them was used
components/offload/coref.go (new, 482 lines) the deterministic selection component built on that index
extract_sweep.go (+679) the economic trigger (S·T > 11.5·W), approval-as-scalar ask pricing, and the evidence seam that puts the index into each inventory line
prefix_econ.go the horizon is measured on the request as the removal will leave it, in both the trigger and the pruner (#232)
internal/extract newline-delimited verdict replies are accepted instead of discarded
deploy/harbor, docs iteration runners, and the component's enablement guide

Why the trigger matters: the pre-expiry window fires on an idle clock, and any concurrently-served deployment keeps refreshing the cached prefix. not_in_pre_expiry_window was 286/286 requests in iteration 028, 378/378 in 024 and 18/18 in 022. Without econ_trigger this component effectively never runs.

Two fixes that were each the difference between acting and not:

  • The pruner's horizon was uncredited, so it pruned 8 of 9 authorised drops. After the fix: 0 of 10, and saved_tokens went 105 → 67,323 on an identical ask.
  • Approval was priced per ask count and floored at 0.05, shutting the component down after three asks. Now mass-weighted and bucketed by inventory regime.

⚠️ This PR's previous title claimed a reward result. That claim is withdrawn.

It read "+8 tasks, 0 worse, p=0.0078", from iteration 024. Iteration 028 found that iteration 024's two arms differed in how often the harness terminated an episode on a truncated response — 37/75 against 26/75, worth 14.7 accuracy points with no selection effect at all, against a reported effect of about the same size. The result is confounded and is not being claimed here.

Tests done

Run on the eval box (Go is not installed on the dev laptop) against a tree verified hash-for-hash identical to this branch's HEAD across all 207 .go files:

CGO_ENABLED=1 go build ./... exit 0
go test ./components/... ./internal/... ./schema/... ./cmd/... exit 0 — 17 packages ok, 0 failures, 2 with no test files
go vet ./components/... ./internal/... exit 0
tests in the three packages this PR changes 605

Notable coverage added or relied on:

  • The four adjudicator safety invariants, each written to fail when its subject is reverted, and each asserting a precondition first — that the reply parsed and the verdict reached the check — so a parse regression cannot turn them into vacuous passes.
  • TestPrunerHorizonIsCreditedForTheRemoval and TestAffordableDropsAreNotPrunedToOneAtHighPressure. The first fixture attempt passed for the wrong reason: it left 2,000 tokens of headroom against a 6,180-token-per-turn rate, so integer division floored the horizon to 0. Rebuilt to leave headroom worth more than one turn.
  • TestRewardPremiumCannotAuthoriseAZeroHorizon — the premium is a belief about what a removed token is worth, and must not be able to manufacture a horizon by pretending more mass left the transcript.
  • TestPrefixRewritePaysUnchangedWithoutAnAsk — coref's arithmetic reduces term-for-term to the original when there is no ask to charge.

Live behaviour, iteration 028 seed 1 (128k band, two arms differing in exactly two keys):

baseline arm A
verdicts / drops 0 / 0 176 / 105
saved_tokens 0 322,939
expand_unresolved_missing 0 0
accuracy 0.333 0.333

So it acted at scale and lost nothing recoverable. Not verified: mkdocs build --strict — mkdocs is unavailable on both the laptop and the box; the new cross-links and nav entry were checked by hand instead.

What's next

  1. Real traffic, as a measurement rather than a rollout. Enabling it on real traffic gives the two keys, the readable precondition (traffic that cannot supply ~10 candidates per request will make it decline correctly and teach nothing), and the one number that decides whether it paid: saved_tokens / incremental cache creation against 11.5. Iteration 028 realised 11.0 — break-even — with thin S and short T.
  2. SWE-bench once this merges — Measure extract_llm_sweep on SWE-bench: does a removal pay when S and T are not thin? #266. Longer trajectories and larger tool outputs raise both terms of S·T.
  3. The feature has never been measured off LOCA. Every corpus behind min_inventory, min_tokens, min_later_turns and the 6%-vs-58% curve is LOCA-derived. Thresholds and validation share one source; that is the gap real traffic closes.
  4. Iteration 028 is stopped at 1 seed of 5. Detecting the observed 4% cost difference would need 107 seeds ($6,300); the affordable resolution is an order of magnitude coarser than the effect.
  5. Three benchmark-harness defects filed low priority, none affecting shipped behaviour: LOCA rig: 25% of sonnet responses truncate at max_tokens 4096, corrupting the next tool call #267 (truncation corrupting tool calls), LOCA rig: context clearing is ENABLED but has never fired, in any pass, even 30k over its trigger #268 (LOCA's context clearing has never fired), LOCA rig: readout resolved passes by a glob that cannot match, and the obvious fix silently aliases both arms #269 (a readout glob, and why the obvious fix is worse).

🤖 Generated with Claude Code

The branch this replaces carried 97 commits against a merge base main has since
moved 295 files past. Three of its general fixes landed separately (#136 schema
shape validation, #137 the adjudicate verdict tool, #138 collapse's byte gate),
and main absorbed the prefix-ask infrastructure independently as
extract_llm_sweep. What is left is the part that was only ever about
co-reference, re-cut onto main rather than rebased: internal/coref (the index),
the coref component, and prefix_econ (the shared cache-write price).

The pre-recut history is preserved on origin at archive/coref-compaction-pre-recut
(f31b451) -- the experiment record and the refuted arms are evidence, not clutter,
and a force-push must not be the only copy of them.

Two things main required that the branch predated:

RegisterFields for coref. main added a test asserting every registered component
declares exactly its configurable YAML keys, and its motivating story is this
branch's own: an account whose extract_llm ran 251 times and acted zero times
because the two keys that decided it were not on the settings page. coref had a
constructor and no descriptors, so it was that bug waiting to happen. Each hint
carries the measurement behind the default rather than restating the field name --
including the two thresholds (closed_dist, open_reps) that are explicitly NOT
measured yet, which is why cut_closed ships off.

MarkKeptVerbatim lost its session argument. The branch had made keep-verbatim
marks session-scoped; main's are global, so a mark written by one session exempts
the same bytes in every other session sharing the store -- preferentially on
content that recurs across sessions, which is exactly the content most worth
cutting. That is a real lost-savings leak, but fixing it is a store key-format
change in state.go affecting every offloader plus a read-both-shapes migration
for marks already on disk, so it is filed separately rather than smuggled in
here. The two tests that prove the leak are SKIPPED with their bodies preserved
commented, not adapted: an adapted body would compile, read as a real test, and
assert nothing, because both sessions would share one global mark.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…trigger

main left Evidence as an explicitly empty seam ("A SEAM, deliberately empty on
`main`. There is no co-reference index here") and left a note at the candidate
append site saying that when PR #80 brings index-driven selection, "the index's
verdict belongs in the prompt as EVIDENCE for the model to weigh
(extract.AdjudicationItem.Evidence), never as a gate that pre-decides the answer."
This fills that seam on exactly those terms, and adds the second trigger.

THE EVIDENCE IS NOT A FILTER, which is the whole lesson of the
prefix_still_referenced thinner: it removed 149,681 candidates and left about one
per request, silently turning a bulk adjudication arm into the per-output shape
refuted at 6% live-kept -- while the arm reported itself as bulk throughout. It
was self-defeating twice: it starved the comparison, and it meant the model only
ever saw what the index had already judged spent, destroying the veto on the
index's exact-match blind spot that the mechanism exists to provide. So the
record goes into the inventory line and the candidate set is untouched.

The contract gains a paragraph, conditional on an item actually carrying
evidence. main's seam comment names one hazard -- a prompt teaching the model to
read counters the prompt never carries. The converse is equally real: counters
carried with no explanation invite the model to invent a reading of them. Tying
the paragraph to the data avoids both. It frames the index as a fallible witness
in its own words, because the index matches text EXACTLY: reuse in transformed
form is invisible to it, that blind spot is precisely what the model is here to
cover, and a model told the index has decided has nothing left to contribute.

THE SECOND TRIGGER IS THE CLAIM OF THIS BRANCH. main sweeps only in the
pre-expiry window. Neither trigger contains the other: pre-expiry fires on the
clock and cannot fire at all on a session whose cache keeps being refreshed --
the long agent run with the most to save -- while econ fires on mass and cannot
know how much time is left, so it must clear S*T > 11.5*W first. The price lives
in prefix_econ.go, shared with coref rather than restated, because two components
pricing the same cache-write differently would be two answers to one question.

S is an upper bound and this says so: it is the inventory's whole mass, but the
model drops only some of it, and how much is unknown until after the call the
test is deciding whether to make. W leans the other way (an unknown cache
boundary is assumed to be the whole transcript). Neither is calibrated, so
prefix_rewrite_repaid / prefix_rewrite_not_repaid is what makes the split
observable rather than assumed.

Both knobs default OFF, and a test asserts a disabled trigger reports no
decision at all -- a gate that fires when the feature is off reads, on a
dashboard, as a feature that is on and failing.

VACUITY: all five mutations were verified to fail the right test -- reverting the
trigger, reverting the evidence fill, removing only the contract paragraph,
flipping the default on, and INTRODUCING the pre-filter. That last one initially
passed, which is the finding: sweepReqStocked produces `novel=0 refs=0
later_turns=0` for every record, so a filter keyed on references removes nothing
there and the guard could not fail. Hence sweepReqCoref, which contains an output
later turns reuse character-for-character (refs=2) and one never mentioned again
(refs=0). The guard now catches the thinner at 11 candidates against 12.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
The evidence base for this branch's claim, re-cut with three corrections main's
conventions require.

LINKS INTO docs/proposals/ ARE NOW PROSE, 26 of them. main excludes proposals/
from the site with a documented rationale -- design rationale addressed to whoever
changes the code next, "useful in review, actively confusing on a page a user
reaches looking for how to configure something" -- and its own published pages
follow that by naming such files in backticks rather than linking them
(components/extract_llm_sweep.md does exactly this for sweep-adjudicator.md).
Every link from a published page into an excluded one is a `mkdocs build --strict`
failure, so these were converted rather than left to CI.

Two broken links FIXED rather than carried over: iter014's preregistration linked
../iter013/PREREGISTRATION.md, which does not exist (iteration 013 has only a
results page), and iter010's results linked iter011/PREREGISTRATION.md without
climbing out of its own directory. Both predate this port; both would fail strict.

min-tokens-vs-economic-gate.md updated in place, because its subject moved.
It was written when one-call adjudication was a `selection_mode: merged` option on
extract_llm, proposed here and not yet on main; it shipped instead as a separate
component, extract_llm_sweep (#118), which is now on main. The argument does not
change -- extract_llm_sweep makes one call per request, so pricing a candidate
against the cost of a whole call is wrong there by the same two to three orders of
magnitude -- but the page is no longer a warning about an unmerged option, it is a
description of an interaction between two shipped components, and it now says so.

The nav gains all 29 experiment pages, not the 8 the pre-recut branch listed.
main's nav comment states the invariant ("Every page under docs/ appears exactly
once") and iterations 007-021 were reachable only by URL, including iteration 021,
the one this branch's claim rests on.

Preregistrations are left exactly as written, including the one that references a
design this port supersedes. They are dated records of what was predicted before a
run; editing them to match what shipped would destroy the only thing they are for.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
They said "filed separately" before the issue existed. A skip reason that names no
issue is a skip nobody can act on.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…shipped baseline

Written before the run, and before the binary is frozen, which is the control
iterations 014, 016 and 018 lacked and the reason none of them can be compared to
each other.

It opens by stating what iteration 021 did NOT establish, because that decides
what this one may claim: 021 was a null on its primary endpoint (clustered
p = 1.0000, 14.00 vs 15.00 solves, +2% cost), its pre-registered reading for that
outcome was "close merged", and `coref` was in neither of its arms. What 021 did
move was operational -- errors 17->10, summarize 71%->56%, requests -28%, 6.5M
tokens removed with 0 unresolved. So this iteration measures the operational
result and carries reward as a HARM GATE only, with the blocking bound declared in
advance per iteration 007's failure.

Three arms, alternatives rather than a stack. B turns on the sweep's evidence and
econ_trigger -- PR #80's merged design, where the index informs and the model keeps
the veto. C adds the coref component, the zero-LLM cutter. They are not combined
because coref leaves markers and the sweep skips marked content, so coref upstream
would hide its own cuts from the model: structurally the prefix_still_referenced
thinner that left about one candidate per request and silently turned a bulk arm
into the per-output shape refuted at 6% live-kept.

Band moves to 32k. At 128k, 11 of 15 tasks scored zero in BOTH arms, so nothing
could have been detected there whatever the configuration. Iteration 008 measured
52.7% at 32k against 33.3% at 64k, and signed-rank power peaks near a 50% base
rate. Stage 0 runs seed 42 only, 15 runs per arm, which 008 also validated (52.7%
over 75 configs against 53% on state0 alone).

The primary endpoint is turns-and-wall-clock SPLIT BY RUN OUTCOME. Iteration 021's
-28% requests is the strongest number it produced, but its own text attributes it
to fewer runaway sessions and its arm B also errored 7 fewer times -- so the drop
may be "failed less" rather than "solved faster", and an end-user latency claim
needs exactly that split. 021 could not make it.

Two shipped defects are carried deliberately and recorded so they are not mistaken
for errors in this file: #134 (pinning min_tokens/trigger makes shouldFire return
true unconditionally, so housellm's tail pass fires every request -- and since it
leaves markers the sweep skips, it can progressively starve arm B) and #120 (the
tail floor is 3000 where the comment above it derives 8000 and calls anything below
measurably a loss). Both are identical in all three arms, so neither can bias B-A
or C-A, and both become measured endpoints instead of config guesses.

The run does not start until a four-part pre-flight passes, including that the
sweep is actually offered candidates -- because the venv was rebuilt with --no-deps
and because the two rig failures this box has already produced "look like a result
rather than a broken rig: tasks run, requests flow, numbers come out."

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…a dead arm

The pre-flight did its job and the arm it was gating would have measured nothing.

Arm B at 32k reported prefix_rewrite_repaid = 0 and prefix_rewrite_not_repaid = 0.
Not a refusal -- the branch's headline trigger was never REACHED. The
min_inventory early return sits above the econ decision, so an inventory below the
floor short-circuits the trigger before it is evaluated.

min_inventory 10 is unreachable on this benchmark, and that is measured rather than
argued: across 710 tool outputs the median is 59 tokens, p75 is 1,187, and the
shipped floor of 1000 yields 4.0 candidates per request. Dropping the floor to 100
only reaches 5.9. No floor makes 10 -- it was calibrated on production Claude Code
traffic, where a tool output is large. So the floor moves to 3 in ALL THREE arms,
with min_tokens left at the shipped 1000 so the candidate population is unchanged.

Band moves to 64k. Trigger one cannot fire under benchmark load at all
(not_in_pre_expiry_window 18/18) because eight workers never leave an idle gap for
a cache entry to approach expiry. That is convenient rather than merely tolerable:
with pre-expiry inert, arm B isolates the econ trigger cleanly, since econ is only
consulted when pre-expiry did not fire. Stage 0's endpoints are operational and
mechanism counters, none of which need reward headroom, so 64k costs nothing --
and iteration 008 already prescribed this split. Reward stays a 32k question.

The econ arithmetic was then checked OFFLINE, for free, before committing money:
over 33 paired requests, with W taken pessimistically as the whole transcript, S
must exceed 5,400-9,100 tokens and 25,000-33,655 are available. T lands at 31-43
because per-turn growth is small against a 64k window, and T is what carries the
inequality. Three to four times margin. That is feasibility, not yield.

Frozen inputs recorded: cg-i022-proxy-v01, sha256 d5bb9558..., commit 143cf73.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…not a copy

stage022.sh and run022.sh existed only on the eval box, which is exactly how
iterations 014, 016 and 018 became mutually incomparable: the thing that decided
what ran was not in the repo.

stage022.sh descends from stage-sab.sh with four deliberate differences. ONE BINARY
and three configs, because the code is identical across arms here and only the yaml
differs, which is what makes B-A attributable. BAND is a parameter that sets the
declared window AND LOCA's clearing threshold together -- a proxy told 64k while
LOCA clears at 32k measures a pressure curve nothing else shares, and separate
knobs invite exactly that. Paths are under ~/ because /tmp is on a 10-day cleaner
that already destroyed one iteration's frozen binary. And it refuses to start if
npx is missing from PATH, because nvm's shims are absent from a non-interactive ssh
PATH and the filesystem MCP server then vanishes silently -- a run that looks like
a result rather than a broken rig.

run022.sh interleaves BY ARM across three passes of five tasks. Sequential-by-arm
would put arm C two to three hours after arm A, so any drift in gateway latency or
model behaviour over the night would load entirely onto whichever arm ran last.
Round-robin spreads it. It also yields a complete paired comparison on five tasks
after pass 1, which is the earliest point an honest direction check is possible.

Both kill by PID only. A kill pattern naming the binary also matches the killing
shell's own argv, which is not theoretical: it killed one of my own shells earlier
today, and the shared box makes a broad pkill unacceptable regardless.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…atency claim does not

45 runs, three arms, 64k, and the first iteration in this series with a clean
error column: 0 errored runs and 0 HTML 400s in every arm. That matters because
errored runs score 0 in ITT and had been the dominant noise term.

THE MECHANISM GATE PASSED, and that is this iteration's real product. The
pre-flight had both econ counters at 0/0 -- the trigger was never reached. After
amendment 1 it was evaluated 30 times and repaid 30 times, with 0 declines, 30 real
adjudications, 0 unparseable replies, and an index record for every candidate.
coref acted 391 times, so min_batch_frac clears at 64k. The offline feasibility
estimate (3-4x margin) was not merely directionally right.

THE LATENCY CLAIM DOES NOT REPLICATE, and this is the endpoint iteration 021 could
not produce. Turns per run, split by outcome: arm B is 18.9 against A's 20.7
overall, but among SOLVED runs it is 20.1 -> 19.8, a 1.5% difference inside noise,
while among UNSOLVED runs it is 21.1 -> 18.5. B also solved fewer tasks. So the
shape of B's efficiency is giving up sooner on tasks it fails, not solving faster.
Iteration 021's -28% requests was read as a latency win; its own text attributed it
to "fewer runaway sessions" and it could not distinguish the two. Measured with the
split it lacked, on a run with ZERO errors, the gain is on the failure path.

On wall clock the direction is worse rather than absent: B adds 1,396 ms per
request against A's 203 ms -- about 1.2 s on every request -- to buy 1.5% fewer
turns on the runs that matter, at 10x its own model spend. Arm C went the other
way: +26% turns and 62% more LOCA cost.

REWARD IS NULL BOTH WAYS and the pre-registered harm gate blocks both arms: B is
-2 solves (p = 0.6250, bound 48.1%), C is +1 (p = 1.0000, bound 31.9%), against a
25% blocking threshold declared before the run. The structural fact this exposes is
more useful than either p-value: at n=15 with one seed the best achievable bound is
21.8%, with ZERO worsened pairs. This design can essentially never license a
positive claim, which is the argument for five seeds rather than more tasks.

One defect filed rather than footnoted: expand_unresolved_missing = 60 in Cp1
against 0 everywhere else -- 60 of that pass's 112 expand calls unresolvable, in
the pass that was also arm C's worst. An unresolvable expand is the one failure the
reversibility invariant exists to prevent, and the correlation is unexplained.

Also recorded, both firsts: extract_llm_sweep as SHIPPED never fires under
continuous load (its only trigger needs an idle gap, and 8 workers never leave
one), so arm A's sweep is inert and B-A is "a sweep that runs" versus "a sweep that
cannot"; and sweep_answered_via_tool is 0 against via_prose 30 -- the verdict tool
#137 added is offered every time and never used.

The index row for iterations 016-021 is still missing from experiments/README.md;
that gap predates this commit and is not addressed here.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
… and why

David asked how much summarization was deferred. The answer is that it was
deferred completely and not by the treatment: summarize acted 0 times in 986
requests, in all three arms, every record verdict "declined", and it is in
top_passthrough in all nine snapshots. So iteration 021's clearest operational
result -- summarization falling from 71% to 56% of requests -- cannot be measured
in this iteration at all, even though summarize was kept in the baseline
specifically to make it measurable.

It was not the trigger. 129 of arm A's 311 requests cleared min_request_frac 0.78
and requests reached 228k-453k tokens, so summarize was eligible and declined
anyway.

The likely cause is collapse, which this iteration added. It acted 195/95/212 times
per arm; it is documented as the last-resort catch-all for anything still
oversized, it leaves a marker, and summarize skips marked content while protecting
keep_last. Iteration 021 had no collapse and summarize fired on 71% of requests.

That makes two results reported in this file one intervention rather than two, and
the trade is now stated as one: adding collapse bought the clean error column (0
errored runs, 0 400s, against 17 and 10) AND cost the summarize endpoint. collapse
was chosen as a shared control because being identical across arms means it cannot
bias B-A or C-A. That reasoning holds and is not the mistake. The mistake was not
checking whether it left summarize any substrate.

Recorded as a HYPOTHESIS, because the component records carry no gate field and
"declined" is therefore unattributed in this run's data. Confirming it needs
gate-level logging for summarize or a fourth arm identical but for collapse. The
opening status line is also amended so the clean-error claim no longer stands
without its cost attached.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…treatment attribution

David asked whether an arm whose sweep acted 11 times can mean anything. It cannot,
and the answer invalidates an attribution this file was making rather than merely
qualifying it.

The sweep acted 11 times: 30 econ firings, 30 asks, 132 candidates offered, 132
verdicts, 11 asks that removed anything, 187,472 tokens. Eleven removal events over
284 requests and 15 runs cannot carry a -2 solve difference or a turn profile.

Meanwhile the same arm carries a 93-event swing that is NOT the treatment:
extract_llm acted 108 times in B against 15 in A, 38.0% of requests against 4.8%,
saving 1.19M tokens against 0.32M -- on a byte-identical config. Since extract_llm
runs before collapse, it is extract_llm and not the sweep that halved collapse
(3.10M -> 1.49M truncation savings). So the collapse reduction is real, and it is a
deferral of the wanted kind -- blunt truncation displaced by model-guided
compaction -- but it is not attributable to evidence or econ_trigger.

Why extract_llm swung 7x on an identical config is unexplained. It is not the
pressure trigger, which #134 forces on in both arms.

So section 2's turn numbers stand as measurements and the outcome split is still
the right way to read them, but the claim that B's turn profile is a property of
the merged design is withdrawn. A clean B-A needs extract_llm controlled, most
simply removed from all arms given #134.

What IS attributable is recorded in a new section 2c. Coverage was 132 of 132
verdicts -- 100% at mean batch 4.4 -- against iteration 021's 61% at batch 12,
confirming at n=132 candidates the smaller-batch lead that 021's own conclusion
named on a 6-of-6 probe. Coverage is a property of the ask, so it does not depend on
trajectory.

The latency question is also answered: it is the sweep, at 15.2 s per ask.
extract_llm_sweep.duration_ms is 454,661 ms against arm A's 35, which is 1,601 ms
per request amortised over 284 and accounts for the entire cg_added_ms_avg gap of
203 -> 1,396. Nineteen of the thirty asks returned "keep everything", so ~290 s of
it bought nothing.

And one anomaly that deserves its own issue: 40% of every ask is paid FRESH -- mean
42,409 cache-read plus 28,764 fresh. A prefix ask appends a question to a
byte-identical prefix, so fresh should be little more than the question. The likely
cause is self-inflicted, each removal mutating the prefix so the next ask no longer
matches the cached one, which would make the mechanism more expensive the more it
succeeds. That is the design's central economic premise and it is not behaving as
designed.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
… overstated claims

David asked to dive into the fresh-token anomaly and fix it, and to say whether the
4.4-vs-12 batch size was configuration or the band. Both answers required
correcting this branch's own record.

THE BATCH SIZE IS CONFIGURATION, NOT THE BAND. The cap is maxAskItems = 12 here and
was 12 in iteration 021, so the gap is candidate availability, and availability is
set by the sweep's floor. Measured on arm B's own traffic -- 6,708 tool outputs,
23.6 per request -- min_tokens 1000 yields 4.5 candidates per request (matching the
observed 4.4), 300 yields 8.6, and 100 yields 11.6, at the cap. So 64k does supply a
batch of twelve and the 1000-token floor excluded it; iteration 021 reached twelve
because its extract_llm ran with min_tokens unpinned. This partly confounds the
coverage result: batch size and the rest of the configuration moved together, so the
honest claim is "coverage was 100% at batch 4.4", not "a smaller batch fixed
coverage". Re-measuring coverage at batch ~12 is one config line and is the most
informative cheap follow-up available.

THE FRESH-TOKEN CLAIM IS WITHDRAWN. An earlier version of results.md called it a
defect and proposed that each removal mutates the prefix so the next ask misses
cache. Investigation does not support it: prefixask.go already sends the previous
turn's SENT body rather than the incoming one for exactly that reason, and
sweep_no_prefix was 0 across all 30 asks, so the stash never went missing and the
1.5 MB cap was never hit. Two explanations remain and this run cannot separate
them -- the benign one being that Anthropic caches only to the last cache_control
breakpoint and cg.cache_boundary saw only 2, consistent with LOCA marking system
blocks alone rather than the last content block as Claude Code does, in which case
the uncached tail is expected.

WHAT IS ACTUALLY DEFECTIVE is that the question was unanswerable at all.
cg.sweep.ask is the only record carrying the ask's economics and it had no session,
so it could not be joined to the request that produced it. This adds session,
max_cached_idx, req_tokens and messages -- the two candidate causes are
distinguished by the boundary and the request size, both already in hand at the call
site.

The test asserts the RENDERED line rather than reading the call site, because a
field passed but dropped by the handler is the failure worth guarding. Verified to
fail on all four fields when the instrumentation is reverted.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
David asked why lowering min_tokens RAISES the candidate count, expecting the
opposite because twelve candidates carry more tokens than four. Both halves are
right and the table now shows why they are not in tension.

min_tokens is a per-output BAR, not a budget: it asks of each tool output whether
that one output is big enough to name. Lowering it can only admit more, and
monotonically -- the candidate set at 100 is a strict superset of the set at 1000.
Arm B carried 23.6 tool outputs per request and the 1000 floor named 4.5 of them.

The mass does rise, as expected, but barely: 38,077 -> 41,001 tokens per request
against 4.5 -> 11.6 candidates. +155% items for +8% mass, because the newly admitted
outputs are by definition the smallest -- the 2,007 additions between 100 and 1000
average 414 tokens against 8,370 for those already in.

That difference in rates is what decides the purpose of a lower floor. In a prefix
ask the model reads each output from cache, so naming one more candidate costs one
inventory line, ~30 tokens, not the output. A lower floor therefore buys peers to
compare against almost free, which is the axis the mechanism lives on -- 6%
live-kept at a batch of one against 58% at ~15 -- while buying almost no removable
mass, and a dropped 414-token output leaves a descriptor behind so its net recovery
is smaller still. This is the same effect docs/results/min-tokens-vs-economic-gate.md
records from the economic gate's side.

Also corrects a figure I gave earlier: floor 300 reaches a batch of 8.6, not ~12.
Matching iteration 021's twelve needs floor 100.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…_tokens doing two jobs

min_tokens was deciding two unrelated things at once: which outputs are worth
NAMING in the inventory, and whether a drop is worth its cost. Those want opposite
settings, and the second was winning.

Naming is nearly free. The model reads each output from the cached prefix, so one
more candidate costs one inventory line -- on the order of thirty tokens, not the
output -- and more candidates is the axis this mechanism lives on: 6% live-kept
shown a single output against 58% at ~15. But a high floor was the only thing
standing between the model and an expensive drop, so it had to be set for the
second job. Measured on iteration 022: the shipped floor of 1000 named 4.5 of the
23.6 tool outputs a request carried, holding the batch at 4.4 against a cap of 12.
A floor of 100 reaches 11.6 candidates for 8% more mass, because the outputs it
admits average 414 tokens against 8,370 for those already in.

SIZE WAS THE WRONG DISCRIMINATOR ANYWAY. A drop's real cost is not its marker --
tryMark already refuses, marker-inclusive, any drop whose replacement would not
shrink the message. It is the cache-WRITE that mutating the prefix forces, charged
over the span from the EARLIEST dropped index to the cached boundary, once per pass.
So a small output dropped after something already being dropped costs its
descriptor and nothing more, while the same output dropped earlier than everything
else sets W for the whole batch and must repay the entire rewrite alone. Depth
relative to the rest of the batch decides, and a size floor cannot express that.

selectAffordableDrops walks the votes latest-first, accumulating, and picks the
subset maximising S*T - 11.5*W. Maximised rather than thresholded because the
objective is not monotonic in k: one early, tiny drop can extend W past what
several later ones repay. prefixRewriteNet exposes the terms because choosing a
subset is an optimisation, and a bool cannot be maximised.

ONLY ON THE ECON PATH. The pre-expiry window fires precisely because the prefix is
about to expire, which makes W nearly worthless; pruning there would forgo real
savings to protect nothing. Under pre-expiry every vote is applied, as on main.

VACUITY: both mutations verified. Making the selector a no-op fails the tiny-early-
drop test (kept=3). Removing the !preExpiry guard fails the pre-expiry test with
drop_unaffordable_pruned:11 -- but only after that test's fixture was tightened.
Its first version used preExpiryCtx's default 1M window, where every drop is
affordable, so removing the guard changed nothing and the test passed vacuously.
At 40k the window is tight enough that anything surviving does so BECAUSE of the
guard.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
Two corrections to iteration 022's arms, both derived rather than tuned, plus the
runner.

extract_llm IS UNPINNED. Iteration 022 inherited housellm verbatim, which pins both
a per-output floor and a trigger threshold. Either sets `explicit`, and shouldFire()
then returns true unconditionally, so the warm path fired on every request -- and
its pinned floor sat below the 6,250-token break-even the preset's own comment
derives, so it fired below cost as well. That is #120 stacked on #134, and the
analysis is now posted on #120. Unpinned, the derived pressure trigger governs and
pressureFloor derives the per-output floor from pressure instead of from a constant
that has to be chosen per workload.

It is also the change that makes arm B interpretable. extract_llm acted 15 times in
iteration 022's arm A against 108 in arm B on a byte-identical config, dwarfing the
sweep's 11 acts. Per session it was concentrated -- 3 of 15 sessions in A, 8 of 15
in B, two sessions holding 67 of B's 108 -- so the aggregate is a high-variance
statistic at this n rather than a systematic effect. Unpinning does not remove the
variance, but it removes the forcing that guaranteed the component ran every turn.

THE SWEEP FLOOR DROPS TO 100. That knob was doing two jobs, and
selectAffordableDrops now owns the second, pricing a drop on depth relative to the
batch. So the floor is free to serve naming, and naming is what sets batch size:
measured on iteration 022's own traffic a floor of 1000 named 4.5 of the 23.6
outputs a request carried, holding the batch at 4.4 against a cap of 12, while 100
reaches 11.6 for 8% more mass. That makes iteration 021's coverage result -- 61% at
batch 12 against iteration 022's 100% at 4.4 -- directly testable, which it was not
before, because batch size and the rest of the configuration had moved together.

Starting at ONE seed to analyse before committing to five. Five is what a reward
claim needs: at n=15 the Clopper-Pearson floor is 21.8% with ZERO worsened pairs,
against a 25% blocking bound, so 15 pairs can essentially never license a positive
result whatever the effect.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…nd hardens

Coverage held at 99.8% (643 of 644 verdicts) as the batch grew from 4.4 to 6.7, on
5x the candidates and 2.3x the tokens removed, with 96 asks against 30. That is the
question the iteration was launched to answer, answered in the direction the design
wanted. The affordability rule added this week also fires -- 5 prunes, only in the
arm where the econ trigger runs -- so depth bites on real traffic rather than merely
being implemented.

But arm B is still confounded and now systematically rather than noisily.
extract_llm ran in all three arms on an identical unpinned config and its pressure
trigger fired only in arm B: 0 acts in A, 0 in C, 239 acts and 101 extraction calls
in B, across 1,135 component runs. Iteration 022 could read its 15-vs-108 swing as
variance concentrated in a few long runs; a perfect 0/239/0 segregation is not
variance. Unpinning removed the #134 forcing as intended and in doing so exposed a
systematic interaction, whose obvious direction is wrong -- the sweep removes
content, which should lower pressure and make extract_llm fire LESS.

Two candidate mechanisms are recorded and neither is established. Markers plus
expand does not survive arm C, which leaves markers too (68 coref acts) and shows
zero. The economic gate is the likelier one: it prices candidates by position
against cache state, and the sweep mutates the prefix, changing max_cached_idx on
later turns. That is testable from this run alone now that cg.sweep.ask carries the
boundary.

Reward is null both ways again -- B +1 (p=1.0000, bound 40.5%), C 0 (p=1.0000,
bound 31.9%) -- both blocked by the 25% harm gate, as iteration 022 predicted any
single-seed design must be. Arm A fell from 7.00 to 5.00 because unpinning made
extract_llm inert in it, so this baseline is a different configuration and no
cross-iteration comparison should be drawn.

Recommendation: the mechanism results justify five seeds, the arm design does not
yet. Settling the 0/239/0 split costs nothing and is a prerequisite.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…he latency attribution were both wrong

Section 3 said arm B was "still confounded" and charged it 5,452 ms per request.
Both are withdrawn, and the trace that withdrew them is now in the file.

The hypothesis is REFUTED, not merely unconfirmed. It held that the sweep mutates
the prefix so content the other arms skip as cached_prefix becomes tail-eligible in
B. cg.extract_llm already carries the boundary, so it was directly testable:
maxCachedIdx medians are 31.0 / 34.0 / 38.5 across A / B / C, B sits between the
other two, and the boundary was never unknown in any arm. If the sweep were moving
it or pushing the cache cold, that is where it would show.

The trace then found the counters contradicting each other. The same arm and run has
components.extract_llm.acted 239 and extract.calls 101, while cg.extract_llm reports
cands 0 on ALL 374 records -- 692 across both arms checked, no exceptions. cands is
len(cands) after the gate loop, so 0 plausibly means nothing survived, consistent
with skip_tail absorbing 7,487. A component with no surviving candidates cannot make
101 calls. The sweep made 96 asks in that arm, close to the 101, and saved_tokens
6,077,421 against unique 597,764 is a 31.58x overcount, the signature of replays
counted repeatedly. So the 59s latency and the -$1.162 are probably the SWEEP's
figures, which is why attributing 5,452 ms/request first to the sweep and then to
extract_llm was wrong in both directions.

Filed as #176 (counters disagree) and #177 (no per-call record to arbitrate them).

What survives of the 0/239/0 split is only the replay explanation: 2,291 replays,
2,291 calls_avoided, 10,538 cache lookups at a 66.8% hit rate, arm B only. The
sweep populates the shared extraction cache and the tail pass replays its verdicts.
That is the treatment persisting, not an independent confound.

Sections 1 and 2 are unaffected: coverage, batch, prunes and removed tokens all come
from cg.sweep.ask, which is per-ask and self-consistent.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…d, and the -$1.162 is neither component's

The earlier text guessed the extract nested map "is not scoped to one component"
and concluded the 59s latency and the -$1.162 were probably the SWEEP's figures.
#178 root-caused it and the guess was too kind.

The map was process-GLOBAL: one set of package-level atomics that both extract_llm
and extract_sweep wrote every field of, so calls, avg_latency_ms, calls_avoided and
the whole net-value block were two components with opposite economics summed under a
name that reads as one of them. extraction_cost_usd was wider still, derived from
cheapmodel.Usage(), which catches every cheap-model call in the process including
summarize and agentdiet, priced through the haiku card even though the sweep asks the
request's own frontier model. So the -$1.162 is two components' savings against
three components' spend at one component's rates -- neither the sweep's figure nor
the tail pass's. Pooling happened at write time, so no re-reading of these logs can
repair it.

Two corrections to the analysis this file carried. cands: 0 was NOT the wrong side --
a frozen replay continues before its candidate is appended, so cands: 0 on all 692
records and acted: 239 are consistent and both true, and extract_llm acted 239 times
without one fresh call. And the 31.58x overcount is not a defect at all; it is the
designed cumulative-versus-unique contrast, correctly left alone.

One side finding recorded because it has behavioural teeth rather than merely
display: tooSlowToExplore read the GLOBAL p50, so the sweep's ~59s asks were braking
extract_llm's cheap-model exploration. The tail pass's firing behaviour in this
iteration was influenced by the sweep's latency through a channel nobody was
watching.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…ttribution

The branch needed #178 before iteration 024 could run: a binary built from this
branch carried the OLD pooled extraction counters, so the run would have reproduced
exactly the unattributable cost and latency numbers iteration 023 spent a day
root-causing.

components/offload/extract_sweep.go changed on both sides and git auto-merged it. The
resolution was verified rather than trusted, because a clean auto-merge of one
function can compile and still be wrong. Both sides' work is present and reachable:

  from main   defer foldFallback() with the NAMED result (_ []int, r sweepResult) --
              the named result is load-bearing, since a deferred mutation of a local
              is discarded after the return value is copied, which is what made the
              obvious version of that fix inert;
              recordLeg / runFallback booking each fallback leg.

  from here   selectAffordableDrops still called on the econ path only, at the same
              point between adjudicate() and the freeze/splice loop;
              evidence and econ_trigger still read;
              coref.Index still filling the evidence seam.

gofmt clean, CGO_ENABLED=1 go vet clean, go test ./... green across 28 packages on
the eval box against the merged tree.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…sured for the first time

Written after launch but before any number is read, and committed with the frozen
inputs and the reading table before the first arm-seed completes. Anything read
earlier than this commit is inadmissible.

Iterations 022 and 023 established that the mechanism works -- coverage 99.8% at
batch 6.7, 96 asks, 426,638 tokens removed, the affordability rule firing. Cost and
latency were never measured, because two defects made them unattributable. The
extract counters were process-global and both components wrote every field, so
latency and net value were two components with opposite economics summed under one
name (#178, merged here as be79553). And cheap_model_price_unconfigured fired ONCE
PER REQUEST in every arm of 023 -- 333/389/413 -- because the gate reads
CHEAP_MODEL_PRICE_*, which the rig never set, so every allow/suppress decision in
both iterations was taken against list rates rather than the operator's card. Now
exported; a probe confirms the gate at 0 over 6 requests.

Two arms, five seeds, 150 runs. The coref cutter arm is dropped -- 5.00/15 twice and
no cost story pending makes it the least informative dollar in a run about cost.

extract_llm stays IN, reversing 023's plan to remove it. Its 0/239/0 split is not a
confound: it runs through the shared extraction result cache, where the sweep's
putResult populates entries the tail pass then replays (2,291 replays, 2,291
calls_avoided, 66.8% hit rate, arm B only). That is the treatment's own decisions
persisting. With the accounting fixed, acted_fresh vs acted_replay can measure that
interaction instead of designing around it.

Five seeds is the point rather than a luxury: at n=15 the Clopper-Pearson floor is
21.8% with ZERO worsened pairs, so no single-seed design can clear the 25% harm
gate -- both prior iterations were blocked by arithmetic, not evidence.

The reading table includes a failure row the earlier iterations lacked: if
cost_source reads anything but `component`, the primary endpoint has FAILED and no
cost conclusion may be drawn. That is to be checked on the first completed arm-seed,
not at the end.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…t, and cost measured honestly

150 runs, 2 arms x 15 tasks x 5 seeds at 64k.

REWARD: significant on the governing test with zero tasks regressed. Clustered over
15 tasks, net +2.00, 8 better and 0 worse, p = 0.0078. Per-pair over 75 pairs, net
+10, 13 improved against 3 worsened, p = 0.0213. Arm A 36.00/75, arm B 46.00/75.
Iteration 021's equivalent was p = 1.0000.

The harm gate cleared for a structural reason rather than a lucky one: at n=15 the
Clopper-Pearson floor is 21.8% WITH ZERO worsened pairs, so 022 and 023 were blocked
by arithmetic, not evidence. Five seeds put n at 75 and the bound at 11.2%. That is
what the seeds bought.

COST: cost_source reads `component` on every arm-seed, so the pre-registered primary
endpoint passed and these are the first attributable figures. The sweep spends $20.26
and books $0.72 of gross value -- 2.4M removed tokens bank at cache-read rates -- for
a net of -$19.53. extract_llm earns $11.58 at zero cost. Combined -$7.95, about
-$0.11/run or 9% on LOCA's $1.13/run.

The mechanism's return does not appear in its own token ledger; it appears in reward.
-$19.53 of measured loss bought +10 solves.

And two caches turn out to be one: the sweep's putResult writes into the extraction
result cache keyed by content id, extract_llm reads that same cache for its own
reason, so the sweep's paid decisions become the tail pass's free hits -- 4,749 calls
avoided at a 99.2% hit rate, 364 acts, zero fresh calls. That recovers 57% of the
spend. Stated carefully: the sharing is measurable, nothing shows the economic
consequence was intended, and it was invisible before #178 pooled counters were split.

LATENCY: the hypothesis is REFUTED, not merely unsupported. Paired turns are 24.1 vs
29.4, and on the 33 pairs where BOTH arms solved, still 29.3 vs 33.2 -- 13% more
turns on comparable work. Composition explains about half the gap and not the rest.
The mechanism buys accuracy by letting the agent work longer on a managed context.

The pre-registered reading table's row for this outcome is half right and is amended
in the file: it treated reward as a harm gate rather than a possible finding, and the
honest statement is that the mechanism does not pay in tokens and does pay in reward.

Not a claim about the shipped configuration: the arms run min_inventory 3 and sweep
min_tokens 100 against shipped 10 and 1000. Not a claim about coref-the-component,
which was in neither arm.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…anism, and promote the unresolved expands

David asked how the sweep's decisions can feed extract_llm when the tail pass runs
BEFORE the sweep within a request. It cannot, and the earlier text asserted a
mechanism it had not verified.

What stands is the accounting: extract_llm books $11.58 at $0.00 from 0 fresh calls
and 364 replays, arm B only, 4,749 calls avoided at a 99.2% hit rate, and the sweep
is the only writer to that result cache. The entries come from the sweep across
turns.

What is withdrawn is the path. Two candidate cross-turn paths were checked and both
are closed by the counters. Expand-restore fails because expansion IS far higher in
arm B (kept_verbatim_after_expand 9,478 against 3,522) but that gate makes
extract_llm SKIP expanded content rather than compact it. The tail/prefix boundary
moving fails because cached_prefix dominates at 29,302, so candidates are
overwhelmingly skipped as not-tail. So the recovery is real in accounting and
unexplained in mechanism -- which matters commercially, since 57% of this
configuration's cost recovery rests on a behaviour nobody has identified in a cache
neither component documents sharing.

And the check surfaced something weightier, now a numbered section rather than a
footnote: expand_unresolved_missing is 175 in arm B and 0 in arm A. The agent asked
for removed content back 175 times and did not get it -- the one failure the
reversibility invariant exists to prevent. Not new either: iteration 023 recorded 60
in its Cp1 pass, against 0 elsewhere, in that iteration's worst-scoring pass.

It does not invalidate the reward result -- 8 tasks better, 0 worse, harm bound
11.2% -- but it raises a question that must be answered before any production claim:
whether the mechanism wins partly by removing content irrecoverably. A drop the agent
can undo and one it cannot are different products, and the reward number cannot tell
them apart.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
#187, not refuted

An earlier draft called the latency hypothesis "refuted" on the strength of arm B
taking 13% more turns on the 33 pairs where both arms solved. That was too strong.

Section 2b records 209 unresolved expands in arm B against 0 in arm A -- about 2.8
per run against roughly 33 turns per run. Every one is a turn the agent spent asking
for removed content and receiving a placeholder, possibly asking again. That can
account for a meaningful share of the 13%, so the turn penalty cannot yet be
attributed to the mechanism rather than to the defect now filed as #187.

Corrected to "not supported, and partly attributable to a reversibility defect", with
the explicit note that no latency claim should be made in either direction until a
re-run after the fix separates them.

The reward result is unaffected and remains conservative: arm B won 8 tasks to 0 at
clustered p = 0.0078 while carrying the same 209 failed expands as a handicap.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
… and it is a shared result cache

David asked what happened to the unexplained recovery channel. It is explained, and
the answer was in a comment: store.ResultPrefix is documented as "extract_llm's
replayed result", and the sweep's drop path writes into it through putResult --
putResult and getResult being shared helpers in components/offload/state.go keyed
cg:res:<session>:<content-id>. One cache, two writers, by construction rather than by
collision.

That resolves the ordering objection an earlier draft foundered on. extract_llm runs
BEFORE the sweep within a request, so the sweep cannot feed it in the same turn; the
cache is content-addressed rather than positional and persists across turns, so
extract_llm need not have seen the content first -- only encounter a content id on a
later turn that the sweep already ruled on.

And the control flow narrows which ids those are. The marker skip is at
extract_llm.go:848 and the cache lookup at :868, so a marker-bearing message never
reaches getResult. All 364 replays were on unmarked content, which leaves the same
content recurring at a fresh position -- routine agent behaviour, and consistent with
a 99.2% hit rate.

The two previously-checked candidate paths are recorded so they are not re-proposed:
expand-restore dies on kept_verbatim_after_expand (9,478 against 3,522, and that gate
SKIPS rather than compacts), and the boundary-moving theory dies on cached_prefix
dominating at 29,302.

The consequence for cost is not reassuring and is stated: the cg:res: entries are
pinned so #187 never touched them, but #188 REFUSES removals when the payload reserve
is full, and no removal means no putResult and no replay. The recovery therefore
scales with how often the sweep acts and moves in both directions under that fix -- a
5,000-entry store admits more, refusals suppress more. The -$7.95 should not be
expected to reproduce.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…ee, and a drop is not a compaction

Two caveats from the #188 review thread, recorded so neither lives only in a message.

SEMANTICS. extract_llm stores a compaction -- a property of the content, reusable
wherever that content appears. The sweep stores a DROP, "spent for this transcript's
obligations", which is why it never publishes to the cross-session cg:xres:
namespace. A replay therefore applies an obligation judgement as a content
projection, at a fresh position, possibly many turns later.

The hazard is not staleness in general but its direction: recurrence is evidence
AGAINST spentness. Replays land only on unmarked content, so the ids are content
reappearing at a fresh position, and content reappears because the agent re-ran the
command or re-read the file -- which it does because it needs it now. So the replay
applies "was spent when the sweep looked" exactly when the agent has demonstrated
renewed need, against a contract defining spent as needed for none of "the step you
are on right now". If a tag is added it should distinguish compaction from drop,
which carries meaning, not component from component, which does not.

COST. This section recorded the channel as $11.58 at $0.00. But the replay reaches
apply WITHOUT passing the cache-tail depth gate (replay at :890, gate at :932), and
that bypass is justified per-MESSAGE -- "this session already sent these compacted
bytes" -- while the lookup is keyed per-CONTENT. At a fresh position the provider
holds the ORIGINAL, so splicing the compaction changes cached bytes and forces a
cache-write of the suffix: a real cost on a ledger extract_llm does not carry, and
the same cost the sweep's econ trigger prices at 11.5x a cache read.

All 364 replays are in that category -- the marker skip at :848 precedes the lookup
at :868 -- so this is the whole channel, not a tail. If it holds, the 57% recovery is
not free, only charged where nobody was reading.

It cannot be settled here: cache_read_tokens, cache_write_tokens and
fresh_input_tokens all read 0 in every arm-seed, unpopulated in this build rather
than measured as zero. A re-run with those live settles it against arm A, where no
replays exist.

In the channel's favour, review established the BYTES ARE IDENTICAL: a sweep record
replayed by extract_llm writes what the sweep's own splice writes. So the
cross-component path cannot flip content and a component tag would prevent no byte
difference. The open questions are semantic and economic, not correctness.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…imply a fresh position

The previous commit claimed all 364 recovery-channel replays landed at fresh
positions, and derived from that a hypothesis that the 57% cost recovery might be
paying a cache-write per replay. The #188 reviewer caught the bad step and is right.

The invalid inference was that because the marker skip precedes the cache lookup,
replays must be on content at fresh positions. Unmarked does not imply fresh. The
client re-sends its OWN original transcript every turn -- collapse.go:108 states it
directly, "the agent re-sends the original each turn, so the only way the
representation stays stable is to re-derive the same bytes", and failed_run.go:121 and
agentdiet.go:393 say the same. So a message compacted last turn arrives unmarked again
this turn at the SAME position and the replay re-derives identical bytes. That is the
steady state everywhere on every turn, and it is precisely what the depth bypass
exists for: the provider already holds the compacted form there, so nothing is
re-written and no cache-write arises.

What survives is bounded rather than universal. The bypass is justified per-message
while the key is per-content, so a subpopulation can splice at depth into content the
provider holds in original form -- but it is self-limiting, because new content is
APPENDED, its index exceeds MaxCachedIdx, TailOnly puts it in the tail on arrival
where the gate would permit acting anyway, and by the time that position is at depth
it was compacted on its arrival turn. Reaching the hazard needs the boundary to have
moved (a compaction reset) or the component not to have acted on arrival.

Iteration 024 cannot size it: 364 is the total, not the fresh-position count, and
cache_read_tokens / cache_write_tokens / fresh_input_tokens all read 0 in every
arm-seed -- unpopulated in this build rather than measured as zero.

So $11.58 at $0.00 stands for the steady-state replays, with an unsized minority
possibly carrying an unrecorded cache-write. The semantic caveat in the same section
-- a drop replayed as a compaction -- is unaffected and stands.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…fresh instrumented run

The withdrawn inference and the withdrawn cost hypothesis are both tracked in #199
alongside the sizing recipe, so a reader finds the correction next to the claim rather
than having to find ae2e5ed. Cross-referenced here.

One consequence from that issue matters for planning and is recorded: iteration 024's
logs carry NO content ids, so the recipe cannot be applied retroactively. Sizing the
fresh-position subpopulation needs a fresh instrumented run rather than a re-read.
#177's per-call record already carries content_key; the missing half is the position.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…uing it locally

Section 2b noted that 209 unresolved expands went unnoticed for two iterations. The
reason generalises and is now stated citably on #200, so this file points at it
instead of making a local version of the argument.

The shape: the benign reading is what a counter's description promises, so the
dangerous case hides behind a reassuring one and the failure is silent by
construction. expand_unresolved_missing sat at 209 looking like ordinary expand
traffic; usage_reported was false on 4,015 of 4,015 requests and was found two
iterations later while chasing something else. Both are this iteration's
contribution to that argument rather than illustrations of it, and #200 carries them
as its supporting evidence alongside expand/unresolved.go's malformed-vs-missing and
#188's stash_missing-vs-stash_refused.

Signed-off-by: David Amid <[email protected]>
Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
The first live run of this tool reported `failures=0` on a 30-batch arm where only
13 batches had produced any verdict at all. 149 of 243 candidates were never
measured, and the resulting file looked like a complete measurement with an 83%
drop rate.

The cause was one discarded return value:

    vs, _ := extract.ParseVerdicts(reply)

`ParseVerdicts` documents at its own definition why that flag exists: folding
"parsed to a deliberate keep-all" together with "did not parse" makes the two
indistinguishable, and those are precisely the states an arm has to separate.
Discarding it here meant an unparseable reply wrote zero rows and incremented no
counter, so incomplete coverage was silent.

Four changes, all about attribution rather than behaviour of the judgement itself:

  - `classifyReply` names the four outcomes -- ok, partial, unparseable,
    truncated -- because they have four different remedies. Truncation means raise
    the token budget; unparseable means fix the prompt; partial means the model
    skipped candidates it was shown; only ok is a measurement.
  - Partial coverage is now reported. It is the quiet failure: the reply parses, so
    nothing errors, but the omitted candidates read as deliberate keeps in any
    scorer that defaults absent to keep.
  - `-replies` captures every raw reply as JSONL. The first run discarded them, so
    when the batches failed there was no evidence of which of the three faults had
    occurred -- and the replies cost real money to obtain.
  - The summary prints each mode separately and warns that missing candidates are
    unmeasured, not keeps, directing the reader to pair arms on the intersection.

Verified against a local fake endpoint serving three known reply shapes: the old
binary printed `failures=0, 3/3 batches` and silently wrote a 3-of-6 partial as
complete; the new one classifies all three correctly (prose -> unparseable,
unclosed array -> truncated, short valid array -> partial, 1 of 3 batches usable).

Mutation-verified, five mutations. Four are caught: discarding the ok flag,
collapsing truncated into unparseable, dropping the partial check, and treating a
closed empty array as junk. The fifth -- returning `vs` instead of `nil` on the
unparseable path -- is NOT caught, and is inert rather than a gap: ParseVerdicts
returns `nil, false`, so the two forms are identical. That limit is recorded in the
test itself so it is not mistaken for a guard.

No behaviour change to any judgement: the same replies produce the same verdicts.
What changes is that a run can no longer report success while more than half its
batches produced nothing.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…carding it

Measured on aws/claude-sonnet-5 against a real prefix ask: the model answered with one
verdict object per line and no brackets at all.

    {"i": 0, "needed_by": "none", "quote": "", "verdict": "drop"}
    {"i": 1, "needed_by": "none", "quote": "", "verdict": "drop"}
    {"i": 2, "needed_by": "none", "quote": "", "verdict": "drop"}
    {"i": 3, "needed_by": "a", "quote": "not_submitted.json", "verdict": "keep"}

Four verdicts, all well-formed, all correctly reasoned, complete for the batch. The
contract does say "Reply with ONLY a JSON array", so this is a deviation -- but
ParseVerdicts scans for `[`, finds none, and throws the whole ask away. The ask is the
expensive part; the brackets are not.

So this is a parser fix, not a prompt one. It accepts more VALID answers without
accepting any invalid one:

  - every check the array path applies is applied per line. Each must decode into a
    Verdict and satisfy looksLikeVerdict, so `{}` and `{"note":"x"}` are still refused
    rather than becoming phantom verdicts for label 0.
  - EVERY line must parse. A reply cut off mid-object leaves a fragment that does not
    decode, and returning false there is what keeps truncation distinguishable from
    malformation -- their remedies are opposite. Accepting the whole lines and skipping
    the fragment would report a partial batch as a complete judgement, which is the
    quiet failure this package already guards against on the array path.
  - AT LEAST TWO lines. `TestAnUnparseableReplyYieldsNoVerdicts` refuses a bare object as
    "not an array" and that guard predates this change: one object is indistinguishable
    from an answer that stopped, while two are evidence of a chosen format. Every
    contract-following single-verdict reply is `[{...}]` and already parses, and
    inventories of one are gated out by min_inventory well before the ask. So nothing is
    lost and the older invariant is left exactly as it was.

ReplyWasTruncated is extended for the bracket-less case. A newline reply cut off
mid-object has no missing bracket, so the old test called it a format failure and pointed
the operator at the prompt when the remedy was the token budget. It now reads as
truncation only when the EARLIER lines parsed -- several verdicts then a fragment is a
budget that ran out; every line malformed is still a format failure.

Mutation-verified, five mutations, all caught: removing the fallback, dropping the
looksLikeVerdict check, skipping a truncated fragment instead of refusing, allowing a lone
bare object, and dropping the truncation label. The lone-object mutation trips the
pre-existing test as well as the new one, which is the intended coupling.

Verified on the wire end to end: the request that previously produced
"UNPARSEABLE (truncated=false, 262 reply chars)" now yields 4 of 4 verdicts, and a
two-batch run reports 2 of 2 batches judged, 0 unparseable, 0 fabricated quotes.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…e live question

Two measurement changes and no production behaviour change.

1. cg-selarm now asks the question production asks.

It used to concatenate the flattened transcript and the inventory into ONE user message.
Live, the transcript is the request's own `messages` array and the ask is a trailing user
message appended by cheapmodel.CompletePrefixed (proxy/prefixask.go:115), so the model's
prior outputs arrive in ASSISTANT role -- they are its own turns. Flattened they become
text the user pasted, which breaks three things at once: criterion (c), "a step you have
EXPLICITLY STATED you will take", stops being about the model's own utterances; the
contract's own sentence "The conversation above is your own" becomes false; and "above"
changes referent.

Measured symptom: the flattened harness dropped 85% of candidates on ~8-candidate batches
while the live component dropped 33% and iteration 024 dropped 43% at comparable
inventory. A harness that overstates drop willingness cannot answer whether a drop is
worthwhile.

It now builds a prefix body and calls CompletePrefixed -- the shipped function, not a
reimplementation. MaxTokens follows cheapmodel.PrefixAskMaxTokens (16,000); the 4,096 that
stood here was this tool's own invention and a tighter budget than the code under test
uses, which would have made truncation a property of the harness.

Dry run now ASSERTS the shape rather than merely building: at least two messages, roles
reported, and the transcript's text must not appear inside the ask. Verified: 27 messages
(14 assistant / 13 user) and a 5,323-byte ask against the live probe's 5,394.

WHAT IT STILL CANNOT REPRODUCE, stated in the code: the corpus records each message as a
role and a flat string, so tool results arrive as user-role text rather than `tool_result`
blocks and assistant tool calls lose their `tool_use` blocks. Role attribution is
faithful; block structure is not.

2. A band and estimator simulation, in-package because the terms are unexported.

prefixRewritePaysWith and turnsRemainingAfter cannot be reached from a command, so
anything outside this package would reimplement the arithmetic and then agree with the
copy rather than with the shipped code. Two tests, both skipped unless
CG_ECON_SIM_CORPUS is set, no model calls:

  - TestEconGatePassRateByBand sweeps window x approval x premium x horizon credit.
    Validated against live behaviour: it predicts 9% pass at 64k under a floored approval
    where the probe measured 8%.
  - TestApprovalEstimatorDynamics runs the ledger sequentially, because a fixed approval
    value cannot show an estimator driving itself to that value and then refusing the
    evidence that would revise it -- which is the observed failure. Both estimators face
    an identical, stated, swept outcome model, so no conclusion depends on that model
    being right, only on it being the same across arms.

Findings recorded here because they are the reason the next configuration changes:

  - the gate is PRO-CYCLICAL. At 128k, pass rate falls 86% -> 38% -> 17% -> 0% -> 0% as
    context pressure rises, while mean inventory rises 5.7 -> 8.6 -> 7.3 -> 9.2 -> 9.8.
    `have` is remaining window room in turns, so it shrinks exactly as the request fills.
  - approval dominates the band. At 128k: 97% pass at the warm-up prior against 34% at the
    floor, and 7.5x the reachable dead mass.
  - the horizon credit (#232) is worth +48 points at 64k and +46 at 32k -- but ONLY where
    approval is not floored, since it subtracts `saved x approval`. Testing it at the floor
    alone made it look inert, which is a conclusion about the floor.
  - the reward premium is load-bearing: premium 1 with a floored approval passes 0% at
    every band including 256k.
  - mass-weighted shrinkage beats the shipped pooled ratio in all six cells, ordering
    stable across outcome models: k=1M floored bucketed > k=300k floored bucketed >=
    no-floor > pooled > shipped. Bucketing by inventory size (#230) is worth 20-37% more
    removed mass, and the floor still helps at moderate k -- shrinkage does not subsume it.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
… ask count

Two changes to askLedger and one to a config, answering a failure measured end to end on
the iteration 027 probe.

WHAT HAPPENED. The sweep made exactly three asks -- 08:05:51, 08:06:35, 08:07:21 -- and
then never asked again for the remaining thirteen minutes of the run. Those three were the
warm-up window, where `l.asks < minAskSamples` reports an approval of 1.0. They offered
37,527 tokens and returned 467, so on the third ask the switch flipped and the pooled ratio
became 0.0124, floored to 0.05: a 20x collapse in expected saving, in one step. Every later
evaluation then needed twenty times the mass to clear the same bar, and
prefix_rewrite_not_repaid 35 plus econ_ask_not_repaid 13 is the rest of the run.

The trap closes on itself. `have` is remaining window room in turns, so the gate admits
THIN, low-pressure asks -- measured at 128k, pass rate falls 86% -> 38% -> 17% -> 0% -> 0%
as pressure rises while mean inventory rises 5.7 -> 9.8. Thin asks return almost nothing,
the pooled ratio collapses, and the collapsed ratio then declines the rich asks that would
have revised it. The rich regime is never sampled.

  1. APPROVAL IS SHRUNK ON MASS. approval = (approved + k*prior)/(offered + k) with k in
     TOKENS of offered mass, so the estimate leaves the prior continuously instead of
     switching. Cost and approval no longer share one gate: cost is an average over asks and
     keeps minAskSamples, approval is a mass ratio whose precision scales with mass.

  2. APPROVAL IS BUCKETED BY INVENTORY SIZE (issue #230), three buckets split at the
     inflection this file's own measurements report -- shown one output, 6% live-kept on
     haiku and 14% on sonnet; shown ~15, 58%; batch 3-6 dropped a genuinely-spent output 2
     times in 4; batch 10 dropped it 4 in 4. A twelve-candidate ask is no longer priced by
     three-candidate history. An unsampled bucket shrinks toward the POOLED rate, so a new
     regime inherits what the component has learned rather than restarting at 1.0.

  3. min_inventory 3 -> 10 in cfg-iter027-B-merged.yaml. The 3 rested on my claim that
     iteration 024's firings "commonly carried THREE candidates". Its own counters refute
     that: sweep_offered 6,034 plus sweep_over_ask_cap 3,682 across ~626 asks is 15.5
     eligible candidates per ask, capped by maxAskItems to a mean of 9.6 offered. The only
     run in this line that produced reward was already at the inflection. The probe measured
     what three buys: three asks of three candidates dropped 135, 170 and 162 tokens while
     keeping every 16k candidate -- 326 tokens against 37,060 examined, 1.2%.

k = 1,000,000 comes from a simulation over 384 decision points (added in the previous
commit) that ran the ledger sequentially against an identical, swept outcome model. Ordering
stable in all six cells: k=1M floored bucketed > k=300k > unfloored > pooled > shipped. At
64k under the pessimistic model it made 132 asks against the shipped 36 and removed 68,955
tokens against 7,329.

THE FLOOR STAYS, and the same simulation is why: the unfloored form converged to 0.033 --
below the floor -- and made 11 fewer asks at 128k. Shrinkage does not subsume it; the floor
is an optimistic bias that keeps the component asking.

TWO EXISTING TESTS CHANGED DELIBERATELY, invariants kept and coverage moved rather than
dropped. TestApprovalFloorPreventsPermanentSelfDisable asserted approval == approvalFloor
after five asks; that encoded the mechanism, since 50,000 tokens is not evidence of a
near-zero rate. Its invariant -- the estimate never reaches zero, so there is always a path
back -- is still asserted, and the floor's own coverage moves to
TestTheFloorBindsOnceThereIsRealEvidenceOfANearZeroRate, where 20 pseudo-counts of contrary
mass make the floor the thing that binds. TestAskLedgerLearnsCostAndApprovalAfterWarmUp
wanted approval ~0.25 from 4,000 tokens; that is the "a rate from almost no mass" reading
that produced the cliff, so the approval half moves to
TestApprovalConvergesOnMassNotOnAskCount, which asserts convergence on twenty pseudo-counts.

Mutation-verified, five mutations, all caught after a first pass found a gap: removing the
floor, making an unsampled bucket restart at the fixed prior, dropping bucketing for one
pooled scalar, removing shrinkage for a raw ratio, and trusting the cost average after one
ask. The unsampled-bucket mutation was NOT caught on the first run and
TestAnUnsampledInventoryRegimeInheritsThePooledRate was added for it. One earlier mutation
reported a false pass because its pattern never matched the source; re-run against the exact
text, it fails as intended.

Full suite green except two pre-existing failures in context-guru-plugin, a package this
change does not touch: install.sh reports result=present because the eval box already has
/usr/local/bin/context-guru-proxy installed.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
-min-candidates N skips decision points carrying fewer than N candidates, so the tool can
measure one inventory regime rather than the average of several. Without it the reported
measurement is not reproducible from this repo.

10 is the value that matters and the reason is in extract_sweep.go's own numbers: shown one
output, 6% live-kept on haiku and 14% on sonnet, both inside the drop-everything null
model's error bar; shown ~15, 58% at the lowest cost per output; batch 3-6 dropped a
genuinely-spent output 2 times in 4; batch 10 dropped it 4 in 4. It also matches
min_inventory, so the tool measures the population the component will actually ask about.

FILTERED BEFORE THE SHUFFLE, deliberately. Filtering after it would make -n 60 and -n 169
different samples of the rich population instead of nested ones, and the whole point of the
seeded sample is that a slice can be compared with the rest of the run.

What it measured, on 60 of the 169 qualifying points (694 candidates, 98% coverage within
the sampled points, $9.89):

  arm                    removed(cand)  removed(tok)  false-drop           live-kept
  null: drop everything          100%          100%   24.2% [21.2-27.5]    0% [0-2.2]
  index: unreferenced           52.3%         42.4%   10.7% [ 8.0-14.4]   76.8% [69.8-82.5]
  model: sonnet-5               77.5%         88.5%   26.2% [22.7-30.1]   16.1% [11.3-22.4]

Rich inventory fixed what it was predicted to fix. Mean dropped candidate 4,414 tokens
against the probe's 155, and 143 of 159 candidates at or above 5,000 tokens were dropped
(90%) -- the component no longer keeps the mass and removes the trivia. 88.5% of offered
tokens approved also means the shrunk estimator converges high and the ask does not shut
itself down.

It did not fix selection. The model's false-drop is statistically indistinguishable from
dropping everything, and against the FREE index on identical candidates it buys 2.09x the
mass at 2.4x the false-drop and a fifth of the live-kept. The decisive figure: it dropped
301 candidates the index would not, and 122 of them (41%) were referenced later.

Two things make these numbers trustworthy rather than merely computed. The index reproduces
its published false-drop -- 10.7% here against 11% in
docs/results/coref-selection-experiment.md -- and the drop-everything arm returns exactly 0%
live-kept, which is the arithmetic check that the ground-truth join is real.

And the standing caveat points the unfavourable way: future_referenced is Tier-1 exact
matching, so it UNDERCOUNTS reuse and both false-drop figures are floors, not estimates.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…nnot be scored

WHAT THE ITERATION FOUND, in the order it matters:

Iteration 024's reward is not attributable to the sweep. Its own pooled counters show arm B
differed from arm A by TWO components: extract_llm was absent from arm A entirely and removed
38,280,211 tokens, against extract_llm_sweep's 2,353,227. The sweep is 6% of the incremental
removal, and has been carrying the credit for the result every gate change since has been
justified by reproducing.

The economic gate refuses hardest where compaction matters. `have` is remaining window room in
turns, so at 128k the pass rate falls 86% -> 38% -> 17% -> 0% -> 0% as pressure rises while mean
inventory rises 5.7 -> 9.8. Iteration 024's 82% pass rate was 700k of unused window, not
permissiveness that transfers to a correctly denominated band.

The approval term shut the component down after three asks -- 90 seconds at the start of a
thirteen-minute run. Those three were the thin asks the gate admits, they returned 1.24% of
offered mass, and the minAskSamples switch then collapsed expected saving 20x. Fixed in the
previous commit; the simulation behind the fix is recorded here.

The horizon credit is worth +48 points at 64k and +46 at 32k -- but only where approval is not
floored, since it subtracts `saved x approval`. An intermediate reading in this iteration called
it inert; that was a conclusion about the floor. The preregistration's "not separable" claim
stands.

And in the rich regime the adjudicator finally drops the mass -- 90% of candidates at or above
5,000 tokens, mean drop 4,414 tokens against the probe's 155 -- while dropping the wrong mass.
On scoreable candidates its false-drop lower bound touches the drop-everything null exactly, and
of the 146 scoreable candidates it dropped that the free index would not, 122 (84%) were reused
later.

THE LIMITATION THIS ADDS TO THE PUBLISHED PAGE, and it is not a bias to bracket alongside the
two already there:

`coref` calls an output opaque when novel == 0. A reference is detected as
`novel & ref_tokens[j]`, so an empty novel intersects nothing and the candidate is recorded
"never referenced" BY CONSTRUCTION, whatever the agent did with it. That is zero sensitivity on
a subset, not a bias with a direction. On the LOCA corpus it is 30% of candidates and 46% of
token mass, with a referenced rate of exactly 0.0% against 10.0% for unreferenced, 50.0% for
closed and 76.0% for open. A 119,846-token spreadsheet dump yields five distinctive tokens in
its entire text, all schema keys, all removed by prior/siblings/common.

The deterministic arms on that page are not distorted by it, because Opaque is never-cut by
design. A model arm's numbers are, by exactly as much as it cuts there.

Two figures reported earlier in this iteration are corrected here rather than quietly dropped:
"85% of iteration 024's candidate mass is dead" counted all 918 opaque as dead by construction
and is 75% of tokens on scoreable candidates, with 53% of the mass called dead never measured;
and a hybrid arm of "index plus the model on opaque only" appeared to dominate the index entirely
because its extra drops were in the class that cannot be scored wrong. That arm is void.

The blindness is wider than the class. Both sides of the intersection pass through
distinctive(), so a positional reference ("the address in row 1") shares no token with its
referent, and an agent may copy `123 Main St` verbatim into an email without producing a match.
An attempt to quantify that by matching literal values reproduced the precision failure
distinctive()'s own docstring records -- scoring 2025, spreadsheetId and valueRanges as reuse and
returning 74% hit on opaque against 68% on unreferenced, i.e. no signal. It establishes nothing
and is recorded as a failed attempt rather than omitted.

Deterministic Tier-2 widening is not the remedy and is already done: iteration 009 moved
referenced candidates 408 -> 473 without narrowing the index-model gap. Widening a proxy does not
make it ground truth, and opaque is an extraction failure while normalization addresses matching.

Recommended gate before further reward spend, stated in the doc: a configuration that dominates
the free index on scoreable candidates. Exactly one does -- agreement-gating, at 8.0% false-drop
and 88.7% live-kept -- and it wins on quality while removing less, which is a trade a reward run
would have to adjudicate rather than an improvement to ship.

mkdocs is installed on neither this laptop nor the eval box, so `mkdocs build --strict` was NOT
run. Verified instead: all 11 relative links in the two touched files resolve to existing files,
the new nav entry points at a real path, and no nav path is duplicated.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…sweep

The section published in 5026234 concluded that iteration 024's reward was "not attributable to
the sweep" because arm B added a second component. That is wrong, and the configs in this repo
refute it.

WHAT I DID. I read `extract_llm`'s saved_tokens of 0 in arm A as the component being absent from
that arm, and inferred arm B = arm A + extract_llm + extract_llm_sweep. I never opened the two
config files, and I never looked at `runs` — only at `saved_tokens`. Absent and present-but-never-
fired produce the same zero.

WHAT IS TRUE. cfg-iter023-A-baseline.yaml and cfg-iter023-B-merged.yaml carry byte-identical
pipelines and a byte-identical extract_llm block. The only difference in either file is two keys
on the sweep: `evidence: true` and `econ_trigger: true`. And the counters say extract_llm ran in
arm A 1,808 times and acted 0 times.

  arm A   extract_llm       runs=1808 acted=0    saved=0
          extract_llm_sweep runs=1808 acted=0    saved=0
  arm B   extract_llm       runs=2207 acted=1492 saved=38280211
          extract_llm_sweep runs=2207 acted=373  saved=2353227

WHY extract_llm FIRES ONLY IN ARM B, and why that is not a second cause. It is configured
fire_on: pressure with economic_gate: true, and iteration 024's window silently resolved to
1,000,000 rather than the configured 64,000, so pressure never rose -- acted=0 in BOTH arms is
what its own trigger produces. What differs is the shared result cache: the sweep's drop path
writes into cg:res: through helpers both components call, so once econ_trigger lets the sweep act,
extract_llm replays those frozen removals. Iteration 024's own page records it -- extract_llm
books $11.58 at $0.00 from 0 FRESH CALLS and 364 replays, arm B only. Zero fresh calls means no
judgement of its own: the 38,280,211 tokens are the sweep's removals persisting, counted once per
request that carries them.

So the intervention is two keys on one component and the endpoint difference belongs to it. The
2.35M against 38.28M is fresh-versus-persisted accounting, not two causes -- which is what that
page already said ("the sweep's own accounting understates it by construction", a removal banking
at cache-read rates). The ratio puts roughly 17x on it.

Nothing else in the iteration moves. Sections 2-5 concern whether the gate fires and section 6 is
an offline selection measurement; none of them depended on the attribution. The "Settled" bullet
is rewritten and the one-sentence summary now leads with the correction.

Links re-checked; no new ones added.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
The sweeps in this file vary one term at a time, which cannot answer "will it fire enough".
That is a JOINT question over the inventory floor and the gate, and multiplying a pass rate
from one table by a qualification rate from another assumes independence when the floor
selects FOR large requests and the gate selects AGAINST them.

Reported as a fraction of ALL decision points, so what min_inventory costs is visible, and
compared against the only firing rate that ever produced reward -- iteration 024's 626 asks
over 2,207 requests, 28%.

  window  min_inventory  qualify  ask/all  deadTokensBehindAsks  approval
  64000   10             44%      36%      5,541,518             prior
  64000   10             44%       2%         31,064             floored
  128000  10             44%      43%      7,399,579             prior
  128000  10             44%      14%        957,474             floored
  64000    3             95%      84%     12,479,678             prior

So the proposed configuration at 64k -- premium 20, credit on, min_inventory 10, the shrunk
estimator -- fires on 36% of decision points against iteration 024's 28%. The band is not the
required lever; the estimator is.

And the two fixes turn out to be one fix seen twice. min_inventory 10 does not merely improve
judgement: the rich-inventory run measured the adjudicator approving ~85% of offered mass,
where the three thin asks that shut the component down approved 1.24%. The floor feeds the
ledger the evidence that keeps the gate open.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…ume or selection quality

THE QUESTION. Iteration 027 measured a selector whose false-drop lower bound touches the
drop-everything null exactly, and of the 146 scoreable candidates it dropped that the free
deterministic index would not, 122 (84%) were reused later. Iteration 024, whose arms differed
in two keys on that same component and nothing else, gained +25% accuracy at +2% cost per step.

Those are only compatible if removal VOLUME buys reward rather than selection quality --
plausible, because every removal is reversible through expand, so a wrong drop usually costs a
round-trip rather than the task. The counter-evidence is in iteration 024's own ledger:
expand_unresolved_missing 175 in arm B against 0 in arm A.

No offline instrument can separate those. It is the measurement this line has been deferring, and
it is why this is worth reward money when nothing since iteration 024 has been.

THREE ARMS, sharing band 64k, premium 20, min_pressure 0.20, min_inventory 10, the credit, and
the mass-shrunk bucketed estimator:

  A volume     the model's verdict alone       (offline: 85.4% tok, fd 36.8%, lk 16.1%)
  B agreement  drop only where index agrees    (offline: 58.0% tok, fd  8.0%, lk 88.7%)
  C free       coref alone, NO asks            (offline: 70.6% tok, fd 10.7%, lk 76.8%)

C is the benchmark that matters: if neither LLM arm beats a component costing nothing, the case
is closed regardless of how A and B compare.

Arm B is explicitly NOT the refuted pre-filter, and the prereg says why. That design offered the
model only what the index had already judged spent, starving the comparison it is good at
(4ca1f13). Arm B offers the FULL inventory and uses the index solely as a veto on the drop.

And what arm B cannot do is stated up front rather than discovered later: opaque candidates are
never `unreferenced`, so 46% of token mass is out of B's reach by construction. If A wins, part of
the win may be mass B is forbidden to touch -- a real confound between "volume" and "reach".

FIRING RATE IS SIMULATED, NOT HOPED. Iteration 026 spent a full run to discover a zero. The
shipped gate functions over 384 decision points say 64k with min_inventory 10 asks on 36% of
decision points against iteration 024's measured 28%, without the 1,000,000-token window that
made 024's gate permissive by accident. A four-part pre-flight gate must pass before launch,
including a new counter -- sweep_index_disagreed -- because without it a null cannot be told from
an arm that never diverged.

MARGIN DECLARED NOW: 8 accuracy points, two-sided, because iteration 007's failure was declaring
it afterwards. Power is stated honestly rather than dressed up: 5 seeds are 5 draws of the same 15
tasks, so effective n is nearer 15 than 75, 8 points is near the edge of what the design can see,
and a null is the most likely single outcome.

expand_unresolved_missing is a first-class endpoint, not a footnote: it is the direct measure of
irreversible loss and the quantity that decides whether iteration 024's reward was bought with it.
An arm winning accuracy while raising it has not demonstrated a shippable mechanism.

COST is given as a range with the derivation shown, because four estimates in iteration 027 were
wrong by 2-3x: bottom-up from LOCA's measured $1.13/run and 024's $20.26 ask spend gives ~$190 for
three arms, while the plan file's own two-arm estimate implies ~$170/arm. Budget $200-$400, lower
end optimistic, with two named mitigations to be decided before launch.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…rule

At the operator's direction: run only the fixed configuration against doing nothing, and read
out after every seed so a bad arm can be abandoned before the budget is spent. Arms B and C
(agreement-gating, and the free deterministic selector) are deferred -- nothing is worth
comparing until the fixed configuration is shown to beat nothing.

A BASELINE ARM IS STILL REQUIRED, and this is the change the operator's instinct did not
anticipate. Iteration 024 cannot serve as the control, because it ran at a window that silently
resolved to 1,000,000 while this runs at 64k. Established from its own transcripts rather than
inferred: 19% of its decision points carried prefixes already over 64,000 tokens, to a maximum
of 507,263, which cannot happen against a 64k window. Same seeds control instance variance; they
do not rescue a different independent variable, and reading a 64k arm against 024's stored
numbers is the exact confound that invalidated iterations 008-024.

The baseline's zero is measured, not assumed: with econ_trigger absent only the pre-expiry
trigger can fire, and 024's arm A recorded not_in_pre_expiry_window on 378 of 378 requests.

POWER, MEASURED FROM ITERATION 024's OWN PASSES rather than asserted. Pass-to-pass SD over 19
recorded passes, each 15 tasks: accuracy 0.087, steps 5.74, cost $17.02. Minimum detectable
difference for two arms at k passes each:

              k=3    k=5    k=8   |  024's effect
  accuracy     14     11      9   |  ~13 points
  steps       9.2    7.1    5.6   |  ~4.7
  cost ($)     27     21     17   |  ~8.9

So k=5 is the minimum that can see the effect and k=3 cannot -- which corrects an earlier
suggestion in this thread that three seeds would do because "seeds are the correlated
dimension". They are not: between-seed SD is 0.048 against a within-seed 0.091, so instance
identity is the small part and the noise averages down at the ordinary rate. Accuracy is also
the best-powered endpoint of the three; steps and cost have higher relative variance and neither
resolves 024's effect even at k=8.

THE STOPPING RULE, on the CUMULATIVE mean difference rather than each seed alone, with its error
rates simulated 200,000 times at the measured one-seed SE of 12.3 points:

  threshold   abandons a true +13.3   stops early if truly 0   if truly -13.3
   0.0                11.6%                   69.0%               99.6%
  -6.7                 3.2%                   33.1%               93.3%
  -13.3                0.8%                   11.3%               67.9%

-6.7 points is adopted: one whole task, which is also the granularity of the measurement -- one
task is 6.7 accuracy points, so a single-seed difference can only take values in multiples of
6.7 and there is no observable "+5 points". At that threshold a harmful arm stops at seed 1.6 on
average, saving ~3.4 of 5 passes, about $140.

Futility-only: the rule may end the run, it may NOT declare a win. Stopping early for lack of
benefit does not inflate type-I error; looking, continuing because it looked good, then testing
at 0.05, does. And a pass that FAILS is not a futility signal -- one of 024's 19 passes scored
0.000 -- so an invalid pass is re-run rather than pooled.

Two further pre-registrations, both made now so they cannot be post-hoc: a secondary endpoint over
the 12 non-degenerate environments, because three of the fifteen were solved 0 times in 18 passes
and only dilute the primary; and expand_unresolved_missing as a first-class endpoint, since it is
what decides whether 024's reward was bought with irreversible loss.

Cost corrected to ~$430 from measured per-pass spend ($40.89 per 15-task pass, n=19, SD $17.02).
The earlier ~$190 came from the 024 page's "$1.13/run", which does not reconcile with the measured
figure; the discrepancy is flagged in the doc rather than settled quietly.

No new code is required -- every term arm A needs already ships -- only a baseline config and the
per-seed readout.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
Three artifacts and no run. Nothing here has been launched.

TWO CONFIGS WHOSE DIFF IS THE INDEPENDENT VARIABLE. cfg-iter028-A.yaml and
cfg-iter028-baseline.yaml are byte-identical -- pipeline, extract_llm, summarize, and every
other sweep key -- except two lines:

  $ diff <(strip cfg-iter028-baseline.yaml) <(strip cfg-iter028-A.yaml)
  > evidence: true
  > econ_trigger: true

reward_premium, min_pressure, min_inventory, min_later_turns and keep_recheck_turns sit in BOTH
files even though they are inert while the component cannot act. That is deliberate: it keeps the
diff two lines rather than seven, so a reader does not have to decide which of several differences
did the work.

The baseline's inertness is measured, not assumed. With econ_trigger absent only the pre-expiry
trigger remains, and it never fires under benchmark load -- iteration 022 recorded
not_in_pre_expiry_window on 18 of 18 requests and iteration 024's arm A on 378 of 378, because
eight parallel workers never leave an idle gap for a cache entry to approach expiry. The runner
still CHECKS it per pass rather than trusting it.

ONE SEED PER INVOCATION, AND THEN IT STOPS. There is no loop over seeds in run028.sh, at the
operator's instruction. A script that ran all five would spend the budget before the first number
was read, which is how iteration 026 spent a full run to discover a zero. `./run028.sh seed N`
runs baseline then arm A, prints the readout, and ends with an explicit refusal to continue.
Baseline runs FIRST within a seed, so an interruption leaves the arm that costs nothing to repeat
rather than the arm carrying the ask spend.

It refuses to spend on four conditions, all verified: no binary; no CG_I028_SHA pinned (a rebuild
landing mid-run leaves passes on different code with every counter still healthy); an unknown
step; and per pass, model_info_unresolved != 0, a baseline that ACTED, or an arm A producing fewer
than five verdicts.

THE FUTILITY RULE LIVES IN readout028.py and is the operator's, quantified. It reads the
CUMULATIVE mean difference over completed seeds -- not the latest seed, whose SE is ~12.3 accuracy
points and which can only take values in multiples of 6.7 (one task of fifteen) -- and stops below
-6.7. Simulated at that noise: abandons a true +13.3-point effect 3.2% of the time, catches a
truly harmful arm 93.3% of the time, stopping at seed 1.6 on average and saving ~$140.

Futility-only, and the script enforces it: it prints "continue is PERMITTED", never a win, and
says in terms that a win cannot exist before seed 5. On futility it says the run is OVER and warns
against running another seed to see whether it recovers.

Two things it enforces rather than mentions:

  - a pass that FAILED is not futility. Accuracy 0.000 (one of iteration 024's 19 passes),
    a wrong window, a baseline that acted, or fewer than five verdicts EXCLUDE the pass from the
    cumulative mean and demand a re-run. A -13.3-looking arm-A-invalid pass must not read as
    evidence against the arm.
  - if expand_unresolved_missing ROSE in arm A, the decision block says so in banner form: the arm
    removed content the agent asked for and did not get back, and an accuracy win there is not a
    shippable mechanism. Preregistered as first-class for exactly this reading, since iteration
    024 logged 175 against 0.

The 12-environment secondary is computed alongside the 15-environment primary, from a constant
naming the three environments solved 0 times in 18 iteration-024 passes -- declared before the run
so it is not a post-hoc subgroup.

VERIFIED against synthetic fixtures covering nine branches for $0: empty tree, a positive seed 1,
futility firing, a failed pass, a baseline that acted, too few asks, a wrong window, five seeds
separating, and five seeds null. Two flaws the fixtures caught and this fixes: the closing line
offered "run seed 2" even after futility fired and after seed 5, and the irreversible-loss
endpoint was only mentioned rather than enforced.

Also written: ~/cg-loca/task-configs/i028-preflight.json, two environments chosen for TRANSCRIPT
SIZE rather than solvability, since the pre-flight asks only whether the band is real and whether
the sweep fires -- and firing needs an inventory of ten.

STILL REQUIRED BEFORE ANY PASS: build the proxy binary, pin CG_I028_SHA to it, and run
`./run028.sh preflight`. No reward pass may start until the pre-flight's four conditions pass.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
Built from this tree with `CGO_ENABLED=1 go build -o ~/cg-bin/cg-i028-proxy
./cmd/context-guru-proxy`, giving b9a69b15e8644bb479bead7e537cf7bf. Full build and the affected
test packages green before building it: components/offload, internal/extract, cmd/cg-selarm.

PINNED IN THE FILE rather than left to CG_I028_SHA in the environment, so the preregistration is
auditable in the repo instead of in someone's shell history. The runner still honours the
environment variable for a deliberate override; the default is the record.

The comment says not to edit it once a pass has completed, and the reason is the one that makes
this class of mistake invisible: passes already run used this binary, so changing the pin to match
a later rebuild silently compares two different programs while every counter still looks healthy.
That is why run028.sh checks the hash before EVERY pass rather than once at launch.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
Skipping a tag whose stats file exists is what lets an interrupted run resume without repeating a
paid pass. It is also how a pass that MUST be redone gets silently skipped.

Measured, not hypothesised: the first iteration 028 pre-flight attempt died on a rotated gateway
credential -- HTTP 401 on every request, `loca exit=0`, 2 requests in 18 seconds, 0/2 success --
and left st-i022-i028pf.json behind. The arm check caught the pass and refused it, but the retry
would have printed "SKIP i028pf (already done)" and proceeded as though a pass that adjudicated
nothing were a completed pre-flight.

The skip now names the six conditions that make a pass invalid -- wrong window, baseline acted,
fewer than five verdicts, accuracy 0.000, and an auth failure -- and prints the exact command to
move the artifact aside. Move rather than delete, so the reason a pass was rejected stays on disk
beside the run it belongs to; the 401 attempt is kept as st-i022-i028pf.json.401-invalid.

No behaviour change to a valid run: a tag with good stats still skips, which is the point of it.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…econd place)

prefixRewriteNet decides WHETHER TO REMOVE `saved` tokens, and measured its turn horizon on the
request as it ARRIVED. So it asked "how long do we last if we do nothing" and then charged the
removal against that answer -- the exact defect #232 fixed in prefixRewritePaysWith, left standing
in the one other caller.

MEASURED CONSEQUENCE, from iteration 028's pre-flight rather than argued: a 73,550-token request
against a 64,000 window has reqAfter >= window, so turnsRemainingAfter returns 0, so S*T is 0 for
every candidate subset and net reduces to -11.5*W. selectAffordableDrops then keeps whichever
subset has the smallest W -- k=1, because k==1 is accepted unconditionally as the initial best.
The model authorised 9 drops, 8 were pruned, and 105 tokens were removed across 64 requests.

THE STATED REASON FOR THE ASYMMETRY WAS MISATTRIBUTED, and that is why it survived. The comment on
rewritePricing.creditRemoval said "coref's drop SELECTION was calibrated against the uncredited form
(prefixRewriteNet, which is unchanged)", which reads as a reason to leave it alone. coref never
calls it: prefixRewriteNet has exactly one caller, extract_llm_sweep's selectAffordableDrops, while
coref reaches the break-even through prefixRewritePays (coref.go:390), which passes creditRemoval
false. THAT default is what protects coref's calibration -- not the state of this function. Both
comments are corrected in place rather than deleted, because the misattribution is the reason the
defect lasted.

NO BELIEF TERM HERE, and that is the difference from the trigger. There the credit uses
`expected = saved * approval` because the ask has not happened and the mass is a projection. Here
the votes are in hand: `saved` is the actual mass of the subset being priced, so the post-removal
size is a fact about this decision. The credit is less arguable here than where it was first applied.

Two tests, both mutation-verified against a revert to the uncredited form:

  - TestPrunerHorizonIsCreditedForTheRemoval: a removal too small to cross the window still reports
    0 turns, correctly; one that crosses it AND leaves more than a turn of headroom must report
    positive turns.
  - TestAffordableDropsAreNotPrunedToOneAtHighPressure: 10 of 10 drops kept where the uncredited
    form keeps 1.

A FIXTURE LESSON WORTH KEEPING, recorded in the test file: the first version removed just enough to
cross the window, leaving 2,000 tokens of headroom against a per-turn growth of 6,180, and
(window-after)/perTurn floored to 0. That was the arithmetic being right, not the credit being
absent. A fixture here must leave headroom worth more than one turn or it tests integer division.

The two pre-existing pruner tests -- KeepsALateBatchWhole and PrunesATinyEarlyDropThatSetsTheRewrite
Span -- still pass, so the credit does not cost the pruner its intended behaviour. Full suite green
apart from the two context-guru-plugin failures this branch does not touch.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
Iteration 028's own pre-flight is the reason, and it is a mechanical one rather than a preference.

At a 64k declared band this agent's requests EXCEED the window -- 73,550 tokens measured, with
pressures of 1.15 and 3.62 -- and turnsRemainingAfter returns 0 whenever reqAfter >= window. That
zeroes THREE terms at once: the econ trigger's `have`, the horizon credit, and
selectAffordableDrops' S*T. The observed cascade was 339 of 349 candidates declined by the inventory
floor, then 8 of the surviving 9 drops pruned, then 105 tokens removed across 64 requests. Nothing
reward can see, at any n.

At 128k the same 73,550-token request sits at 0.57 pressure with a real horizon.

AND THIS IS FINALLY A MECHANICAL ACCOUNT OF ITERATION 024. Its window resolved to 1,000,000, so a
request of that size sat at 7% pressure and every term was healthy. Its result was not bought by a
permissive gate in any transferable sense -- it was bought by a window large enough for the
arithmetic to be non-degenerate. The band is the fix; the gate tightenings since were treating a
symptom.

Verified before changing it: model-window-128k.json is served on :6980 (HTTP 200, max_input_tokens
128000, prices present so cheap_model_price_unconfigured stays 0). The band sets the declared window
AND LOCA's clearing threshold together, so both move.

The binary is re-pinned to bc3b53b5320e898490c333e61c28bae9, which carries the pruner's horizon
credit. The record of the change is in the comment: no seed had run under the old hash, so nothing
is invalidated -- only the two pre-flight attempts, and both are kept on disk beside their reasons
(st-i022-i028pf.json.401-invalid, st-i022-i028pf.json.64k-degenerate).

WHAT THIS DOES NOT CLAIM: 128k is not large enough for every request. The 3.62-pressure request
observed at 64k is still 1.81 at 128k, and those still degenerate. What changes is the common case,
and -- with the pruner now credited -- a large enough removal can bring a heavy request back under
the window instead of being refused for having no runway.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…uner

Written after the pre-flight and before any reward pass, so nothing is retro-fitted -- no seed had
been run.

The amendment records the measured cascade the pre-flight found at 64k: 349 candidates offered, 339
declined by min_inventory, 1 ask, 9 drops authorised, 8 pruned as unaffordable, 105 tokens removed
across the whole pass. Against a baseline that removes 0 that is not separable at any n, so the
pre-flight did the job it exists for and cost ~$14 instead of $430.

It also records the first mechanical account of iteration 024 this line of work has had. Its window
resolved to 1,000,000, so a 73,550-token request sat at 7% pressure and all three horizon terms were
healthy. The result was not bought by a permissive gate in any transferable sense -- it was bought by
a window large enough for the arithmetic to be non-degenerate. Every gate tightening since was
treating a symptom, which is why each one measured worse than the last.

Two limits are stated rather than left implicit. 128k is not large enough for every request: the
3.62-pressure request is still 1.81 at 128k and still degenerates. And the pre-flight's two
environments both scored 0.0000 where iteration 024 scores them 0.89 and 0.47 -- with 105 tokens
removed and expand_unresolved_missing 0 the arm cannot be the cause, so that is an environment
failure in the chosen pair, and it means the pre-flight says nothing about task outcomes. A condition
for "the tasks actually ran" is missing and is flagged as such.

The haiku question is recorded under what this iteration cannot settle, with the constraint that
makes it a bigger change than it looks: the sweep's ask carries only an inventory and reads the
outputs from the REQUEST model's prompt cache, so `source: config` is refused by the component
outright. Running the agent on haiku therefore moves the agent and the adjudicator together. It is
~3x cheaper and the published table has haiku matching sonnet on live-kept at bulk -- 58% both, at
1/12 the cost per call -- so it earns its own seed, but it risks flooring the accuracy endpoint,
since power lives in the 12 non-degenerate environments and a weaker agent pushes more to zero.
Tracked as the next question rather than folded into this one.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
It was hardcoded to `aws/claude-sonnet-5`. Now `LOCA_MODEL`, defaulting to exactly that, so every
existing caller -- run022 through run027 -- is unaffected. Verified both ways: unset resolves to
aws/claude-sonnet-5, set resolves to the override.

NEEDED FOR a capability check the operator asked for: can haiku solve LOCA's tasks at all? If it
cannot, running haiku with the sweep cannot get far either, so the question is about the agent and is
answered with the BASELINE config -- sweep present but inert -- which costs no ask spend and leaves
nothing to confound the accuracy reading.

TWO CONSTRAINTS RECORDED AT THE VARIABLE, because this is the place someone will reach for it:

  - It is not a free knob. extract_llm_sweep sends its ask to the REQUEST's own model by construction:
    the ask carries only an inventory and the outputs are read from that model's prompt cache, so
    `model` is a REFUSED key on that component rather than merely discouraged. Changing LOCA_MODEL
    therefore changes the agent and the adjudicator together, and any comparison across it moves two
    things at once.
  - The model-window document must carry an entry for whatever is set, or the proxy resolves no window
    and model_info_unresolved goes non-zero -- the failure that voided iterations 008-024.
    model-window-128k.json already carries aws/claude-{sonnet-5,haiku-4-5} and their bare forms, with
    haiku priced at $1/$5 against sonnet's $2/$10.

The repo and box copies of this file were verified byte-identical before editing. That check is not
ceremony: this script is shared with other iterations and other sessions on the same box, and a copy
of it was clobbered earlier in this line of work, losing CAPTURE_BODYDUMP and four
CHEAP_MODEL_PRICE_* settings.

No run is launched by this commit.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
`./run028.sh base N [model]` runs the baseline pass of a seed and stops. The baseline config leaves the
sweep inert, so the pass carries no ask spend: it measures the AGENT, not an arm.

WHY THIS IS A DIFFERENT QUESTION FROM REWARD. "Would a cheaper agent model still finish these tasks"
cannot be read off an A-vs-baseline comparison. If the agent solves nothing, both arms score zero and
the readout reports futility -- which is indistinguishable from an unusable agent. Iteration 026 spent
a full run to learn a zero it could not attribute, and this step exists so the attribution comes first
and cheaply.

The tag encodes a non-default model. A haiku pass written to the plain `i028-sN-base` tag would be
SKIPPED by `run_pass` and silently adopted by `./run028.sh seed N` as arm A's own baseline, comparing a
haiku baseline against a sonnet arm A with `model_info_unresolved=0`, `acted=0` and every other counter
healthy. The default model deliberately keeps the plain tag, because that pass IS seed N's baseline and
must be reused rather than paid for twice.

perenv028.py reports accuracy PER ENVIRONMENT rather than the mean. Three of the fifteen
(CanvasArrangeExamS2L, CanvasListTestS2L, WoocommerceNewWelcomeS2L) scored a constant zero across all
nineteen iteration-024 passes, so a mean over fifteen has a partly noise-free denominator, and two
agents with the same mean can solve entirely different environments. The count that answers the
capability question is how many environments come off zero, so that is what it prints -- and it warns
when a known-zero environment scores above zero, because that also invalidates readout028.py's power
arithmetic, which excludes the same three.

It refuses rather than reports when LOCA's summary block is absent or parses to no environments: a
truncated log otherwise yields a partial table that reads as a complete result.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…sode from a failed one

TWO DEFECTS IN THE READOUT, both of which made a pass look like something it was not.

1. `pass_dir` globbed `outputs/*<tag>*`, but LOCA names its directory after the TASK CONFIG and the agent
model -- `inf_claude_api_i024-64k-s1_aws-claude-sonnet-5_CTU_<ts>` -- with no trace of the arm tag. So the
glob matched nothing and seed 1's readout announced "No iteration 028 passes on disk yet" with both passes
complete, validated and paid for.

Globbing the task-config name instead would have been worse than the bug: `*i024-64k-s1*` matches every
pass ever run on that seed -- both arms, both models, and iteration 024's own five passes on the same
instances -- and the newest-wins tiebreak would then resolve BOTH arms to the same directory. The
difference would read as an exact zero with every counter healthy. The pass's own log is the only artifact
that ties a tag to a directory; absent or unparseable, it now reports the pass missing rather than
guessing.

2. `Final reward (accuracy)` conflates the agent getting a task wrong with the HARNESS killing the episode
because one response hit `max_tokens` (default 4096). Those need opposite responses and the number could
not tell them apart.

Measured, iteration 024, ten passes: 63 of 150 episodes (42%) ended on a truncated response and NONE of
the 63 scored, while 82 of 87 survivors (94%) did. Iteration 028 seed 1: 9 of 15 in EACH sonnet pass.
Accuracy has therefore been close to `1 - kill_rate` throughout.

That makes the arms' kill rates a confound rather than an outcome, so the readout now prints the kill rate
per arm and warns when they differ. Iteration 024's arms differed 37/75 against 26/75 -- 14.7 accuracy
points available before any content-selection effect is counted, against a reported effect of about the
same size.

locaterm.py holds the accounting and the degenerate list so the two scripts cannot drift: the list is also
narrowed in place, because all three of its members are in the truncation-killed set in both seed-1 sonnet
passes, and haiku -- which killed no episodes at all -- solved CanvasArrangeExam outright at 35/35 courses
matched. "Never scores" was a claim about sonnet at a 4096-token output budget, not about the task.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…ger output budget

THE RIG HAS BEEN TRUNCATING A QUARTER OF SONNET'S RESPONSES, and the cause is not long answers.

LOCA adds no `thinking` field at all under --no-enable-thinking (inference/run_claude_api.py:1147 only
ADDS one when enabled), so Sonnet 5 applies its own adaptive default and thinks anyway. That is why the
banner has always printed "Extended thinking: DISABLED" while 183 of the seed-1 baseline's 243 responses
carried thinking blocks. Measured in situ: responses WITH thinking truncate 30%, without 10%, and haiku
-- which never thinks -- sits at 10%.

Gateway measurement, same prompt, max_tokens 4096, three repetitions each:

  field omitted (the rig today)            4096, 4096, 4096   capped 3/3
  thinking {enabled, budget_tokens 1024}   1327, 1279, 1729   capped 0/3
  thinking {enabled, budget_tokens 2048}   1746, 1459, 1405   capped 0/3
  thinking {disabled}                      1143, 1422, 1419   capped 0/3

2048 and 1024 yield the same output, so the bound is not what binds -- HAVING one is what stops the
runaway. Hence the shape of the switch: thinking is turned ON in order to bound it, because "off" in this
rig means "unbounded adaptive". No patch to LOCA is needed; --enable-thinking and
--thinking-budget-tokens already emit {"type": "enabled", "budget_tokens": N}, the exact shape measured
above. Default empty, so every earlier run reproduces byte-for-byte.

WHY IT COSTS MORE THAN TOKENS. A truncated response cuts the tool_use JSON mid-object and the tool then
fails schema validation: 93 of 96 tool validation failures in the seed-1 baseline and 120 of 123 in arm A
landed immediately after a truncated response. The agent retries, burning steps and context.

AND THE OPPOSITE LEVER IS WORSE, measured rather than assumed. `mtprobe 8192` gave thinking room to
expand into: 16 responses at the new wall against 5 at 4096, the same two zeros, and $18.02 on one task
against $2.49. $19.19 for a clean negative, which is why it was probed before five seeds were committed
to it.

NOT `effort`, and one trap worth recording: `thinking.adaptive.effort` is rejected 400 ("Extra inputs are
not permitted"), while a TOP-LEVEL `effort` returns 200 and is SILENTLY IGNORED -- thinking still capped
3/3. Anyone setting that flag would believe effort was reduced while nothing changed. `output_config`
{effort: low} does work (1532, 1110, 1342) but LOCA has no flag for it.

Both probe steps refuse to be read as reward: baseline config, two environments, and printed guidance
that a pass here is never pooled with a seed.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…al traffic would take

ITERATION 028 IS STOPPED AFTER ONE SEED OF FIVE, by decision rather than by its futility rule -- the rule
permitted continuing at +0.0.

What the seed established, and it is worth keeping: the sweep removed 322,939 tokens across 105 drops
with expand_unresolved_missing 0 -> 0 and accuracy 0.333 in both arms. It acted at scale and broke
nothing.

What stopped it is that the workload cannot PRICE it. 441 candidates offered over ~88 collecting runs is
~1.5 settled candidates per request against min_inventory 10, so the component asked 15 times in 286
requests -- correctly, since its own measurements put a one-candidate ask at 6-14% live-kept against 58%
at ~15. The gate is S*T > 11.5*W and LOCA supplies thin S and short T (10-30 step tasks), so the realised
cache ratio of 11.0 against a break-even of 11.5 does not separate "the mechanism is marginal" from "this
instrument cannot tell".

AND THE THRESHOLDS SHARE A SOURCE WITH THEIR OWN VALIDATION. A section of this document originally
reported that the offline corpus supplies 8 candidates per request against LOCA's 1.5 and concluded the
benchmark under-supplies the feature. Every corpus on the eval box is LOCA-derived -- all six carry conv
values of the form `inf_claude_api_...|<LOCAEnvironment>` -- so the comparison was LOCA against LOCA and
is withdrawn. min_inventory, min_tokens, min_later_turns, the 6%-vs-58% curve and the 8,105-decision
selection experiment are all calibrated on LOCA traffic, and the component has never been measured
against a workload independent of the one it was tuned on. That is iteration 028's actual finding.

Recorded as errors rather than quietly fixed, because two were presented as findings first: "truncation
kills the episode" (true only of terminal truncations, 91% are survived); "13 of 15 tasks never approach
the window" (read off proxy session ids, which do not map to tasks -- 9 of 15 peak at >=70%); the corpus
comparison above; "fix min_inventory", proposed twice against the code's own refutation; and a cost
estimate 2x low on the 8192 probe.

Two rig changes were probed before being committed to, and both were negative: --max-tokens 8192 let
thinking expand into the budget (16 responses at the new wall, $18.02 on one task against $2.49, same
zeros), and bounding thinking capped output 3/3 -> 0/3 on the gateway but did not transfer to the rig
(truncation 23.5% -> 29.8% over 15 tasks, same 5/15, same cost). LOCA_THINKING_BUDGET therefore ships
defaulting to empty and is documented as not recommended.

THE ENABLEMENT SECTION exists because the next measurement should be real traffic, not a sixth pass. It
is written to make a deployment readable rather than aggressive: econ_trigger is required in practice
(the pre-expiry trigger cannot fire under concurrent load -- 286/286, 378/378, 18/18 across three
iterations), reward_premium stays at 1 because the instrument that would price headroom has never fired,
and the pay/no-pay question is answered by saved_tokens / incremental cache creation against 11.5 rather
than by a dollar total that step-count variance dominates. It also names the readable precondition:
traffic that cannot supply ~10 candidates per request will produce a component that declines correctly
and teaches nothing.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
@amiddavid amiddavid changed the title feat(coref): co-reference evidence and an economic trigger for extract_llm_sweep — +8 tasks, 0 worse, p=0.0078 feat(offload): extract_llm_sweep — co-reference index, economic trigger, and the fixes that let it act Sep 16, 2026
One conflict, in components/offload/summarize.go, resolved by taking main's rewritten file and
re-applying this branch's gates by hand. A union resolution would have been wrong in three separate ways,
so each is recorded.

MAIN'S SIDE IS A MECHANISM CHANGE (0c21ead, "summarize by appending, not rebuilding", 426 insertions over
8 commits); this branch's side was 70 lines of observability over 3 commits. Main independently solved part
of the same problem, so three of this branch's additions are now redundant or wrong:

  - summary_below_trigger  -> main raises below_request_trigger on that path. Dropped.
  - summary_no_model       -> main raises no_model. Dropped.
  - summary_checkpoint_reused -> main files reused_checkpoint / awaited_checkpoint /
    gated_replayed_checkpoint through Report.Replay, which is what this branch's commit 69e3e03 was for.
    Dropped, and docs/components/summarize.md's claim that "acted_replay reads 0 whether reuse fired on
    every turn or none" is now false and has been corrected in place rather than left to mislead.
  - summary_reuse_disabled -> main deliberately MERGED `resummarize_tokens <= 0` into the stale branch, so
    that a config carrying 0 reports a valid checkpoint instead of replaying nothing. The path that gate
    named no longer exists; carrying it forward would have shipped a counter that can never fire. The
    surviving gate is renamed summary_checkpoint_stale, for the outcome rather than for one of its two
    reasons.

RE-APPLIED, because main left these paths unnamed: summary_span_empty, summary_span_empty_after_expand_trim,
summary_span_below_min_tokens, summary_no_checkpoint, summary_checkpoint_overlaps_tail,
summary_covered_span_changed (with its churn-not-cost argument intact), summary_checkpoint_stale, and
summary_empty_reply.

summary_empty_reply went to summarize_inline.go ONLY. Main split the model call into inline and async
paths, and the async one runs in a detached goroutine whose siblings are atomic counters, not gates,
because the Report belongs to the request goroutine. A rep.Gate there would be a data race, so that case
stays uncounted and says so rather than being papered over.

THREE TEST REPAIRS, two of which were silent failures rather than loud ones.

  1. coref.go called trigger.Fires(req, c.CtxWindow). Main changed the signature to take the Ctx so
     min_request_frac measures against the CLIENT's compaction point and its billed input rather than the
     model window and our own count. coref adopts that unchanged: the failure it fixes -- a client that
     compacts early never reaching frac x window, so the component silently never fires -- applies here
     identically.

  2. TestEveryFreshPathDeclineIsLabelled scans the source and requires a rep.Gate within six lines of every
     `rep.Skipped = true` in Offload. Main's rewrite deliberately separates recording WHY a turn declines
     from deciding WHAT to forward, because conflating them was cache-destructive rather than merely lossy,
     which puts two gates far outside that window. Both are now allowlisted by their own source anchor
     rather than by line number, and the guard is unchanged: an injected bare `rep.Skipped` is still
     caught. Widening the window instead would have made the test pass by making it vacuous.

  3. Both checkpoint-reuse tests were passing by SKIPPING. Main moved summary production off the hot path,
     so turn one commissions a summary and returns Skipped while it runs -- and `if rep1.Skipped { t.Skip }`
     then fired every run, which reads as a pass in the package line. They now drain through
     WaitForSummaryForTest (the same channel a real turn waits on) and FAIL if no checkpoint lands. That
     exposed the real reason they could not summarize: main defaults min_request_frac to 0.9, and
     FracResolvable needs an exact window plus a non-zero PrevBilledInput, neither of which a six-message
     fixture has. The fixture now writes `min_request_frac: 0` -- a configuration the component supports on
     purpose -- rather than inventing a 900,000-token PrevBilledInput.

Verified by mutation, since the point of the three repairs is that the assertions be live: dropping
summary_covered_span_changed, dropping summary_no_checkpoint, and adding a new anonymous decline are each
CAUGHT.

Build and suite on the eval box: `go build ./...` exit 0, `go vet` exit 0, `go test ./...` 31 packages ok.
The two failures are TestInstallRefusesAnUnverifiedDownload and
TestInstallReportsPATHFromTheSourceFallbackToo in context-guru-plugin, which this branch does not touch:
the shared box has a root-owned /usr/local/bin/context-guru-proxy installed, so install.sh short-circuits
with result=present and never reaches the download-verification path under test.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
`make lint` runs `go vet ./...` then fails on any `gofmt -l .` output, and two files added earlier on this
branch were unformatted: cmd/cg-selarm/main.go (a struct-literal key alignment) and
components/offload/econ_band_sim_test.go (an import indent and trailing-comment alignment).

Whitespace only -- no statement, expression or comment text changes, which the diff shows.

Caught by CI rather than locally because Go is not installed on the dev laptop, so `make lint` cannot run
there; it was run on the eval box against this exact tree and now exits 0.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>

# Conflicts:
#	metrics/metrics.go
#	proxy/promexport_coverage_test.go
@amiddavid
amiddavid merged commit b2f79f8 into main Sep 17, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Sep 17, 2026
@amiddavid
amiddavid deleted the feat/coref-recut branch September 17, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant