Follow Discord
Sweep 22 Oct 2026 · 04:32Z Build v2.1.308 527 read Stable v2.1.308 Latest v2.1.308 Next v2.1.308 Feeds RSS JSON llms.txt llms-full.txt Unofficial

Claude Code v2.1.83 ·

CwdChanged and FileChanged Hooks

Entry
JSON All of v2.1.83
EntryKind: in v2.1.83,
ChangesSection of the release
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.

How sure we are
One source agreesOne thing we can check says the same as this entry.
Anthropic's release notes agreeAdded CwdChanged and FileChanged hook events for reactive environment management (e.g., direnv)

See this entry in the whole of v2.1.83 →

Feedback