{"version":"2.1.83","anchor":"cwdchanged-and-filechanged-hooks","canonical_anchor":"cwdchanged-and-filechanged-hooks","heading":"CwdChanged and FileChanged Hooks","tier":null,"area":null,"scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.83\/e\/cwdchanged-and-filechanged-hooks","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.83","markdown":"### CwdChanged and FileChanged Hooks\n\n**What**\n\nTwo new hook event types that trigger automation when the working directory changes or when specific files are modified.\n\nUsage in `.claude\/hooks.json`:\n\n`{ \"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_cwd` and `new_cwd`. Hook output can include `watchPaths` to dynamically register additional file watchers via `hookSpecificOutput` - **FileChanged**: Fires when a watched file changes, is added, or is removed. Input JSON includes `file_path` and `event` (one of `change`, `add`, `unlink`). The `matcher` field specifies file glob patterns to watch - Both hook types set `CLAUDE_ENV_FILE` \u2014 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-\"`)"}