The Cost of a Read Isn't Its Size. It's How Long It Stays.
Here's a thing about coding agents that took us a while to feel in our gut: the model is stateless. Every single turn of an agent loop re-sends the entire conversation so far — every message, every file it has read, every command's output — back to the model as input tokens. The agent doesn't "remember" your file. It re-reads it to itself, from scratch, on every turn, until the session ends or gets compacted.
Which leads to a consequence most token math misses. The cost of a tool result isn't a one-time charge for its size. It's that size, paid again on every turn that comes after it. A 1,000-token file read on turn 3 of a 60-turn session isn't 1,000 tokens — it's ~57,000 token-turns of carried weight. The same file read on the last turn carries almost nothing. Two reads of identical size can differ 50× in true cost, purely by when they happened.
We wanted to see this in our own sessions, so we wrote a 150-line script — context-carry — that reads a Claude Code transcript and scores every tool result by tokens × (turns it's re-sent on after it lands).
What one real session looked like
We pointed it at a single long session of ours — 3,174 turns:
context-carry — <session>.jsonl (3174 turns)
heaviest carriers (result tokens × turns re-sent after they landed):
≈27,238,176 tok·turns turn 426/3174 · 9,912 tok × 2748 re-sends mcp__kite__get_quotes
≈16,638,405 tok·turns turn 9/3174 · 5,257 tok × 3165 re-sends …/huddle/steps/step-02.md
≈12,488,320 tok·turns turn 14/3174 · 3,952 tok × 3160 re-sends …/deemwar-queue/CLAUDE.md
● ≈1,003,242,514 token-turns of carried context
(vs a naive 603,849-token sum — carry is ~1,661× larger).
A billion token-turns. The naive "tokens read" number — 604k — undercounts the real context pressure by three orders of magnitude, because it ignores residence time. The worst offender was a single MCP get_quotes result of ~10k tokens that landed early-ish and then rode along in context 2,748 more times. The skill reference and CLAUDE.md that loaded on turns 9 and 14 each carried twelve to sixteen million token-turns — not because they're huge, but because they boarded early and never got off.
That ratio — carry over naive sum — is what a recent paper (The Missing Memory Hierarchy, 2026) names the amplification factor, measured at a median of 84× across 857 Claude Code sessions (P90 ~570×). Our 1,661× is an unusually long session at the far tail; the point of the median is that every nontrivial agent session pays this, most of them 50–500×. We didn't invent the metric — that paper did, and its remedy is a whole demand-paging proxy. What was missing was the cheap part: a script that tells you which reads are the whales and that loading them early is why.
"But prompt caching makes re-sends almost free"
This is the honest objection, and it's half right, so let's be precise — because the dollars and the tokens are two different stories.
In dollars: yes, prompt caching discounts a cache read to ~0.1× of a fresh input token (cache writes cost 1.25×). So re-sent context is roughly 10× cheaper than the raw token count suggests. Real ccusage breakdowns bear this out — on a busy day, cache reads can be ~50% of the entire bill, with one reported session hitting 99.93% cache reads thanks to a CLAUDE.md re-read on every turn. So caching turns the billion-token-turn bleed into a ~100-million-effective-token bleed. Cheaper. Not free. And it still grows with residence.
In everything else: caching does nothing. The re-sent tokens are physically still in the request, so they still occupy your finite context window, and they still dilute attention — the "lost in the middle" effect costs >30% recall accuracy when relevant content is buried mid-context, and Anthropic's own "effective context engineering" guidance treats context as "a finite resource with diminishing marginal returns" where "every token introduced depletes this budget." Caching cuts the dollar cost of carry; it does nothing for the window cost or the attention cost.
And the discount is fragile: the cache has a 5-minute default TTL, and it breaks at the first changed earlier token — so one edit near the top of your context, or a coffee break, and the next turn re-reads everything at full price. There's a camp that argues long sessions are therefore cheaper than /clear-ing often (you keep the warm-cache discount). Under steady typing, on dollars alone, they have a point. But "cheaper than the worst alternative" isn't "cheap," and it does nothing for the window filling up or the model getting dumber as it fills.
So what do you actually do
The prescription falls right out of the metric: the expensive context is the big stuff that loads early. So:
- Don't front-load. A giant file read or a verbose MCP result on turn 2 is the most expensive position there is. Read narrowly (grep/snippet) before reading whole; defer big reads until you actually need them.
- Evict the whales. That 10k-token MCP result you used once on turn 400 is riding for free in your head and for-not-free in the model's. Subagents help structurally — a sub-agent reads the big thing, returns a 200-token conclusion, and the 10k never enters the main thread's carry (the same paper measured subagent amplification at 12.8× vs 84× for main sessions).
- Compact before it compounds.
/compact(or a fresh session with a summary) resets residence to zero. The longer you wait, the more turns every early read has already been charged for.
The mental model we walked away with: your context window isn't storage, it's a conveyor belt you pay to re-run every turn. What you put on early, you pay for the whole way down. context-carry just prints the receipt.
It's a single file, no dependencies — point it at a .jsonl and find your whales. → Talk to us if you're tuning an agent's context economy.
Prior art, credited: the amplification-factor metric and its measurement at scale are from arxiv 2603.09023; the quadratic agent-cost framing from exe.dev and Augment; the finite-context argument from Anthropic. context-carry's contribution is the runnable per-item leaderboard. Token figures are estimates (~4 chars/token); the transcript format is undocumented and version-dependent, so the script degrades gracefully on lines it doesn't recognize.
Get the tool → context-carry in agent-ops — open source (MIT), a single dependency-free script, part of our toolkit for running coding agents in production.
Found this useful?
Related posts
The boring part: governance that enforces, not displays
Most "AI governance" is a dashboard. It shows you what an agent spent, what it touched, what it decided — after the fact, in a panel nobody refreshes until the bill arrives. A display is not a control. A control is the t…
Your Launch Deserves a Real Demo Video, Not a Screen Recording With Captions
Most product launches skip the demo video entirely, and the ones that don't ship one usually reach for the fastest option: a raw screen recording, maybe some auto-generated captions, posted as-is. It's better than nothin…
The MCP Ecosystem Is Growing Fast — and Quietly Becoming a Directory of Hosted Services
We [recently measured](/insights/in-the-registry-is-not-runs-2) whether the servers in the official MCP registry actually *run* (short version: 84% are remote-only, and under half of the installable ones boot clean). Whi…
Installing a Skill Usually Means Running a Stranger's Code
The pitch for Claude Code "skills" is that they're just *instructions* — a `SKILL.md` file with some markdown telling the agent how to do a task. That framing makes them feel safe to install. A prompt can't hurt you; wor…