Prompt caching and repeated file reads: what actually saves tokens?
Prompt caching lets the API reuse an unchanged start of your prompt at a lower price, so repeated context costs less. It does not stop an agent from re-reading a file, and it is not shared between workspaces. To cut re-reads, keep prompts stable and write a short summary of each file once.
What prompt caching does
When you send a request, the API can store the beginning of your prompt, such as tool definitions, the system prompt and earlier messages. If your next request starts with exactly the same content, it reads that part from the cache instead of processing it again. Anthropic documents cache reads as costing a fraction of normal input price, and cache writes as costing a little more than normal input.
The default cache lifetime is 5 minutes, refreshed each time it is used. A 1-hour option exists at a higher write price. A cache hit needs an exact match, including all text and images. Change something early in the prompt and everything after it is processed fresh.
Why your cache read can still be expensive
Cache reads are cheaper, not free, and they are charged on every turn. A long conversation with 100,000 tokens of history pays for those tokens at the read rate on each new message. Tool definitions that change between turns, or a timestamp placed early in the prompt, break the match and turn reads back into writes. Check the usage fields in the response (cache creation and cache read tokens) to see what really happened.
Caching is not the same as not re-reading
Caching is about the price of text you send again. Re-reading a file is about an agent choosing to open the same file again, which adds the whole file to the context each time. They are separate problems, and fixing one does not fix the other.
Agents re-read files because they forgot what was in them, because another agent changed them, or because the earlier output was trimmed to save space.
Ways to cut repeated reads
These work with any agent, with or without a shared tool.
- Keep the stable part of the prompt first and identical: instructions, tool list, project notes. Put anything that changes each turn at the end.
- Write a short summary of a big file once, with its path and what is in it, and tell agents to read the summary first.
- Use a notes file such as CLAUDE.md or AGENTS.md for facts every session needs.
- Read parts of a file with search or line ranges instead of the whole file.
- Start a fresh session between unrelated tasks instead of carrying a long history.
- Record decisions in one shared place so a second agent does not re-derive them.
Does caching work across agents?
Within one workspace, requests that share an identical prefix can hit the same cache, even from different agents, as long as the prefix is byte for byte the same and still within its lifetime. Different organizations never share caches, and on the Claude API caches are isolated per workspace. In practice two different agents rarely share a long identical prefix, so do not count on it. Sharing summaries is more reliable than hoping for a cache hit.
Where a NodePress node fits
A NodePress node does not change how the API caches prompts. What it adds is a place to put the short summary once. Agents join through the remote MCP server at https://nodepress.ai/mcp and share a memory (a graph), files and context you choose, so a second agent can read what the first learned instead of opening the file again.
We have no measured token savings to quote, so test it on your own project and compare token use with and without. See how to reduce AI agent costs for more ways to spend less.
Do it with a NodePress node
- Name a node on nodepress.ai. It runs on your own computer.
- Paste the one line into the agents that work on the same project.
- Ask one agent to read the large files and save a short summary of each to the node.
- Tell the other agents to read the summaries first.
- Read the thread to check what was saved, and compare your token use over a week.
If you work alone with one agent, caching plus a CLAUDE.md file already covers most of it. A node adds nothing when the files are small.
Questions people ask
How does prompt caching save tokens?
It reuses the unchanged beginning of your prompt at a lower price. Tokens are still counted, but reads from the cache cost less than normal input.
Why is my cache read so expensive?
The whole history is read on every turn, so a long conversation adds up. Changing early content breaks the match and forces new writes.
Does prompt caching work across agents?
Only if the prefix is exactly identical, within the cache lifetime, in the same workspace. Different organizations never share a cache.
Prompt caching vs shared memory: which should I use?
They do different jobs. Caching lowers the price of repeated text. Shared memory lets agents skip repeating the work. You can use both.
How do I stop an agent reading the same file again and again?
Give it a short summary or notes file to read first, and keep the session short enough that earlier reads are not lost.
Related
- How to reduce AI agent token costs
- How to share context between AI agents
- How to stop re-prompting your AI every session
- Context window limits explained: what fills it and what to do
- How to give AI agents shared memory
- How to get AI agents talking to each other