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

  1. Iterative exploration — You start working on one package, then realize you need to check or modify a related directory
  2. Debugging across boundaries — Mid-investigation, you discover the bug lives in a different repo/directory
  3. Avoiding session restarts — Preserving conversation context and progress instead of quitting and re-launching with --add-dir
  4. 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.

View original on GitHub ↗

11 Comments

github-actions[bot] contributor · 5 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #11746

Powered by Codex Action

matthewlloyd · 5 months ago
hcdiekmann · 4 months ago

1+ for this

shmokmt · 4 months ago

+1

aymvngg · 4 months ago

+1

PerkinzPie · 4 months ago

+1 for this request. Would be very useful.

yuriever · 3 months ago

+1 to this

xuzijian2019 · 2 months ago

Any updates on this please? Has it been looked at yet? This is a very neat feature to have.

verticalLine111 · 1 month ago

+1 for this request. Would be very useful.

javarich · 1 month ago

+1 for the feature, its very useful in your competitors cli

AmeowCAT · 11 days ago

+1