What's wrong with this entry?
Anonymous. No account, no email.
What
Two new hook event types that trigger automation when the working directory changes or when specific files are modified.
Usage in .claude/hooks.json:
{
"hooks": {
"CwdChanged": [{
"command": "my-script.sh",
"timeout": 10000
}],
"FileChanged": [{
"command": "on-file-change.sh",
"matcher": "src/**/*.ts",
"timeout": 10000
}]
}
}Details
- CwdChanged: Fires after the working directory changes. Input JSON includes
old_cwdandnew_cwd. Hook output can includewatchPathsto dynamically register additional file watchers viahookSpecificOutput - FileChanged: Fires when a watched file changes, is added, or is removed. Input JSON includes
file_pathandevent(one ofchange,add,unlink). Thematcherfield specifies file glob patterns to watch - Both hook types set
CLAUDE_ENV_FILE— write bash exports there to inject environment variables into subsequent BashTool commands - File watching uses chokidar under the hood for cross-platform filesystem monitoring
Evidence
New hook types (search for "CwdChanged", "FileChanged", "cwdchanged-hook-", "filechanged-hook-")
Strings lifted out of the shipped bundle, so the claim above can be checked against them.