How to Get Started with OpenAI Codex (and How I use it)
Don't want to figure this out alone? I walk members through every step inside the community. Join the Skool → skool.com/raycfu

Codex is OpenAI's coding agent. Not autocomplete. Not a chatbot that answers coding questions. It is an autonomous agent that reads your codebase, writes code, runs tests, fixes bugs, creates pull requests, and iterates on feedback. It works in the background while you do other things. Codex just hit 3 million weekly users, a 5x increase in three months with 70% month-over-month growth.
You can use it in four places and they all share your account, settings, and history:
The Codex desktop app (Mac and Windows). A dedicated command center for managing multiple agents across projects.
The Codex CLI. A terminal tool that runs locally on your machine.
The Codex IDE extension. Works inside VS Code, Cursor, and Windsurf.
Codex Web. The cloud version at chatgpt.com/codex that works on any device with a browser.
THE PLANS
There are now two Pro tiers. Both share the same core capabilities. The only difference is usage allowance.
ChatGPT Plus ($20/month): Includes Codex. Good for steady day-to-day usage. You will hit limits if you use it heavily.
ChatGPT Pro $100 ($100/month): 5x more Codex usage than Plus. Access to all Pro features including the Pro model and unlimited Instant and Thinking models. Best for longer, high-effort Codex sessions. Through May 31, you get 10x Codex usage of Plus as a launch promotion.
ChatGPT Pro $200 ($200/month): 20x more Codex usage than Plus. Same features as Pro $100 but with significantly higher usage allowance. For continuous demanding workflows across multiple parallel projects.
SETTING UP THE DESKTOP APP

STEP 1: DOWNLOAD
On Mac: Go to openai.com/codex and download the macOS app. Requires Apple Silicon (M1 or later).
On Windows: Download from the Microsoft Store. Search "Codex" or go to apps.microsoft.com. Runs natively in PowerShell with a Windows sandbox.
STEP 2: SIGN IN
Open the app and sign in with your ChatGPT account. You can also use an OpenAI API key but some features like cloud threads may not be available.
STEP 3: ADD A PROJECT
Click "Add new project" and choose the folder of your codebase. Codex will have access to files in that directory and its subdirectories. Past projects from CLI or IDE use show up automatically.
STEP 4: START A THREAD
Click "New thread" and choose between:
Local: Works directly in your project folder. Changes happen on your machine in real time.
Worktree: Creates an isolated copy of your repo on a separate Git branch. Changes stay isolated until you merge. Use this when you want multiple agents working on the same repo without conflicts. This is the feature that unlocks real parallelism. One thread builds a feature, another writes tests, a third refactors. None of them touch the same files.
STEP 5: SEND A TASK
Type what you want and hit send. But before you do, read the prompting section below. How you describe the task changes everything about what you get back.
SETTING UP THE CLI
npm i -g @openai/codex
Or on Mac:
brew install --cask codex
Then run:
codex
Sign in when prompted. Navigate to any project folder and start giving it tasks. If you have a ChatGPT Plus, Pro, or Business plan, the CLI is included at no extra cost when using ChatGPT authentication.
For full automation in CI/CD environments:
codex --full-auto "Run tests and fix failures"
Launch the desktop app from the CLI with:
codex app
Three safety modes for the CLI:
Read Only (-s read-only): For audits and code review. Codex can look but not touch. Auto (default): For daily development. Approves reads and edits, asks before running commands. Full Auto (--full-auto): For automation. Codex does everything without asking. Use in isolated environments only.
THE AGENTS.MD FILE
Create a file called AGENTS.md in the root of your project. This tells Codex how to navigate your codebase, which commands to run for testing, and what conventions to follow. Codex reads this before every task. Think of it as a README written for the agent instead of for humans.
Quick start: Run /init in the CLI. It scaffolds a starter AGENTS.md based on your actual project structure. Edit from there instead of writing from scratch.
Example:
AGENTS.md
Code Style
- Use Black for Python formatting
- All functions need docstrings
Testing
- Run pytest tests/ before finalizing a PR
- All commits must pass lint checks via flake8
PR Instructions
- Title format: [Fix] Short description
- Include a one-line summary and Testing Done section
Project Structure
- Backend in /src/api/
- Frontend in /src/web/
- Migrations in /migrations/
You can nest AGENTS.md files at different levels. Put a global one at ~/.codex for personal defaults that apply everywhere. A repo-level one for shared team standards. And subdirectory-level ones for specific areas like frontend vs backend. The most specific file always wins. This means your frontend folder can have completely different rules than your backend.
Keep it short. A tight, accurate AGENTS.md beats a long vague one every time. Start with just your test commands, code style, and project structure. Add new rules only after you notice Codex making the same mistake twice. A bloated file wastes tokens on every single task.
HOW TO PROMPT CODEX LIKE A POWER USER
This is the section that separates people who get mediocre results from people who ship 70% faster. Most of these come from OpenAI's own internal workflows.
INCLUDE FOUR THINGS IN EVERY PROMPT
Context: Which files, folders, docs, or errors matter for this task. You can @ mention specific files. Goal: What you actually want done. Constraints: What standards or conventions Codex should follow. Done when: What should be true before the task is complete. Tests passing, a behavior changing, a bug no longer reproducing.
This last one matters more than it looks. Codex can run the full verification loop for you, but only if it knows what "done" looks like.
USE PLAN MODE FOR COMPLEX TASKS
Before any complex task, hit /plan or Shift+Tab. This makes Codex gather context, ask clarifying questions, and build a structured plan before it writes any code. Most people skip straight to implementation and get worse results. Plan mode exists specifically for ambiguous or multi-step work.
For really complex projects, use the Plans.md technique. Tell Codex to create a Plans.md file with milestones before it starts building. OpenAI's own team used this approach to build the entire Sora Android app in 28 days. The plan acts as a contract so the agent does not drift mid-task.
ASK CODEX TO INTERVIEW YOU
If you have a rough idea but cannot describe it well, do not struggle with the perfect prompt. Instead tell Codex: "Challenge my assumptions and turn this fuzzy idea into a concrete spec before writing any code." Let it ask you questions. This consistently produces better results than trying to write a detailed prompt yourself.
USE SPEECH INSTEAD OF TYPING
Hold Ctrl+M in the desktop app and talk. Codex transcribes and starts working. This is not a gimmick. Describing a complex task out loud is faster than typing and often produces better prompts because you naturally include more context when you are speaking. Especially useful for describing visual bugs while looking at the screen.
ATTACH SCREENSHOTS FOR FRONTEND WORK
Codex accepts images alongside text. A screenshot of a design mockup or a visual bug gives it far more to work from than a text description alone. Most people do not realize Codex is multi-modal. Drop in a Figma screenshot and say "build this" and it will.
POP OUT THREADS FOR FRONTEND ITERATION
You can detach any active thread into its own floating window. Put it next to your browser preview and iterate on UI changes without switching back and forth. This alone changes the frontend development experience.
THE TEST-FIRST PATTERN (THIS IS THE BIG ONE)
This is the single most effective workflow pattern for Codex and it comes directly from how OpenAI uses it internally.
Step 1: Write your tests first. Define exactly what the code should do. Step 2: Confirm all tests fail. This proves they are actually testing something. Step 3: Commit the failing tests as a checkpoint. Step 4: Tell Codex to implement until all tests pass, with an explicit instruction to never modify the tests themselves. Step 5: Run the verification loop yourself before accepting the work.
Why this works: Without tests, Codex verifies its own work using its own judgment. Tests create an external source of truth that stays accurate no matter how long the session runs. Each red-to-green cycle gives Codex unambiguous feedback it can act on without guessing.
At OpenAI, Codex reviews 100% of pull requests. The teams that get the most value from it are the ones whose tests are good enough to make the review meaningful.
WHEN THINGS GO WRONG
Sessions go sideways. It happens. Here is what OpenAI's own team does:
Do not fight a degraded thread. If Codex starts producing bad output after a long conversation, do not try to correct it in the same thread. Save your current state to a file, start a fresh thread with cleaner context, and try again. Forking a session costs far less in tokens and frustration than wrestling with a context window that has lost coherence.
Always run verification before accepting output. Codex can produce confident output that is subtly wrong, especially in frameworks it has less training data on. Tests, linters, and type checkers are not optional. Run them before accepting the work.
Check your reasoning level. Use "medium" for everyday tasks. Reserve "high" and "xhigh" for genuinely hard problems. Most people leave it on the highest setting and burn through credits for no reason. Medium is faster, cheaper, and good enough for 80% of work.
FEATURES MOST PEOPLE DO NOT KNOW ABOUT
PARALLEL AGENTS WITH WORKTREES
Run multiple threads at the same time, each on a different task in its own isolated branch. This is the feature that turns Codex from an assistant into a team. One agent builds a feature, another writes tests, a third refactors old code. When they finish, you review the diffs and merge what you want.
AUTOMATIONS
Set up tasks that run on a schedule without you prompting them. Auto-triage GitHub issues, monitor error logs and submit fixes, review every PR, generate weekly codebase reports. Configure in the Automations section of the app. Codex adds findings to your inbox or archives the run if nothing needs attention. These run even when your computer is closed via cloud-based triggers.
SKILLS
Reusable bundles that extend Codex beyond code. Image generation, web game development, documentation in your exact format. Browse and install in the Skills section. OpenAI demoed a full 3D racing game with eight maps built entirely by Codex using skills and over 7 million tokens. You can pair skills with automations to handle recurring tasks automatically.
AUTO CODE REVIEW
Connect your GitHub repo. Codex reviews every PR before merge. It only flags issues it is highly confident about. The Codex product lead said they built it this way because "human attention is scarce" and they want to protect it. The hit rate is extremely high. Tag @Codex on a specific PR or enable auto-review repo-wide.
MCP SUPPORT
Connect Codex to external services using MCP servers. Same configuration works across app, CLI, and IDE extension. Codex can also be used as an MCP server itself, meaning other agents and tools can invoke it as part of a larger workflow or CI/CD pipeline. This is how you wire Codex into an existing automation stack.
CODEX IN CI/CD
You can run Codex as a step in your GitHub Actions workflow:
.github/workflows/codex.yml
- name: Run Codex run: | npm i -g @openai/codex codex exec --full-auto "Update CHANGELOG" env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
Automatic changelog updates, test runs, dependency checks, whatever you want on every push.
TIPS TO SAVE ON TOKENS
Write a tight AGENTS.md. This loads on every task. Smaller file means fewer tokens burned on context. Only include what Codex actually needs to know.
Use "medium" reasoning for routine work. Save "high" and "xhigh" for complex multi-file tasks. The difference in credit consumption is significant.
Switch to GPT-5.4-mini for simple tasks. Quick edits, small fixes, and formatting do not need the top model.
Use worktrees for parallel work. Each agent only loads context for its specific branch. Less overlap, fewer tokens.
Break large tasks into focused pieces. "Refactor the auth module" burns way less than "refactor everything." Smaller scope means less context per task.
Structure related tasks in the same session. Cached input tokens are charged at a lower rate under the new pricing. Reusing context is cheaper than starting fresh every time.
Control prompt size. Be precise with instructions but remove unnecessary context. If you are working on a large project, nest your AGENTS.md files so each directory only loads the context relevant to that area.
15 THINGS TO BUILD
CODING AND DEVELOPMENT
- Automated PR reviewer. Connects to GitHub. Reviews every pull request. Catches bugs and backward compatibility issues your team would miss.
- Bug fix pipeline. Paste a bug report. Codex finds the code, writes the fix, runs tests, opens a PR. Sentry built exactly this.
- Test suite generator. Points at your source code, identifies untested functions, writes comprehensive tests, runs them, iterates until they pass.
- Legacy code migrator. Reads old code in one language, refactors to a modern one while preserving business logic. Nubank migrated 6 million lines this way.
- Documentation generator. Scans your codebase and writes up-to-date docs with examples. Set as a weekly automation so docs never go stale.
APPS AND PRODUCTS
- Full web app from a prompt. Describe what you want. Codex builds it end to end. OpenAI demoed a full 3D racing game with item mechanics and eight maps.
- Chrome extension. Describe the functionality. Codex builds manifest, scripts, popup, and background workers.
- API and backend. Describe your data model and endpoints. Codex builds routes, schema, auth, and tests.
- CLI tool. Describe what it does. Codex builds it with argument parsing, error handling, and help text. Publish to npm or PyPI.
- Slack or Discord bot. Describe the behavior. Codex handles auth, commands, and integration.
AUTOMATION AND WORKFLOWS
- Error monitor and auto-fixer. Watches logs, reads stack traces, writes fixes, opens PRs. Set as an automation that runs without you being online.
- Issue triage bot. Reads new GitHub issues, labels by type and priority, assigns to the right person, posts a summary.
- Weekly codebase reports. Analyzes recent commits, summarizes changes, identifies areas with increasing complexity.
- CI/CD integration. Runs as a step in your pipeline. Validates changes and flags issues before deployment.
- Dependency updater. Checks for outdated packages, updates them, runs tests, opens a PR if everything passes.
TROUBLESHOOTING
Hitting rate limits on Plus: Buy additional credits in Codex Settings under Usage, or upgrade to Pro $100. The 5x increase (10x through May 31) is a massive jump.
Codex is slow: Check which model and reasoning level you are using. Drop to medium reasoning for routine work. Also check if your AGENTS.md is too large.
Session going in circles: Do not fight it. Save state, start a fresh thread with clean context. This is what OpenAI's own engineers do.
Changes not showing: If using worktree mode, changes are on a separate branch. Check it out or merge to see them in your working directory.
Sandbox errors: Make sure sandbox permissions are set to Default in the Composer. Adjust approval policy if Codex needs access outside your project directory.
CLI approval prompts won't stop: Check /status in the TUI. A reconnect can reset your approval_policy. Restart with your profile and re-apply settings.
Network access denied in CLI: The sandbox blocks network by default. Enable it with: codex -c 'sandbox_workspace_write.network_access=true' "your task"
CLI not found: Make sure the install location is in your PATH.
You just read the full playbook. Most people will close this tab and never implement it. The ones who do usually hit a wall around the technical setup and quit.
Inside the Skool, I walk you through the exact build step-by-step, troubleshoot your setup live in the community, and share the scripts and templates I use to actually land paying clients.
If you want the shortcut instead of the long way around:
