From 1460c97e855e07973013b72db918261e82461f33 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Sun, 15 Mar 2026 16:49:42 -0700 Subject: [PATCH] fix: correct Claude Code hooks config to match actual schema (#1388) The hooks configuration example used a format that was valid when originally written but broke across two Claude Code releases: - v1.0.41: Added `hook_event_name` to hook input, replacing the previous field name. The hook script was still reading `.event`, causing the case statement to always fall through to unknown. - v2.1.63: Added HTTP hooks with `{ "type": "command", "command": "..." }` object format. Bare string paths in the hooks array are no longer valid now that hook type disambiguation is required. Changes: - Stop hooks now use the full matcher/hooks object structure - PostToolUse inner hooks use typed command objects - Hook script reads `hook_event_name` instead of `event` Ref: https://docs.anthropic.com/en/docs/claude-code/hooks --- web/app/[locale]/docs/notifications/page.tsx | 21 +++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/web/app/[locale]/docs/notifications/page.tsx b/web/app/[locale]/docs/notifications/page.tsx index 2a5d53b9..b02de0e1 100644 --- a/web/app/[locale]/docs/notifications/page.tsx +++ b/web/app/[locale]/docs/notifications/page.tsx @@ -158,7 +158,7 @@ printf '\\e]99;i=1;e=1;d=1;p=body:All tests passed\\e\\\\'`} [ -S /tmp/cmux.sock ] || exit 0 EVENT=$(cat) -EVENT_TYPE=$(echo "$EVENT" | jq -r '.event // "unknown"') +EVENT_TYPE=$(echo "$EVENT" | jq -r '.hook_event_name // "unknown"') TOOL=$(echo "$EVENT" | jq -r '.tool_name // ""') case "$EVENT_TYPE" in @@ -174,11 +174,26 @@ esac`}

{t("configureClaude")}

{`{ "hooks": { - "Stop": ["~/.claude/hooks/cmux-notify.sh"], + "Stop": [ + { + "matcher": "", + "hooks": [ + { + "type": "command", + "command": "~/.claude/hooks/cmux-notify.sh" + } + ] + } + ], "PostToolUse": [ { "matcher": "Task", - "hooks": ["~/.claude/hooks/cmux-notify.sh"] + "hooks": [ + { + "type": "command", + "command": "~/.claude/hooks/cmux-notify.sh" + } + ] } ] }