You'll noticeTier: how much it should matter to you
3Useful: my rating, 1 to 5
2Signal: worth watching, 1 to 5
CompactionArea: what it touches
ImprovementsKind: in v2.1.326,
ImprovementsSection of the release
What
Compaction shortens the conversation by summarising earlier parts so it fits in what the model can read at once. A PreCompact hook is a command you set up to run before compaction, and it can block the compaction.
When a request is too large to send as it is, Claude Code compacts in response. In that case it now compacts even if a PreCompact hook blocks it, and writes a log line saying so. Before, a block from the hook always stopped the compaction.
Why
It keeps a session from getting stuck when the conversation has grown too large to send. If you rely on a PreCompact hook to block compaction, it no longer stops this case.
The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.
Confirmed sinceAnthropic's documentation has since written up PreCompact, on Intercept and control agent behavior with hooks.A callback that exceeds its timeout follows [Hook timeout](#hook-timeout). With `"block"` set, a timeout also blocks `PreCompact` and `Elicitation`.agent-sdk/hookssee the edit
How sure we are
One source agreesOne thing we can check says the same as this entry.
Anthropic's documentation agreesAnthropic's documentation has since written up PreCompact, on Intercept and control agent behavior with hooks.