Claude Code vs Codex: a November 2026 comparison
Claude Code and Codex compared from their official docs as of November 2026: instructions, approvals, sandboxes, hooks, subagents, MCP, licence and plans.
Claude Code and Codex are close in what they do: both are terminal agents that read your repository, edit files, run commands and ask before risky steps. They differ in details that matter in daily use, such as how the sandbox is switched on, how many hook events you can use and what the licence allows. This comparison uses each vendor's own documentation, as of November 2026, and contains no benchmark numbers, because those say little about your codebase.
How do they compare?
| Area | Claude Code | Codex |
|---|---|---|
| Instruction file | CLAUDE.md, with imports; by default reads AGENTS.md when there is no CLAUDE.md (version 2.1.277 or later) | AGENTS.md, with AGENTS.override.md; 32 KiB combined cap by default |
| Approvals | Six permission modes: default (shown as Manual), acceptEdits, plan, auto, dontAsk, bypassPermissions | Approval policies on-request, never and granular, with an optional reviewer agent (auto_review) |
| Sandbox | Off by default; opt in with /sandbox. macOS, Linux and WSL2; native Windows runs commands unsandboxed | Modes read-only, workspace-write, danger-full-access. macOS, Linux, WSL2 and native Windows |
| Hooks | 33 events, 5 handler types, set in settings files | 14 events, set in hooks.json or config.toml, with a trust review |
| Subagents | Markdown files in .claude/agents/; background runs; optional worktree isolation | TOML files in .codex/agents/; delegates on request or when instructions ask |
| MCP | HTTP, stdio, WebSocket; SSE is deprecated | STDIO and streamable HTTP |
| Non-interactive | claude -p | codex exec |
| Licence | All rights reserved, under Anthropic's Commercial Terms | Apache-2.0 |
| Entry plan | Pro, $20 per month | Free, then Go at $8 per month |
Instruction files
Claude Code reads CLAUDE.md. Its memory documentation says it also reads AGENTS.md from version 2.1.277. By default it does so only when no CLAUDE.md exists in the working directory or above it; its Project instructions setting can load both files together. Codex reads AGENTS.md, checks AGENTS.override.md first in each directory, and caps the combined size at 32 KiB by default. The practical answer for a team that uses both is one shared file; see keeping one AGENTS.md and importing it.
Permissions and approvals
Claude Code has six permission modes. In default, only reads run without asking. acceptEdits adds file edits and common filesystem commands. plan is for reading before changing. auto runs everything with background safety checks. dontAsk denies whatever would prompt, and bypassPermissions runs everything.
Codex separates approvals from the sandbox. The approval policy says when to ask (on-request, never, or granular to keep chosen prompt types and reject the rest). The sandbox mode says what is possible at all. For folders under version control, Codex recommends an Auto preset: workspace-write with on-request approvals. Setting approvals_reviewer to auto_review sends approval requests to a reviewer agent, which uses extra model calls.
Sandboxing on each operating system
Both use Seatbelt on macOS and bubblewrap on Linux. They differ in defaults and on Windows.
- Claude Code: the sandbox is off by default. On native Windows, commands run unsandboxed, and WSL2 is the way to get one. It wraps shell commands only: Claude's file tools, MCP servers and hooks run outside it.
- Codex: the default permissions mode applies sandboxing automatically. On Windows, PowerShell uses a native Windows sandbox and WSL2 uses the Linux implementation. On Linux it asks you to install bubblewrap, and falls back to a bundled helper that needs unprivileged user namespaces.
Read the details of each before you rely on one. The Claude Code documentation notes that its sandbox still allows reading credential files such as those under ~/.ssh unless you deny them.
Hooks, subagents and MCP
Claude Code's hooks reference lists 33 events and five handler types: command, HTTP, MCP tool, prompt and agent. Codex's hooks cover 14 events, including PreToolUse, PermissionRequest and Stop, and ask you to review and trust a new or changed hook before it runs. For the events that tell you an agent is waiting, see the guide on agent hooks.
Claude subagents are Markdown files with YAML frontmatter, can run in the background, and can run in a temporary git worktree with isolation: worktree. Codex subagents are TOML files, started when you ask or when AGENTS.md or a skill asks for them, with a setting that caps concurrent threads.
Both are MCP clients. Claude Code supports HTTP (recommended for remote servers), stdio and WebSocket, and marks SSE deprecated, with local, project and user scopes. Codex supports STDIO and streamable HTTP, configured with codex mcp add or a [mcp_servers] table in config.toml.
Headless and scripted use
claude -p runs one prompt and exits, with text, json and stream-json output, a --json-schema option, and a --bare mode that skips automatic loading of hooks, plugins and CLAUDE.md for repeatable runs. In Manual mode, a call that needs approval is denied unless a hook or a prompt tool approves it. codex exec streams JSON Lines with --json, accepts --output-schema, and runs in a read-only sandbox by default. Edits need --sandbox workspace-write.
Licence
The Codex repository is licensed under Apache-2.0, so you can read, fork and build it. The Claude Code repository is public, but its licence file reads "© Anthropic PBC. All rights reserved. Use is subject to Anthropic's Commercial Terms of Service." It is not an open source licence.
Plans and pricing as of November 2026
Prices change often, so check the pages before you buy. Claude's pricing page shows Claude Code in Pro ($20 per month, or $17 per month billed annually), Max ($100 per month) and Ultra ($200 per month), in Team (standard seat $25 per month, or $20 billed annually) and in Enterprise. It marks Claude Code as not included in Free. Claude Code also runs with an API key from the Claude Console. Codex's pricing page lists Free ($0), Go ($8 per month), Plus ($20), Pro (from $100) and Business ($20 per user per month billed annually, $25 monthly), with Enterprise and Edu through sales. Local messages and cloud chats share the plan's allowance, and weekly limits may apply. API-key sessions use API pricing instead.
Where is each one the better fit?
Claude Code fits better when
- You want the wider hook surface: 33 events and handler types that include an HTTP call, a prompt and a subagent.
- You want a named plan mode and an
automode with safety checks, instead of building that from approval policies. - You delegate to subagents and want worktree isolation as one line in the agent's file.
- You are already on a Claude plan.
Codex fits better when
- You need to read or modify the tool itself: it is Apache-2.0, and Claude Code is not open source.
- Your team uses native Windows and wants a sandbox without moving to WSL2, or you want the sandbox on by default.
- You want a free or $8 entry point, or a CI run that starts read-only until you widen it.
- You already keep instructions in
AGENTS.mdand want no extra files.
If your constraints do not point one way, the difference will not decide the outcome. Try both on the same task and read the result.
You do not have to pick one
The files overlap enough to share (AGENTS.md), and both agents work on a branch. Give each its own git worktree, as in the worktrees guide, and you can run both on one repository. Tenslo Code does that for you: it runs Claude Code and Codex side by side, each in its own worktree.
Sources
- How Claude remembers your project, Claude Code docs
- AGENTS.md, Codex docs (OpenAI)
- Choose a permission mode, Claude Code docs
- Agent approvals and security, Codex docs (OpenAI)
- Sandboxing, Claude Code docs
- Sandboxing, Codex docs (OpenAI)
- Hooks reference, Claude Code docs
- Hooks, Codex docs (OpenAI)
- Create custom subagents, Claude Code docs
- Subagents, Codex docs (OpenAI)
- Connect Claude Code to tools via MCP, Claude Code docs
- Model Context Protocol, Codex docs (OpenAI)
- Run Claude Code programmatically, Claude Code docs
- Non-interactive mode, Codex docs (OpenAI)
- openai/codex, GitHub
- LICENSE.md, anthropics/claude-code, GitHub
- Plans and pricing, Claude
- Pricing, Codex docs (OpenAI)