Skip to content

Codex: Beginner

Beginner

Codex is OpenAI’s agentic coding agent. It runs in your terminal and your IDE, reads and edits files in your project, runs commands in a sandbox, and works through multi-step tasks, pausing for your approval along the way. It ships as a CLI, an IDE extension, and a cloud service that all share one backend. This guide gets you from install to a productive first task. For the bigger picture, see How AI coding tools work.

  • A terminal, or VS Code, Cursor, Windsurf, or a JetBrains IDE for the extension
  • Node.js (for the CLI install via npm), or Homebrew on macOS
  • A ChatGPT plan (Plus, Pro, Business, Edu, or Enterprise; Free and Go work at low limits) or an OpenAI API key
  1. Install the Codex CLI (or the IDE extension):

    Terminal window
    npm install -g @openai/codex
  2. Go to a project and start it:

    Terminal window
    cd my-project
    codex
  3. On first run, sign in with your ChatGPT account or paste an API key.

Talk to it in plain English. A few good first prompts:

What does this project do? Give me a short overview.
Find where the page title is set and change it to "Hello".

Codex explores the files, shows the edits it plans to make, runs any commands in a sandbox, and asks for approval before it changes anything.

Codex doesn’t edit files or run commands behind your back. Two controls decide how much freedom it has:

  • Approval mode: how often it stops to ask.
  • The sandbox: an OS-level boundary (macOS Seatbelt, a Linux sandbox, or the native Windows sandbox / WSL2) that limits what a command can touch.
Approval modeWhat it does
Auto (default)Edits inside the workspace and asks before anything riskier
Read-onlyLooks but doesn’t change files or run commands
Full AccessActs without stopping to ask

Switch mode at any time with /permissions.

CommandWhat it does
/initDraft a starter AGENTS.md so Codex knows your project
/permissionsSwitch approval mode mid-session
codex resumeContinue your previous session
  • ✅ You can start Codex in a project (CLI or IDE)
  • ✅ You’ve approved at least one file change
  • ✅ You know how to switch approval modes and resume a session

Ready for a real workflow: a steering file, the right context, and the window that limits it all?