# Claude Code vs Codex CLI for hooks and patch review

Canonical: https://cwyn.com/pages/claude-code-guide-claude-code-vs-codex.html
Last updated: 2026-11-27T03:07:55-05:00

Claude Code workflow guide

Choose Claude Code if an edit to a protected file should stop before the write. A project hook can check the path. Choose Codex CLI if you want to review an uncommitted patch without changing it or send a task to the cloud. If either workflow fits, [compare costs on your current plan](https://cwyn.com/pages/claude-code-guide-claude-code-vs-codex-cost.html).

Last updated November 27, 2026 · Published November 23, 2026

By CWYN · Published Nov 23, 2026 · [Anthropic’s file protection example](https://code.claude.com/docs/en/hooks-guide#block-edits-to-protected-files) and [OpenAI’s CLI review and cloud workflows](https://learn.chatgpt.com/docs/codex/cli) (as of Nov 27, 2026) · [Vendor sources and dates](https://cwyn.com/pages/claude-code-guide-claude-code-vs-codex.html#source-dates)

## 1. Compare Claude Code and Codex CLI

Terminal workflows and usage limits. Scroll across on a small screen to read both tools.

| What you need | Claude Code | Codex CLI |
| --- | --- | --- |
| Install and sign in | On Windows, run `irm https://claude.ai/install.ps1 \| iex` in PowerShell. Open a fresh terminal in the project, run `claude` and follow the sign-in prompts. [Windows setup and first sign-in](https://cwyn.com/pages/claude-code-guide-windows-powershell-install.html) . | Use the Windows installer, or run `curl -fsSL https://chatgpt.com/codex/install.sh \| sh` on macOS or Linux. In the repo, run `codex` and select Sign in with ChatGPT . [CLI setup](https://developers.openai.com/codex/cli) (Nov 23, 2026). |
| Plans and shared usage | Individual subscription access starts on a paid Claude plan. On Pro and Max, terminal work uses the same allowance as web and desktop chat. [Plan access](https://cwyn.com/pages/claude-code-guide-claude-code-vs-codex-cost.html) and [shared Claude usage](https://cwyn.com/pages/claude-code-guide-usage-limits.html) . | Codex shares usage limits and credits with ChatGPT. It is included with Free, Go, Plus, Pro, Business, Edu and Enterprise. [Included plans](https://developers.openai.com/codex/pricing) (Nov 23, 2026). |
| Usage limits | On Pro and Max, your first message starts a five-hour window. Your weekly allowance resets at a time assigned to your account. Check both in `/usage` . Anthropic leaves absolute message counts unpublished. [Reset times](https://cwyn.com/pages/claude-code-guide-usage-limits.html) and [plan allowances](https://cwyn.com/pages/claude-code-guide-subscription-vs-api.html) . | On Plus, OpenAI estimates 15 to 160 local messages per five hours with GPT-6.1 Sol, 6 to 50 with GPT-6.2 Astra and 17 to 180 with GPT-6.2 Sol. The task and model affect usage. Weekly limits may apply. Pro currently has no five-hour limit. A launch billing mistake discounted GPT-6.2 Astra and Sol usage. Since the fix, users reach limits 40% faster on GPT-6.2 Astra and 25% faster on GPT-6.2 Sol than last week. Both still go further than GPT-6 Astra and GPT-6.1 Sol, respectively. Other models are unaffected. There is no charge for past usage. Go, Plus, Pro and Business each get one banked reset. [Tibo’s billing update](https://x.com/thsottiaux/status/2125784147889393806) (Nov 25, 2026 at 9:50 PM ET). OpenAI still lists the same ranges and credit rates. [Codex usage estimates](https://developers.openai.com/codex/pricing) (checked Nov 26, 2026 at 10:51 AM ET). See [what to check before your next Codex task](https://cwyn.com/pages/claude-code-guide-codex-gpt-6-2-usage-limits.html). |
| API-key billing | An Anthropic API key bills metered calls separately from the Claude subscription. Include scripts that need the key in your API budget. [Subscription vs API billing](https://cwyn.com/pages/claude-code-guide-subscription-vs-api.html) . | An OpenAI API key bills at API rates, separately from your ChatGPT allowance. API-key sessions have no cloud features such as GitHub code review or Slack. [API-key access](https://developers.openai.com/codex/pricing) (Nov 23, 2026). |
| Project instructions | Put the repository's commands and conventions in `CLAUDE.md` . To share rules with Codex, import them with a line containing `@AGENTS.md` . [Project template](https://cwyn.com/pages/claude-code-guide-claude-md-template.html) and [file discovery](https://cwyn.com/pages/claude-code-guide-claude-md-vs-agents-md.html) . | `/init` creates an `AGENTS.md` for the project. Codex reads instructions from the project root down to the working directory. [Discovery order](https://cwyn.com/pages/claude-code-guide-claude-md-vs-agents-md.html) . [CLI commands](https://developers.openai.com/codex/cli) (Nov 23, 2026). |
| Permissions and approval | Use `/plan` to read the project and review a plan before editing. For commands, Claude checks `deny` , then `ask` , then `allow` rules. [Plan mode](https://cwyn.com/pages/claude-code-guide-plan-mode.html) and [permission rule order](https://cwyn.com/pages/claude-code-guide-permission-allowlist-prompts.html) . | `/permissions` shows the sandbox and writable roots. Choose when Codex may edit files or run commands without asking. [CLI permissions](https://developers.openai.com/codex/cli) (Nov 23, 2026). |
| Code review | `/code-review` checks a diff, pull request, branch or path for bugs. `/review` is an alias. Add `--fix` to apply fixes. [Review commands](https://cwyn.com/pages/claude-code-guide-commands-cheat-sheet.html#before-you-ship) . | `/review` reports findings on uncommitted changes, a commit or changes against a base branch. The review leaves the working tree intact. [Review targets](https://developers.openai.com/codex/cli) (Nov 23, 2026). |
| Undo and checkpoints | Open `/rewind` , select the prompt and choose Restore code to recover files tracked by Claude's edit tools. Use Git for files changed only through Bash. [What checkpoints restore](https://cwyn.com/pages/claude-code-guide-rewind-checkpoints.html) . | OpenAI recommends Git checkpoints before and after a task so you can return to a saved revision. `codex resume` reopens a saved conversation. [Git checkpoints and resume](https://developers.openai.com/codex/cli) (Nov 23, 2026). |
| Parallel work | Run `claude --worktree <name>` for each task, using a different name in each terminal. Each session gets a separate branch and checkout. [Worktree guide](https://cwyn.com/pages/claude-code-guide-worktrees.html) . | Delegate focused work to specialized agents. For example, ask one to trace a caller and another to inspect its tests. [Agent delegation](https://developers.openai.com/codex/cli) (Nov 23, 2026). |
| MCP, skills and plugins | Connect external tools through MCP, put a repeatable checklist in a skill, or distribute a skill, hook and server together in a plugin. [Extension types](https://cwyn.com/pages/claude-code-guide-skills-vs-subagents-hooks.html) . | Use `codex mcp` to add a local or remote MCP server. Marketplaces offer skills and plugins. [MCP, skills and plugins](https://developers.openai.com/codex/cli) (Nov 23, 2026). |
| Hooks for required checks | A `PreToolUse` hook can reject an edit to a protected file. A `PostToolUse` hook can run a formatter after a matching edit. [Protected-file and formatter hook examples](https://cwyn.com/pages/claude-code-guide-hooks-examples.html) . | Hook-based checks are not covered in our guides . [Codex CLI feature reference](https://developers.openai.com/codex/cli) (Nov 23, 2026). |
| Headless runs and CI | Use `claude -p` to run a prompt without an interactive session. Add `--output-format json` for a script. The documented `--bare` setup requires API authentication and skips discovery of hooks, MCP servers and `CLAUDE.md` . [Print mode guide](https://cwyn.com/pages/claude-code-guide-headless-print-mode.html) . | Use `codex exec` to run a task non-interactively in a script or CI job. [Non-interactive runs](https://developers.openai.com/codex/cli) (Nov 23, 2026). |
| Cloud hand-off | `/teleport` moves a session between environments. Handing a local task to a cloud worker is not covered in our guides . [Session commands](https://cwyn.com/pages/claude-code-guide-commands-cheat-sheet.html#between-sessions) . | With a ChatGPT sign-in, use `codex cloud` to hand a task to Codex cloud. A cloud task may use more of your allowance. [Cloud tasks](https://developers.openai.com/codex/cli) and [usage](https://developers.openai.com/codex/pricing) (Nov 23, 2026). |

### Vendor sources and dates

As of Nov 23, 2026 · OpenAI's [Codex CLI reference](https://developers.openai.com/codex/cli) and [plans, API access and usage estimates](https://developers.openai.com/codex/pricing).
 As of Nov 22, 2026 · Anthropic's [usage limits](https://support.claude.com/en/articles/11647753-how-do-usage-and-length-limits-work), [usage commands](https://code.claude.com/docs/en/costs), [project instructions](https://code.claude.com/docs/en/claude-md), [permission modes](https://code.claude.com/docs/en/permission-modes), [review and session commands](https://code.claude.com/docs/en/commands), [checkpoints](https://code.claude.com/docs/en/checkpointing), [worktrees](https://code.claude.com/docs/en/worktrees), [features](https://code.claude.com/docs/en/features-overview), [skills](https://code.claude.com/docs/en/skills), [hooks](https://code.claude.com/docs/en/hooks-guide) and [MCP setup](https://code.claude.com/docs/en/mcp).
 As of Nov 21, 2026 · Anthropic's [Claude Code billing](https://code.claude.com/docs/en/costs).
 As of Nov 20, 2026 · Anthropic's [AGENTS.md discovery](https://code.claude.com/docs/en/memory#agentsmd) and [shared-file import](https://code.claude.com/docs/en/memory#share-one-file-with-other-coding-tools), and OpenAI's [instruction file precedence](https://learn.chatgpt.com/docs/agent-configuration/agents-md).
 As of Nov 19, 2026 · Anthropic's [installer](https://code.claude.com/docs/en/setup), [first sign-in](https://code.claude.com/docs/en/quickstart), [plan allowances](https://claude.com/pricing) and [print mode](https://code.claude.com/docs/en/headless).
 As of Nov 18, 2026 · Anthropic's [permission rules and command matching](https://code.claude.com/docs/en/permissions).

## 2. Which tool fits your next task?

### Use Claude Code when a rule must run on each edit

Suppose a teammate can change application code but should leave the project's `.env` file alone. Put the reason in `CLAUDE.md` so it is available in each session. Use a `PreToolUse` hook to check the path and reject a matching write. In a scratch project, ask Claude to create an empty `.env` file and confirm the hook blocks the write.

### Use Codex CLI when you want a review or a cloud hand-off

For a patch you already have locally, choose uncommitted changes in `/review` before you stage it. If the work still needs doing and you want it to run in the cloud, sign in with ChatGPT and use `codex cloud`. Check the [allowance for the plan and model](https://cwyn.com/pages/claude-code-guide-claude-code-vs-codex.html#usage-limits) before moving a large task.

### Use both on the same change

Let Claude make the edit with your project hooks active. Open Codex in the same worktree and run `/review` on the resulting changes. If the change is already committed, select that commit instead. Give both tools the same test command in `AGENTS.md` so the reviewer can find the check the author used. See [how Claude Code and Codex read shared instructions](https://cwyn.com/pages/claude-code-guide-claude-md-vs-agents-md.html).

For a workflow that starts in chat, compare [OpenClaw vs Claude Code](https://cwyn.com/pages/openclaw-guide-openclaw-vs-claude-code.html) or [Hermes vs Claude Code](https://cwyn.com/pages/hermes-guide-hermes-vs-claude-code.html). If a teammate approves the action in a chat channel, the [May 27 OpenClaw release review](https://cwyn.com/pages/openclaw-2026-5-27-release-review.html) explains where an emoji reaction can grant approval.

## 3. Switch tools in an existing repository

1. Verify the shared instructions. Keep the team's test command and file paths in `AGENTS.md`. Put `@AGENTS.md` on its own line in a neighboring `CLAUDE.md`. In Claude, run `/context all` and look under Memory files. In a fresh Codex session, ask which instruction files are active. Then ask each tool which test it would run. [Instruction checks](https://cwyn.com/pages/claude-code-guide-claude-md-vs-agents-md.html).
2. Reconnect the MCP server. Identify the local command or remote endpoint your project uses. In Claude, `claude mcp add` with `--scope project` writes the shared entry to `.mcp.json`. Check it with `claude mcp list`. In Codex, use `codex mcp` to add the same server. [Claude MCP scopes](https://cwyn.com/pages/claude-code-guide-mcp-setup.html) and [Codex CLI reference](https://developers.openai.com/codex/cli) (Nov 23, 2026).
3. Check approvals before an edit. In Claude, use `/plan` if you want to inspect the approach first. In Codex, read `/status` for the session configuration and `/permissions` for writable paths and command approvals. Save a Git checkpoint before handing over the task. [Codex CLI reference](https://developers.openai.com/codex/cli) (Nov 23, 2026).

## 4. Claude Code vs Codex CLI FAQ

### Which is cheaper, Claude Code or Codex CLI?

If your task fits a plan you already pay for, using its included allowance adds no new plan fee. To [estimate your monthly Claude Code bill](https://cwyn.com/pages/claude-code-guide-cost-per-month.html), start with how you sign in. For API work, use the [worked API cost comparison](https://cwyn.com/pages/claude-code-guide-claude-code-vs-codex-cost.html) to price the same task on both models.

### Can Claude Code and Codex CLI share one instruction file?

Yes. Keep the shared rules in `AGENTS.md` and import it from `CLAUDE.md` with `@AGENTS.md`. Claude Code can also discover `AGENTS.md` directly from v2.1.277. By default, a `CLAUDE.md` or `CLAUDE.local.md` in the working directory or a parent takes priority. See the [file precedence guide](https://cwyn.com/pages/claude-code-guide-claude-md-vs-agents-md.html).

### Do I need an API key?

You can use either CLI interactively without an API key. Sign in with an eligible Claude plan or choose Sign in with ChatGPT in Codex. If you choose API-key billing, the API charges are separate. Claude's documented bare print-mode setup requires API authentication. See [Claude subscription vs API billing](https://cwyn.com/pages/claude-code-guide-subscription-vs-api.html) and [Codex pricing](https://developers.openai.com/codex/pricing) (Nov 23, 2026).

### Which tool has usage limits?

Both. On Claude Pro or Max, run `/usage` to check the current session and weekly allowance. On ChatGPT Plus, budget using OpenAI's five-hour estimates for your model and task. A Claude session and a Codex message measure different things. See the [limits side by side](https://cwyn.com/pages/claude-code-guide-claude-code-vs-codex.html#usage-limits) and [Claude reset times](https://cwyn.com/pages/claude-code-guide-usage-limits.html).

## Next steps

- [All 34 Claude Code guides](https://cwyn.com/guides/claude-code/)
- [Claude Code setup walkthrough](https://cwyn.com/setup/claude-code/)
- [Free AI model comparison](https://cwyn.com/score/ai-model-comparison/)
- [Claude Code Complete Setup Pack ($12.95)](https://cwyn.com/pages/pack-claude-code-complete-setup-pack.html)

### Choose a model for the task

[Use the free AI model comparison](https://cwyn.com/score/ai-model-comparison/)

## Email me the CLAUDE.md + settings starter

Get the editable CLAUDE.md template and a project setting you can merge into .claude/settings.json.

Email address

Email me this file. Also send up to 4 short follow-up emails with tips and one related CWYN product. Unsubscribe any time. [Privacy policy](https://cwyn.com/pages/privacy.html)

### Set up Claude Code for your repository

To check file paths before Claude edits your repository, adapt the project hooks in the [Claude Code Complete Setup Pack ($12.95)](https://cwyn.com/pages/pack-claude-code-complete-setup-pack.html).

Claude Code Complete Setup Pack $12.95

Set up project instructions, permission rules, hooks, a reviewer skill and subagent, and MCP connections for Claude Code.
