If you use Claude Max and work on large codebases, you've probably hit your weekly limit faster than the math should allow. You may have attributed it to heavy usage. The real culprit is quieter: Anthropic's KV cache eviction policy, which resets your prompt cache after five minutes of inactivity.
This post explains the exact mechanics and calculates the dollar cost across a real engineering workday.
How prompt caching works
Anthropic's prompt caching stores your context (codebase, system prompt, conversation history) in GPU memory after the first request. Subsequent requests with an identical prefix read from cache at a dramatically reduced rate:
| Token type | Claude Sonnet 5 price |
|---|---|
| Cache write (first write per session) | $3.75 / 1M tokens |
| Cache read (hit) | $0.30 / 1M tokens |
A 12.5x cost difference between a cache hit and a cache write. For context-heavy workflows, the first write is expensive — subsequent reads are almost free. The catch: Anthropic evicts the KV cache after 5 minutes of inactivity. Every eviction forces a full re-write at the expensive rate.
The exact dollar cost of a cache bust
| Context size | Cache write cost | Cache read cost | Penalty per bust |
|---|---|---|---|
| 100k tokens | $0.375 | $0.030 | $0.345 |
| 250k tokens | $0.938 | $0.075 | $0.863 |
| 500k tokens | $1.875 | $0.150 | $1.725 |
| 1M tokens | $3.750 | $0.300 | $3.450 |
On a 500k token context, every interruption that causes a 5-minute gap costs an extra $1.73 versus reading from cache.
A realistic 8-hour engineering day
Software development involves constant context-switching. A typical day includes:
- Morning standup (15 min) — cache evicts
- Lunch break (45 min) — cache evicts
- Two PR reviews from teammates (~20 min each) — cache evicts
- A Slack thread that pulls you away for 10 min — cache evicts
- End-of-day wrap-up — cache evicts
That's 6 cache evictions on a normal day.
On ~20 working days a month: $207.60/month in cache penalty alone.
Your Claude Max x5 plan costs $100/month.
This is why power users report burning through weekly limits on apparently light days. The cache eviction penalty doesn't appear as a line item — it silently accelerates token consumption.
What a 57% smaller context does to the penalty
The TTL is a server-side parameter. You cannot change it. But you control two things: context size and context determinism. Reducing your baseline context makes every cache bust cheaper. Ensuring byte-identical output across requests ensures hits fire within the 5-minute window (non-deterministic output causes misses even during active sessions).
| Scenario | Context | Cost/bust | Daily (6 busts) | Monthly (20 days) |
|---|---|---|---|---|
| Raw context | 500k tokens | $1.73 | $10.38 | $207.60 |
| Compressed (57% reduction) | 215k tokens | $0.74 | $4.44 | $88.80 |
| Saving | 285k fewer tokens | -$0.99 | -$5.94 | -$118.80/mo |
What I built to address this
I built mcp-injector, a local MCP server that pre-indexes codebases into a SQLite catalog and serves AST-compressed snapshots. It addresses both structural problems:
- Smaller baseline: AST body-folding reduces codebase token footprint by 41–89%. Next.js: 23.9M → 10.2M tokens (57.4%). Redis: 892k → 143k (84.9%).
- Strict determinism: Output is byte-identical across runs — alphabetically sorted files, timestamps stripped, metadata normalized. Cache reads fire reliably.
Free for codebases under 50,000 lines. No account, no credit card. Install takes 60 seconds. Full benchmark data at foldwork.dev/benchmarks.
Pricing from Anthropic's API pricing page as of July 2026. Cache TTL from Anthropic's prompt caching documentation. Benchmark methodology: real repository shallow clones, mcp-injector default tier, July 2026.