Codex · Series · Part 1 of 8
Meet Codex and set it up: the interfaces, the first session, and choosing a model
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.
- 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.
- 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).
- Install and check it. One command from section 3, then
codex --version. - Make a throwaway project in git and create a branch first (
git switch -c try-codex), so anything Codex changes can be undone. - Start it. Run
cd your-project, thencodex, and choose Sign in with ChatGPT (or another available method) the first time. - Ask before you change. Try “Tell me about this project” (the docs’ own first prompt) and read the answer.
- Try one tiny change, such as “add a one-line description to README.md”. Then run
/diffto see exactly what changed. - Know how to stop. Ctrl+C or
/exitcloses 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
| Word | In plain words |
|---|---|
| Prompt | The message you type to Codex. |
| Token | A small chunk of text, roughly three-quarters of a word. Limits and costs are counted in tokens. |
| Context window | The 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. |
| Chat | One conversation with Codex. The docs also use the word “session” for a CLI conversation, and older material says “thread” or “task”. |
| AGENTS.md | A text file in your project that gives Codex lasting instructions, so you do not have to repeat yourself. |
| Model | The AI behind Codex. Bigger ones think harder but are slower and use more of your allowance. |
| Sandbox | A fenced area the operating system enforces around the commands Codex runs. |
- 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.mdis, 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?
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:
| Name | What it is |
|---|---|
| The model | The “brain”. OpenAI offers several, in different sizes, and you can choose which one Codex uses (section 8). |
| Codex | The 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 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.
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.
| Surface | Good for |
|---|---|
| Codex CLI | Use Codex from your terminal and scripts. Type codex inside your project folder. This is the surface most of this series shows. |
| IDE extension | Work 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 app | A standalone window for projects, local files, parallel chats and longer tasks. No terminal needed. Available for macOS, Windows and (as a preview) Linux. |
| Codex cloud | Run 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 mobile | Start 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:
| Label | Meaning in the docs | What to do |
|---|---|---|
| Experimental | Unstable; OpenAI may remove or change it. | Use at your own risk. |
| Beta | Ready for broad testing; some aspects may change. | OK for evaluation and pilots; expect small changes. |
| Stable | Fully supported and consistent over time. | Safe for production use. |
| Deprecated | Still 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
- A way to sign in: a ChatGPT account, or an OpenAI API key. Plans differ in what they include. As of 18 October 2026 the pricing page lists Codex on the web, in the CLI, in the IDE extension and on iOS under Plus, and lists the desktop app with GPT-6 Luna under Free and Go, subject to rollout. See the pricing page for current plans and limits.
- A project folder to work in, ideally one under git.
- Optional: git itself. The Windows app docs call Git the tool that powers the review panel and lets you inspect or revert changes.
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
| System | Command | Notes |
|---|---|---|
| macOS, Linux | curl -fsSL https://chatgpt.com/codex/install.sh | sh | The standalone installer. Running it again updates Codex. |
| Windows, PowerShell | powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" | Start it from a new PowerShell window. Running it again updates Codex. |
| Homebrew | brew install --cask codex | Update with brew upgrade --cask codex. |
| npm | npm install -g @openai/codex | Re-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:
- Native CLI: the PowerShell command above. The Windows desktop app runs natively using PowerShell and the Windows sandbox.
- WSL2 (Windows Subsystem for Linux): choose it when you need Linux-native tooling or your repositories already live in WSL2. In an elevated PowerShell or Windows Terminal run
wsl --install(Ubuntu is a common choice), thenwslto open a Linux shell, and install Codex inside it with the macOS/Linux command. WSL1 is not supported: the docs say it worked through Codex 0.114, and from 0.115 the Linux sandbox usesbubblewrap. - The ChatGPT desktop app: download it from the download page, or run
winget install --id 9PLM9XGG6VKS -s msstore. By default its agent runs in PowerShell; in Settings you can switch the agent to WSL and restart the app.
# 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:
- Open a new terminal window. The docs’ Windows troubleshooting table gives this as the first fix when
codexis not recognized after installation, because an already-open window does not see the updated PATH (the list of folders your terminal searches for commands). - Check whether the command exists at all. The WSL page uses this on Linux-style shells:
On Windows PowerShell,which codex || echo "codex not found"Get-Command codexshows where it is found, and the docs suggest it for spotting competing standalone and npm copies when the wrong version starts. - 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.
- 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
whichcheck 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.
| Method | What it means | How in the CLI |
|---|---|---|
| Sign in with ChatGPT | Subscription access. Usage follows your ChatGPT workspace permissions and settings. This is the default. | Run codex (or codex login) and finish the browser flow. |
| API key | Usage-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
- Go to your project. Codex works relative to the folder you start it in, so this matters.
cd ~/projects/my-app - Start it.
codex - 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.
Good to know about sign-in
- Check or end it.
codex login statusprints the active sign-in method.codex logout(or/logoutinside a chat) clears the stored credentials. Use it on a shared machine. - Login is cached. Codex stores it locally, in a plaintext file at
~/.codex/auth.jsonor in your operating system’s credential store. The CLI and IDE extension share the cache. Treatauth.jsonlike a password: do not commit it, paste it into tickets, or share it in chat. Thecli_auth_credentials_storesetting (file,keyring,autoorephemeral) chooses where it goes. - No browser on the machine? On a remote or headless computer, the docs prefer device code login, which they label beta: run
codex login --device-auth, open the link on another device and enter the one-time code. It must be enabled in your ChatGPT security settings or workspace permissions first. - Your sign-in method decides the rules. The docs say it determines which admin controls and data-handling policies apply: ChatGPT workspace settings for ChatGPT sign-in, your API organisation’s settings for an API key.
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:
- 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 - Start Codex with
codexand, 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. - Ask a question. “Tell me about this project.” Nothing should change yet.
- Check where you stand. Type
/status. The docs say it shows the active model, approval policy, writable roots and remaining context. - Ask for one tiny change. “Add a one-line description under the title in README.md.” Read any approval request before you answer it.
- Inspect the result. Type
/diffto see the git diff, including files git is not tracking yet. - Keep or discard. Happy?
git commit -am "try codex". Not happy?git restore README.md, or just delete the playground. - Leave and come back. Quit with
/exit, then runcodex resume(see below) to reopen a recent chat.
> 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
> _
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 to | Do this |
|---|---|
| Leave Codex | Press Ctrl+C or type /exit (the same as /quit). Save or commit anything important first. |
| Give new instructions while Codex is working | Press 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 message | Press 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 conversation | Type /new (same CLI session) or /clear (clears the terminal view too). |
| Come back to an earlier conversation | Run codex resume (picker), codex resume --last (most recent in this folder), or type /resume inside Codex. |
| Step back from a bad edit | Use 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
- Work on a git branch. Run
git switch -c try-codexfirst 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:
| Command | What it does |
|---|---|
/status | Shows the active model, approval policy, writable roots and token usage. |
/permissions | Sets what Codex can do without asking first, such as switching between Auto and Read Only. |
/model | Chooses the active model, and the reasoning effort when available. |
/plan | Switches to plan mode, optionally with a prompt, for example /plan Propose a migration plan for this service. |
/init | Generates an AGENTS.md scaffold in the current directory (Part 2). |
/diff | Shows the git diff, including files git is not tracking yet. |
/review | Asks Codex to review your working tree and summarise issues, focusing on behaviour changes and missing tests. |
/new, /clear | Start a new chat. /clear also clears the terminal first. |
/resume | Reloads a saved chat from a picker. |
/compact | Summarises the visible chat to free up context. Details in Part 3. |
/mention | Attaches a file or folder to the chat so Codex inspects it next. |
/usage | Shows your account’s token usage, or lets you use an available rate-limit reset. |
/debug-config | Prints config layers and policy diagnostics, handy when a setting does not seem to apply. |
/exit, /quit | Exit 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:
The three sandbox modes
Sandbox mode (--sandbox) | What it allows |
|---|---|
read-only | Codex can read files and run commands inside a read-only sandbox. It cannot write to your project. Good for chatting, planning and review. |
workspace-write | Codex 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-access | Removes 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.
| Intent | Flags | Effect |
|---|---|---|
| Auto (default preset) | no flags, or --sandbox workspace-write --ask-for-approval on-request | Read, 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-request | Read files and run commands in the read-only sandbox. Actions outside it can need approval. |
| Auto-review | --approve-for-me | Same 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
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)
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.
| Situation | Setup I would pick |
|---|---|
| First day with Codex, or unfamiliar project | Read 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 mistakes | Auto |
| Exploring or reviewing code, no changes wanted | Read Only |
| Long task you will check at the end | Auto, 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.
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
Choose a model
✓ gpt-6.1-sol
gpt-6-luna
(only models available to your account appear)
/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:
- Low for quick, well-scoped tasks.
- Medium for tasks that need more planning.
- High and Extra High for difficult work with multiple steps, sources or trade-offs.
- Max gives the model more time on a single hard task; Ultra uses subagents to work on parts of a task in parallel. The docs say most tasks need neither, and that Luna supports up to Max but not Ultra.
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:
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:
| Key | What it does |
|---|---|
model | The default model for the CLI and IDE. If you leave it out, Codex uses a recommended model. |
model_reasoning_effort | The default reasoning effort, when the model supports it. |
approval_policy | When Codex pauses to ask: on-request or never (section 7). |
sandbox_mode | read-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 = true | Lets 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.
| Term | In plain words |
|---|---|
| Codex | OpenAI’s coding agent, available in the CLI, IDE extension, ChatGPT desktop app and the cloud. |
| CLI | Command-line interface: using a program by typing in a terminal. |
| PATH | The 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 command | A /something command that controls the chat. |
| Sandbox mode | What Codex can technically touch: read-only, workspace-write or danger-full-access. |
| Approval policy | When Codex must stop and ask you: on-request or never. |
| Workspace | The current directory plus temporary directories like /tmp, where Codex may write by default. |
| Reasoning effort | How much thinking the model applies: low, medium, high and above. |
| Plan mode | A mode (/plan) where Codex proposes a plan before implementation starts. |
| config.toml | The file that stores your preferences, at user (~/.codex/) or project (.codex/) level. |
| Maturity label | Experimental, beta, stable or deprecated: how much to trust a feature to stay the same. |