Make the location of project-scoped `.codex` directory customizable

Open 💬 4 comments Opened Apr 17, 2026 by hrumhurum
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What variant of Codex are you using?

CLI

What feature would you like to see?

Overview

Currently, Codex CLI has a predefined set of places where it looks for its configuration:

  • Project config files: .codex/config.toml, ordered from the project root down to your current working directory (closest wins)
  • User config: ~/.codex/config.toml

Some projects, however, prefer different layouts for AI configuration. For example: repository-root/ai/.codex/config.toml.

The Proposed Improvement

Allow Codex CLI to search for .codex configuration directories in custom locations specified with CODEX_CONFIG_DIR environment variable.

Ideally, CODEX_CONFIG_DIR would accept multiple locations separated by a path separator defining closest-furthest relationships if hierarchical configuration support is needed.

Alternative Design

As an alternative solution, allow Codex CLI to search for .codex configuration directories in locations specified with --add-dir option, maybe gated by CODEX_ADDITIONAL_DIRECTORIES_CONFIG=1 environment variable as a safety switch.

Benefits

The suggested improvement will:

  • Enable custom configuration layouts
  • Which in turn will remove the pressure from --profile option because users will be able to compose theirs own configuration profiles in varying combinations according to their needs and preferences

Existing Artwork

Claude Code support CLAUDE_CONFIG and CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD environment variables that allow to achieve similar results.

Additional information

_No response_

View original on GitHub ↗

4 Comments

etraut-openai contributor · 4 months ago

This is already supported via the CODEX_HOME environment variable.

hrumhurum · 4 months ago

CODEX_HOME isn’t the right mechanism for this feature. That environment variable is intended to point to user-scoped configuration, including sensitive data such as logs, sessions, authentication tokens, and therefore shouldn’t be used for settings meant to be shared.

This request is specifically about project-level configuration: things like skills specific to the project, permissions, and other settings that are safe to commit to version control and share across a team.

etraut-openai contributor · 4 months ago

Ah, I misunderstood the request because it also mentioned "user config". I now understand that you're talking about project configurations. I'll reopen.

SeepMystery · 4 months ago

I also need this feature in project repository.