Codex Config Walkthrough
Introduction
Welcome to Mastering Advanced AI Tooling in Codex! This is the first lesson of the course, where we'll explore how to configure Codex as a durable, repository-native agent. In this lesson, we'll dive deep into config.toml, the primary configuration file that controls how Codex behaves in your environment.
In this lesson, we will focus on the specific configuration keys Codex actually uses to decide things like which model to run, how cautious it should be before executing commands, what sandbox restrictions apply, and how it discovers repository guidance like AGENTS.md.
By the end of this lesson, you'll understand the difference between provider-specific parameters and Codex configuration knobs, and you'll know how to create a template with conservative defaults suitable for any repository.
Understanding Configuration Files
Before we explore config.toml specifically, let's build some intuition about why configuration files matter. When working with command-line tools like Codex, we often face a challenge: how do we customize behavior without passing dozens of flags every time we run a command? Configuration files solve this by storing our preferences in a structured format that the tool reads automatically.
The TOML format (Tom's Obvious Minimal Language) is particularly well-suited for this purpose. Unlike JSON or YAML, TOML is designed to be human-readable and easy to edit manually.
Where to Place Your Configuration
In a repository-native workflow, Codex uses a layered configuration approach. It is crucial to place files in the correct location for them to be detected.
- Global Level (User Defaults):
Codexalways reads from~/.codex/config.toml. This is where you define your personal preferences that apply to every project you touch. - Project Level (Repo Overrides): To enforce team standards, you place configuration in the repository at
.codex/config.toml(e.g.,excalidraw/.codex/config.toml).
When Project Configuration is Applied
Project-level configuration in .codex/config.toml is applied when you run Codex inside that repository directory and Codex is allowed to act under your approval and sandbox settings.
