How it works
The provider hashes or otherwise matches a prefix of the prompt, often up to a cache breakpoint the request marks, and reuses the computation it already did for that exact token sequence. The system prompt, the tool definitions and any other stable front matter are the usual contents. A single changed token in that prefix misses. The cache does not know that two sentences mean the same thing. Billing often prices the cached prefix differently from the uncached tail, which is why a stable prefix shows up on the invoice as well as on the latency chart.
Caching does not enlarge the context window. The cached tokens still count as tokens in the call. It also does not remember a previous answer. A semantic cache returns a stored reply for a similar question. Prompt caching returns nothing to the user by itself. It only lets the provider skip redoing a prefix that matched byte for byte, or token for token. Edit the prefix and you have a new instruction and a cache miss at the same time. Those two effects should not be confused when the behaviour changes.
A worked example
A thousand dispute narratives, one unchanged prefix
Each night a card issuer classifies dispute narratives. The system prompt and the scheme-rule extract are identical for every narrative, and the narrative itself is the tail. The provider reports a large cached-prefix portion on each call after the first. One night a developer inserts a single sentence about goodwill refunds at the top of the prompt. Every narrative misses the cache, the bill moves, and the classifications move too. The classifications moved because the instruction changed, not because the cache forgot the old disputes. The cache had never stored those disputes as answers. It had only reused an identical prefix. Restoring the old prefix brings the cache hits back and restores the old instruction with them.
Illustrative example, not a production trace and not a measured result.
What goes wrong
- A timestamp, a request id or a greeting is placed in the prefix, so every call misses and the team concludes that caching is broken.
- The tool schema changes key order between releases, the prefix no longer matches, and latency and cost jump on a deploy that looked unrelated to prompts.
- A reworded question is expected to hit because it means the same thing, and it misses, because the feature compares tokens rather than meaning. Identical prefix tokens are required.
How to measure it
Read the provider's cached-token and prompt-token fields per call, grouped by the prefix version. A miss after a one-token edit is expected. A miss with an unchanged prefix is a breakpoint or a moving-header problem.
When behaviour changes on the same night as a cache-rate change, diff the prefix before you blame the cache. Compare cost per task and task success for that cohort with the previous prefix. Note the version.
Further reading
How Abracadabra helps
A sudden move in cost per task, with the prefix text unchanged, is a caching question. A move in decisions on the night the prefix text changed is an instruction question that happens to miss the cache as well. Compare both figures for that cohort.
When context is lost, people restate a fact or repeat the request. Abracadabra pins those corrections and repeated intents to the turn. After a change to what the agent keeps, compare task success for that task and cohort with the previous period.
Request access to read this on your own agent.