A new session.compact hook lets plugins intercept and replace Claude Code's conversation-compaction output
What
Both live/reactive compaction and precomputed/background compaction now route through a shared step that runs the session.compact plugin hook before falling back to Claude Code's built-in compactor. A compaction hook must return either { messages } (replacement messages) or { skip: reason }. If a hook supplies replacement messages, compaction uses those directly instead of summarizing normally; if a hook rewrites content after a background compaction already ran, the stale precomputed result is discarded.
Why Gives plugins a supported way to control what happens when a conversation gets compacted (summarized to save space), instead of only being able to observe it, useful for plugins that want custom summarization logic or need to preserve specific content.