Repository navigation
Description
What was measured
Whether a memory written by one session makes a later session on the same task cheaper. This is the reuse half of the plugin's promise, and the bench had never measured it above a 123-line repo.
Fixture: benchmark-tests/ocsi/base3 — 783 src lines across 16 modules. A real bug (mergeAllocations keeps the first part's backordered flag instead of OR-ing), a real suite that catches it (65 tests, 1 failure), and a four-read trace from symptom to cause.
Arms, 5 pairs, one seat (evo/Qwen3.8-Flash-Next), graded against the pristine suite:
| arm | store | sessions | pass | median tokens |
|---|---|---|---|---|
| L0 | empty | 5 | 5/5 | 16,281 |
| L1 | empty, capture on | 5 | 5/5 | 15,637 |
| L2 | L1's own store | 5 | 5/5 | 18,170 |
| L4 | one irrelevant lesson | 3 | 3/3 | 24,698 |
Pre-registered verdict on median(L2)/median(L0): HELPS < 0.85, NEUTRAL 0.85–1.15, HURTS > 1.15.
Result: NEUTRAL, and noise is dearer than signal
Median L2/L0 = 1.03x over 5 pairs, higher in 3 of 5. Per-pair ratios: 0.43, 0.78, 1.03, 1.45, 1.86.
An irrelevant memory costs 1.52x (3/3 sessions at or above 1.5x) — consistently dearer than the real row's median.
Three things were verified rather than assumed:
- Capture writes the answer. From a successful base3 session, capture stored the cause at rule abstraction in 4 of 5 runs: "In src/warehouse.ts mergeAllocations, per-record flags must be explicitly combined when collapsing SKU allocations; backordered should be OR-ed so any inbound part triggers split-handling shipping." Storage is not the weak link.
- Injection works. Row fragments were found in L2's request bytes (21 and 22 occurrences across the run; the irrelevant row 63). The row rode every request.
- No masking. All 18 runs edited
warehouse.ts. Not one made the suite green by patching the invoice boundary instead of the cause. The fixture measures repair.
So the row is stored correctly, injected correctly, and buys nothing measurable.
Why the variance, and why the metric is still the right one
L2's spread (7,070 to 23,503 tokens) is wider than the whole effect. Repeat 4 is the control case that shows the row is not what drives cost: L1 wrote no answer-shaped row there, and L2 still cost 1.86x. Session-to-session variance in how much the agent reads swamps a memory that saves four reads.
What this does and does not rule out
It rules out: "the plugin pays for itself on tasks the agent completes anyway." On that class the ceiling is neutrality and the floor is the noise cost.
It does not rule out: value on tasks the agent fails without help. That measurement is still blocked, and base3/FIXTURE.md records why the obvious fix breaks the oracle. A test pinning the buggy flag would produce failures, and would also make grading reward masking over repair, because grading copies the pristine fixture plus the agent's src/.
Proposed direction
Cost on pass-anyway tasks is a dead end as a justification. Options, ranked:
- Stop selling reuse as a saving. Keep capture, and state the cost honestly: a correct memory is free-to-neutral, a wrong one is 1.5x. That makes precision the only quality metric that matters, and it makes the noise bank (arm L4) the primary test rather than an afterthought.
- Find a failure class that survives the oracle test. The requirement is a bug where the fix location is not reachable by a short deterministic trace and where no plausible test can pin the wrong behaviour. Not built yet; two attempts are documented in
base3/FIXTURE.md. - Raise n until variance resolves. 5 pairs gave 0.43–1.86. Resolving a 10% effect at that spread needs roughly 30 pairs, about 12 hours of seat time. Available, but it measures a metric whose ceiling is neutrality.
Reproduce: CHAIN_LARMS=0124 CHAIN_LREPEAT=5 CHAIN_OUT=results-reuse-base3 bun chain-learn.ts --localise. Results in results-reuse-base3/learn.json.
Activity
abogartz commentedon Nov 10, 2026
Correction: the cost metric excluded 94% of the cost
The 1.52x noise cost in the table above is wrong and so is the 1.03x. Both come from
runSession'stokens, which sumsinput + output + reasoningand deliberately excludescache.read(kept in a separate field so old comparisons stayed valid).inputfrom this provider is only the uncached remainder. In this very run that means the reported figure captured 17,008 of 262,332 tokens actually moved — 6%.Recomputing the same 18 sessions from
stdout.ndjsonwith the cache included:Median true ratio 0.85x, spread 0.57–2.93. The irrelevant-memory arm inverts outright: 0.75, 0.82, 1.09 → median 0.82x, not 1.52x. The direction of the finding depends entirely on which tokens you count, so neither verdict is safe at n=5 and the "noise is dearer than signal" line in the title does not hold.
What the old metric was actually measuring
Output + reasoning + cache misses. That is not neutral, because injecting a memory block changes the system prompt and therefore invalidates the provider's prompt cache.
results-cache-audit-onvsresults-cache-audit-pinshows it directly:prompt_reveal)Same session, same topics. An unstable memory block costs 2.1x the uncached input purely in cache invalidation, every turn. So the historical metric was not measuring what memory saves; it was partly measuring the cache damage memory does.
What survives
warehouse.ts; none masked the symptom. The fixture measures repair.runSession().tokens— including the Cheaper auto-capture: measure the cost and add the two switches #365 median drop from 20,506 to 10,009 — is a cache-state artifact and should be retracted rather than explained.Consequence for the plan
Two things follow, in order. First, fix the metric: bill
input + output + reasoning + cache.read + cache.write, and record capture's own calls, which were never in the session total either. Second, make the injected block stable, because that is a measured 2.1x on uncached input and it is available now regardless of whether memory turns out to help.