Codex · Series · Part 1 of 8

Meet Codex and set it up: the interfaces, the first session, and choosing a model

Khairul Alam·October 2026·~31 min read
CodexOpenAISetupModelsconfig.toml

Every time I start work on a project with an AI assistant, I catch myself explaining the same things again: how to build it, which folders matter, which style we follow. This eight-part series is about ending that habit with one small file called AGENTS.md. Before the file makes sense, though, you need the basics, so Part 1 covers what Codex is, the official ways to use it, how to install and sign in, how much freedom to give it, and how to pick a model.

Codex changes quickly. This series was checked against the official documentation on 18 October 2026; always confirm details on the official pages. Model names, plan limits and even command lists move from month to month, so where a fact is date-sensitive I say “as of 18 October 2026” and link the page it came from.

Start here: your first 15 minutes
  1. Check your account. Codex works with a ChatGPT account (Free, Go, Plus, Pro, Business, Enterprise or Edu, with different features per plan) or with an OpenAI API key. See section 4.
  2. Open a terminal. Never used one? The ChatGPT desktop app and the IDE extension are the two ways in that need no command line (section 2).
  3. Install and check it. One command from section 3, then codex --version.
  4. Make a throwaway project in git and create a branch first (git switch -c try-codex), so anything Codex changes can be undone.
  5. Start it. Run cd your-project, then codex, and choose Sign in with ChatGPT (or another available method) the first time.
  6. Ask before you change. Try “Tell me about this project” (the docs’ own first prompt) and read the answer.
  7. Try one tiny change, such as “add a one-line description to README.md”. Then run /diff to see exactly what changed.
  8. Know how to stop. Ctrl+C or /exit closes the session. Section 5 covers the other controls.

Section 3 to section 5 explain each step, and the “Stay safe on day one” list is worth reading before you approve anything.

Words you will see

WordIn plain words
PromptThe message you type to Codex.
TokenA small chunk of text, roughly three-quarters of a word. Limits and costs are counted in tokens.
Context windowThe amount of text Codex can look at at once: your messages, the files it read, and its own replies. A fresh chat starts nearly empty.
ChatOne conversation with Codex. The docs also use the word “session” for a CLI conversation, and older material says “thread” or “task”.
AGENTS.mdA text file in your project that gives Codex lasting instructions, so you do not have to repeat yourself.
ModelThe AI behind Codex. Bigger ones think harder but are slower and use more of your allowance.
SandboxA fenced area the operating system enforces around the commands Codex runs.
The series at a glance (Parts 1 to 4 are the beginner level)
  • Part 1 (this one): what Codex is, the official surfaces, setup, sign-in, first session, approvals and sandbox, changing the model and config.toml.
  • Part 2: why Codex forgets between chats, what AGENTS.md is, where it lives, and how to write a good one.
  • Part 3: how the file saves tokens, helps you onboard onto a new project or feature, and the mistakes to avoid.
  • Part 4: the Codex models, the API, and the official links in one place.
  • Parts 5 to 8 (advanced): day-to-day prompting, git and troubleshooting; extending Codex with MCP, skills, plugins and subagents; automation, CI and team setup; and Codex beyond code with a learning path.
Contents of Part 1
  1. What is Codex?
  2. The official ways to use it
  3. Installing Codex
  4. Signing in: ChatGPT account or API key
  5. Your first session
  6. Slash commands worth knowing
  7. Approvals, sandbox and permission modes
  8. Changing the model and reasoning effort
  9. config.toml and where it lives
  10. What comes next

1. What is Codex?

Codex is OpenAI’s coding agent. You describe a goal in plain language, and Codex reads your project, edits files and runs commands to get there, within limits you set. The documentation’s glossary describes the agent as the part that “reasons over context, uses tools, and completes a task”. Underneath is a large language model, the same kind of “very fancy autocomplete” I described in my Android AI chat post: it reads your input as tokens and writes a reply one token at a time.

Two names get mixed up, so let me separate them:

NameWhat it is
The modelThe “brain”. OpenAI offers several, in different sizes, and you can choose which one Codex uses (section 8).
CodexThe agent wrapped around a model. It can read your project, edit files, and run commands, with your permission. This series is about it.

Codex also lives inside the ChatGPT desktop app. In the docs’ quickstart, you pick Codex from the ChatGPT dropdown when you want software development with codebase context and developer tools, and you pick ChatGPT for other work. This series is mostly about the coding side.

A chat helper versus a teammate

A normal chat window is like texting a smart friend: they only know what you paste in. Codex is more like a teammate sitting at your computer: it can open the files itself, search the code, run the tests and show you the result. The catch is that this teammate arrives with a blank memory for every new chat. Fixing that is the whole point of this series.

Codex agentplus the model you pick Codex CLIin your terminal IDE extensionbeside your code ChatGPT desktop appprojects, parallel chats Codex cloudtasks run on OpenAI’s side
One agent, reached through different doors. The CLI is the door this part focuses on.

2. The official ways to use it

Codex is not tied to one window. OpenAI ships it in several places. The CLI and the IDE extension share the same configuration layers, so a habit you learn in one carries over to the other.

SurfaceGood for
Codex CLIUse Codex from your terminal and scripts. Type codex inside your project folder. This is the surface most of this series shows.
IDE extensionWork with Codex beside your code. The docs list Visual Studio Code, Cursor, Windsurf and VS Code Insiders (extension), plus Xcode and JetBrains IDEs (their own integrations).
ChatGPT desktop appA standalone window for projects, local files, parallel chats and longer tasks. No terminal needed. Available for macOS, Windows and (as a preview) Linux.
Codex cloudRun coding tasks in the cloud inside an environment you set up, then review the changes and open a pull request. It requires signing in with ChatGPT.
Codex on mobileStart tasks, approve actions and review work from your phone. Tasks run in the cloud or on a connected computer. Availability depends on rollout and your workspace settings.

The docs also describe a non-interactive mode, codex exec, for scripts and CI. We meet it in Part 7.

What the maturity labels mean

Some features carry a maturity label. You will see these words in the docs, and in this series:

LabelMeaning in the docsWhat to do
ExperimentalUnstable; OpenAI may remove or change it.Use at your own risk.
BetaReady for broad testing; some aspects may change.OK for evaluation and pilots; expect small changes.
StableFully supported and consistent over time.Safe for production use.
DeprecatedStill available, no longer recommended.Avoid new use and plan to migrate.

For example, as of 18 October 2026 the command reference marks codex, codex exec and codex resume as stable, and codex cloud as experimental. The Linux desktop app is described as a preview, and permission profiles as beta.

Features and install steps change often. Treat the official Codex CLI page and the quickstart as the source of truth, and use this post for the ideas behind them. The core of Codex is also developed in the open at github.com/openai/codex; the docs say the IDE extension and Codex cloud are not open source.

3. Installing Codex

Before you install

New to the terminal? Skip it for now: install the ChatGPT desktop app or the IDE extension instead. The CLI will still be here when you are ready. The docs do not publish a minimum macOS, Windows or Linux version for the CLI, so if the installer fails, start with the official CLI page.

Pick the install command for your system

SystemCommandNotes
macOS, Linuxcurl -fsSL https://chatgpt.com/codex/install.sh | shThe standalone installer. Running it again updates Codex.
Windows, PowerShellpowershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"Start it from a new PowerShell window. Running it again updates Codex.
Homebrewbrew install --cask codexUpdate with brew upgrade --cask codex.
npmnpm install -g @openai/codexRe-run the same command to update.

You can also run codex update, which the command reference says checks for and applies an update when your installed release supports self-update.

Windows: native, WSL or the desktop app

On Windows you have three official routes:

# Inside an elevated PowerShell (WSL route)
wsl --install
wsl

# Then, inside the WSL shell
curl -fsSL https://chatgpt.com/codex/install.sh | sh
codex

The docs also advise keeping repositories under your Linux home folder (for example ~/code/my-app) rather than under /mnt/c, because Windows-mounted paths can be slower and cause more symlink and permission issues.

Linux: CLI and desktop app

On Linux the CLI uses the same installer as macOS. Codex’s sandbox on Linux and WSL2 relies on bubblewrap, which the docs ask you to install first:

# Debian / Ubuntu
sudo apt install bubblewrap

# Fedora
sudo dnf install bubblewrap

The ChatGPT desktop app for Linux is a preview. The docs list Ubuntu 24.04 LTS and 26.04 LTS, Debian 13, Fedora 43 and 44, and current Arch Linux, each for x64 and ARM64. Packages are a .deb (Ubuntu, Debian), an .rpm (Fedora) or an install script (Arch); follow the Linux desktop app guide for the exact download and install steps.

Check that it worked

Open a new terminal window and run:

codex --version

It prints a version number. For a fuller health check, run codex doctor. The docs say it generates a diagnostic report covering installation, configuration, authentication, runtime, Git, terminal, app-server and chat inventory. Add --summary for just the grouped check rows and the final count.

If you see “command not found” or “not recognized”

This is the most common first-day problem with any command-line tool. It usually means your terminal cannot find the codex program. The part of the docs that covers it is brief, so here is what they support, in order:

  1. Open a new terminal window. The docs’ Windows troubleshooting table gives this as the first fix when codex is not recognized after installation, because an already-open window does not see the updated PATH (the list of folders your terminal searches for commands).
  2. Check whether the command exists at all. The WSL page uses this on Linux-style shells:
    which codex || echo "codex not found"
    On Windows PowerShell, Get-Command codex shows where it is found, and the docs suggest it for spotting competing standalone and npm copies when the wrong version starts.
  3. Check the PATH of the right account. The docs warn that an install done under a different account (for example a system account in a managed setup) does not install into your own profile.
  4. In WSL, install it inside WSL. The WSL page’s own fix for “cannot find codex” is to verify the binary exists and is on PATH inside WSL. If it is missing, run the macOS/Linux installer in the WSL shell and repeat the which check above.

The docs do not print a specific folder to add to PATH, so I will not guess one. If the steps above do not fix it, re-run the installer, or install with Homebrew or npm instead, then open a new terminal. Still stuck? codex doctor is built for this, and the issue tracker is where the docs send bug reports.

4. Signing in: ChatGPT account or API key

According to the authentication page, Codex supports two ways to sign in when using OpenAI models. The desktop app, CLI and IDE extension support both. Codex cloud needs ChatGPT.

MethodWhat it meansHow in the CLI
Sign in with ChatGPTSubscription access. Usage follows your ChatGPT workspace permissions and settings. This is the default.Run codex (or codex login) and finish the browser flow.
API keyUsage-based access, billed through your OpenAI Platform account at standard API rates. Some features that rely on ChatGPT workspace access or cloud services are limited or unavailable.printenv OPENAI_API_KEY | codex login --with-api-key

Get an API key from the OpenAI dashboard. The docs pipe the key in through stdin so it does not end up in your shell history as a typed argument. Compare which features each method supports on the feature availability table.

Start it and sign in

  1. Go to your project. Codex works relative to the folder you start it in, so this matters.
    cd ~/projects/my-app
  2. Start it.
    codex
  3. Sign in. The first run asks you to choose Sign in with ChatGPT or another available method. For ChatGPT sign-in a browser window opens, and after you sign in the browser returns your credentials to Codex.
Installone command cd projectpick a folder codexstart a chat Sign infirst run only Askstart working
Five steps from nothing to your first question.

Good to know about sign-in

5. Your first session

Once you run codex in a project folder, you get a prompt. You type in plain language. A good first message is not “write me a feature”, it is a question that lets Codex look around. The CLI page’s own first example is exactly that:

Tell me about this project

If you want a safe place to practise, make a throwaway project first. This is the checklist I would follow on day one:

  1. Create a playground in git.
    mkdir ~/codex-playground && cd ~/codex-playground
    git init
    printf '# Playground\n' > README.md
    git add . && git commit -m "start"
    git switch -c try-codex
  2. Start Codex with codex and, if asked, decide whether to trust the folder. If you are unsure, do not trust it yet: the docs say Codex may start in read-only until you explicitly trust the working directory.
  3. Ask a question. “Tell me about this project.” Nothing should change yet.
  4. Check where you stand. Type /status. The docs say it shows the active model, approval policy, writable roots and remaining context.
  5. Ask for one tiny change. “Add a one-line description under the title in README.md.” Read any approval request before you answer it.
  6. Inspect the result. Type /diff to see the git diff, including files git is not tracking yet.
  7. Keep or discard. Happy? git commit -am "try codex". Not happy? git restore README.md, or just delete the playground.
  8. Leave and come back. Quit with /exit, then run codex resume (see below) to reopen a recent chat.
~/projects/my-app — codex
> Tell me about this project

● I'll look at the project files first.
  read README.md
  read app/build.gradle.kts
  search "MainActivity"

● This is an Android app that shows a list of notes.
  • UI is in app/src/main/java/.../ui/ (Jetpack Compose)
  • Data is stored with Room in .../data/
  • Run it with ./gradlew installDebug

> _
Illustrative mockup, not a live capture. Codex reads files itself, then summarises. Wording and layout vary by version.

Notice what happened. You did not paste any code. Codex chose which files to read. When it wants to do something outside its sandbox boundary, such as edit a file outside the workspace or use the network, it stops and asks you first. Section 7 explains exactly when.

Two prompt habits from the official best practices guide pay off immediately. First, a good default prompt has four parts: the goal, the context (use @ to search for a file and add its path), any constraints, and a done when condition such as “tests pass”. Second, for anything hard or vague, ask Codex to plan before it codes (the /plan command in section 6).

How to stop, interrupt and quit

You want toDo this
Leave CodexPress Ctrl+C or type /exit (the same as /quit). Save or commit anything important first.
Give new instructions while Codex is workingPress Enter to inject them into the current turn, or Tab to queue a follow-up prompt or slash command for the next turn.
Change your mind about your last messagePress Esc twice with an empty prompt to edit the previous message and fork the chat from that point.
Stop long-running commands Codex started/ps shows background terminals and their recent output; /stop stops them all.
Start a fresh conversationType /new (same CLI session) or /clear (clears the terminal view too).
Come back to an earlier conversationRun codex resume (picker), codex resume --last (most recent in this folder), or type /resume inside Codex.
Step back from a bad editUse git: review with /diff, then restore files or switch branch.

One honest gap: the pages I checked do not name a default key that interrupts just the current turn. They do show that the interrupt key is configurable (interrupt_turn under [tui.keymap.chat] in config.toml, with f12 as the example), and that /keymap lets you inspect and change shortcut bindings. Open /keymap to see what your version uses.

Stay safe on day one

A short checklist before you approve anything
  • Work on a git branch. Run git switch -c try-codex first and commit anything you care about. The docs themselves advise creating Git checkpoints before and after a task so you can revert changes.
  • Keep the defaults while you learn. By default Codex keeps network access off and limits writes to the workspace. Check with /status.
  • Read each approval request. Look especially at shell commands and anything that leaves the workspace. Say no if you are not sure.
  • Start with questions or plan mode, not edits, in a project you do not know.
  • Treat web results and fetched pages as untrusted. The docs warn that prompt injection (hidden instructions in content the agent reads) can make an agent follow untrusted instructions, so be careful when you enable live web search or network access.
  • Keep secrets out of reach. Do not paste passwords or keys into chat, and never share ~/.codex/auth.json.
  • Avoid the full-bypass options --dangerously-bypass-approvals-and-sandbox (alias --yolo) and --sandbox danger-full-access. The docs say to use the first only inside an externally hardened environment, and describe it as no sandbox and no approvals.
  • Check your workplace rules. What Codex reads is processed by OpenAI’s service. If the code is your employer’s, make sure using an AI tool on it is allowed, and remember that your sign-in method decides which data-handling policy applies.

6. Slash commands worth knowing

Typing / in the prompt opens a menu of commands that control the chat itself rather than talk to the model. Type a few letters to filter the list. If a chat is already running, you can type a slash command and press Tab to queue it for the next turn. These are the ones I use most. The full list is in the official CLI reference:

CommandWhat it does
/statusShows the active model, approval policy, writable roots and token usage.
/permissionsSets what Codex can do without asking first, such as switching between Auto and Read Only.
/modelChooses the active model, and the reasoning effort when available.
/planSwitches to plan mode, optionally with a prompt, for example /plan Propose a migration plan for this service.
/initGenerates an AGENTS.md scaffold in the current directory (Part 2).
/diffShows the git diff, including files git is not tracking yet.
/reviewAsks Codex to review your working tree and summarise issues, focusing on behaviour changes and missing tests.
/new, /clearStart a new chat. /clear also clears the terminal first.
/resumeReloads a saved chat from a picker.
/compactSummarises the visible chat to free up context. Details in Part 3.
/mentionAttaches a file or folder to the chat so Codex inspects it next.
/usageShows your account’s token usage, or lets you use an available rate-limit reset.
/debug-configPrints config layers and policy diagnostics, handy when a setting does not seem to apply.
/exit, /quitExit the CLI.

Beyond these, the reference lists commands for /fork, /side, /goal, /mcp, /skills, /hooks and more. We meet most of them in Parts 5 to 7. Some commands appear only when available: for example /fast shows up only if the current model offers a Fast tier.

7. Approvals, sandbox and permission modes

Earlier you saw that Codex can stop and ask. The docs explain this as two separate controls that work together:

Sandbox mode What Codex CAN do technically Where it may write filesWhether commands can use the networkEnforced by the operating system Approval policy WHEN Codex must stop and ask you Before leaving the sandboxBefore using the networkBefore commands outside a trusted set The sandbox draws the line. The approval policy decides who says yes when Codex wants to cross it.
Two layers, one safety model. Changing one does not silently change the other.

The three sandbox modes

Sandbox mode (--sandbox)What it allows
read-onlyCodex can read files and run commands inside a read-only sandbox. It cannot write to your project. Good for chatting, planning and review.
workspace-writeCodex can also edit files in the workspace (the current directory plus temporary directories like /tmp). Network access stays off unless you turn it on.
danger-full-accessRemoves the sandbox restrictions. Not recommended outside an isolated environment.

Even in workspace-write, some paths stay read-only inside the workspace: .git, and .agents, .codex and .aws when they exist as directories.

The approval policy

The two values you can pass to --ask-for-approval (-a) are on-request, where Codex runs what the sandbox allows and asks when it needs to go beyond it, and never, which turns approval prompts off. The docs stress that never still works within whatever sandbox you chose, so you keep control of how much autonomy there is. They also mention a granular form for keeping some prompt categories interactive and rejecting others, and say the older untrusted value has been retired and can stop the client from starting if it is still in your config.

The combinations you will actually use

The docs call the default preset Auto. In the CLI you pick between the presets with /permissions. In the desktop app and IDE extension the permissions control sits below the composer, where the docs call the starting mode Ask for approval.

Read Only read-only sandbox,ask when it needs more. Reads and answers.Does not edit your files. Auto (default preset) workspace-write + on-request.Reads, edits and runscommands in the workspace.Asks to go outside it or touse the network. Full access danger-full-access, noapprovals (--yolo). No sandbox, no prompts.Not recommended. you decide every stepCodex moves faster, with fewer limits Plan mode (/plan) is separate: it is about thinking first, not about autonomy.
Three common setups. Switch between the first two at any time with /permissions.
IntentFlagsEffect
Auto (default preset)no flags, or --sandbox workspace-write --ask-for-approval on-requestRead, edit and run commands in the workspace. Approval needed to edit outside it or to use the network.
Safe read-only browsing--sandbox read-only --ask-for-approval on-requestRead files and run commands in the read-only sandbox. Actions outside it can need approval.
Auto-review--approve-for-meSame workspace-write boundary, but eligible approval requests go to an automatic reviewer instead of to you. In the desktop app this is Approve for me.
Dangerous full access--dangerously-bypass-approvals-and-sandbox (alias --yolo)No sandbox, no approvals. The docs mark it not recommended.

The --approve-for-me row comes from the command reference; the same behaviour is also written in the docs as -c approvals_reviewer=auto_review. The reviewer only looks at actions that already need approval, uses extra model calls, and can make mistakes, so the docs say it does not replace isolation or your own oversight. While you are learning, keep approvals on you.

What Codex does on first launch

The docs say Codex detects whether your folder is version-controlled and recommends Auto for version-controlled folders and read-only for folders that are not. That is one more reason to put your practice project in git. To accept the defaults, simply run codex. To set them explicitly:

codex --sandbox workspace-write --ask-for-approval on-request
codex --sandbox read-only --ask-for-approval on-request
/permissions
> /permissions

 Select approval preset
 ✓ Auto        edit and run in the workspace, ask beyond it
   Read Only   read and answer, review edits first
   (more choices may appear for your setup)
Illustrative mockup. The preset names Auto and Read Only come from the docs; the layout and descriptions here are mine and vary by version, plan and organisation policy.

Plan mode: think first

Separately from permissions, /plan switches the chat into plan mode: Codex proposes an execution plan before implementation starts. You can add a prompt inline, for example /plan Propose a migration plan for this service. It is unavailable while Codex is already working. Why it matters: a plan is cheap to correct, and code is not. Catching a wrong assumption in step 2 of a plan costs you one sentence. Catching it after twenty edited files costs a lot of tokens and time. I use it for anything touching several files, new features, and any code I do not know well.

SituationSetup I would pick
First day with Codex, or unfamiliar projectRead Only or the default Auto, with git checkpoints
Big or vague change across many files/plan first, then Auto
Small, clear edit with tests to catch mistakesAuto
Exploring or reviewing code, no changes wantedRead Only
Long task you will check at the endAuto, and consider automatic review once you know what it does

Managed machines add another layer. Your organisation may enforce constraints, for example by disallowing approval_policy = "never" or sandbox_mode = "danger-full-access", and local settings cannot override that. If a mode is missing or greyed out, ask your administrator before you blame your config. The Windows and Linux sandbox details are in the sandbox page and approvals and security page.

8. Changing the model and reasoning effort

Codex can run on different models. A larger model reasons better about hard problems but is slower and uses more of your allowance. A smaller one is quick and fine for simple, repeatable tasks. Matching the model to the job is one of the easiest ways to work faster and spend less. The docs’ model page says to start with the default reasoning effort and raise it when the task needs deeper planning or analysis.

Reasoning effort trade-off Low Medium High and above faster, fewer tokensbalanceddeeper, slower quick, well-scopedtasks tasks that need moreplanning difficult multi-stepwork with trade-offs more depth, time and usage →
A rule of thumb from the docs, not a law. Start at the default, step down for easy work, step up when stuck.

How to choose

# 1. Inside a chat: pick a model and reasoning effort from the popup
/model

# 2. When you start Codex (this launch only)
codex --model gpt-6.1-sol
codex -m gpt-6-luna

# 3. Saved in config.toml (see section 9)
model = "gpt-6.1-sol"
model_reasoning_effort = "medium"

# 4. Any single setting for one launch
codex -c model_reasoning_effort=high
/model
> /model

 Choose a model
 ✓ gpt-6.1-sol
   gpt-6-luna
   (only models available to your account appear)
Illustrative mockup. The picker only shows models available to your account and workspace, so your list will differ. Run /status afterwards to confirm the change.

Command-line flags beat saved settings for that launch. In the picker, the CLI can show more reasoning options if you select More reasoning… after choosing a model.

Which models, as of 18 October 2026

Per the models page, the docs recommend GPT-6.1 Sol (gpt-6.1-sol) when it is available to your account and client for complex coding and agentic work, and GPT-6 Luna (gpt-6-luna) for focused, repeatable tasks. Astra is described as the choice when a task needs the strongest capability across steps and tools. Availability depends on rollout, your sign-in method, your client and, for Enterprise and Edu, whether an administrator enabled a model. If a model is not listed in your picker, pick another.

Retirements to know about. The docs say GPT-5.5 retired from Codex for ChatGPT sign-in on 14 October 2026 (API-key sessions were not affected), and that gpt-5.3-codex-spark retired on 14 September 2026. If an old script or config still names a retired model, replace it with an available one. The full model story, including the API, is in Part 4.

Reasoning effort

Effort levels have friendly names in the apps and plain names in config. The docs say Light in the desktop app, ChatGPT Work on the web and the IDE extension is called Low in the CLI. In config.toml, model_reasoning_effort takes values such as low, medium, high, xhigh, max or ultra, but only the levels your model and client actually support. Guidance from the docs:

Higher effort takes longer and uses more tokens, so raise it on purpose. Reasoning efforts also do not map exactly between model generations, so the docs suggest trying a familiar task at a lower setting and adjusting.

One more control: /fast toggles a Fast service tier on or off and saves your choice, but only when the current model offers one.

9. config.toml and where it lives

Beyond the model, you can save preferences in a config.toml file (TOML is a simple key = "value" text format). Per the config basics page, your personal defaults live in ~/.codex/config.toml, and you can scope settings to a project with a .codex/config.toml file in the repo. Codex loads project .codex/ layers only when you trust the project. The CLI and the IDE extension share the same layers. In the extension, click the gear icon, then Codex Settings > Open config.toml. The Codex home folder is $CODEX_HOME, which defaults to ~/.codex; the app on Windows uses %USERPROFILE%\.codex.

When settings disagree, Codex resolves them in this order, highest first:

1. CLI flags and -c overrideswins 2. Project: .codex/config.toml (trusted projects only) 3. Profile file chosen with --profile (~/.codex/NAME.config.toml) 4. User: ~/.codex/config.toml 5 and 6. Cloud-managed defaults, then system config (/etc/codex/config.toml on Unix) 7. Built-in defaults
Think of it as layers: built-in defaults, your global habits, the project’s rules, then whatever you type on the command line.
~/.codex/config.toml
model = "gpt-6.1-sol"
model_reasoning_effort = "medium"
approval_policy = "on-request"
sandbox_mode = "workspace-write"
web_search = "cached"

That small file says: use GPT-6.1 Sol at medium effort by default, ask for approval when going beyond the sandbox, let commands write inside the workspace, and use cached web search results. Every key above is one the docs list as commonly changed. Here is what the less obvious ones mean:

KeyWhat it does
modelThe default model for the CLI and IDE. If you leave it out, Codex uses a recommended model.
model_reasoning_effortThe default reasoning effort, when the model supports it.
approval_policyWhen Codex pauses to ask: on-request or never (section 7).
sandbox_moderead-only, workspace-write or danger-full-access.
web_search"cached" (default: pre-indexed results from an OpenAI-maintained cache, which lowers exposure to prompt injection), "indexed", "live" (same as --search) or "disabled".
[sandbox_workspace_write] network_access = trueLets commands in the workspace-write sandbox reach the network. Off by default, so enable it only if you need it.

Do not mix the old and new styles: the docs say permission profiles (default_permissions, beta) do not compose with the older sandbox_mode settings, so use one or the other. If something does not apply, run /debug-config to see which layer won. For every available key, see the configuration reference.

Notice that config.toml configures behaviour. It does not tell Codex anything about your project. For that, we need a different kind of file.

10. What comes next

You can now install Codex, sign in, talk to it, control what it may do, and switch models. But start a new chat and Codex has forgotten what you taught it. That is not a bug; it is how language models work. In Part 2 we fix it with AGENTS.md. Part 3 shows how that saves tokens and speeds up onboarding, and Part 4 covers the Codex models, the API and the official links.

TermIn plain words
CodexOpenAI’s coding agent, available in the CLI, IDE extension, ChatGPT desktop app and the cloud.
CLICommand-line interface: using a program by typing in a terminal.
PATHThe list of folders your terminal searches for commands. “command not found” often means the install folder is missing from it or the terminal needs reopening.
Slash commandA /something command that controls the chat.
Sandbox modeWhat Codex can technically touch: read-only, workspace-write or danger-full-access.
Approval policyWhen Codex must stop and ask you: on-request or never.
WorkspaceThe current directory plus temporary directories like /tmp, where Codex may write by default.
Reasoning effortHow much thinking the model applies: low, medium, high and above.
Plan modeA mode (/plan) where Codex proposes a plan before implementation starts.
config.tomlThe file that stores your preferences, at user (~/.codex/) or project (.codex/) level.
Maturity labelExperimental, beta, stable or deprecated: how much to trust a feature to stay the same.
← Back to all writing