Bug: claude agents silently drops the second --add-dir when --add-dir is repeated
Summary
Per the Agent view docs → "Settings, plugins, and MCP servers", --add-dir is supposed to be repeatable on claude agents:
Repeat--add-dir,--plugin-dir, or--mcp-configonce per value. The space-separated form, such as--add-dir a b c, is not supported withclaude agents.
In practice, when I pass --add-dir twice (with the documented one-flag-per-value syntax), only the first one appears to take effect. The second --add-dir's contents are not visible from any user-facing surface inside agent view.
Repro
I use a shell alias ca='claude agents'. Two equivalent failing repros:
# Repro A — two add-dirs pointing at unrelated trees
ca --add-dir ~/ghost --add-dir ~/HUB/repos
# Expected: contents of both ~/ghost AND ~/HUB/repos are reachable from agent view
# Observed: only the first is reachable; the repo inside ~/HUB/repos/ does not appear
# anywhere user-facing (e.g. the @<repo> mention picker does not surface it).
# Repro B — two add-dirs where the second is a child of the first
ca --add-dir ../ghost --add-dir ../ghost/nfrith-repos
# Expected: repos under nfrith-repos/ are reachable (e.g. @nfrith-repos/als/ should show up)
# Observed: they do not.
For Repro B specifically: ~/ghost/nfrith-repos/ exists and contains sibling sub-repos including als/, delamain-dispatcher/, delamain-dashboard/, alsc/, etc. The als/ sub-repo has its own .git/ and is a legitimate @<repo> mention target if its parent were enumerated.
Expected
Per the documented contract, both --add-dir values should be applied to agent view itself and passed through to every dispatched session. The user should be able to observe — through whatever surface --add-dir was supposed to influence — that both paths are now in scope.
Observed
Only the first --add-dir appears to take effect. The second is dropped silently — there is no error, no warning, no indication in the agent view header or footer that two paths were requested but only one applied.
Why this is a bug, not a misunderstanding
The doc explicitly calls out the syntax distinction:
The space-separated form, such as--add-dir a b c, is not supported withclaude agents.
This phrasing only makes sense if the repeated-flag form is supported. So the documented contract is: "repeat the flag, once per value." My repro follows that contract exactly and the second value is being dropped.
Caveat / probe I used
The surface I used to detect the drop was the @<repo> mention picker — i.e. I looked there to see whether the additional directory's repos became enumerable. It's possible that @<repo> enumeration is not the intended observable for --add-dir (the doc literally says --add-dir "Grants file access to an additional directory" — that's about read/write scope, not mention enumeration).
If that's the case, there are actually two problems to address here:
- Multi-
--add-diris opaque. There is no user-facing way to confirm that the second value took effect. Even if the bug isn't real (i.e. file access was granted to both paths), the lack of any signal makes it untestable from inside agent view. - Separately: if
--add-diris not supposed to extend the@<repo>mention pool, that is itself a feature gap (the natural ask: "let me span repos across multiple parent dirs in agent view"). That is a separate request — I can file it independently if the team confirms--add-dir's scope.
But the strict bug, as documented, is #1: pass two --add-dirs, the second behaves as if not passed.
Asks
- Confirm whether multi-
--add-diris currently honored in agent view at all (whatever "honored" means per the intended scope of the flag). - If yes → make at least one user-facing surface in agent view reflect the additional directories so users can verify the flag took effect (header,
?shortcut overlay,claude daemon status, footer below dispatch input — any of these). - If no → fix the silent drop and add a startup warning when more than one
--add-diris parsed but only the first applies.
Related
- Feature request: fuzzy match in claude agents @<repo>/@<subagent> picker (#61407) — adjacent: that issue assumes the picker only enumerates under the cwd. This issue is about whether
--add-dirpaths should also be enumerated, and whether they are at all. - Feature request: --plugin-dir from claude agents dispatch input (#61409) — same family of "configuration flags on
claude agentsneed a clearer story".
Thanks!
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗