⌨️FileChanged Hook
Also known as FileChanged
The event when a watched file changes, no matter what changed it.
Think of it like
It is like a dog that barks when a door opens. It does not care who opened it.
Example
Jack edits .env in his own editor while Claude works. His FileChanged hook reloads it, so Claude's next command sees the new value.
Why it matters
A hook that matches Edit or Write misses changes made by a script. This one sees them all.
Definition
Example code
json
{
"hooks": {
"FileChanged": [
{ "matcher": ".envrc|.env", "hooks": [{ "type": "command", "command": "direnv export bash >> \"$CLAUDE_ENV_FILE\"" }] }
]
}
}Common mistake
Key takeaways
- 1Watched files. Any writer.
- 2Plain names. Not patterns.
- 3After the change. Cannot block.