Source Intelligence

DisclaimerUnofficial, and not affiliated with Anthropic. Nearly all of this is read straight out of what ships: npm bundles, captured prompts, published docs. Anthropic's own notes go in verbatim, marked as theirs. The rest is my reading, and every entry carries the strings behind it. If one looks wrong, vote it down and say why.

All of v2.1.83 Home All releases olderv2.1.81 v2.1.84newer
Claude Code v2.1.83

CwdChanged and FileChanged Hooks

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_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 — 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.

See this entry in the whole of v2.1.83 →