Introduction to Codex

What is Codex?

Codex is OpenAI's AI coding agent—not just a code-completion model. In your local workspace it can:

  • Read codebases and documentation
  • Edit files and run commands
  • Verify results (tests, lint, builds)
  • Iterate until the task is done or needs your approval

Codex has evolved through two major shifts:

PhaseRepresentative productCharacteristics
2021–2023Codex API / early GitHub CopilotCode completion focus; model runs in the cloud
2025+Codex CLI (open source, Rust)Terminal agent with file I/O, Shell, and MCP
2025–2026Codex App / IDE / CloudUnified experience across surfaces; Cloud integrates with GitHub PRs

This tutorial centers on Codex CLI (comparable to Claude Code) and covers how App, IDE extensions, and Cloud fit together.


Product matrix: four surfaces, one agent stack

                    ┌─────────────────────────────────┐
                    │     OpenAI Codex (same stack)   │
                    └─────────────────────────────────┘
           ┌────────────┬────────────┬────────────┬────────────┐
           │  Codex CLI │  Codex App │ IDE ext.   │ Codex Cloud│
           │  Terminal  │ Desktop GUI│ VS Code…   │ Browser/PR │
           └────────────┴────────────┴────────────┴────────────┘
                    local workspace          remote env + GitHub

1. Codex CLI (tutorial focus)

  • Open source: github.com/openai/codex
  • Rust implementation: fast startup, low overhead
  • Interactive TUI, codex exec for non-interactive runs, sandbox and approval policies
  • Best for: daily development, script automation, CI assistance

2. Codex App

  • macOS / Windows desktop app
  • Pick a project folder; runs locally in Local mode
  • Best for: developers who prefer a GUI and visual diffs

3. IDE extensions

  • VS Code, Cursor, Windsurf, and others
  • Sidebar agent mode with read/write and run permissions by default (configurable)
  • Best for: inline edits while coding

4. Codex Cloud

  • Visit chatgpt.com/codex
  • Connect GitHub repos; tasks run in cloud environments and produce PRs
  • @codex in GitHub PR comments delegates work
  • Best for: async long tasks and cross-timezone collaboration

Core capabilities

Code understanding and generation

  • Generate or modify code from natural language
  • Cross-file refactors, tests, and documentation
  • Image input (screenshots, designs) and image generation/editing (CLI capabilities)

Agent toolchain

Codex works through built-in tools and extension protocols:

  • File read/write and patch application
  • Shell commands (within sandbox policy)
  • Code search (glob, grep, etc.)
  • Web search (cached / live modes)
  • MCP: connect Linear, GitHub, docs services, and other external systems

Customization stack

OpenAI splits “make the agent work like our team” into five layers that complement each other:

LayerRoleTypical location
AGENTS.mdPersistent project rules (build, test, style)Repo root / subdirectories
MemoriesContext learned from past tasksInside Codex
SkillsReusable workflows (SKILL.md + scripts)~/.agents/skills or .agents/skills
MCPExternal tools and dataconfig.toml[mcp_servers]
SubagentsFocused sub-agents (review, explore, etc.)Config + prompts

Understanding these five layers is the step from “using Codex” to “using it well.” Later chapters cover each layer.


Good fit vs. caution

Good fit:

  • Feature work, bug fixes, and tests in familiar repos
  • Bulk refactors, migrations, and doc sync
  • Local code review (dedicated review agent)
  • Turning repeat flows into Skills or codex exec scripts

Use caution:

  • Production secrets or unisolated sensitive environments (always use sandbox + approvals)
  • Repos with no tests or lint (“bare” repos where the agent may loop on mistakes)
  • Fully unattended auto-merge (prefer PR + human review)

Comparison with other tools (brief)

DimensionCodexClaude CodeGitHub Copilot
SurfacesCLI + App + IDE + CloudCLI / IDE focusedIDE completion + agent mode
Open-source CLI✅ Rust
Project instructionsAGENTS.md (open standard)CLAUDE.md / rulesProduct-specific
SkillsSKILL.md (cross-tool open standard)Agent SkillsExtensions
MCP✅ TOML config✅ JSON configGrowing support
SandboxOS-level + configurable policyPermissions / sandboxDepends on IDE integration

Choosing: If you already have ChatGPT Plus/Pro and want local agent + Cloud PRs + open AGENTS.md, Codex is a full stack. Deep Anthropic usage favors Claude Code; IDE-only completion favors Copilot.


Billing and accounts

  • ChatGPT Plus / Pro / Business / Edu / Enterprise plans typically include Codex usage
  • OpenAI API key login is also supported (some features may be limited)
  • CLI ChatGPT login can configure the API key automatically

See OpenAI Codex docs for current quotas.


Next steps