Claude Code workflow guide

Claude Code vs Codex CLI for hooks and patch review

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.

Last updated · Published

By CWYN · Published · Anthropic’s file protection example and OpenAI’s CLI review and cloud workflows (as of ) · Vendor sources and 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 needClaude CodeCodex 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. 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 ().
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 and shared Claude usage. Codex shares usage limits and credits with ChatGPT. It is included with Free, Go, Plus, Pro, Business, Edu and Enterprise. Included plans ().
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 and plan allowances. 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 ().

OpenAI still lists the same ranges and credit rates. Codex usage estimates (checked ). See what to check before your next Codex task.

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. 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 ().
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 and file discovery. /init creates an AGENTS.md for the project. Codex reads instructions from the project root down to the working directory. Discovery order. CLI commands ().
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 and permission rule order. /permissions shows the sandbox and writable roots. Choose when Codex may edit files or run commands without asking. CLI permissions ().
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. /review reports findings on uncommitted changes, a commit or changes against a base branch. The review leaves the working tree intact. Review targets ().
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. 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 ().
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. Delegate focused work to specialized agents. For example, ask one to trace a caller and another to inspect its tests. Agent delegation ().
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. Use codex mcp to add a local or remote MCP server. Marketplaces offer skills and plugins. MCP, skills and plugins ().
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. Hook-based checks are not covered in our guides. Codex CLI feature reference ().
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. Use codex exec to run a task non-interactively in a script or CI job. Non-interactive runs ().
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. 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 and usage ().

Vendor sources and dates

As of · OpenAI's Codex CLI reference and plans, API access and usage estimates.
As of · Anthropic's usage limits, usage commands, project instructions, permission modes, review and session commands, checkpoints, worktrees, features, skills, hooks and MCP setup.
As of · Anthropic's Claude Code billing.
As of · Anthropic's AGENTS.md discovery and shared-file import, and OpenAI's instruction file precedence.
As of · Anthropic's installer, first sign-in, plan allowances and print mode.
As of · Anthropic's permission rules and command matching.

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 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.

For a workflow that starts in chat, compare OpenClaw vs Claude Code or Hermes vs Claude Code. If a teammate approves the action in a chat channel, the May 27 OpenClaw release review 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.
  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 and Codex CLI reference ().
  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 ().

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, start with how you sign in. For API work, use the worked API cost comparison 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.

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 and Codex pricing ().

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 and Claude reset times.

Next steps

Choose a model for the task

Use the free AI model comparison

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).