Hooks are tool-call-scoped, not filesystem-scoped -- no way to catch "a file changed" regardless of which tool changed it

Status Open
Maintainer reply None cached
Activity 0 comments · opened Aug 17, 2026

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.

View original on GitHub ↗