What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Claude prompt caching can miss in a long agent loop even when much of the prompt is unchanged: each cache breakpoint searches backward through at most 20 block positions for a matching entry that an earlier request actually wrote. If the loop grows beyond that reach, or the breakpoint includes changing content, the stable prefix may not be reused. Put the breakpoint at the end of the stable prefix and add an intermediate breakpoint before a long turn can push the previous write out of range.
How Claude’s 20-position lookback works
Claude caches a cumulative prompt prefix: tool definitions, system content and messages up to a block marked with cache_control. That breakpoint writes a cache entry for the prefix ending there. On a later request, Claude checks backward from the current breakpoint for a matching entry previously written by an earlier request. Anthropic’s documentation describes the limit this way: “The lookback window is 20 blocks.” The current breakpoint counts as one of those positions, leaving 19 earlier positions to check. Anthropic’s prompt caching documentation.
As an Amazon Associate I earn from qualifying purchases.
“Block” here refers to a position in the API’s prompt structure, not necessarily an individual tool call. On the Claude API, a consecutive run of tool_use blocks counts as one position, and a consecutive run of tool_result blocks also counts as one. Do not assume the same counting behavior on other platforms without checking their documentation. Anthropic’s prompt caching documentation.
The boundary in Anthropic’s example
Anthropic illustrates the limit with a cache write at block 15 and a later breakpoint at block 35. From block 35, the lookup checks blocks 35 back through 16; block 15 is just outside the window and cannot be found. A nearer breakpoint can establish another entry within reach. This is a deterministic example of the documented rule, not a performance benchmark. Anthropic’s prompt caching documentation.
#1 Best Overall
Why a long agent loop can lose a cache hit
Agent turns may add many messages and tool-related blocks between requests. If that growth leaves the next breakpoint at least 20 positions beyond the previous write, the bounded search cannot reach that entry. An unchanged prefix is not enough: the entry must have been written earlier and remain inside the current breakpoint’s lookback window.
There is another common cause: placing the breakpoint after content that changes every request. A cache entry represents the entire prefix through the breakpoint, so a changing timestamp or user message changes the prefix. Searching backward does not automatically write an entry for the stable blocks before it. Anthropic advises placing the breakpoint at the end of the last stable block intended for reuse. Anthropic’s prompt caching documentation.
Automatic caching does not bypass the window. It places a breakpoint on the last cacheable block and follows the same lookback rule. If that block varies between requests, explicit placement at the stable-prefix boundary may be needed. Anthropic’s prompt caching documentation.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →How to keep caching working as the loop grows
- Put stable content first. Arrange relatively static tool definitions, system instructions, shared context and examples before the changing per-request suffix.
- Mark the stable boundary. Put
cache_controlon the last block whose full preceding prefix is identical across the requests you expect to share a cache. Avoid putting it after a timestamp or incoming message that changes on each request. - Estimate growth between writes. Count the positions likely to accumulate during a long agent turn. If the next breakpoint may end up 20 or more positions beyond the last write, establish a nearer breakpoint before that growth occurs.
- Use multiple breakpoints when needed. They can serve prompt sections that change at different rates or keep a growing conversation from leaving the earlier write unreachable. Anthropic documents a maximum of four breakpoints. The number of breakpoints does not itself create a separate fee; costs follow the cached content and cache operations. Anthropic’s prompt caching documentation.
- Check response usage. Inspect cache-read and cache-write usage in API responses to tell whether a request read a prior entry or wrote one. A stable-looking prefix alone does not establish that a cache hit occurred.
One breakpoint or several?
| Prompt or loop pattern | Practical approach |
|---|---|
| Stable prompt prefix followed by a short, changing suffix | Place a breakpoint at the end of the stable prefix; a single breakpoint may be sufficient if the write stays within lookback reach. |
| Long turns add many positions before the next request | Add a nearer intermediate breakpoint early enough to be written before growth pushes the earlier entry out of reach. |
| Prompt sections change at different rates | Consider separate breakpoints at stable boundaries, staying within Anthropic’s documented maximum of four. |
| Last cacheable block changes on every request | Use explicit breakpoint placement at the end of the stable prefix rather than relying on automatic placement there. |
Cache lifetime, cost and platform qualifications
Anthropic’s documentation describes a five-minute default cache lifetime and an optional one-hour duration at additional cost. Its standard rate examples list five-minute cache writes at 25% above base input price and cache reads at 10% of base input price. These are relative rates, not fixed dollar prices; check the current pricing schedule for the specific model and platform before estimating costs. Anthropic’s prompt caching documentation.
Rank #3
Feature availability can differ by platform. Anthropic’s documentation says the legacy Amazon Bedrock integration for Opus 4.6 and earlier does not support top-level automatic caching, so that integration requires explicit cache breakpoints. Confirm current model and platform support in the relevant feature documentation before relying on automatic caching. Anthropic’s prompt caching documentation.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




