Claude Code prompt caching: pick one model and never switch mid-task
Switching models, changing MCP servers, or compacting mid-task breaks the prompt cache; routing micro-decisions to Jev keeps them out of the prefix entirely.
THIS IS A PURE F*CKING GOLDMINE Anthropic just shared one of the best tricks for Claude Code. The idea: every turn re-sends your whole history, and the only question is whether you pay full price for it again. The cache matches the start of your request, so one change anywhere in the prefix recomputes everything after it. You just start Claude Code like this: claude --model opus here's the split: → pick the model once, at the top, and never touch /model mid-task → every /model switch reads the entire history with zero cache hits → on Opus 5.5 changing effort keeps the cache, so the effort ladder is free → /advisor toggles keep it too, the advisor sits after the breakpoint three things quietly burn your prefix: → switching models in the middle of a task → connecting or removing an MCP server → compacting when you could have rewound instead Pick once. Append always. Rewind, don't compact. JEV engineering is the same move one layer down: the forks that need no thinker (which file, which tool, retry or stop) go to JEV in milliseconds and never enter the prefix at all, so the big models only see the ones that split the full tree > one model for the whole session, every switch starts a fresh cache > /rewind truncates back to a prefix that is already cached > /compact builds a new one, so save it for breaks between tasks > editing claude-md mid-session keeps the cache and also does not apply > subagentPromptCacheTtl 1h keeps subagent caches warm past five minutes > JEV routes micro-forks in milliseconds and never touches the prefix paste the tree and this prompt into Claude Code ↓ "Rebuild my Claude Code setup around this tree: 1. Add one rule to CLAUDE.md: pick the model at session start and never switch mid-task. 2. Set subagentPromptCacheTtl to 1h in my settings so subagent caches survive longer than five minutes. 3. Add a second rule: prefer /rewind over /compact, and only compact between tasks. 4. Route fast deterministic forks (tool choice, path selection, retries) through JEV. Show me every change as a diff first. No edits until I say go." ↳ http://code.claude.com/docs/en/prompt-caching save it, it'll come in handy.
This post quotes another post: x.com/hanakoxbt/status/2110067711363457244