# Claude Code now compacts automatically before the cache expires


A user reports seeing for the first time that Claude Code compacts a session automatically before its context cache expires. They previously performed this compaction manually, and describe having lost around 600k tokens of context when they forgot to compact mid-session.

The post shares a screenshot of the behavior and thanks Anthropic, framing the change as an improvement aimed at saving users' tokens. The report is based on the user's own observation and does not include a changelog or official documentation.

## Media

![Image: Claude Code Compacts Automatically Before Cache Expires, THANK YOU&#33;](<https://preview.redd.it/rkhs9s4avcuh1.png?width=140&height=12&auto=webp&s=5d3fa22ae7d368b20fff7dd7c6dc4584a45498b4>)

[Image: Claude Code Compacts Automatically Before Cache Expires, THANK YOU&#33;](<https://preview.redd.it/rkhs9s4avcuh1.png?width=140&height=12&auto=webp&s=5d3fa22ae7d368b20fff7dd7c6dc4584a45498b4>)
