open this note in the tree

codex

Config files & related artifacts

File / Artifact Location Purpose
~/.codex/config.toml Home directory, hidden .codex folder Main user config. Stores preferences (model, reasoning effort, approval mode, MCP servers). GitHub
~/.codex/auth.json ~/.codex/ in home dir Holds login/auth credentials when signing in as ChatGPT account. OpenAI Developers+2GitHub+2
~/.codex/instructions.md or ~/.codex/AGENTS.md Home .codex folder or in project root (depending on scope) Human-readable context / instructions / project-style guidance. Code-style, testing, how agents should behave. GitHub+2OpenAI Help Center+2
Project-level config (if any) Possibly ./.codex/config.toml or via local docs If present, override or augment the user config in specific projects. Not clearly documented. Inferred via how instructions.md/AGENTS.md works. DataCamp+1

Precedence / override order (inferred)

Here is the likely order Codex CLI uses when deciding what setting to apply. Lower numbers are lower precedence; higher numbers win when there’s conflict.

1. Built-in defaults (hardcoded in Codex binary) 2. User config file (~/.codex/config.toml) 3. Auth settings (~/.codex/auth.json) for login/auth behavior 4. Environment variables / CLI flags (e.g. --model, --provider, etc.) 5. Local project instructions/docs (e.g. AGENTS.md / instructions.md) for behavior guidance

Built-in defaults (hardcoded in binary)
│
├── User config
│   └── ~/.codex/config.toml
│
├── Auth settings
│   └── ~/.codex/auth.json
│
├── Project instructions / guidance
│   ├── ./.codex/config.toml   (if supported)
│   ├── ./.codex/instructions.md
│   └── ./.codex/AGENTS.md
│
├── Environment variables
│   └── e.g. CODEX_API_KEY=... , MODEL=...
│
└── Command-line arguments
    └── codex chat --model=gpt-4.1 --temperature=0.7