Source Intelligence

DisclaimerUnofficial, and not affiliated with Anthropic. Nearly all of this is read straight out of what ships: npm bundles, captured prompts, published docs. Anthropic's own notes go in verbatim, marked as theirs. The rest is my reading, and every entry carries the strings behind it. If one looks wrong, vote it down and say why.

All of v2.1.85 Home All releases olderv2.1.84 v2.1.86newer
Claude Code v2.1.85

Hook Conditional Filtering via if Field

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.

See this entry in the whole of v2.1.85 →