Claude Code's prompt cache: a cold miss costs more than no cache
How Claude Code's prompt cache works, what breaks it, what a miss costs, and the habits that keep long sessions cheap, as of November 2026.
- Published
- Nov 9, 2026
- Length
- 7 min read · 1528 words

Contents
- Common causes of misses include switching model, fast mode or (on most models) effort, compacting, and idling past the cache lifetime. Editing CLAUDE.md, running skills and spawning subagents keep the cache1.
In a long Claude Code session, your next prompt is cheap. The expensive one is the first after lunch or after a model switch, when the prompt cache misses and the whole conversation is processed and stored again. As of November 2026, Claude Code shows the cache state and lets you choose its lifetime, so you can see and avoid those misses1,4,5.
The dollar figures below apply to token billing: an API key, a cloud provider or usage credits. On a Pro, Max or Ultra plan, usage comes out of your plan’s limits instead, Anthropic says the session’s dollar figure “isn’t relevant for billing purposes”, and it doesn’t publish how cache reads and writes count against those limits. The habits still help there, but the savings can’t be computed from these prices4.
The cache only matches the start of the request
Every Claude Code turn is a new API request carrying the system prompt, tools, project context and every earlier message1. The server finds the longest start of that request, the prefix, that a recent request already stored, and bills it at the cheap read rate1,6. The match is exact: change one byte, and everything from there on is processed again3. That is why Claude Code orders the request from stable to volatile and puts file changes and the date in messages at the end, not in the system prompt1,7.
A cold miss costs more than no cache
Storing a prefix costs a premium and reading it earns a discount: 1.25x the base input price for a 5-minute write, 2x for a 1-hour write, and 0.1x for a read, or 0.05x on Opus 5.5 and Sonnet 5.52. Each read also resets the timer6.
A 5-minute write pays for itself from the second request, a 1-hour write from the third2. Everything else in this post is about staying in the top two rows.

Seven habits do most of the work
- Choose model, effort and fast mode at session start. Each model has its own cache, so
/modelmid-task rereads everything1. At 100k tokens of context, staying on Opus 5.5 reads the history for $0.02; switching to Sonnet 5.5 writes it for $0.25, or $0.40 with a 1-hour cache (our arithmetic from Anthropic’s price list)2. For cheaper-model work, hand the task to a subagent instead: it builds its own cache and leaves yours warm. A fork (/fork, or a skill withcontext: fork) reads your cache only while it stays on your model1,7. - Compact while the cache is warm. A warm
/compact“costs a fraction of what the context size suggests”; a cold one reprocesses the whole history uncached1. Compact at natural breaks between tasks, not mid-task, because the summary is lossy3. - Start fresh from a handoff when you no longer need the full history.
/clear“costs nothing”4, and a short handoff note that Claude writes while the cache is warm carries what matters into the next session3. Elapsed time alone shouldn’t decide: if you still need the history, one rebuild can be worth paying for. Just know that/resumeafter the cache has expired rewrites the whole history1;/renamekeeps the old session findable for when you need it4. - To abandon a path, rewind.
/rewindreturns to a turn whose prefix is already cached and kept warm by every later turn1. Watch the timer. The cache lifetime, or time to live (TTL), is 5 minutes or 1 hour.
/usagehas a “Prompt cache (main)” line: hit ratio, misses, warm or cold, the TTL in effect and the likely cause of the last miss4. The status line receives aprompt_cacheobject withexpires_atandrecache_tokens_if_cold, the tokens your next request rewrites if the cache has gone cold5. One command generates the script5,3:/statusline show the prompt cache status: warm or cold, the TTL and the minutes left before it expires- Keep the base context small. Cached reads are cheap but not free: a one-line question in an all-day session “still draws usage for the whole conversation”4. Keep CLAUDE.md under 200 lines, move specialised instructions into skills, and send noisy test or log output to subagents4.
- Leave tool search on, and keep
/advisoroff if cost matters. Tool search, the default on supported models, stops Model Context Protocol (MCP) server changes from breaking the cache1. The advisor reads the full transcript uncached on every call9.
Most switches break it; most settings don’t
| Breaks the cache | Keeps the cache |
|---|---|
|
|
The pattern follows from the prefix rule: anything that changes the start breaks the cache, anything appended at the end keeps it3. A subagent has its own system prompt and tools, so it builds its own cache on a 5-minute TTL and leaves yours intact. A fork inherits your prefix exactly and reads your cache, as long as it runs on the same model1.
How long the cache lives depends on how you pay
| Request | Subscription, within plan usage | Usage credits, API key or cloud provider |
|---|---|---|
| Main conversation | 1 hour | 5 minutes |
| Everything else: subagents, workflows, teammates, forks, compaction, titles | 5 minutes | 5 minutes |
Once you draw on usage credits, the main conversation drops to 5 minutes too. Since v2.1.242, promptCacheTtl and subagentPromptCacheTtl take 5m or 1h, and claude -p "hello" --output-format json shows which one you get under usage.cache_creation1.
On an API key, 1 hour costs more up front: at 102k tokens, the first write is $0.31 more than a 5-minute one. One pause of 5 to 60 minutes saves about $0.47, more than that premium. For agent loops that never pause, or breaks longer than an hour, 5 minutes is cheaper (our arithmetic from Anthropic’s price list)2,3. Subagents that wait on a long test run or a permission prompt are the exception: give only those cacheTtl: 1h under the experimental field of their frontmatter (v2.1.248+)1.
Where people disagree
Much of the argument traces to 6 March 2026, when Anthropic changed how Claude Code picks a TTL per request and many requests moved to 5 minutes, mostly subagent requests according to one user’s logs10,11. On Hacker News (HN) the complaint was trust: “One of the largest AI companies on Earth cannot figure out an algorithm for when not to drop caches in long-running sessions?”10. Anthropic’s Jarred Sumner said the change made Claude Code cheaper, because “a meaningful share of Claude Code’s requests are one-shot calls where the cached context is used once and not revisited”11. An HN commenter who runs Anthropic models through pi, a different coding agent, agreed: “the much higher cost of 1h caches is almost never a good tradeoff”10.
The advice to clear gets pushback too: “/clear only works for new, completely different jobs — that’s rare in development”12. That is the case for a handoff note over a bare /clear.
Watch two open questions
Anthropic doesn’t publish how cache reads and writes count against subscription limits. Asked on GitHub, Anthropic replied in April 2026 “we’ll follow up there”; as of November, the docs still don’t say10,4. Until they do, judge your habits by /usage, not by quota guesses. Keep-alive pings, a loop that messages Claude every few minutes to keep the cache warm, are a community workaround: each ping is a full cached read, and nobody has measured whether they pay off6,13. Revisit this when Anthropic documents quota weighting.
Notes
- 1Anthropic, “How Claude Code uses prompt caching”, Claude Code docs, updated 6 November 2026. code.claude.com
- 2Anthropic, “Pricing”, Claude API docs, 21 October 2026. platform.claude.com
- 3Marek Elmayan, “Prompt caching in Claude Code: why your coffee break costs more than your prompt”, melmayan.fr, 13 October 2026. melmayan.fr
- 4Anthropic, “Manage costs effectively”, Claude Code docs, 2 November 2026. code.claude.com
- 5Anthropic, “Customize your status line”, Claude Code docs, 30 October 2026. code.claude.com
- 6Anthropic, “Prompt caching”, Claude API docs, 15 September 2026. platform.claude.com
- 7Thariq Shihipar, “Lessons from building Claude Code: Prompt caching is everything”, claude.com, 30 April 2026. Vendor blog. claude.com
- 8Alejandro AO, “Prompt Caching Explained: Stop Overpaying for AI Agents”, Hugging Face on YouTube, 10 August 2026. youtube.com
- 9Anthropic, “Escalate hard decisions with the advisor tool”, Claude Code docs, 21 October 2026. code.claude.com
- 10Hacker News, “Anthropic downgraded cache TTL on March 6th”, discussion of GitHub issue #46829 and Anthropic’s reply, 12 April 2026. news.ycombinator.com
- 11Tim Anderson, “Anthropic: Claude quota drain not caused by cache tweaks”, The Register, 13 April 2026. theregister.com
- 12Comments on Sharbel A., “Paste This Into Claude Code, Never Run Out Of Tokens Again”, YouTube, 19 August 2026. youtube.com
- 13Chase AI, “You’re Paying Anthropic 20x MORE Than You Need To”, YouTube, 6 August 2026, and its comments. youtube.com


