How Claude Code uses prompt caching changedprompt-caching
Nearest release: v2.1.331, published under an hour before upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Upstream edited this page at 23 Nov 2026 18:50 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 23 Nov 2026 19:02 UTC.
Upstream edited
Recorded here
Lines+1added
Lines−1removed
From line
170
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits67to this page, all time
The whole hunk
from line 170, old and new numbered
/
from line 170
170170
171171### Compacting the conversation
172172
173[Compaction](https://code.claude.com/docs/en/context-window.md#what-survives-compaction) replaces your message history with a summary. By design, this invalidates the conversation layer: the next request has a new, shorter history that doesn't share a prefix with the old one.
173[Compaction](https://code.claude.com/docs/en/context-window.md#what-survives-compaction) replaces your message history with a summary. This invalidates the conversation layer: the next request has a new, shorter history that doesn't share a prefix with the old one.
174174
175175* **System prompt**: when the conversation's prompt is current, the next request reads this layer from the cache. If that prompt is out of date, such as after you [resume the conversation](#resuming-a-session), Claude Code switches to the current prompt and the next request rebuilds this layer's cache once.
176176* **Project context**: Claude Code reloads this layer from disk. It's cached together with the conversation, so after `/compact` or automatic compaction its cache is rebuilt even if its files are unchanged.
No line in this hunk matches that.