{"version":"2.1.219","anchor":"new-directoryadded-hook-event","canonical_anchor":"new-directoryadded-hook-event","heading":"New DirectoryAdded hook event","tier":"use","area":"Hooks","scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.219\/e\/new-directoryadded-hook-event","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.219","markdown":"### New DirectoryAdded hook event\n\nYou can now run a hook whenever a directory is added mid-session, including via \/add-dir.\n\n**What**\n\nHooks 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.\n\n**Details**\n\n- 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.\n- 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.\n- Registered in the hook config schema, the hook registry, the SDK hook-event enum and the \/hooks UI.\n- 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: \".\n\n**Evidence**\n\n`\"slash_command\" for \/add-dir, \"register_repo_root\" for the SDK control_request.`, `After a working directory is added mid-session`\n\n- Area: Hooks\n- Names: `DirectoryAdded`, `\/add-dir`, `\/hooks`, `slash_command`, `register_repo_root`\n- Tier: Use it now\n- Useful: 4\/5\n- Signal: 0\/5"}