Make the location of project-scoped `.codex` directory customizable
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
--profileoption 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_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗