Add `/add-dir` slash command to add directories mid-session
Open 💬 11 comments Opened Feb 13, 2026 by Deveshb15
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
Feature Request
Problem
Codex CLI supports --add-dir as a startup flag, but there's no way to add additional working directories during an active session. If you realize mid-conversation that you need the agent to access another directory, you have to quit, restart with the extra --add-dir flag, and lose your session context.
Claude Code solves this with a /add-dir slash command that lets you add directories on the fly without restarting.
Proposed Solution
Add a /add-dir slash command that can be used mid-session to expand the agent's accessible directories.
Example usage (during a session):
> /add-dir ../frontend
Added directory: /Users/me/projects/frontend
> /add-dir ../shared-lib /tmp/fixtures
Added directories:
- /Users/me/projects/shared-lib
- /tmp/fixtures
Use Cases
- Iterative exploration — You start working on one package, then realize you need to check or modify a related directory
- Debugging across boundaries — Mid-investigation, you discover the bug lives in a different repo/directory
- Avoiding session restarts — Preserving conversation context and progress instead of quitting and re-launching with
--add-dir - Dynamic workflows — Projects where the set of relevant directories isn't known upfront
Behavior Details
- Should accept one or more relative or absolute paths
- Validate that each path exists and is a directory
- The agent should immediately be able to read, search, and write in newly added directories
- Could show currently active directories via
/list-dirsor similar - Optionally support
/remove-dirto revoke access
Willingness to Contribute
I'd be happy to work on this and submit a PR if the maintainers are open to it. Would appreciate any pointers on where the slash command system is implemented.
11 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
See also https://github.com/openai/codex/issues/11612
1+ for this
+1
+1
+1 for this request. Would be very useful.
+1 to this
Any updates on this please? Has it been looked at yet? This is a very neat feature to have.
+1 for this request. Would be very useful.
+1 for the feature, its very useful in your competitors cli
+1