Claude Code implements automatic prompt caching, reducing input token costs to 10%

Anthropic detailed how prompt caching functions in Claude Code. Without caching, the API would reprocess the entire history on every step: system prompts, project context, past messages, and tool outputs. The cache reuses processed prefixes and only computes changes.
Matching relies on exact prefix alignment. Claude Code sorts content into layers: system prompts and tools, then project context (CLAUDE.md, memory), and finally the dialogue. Changes in an early layer invalidate everything that follows.
Cache invalidation occurs upon changing models, effort levels, enabling fast mode, adding an MCP server to the prefix, or upgrading Claude Code. The default TTL is five minutes, with a one-hour option for subscribers. You can enable the longer TTL via the ENABLE_PROMPT_CACHING_1H=1 environment variable.
Up next
Capacitor persists Claude Code and Cursor sessions to a shared store
Claude Code sessions often vanish after an OS update or reboot, losing all context and history. Capacitor solves this by logging every agent session to an event store with a unique ID. You can now resume work on a different machine or hand off a full session to a colleague.
Related stories
- Claude Code sends 33k tokens before it even reads your prompt; OpenCode uses 7k
- Anthropic’s Claude.dev hub ships guides and easter eggs
- Claude Code plugins become Claude Mods, shipping in weeks
- Function Hooks would wrap Claude Code like middleware
- Claude Tag takes the first pass at Anthropic’s CI alerts
- Claude Code 2.1.247 drafts its own feedback reports
Comments
No comments yet. Be the first.
Join the conversation
Sign in to leave a comment. It appears after moderation.

