How coding agents like Cursor quietly cut input costs by reusing KV states across turns — and what actually breaks the cache A developer discovered that Cursor, an AI coding agent, achieved nearly 99% cache read rates by reusing Key/Value states from the transformer prefill stage across turns. Prompt caching exploits prefix stability, where static content like system instructions and file context is placed first, so only new user input is recomputed, drastically reducing input costs. However, any divergence in the token prefix breaks the cache, forcing full recomputation. I was poking around my usage dashboard in Cursor and noticed a metric I'd never paid attention to before: Cache Read . Date Type Model Tokens May 2, 06:50 PM Included auto 898K → Cache Read May 2, 06:49 PM Included auto 1.4M → Cache Write May 2, 06:47 PM Included auto 346.8K → Input / Output Almost 99% of my input tokens for that session were served from cache. That sent me down a rabbit hole on what prompt caching actually is , and why it matters so much for agentic coding tools specifically. Here's what I found. Agentic coding tools ship a lot of context on every single call — system instructions, workspace rules, file contents, conversation history, the works. LLMs are stateless by default, so naively, all of that gets reprocessed from scratch on every request. Prompt caching short-circuits this. It saves the intermediate computation from the transformer's prefill stage — specifically the Key/Value states — so that when a later request shares the same leading sequence of tokens, the model reuses those states instead of recomputing them. One important caveat: this only applies to input tokens. Output generation is still sequential, token-by-token, and gets no speedup from caching. Coding agents don't just fire your question at the model. They assemble a large composite prompt, and — critically — they structure it with the most static content first and the most volatile content last: