Follow Discord
Sweep 22 Oct 2026 · 04:32Z Build v2.1.308 527 read Stable v2.1.308 Latest v2.1.308 Next v2.1.308 Feeds RSS JSON llms.txt llms-full.txt Unofficial

Claude Code v2.1.85 ·

Hook Conditional Filtering via if Field

Entry
JSON All of v2.1.85
EntryKind: in v2.1.85,
ChangesSection of the release
What

Hooks now support an if field that uses permission rule syntax to filter when the hook runs, avoiding unnecessary hook execution for non-matching commands.

Usage
{
  "hooks": {
    "PreToolUse": [{
      "if": "Bash(git *)",
      "command": "my-git-hook.sh"
    }]
  }
}
Details
  • The if field accepts permission rule syntax (e.g., "Bash(git *)")
  • Hooks only fire when the tool call matches the pattern
  • Non-matching tool calls skip the hook entirely: "Skipping hook due to if condition not matching"
  • If the if condition cannot be evaluated for non-tool events, a diagnostic is logged
  • When a hook's condition is satisfied, interaction results are tracked (including deny rule overrides and ask rule prompts)
Evidence

Hook schema description (search for "Permission rule syntax to filter when this hook runs")

Strings lifted out of the shipped bundle, so the claim above can be checked against them.

How sure we are
One source agreesOne thing we can check says the same as this entry.
Anthropic's release notes agreeAdded conditional if field for hooks using permission rule syntax (e.g., Bash(git *)) to filter when they run, reducing process spawning…

See this entry in the whole of v2.1.85 →

Feedback