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-dirs or similar
- Optionally support
/remove-dir to 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.
Feature Request
Problem
Codex CLI supports
--add-diras 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-dirflag, and lose your session context.Claude Code solves this with a
/add-dirslash command that lets you add directories on the fly without restarting.Proposed Solution
Add a
/add-dirslash command that can be used mid-session to expand the agent's accessible directories.Example usage (during a session):
Use Cases
--add-dirBehavior Details
/list-dirsor similar/remove-dirto revoke accessWillingness 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.