FileChanged vs PostToolUse
People think a PostToolUse hook on Edit sees every change made to a file in the project. It sees only Claude's own tool calls. A script Claude runs, or your own editor, can change the file and it never fires. FileChanged watches the file itself, so it fires whatever wrote it. But only PostToolUse knows which tool call did it.
FileChanged Hook
The event when a watched file changes, no matter what changed it.
FileChanged is the hook event that fires when a watched file changes on disk. It does not care what changed it: an edit by Claude, a script, or another program. The matcher lists the file names to watch, split by |, such as .envrc|.env. These are plain names in the working folder, not patterns. It runs after the change and cannot block it.
PostToolUse Hook
The event right after a tool works. It is often used to tidy code.
PostToolUse is the hook event that fires right after a tool call works. It is the usual place to tidy code, lint it or run a quick test after Claude edits a file. The tool has already run, so the hook cannot undo it. It can send Claude a note to act on. It does that by exiting 2, or with a block decision and a reason.
In one line
- FileChanged Hook
- The event when a watched file changes, no matter what changed it.
- PostToolUse Hook
- The event right after a tool works. It is often used to tidy code.