skip to content

In Claude Code, when do you run `/add-dir` and when `/cd`, and what project configuration does each one load?

level: middleimportance: should knowfreq 9%

answer

  1. alongside versus instead of
  2. file access is not configuration
  3. a short exceptions list
  4. the new root's settings, hooks and servers
  5. /cd applies at once since 2.1.246

basics

~20 s

/add-dir adds a directory Claude may read and edit but loads little of its configuration; /cd moves the session's primary working directory, keeps the conversation, and applies the new directory's CLAUDE.md, settings, hooks, MCP servers, skills and subagents.

solid answer

~40 s

`/add-dir <path>` extends **file access**: the new directory follows the same permission rules as the original one, but it is not a configuration root. From it Claude Code loads only skills (with live reload), `.claude/commands` files, subagents, the `enabledPlugins` and `extraKnownMarketplaces` settings keys, and CLAUDE.md files only when `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1` is set. `/cd <path>` **moves** the session: the conversation continues, the new directory's `CLAUDE.md` loads, and since v2.1.246 its project settings (permission rules and hooks), `.mcp.json` servers (behind the usual approval), plugins, skills, subagents and `env` apply at once, while the old project's MCP servers disconnect. An untrusted target first shows a trust prompt listing what would activate. Use `/add-dir` to read a neighbour; use `/cd` to work in it.

go deeper

for a junior

Recall the split: /add-dir lets Claude read and edit another directory alongside this one, while /cd moves the whole session there and keeps the conversation.

for a middle

Explain what each loads: the short list /add-dir takes from an added directory, and the settings, hooks, MCP servers, skills and CLAUDE.md that /cd applies, plus what it disconnects.

for a senior

Show the operational judgment: why hooks and allow rules arriving through /cd make the trust prompt the real safety point, and why pre-2.1.246 advice to resume after /cd is stale.

for a principal

Weigh how multi-repository work should be shaped for a team: shared read access through added directories against moving sessions between repositories with different rules and servers.

## Two commands, two different jobs Every Claude Code session has a **primary working directory**: by default the directory you launched it from. Claude can read files there without prompting, and that is where the session's project configuration comes from. Two built-in commands change the picture mid-session: - **`/add-dir <path>`** adds a directory **alongside** the primary one. - **`/cd <path>`** **moves** the session so the new path becomes the primary working directory, keeping the conversation. | | `/add-dir` | `/cd` | | :- | :- | :- | | Primary working directory | Unchanged | Becomes the new path | | Conversation | Continues | Continues | | File access | Added, under the same permission rules | Follows the new root | | Project settings, permission rules, hooks | Not loaded | Applied at once | | `.mcp.json` servers | Not loaded | Loaded, behind the usual approval; the old project's disconnect | | CLAUDE.md | Only with `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1` | The new directory's loads | | Skills, subagents | Loaded | Loaded | ## `/add-dir`: file access, not configuration Adding a directory extends **where Claude can read and edit**. It does not make the directory a configuration root. From a directory added with `/add-dir` (or `--add-dir` at launch) Claude Code loads only: 1. skills in `.claude/skills/`, with live reload; 2. command files in `.claude/commands/`, without live reload (your project's command wins on a name clash); 3. subagents in `.claude/agents/`; 4. from its `.claude/settings.json` and `.claude/settings.local.json`, only `enabledPlugins` and `extraKnownMarketplaces`; 5. CLAUDE.md files and `.claude/rules/` only when `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1` is set. Its hooks and permission rules do **not** apply. Directories listed in `permissions.additionalDirectories` in a settings file are narrower still: file access only, none of the configuration above. You cannot add most network paths such as `\\server\share`. Running `/add-dir` on a subdirectory of the primary directory (v2.1.257 and later) loads that subdirectory's skills, commands and subagents without adding a working directory. ## `/cd`: move the session `/cd` keeps the conversation and re-roots the session. Claude Code loads the new directory's `CLAUDE.md`, prompts you to trust the workspace if you have not worked there before, and then applies the new directory's project configuration: - its project settings, including their **permission rules** and **hooks**; - its `.mcp.json` servers (subject to the usual server approval) and the local-scope MCP servers registered for it; - the plugins its settings enable, its skills and its subagents; - its `env` values, layered over the previous directory's, which stay in effect. It also **disconnects** the previous directory's project and local-scope MCP servers, takes additional directories from the new directory's settings, and keeps directories you added with `/add-dir` or `--add-dir`. Hooks the move activates still see `CLAUDE_PROJECT_DIR` set to the root where the session started. A later `--resume` from the new directory finds the moved session. Before **v2.1.246**, `/cd` did not apply the new directory's settings, hooks, MCP servers or skills until you resumed the session, and its trust prompt did not list what would activate. Advice written for those releases ("restart after `/cd`") is out of date. ## The trust prompt is the safety point Because `/cd` activates another repository's hooks and allow rules, an untrusted directory first shows a trust prompt that lists the allow rules, additional directories, hooks and helper commands its settings would turn on. Declining leaves the session where it was. Administrators can restrict or disable `/cd` targets with `Cd` permission rules; the rule syntax belongs to the permissions material. ## A worked example You are working in `api-gateway` and need the request types from `../shared-types`. `/add-dir ../shared-types` lets Claude read and edit them under your current permission rules; any skills in that directory load too, but its hooks and CLAUDE.md do not. Later the task moves into `../billing-service`, whose settings run a formatter hook and whose `.mcp.json` connects a database server. Now `/cd ../billing-service` is the right move: the trust prompt lists the hook and the allow rules before anything activates, and once you accept, the gateway's project MCP servers disconnect and billing's load, all inside the same conversation. Directories you added with `/add-dir` stay available. ## Choosing - Reading a shared library, a sibling service's API types or a design doc while you keep working here: **`/add-dir`**. - Continuing the same task inside another repository, with that repository's rules, hooks and servers: **`/cd`**. - Wanting another repository's configuration but a fresh start: launch Claude Code from that directory instead.

  • After `/add-dir ../payments`, why do that repository's hooks never fire?
    An added directory grants file access, not configuration. Claude Code loads its skills, command files, subagents and two settings keys (`enabledPlugins`, `extraKnownMarketplaces`), but not its hooks or permission rules. To work under that repository's hooks, move the session there with `/cd`, which applies its project settings after the trust prompt, or launch Claude Code from it.
  • What does declining the trust prompt during `/cd` do?
    The session stays in its current directory and none of the target's configuration activates. The prompt exists because `/cd` would otherwise switch on the target's allow rules, additional directories, hooks and helper commands, which is why it lists them before you accept.

  • /add-dir makes the added repository's CLAUDE.md and hooks active.
  • /cd starts a fresh conversation in the other directory.
  • After /cd, the old project's .mcp.json servers stay connected.
  • additionalDirectories in settings loads skills just as /add-dir does.
  • /cd into an untrusted directory activates its settings without asking.
  • You must resume the session before /cd applies the new project's settings.

Assumes Claude Code 2.1.286; since 2.1.246 /cd applies the new directory's settings, hooks, MCP servers and skills immediately instead of on resume.