Skip to content

Feature Request: Add --add-dir flag to include additional working directories #11746

Closed

Description

@Deveshb15

Feature Request

Problem

When working on projects that span multiple directories (monorepos, separate frontend/backend repos, shared libraries), Codex CLI is limited to the current working directory. There's no way to give the agent access to additional directories without changing your working directory or running separate sessions.

Proposed Solution

Add an --add-dir flag (similar to what Claude Code offers) that allows users to specify additional directories the agent should have access to during a session.

Example usage:

# Working on an API, but need access to the frontend and shared libs
cd my-project/packages/api
codex --add-dir ../web ../shared

This would give Codex access to:

  • my-project/packages/api (current working directory)
  • my-project/packages/web (via --add-dir)
  • my-project/packages/shared (via --add-dir)

Use Cases

  1. Monorepos / multi-package projects — Working on a feature that touches multiple packages
  2. Separate frontend + backend repos — Need the agent to understand the API contract while working on the backend (or vice versa)
  3. Shared libraries — Modifying a shared library alongside the projects consuming it
  4. Cross-project refactoring — Coordinated changes across multiple directories

Behavior Details

  • Paths can be relative or absolute
  • Each path should be validated to exist as a directory at startup
  • The agent should be able to read, search, and (optionally) write to all added directories
  • Could also support an in-session command like /add-dir <path> for adding directories mid-conversation

Willingness to Contribute

I'd be happy to work on this and submit a PR if the maintainers are open to it. Would love guidance on the preferred implementation approach.

Activity

  1. added
    enhancement
    CLI
    on Feb 13, 2026
  2. Deveshb15 commented on Feb 13, 2026

    @Deveshb15
    Author

    Closing — this was filed incorrectly. The --add-dir CLI flag already exists. Re-filing as a request for an in-session /add-dir slash command instead.

  3. peterbecich commented on May 13, 2026

    @peterbecich

    Related to the --add-dir CLI flag:

    The CLI flag may already exist, but I do not see the second dir included here:

    │ >_ OpenAI Codex (v0.130.0)                  │
    │                                             │
    │ model:     gpt-5.5 xhigh   /model to change │
    │ directory: (current working dir)
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions