codex - 💡(How to fix) Fix Make the location of `.codex` configuration directory customizable [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#18334Fetched 2026-04-18 05:55:46
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×3closed ×1commented ×1

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.

Root Cause

  • 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
RAW_BUFFERClick to expand / collapse

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

extent analysis

TL;DR

To address the need for custom configuration layouts in Codex CLI, consider implementing support for the CODEX_CONFIG_DIR environment variable to specify custom locations for .codex configuration directories.

Guidance

  • Investigate how the CODEX_CONFIG_DIR environment variable can be used to allow multiple locations separated by a path separator, enabling hierarchical configuration support.
  • Evaluate the alternative design of using the --add-dir option, gated by the CODEX_ADDITIONAL_DIRECTORIES_CONFIG environment variable, as a potential solution.
  • Research how Claude Code's CLAUDE_CONFIG and CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD environment variables achieve similar results and apply those insights to Codex CLI.
  • Consider the benefits of enabling custom configuration layouts, such as removing pressure from the --profile option and allowing users to compose their own configuration profiles.

Example

No specific code snippet is provided due to the lack of implementation details in the issue.

Notes

The proposed improvement and alternative design require further development and testing to ensure compatibility and effectiveness.

Recommendation

Apply the workaround by implementing support for the CODEX_CONFIG_DIR environment variable, as it provides a flexible solution for custom configuration layouts and aligns with the existing artwork in Claude Code.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Make the location of `.codex` configuration directory customizable [1 comments, 2 participants]