Blog

Prompt caching in Claude Code, explained for developers

Token Coach ·

Short answer: Claude Code caches the repeated start of your context automatically. Cached tokens are much cheaper. Idle gaps and edits near the start of the context break the cache.

What gets cached

Each turn starts with the same material: system instructions, tools, CLAUDE.md and the conversation so far. Claude Code caches that shared start, so the next turn reads it from cache instead of paying full price for it again.

Why it matters

Cache reads cost a small fraction of fresh input. In a long, steady session most of your context is cached, which is a large part of why long sessions are affordable at all.

What breaks the cache

Habits that keep it warm

  1. Work in focused bursts in one thread.
  2. Settle CLAUDE.md and MCP setup before a long session, not during it.
  3. After a long break on a long thread, consider a handoff note and a fresh thread instead.

See your cache at work

CTO reads your local session logs and shows how much of each session came back from cache, and tells you when a habit is breaking it.

Questions

Do I need to turn on prompt caching in Claude Code?

No. Claude Code caches automatically.

Why did one turn cost much more than the others?

Usually the cache expired after an idle gap or the start of the context changed, so the whole context was billed fresh.

Try CTO free. Paste this in a terminal, then fully quit and reopen Claude Code:

claude plugin install --marketplace tokencoach/token-coach token-coach