Menu

1 / 2

How the Claude Code prompt cache works, and why my long breaks cost the most

DEV Community: productivity·Muhammad Mairaj·1 day ago
#Q4HLvFzr
#devtoproductivity#devto#dev#cache#claude
Long article (1146 words) — no AI summary yet.
Reading 0:00
15s threshold

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.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.