Prompt cache boundary playground
Move the cache boundary and the changing value through an agent's prompt, and watch reads, writes and cost. A companion to my notes on Lumer et al., "Don't Break the Cache" (arXiv:2601.06007v2).
1. Pick one of the paper's four cache modes, or move things yourself
2. One request, front to back
read from cache
written to cache
plain input (computed, not stored)
▼ cache boundary
▲ changing value
Drag along the strip to put the boundary at the end of a segment. S = tools + system prompt, Q = question, C = assistant message with tool call, R = tool result.
3. Whole run: input cost only
read from cache
written to cache
plain input
input cost
same tokens, no caching
saving (negative = costs more)
The four modes with your current sizes, prices, sessions and machines:
| Mode | Read | Written | Plain | Cost | Saving |
|---|
4. The task, the prices, and where requests go
5. Requests
| Request | Machine | Length | Read | Written | Plain | Cost |
|---|
Click a row to show it in the strip. With several sessions, the table lists all of them in order.
Assumptions
- One explicit cache breakpoint per request. A write stores the prefix up to the boundary. A later request reads the longest stored prefix that matches it exactly, at or before its own boundary. Real providers differ: some cache automatically, some allow several breakpoints, and some look back only a limited number of blocks.
- Matching is exact to the token. Real caches match in blocks or increments.
- A "changing value" is different on every request, takes zero tokens, and makes everything after it impossible to reuse. A write that reaches past it is still charged.
- A write covers the tokens between what was read and the boundary, at the write price. Everything else not read is plain input.
- Entries never expire or get evicted. Requests run one after another, so a write is ready for the next request.
- Sessions share only the tools and system prompt. Each has its own history, and all use the same sizes.
- "Same prefix goes to the same machine" always succeeds, with no overflow. Round robin sends requests to machines in turn.
- Cost counts input only. Output tokens and storage fees (the paper lists one for Google) are left out. Prices apply the same mechanics to every preset.