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.219 Home All releases olderv2.1.218 v2.1.220newer
Claude Code v2.1.219

New DirectoryAdded hook event

Use it now
Useful4 Signal0
Hooks Notable

You can now run a hook whenever a directory is added mid-session, including via /add-dir.

DirectoryAdded/add-dir/hooksslash_commandregister_repo_root
What

Hooks gained a DirectoryAdded event that fires after a working directory is registered mid-session, so you can react to /add-dir and to SDK-driven directory registration.

Details
  • Described in the hook config as "After a working directory is added mid-session"; fires after the directory is registered and after the sandbox config is refreshed.
  • Hook input JSON carries the absolute directory and a source; the matcher can match on "slash_command" for /add-dir and "register_repo_root" for the SDK control request.
  • Registered in the hook config schema, the hook registry, the SDK hook-event enum and the /hooks UI.
  • Failure handling differs by path: for /add-dir a failure count is summarised to Claude and hook systemMessage output reaches Claude; for register_repo_root failures are debug-logged only, via "DirectoryAdded hook failed: ".
Evidence

"slash_command" for /add-dir, "register_repo_root" for the SDK control_request., After a working directory is added mid-session

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.219 →