In this article
Claude Code caching reuses processing of an unchanged request prefix; it neither removes that content from context nor supplies an earlier answer as the new result.
A follow-up turn often contains most of the same context as the preceding turn. Claude Code manages prompt caching automatically so supported requests can reuse processing of the unchanged beginning. The mechanism is easier to understand through the order of request layers than through the vague idea that the assistant remembers a file.
Recognize the stable request layers
The documentation describes system and tool definitions, project context and conversation as ordered layers. New exchanges usually extend the conversation at the end. An unchanged earlier prefix can therefore be reused while the new tail is processed. In a hypothetical debugging session, reading another relevant function appends evidence; it does not inherently require changing the instructions and tools that preceded the conversation.
Understand why an early change matters
Prefix matching is exact. A change near the beginning can invalidate reuse for the content that follows it. Adding or removing an MCP tool surface can affect system-level material, while a normal conversation message belongs later. The practical question is which request layer changed, not whether the edited text looked small in the UI. A small early edit can have a broad matching consequence.
Keep caching distinct from memory
Auto memory carries selected project learnings across sessions, while prompt caching reuses processing for matching request content. They are different mechanisms. A cached instruction still occupies context, and a recalled note still needs to be true. For the debugging example, the cache does not decide whether the newly observed failure is real; the model must interpret the fresh diagnostic in the supplied context.
Do not assume every setting changes the prefix
The official page lists actions that preserve caching and actions that invalidate it. Some workflow instructions append to conversation rather than rewriting the earlier system layer. Consult the documented behavior for the active setting instead of inferring it from the setting’s name. Model changes also matter because cache behavior is model-dependent. Avoid turning a general explanation into an unsupported promise of identical reuse across every backend.
Interpret usage with the actual request history
If reuse drops, compare the preceding configuration change, session lifecycle and request content before blaming repository edits. A file edit on disk is not automatically a rewritten system prompt. Usage observations should distinguish cached input processing from newly processed content and output generation. The result is a causal explanation of the session’s behavior, while exact costs and available cache options remain questions for current provider documentation.
Documentation and further study
Related engineering guides: Reproducible inference stacks: preserving a GPU pilot’s result; Choose a local AI stack: desktop chat, shared UI or coding agent.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.