Skip to content

EPIC: What memory is actually worth — one proven benefit, one measured null, and cost accounting that stops lying #386

Done

Description

@abogartz

Why this epic exists

The plugin's promise is that a session's hard-won insight is stored and surfaces later,
saving work. That promise has never been measured in a way that could fail. This POC made
it falsifiable, ran it, and found the promise is half true.

Findings file: benchmark-tests/ocsi/FINDINGS-2026-11-10-memory-value.md. Every number
below has a result directory behind it and a seat named in front of it
(evo/Qwen3.8-Flash-Next, opencode v2.2.5). Nothing here is a claim about models in
general.

What is proven

Memory carries facts that are unavailable any other way. Leak-checked fixture
base4, results-transport-x5/: empty store 0/5, and every failure is
no out/declaration.json — without the fact the artifact cannot be produced at all. The
store written by the previous session carried the next one to 5/5, capture keeping the
fact 5/5, no human in between. Pre-registered expectation was "empty 0/5, seeded >= 4/5".

Memory does not make ordinary work cheaper. base3 — 783 src lines, real bug, 65-test
suite — results-reuse-n6/: six pairs, all arms 6/6 pass, per-pair 0.84, 0.79, 1.06,
0.98, 1.23, 0.54, median 0.98×, higher in 2 of 6. A memory about an unrelated bug came
in at 0.88×. Neither effect is distinguishable from nothing at the resolution we have.
(The "median" label on both figures was wrong: it was sorted[n/2], the upper-middle
element at n=6. The median of the six per-pair ratios is 0.91×, unrelated arm 0.99×,
published in PR #398 after review — on top of the metric correction recorded on
#385.)

Capture is the dominant cost the plugin adds, and it was billed to nobody. Roughly a
third of a session's own generation, per session. It does not appear in the session's event
stream, and its reply can land after the CLI exits, so reading the meter at exit reports it
as free.

The injected block invalidates the prompt cache every turn. results-cache-audit-on vs
-pin: 15 invalidations with reason prompt_reveal versus 0, 3,999 versus 1,934 uncached
input tokens over six turns. Cause is src/inject/epochs.ts: selection is a function of the
current prompt and the block bytes are the cache key.

Nothing reproduces at n=1. Same arm, same fixture, both passing: 202,474 and 444,500
tokens. Turn count for the same task is 13, 14 and 22. cv on the primary metric is 23%.

What is NOT proven, and must stop being claimed

  • That memory saves tokens on tasks the agent completes anyway. Ceiling is neutrality.
  • That a wrong memory is expensive. The 1.52× figure posted earlier was an artifact of a
    metric that counted cache misses; corrected it is 0.88×.
  • Any cost number in this repo's history produced by runSession().tokens, including the
    Cheaper auto-capture: measure the cost and add the two switches #365 median drop 20,506 → 10,009. That is a cache-state artifact.
  • Anything measured on one run of one arm.

Method rules, earned the hard way

  1. Pre-register thresholds before the first session. R1 and R2 both stated their bands in
    the notes file beforehand; when C1's own AC proved impossible, the AC was corrected in
    writing, not quietly.
  2. n >= 6 pairs to claim 20%; n >= 21 for 10%. Below that, report INSUFFICIENT.
  3. Baselines are mandatory: full history, TF-IDF + k-NN, newest-wins
    (selector-baselines.ts). TF-IDF+kNN places above eight published memory systems on
    MemoryAgentBench; newest-wins scores 100% where Mem0 scores 20%.
  4. Leak checks run against the copied working tree with no exclusions. A manual
    grep -v FIXTURE.md declared base4 clean while it was shipping the answer.
  5. Score use at point of use, not task outcome: 23.2% of episodes with beneficial memory use
    still fail and 31.3% with harmful use still succeed (arXiv 2611.01718).

Tickets

Update after #387 (PR #394): the session side is now provider-sourced, but capture has
no receipt to report — ctx.generate exposes one member, text, resolving to { text } with
no usage (probed against a running host). PR #394 ships a labelled estimate instead of a
zero, and the receipt itself became #395. That also blocks #387's 2% bench-agreement
criterion until one of the two routes in #395 lands.

Order of work: #387 first, because every other number depends on it. #388 next — it is the
only measured win in hand. #392 alongside both. #389, #390 and #393 need the noise bank and
a second seat respectively, and none should start before #387 lands.

Added after filing: the wrong-memory result

R4 (benchmark-tests/ocsi/results-poison-x5/, n=5) changed the shape of this epic. The
empty store fails honestly — 3/5 produce no file, 2/5 write vat_bps null rather than
invent a rate. One plausible wrong row produces a wrong artifact in 4/5 runs (2475,
2100, 3100, 1750) with no uncertainty flagged. The correct row: 5/5.

So a memory is not neutral when it is wrong, and capture has no truth check at all. That is
#393. It also means "capture writes too much" (#389) and "capture writes the wrong thing"
are two separate defects with two separate checks: restatable → refuse; unverifiable → do
not store as fact.

Corrected after filing: #390 is largely refuted

R3c (benchmark-tests/ocsi/results-stale-s5-x5/) stamped two conflicting rows 30 days apart
and got 10/10 in both write orders. The plugin resolves a changed fact by timestamp,
order-independently. The 3/10 that made #390 look serious needed same-millisecond rows, which
the harness produces by seeding in a loop and real capture does not.

condition result
real chain: A learns 2150, B told 1900, C does the task 5/5
two rows, prose marker, same instant 5/5
two rows, no marker, same instant 3/10
two rows, no marker, 30 days apart 10/10

#390 is now severity:low, narrowed to same-instant ties. The part worth keeping from it moved
to #393: capture already detects a contradiction and writes it as prose, and the session
files one side of it anyway.
Detection exists; it gates nothing.

Two harness bugs were caught on the way and are recorded in the findings file (F13): a seed
function that overwrote the store it was seeding, and a run-summary line that did not match
the guards it summarised. Both produced results that were cleaner than the truth.

Definition of done

The README states the transport result with its floor and the reuse result with its
null, on one seat, with n named. Capture cost is visible in the plugin's own status output.
The transport fixture runs in CI and fails loudly if a fixture ever ships its own answer.

Execution status (2026-11-11)

All eight tickets have shipped work or an explicit blocked-with-reason record. Open PRs:
#394 #396 #397 #398 #399 #400 #401 — agents do not merge, so every ticket stays open
until its PR merges.

The one measurement still owed (all three blocked on the same thing — F19: the bench
seat is shared with the agent driving it, and the same profile ran 5–47s/turn and 1287s/turn
an hour apart): #388 AC 4 post-fix order-churn audit, #389 AC 3 live transport x5 with the
gate active, #393 AC 3/4 poison+transport re-run at n>=5, #390 AC 2 live both-rows x5. Each
is recorded unmeasured on its PR with the expectation written down BEFORE the run, so a
null result is a finding, not a shrug.

Activity

  1. added
    capture
    bench
    severity:high
    on Nov 11, 2026
  2. added
    tier:full
    enhancement
    on Nov 23, 2026
  3. abogartz commented on Dec 1, 2026

    @abogartz
    OwnerAuthor

    Closed as done. The epic owns no change beyond its children: six shipped, and its definition-of-done checks true on main (README.md:32; src/status/harness-stats.ts:176). The unfinished legs are tracked on #388 #391 #395.

    Reopen it whenever the premise comes back; nothing here is deleted and the history stays put.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    benchcaptureenhancementseverity:hightier:full

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions