From db62f540ab7f3fd29d56ba1bc5243b1a58dd2cda Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Tue, 10 Mar 2026 16:57:11 -0700 Subject: [PATCH] feat(hooks): add PreCompact hook to auto-trigger /ce:compound Adds a PreCompact prompt hook that checks if the current session contains a solved problem or debugging insight worth documenting. If so, it triggers /ce:compound to capture the knowledge before context compaction loses it. The hook uses the "prompt" type so the AI evaluates whether compounding is warranted - it skips silently if nothing significant was solved. Fixes #95 Co-Authored-By: Claude Opus 4.6 --- plugins/compound-engineering/hooks/hooks.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 plugins/compound-engineering/hooks/hooks.json diff --git a/plugins/compound-engineering/hooks/hooks.json b/plugins/compound-engineering/hooks/hooks.json new file mode 100644 index 00000000..5cff383e --- /dev/null +++ b/plugins/compound-engineering/hooks/hooks.json @@ -0,0 +1,15 @@ +{ + "hooks": { + "PreCompact": [ + { + "matcher": "*", + "hooks": [ + { + "type": "prompt", + "prompt": "Before context compaction, check if this session contains a solved problem, debugging insight, or pattern worth documenting. If so, run /ce:compound to capture it before context is lost. If nothing significant was solved, skip silently." + } + ] + } + ] + } +}