{"version":"2.1.336","anchor":"bash-pretooluse-hook-commands-trimmed-and-matched-on-a-norma","canonical_anchor":"bash-pretooluse-hook-commands-trimmed-and-matched-on-a-norma","heading":"Bash hooks that run before a command now get the command with spaces trimmed","tier":"notice","area":"Hooks","scope":"individual","heads_up":true,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.336\/e\/bash-pretooluse-hook-commands-trimmed-and-matched-on-a-norma","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.336","markdown":"### Bash hooks that run before a command now get the command with spaces trimmed\n\nOn macOS and Linux, PreToolUse hooks for Bash now get the command trimmed and may match it on a normalized form\n\n**Unclear.** It is not clear what normalized form of the command hook patterns are now matched against.\n\n**What**\n\n`PreToolUse` hooks are scripts that run before a tool call and can block it. On systems other than Windows, those hooks for the Bash tool, which runs shell commands, now receive the `command` in `tool_input` with surrounding spaces trimmed. Before, `tool_input` was passed on unchanged. When Claude Code matches hooks to these calls, it also checks an extra name derived from the command.\n\n**Why**\n\nIf you have `PreToolUse` hooks with `if` or matcher patterns on Bash commands, they may now match differently. Check that they still catch the commands you expect.\n\n- Area: Hooks\n- Names: `PreToolUse`, `tool_input`\n- Tier: You'll notice\n- Useful: 2\/5\n- Signal: 1\/5\n- Scope: individual\n- Heads-up: yes"}