From 63c010f4b6a8eadbda2822e7a64b9afe866a2767 Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Fri, 27 Mar 2026 02:19:22 -0600 Subject: [PATCH 1/2] perf(hooks): narrow Bash hook matchers to git commands only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bash hooks (guard-git, pre-commit, lint-staged, check-readme, guard-pr-body, track-moves, post-git-ops) now use `Bash(git )` matcher instead of `Bash`, so they only fire on git commands rather than every Bash invocation — reduces token consumption. --- .claude/settings.json | 4 ++-- docs/examples/claude-code-hooks/settings.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.claude/settings.json b/.claude/settings.json index 2f9b092f..7ac8c478 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -2,7 +2,7 @@ "hooks": { "PreToolUse": [ { - "matcher": "Bash", + "matcher": "Bash(git )", "hooks": [ { "type": "command", @@ -69,7 +69,7 @@ ] }, { - "matcher": "Bash", + "matcher": "Bash(git )", "hooks": [ { "type": "command", diff --git a/docs/examples/claude-code-hooks/settings.json b/docs/examples/claude-code-hooks/settings.json index 13c5afb0..31c087bb 100644 --- a/docs/examples/claude-code-hooks/settings.json +++ b/docs/examples/claude-code-hooks/settings.json @@ -12,7 +12,7 @@ ] }, { - "matcher": "Bash", + "matcher": "Bash(git )", "hooks": [ { "type": "command", @@ -49,7 +49,7 @@ ] }, { - "matcher": "Bash", + "matcher": "Bash(git )", "hooks": [ { "type": "command", From 2f03c35b9bd7afb0e03a31acdeecd2542fa35037 Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Fri, 27 Mar 2026 04:10:01 -0600 Subject: [PATCH 2/2] fix(hooks): revert Bash matchers to plain tool name (#655) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `Bash(git )` matcher syntax does not work — the matcher regex is applied to the tool name string ("Bash"), not the command argument. Using `Bash(git )` silently disables all git safety hooks. The hook scripts already filter internally for git commands, so narrowing at the matcher level is unnecessary. --- .claude/settings.json | 4 ++-- docs/examples/claude-code-hooks/settings.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.claude/settings.json b/.claude/settings.json index 7ac8c478..2f9b092f 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -2,7 +2,7 @@ "hooks": { "PreToolUse": [ { - "matcher": "Bash(git )", + "matcher": "Bash", "hooks": [ { "type": "command", @@ -69,7 +69,7 @@ ] }, { - "matcher": "Bash(git )", + "matcher": "Bash", "hooks": [ { "type": "command", diff --git a/docs/examples/claude-code-hooks/settings.json b/docs/examples/claude-code-hooks/settings.json index 31c087bb..13c5afb0 100644 --- a/docs/examples/claude-code-hooks/settings.json +++ b/docs/examples/claude-code-hooks/settings.json @@ -12,7 +12,7 @@ ] }, { - "matcher": "Bash(git )", + "matcher": "Bash", "hooks": [ { "type": "command", @@ -49,7 +49,7 @@ ] }, { - "matcher": "Bash(git )", + "matcher": "Bash", "hooks": [ { "type": "command",