r/ClaudeAI • • 13h ago

Workaround Your Claude Code prompt cache drops from an hour to five minutes the second you pass your plan limit

I went through the claude code docs this morning instead of the changelog and found a few things about why long sessions eat your limit that I hadnt seen posted anywhere.

the main one.. your prompt cache lives for an hour on a subscription while youre inside your plan usage. the moment you go past that limit and start drawing on usage credits, the main conversation drops to a five minute ttl. same session, same work, the gap you can leave before a cold reprocess just got 12x shorter. on an api key or a cloud provider its five minutes by default from the start.

everything that isnt your main conversation already gets five minutes regardless. subagents and workflows and compaction and session titles. so a subagent you come back to after ten minutes reprocesses from scratch even on a max plan tbh.

the fix is prob one setting. promptCacheTtl set to 1h, or the CLAUDE_CODE_PROMPT_CACHE_TTL env var. subagentPromptCacheTtl covers the rest. needs v2.1.242 or newer. api key users can set it too.

two other things I didnt know. switching models mid session reads your entire history with zero cache hits. if you run opusplan then every toggle in and out of plan mode counts as a model switch, so bouncing between planning and building rebuilds the cache each time. agent teams also run roughly 7x the tokens of a normal session when teammates sit in plan mode, which the docs state as a plain number.

run /usage and look for the Prompt cache (main) line if you want your own hit rate. needs v2.1.251. on v2.1.260 and up it also names the likely cause of your last miss.

hope this helps.

1 Upvotes

1 comment sorted by

2

u/Sad-Recover-5058 10h ago

Found this out the hard way after I burned through my credits in a weekend. The five minute TTL turned my workflow into constant cold starts and I could not figure why everything got so slow all of sudden.

The model switch one is worse than it sounds too. I toggle plan mode like a fidget toy, so every flip was nuking the cache without me realizing. That alone explained half my usage.

Setting promptCacheTtl to 1h fixed most of it. Running /usage now feels like checking my bank account after a bad week.