Skip to content

Feature Request: Add /add-dir slash command to add directories mid-session #11747

@Deveshb15

Description

@Deveshb15

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displayenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions