Hook matchers (PreToolUse/PostToolUse) fire on which Claude Code tool ran (Edit|Write, Bash|PowerShell, etc.), not on the actual file mutation. This means a hook meant to run "whenever a file is written" is trivially bypassed by using a different tool to write the same file -- e.g. a PostToolUse hook matching Edit|Write that normalizes line endings never fires if the same file gets written via Bash running a script instead. There's no hook type that watches actual filesystem changes independent of which tool produced them.
Would be useful to have a hook scope (or a documented pattern) that fires on file-content changes regardless of the originating tool -- e.g. a PostToolUse matcher that inspects git diff/mtime-changed files after any tool call, or a dedicated filesystem-watch hook type.
Hook matchers (
PreToolUse/PostToolUse) fire on which Claude Code tool ran (Edit|Write,Bash|PowerShell, etc.), not on the actual file mutation. This means a hook meant to run "whenever a file is written" is trivially bypassed by using a different tool to write the same file -- e.g. aPostToolUsehook matchingEdit|Writethat normalizes line endings never fires if the same file gets written viaBashrunning a script instead. There's no hook type that watches actual filesystem changes independent of which tool produced them.Would be useful to have a hook scope (or a documented pattern) that fires on file-content changes regardless of the originating tool -- e.g. a
PostToolUsematcher that inspectsgit diff/mtime-changed files after any tool call, or a dedicated filesystem-watch hook type.