The prompt cache is the most underrated savings mechanism: repeated requests with an unchanged context head cost a fraction of the price. Claude’s cache lives for about five hours; the rule “don’t edit the beginning of the context” is known to every practitioner, yet it’s broken more often than any other. We break down the mechanics, the rules, and the typical mistakes.
How the Cache Works
A request to a model consists of a “head” (the system prompt, rules, files) and a “tail” (the question). If the head matches a recent request, the provider doesn’t recompute it: you pay a fraction of the price for the cached part and the full price only for the tail. In the video-editing case the cache delivered 99% savings: 147 million tokens in the session, of which 213 thousand were written — the rest was cache.
At Anthropic the cache lives for about five hours from the last touch. Other platforms have a similar mechanics with their own timings. The practical consequence: working in sessions around the “head” is the cheapest mode.
What Breaks the Cache
- Editing the start of the context. Change one word in the system prompt — the cache is dead: all tokens are recomputed at full price. Rule: project rules are frozen for the session, not “tweaked” on the fly.
- Subagents in batches. Every subagent has its own context and its own cache miss; a batch of subagents within an hour multiplies the bill.
- Shuffling files. “Re-read these 20 files in a different order” — the head is different, the cache is dead.
- Long pauses. The cache has expired by time — the next request pays in full; break the day into sessions around the cache’s hours of life.
The Cache-Friendly Session Pattern
1. Открываете сессию: голова = [правила проекта + релевантные файлы] — фиксирована.
2. Все итерации задачи идут с этой же головой, меняется только хвост.
3. Задача завершена — итоги в файл правил (для следующей сессии).
4. Следующая задача — новая сессия с новой головой.The anti-pattern: “let’s also do something else in this same session” — the head inevitably changes, the cache dies, and the context gets clogged. One session — one task is the rule that protects both quality and money.
The Economics of the Cache
Measurements from practice: working without the cache versus with it — the difference in the price of a session is several-fold; Code Mode (batch tool calling) delivered −29% on the cost of a task, partly precisely on the cache. On long contexts the cache isn’t an option but a necessity: a million tokens of head without cache make the work irrational.
The new trend is RLM architectures: the model itself decides what to keep in context, treating the history like variables. This changes the role of the cache: compaction may die out. The trap of the transition period: editing the context breaks the cache even at 10% of the price of cached tokens.
Cheat Sheet: When the Cache Works and When It Breaks
The mechanics above come together in a table: if a session has become suspiciously expensive, find your row — usually one of the six situations is to blame. The table is assembled from the rules of the sections above and covers most of the questions people ask after the first big bill for a session.
| Situation | What happens to the cache | What to do |
|---|---|---|
| One word changed in the system prompt | The cache is dead: the whole head is recomputed at full price | Rules are frozen for the session, not on the fly |
| A batch of subagents within an hour | Each has its own context and its own cache miss | Budget the batch in advance |
| Files re-read in a different order | The head is different, there’s no match | A stable file order in the head |
| A pause longer than the cache’s life window | The cache has expired, the next request pays in full | Sessions are planned around the window |
| Cached tokens in usage near zero | The head changes from iteration to iteration | Discipline: one session — one task |
| A new session with the same head | The cache works while it’s alive and matches byte-for-byte | Don’t touch the head between sessions |
The last row is the most profitable and the most fragile: the cache’s five hours of life can span several sessions if the head wasn’t edited. Hence a practical daily rhythm: a morning and an afternoon session on the same head merge into one cheap loop, while an evening edit of the system prompt wipes out everything accumulated. The check takes a minute: before every edit of the head, ask yourself whether the gain from the edit outweighs the full recomputation of all its tokens. In most cases the edit can be postponed to the boundary between tasks — and the bill will notice it that same week.
The table also works in reverse: if the share of cached tokens in usage is high and the bill still grows, it’s the tail that grows. Then look not at the cache but at the volume of tasks: long answers, extra iterations, heavy tools. Diagnostics from the usage fields separates a broken cache from a bloated tail in a minute, without instrumenting the pipeline and without waiting for the end-of-month bill.
Frequently Asked Questions
How do you check that the cache works? The usage field of responses contains cached tokens: a growing share of cached tokens across iterations is a sign the cache is alive. Zero — the head is changing.
Does the cache work between sessions? Within the cache’s lifetime (5 hours for Claude) — yes, if the head matches byte-for-byte: opening a new session with the same rules and files, you keep using the cache.
Is it worth shortening the head for the sake of speed? No: the head is cached — a long stable head is cheaper than a short changing one.
Does the cache work on free tiers? The mechanics are provider-specific: for some yes, for others no — check via the usage fields of the particular platform.
Do the five hours count from the first request or from the last one? From the last touch: every request with the same head extends the cache’s life. That’s why continuous work doesn’t lose the cache midway, while a gap longer than the window pays for the full recomputation.
The rules do need changing — how do you do it cheaper? At the boundary between sessions: finish the task, record the outcomes in the rules file, open a new session with the new head. The recomputation happens once, not on every iteration in the middle of a task.
How much does it cost to break the cache on a long head? The full recomputation of all the head’s tokens at full price: on a million tokens it makes the work irrational. The trap of the transition period is that an edit hits the economics even at the reduced price of cached tokens.
Do subagents share a cache or does each have its own? Each has its own: every subagent has its own context and its own cache miss, and a batch within an hour multiplies the bill. If a subagent makes many iterations, its head must also stay stable.
The cache is a discipline, not a button: a stable head, one session — one task, rules files instead of on-the-fly edits. The cache’s five hours of life are your cheapest resource. The mechanics are as of autumn 2026.
