Domain 5 · Context Management & Reliability

Prompt caching

If every request re-sends the same big system prompt, tool list, or document, you pay full price to process those tokens every single time. Prompt caching lets Claude remember a prefix it already processed and reuse it at a fraction of the cost and latency. Toggle caching and watch the bill — and the clock — drop.

cache_controlprefix reuse cache write vs readlatency stable prefix first
Explain like I'm 10
Imagine telling a long bedtime story every night, but you always start with the same boring 10-minute intro before the new part. Wouldn't it be nice to bookmark the intro so you skip straight to "…and then, tonight's new adventure"? Prompt caching is that bookmark. Claude remembers the part that never changes and only does fresh work on the new bit — faster, and way cheaper.

Compare the bill: cache off vs on

You're answering 20 questions about the same 50-page contract. Without caching, all those contract tokens are reprocessed on every question. With caching, the first call writes the cache (a small premium), and the next 19 read it cheaply. Move the slider:

no cache
with cache

The rules that make it work

Exam trap: caching only helps when a large, identical prefix repeats and comes first. Ordering volatile content before stable content (so the prefix changes each call) is the classic mistake — every call misses. And caching tiny or one-off prompts wastes the write premium. Cache the big, stable, reused head; keep the variable tail outside the breakpoint.
Takeaways: prompt caching reuses an already-processed prefix to cut cost and latency. Order stable content first (system → tools → docs) and mark the breakpoint with cache_control; the variable user turn goes last. First call writes (small premium), later calls read cheaply — worth it from ~2 reuses, within the cache TTL.

Curated companion: Anthropic — Prompt caching.