Prompt caching stores the model's key and value tensors for a prefix and reuses them when the next request starts the same way. That reuse is computed from the front of the request: change one character before the breakpoint and everything after that point is recomputed at full price (a practical guide to prefix caching). This is not semantic matching. Two prompts that mean the same thing but start with different tokens cannot share a cached prefix (how prompt caching works).
The mechanism is a hash over the cumulative prefix. Anthropic's own documentation, as summarized in a walkthrough of breakpoints, states that cache hits require 100 percent identical prompt segments up to and including the marked block, and that a breakpoint belongs on the last block that stays identical across requests rather than on the varying block (breakpoint placement walkthrough). OpenAI's approach is automatic: it caches the longest matching prefix of prompts longer than 1,024 tokens, growing in 128-token increments (OpenAI prompt caching guide).
The financial consequence is what makes this a CI problem. A timestamp in a system prompt forces a fresh cache write on every call and never a read, with no error and no warning, which in one cost model multiplied an 80-turn session's input cost by 7.8 (five ways to invalidate your prompt cache). On the read side, cached tokens bill at a fraction of base input, and one published analysis puts reads at 0.1x base input with writes at 1.25x or 2x depending on TTL (Anthropic caching pricing mechanics). A silent miss therefore is not a small tax.
Teams already treat this as an operational metric. The Claude Code team alerts on cache hit rate and declares incidents when it drops (prompt caching field guide). CI is a cheaper place to catch the cause than a production dashboard is to catch the symptom.



