Codex on WholeTech network
A complete guide, plain-language

Hello, Codex.

A plain-language, end-to-end guide to OpenAI Codex — the CLI in your terminal, the extension in your IDE, the desktop app on your dock, the cloud agent that works on tasks while you do something else, and the GitHub bot that reviews your PRs. What each one is for, when to use which, and the exact commands to type.

If you can copy a sentence from a webpage into a terminal, you have everything you need.

Last updated: May 2026 Reading time: ~30 min · Hands-on: ~2 hours Audience: beginners → builders
01 — Quick Start

Pick where you want to start

Codex is one product with five front doors. The cloud at chatgpt.com/codex needs zero setup — your repo, your tasks, your machine never leaves the browser tab. The CLI lives in your terminal and runs locally. The IDE extension brings the same agent into VS Code, Cursor, or Windsurf. The desktop app is the cloud and the local agent fused into one window with native notifications. And the GitHub bot reviews PRs when you @codex it in a comment. Most people start in the cloud, then install the desktop app or CLI within a week.

1. Codex Cloud (web)

chatgpt.com/codex · 0 min setup

Sign in with ChatGPT, connect a GitHub repo, give Codex a task. It spins up a container, makes the changes, opens a PR. You can fire off a dozen in parallel and check back later. Included with Plus, Pro, Business, Enterprise, and Edu plans.

Open chatgpt.com/codex →
>_

2. Codex CLI

terminal · ~5 min setup

One npm i -g @openai/codex (or brew install codex) and you have an agent that reads, edits, and runs code in the project you launched it from. Sign in with your ChatGPT account — no API key needed.

Install the CLI →

3. Codex IDE extension

VS Code · Cursor · Windsurf

Install from the VS Code marketplace and the same agent runs in a side panel — with the diff viewer, file picker, and your active selection wired in. Cursor and Windsurf are also supported (they share the VS Code extension model).

See IDE setup →

4. Codex desktop app

macOS · Windows · ~2 min setup

A native window that fuses the cloud dashboard, the local agent, and your inbox of running tasks. Notifications, global hotkey, system-tray status, and a richer diff viewer than the IDE. Best if you have several repos and want one place to watch them.

See desktop setup →

5. Codex on GitHub

@codex · PR reviews

Install the Codex GitHub app, then mention @codex in any issue or PR comment. It can review diffs, propose fixes as commits, answer questions about the code, and run the cloud agent to implement small changes end-to-end.

Wire up GitHub →
Not sure which to pick? Start in the cloud if you want to see what Codex can do without touching your machine. Drop down to the CLI the first time you want to iterate fast on something running locally — like a Vite dev server, a database migration, or a script that touches your filesystem.
02 — What it actually is

One agent, four surfaces

Codex is OpenAI's coding agent. It reads files, writes patches, runs commands, asks you questions, follows up on test failures, and stops when it's stuck. The same model and the same instruction set power all four surfaces — the only thing that changes is where the work runs and what kind of approval gate sits between the model and your filesystem.

runs locally

CLI & IDE extension

Your code, your machine, your shell. The agent edits files in place and runs commands inside a sandbox you control. Best for tight loops where you want to watch the dev server, see the failure, ask Codex to fix it — and merge before lunch.

low latencyprivateyour tools
runs in the cloud

Codex Cloud & GitHub bot

A fresh container per task, cloned from your repo. You give Codex a job, walk away, come back to a PR. Fan out: spin up ten tasks at once and pick the ones that landed clean. Best for backlog grooming, refactors, and "I wonder if this is doable."

parallelasyncPR-shaped
The mental model: CLI = pair programming. Cloud = delegation. The CLI is best when you'll watch every step; the cloud is best when you'd rather not.
03 — The surfaces

Every place Codex shows up

Each chip points to a section below. Solid borders ship today; dashed are early-access or rumored. Codex is one of the fastest-moving products at OpenAI — this list will need updates often.

04 — Install

Get the CLI running

The CLI is the highest-leverage surface — install it once and the IDE extension, the cloud, and the GitHub bot all become richer because you can flip between them. Two install paths cover almost everyone: npm and Homebrew.

macOS, Linux, Windows (npm)

If you have Node 20+ already, this is two lines:

terminal
# 1. install
$ npm install -g @openai/codex

# 2. sign in with your ChatGPT account (opens a browser)
$ codex login

# 3. start a session in the current directory
$ codex

macOS (Homebrew)

$ brew install codex
$ codex login
$ codex

Windows notes

Codex runs in PowerShell 7+, Windows Terminal, and inside WSL. The native Windows build does file edits the same way as on macOS/Linux; the sandbox is less strict (Windows doesn't have Seatbelt or Landlock). If you do a lot of agent work, run it inside WSL Ubuntu — you get the Linux sandbox and faster filesystem ops on git repos.

Authentication

You have two ways in. ChatGPT login (free if you already pay for Plus/Pro/Business/Enterprise/Edu) is the default and is included with your plan. API key bills usage against your OpenAI API account — useful if you're on a free ChatGPT tier or you want to switch billing to a company API account.

codex login
Interactive — opens chatgpt.com in your browser, authenticates, drops a credential into ~/.codex/auth.json.
codex login --api-key
Use an OpenAI API key instead. Stored locally; never sent anywhere but the API.
OPENAI_API_KEY env var
Picked up automatically if set. Convenient for CI.
codex logout
Wipes the stored credential.
Tier check: ChatGPT login requires a paid plan (Plus, Pro, Business, Enterprise, or Edu). On the free tier you'll need an API key with credit on it. If codex login errors out, that's the most common reason.

Updating

$ npm update -g @openai/codex      # npm install
$ brew upgrade codex                # homebrew install
$ codex --version                   # check what you're on

Codex ships often — usually a release every week or two. If something behaves oddly, update before you debug.

05 — Pricing & plans

What it costs

Two ways to pay for Codex, and you can mix them. A ChatGPT subscription (Plus, Pro, Business, Enterprise, Edu) includes Codex usage with monthly limits — most people start here and never leave. An OpenAI API key bills usage per-token against your developer account — useful when you blow past the ChatGPT limits, when you're on the free tier, or when a finance team wants Codex billed against API spend instead of seats. Pick whichever fits, swap any time with codex logout.

ChatGPT plan tiers

Codex is included with every paid ChatGPT plan. The plan controls how much you can use it before you hit a limit, and which surfaces unlock.

PlanPriceCodex usageSurfacesBest for
Free $0 Not included API key route only
Plus $20/mo Generous everyday usage. Enough for a few cloud tasks a day plus a steady CLI/IDE habit. All five (CLI, IDE, Desktop, Cloud, GitHub) Solo devs, side projects, learning
Pro $200/mo Much higher limits — built for power users who fan out tasks in the cloud and use Codex all day. All five, with priority cloud throughput Full-time Codex users, heavy cloud delegation
Business ~$25/user/mo Plus-tier limits per seat, pooled at the workspace level. Admin controls, SSO, audit log. All five + admin dashboard, workspace AGENTS.md, SCIM Small & mid-sized teams
Enterprise Custom Custom usage caps, data residency options, retention controls, SAML, BAA available. All five + enterprise SSO, DLP integration, private endpoints Larger orgs, regulated industries
Edu Discounted/free for verified institutions Business-equivalent usage at education pricing. All five Universities, accredited K-12
Pricing & limits move. OpenAI revises both fairly often. The shape of the table above is stable; specific dollar amounts and "how many cloud tasks per day" numbers should be confirmed at openai.com/pricing before you commit. The exact monthly Codex caps are usually documented inside chatgpt.com/codex on the billing page.

API key route (pay-per-token)

Both codex login --api-key and the OPENAI_API_KEY environment variable route usage through your OpenAI developer account at platform.openai.com. You pay per million input/output tokens, with billing showing up on the same dashboard as any other API spend.

ModelRelative costWhat you're paying for
gpt-5-codexFrontier-tierBest agentic coder; deep reasoning; the right pick for real work.
gpt-5.1-codexFrontier-tierLatest revision — same price band as gpt-5-codex.
gpt-5-codex-mini~5-10× cheaperRoutine edits, quick reads, batch jobs. The everyday workhorse for cost-sensitive workflows.

Three lever you should know about — they make the API route substantially cheaper:

When to pick which

Stay on the ChatGPT plan when…

  • You haven't hit a monthly limit yet (most people don't on Plus).
  • You want one bill for ChatGPT and Codex.
  • You're using the cloud heavily — limits there are tuned for that.
  • You're on a Business or Enterprise plan with pooled usage.

Switch to API billing when…

  • You blew through the ChatGPT Codex cap mid-month and don't want to wait for reset.
  • You're running Codex from CI or a script (use the OPENAI_API_KEY env var).
  • Your team already has an API account with a budget; finance prefers one line item.
  • You want to use gpt-5-codex-mini in batch jobs for cheap async work.

Cost-control tips

The right starting point for almost everyone: ChatGPT Plus at $20/mo. Run the CLI on gpt-5-codex-mini for everyday edits, escalate to gpt-5-codex for hard problems, fan out a couple of cloud tasks per day. If you regularly hit the Plus cap or want to delegate constantly, jump to Pro — at $200/mo it pays for itself if it saves you four hours a month.
06 — Your first session

What happens when you type codex

It drops you into a TUI: a chat at the bottom, an event log above, a hint bar with slash commands, and a status line showing the working directory and active model. Type a sentence — anything — and watch.

  1. It reads before it writes. The first thing the agent does is look around: ls, glance at README.md, package.json, AGENTS.md if you have one. Letting it skim is fine; you don't need to brief it on the project structure.
  2. It proposes a plan, sometimes. For non-trivial tasks Codex will outline what it intends to do. You can interrupt with a one-word redirect ("smaller", "skip tests", "just the auth piece") and it adjusts.
  3. It asks before running risky commands. By default, edits inside your working directory go through without a prompt; anything that writes outside it, calls the network, or executes a command flagged as destructive triggers an approval dialog. Approval modes control how chatty that gate is.
  4. You can interrupt anything. Hit Esc to stop generation. Hit Ctrl-C twice to abort a running command. /undo reverts the last set of file changes.
  5. Quit cleanly. /quit or Ctrl-D. Your conversation is logged under ~/.codex/sessions/ and you can resume with codex resume.

Useful slash commands

CommandWhat it does
/initDrafts an AGENTS.md for the current repo by reading the project structure.
/diffShows everything Codex has changed in this session, as a single git diff.
/undoReverts the last batch of file edits.
/modelSwitch model (e.g. gpt-5-codexgpt-5-codex-mini).
/approvalsChange the approval mode mid-session.
/compactSummarize history to free up the context window.
/mentionPull a file or symbol into the conversation by name.
/clearReset the conversation but keep the working directory.
/helpThe full list, always more current than this table.

One-shot mode (no TUI)

For scripts, CI, or just when you want a single answer:

$ codex exec "add a --json flag to the build script"
$ codex exec --model gpt-5-codex-mini "summarize CHANGELOG.md in 3 bullets"
$ codex exec --approval-mode full-auto "run the migration and commit"

codex exec takes one prompt, runs to completion, prints the diff and the final reply, and exits. Combine with shell pipes for batch work.

07 — Approval modes

How much rope you give it

Every action Codex takes — read, edit, run a command, hit the network — passes through a permission gate. The mode you pick decides what the gate lets through silently and what makes it stop and ask. Three modes, in increasing order of trust.

ModeReadsEditsShell commandsNetworkBest for
Read Only
--approval-mode read-only
✓ silent ✗ asks every time ✗ asks every time ✗ asks every time Code review, "explain this", auditing
Auto (default)
--approval-mode auto
✓ silent ✓ silent in workspace ✓ silent in workspace
asks outside it
✗ asks every time Day-to-day work (this is what you want)
Full Access
--approval-mode full-auto
✓ silent ✓ silent anywhere ✓ silent ✓ silent CI, fire-and-forget, throwaway VMs
Full Access is a real footgun. Use it only in a container, VM, or a directory you don't mind losing. The cloud product runs in this mode because it's a disposable container. Locally, Auto is almost always what you want.

The sandbox

Inside Auto and Full Access, commands run in a platform-specific sandbox that blocks unexpected writes:

Network egress is blocked by default in Auto. Turn it on per-session with /approvals or per-invocation with --allow-network.

Picking a mode in practice

Reach for Read Only when…

  • You're using Codex to understand a codebase you didn't write.
  • You want a second-pair-of-eyes review before merging.
  • You're in a production-shaped directory by accident.

Reach for Full Access when…

  • You're inside a Docker container or fresh VM.
  • You're running codex exec from a CI job.
  • You're delegating a long task and willing to discard the result if it goes sideways.
08 — Project memory

The AGENTS.md file

Codex looks for a file called AGENTS.md at the root of your repo (and, recursively, in subdirectories). Anything in it is loaded into context at the start of every session. It's the single highest-leverage thing you can write in a Codex-using repo — a one-page brief that turns every prompt into a better one.

What goes in it

Bootstrapping one

From inside a repo, run /init at the prompt. Codex will read the project structure, draft an AGENTS.md, and ask you to confirm. Edit the draft — the value is in the bits a generator can't infer.

AGENTS.md — a real example
# Acme Web

## Stack
- Next.js 15 (app router) · TypeScript · pnpm
- tRPC + Drizzle on Postgres (Neon)
- Tailwind v4 + shadcn/ui
- Tests: vitest (unit), playwright (e2e)

## How to run
- pnpm dev            # dev server, port 3000
- pnpm test           # vitest, watch mode off
- pnpm test:e2e       # playwright (assumes dev server is up)
- pnpm lint && pnpm typecheck  # gate before commits

## Conventions
- Server components by default; mark client islands explicitly.
- One tRPC router per resource, in src/server/routers/.
- No any. If a type is genuinely unknown, write a comment explaining why.

## Don't
- Touch src/legacy/billing/ — being rewritten on a branch.
- Run migrations. Generate them; we apply by hand.
- Add new dependencies without flagging the size in the PR description.

## Watch out for
- auth.ts has two code paths (session cookie vs. bearer token).
  Most bugs come from forgetting the bearer branch.
The 10-minute payoff. Ten minutes spent on a sharp AGENTS.md saves an hour per week in prompts you didn't have to write and corrections you didn't have to make. Refresh it whenever you notice yourself typing the same context twice.

Nested AGENTS.md files

Drop an AGENTS.md in a subdirectory and Codex will use it when working in that subtree. Useful for monorepos: a top-level brief plus per-package addenda for the parts with their own conventions.

09 — Prompting Codex

Getting more out of every turn

Codex is forgiving — terse prompts work, vague ones often work, even single-word redirects ("smaller", "tests", "no") get parsed sensibly. But the difference between an okay session and a great one comes down to a handful of habits.

1. Say what success looks like

"Add a search endpoint" is fine. "Add a search endpoint at /api/search?q= that returns 20 results, ranked by recency, in JSON" is better — and shorter than the back-and-forth you'd otherwise have to disambiguate it.

2. Name the files

If you know where the change belongs, say so. "In src/auth/session.ts, swap the cookie name to __Host-sid and update the reader in the same file." Codex will still find the file if you don't, but naming it skips a grep round-trip.

3. Constrain scope

Big asks ("rewrite the auth flow") drift. Small, scoped asks land. Break it down yourself, or let Codex propose a plan and pick the first item.

4. Set the verification

End the prompt with "verify by running pnpm test auth". Codex will run it, see the failures, and keep iterating. This single habit turns most flaky outputs into self-healing ones.

5. Use plain-language redirects

You don't need to repeat the prompt. "shorter", "no, I meant the client component", "don't touch the tests", "keep going" — all get parsed correctly. Treat the chat like an over-the-shoulder conversation.

6. Reach for the right effort level

Reasoning effort controls how hard the model thinks before it acts. There are four settings:

EffortWhat it's forLatency
minimalMechanical edits, rename, format. No thinking needed.fastest
lowRoutine changes — add a flag, write a test, fix a typo.fast
medium (default)Most real tasks. Bug fixes, small features, refactors.moderate
highArchitectural choices, gnarly bugs, plans you'll execute against.slow

Switch with /model in the TUI, or --effort high on codex exec. Default to medium; reach for high when you'd want a senior engineer to think for a minute before writing.

7. Show, don't just tell

Pasting a sample of the desired output ("this is what one looks like…") is worth a paragraph of explanation. So is pointing at a similar feature already in the repo: "do the same thing we did in orders/route.ts, but for invoices."

8. End with a check

Once Codex says it's done, run /diff, scan the change, and ask one targeted question: "why this approach over X?" The answer often surfaces a tradeoff worth a follow-up.

10 — Models

What's behind the agent

Codex uses purpose-tuned variants of OpenAI's frontier models. They share the GPT-5 family lineage but are trained specifically for long-horizon coding work — staying on task across many tool calls, recovering from test failures, and writing code that runs.

ModelWhen to use itNotes
gpt-5-codex The default. Best agentic coder OpenAI ships. Long context, strong tool use, good at staying on task. Higher latency, higher quality. Use for real work.
gpt-5-codex-mini The fast variant. Routine edits, quick questions, "what does this file do" reads. Trades depth for speed. Great with --effort low.
gpt-5.1-codex The latest revision — improved tool-call patterns, better at picking sandbox modes, slightly better long-horizon recovery. Default when available; falls back to gpt-5-codex otherwise.
gpt-5 / gpt-5.1 The general-purpose models. Available if you want a Codex session backed by the non-specialized GPT-5. Slightly weaker at agentic loops; sometimes stronger on free-form reasoning.

Switching models

$ codex --model gpt-5-codex-mini       # for this session
>_ /model gpt-5-codex                   # mid-session switch
# or set the default in ~/.codex/config.toml — see §11
A pattern that works: start in mini for exploration and quick edits, escalate to the full model the moment you hit a real decision. The TUI tells you which model produced each response, so you can read back and see where the gear-shift happened.
11 — IDE extension

Codex in your editor

The IDE extension is the CLI with a better UI for the visual parts — diffs, file picks, selections. Install it once and you can switch between terminal and editor without changing your workflow.

Install

What you get over the CLI

What you give up

When to prefer the IDE: visual work — UI components, diff-heavy refactors, anything where you want to scroll through a generated file before saving it.
When to prefer the CLI: long-running tasks, batch work, anything where you'll fire and forget.
12 — Desktop app

One window, every surface

The Codex desktop app is the cloud, the CLI, and the GitHub bot fused into a single native window. Think "ChatGPT desktop, but for code" — it's the surface most people end up living in once they're past the first week. macOS and Windows builds, signed and notarized, available from the OpenAI downloads page.

Install

  1. Go to the Codex page and click the Download button, or grab it from openai.com/codex.
  2. Open the .dmg (macOS) or run the .exe installer (Windows).
  3. Sign in with your ChatGPT account — same one as the CLI. Sessions are shared across surfaces.

It auto-updates in the background, so once it's installed you can mostly forget about it.

What you get

unified inbox

One queue for every task

Cloud tasks, local sessions, and GitHub mentions all land in the same sidebar. Sort by status, repo, or recency. Click in and you're picking up where you left off.

local + cloud, side by side

Switch surfaces mid-task

Start a session locally with full filesystem access. Hand it off to the cloud when you want to walk away. Open the resulting PR back in the desktop app for the final review. No context juggling.

native diff viewer

A diff UI built for review

Three-column layout — file tree, before/after, comment thread. Better than the embedded IDE viewer, better than GitHub's. Apply hunk-by-hunk, stage, or send back for changes.

global hotkey

Summon from anywhere

Default ⌘⇧K (macOS) / Ctrl⇧K (Windows) brings up a quick-prompt overlay from any app. Type a sentence, pick a repo, hit return — the task lands in the cloud, you keep doing what you were doing.

notifications

System tray & push

Native toast when a cloud task completes, when CI fails on a Codex PR, or when @codex is mentioned on a repo you watch. Configurable per-repo — silent for the noisy ones, loud for the ones you care about.

repo browser

Files, branches, runs

A lightweight repo explorer for the projects you've connected — open a file, scan recent runs, see which branch a cloud task forked from. Useful for orienting before you write the prompt.

How it relates to the CLI and IDE

SurfaceBest atFalls short on
CLI Tight terminal loops, scripting, CI, working over SSH on a remote box Visual diffs, juggling several tasks at once
IDE extension Edit-while-you-code workflow; selections, inline diffs in context Long async tasks; awareness of cloud work happening in parallel
Desktop app Coordinating local + cloud + GitHub from one place; passive monitoring; fan-out Pure terminal nerds will still prefer the CLI; in-editor flow lives in the IDE

Settings worth flipping on day one

The split that works: desktop for orchestration (what's running, what's done, what needs review), CLI for the tight loops where you want to watch every command, IDE for the moments when the change is small enough that switching apps would break flow. Three surfaces, one account, one AGENTS.md.
Heads up: the desktop app is the newest surface and ships behind a slightly slower cadence than the CLI. If a feature is in the CLI release notes but not in the app yet, give it a week or two.
13 — Codex Cloud

Delegation, in a browser tab

The cloud product at chatgpt.com/codex is the opposite of the CLI: instead of you driving Codex through every step, you describe a task, Codex spins up a container with your repo cloned into it, does the work, and opens a pull request. You watch from a dashboard.

Setup, once

  1. Go to chatgpt.com/codex and sign in with your ChatGPT account.
  2. Connect GitHub — grant the OpenAI Codex app access to the repos you want.
  3. For each repo: pick the default branch, the install command (npm i, pnpm i, etc.), and any environment variables it needs.

A task, end to end

  1. Describe the work. A sentence is fine. "Add a --quiet flag to the CLI that suppresses log output below WARN."
  2. Codex provisions a container. Clones the repo, runs the install command, runs AGENTS.md through the agent, starts work.
  3. You watch (or don't). The dashboard shows live logs, file diffs, test results. You can interrupt with a comment or let it run.
  4. It opens a PR. Branch name, title, description, the diff — pre-baked. You review like you would any other PR.
  5. You ask for changes inline. Comment on a hunk and Codex picks the task back up, pushing a follow-up commit.

The parallel trick

Cloud tasks each run in their own container — there's no contention. Queue up five at once for five different ideas. Two will land clean, two will need follow-ups, one will fail and you'll abandon it. That ratio is the whole point: you're paying for exploration, not for guaranteed outcomes.

What it can and can't reach

Available
✓ YesYour repo (read & write), package install, test runners, public network egress, an env file you provide.
✗ NoYour local machine, your other repos (unless connected), private VPN endpoints, your secrets (unless you supplied them as env vars).
Secrets in the cloud: env vars you paste in are encrypted at rest, but they exist somewhere outside your machine. If a key is sensitive (production DB, payment processor), use a scoped test credential — not the real one.
14 — On GitHub

Codex as a teammate

Install the Codex GitHub app on a repo and you can summon Codex in any issue, PR, or comment by mentioning @codex. It uses the cloud agent under the hood — same container model, same model family, same AGENTS.md — but the interface is GitHub.

Things you can ask in a comment

Automated review on every PR

Configure the app to auto-review PRs (per-repo setting). On each open or push, Codex posts a single review comment with: a summary, concerns, suggestions, and (if requested) a draft of the changes it would make. Treat it like a junior reviewer who reads every line — sometimes wrong, often useful, always fast.

The right pairing: human reviewers for judgment ("does this belong in this codebase?"), Codex for thoroughness ("did you handle the empty case on line 47?"). Used together, the two cover more ground than either alone.
15 — Mobile & Slack

Codex where you already are

Mobile (ChatGPT app)

The ChatGPT mobile app has a Codex tab. It's a thin client over the cloud: you can kick off tasks, watch progress, comment on diffs, and merge PRs from your phone. Best uses are reactive — a CI fails while you're at the coffee shop, you tell Codex to investigate, the PR is waiting when you're back.

Slack

The Codex Slack app adds a /codex command and an @Codex mention. From any channel:

Pairs well with team-facing repos where the same person who runs the engineering channel isn't always the one writing code.

16 — Configuration

Make it yours

Codex reads ~/.codex/config.toml on startup. Defaults are sensible; this is where you'd pin a model, set a default approval mode, define profiles, or wire up an MCP server.

~/.codex/config.toml
# default model and effort for every session
model = "gpt-5-codex"
effort = "medium"
approval_mode = "auto"

# where session logs go
history_dir = "~/.codex/sessions"

# notification when a task completes (script gets one arg: the event JSON)
notify = ["~/bin/codex-notify.sh"]

# profiles let you swap whole configs with --profile fast / --profile review
[profiles.fast]
model = "gpt-5-codex-mini"
effort = "low"

[profiles.review]
model = "gpt-5-codex"
approval_mode = "read-only"

# MCP servers — expose external tools to the agent
[mcp_servers.filesystem]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "/Users/me/notes"]

[mcp_servers.github]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-github"]
env = { GITHUB_PERSONAL_ACCESS_TOKEN = "ghp_..." }

Profiles

A profile is a named bundle of overrides. Pick one with codex --profile fast. Three patterns worth setting up:

MCP servers

Codex speaks the Model Context Protocol, so any MCP server you've already configured for Claude or another client works here too. Drop the server config into [mcp_servers.NAME] and the agent gets new tools at startup. Common ones: filesystem (extra paths), GitHub, Postgres, Slack, your own.

Notify hook

The notify setting runs a script every time a task completes. Use it to: play a sound, post to Slack, ring a Pushover. The script receives one argument — a JSON blob describing what happened.

Per-repo configs: drop a .codex/config.toml at the root of a repo and Codex merges it on top of your global config when you launch inside that tree. Use it to pin the model per project (e.g. mini for the docs repo, full for the app).
17 — Recipes

Workflows that actually pay off

A few patterns that move the needle past "I asked it to write a function." Each one starts with the surface that fits best.

The bug-fix loop (CLI)

  1. Paste the failing test or stack trace into the prompt.
  2. Ask Codex to find the cause, not just patch the symptom.
  3. End with "fix it, then run the test again."
  4. If the test passes, run /diff, eyeball, commit.
  5. If it doesn't, the agent loops on its own — give it 2-3 rounds before stepping in.

The exploration spike (Cloud, parallel)

  1. You have an open question — "could we move from Webpack to Vite?", "is there a clean way to add tenants to this schema?".
  2. In the cloud, kick off three tasks with three different framings.
  3. Walk away. Come back to three PRs.
  4. Read all three diffs. The right answer is often a Frankenstein of two of them.
  5. Close the losers. Iterate on the winner.

The pre-PR review (IDE or CLI, read-only)

  1. Stage your changes (git add -p).
  2. Switch Codex to --profile review.
  3. Ask: "review the staged diff. Flag bugs, missing edge cases, and anything that would surprise a reviewer."
  4. Decide which flags are real. Fix those. Push.

The dependency bump (Cloud)

  1. Open a cloud task: "upgrade React from 18 to 19. Resolve breaking changes. Make sure pnpm test and pnpm typecheck pass."
  2. Codex bumps, runs, fixes type errors, runs again.
  3. You get a PR with a working bump. Read the diff for surprises (renamed APIs you used heavily).

The "make it like X" port (CLI)

  1. Point Codex at the existing feature you like: "in src/api/orders.ts we have a paginated endpoint. Build the same shape for invoices."
  2. Codex reads the orders file, applies the same pattern, writes tests in the same style.
  3. Faster than starting from a blank file, more consistent than reading the orders file yourself.

The "what does this even do" read (IDE)

  1. Open an unfamiliar file. Highlight a function.
  2. Right-click → "Explain with Codex" (or paste into the side panel).
  3. Ask the follow-up that mattered: "what would break if I deleted the early return on line 32?"
18 — Codex vs. the field

How it stacks up

There's no objective ranking — they're all good, they're all moving. But there are real differences in shape, and picking the right tool per job beats picking the right tool overall.

ToolShapeStrongest atPairs best with
OpenAI Codex CLI + cloud + GitHub + IDE Delegated work, parallel cloud tasks, PR reviews Repos with a clean CI you trust
Claude Code CLI + IDE + cloud (Managed Agents) Long, careful sessions; complex reasoning; agent SDK See claude.wholetech.com
Cursor / Windsurf IDE-first Tab-completion, inline edits, "the editor that gets it" Solo work, design-heavy iteration
GitHub Copilot IDE + chat + agent mode Autocomplete, fluent IDE integration, line-by-line Anyone already paying for it
Devin / autonomous agents Hosted, fully async Tickets-to-PRs at scale Mature codebases with strong tests
The honest take: if you ship code for a living, install two of these and switch between them. Codex's cloud is best-in-class for parallel delegation. Claude Code's CLI is best-in-class for long, careful sessions. Cursor's editor is best-in-class for inline iteration. Pick the one that fits the task in front of you, not the one you swore allegiance to last year.
19 — Twelve tips

Things you'll learn the slow way

01

Write the AGENTS.md first

Before your second Codex session, write a one-page AGENTS.md. You'll feel the improvement instantly.

02

Default to medium effort

Don't crank to high unless you're actually waiting on a hard decision. Most tasks are medium-shaped.

03

Run /diff before every commit

It's two keystrokes and it'll save you from at least one accidentally-committed test change.

04

Don't be afraid to /undo

Codex undoes cleanly. If something doesn't smell right, revert and re-ask with one more sentence of context.

05

The cloud is for parallelism

If you'd run something locally and just wait, run two of them in the cloud instead. The whole pricing model assumes you will.

06

End prompts with verification

"…then run pnpm test". This single habit cuts your turn count roughly in half.

07

Use --profile for context switches

Reviewing? --profile review. Hacking? Default. Inside a container? --profile yolo.

08

Pin the dev server to a port

If Codex starts and kills a dev server constantly, set PORT=3000 in AGENTS.md or your shell. Saves churn.

09

Watch the tool calls

The event log shows every command Codex runs. Glance at it during long tasks — you'll learn what Codex thinks "search" or "test" means in your repo.

10

Resume sessions

codex resume brings back yesterday's chat. Pair with a daily journal commit and you have a real audit trail.

11

Trust, but verify

Codex sometimes claims it ran tests it didn't. Check the diff includes a real test-run output, not just an assertion.

12

Update weekly

The product moves fast. npm update -g @openai/codex on Mondays.

20 — Resources

Where to go next

This page changes. Codex ships often. If something here is wrong or stale, the network maintainer welcomes corrections — there's an email on wholetech.com.