All guides

Claude Code vs Codex: which coding agent is more capable in Oct 2026?

Where Claude Code and Codex differ on safety, extensibility and automation, plus a script to test both on your own repo.

By Roman · · 4 min read

claude, openai

Coding-agent leaderboards flip every few months. Most of what makes Claude Code or Codex “more capable” on a given day is the model behind it, and Anthropic and OpenAI ship new ones several times a year. The parts that last are the harness: how each tool sandboxes commands, takes project instructions, runs in CI and lets you extend it.

TL;DR

  • Neither is categorically more capable. Raw coding quality tracks the current model, so measure it on your own tasks with the script below before you standardize.
  • Pick Claude Code if your team prefers Claude models and finds them more capable in technical tasks.
  • Pick Codex if you need local or non-OpenAI models, a sandbox on native Windows, or an open-source CLI you can audit.
  • Keep project instructions in AGENTS.md; both tools read it.

What both agents share, and where they differ

Both are terminal-first agents that read your repo, edit files, run commands and loop until tests pass. Each also ships IDE and web versions and supports MCP (Model Context Protocol) for external tools. The comparison covers the CLI agents as of October 2026 on models, command safety, project instructions, extensibility, headless and cloud runs, source and billing.

Claude Code and Codex, feature by feature

Criterion Claude Code Codex
Models Claude models only (switch with /model) OpenAI models, plus local or third-party ones through model_providers (Ollama, LM Studio, Bedrock)
Command safety Per-tool allow/deny rules; OS sandbox (Seatbelt, bubblewrap) once you turn it on with /sandbox; none on native Windows OS sandbox on by default (Seatbelt, bubblewrap, native Windows) plus approval policy
Project instructions CLAUDE.md with @file imports, or AGENTS.md AGENTS.md (open format shared by many tools)
Extensibility Hooks, subagents, skills, plugins, MCP Hooks, subagents, skills, plugins, MCP
Headless mode claude -p, JSON output, Agent SDK codex exec, JSONL events with --json
Async cloud runs Claude Code on the web Codex cloud tasks
Source Closed CLI is open source (Apache-2.0)
Billing Claude subscription or API key ChatGPT plan or API key

Measure capability on your own repo

Public benchmarks like SWE-bench Verified and Terminal-Bench are useful for spotting a big jump, but they test other people’s repos, not your build. An eval on 10–20 real tickets, each with a test that proves the fix, tells you more. Run each agent in its own git worktree so they can’t see each other’s changes, then let your tests decide.

#!/usr/bin/env bash
# usage: CLAUDE_MODEL=<id> CODEX_MODEL=<id> ./eval.sh "Fix the failing test in src/parser.test.ts"
set -euo pipefail
: "${CLAUDE_MODEL:?set CLAUDE_MODEL}" "${CODEX_MODEL:?set CODEX_MODEL}"
TASK="$1"
ROOT=$(git rev-parse --show-toplevel)

for tool in claude codex; do
  git worktree add --detach "$ROOT/../eval-$tool" HEAD
  (cd "$ROOT/../eval-$tool" && npm ci)
done

(cd "$ROOT/../eval-claude" && time claude -p "$TASK" --model "$CLAUDE_MODEL" \
  --permission-mode acceptEdits \
  --allowedTools "Bash(npm test:*)" \
  --output-format json > ../claude.json) || true

(cd "$ROOT/../eval-codex" && time codex exec -m "$CODEX_MODEL" \
  --sandbox workspace-write --json "$TASK" > ../codex.jsonl) || true

for tool in claude codex; do
  cd "$ROOT/../eval-$tool"
  if npm test >/dev/null 2>&1; then echo "$tool: pass"; else echo "$tool: fail"; fi
  git add -A && git diff --cached --stat | tail -1
  cd "$ROOT"
  git worktree remove --force "$ROOT/../eval-$tool"
done

The script checks out HEAD twice, once per agent, and installs dependencies in each checkout. It gives both agents the same task with a pinned model and times each run. It then runs npm test in each checkout, prints pass or fail and the diff size, and deletes the checkouts. The agents’ logs stay next to the repo as claude.json and codex.jsonl.

Run it once per ticket and record pass rate, wall-clock time and diff size per tool. A smaller diff that passes is usually the better result, since reviewers pay for every extra line. Pin both models by setting CLAUDE_MODEL and CODEX_MODEL when you run it, as in the usage line, or you are comparing whatever default shipped that week.

Decision flow: a need for local models, native Windows or open source points to Codex, a Claude model preference to Claude Code, and otherwise the worktree eval decides.

When to pick Claude Code

Pick it when your team prefers Claude models and finds them more capable in technical tasks.

When to pick Codex

Pick it when you need models from more than one vendor. Codex takes custom providers under model_providers and ships built-in ollama, lmstudio and amazon-bedrock providers, so a local or air-gapped model runs with the same CLI and config. Claude Code runs Claude models only. To point Codex at a local model, set it in ~/.codex/config.toml:

model_provider = "ollama"
model = "gpt-oss:20b"

Windows teams get a sandbox without WSL2: Codex uses a native Windows sandbox in PowerShell, while Claude Code runs commands unsandboxed on native Windows.

Regulated teams can have security audit the open-source CLI before rollout.

For pipelines, put approval_policy = "never" in ~/.codex/ci.config.toml and run codex exec --profile ci "...". Avoid --sandbox danger-full-access outside a throwaway container; it turns the sandbox off.

Share instructions between both tools

Both tools read AGENTS.md, but Claude Code only falls back to it when no CLAUDE.md exists. If your repo already has one, import AGENTS.md at its top:

{ echo '@AGENTS.md'; cat CLAUDE.md; } > CLAUDE.md.new && mv CLAUDE.md.new CLAUDE.md

Put build commands, test commands and repo conventions in AGENTS.md. With the exact test command, neither agent has to guess how to verify a change.

Checklist

  • Run the worktree eval on 10–20 real tickets with the model pinned in both tools.
  • Compare pass rate, time and diff size, not leaderboard scores.
  • Store instructions in AGENTS.md, and import it from CLAUDE.md if you have one.
  • Re-run the eval when either vendor ships a new default model.

Documentation