1. Advanced Guides
AnyRoute English
  • AnyRoute User Guide
  • Frequently Asked Questions
  • AnyRoute Support Group
  • Supported Models
  • Environment Setup
    • Node.js Installation Guide
    • CC Switch Introduction
  • Quick Start Guides
    • Codex CLI Quick Start
    • Claude Code Quick Start
    • OpenClaw Quick Start
    • Hermes Quick Start
    • Cherry Studio Quick Start
    • Claude Desktop Quick Start
    • Codex Desktop Quick Start
    • GPT Image 2 Guide
    • Claude Code in VS Code
  • Advanced Guides
    • Personal AGENTS.md Global Rules
    • Claude Code and Codex Collaboration Guide
  1. Advanced Guides

Claude Code and Codex Collaboration Guide

The Codex plugin for Claude Code lets you review code and delegate tasks to Codex without leaving Claude Code. A practical division of work is:
Claude Code: requirements, planning, and design discussion
Codex: implementation or focused investigation through /codex:rescue
Codex: independent review through /codex:review
Actual cost and usage depend on your Anthropic, OpenAI, and AnyRoute plans. Monitor both sides instead of assuming one model is always cheaper.
This guide assumes Claude Code and Codex CLI are already installed and configured.

Install the Codex plugin#

Run these commands separately inside Claude Code:
/plugin marketplace add openai/codex-plugin-cc
/plugin install codex@openai-codex
/reload-plugins
/codex:setup
/codex:setup checks whether Codex is installed and authenticated. If needed:
!codex login
The plugin uses the Codex CLI installation, authentication state, and configuration already present on the machine.
Official project: openai/codex-plugin-cc

Core commands#

Read-only reviews#

/codex:review
/codex:review --base main
/codex:review --background
/codex:adversarial-review --background look for race conditions and challenge the caching strategy
/codex:review is read-only. Use adversarial review to pressure-test a particular decision or risk.

Delegate work#

/codex:rescue investigate why the tests started failing
/codex:rescue fix the failing test with the smallest safe patch
/codex:rescue implement validation for the registration form
/codex:rescue --background refactor the database connection pool
/codex:rescue --model gpt-5.4-mini write unit tests for utils.ts
/codex:rescue --model spark fix this lint error
/codex:rescue --resume apply the preferred fix from the previous run
If no model or reasoning effort is specified, Codex chooses its configured defaults. The spark alias maps to gpt-5.3-codex-spark in the current plugin.

Manage background jobs#

/codex:status
/codex:result
/codex:cancel
When available, /codex:result includes a session ID that can be continued directly:

Transfer the current Claude Code session#

/codex:transfer
This creates a persistent Codex thread from the current Claude Code session when the installed versions support the external-agent importer.

Recommended workflow#

Normal development#

Requirement → Claude plans → Codex implements → Codex reviews → developer verifies
1.
Describe the requirement and constraints.
2.
Ask Claude to identify the implementation plan and risks.
3.
Delegate clearly bounded implementation tasks with /codex:rescue.
4.
Run /codex:review --background.
5.
Evaluate the findings, fix confirmed issues, and run project tests.
Codex does not automatically inherit every detail from the Claude conversation. Include the necessary context, acceptance criteria, paths, and constraints in delegated tasks, or use the transfer feature where appropriate.

High-risk changes#

For migrations, authentication, authorization, billing, or infrastructure:
Plan → implementation → normal review → fixes → adversarial review → verification
An adversarial review should challenge rollback, race conditions, data loss, trust boundaries, and failure modes.

When one model is stuck#

Delegate a focused, evidence-based task:
/codex:rescue --fresh find the root cause and propose the smallest safe fix

Background execution#

Long reviews and rescue tasks are better suited to background mode:
/codex:rescue --background implement pagination
/codex:status
/codex:result
Monitor background jobs. A task that appears stuck should be inspected or cancelled instead of consuming usage indefinitely.

Optional review gate#

/codex:setup --enable-review-gate
/codex:setup --disable-review-gate
The review gate can block Claude's completion when Codex reports findings.
Enable it only when you can monitor the session. It can create long Claude/Codex loops and consume usage limits quickly.

Codex configuration#

Codex reads:
User configuration: ~/.codex/config.toml
Trusted project override: .codex/config.toml
Example:
model = "gpt-5.4-mini"
model_reasoning_effort = "high"
Override a rescue task when needed:
/codex:rescue --model spark --effort medium fix the lint failure

When not to delegate#

Keep the task in the current agent when:
The necessary context exists only in the current conversation and cannot be summarized safely.
The task requires continuous product or design decisions from the user.
The task is so small that delegation overhead exceeds the work.
The repository or permission boundary does not allow the delegated operation.

FAQ#

The /codex commands do not appear#

Run /reload-plugins, then /codex:setup. Confirm that the plugin is installed as codex@openai-codex.

A review reports an authentication error#

Run /codex:setup, verify Codex CLI authentication, and review Codex CLI Quick Start.

How is /codex:rescue different from asking Claude to code?#

It delegates the task to the local Codex runtime, which uses its own model configuration and usage limits. The delegated prompt must include the context Codex needs.

Claude and Codex disagree#

Treat both outputs as evidence, not authority. Reproduce the concern, inspect the relevant code, and make the final engineering decision.

How much usage does this save?#

It depends on task mix, model selection, and pricing. Review actual usage records for both providers.

Join AnyRoute WeChat Group

To get support for AnyRoute

scan QR code
Modified at 2026-07-24 19:05:30
Previous
Personal AGENTS.md Global Rules
Built with