Should you run /compact on a schedule in Claude Code? Deciding when to press it from the official spec
Plenty of people press Claude Code's /compact on a rule like "every 30 minutes" or "once context passes 70%", but what the official documentation recommends is neither a clock nor a percentage: it is a break in the work. Run /compact at a natural breakpoint, such as between tasks, rather than waiting for auto-compaction to trigger in the middle of a task. This article takes the Claude Code documentation as of 8 August 2026 (latest release v2.1.226) as its primary source and works the manual-compaction question out from the spec. It starts with the machinery: compaction runs in three stages, namely dropping old tool outputs, auto-compaction, and the manual /compact you press. The second and third are the same processing, so pressing it yourself buys exactly two things, choosing the timing and specifying what to keep. Pressing it more often does not save extra context. Next comes a table of what survives. The CLAUDE.md at the project root and your auto memory are re-injected from disk, while rules carrying paths: and nested CLAUDE.md files in subdirectories are lost until a matching file is read again, and the bodies of skills you invoked are re-injected under a cap of 5,000 tokens per skill and 25,000 in total, with the oldest dropped first. On cost, the price of a compaction is set not by the size of the context but by whether the prompt cache is warm. Press it mid-session and the prefix is read from cache, which is cheap; press it after a break longer than the cache lifetime (one hour on a subscription, five minutes by default on an API key) and the whole history is reprocessed uncached, which is the most expensive that command ever gets. From there the article covers how to choose between /compact, /clear, /rewind, /recap and /context, how /autocompact from v2.1.221 moves the automatic firing point anywhere from 100K to 1M tokens and the precedence of the four places the setting can come from, the trap that only the environment variable accepts a plain integer, and the meaning and recovery steps for the two messages "Not enough messages to compact." and "Autocompact is thrashing: the context refilled to the limit...".