Build1 distinct publisher3 min readPublished
Provider prompt caches bill a reused prefix at roughly a tenth of input, so an agent that rewrites its own history to save tokens forfeits the discount and pays to re-prefill everything ahead of the edit.
The Engineer · Build desk

Compiled by The EngineerSomething wrong?How this is made
Start with what the provider actually does when your compactor rewrites turn three of a twelve-turn session. The prefix no longer matches verbatim, so nothing before the edit is reusable, and the whole prefix is processed again [3][2]. You also pay to write the new prefix, which on some newer model families bills at 1.25x input [6]. Edit again on the next turn and you buy another write and never collect a read [5].
The pricing is worth doing by hand. Reads run at roughly 0.1x full input price [6]. Over N requests sharing a prefix, the cached path costs 1.25 + 0.1(N-1) against N for the uncached path, and the two cross just above N = 1.28 [2]. A prefix used twice has already paid for its write. That is why the write premium is tolerable at all, and why a compactor that manufactures single-use prefixes is expensive: it pays the premium every turn for a discount it never reaches.
Both cited results are somebody else's workload. Shrinking tool output 38.4% while the bill rose 6.8% [8] means each surviving tool-output token cost about 1.73x what it did before, if you divide the new bill by the tokens left [1]. That transfers only if your spend is dominated by input tokens on a genuinely reused prefix and your compactor edits inside it. If your volatile content already sits after the anchor, the study describes a bug you do not have.
The coding-agent number is narrower still. Going from 27/40 to 15/40 patches is a 44% relative fall in success [9][4], and the stated cause is broken code anchors [9]. To reproduce that, your agent has to quote file content back into its edits by literal or line number, so a summarizer can quietly remove the thing the patch is keyed to. Agents that address files by path and let the tool do the reading are not exposed the same way.
Routing constrains the other axis, and it gets less attention. Requests hash to a machine by prefix, each machine serves roughly 15 requests per minute for that prefix, and the overflow spills to machines that miss [7]. That is one request every four seconds [5]. A fan-out agent firing twenty parallel subtasks at one shared system prompt is generating misses by design. The playbook's answer is to shard deliberately with a routing key [7], declared alongside an explicit cache mode and TTL in the request body [11].
Defaults are short. The author puts OpenAI near 30 minutes and Anthropic near 5, with 10 to 60 minutes as the tuning band for interactive sessions [12]. Keepalive reads at 240 to 480 second intervals are offered as the way to hold a prefix across builds and human approvals [13]. Against a 300-second TTL, a 240-second ping leaves 60 seconds of margin [6]. His own caveat is the load-bearing one: measure first, because a ping into an evicted cache pays the full write [13].
The rule I would take from this is narrow. Compaction stays, but it happens before the write and never behind it, and everything volatile, timestamps included, goes after the anchor [10]. The number on the dashboard becomes cache hit rate next to time-to-first-token, not tokens per turn, because tokens per turn is precisely the metric that made this failure look like a win.
Ranked by verification strength, evidence, and original report placement.
The playbook argues that token minimization is the wrong first principle for agentic LLM systems when provider prompt caches are in play.
Providers store the model's internal key/value state after processing a prompt prefix; when a later request begins with the same prefix the provider reuses that KV state instead of reprocessing those tokens, reducing time-to-first-token and input billing.
Caches typically match on verbatim prefixes or on explicit breakpoints, and any change inside the cached prefix invalidates a hit.
Aggressively compressing, reordering, or retroactively editing history causes cache misses and full re-prefill of the prefix, extra diagnostic turns and retransmissions to recover lost anchors, and repeated cache writes for content that will never be reused.
The recommended pattern is to keep cacheable anchors such as the system prompt, tool definitions and stable instructions verbatim at the front of the prompt, move volatile content such as tool outputs, ephemeral runtime state and timestamps outside the cached prefix, pre-inject compressed summaries before a cache write rather than retroactively pruning cached history, and avoid inline timestamps, UUIDs or session-specific strings in the cached area.
The OpenAI-style example in the playbook sets prompt_cache_options with mode "explicit" and a ttl of 30m plus a prompt_cache_key of "my-agent-shard-42", and the author notes provider fields differ.
Distinct publishers with included, body-backed reporting in this cluster.
dev.to
1 article · September 2, 2026
Follow any of these and your For You feed starts watching them — no settings page required.
build
Prompt caching cuts agent API costs 41-80%, but only if tool results stay out of the cache1 distinct publisher
build
A semantic cache hit saves five times what a prompt cache hit saves1 distinct publisher
build
OpenClaw makes the channel the architecture, and the reasoning loop a lodger1 distinct publisher
build
Count invalid JSON as a failed classification, and model choice becomes a reliability problem1 distinct publisher
Evidence-backed comparisons of source perspectives and observed adoption signals. Read the methodology
Which Builder, Operator, and Investor concerns the observed source mix emphasized—not a truth score.
Evidence, demonstrated adoption, hype gap, incentives, and confidence are assessed independently, each on its own current evidence. How these are measured.
One post, no citations
The mechanics hold up on their own terms — prefix reuse, verbatim matching, the consequence that editing cached history forces a re-prefill — and they are described consistently enough to check against any provider's caching documentation. The quantities do not. 38.4%, 6.8%, 27/40 to 15/40, 1.25x writes, 0.1x reads, a 1,024-token floor, 15 requests a minute: every one of them appears in exactly one dev.to post, most hedged with 'commonly' or 'some newer model families', none tied to a rate card or a named experiment.
No named users
There is nobody to count. The cost study has no author, the coding-agent test names neither model nor task set, and the operations flow that supposedly gained latency and accuracy belongs to an unspecified 'we'. Prompt caching itself is evidently shipping at the two providers whose defaults get quoted, but that is background, not evidence that anyone has adopted the pattern this reporting argues for.
Precision outruns provenance
Decimal points are doing persuasive work. '38.4%' and '6.8%' read like the output of an instrumented run, and arithmetic on them — about 1.73x per surviving token — only makes them sound more settled. Strip the figures and what remains is modest, sensible and cheap to test: keep the stable head of your prompt byte-identical and put the churn after it. The overstatement is in the confidence of the numbers, not in the advice.
Reputation, not revenue
Nothing is for sale here. This is a self-published practitioner piece with no sponsor, no product, and no affiliate link; the pull is toward sounding authoritative — a 'playbook', a five-step checklist, a house anecdote nobody can audit. One alignment goes unremarked: the advice points toward larger, longer-lived cached prefixes and more cache writes, and by the post's own figures writes bill at a premium. That does not make the advice wrong, but a reader should notice which direction it pushes spend.
Direction yes, magnitudes no
We are confident about the sign and not the size. If caches match verbatim prefixes, then rewriting history to save tokens forfeits the discount and pays to re-prefill — that follows, and the post states the premise plainly. Whether the penalty in your system is 6.8% or ten times that is unknowable from this reporting, which is exactly why its closing instruction to A/B one expensive path and log the cache counters is the soundest sentence in it.