If you use Claude Code, you're using something called the prompt cache, whether you've heard of it or not. It decides a big part of what each message costs, and it's why the same "continue" can be cheap one minute and expensive the next. Here's how it works in plain words, and what I found when I measured my own.
Claude doesn't remember your conversation
This surprises people. The model keeps nothing between messages. Every time you press enter, Claude Code sends the whole conversation again: its instructions, the files it has read, every earlier question and answer, and then your new message at the end.
Early in a session that's small. After an hour of work it can be hundreds of thousands of tokens, sent again on every single message. (A token is a piece of a word, about three quarters of one on average.)
The cache saves work it already did
Reading all that text takes real computing work. So Anthropic keeps the processed version of your conversation for a while. When your next message arrives and starts with exactly the same text, the model skips the part it has already read and only reads what's new.
Think of a bookmark. Instead of rereading a book from page one every time you pick it up, you open it where you stopped. The cache is that bookmark.
Three prices, not one
Because of the cache, the tokens you send are billed in three different ways:
- Normal input: new text the model hasn't seen, at the normal price.
- Cache write: saving text into the cache. This costs more than normal input: 1.25 times the price for a cache that lasts 5 minutes, 2 times for one that lasts an hour.
- Cache read: reusing text from the cache. This is the cheap one, a tenth of the normal price or less on current models.
In a healthy session you pay for one write, then read it again and again for almost nothing. In my logs, every token written to the cache was read back 64 times.
The bookmark falls out
The cache doesn't last forever. It lives for 5 minutes or 1 hour, depending on the setting, and every message that uses it resets the clock. As long as you keep working, it never expires.
Go quiet for longer than that and it's gone. Your next message has to write the whole conversation into the cache again, at the higher write price. People call this the cache tax: you pay it every time you come back to a session after the cache has expired.
One more rule: the cache only matches from the beginning. If something early in the conversation changes, everything after that point is written again. Claude Code is built to keep the beginning stable and only add to the end, so in normal use this is the timer's problem, not yours.
The study that made me check
Requesty looked at 30 days of coding-agent traffic and found that 23.1% of the Claude bill went to rebuilding caches that expired while the developer was away, with 5 to 30 minute pauses alone at 15.2%. They also report that Claude Code used the 1-hour cache on only 2% to 10% of large writes across most routes.
That's a strong claim, and it's about people like me. So I measured instead of nodding along. For me, the short pauses barely matter. The expensive moment is coming back to a long session after more than an hour.
What my logs say
Claude Code keeps a log of every session on your machine, including the token counts of each reply. I wrote a small tool, claude-cache-tax, that reads only the timestamps and token counts and sorts every cache write by the pause before it. This is my real output across 430 session logs:
Three things stand out.
Most of my cache writes use the 1-hour cache. 74.5% of written tokens, not 2% to 10%. Counting only my main sessions and leaving out subagents, it was over 95%. My Claude Code mostly runs on the longer timer, so a 10-minute break doesn't throw anything away.
Short pauses are a small slice. Replies after a 5 to 60 minute pause caused 7.2% of my cache writes. Real, but nowhere near the study's 15.2% for 5 to 30 minutes.
Long breaks are the bill. Only 377 replies, under 1% of the total, came after a pause of more than an hour. They caused 48% of all cache writes. That's me opening yesterday's huge session, typing "continue", and paying to process hundreds of thousands of tokens again.
Why the two results can both be true
The study measured traffic through an API gateway across several tools. I measured one person on one tool. Which cache timer you get depends on the tool, its version and how you pay, and my logs show the 1-hour timer most of the time. So the honest summary isn't that the study is wrong. It's that your cache bill depends on your setup and your habits, and you can check yours in about ten seconds.
What you can do about it
You don't need to change how you work. The cost of coming back depends on how big the conversation is, so make it small before you leave:
- Taking a long break mid-task? Type
/compactfirst. Claude Code swaps the long conversation for a short summary, so the rebuild when you come back is small. - Task finished? Type
/clearand start the next one fresh, instead of piling it onto yesterday's session. - Short pauses? Don't worry about them. In my logs they were a small part of the bill.
How I measured
claude-cache-tax reads the session logs in ~/.claude/projects. For each assistant reply it takes the timestamp, the model and the usage numbers Claude Code records, counts a reply logged twice only once, and measures the pause since the previous reply in the same log. The 1-hour and 5-minute split comes from fields Claude Code writes for each cache write. Prompts and replies are never read into the results, and nothing leaves the machine.
What this doesn't cover: it counts tokens, not money, because prices and cache multipliers change and differ by plan. It only sees Claude Code, not direct API calls or other tools. Subagents keep separate logs, so their first reply counts as a session start. And it's one developer's habits, which is exactly why you should run it on yours.
Try it
npx claude-cache-tax npx claude-cache-tax --days 7 npx claude-cache-tax --json The code is on GitHub, MIT licensed, with no dependencies. If you're curious what else agents leave behind in logs, I also built an audit trail for what AI agents do through MCP.
Measure your own habits before you trust anyone's average, including mine.



