Support argument patterns in hook matchers (like permissions system)

Resolved 💬 3 comments Opened Jan 28, 2026 by lucharo Closed Feb 1, 2026

Problem

The permissions system supports argument patterns like Bash(git commit*) to match specific commands. Hook matchers only match tool names, so "matcher": "Bash(git commit*)" doesn't work — you have to use "matcher": "Bash" and filter inside your script.

This means hooks fire on every Bash invocation, even when they only care about specific commands.

Current workaround

{ "matcher": "Bash" }
INPUT=$(cat)
if ! echo "$INPUT" | grep -q "git commit"; then
  exit 0
fi

The hook still spawns for every ls, cat, grep, etc. — it just exits immediately. This creates visual noise ("Running PostToolUse hook…" on every command) and is inefficient.

Proposed

Allow argument patterns in hook matchers, consistent with permissions:

{ "matcher": "Bash(git commit*)" }

This would let Claude Code filter before spawning the hook process.

Inconsistency

| System | Bash(git commit*) works? |
|--------|---------------------------|
| Permissions (allow/deny) | ✅ Yes |
| Hooks (matcher) | ❌ No |

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗