Codex · by OpenAI · About 90 min
Codex, properly understood
Codex is OpenAI’s agent for working on files: point it at a folder, describe what you want, and it reads, writes and changes files there, then shows you exactly what it changed. This guide gets you started, then explains the ideas behind it, from AGENTS.md to skills, subagents and the context window.
Before you start
A ChatGPT account and the ChatGPT desktop app (Mac, Windows, or Linux in preview).
- Free and Go: Codex in the desktop app with the lightest model (GPT-6 Luna).
- Plus and above: also the web, phone, terminal and code editors, plus higher limits and the larger models.
No coding knowledge is needed.
Chapter 1 of 3
Get started
Pick the right mode of ChatGPT for the job, open Codex on a safe folder, and review what it changes.
Step 1 of 16
Chat, Work or Codex?
ChatGPT has three modes, and they share one engine:
- Chat is ordinary back-and-forth: questions, ideas, drafts.
- Work carries a bigger task through to a finished result, like a report, a slide deck or an analysis, and keeps the technical detail out of sight.
- Codex is the same capable agent, but it shows you its workbench: the files it changes, the commands it runs, and every edit line by line.
Work and Codex share a usage allowance. Pick by how much you want to see:
- Work when you want the finished document.
- Codex when you are building or changing something made of files and want to check each change.
Think of it like…
Chat is phoning a knowledgeable friend. Work is hiring an assistant to hand you a finished report. Codex is the same assistant, but you sit beside them at their workbench.
You’re done with this step when
You can say which mode you would use to: ask a question, get a finished slide deck, and build a small website.
Step 2 of 16
Open Codex in the ChatGPT app
- Download the ChatGPT desktop app from OpenAI if you do not have it, and sign in.
- Open the ChatGPT dropdown at the top and choose Codex.
- Click New chat.
You’re done with this step when
You are looking at a new Codex chat in the desktop app.
For the curious
Codex also comes as a terminal tool. On Mac or Linux:
curl -fsSL https://chatgpt.com/codex/install.sh | shThen type
codexin a folder and choose Sign in with ChatGPT.There is an extension for VS Code, Cursor and Windsurf, and Codex Cloud (Plus and above) runs tasks on OpenAI's servers against GitHub projects.
Step 3 of 16
Give it a practice folder
Codex reads and changes files only inside the folder you choose, so start with a safe one.
- Make an empty folder on your Desktop called
codex-practice. - In Codex, open that folder.
- Under Work in, keep This computer and Local.
If Codex offers to set up Git (a built-in history of changes), say yes. It is what lets you review and undo.
You’re done with this step when
Codex is open on your codex-practice folder, working locally.
- Make an empty folder on your Desktop called
Step 4 of 16
Make something, then review it
Ask for something you can see. When Codex finishes, open the review pane:
- It shows exactly what changed, line by line.
- Keep what you like, and revert what you do not: for one file, one part, or everything.
- Last turn shows only what Codex just did.
Then double-click the new file in your folder to open it in your browser.
Try this
Create a simple one-page website (index.html) for a bakery: its name, opening hours, a small menu table and a contact section. Make it look good on a phone.
You’re done with this step when
You opened the review pane, looked at the change, and opened the page in your browser.
Questions people ask
What's the difference between Work and Codex?
They are the same agent with the same shared allowance. Work keeps the technical detail out of sight and hands you a finished result, like a deck, a report or an analysis. Codex shows its workbench: the files it changes, the commands it runs and every edit. Choose Codex when you want to see and approve each change.
What's the difference between Codex and Claude Code?
They are similar ideas from different companies. Both are agents that work on files in a folder you choose, and both ask before acting. Codex is OpenAI's, inside ChatGPT, and reads AGENTS.md for its standing rules. Claude Code is Anthropic's, and reads CLAUDE.md, though it falls back to AGENTS.md if a project has no CLAUDE.md.
Can I use Codex on the free plan?
Yes, in the ChatGPT desktop app, with the most efficient model (GPT-6 Luna), as it rolls out. Plus and above add the web, phone, terminal and code editors, larger models and higher limits.
Why does it want Git?
Git keeps a history of changes. The review pane uses it to show exactly what Codex changed and to let you undo it. Without Git, you lose that safety net.
Chapter 2 of 3
How it actually works
The ideas people use every day without knowing their names. Once these click, Codex stops feeling unpredictable.
Step 5 of 16
The context window: what Codex can see right now
Codex works only with what is in its context window: the maximum amount it can consider at once. That includes:
- your messages
- its standing instructions
- every file it reads
- the output of every command
- descriptions of the tools and skills it has
Context is counted in tokens, chunks of text of roughly three-quarters of a word. The current models can hold about a million, but a long task that reads big folders still fills it.
This is why Codex can lose track of something from early in a long chat.
Think of it like…
A whiteboard. Everything it is thinking about must be written there, and when it is full, something gets wiped or summarised.
You’re done with this step when
You can explain why a very long chat might lose details from its start.
For the curious
In the terminal,
/statusshows how much context is left, alongside your rate limits.The docs' guidance is to keep one chat per piece of work and to push noisy exploration into subagents, avoiding what they call "context rot".
Step 6 of 16
When it fills up: compaction and fresh starts
As the window nears its limit, Codex compacts: it summarises the older part of the conversation so work can continue. A summary keeps the gist but loses detail.
Your controls:
- /compact summarises now, before a big next step.
- /new starts a fresh chat.
The habit that saves most frustration: one task per chat. Finished the website? Start a new chat for the spreadsheet.
Think of it like…
Photographing a full whiteboard, writing a summary in the corner, and wiping the rest.
Try this
/compact
You’re done with this step when
You know when you would compact and when you would start a new chat.
Step 7 of 16
History: resume, fork and archive
Every chat is saved, so you can come back to it.
- Resume reopens an old chat with its full context.
- Fork makes a copy, so you can try a different approach without losing the original.
- Archive tidies away finished work.
In the app you can rename, pin and search your chats.
Think of it like…
Resume is reopening a saved document. Fork is "Save As" a copy before experimenting.
Try this
/fork
You’re done with this step when
You know how to get back to an old chat, and how to try an idea without losing the original.
For the curious
In the terminal:
codex resumeopens a picker, andcodex resume --lastreopens your newest chat./fork, or Esc twice on an empty message box, forks from an earlier message./archivehides a chat./deleteremoves it permanently.
Step 8 of 16
AGENTS.md: the rules it reads before any work
Each chat starts fresh, so anything Codex should always know belongs in a plain text file called AGENTS.md. Codex reads it before doing any work in that folder.
Good things to put in it:
- what the project is
- how to check the work
- your preferences
- things it must never do, like "ask before deleting files"
Keep it short and accurate. OpenAI's own advice: a short, accurate AGENTS.md beats a long one.
The easiest start is /init, which writes a draft for you to edit.
Think of it like…
Company handbook, then department handbook, then the sticky note on your own desk. The most local one wins.
Try this
/init
You’re done with this step when
Your practice folder has an AGENTS.md, and you added one rule of your own to it.
For the curious
Files layer from general to specific:
~/.codex/AGENTS.mdapplies everywhere.- The project's own file comes next.
- A file in a subfolder adds to it, and the closest file wins.
An
AGENTS.override.mdreplaces the normal file at its level. The combined size defaults to 32 KiB. Codex re-reads the files each session, so restart to pick up changes.Claude Code also reads AGENTS.md when a project has no CLAUDE.md.
Step 9 of 16
Memory: helpful recall, not rules
ChatGPT can remember things about you across chats, and Codex on your computer has its own separate memory, which is off until you turn it on in Settings.
OpenAI is clear about the difference:
- Memory is a helpful recall layer. Use it for preferences Codex picks up as you work.
- AGENTS.md is where rules that must always apply belong.
A ChatGPT project is different again: a folder of related chats, files and instructions. It does not give access to a folder on your computer.
Think of it like…
AGENTS.md is the laminated rules sheet on the workbench. Memory is a colleague's recollection: usually right, not to be relied on for the rules.
You’re done with this step when
You can say which belongs in AGENTS.md and which you would leave to memory.
Step 10 of 16
Sandbox and approvals: what it may touch
Two controls work together:
- The sandbox decides what Codex can technically reach.
- Approvals decide when it must stop and ask before going further.
Internet access is off by default. The modes:
- Ask for approval (recommended) works inside your folder and asks before going beyond it.
- Approve for me passes those requests to an automatic reviewer instead of you.
- Full access has no limits: your whole computer and the internet. Avoid it.
Think of it like…
The sandbox is a fenced yard. Approvals are the gate, where it rings the bell.
Try this
/permissions
You’re done with this step when
Your permissions are set to Ask for approval, and you know what each mode allows.
For the curious
In config these are:
sandbox_mode:read-only,workspace-writeordanger-full-accessapproval_policy:on-requestornever
Codex enforces the sandbox with the operating system's own isolation. Experimental rules in
~/.codex/rules/can allow, prompt for or forbid specific commands, and the strictest rule wins.
Questions people ask
Is the context window the same as memory?
No. The context window is what Codex can see right now in this chat. Memory carries things into future chats. OpenAI calls it a helpful "recall layer", and AGENTS.md is where rules that must always apply belong.
What's the difference between AGENTS.md and a prompt?
A prompt is for this task. AGENTS.md is read before any work in that folder, every time. Anything you keep repeating belongs in AGENTS.md.
What's the difference between AGENTS.md and a ChatGPT project's instructions?
A ChatGPT project groups chats, uploaded files and instructions inside ChatGPT, and does not reach a folder on your computer. AGENTS.md lives in your folder and guides Codex when it works there.
What's the difference between resume and fork?
Resume continues an old chat as it was. Fork makes a copy from a point in the chat, so you can try a different approach and still have the original.
What's the difference between /compact and /new?
/compact keeps the same chat but summarises the older part to free up room. /new starts a fresh chat. Compact mid-task, and start new between tasks.
What's the difference between "Approve for me" and "Full access"?
Approve for me keeps the same fences as "Ask for approval", but an automatic reviewer answers the requests instead of you. Full access removes the fences altogether: your whole computer and the internet. They are very different levels of risk.
Chapter 3 of 3
Make it yours
The features that turn Codex into your own system: reusable know-how, parallel helpers, connections to your other tools, and a second pair of eyes.
Step 11 of 16
Plan first, and set a goal
For anything bigger than one file, do not let it dive in.
- /plan switches to plan mode: Codex looks around, asks questions and proposes steps before touching anything.
- /goal sets the outcome and what "done" means, so a long task keeps working towards it.
Try this
/plan I want to add a contact form to the bakery page. Propose the steps and wait for my OK.
You’re done with this step when
Codex showed you a plan and waited for your go-ahead.
Step 12 of 16
Skills: teach it a job once
A skill is a folder with a
SKILL.mdfile: written instructions for one job, such as "how we write the weekly status update".Codex sees only each skill's name and short description until a task matches, then loads the full instructions. So skills cost almost nothing until they are needed.
- Call a skill by name with
$, like$weekly-status. - Or let Codex pick it when your request fits.
- Codex comes with
$skill-creatorto help you write new ones.
Think of it like…
A recipe box. You read the labels and only pull out the full card when you are cooking that dish.
Try this
$skill-creator Make a skill called weekly-status that turns my rough notes into: done, next, blocked.
You’re done with this step when
You made a skill and used it by name.
For the curious
Skills live in
.agents/skillsinside a project, or~/.agents/skillsfor you personally. OpenAI also ships some built in.Write the description with the main use and trigger words first. Skills are shared as plugins.
- Call a skill by name with
Step 13 of 16
Subagents and worktrees: helpers in parallel
A subagent is a helper agent Codex sends off with one job. It works with its own context and reports back a summary, so your main chat stays clean.
You can ask for several at once. In Codex on your computer, they start only when you, your AGENTS.md or a skill asks for them.
To stop parallel helpers tripping over each other, Codex can work in a worktree: a separate copy of your project, so each one edits its own files.
Think of it like…
A project lead sending three researchers out with their own copies of the files, then reading their one-page reports.
Try this
Review this folder with parallel subagents: one for spelling and tone, one for broken links, one for layout on phones. Summarise by category.
You’re done with this step when
You can explain why a subagent keeps your main chat clean.
For the curious
Built-in agent types are
default,workerandexplorer. Custom agents are TOML files in.codex/agents/, and/agentswitches between agent threads.Subagents use more of your allowance than a single agent.
Step 14 of 16
Apps, plugins and MCP: plugging into your tools
On its own, Codex sees your folder. Apps (connectors) and MCP let it reach other tools, such as your docs, issue tracker or design files.
MCP, the Model Context Protocol, is an open standard for plugging tools into AI agents. Plugins are installable bundles of skills, MCP connections and more, and ChatGPT and Codex share one plugin directory.
Connect only what a task needs. A connection acts with your access.
Think of it like…
MCP is a universal power socket. A plugin is an appliance that arrives with its own plug and instruction booklet.
You’re done with this step when
You can explain what MCP is for, and where you would add a connection.
For the curious
In the terminal:
codex mcp add <name> -- <command>adds a server./mcplists your servers./appsinserts an app.
Servers are set in
~/.codex/config.toml. You can limit which of a server's tools are allowed and when they need approval.Step 15 of 16
Models, effort and review
Models, switched with /model:
- GPT-6 Astra is the most capable.
- GPT-6.1 Sol is the recommended everyday default.
- GPT-6 Luna is the most efficient, and the one on the free plans.
Reasoning effort is how long it thinks before answering. More effort helps on hard problems but is slower and uses more of your allowance.
/review starts a separate reviewer that reports problems without changing your files. It is a second pair of eyes before you keep anything.
Think of it like…
Effort is how long a consultant mulls before replying, and you pay for the mulling time.
Try this
/review
You’re done with this step when
You know which model you are using, and you ran a review on your changes.
For the curious
Usage is shared with Work and resets every five hours, with weekly limits too. On Plus, Luna allows far more messages than Astra.
/statusand/usageshow where you stand.On GitHub, commenting
@codex reviewon a pull request asks Codex for a review.Step 16 of 16
Put it together on a real job
Pick one small, real task: clean up a messy spreadsheet export, write a plain-English guide to a project a colleague left you, or explain a folder of files.
Use what you learned:
- Work on a copy.
- Add an AGENTS.md with your rules.
- Plan first.
- Review every change.
- Start a new chat when you move on.
Try this
Clean this CSV: remove duplicate rows, fix the date formats and trim extra spaces. Save a cleaned copy and do not change the original.
You’re done with this step when
Codex finished a job you needed, and you reviewed the result before keeping it.
Questions people ask
What's the difference between a skill and a prompt?
A prompt is a one-off message. A skill is a saved, named set of instructions, with optional example files and scripts. Codex loads it when a task matches, or when you call it with $name. Make a skill when you keep explaining the same procedure.
What's the difference between a skill and AGENTS.md?
AGENTS.md is read before every piece of work. A skill is loaded only when relevant: Codex sees just its name and description until then. Rules that always apply go in AGENTS.md; occasional procedures go in skills.
What's the difference between a subagent and a worktree?
A subagent is a helper agent with its own context, which reports back a summary. A worktree is a separate copy of your project's files, so parallel helpers don't edit the same files at once. They are often used together.
What's the difference between MCP, apps and plugins?
MCP is the open standard for plugging tools into AI agents. An app is a ready-made connector you can insert into a chat. A plugin is an installable bundle that can include skills, MCP connections and more. ChatGPT and Codex share one plugin directory.
What's the difference between the model and the reasoning effort?
The model is which engine does the work: Astra, Sol or Luna. Effort is how long that engine thinks before answering. Both affect quality, speed and how fast you use your allowance.
Does /review change my files?
No. It starts a separate reviewer that reports problems, ranked by importance, and leaves your files alone. You decide what to fix.
Worth knowing
- Codex usage is shared with ChatGPT Work and has limits that reset. Larger models and subagents use it faster.
- Never paste passwords or API keys into a prompt or a project file.
- Cloud tasks run on OpenAI’s servers and cannot see your local files or the sites you are logged in to.
Where this comes from
- Using ChatGPT: Chat, Work and Codex
- Codex quickstart
- Pricing and plans
- AGENTS.md
- Memories
- Glossary (context window)
- Slash commands
- Permission modes
- Skills
- Subagents
- MCP
- Models
- Code review
Checked against the sources on 2026-10-08. These tools change quickly.