[BUG] In-session /add-dir accepts only one path; launch --add-dir is variadic — inconsistent arity for the same command

Status Open
Reported on v2.1.195
Maintainer reply ✓ Yes — bcherny
Activity 3 comments · opened Jun 29, 2026
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

Describe the bug

The --add-dir and /add-dir surfaces of the same feature have inconsistent arity. At launch, --add-dir is variadic and accepts multiple paths in one invocation (--add-dir <directories...>, per claude --help). The in-session /add-dir slash command does not match this — it adds a single directory per invocation, with no way to pass several at once.

Same command name, same purpose (grant tool access to additional directories), divergent behavior depending only on whether you're at launch or mid-session. Adding five sibling repos after a session has started means running /add-dir five times, even though the launch flag would have taken all five in one shot.

Steps to reproduce

  1. Launch with multiple dirs in one flag — works: claude --add-dir /path/a /path/b /path/c.
  2. Start a session normally, then mid-session run /add-dir /path/a /path/b /path/c.
  3. Observe that the in-session command does not add all three the way the launch flag does — only a single directory is taken per invocation.

Expected behavior

In-session /add-dir should accept multiple paths in one invocation, matching the variadic --add-dir launch flag: /add-dir /path/a /path/b /path/c.

Actual behavior

/add-dir takes one directory per invocation; there is no documented way to pass several. The only mid-session route to add N directories is N separate /add-dir calls (or restarting the session with --add-dir, which defeats doing it mid-session).

Environment

  • Claude Code version: 2.1.195
  • Platform: macOS (Darwin 25.5.0)

Notes / related

  • permissions.additionalDirectories and the --add-dir launch flag both pre-load directories before a session starts; neither addresses adding directories after a session is already running, which is when you often discover which sibling repos you need. (This is why #3146 — "configure additional directories via settings files," shipped as permissions.additionalDirectories — does not cover this; it's a different, launch-time mechanism.)
  • Separately, there's recurring demand for named, reusable directory bundles loadable in one command (e.g. /add-dir @my-bundle) — a feature, not this bug. See #24980 (closed NOT_PLANNED) and #45643 (closed as duplicate).
  • Prior report of the in-session multi-path gap: #68845 (auto-closed as a duplicate of the shipped/launch-time #3146; reopen not available to external reporters). Filing fresh and scoped to the arity inconsistency.

🤖 Generated with Claude Code

View original on GitHub ↗

3 Comments

brian-deane-gusto · 2 months ago

Still reproduces on 2.1.220 (filed against 2.1.195). The launch flag remains variadic — --add-dir <directories...> in claude --help — while the in-session command still declares a singular argument hint ({name: "add-dir", argumentHint: "<path>"}). The divergence is unchanged.

On impact: I invoked /add-dir 14 times across my last 50 sessions, each one a single directory that the launch flag would have accepted in one shot.

🤖 Generated with Claude Code

bcherny collaborator · 1 month ago

Thanks for the detailed report — I was able to verify this on 2.1.233 on Linux.

What I tried: launched claude --add-dir /path/a /path/b (both directories were added — re-adding either in-session reports "already added as a working directory"), then ran /add-dir /path/c /path/d in-session. The command treated the whole argument as a single path and replied Path /path/c /path/d was not found. — neither directory was added.

So the inconsistency you describe is real: the launch flag accepts multiple directories, while the in-session command accepts exactly one per invocation. Both match their documented syntax (--add-dir <directories...> vs /add-dir <path> — https://code.claude.com/docs/en/commands), and this has been the behavior since /add-dir was introduced, so it's not a regression — but we agree the divergent arity for the same name is confusing, and the error message doesn't tell you that only one path is accepted.

We're considering accepting multiple paths in /add-dir (the in-session command shows a per-directory confirmation dialog, which is why it's currently one at a time) and, at minimum, improving the error message for multi-path input. Leaving this open to track that.

🤖 Generated with Claude Code

brian-deane-gusto · 1 month ago

Any way to unstale this?