← All research

The Token Economics of Remembering

July 2026 · 33 real sessions, 3,360 requests, 656M tokens mined · 5 experiments, adversarially reviewed pre-run

A memory system costs tokens to maintain: an index read every session, knowledge files retrieved, a distillation pass after work ends. Does it give more back than it takes? We mined 40 days of the developer's real Claude Code transcripts to price distill's overhead precisely, measured what friction knowledge actually prevents, and stress-tested a cheaper index. Numbers are reported tokens-first; dollar figures are API-equivalent counterfactuals (real usage runs on a flat-rate subscription).

The question

The intuition: distill saves tokens in the long run because errors stop repeating and sessions start with knowledge instead of re-exploration. But the intuition had never been priced. Three sub-questions:

  1. What does the maintainer's usage actually cost, and where do the tokens go?
  2. What is distill's all-in overhead — index carry, retrievals, the /distill pass itself?
  3. What can we prove about the savings side — and what can't we prove yet?

Method

Corpus
Every local Claude Code transcript on the machine: 35 JSONL files, 33 sessions with usage, 2026-05-29 → 2026-07-08
Unit
Per-request API usage records (input, output, cache read, cache write by TTL), deduplicated by message id
Pricing
API list prices (Fable $10/$50, Opus 4.8 $5/$25 per MTok; cache read ×0.1, 1h write ×2) — verified against current docs the same night
Integrity
All experiment designs pre-registered, then attacked by a clean-context adversarial reviewer BEFORE any scored run (17 findings, all fixed pre-run)

Subagent transcripts don't persist to the projects directory — every figure is a main-loop floor. Session titles and personal file names never leave the machine; the published dataset carries aggregates and pseudonymized paths only.

Cost anatomy: generation is the cheap part

40 days of heavy use moved 656M tokens for 4.2M tokens of actual output — an API-equivalent of $868, 100% of it on the two most expensive models (Fable 5, Opus 4.8). Decomposed:

ComponentTokensShare of cost
Cache reads (context re-read every request)635M51–57%
Cache writes (context growth, 1h TTL)16.3M22–34%
Output (the actual work)4.2M15–21%
Fresh uncached input0.5M<1%
The headline

~85% of spend is moving context around, not generating anything. The median request drags 153k tokens of resident context (p90: 389k); that number grew 5× between May and June as sessions became marathons. Any cost strategy that doesn't address context posture is optimizing the 15%.

Spend is also concentrated: the top 5 sessions (deck-building and masterclass marathons) account for 69% of everything. The other 28 sessions average ~$10 API-equivalent. Routing small sessions to small models would save almost nothing; the leverage is inside the big sessions.

Sensitivity, not savings: re-pricing the window with mean context capped at 100k/60k tokens yields −40%/−57% — an unachievable upper bound (the work used much of that context), quoted only to size the lever. TTL note: observed usage is ~100% 1-hour-TTL cache writes; the re-price scales the observed hit pattern linearly.

The distill ledger: overhead side, measured to the cent

Overhead itemMeasuredWindow total (API-equiv)
Session-start floor (SPINE 3.6k + monitor rules)~5.5k tokens/session$0.18 as reads
SPINE carried in resident context, re-read every request3.6k × 3,360 requests$12.10
/distill main-loop turns12 invocations, median $1.31$29.94
/distill subagent (invisible in transcripts)live samples 46–328k tokens≈$6–18 (estimate)
Knowledge-file retrievals36 reads, median file ~1k tokens<$1
All-in overhead

≈$50 per 40-day window — 5–6% of total spend. The index carry (SPINE re-read every request) costs more than every knowledge retrieval combined; the retrieval risk worth worrying about is under-retrieval, not cost. SPINE was Read-tool-loaded in only 17 of 33 sessions.

Friction curves: what encoding actually prevents

We scanned command output (Bash/PowerShell/Edit tool results only) for error signatures tied to encoded knowledge, and tracked recurrence over the window. A methodology trap first: a naive scan over all text inflated counts 3–10× — because reading a knowledge file that describes an error puts its signature into the context. Count errors only where they can actually happen.

Environment gotchas (encoded in ops/ files) Recurrence ≈ ZERO after encoding
One-and-done
git index.lock (1 session, never again) · NTFS colon paths (1) · python3 Store stub (1) · screenshot relative-path ENOENT (2 sessions, then never) · cp1252 Unicode crashes (4 sessions, zero events after Jul 1)
The exception: behavioral rules
"Edit requires a prior Read" harness error: 25 events across 7 sessions, still occurring on the last day of the window — despite being encoded. Knowledge kills environment traps; it does not reliably change in-flight habits.
Execution gap, quantified

This is the first hard measurement of a thesis distill already carried as a principle: encoded knowledge prevents lookup-shaped failures, while habit-shaped failures need structural checkpoints, not more prose. Each friction event costs a median 5–18k output tokens of self-recovery (upper bound; ≈$0.3–1 each).

Honest accounting: friction non-recurrence saved roughly $10–30 over the window — real, but small next to the context tax. The larger claimed benefit (avoided re-exploration and wrong turns in marathon sessions) has no counterfactual in this dataset: we never run the same session without knowledge. The distill-benchmark measures quality deltas; it doesn't yet record token deltas. That instrumentation is the top follow-up this study produces. Best external proxies: 40–60% of real agent-trajectory input tokens measured as redundant (AgentDiet, arXiv:2509.23586); Anthropic's memory + context-editing eval reporting 84% token reduction on 100-turn tasks (vendor-internal).

Experiment: putting the SPINE on a diet

Update, September 2026: the index has grown since this was measured. It now carries 65 entries at a median 133 tokens each. The file is an estimated 13.8k–18.6k tokens (3.8–5.2× the 3.6k below) and the turn that reads it measures 21,247 tokens (5.9×) — growth driven by verbosity per entry rather than entry count. See Local Decision Models. The figures on this page stand as measured in July 2026.

The SPINE is 3.6k tokens, re-read constantly. A clean-context agent (which never saw the test set) compressed it by a mechanical rule — every entry becomes [Title](path) — ≤8-word trigger, all 59 entries preserved — landing at 1.2k tokens. A second clean agent (which never saw the diet SPINE) authored 6 held-out retrieval probes, paraphrased so string-matching can't win. Both arms ran on the same pinned model, N=2 per held-out probe.

Held-out probes (primary, pre-registered) NOT a free win
Full SPINE (3.6k)
Recall 12/12. But 7 over-reads — richer descriptions invite tangential files; avg 1,845 tokens of files read per probe.
Diet SPINE (1.2k)
Recall 10/12 — it missed BOTH repetitions of the GitHub-Pages probe: compression dropped the distinctive trigger nouns. Only 3 over-reads; avg 1,317 tokens read (−29%).
Classification: trade-off knob, not free win

The diet SPINE saves ~2.4k tokens of carry per session plus ~29% of retrieval-read volume — and measurably loses recall on paraphrased probes (1 of 6 held-out domains, consistently). Under this project's release rule — optimizations that change distill's output need explicit opt-in — this ships, if at all, as a documented option. A v2 compression rule that must preserve distinctive nouns is the obvious next test. Also noteworthy: even the full SPINE missed once on the secondary set — retrieval is not a solved problem at any index size.

Verdict

  1. Distill's overhead is certain and small: 5–6% of spend. The index carry dominates it; retrieval cost is noise.
  2. Measured savings (friction non-recurrence) do not alone repay it; the unmeasured side is where the case lives. Environment-gotcha recurrence drops to ~zero after encoding — but at ~$0.3–1 per avoided event, friction alone returns $10–30 against ~$50 of overhead. The re-derivation counterfactual (what a knowledge-free session would have burned re-exploring) is unmeasured — and external trajectory studies put redundant work at 40–60% of agent input tokens. Verdict: overhead proven, savings evidence directional; instrument before claiming victory.
  3. The token conversation is mostly not about memory. Memory overhead (5–6%) and even /distill passes are rounding errors next to context posture: ~85% of cost is context movement, and the median request carries 153k tokens. If cost is the concern, the order of operations is context hygiene → delegation → routing → memory diet.
  4. Distill's honest cost role today: not a token saver — a token shaper. It converts unbounded, repeated re-derivation into a small fixed floor plus rare 1k-token reads. The floor is provably cheap. Proving the avoided re-derivation needs the benchmark to log tokens, which is now a tracked follow-up.

Limitations

  1. Single user, single machine, 40-day window, n=33 sessions. Cleanup policies mean earlier history is gone.
  2. Main-loop only: subagent usage doesn't persist locally — all totals are floors, and the /distill subagent cost is an estimate from live same-night samples.
  3. $ figures are API-price counterfactuals; actual billing is a flat-rate subscription whose metering treats cache reads differently (officially: discounted; one documented community case disagrees — unresolved upstream).
  4. Friction signatures are a curated list tied to encoded knowledge; unencoded friction isn't counted. Recovery windows include some task continuation (upper bound).
  5. The author of the system also authored the study. Mitigations: pre-registration, clean-context adversarial review before every scored run, held-out test authorship, and this limitations list. The review's structural warning stands: this study cannot conclude "distill isn't worth it" — only bound its overhead and falsify specific savings claims.