{"version":"2.1.267","anchor":"async-sessionstart-hooks-are-now-settled-with-a-grace-period","canonical_anchor":"compaction-can-now-be-intercepted-and-rewritten-by-a-session","heading":"Compaction can now be intercepted and rewritten by a session.compact plugin hook","tier":"use","area":"Hooks","scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.267\/e\/async-sessionstart-hooks-are-now-settled-with-a-grace-period","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.267","markdown":"### Compaction can now be intercepted and rewritten by a session.compact plugin hook\n\nA new session.compact hook lets plugins intercept and replace Claude Code's conversation-compaction output\n\n**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.\n\n**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.\n\n- Area: Hooks\n- Tier: Use it now\n- Useful: 4\/5\n- Signal: 3\/5"}