Claude Code Explains Prompt Caching Mechanics
Claude Code’s documentation explains how exact prefix matching reuses system instructions, project context, conversation history, and tool definitions across requests. It details cache invalidation triggers, TTLs, subagents, compaction, and cache performance metrics.
Prompt caching is not merely an optimization—it shapes how agent systems should be designed.
- –Stable prompts and tool definitions should come first, with dynamic context appended later.
- –Model switches, effort changes, MCP updates, upgrades, and compaction can trigger costly cache misses.
- –Editing repository files preserves the cache, but CLAUDE.md changes wait until a restart, /clear, or /compact.
- –Developers can monitor cache-read versus cache-creation tokens to diagnose latency and usage spikes.
DISCOVERED
1d ago
2026-08-30
PUBLISHED
1d ago
2026-08-30
RELEVANCE
AUTHOR
dani_avila7