codex-plugin-cc

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Codex Plugin for Claude Code

面向Claude Code的Codex插件

Skill by ara.so — Daily 2026 Skills collection.
A Claude Code plugin that lets you run OpenAI Codex code reviews and delegate background tasks to Codex directly from your Claude Code session. Use it for read-only code reviews, adversarial design challenges, and handing off investigative or fix tasks to Codex as a subagent.

ara.so开发的Skill — 2026年度每日技能精选集。
这是一款Claude Code插件,支持你直接在Claude Code会话中调用OpenAI Codex执行代码审查,以及将后台任务委派给Codex处理。可用于只读代码审查、对抗性设计挑战,还可将调研或修复任务交给作为子代理的Codex处理。

What It Does

功能说明

  • /codex:review
    — Standard read-only Codex code review of uncommitted changes or a branch diff
  • /codex:adversarial-review
    — Steerable review that challenges design decisions, tradeoffs, and assumptions
  • /codex:rescue
    — Delegate a task (bug investigation, fix, etc.) to Codex as a background subagent
  • /codex:status
    — Check progress of background Codex jobs
  • /codex:result
    — Retrieve output from a finished job (includes Codex session ID for
    codex resume
    )
  • /codex:cancel
    — Cancel an active background job
  • /codex:setup
    — Verify Codex is installed and authenticated; optionally enable/disable the review gate

  • /codex:review
    — 针对未提交变更或分支差异的标准只读Codex代码审查
  • /codex:adversarial-review
    — 可定向的审查模式,会质疑设计决策、权衡方案和隐含假设
  • /codex:rescue
    — 将任务(漏洞调研、修复等)作为后台子代理任务委派给Codex
  • /codex:status
    — 查看Codex后台任务的进度
  • /codex:result
    — 获取已完成任务的输出(包含Codex会话ID,可用于
    codex resume
    命令)
  • /codex:cancel
    — 取消正在运行的后台任务
  • /codex:setup
    — 验证Codex是否已安装并完成身份验证;可选择启用/禁用审查闸门

Requirements

依赖要求

  • Node.js 18.18 or later
  • A ChatGPT subscription (Free tier works) or an OpenAI API key
  • Claude Code with plugin support

  • Node.js 18.18或更高版本
  • ChatGPT订阅(免费版可用) OpenAI API密钥
  • 支持插件功能的Claude Code

Installation

安装步骤

1. Add the marketplace and install the plugin

1. 添加应用市场并安装插件

bash
/plugin marketplace add openai/codex-plugin-cc
/plugin install codex@openai-codex
/reload-plugins
bash
/plugin marketplace add openai/codex-plugin-cc
/plugin install codex@openai-codex
/reload-plugins

2. Verify setup

2. 验证安装配置

bash
/codex:setup
If Codex CLI is missing,
/codex:setup
can install it for you via npm, or install manually:
bash
npm install -g @openai/codex
bash
/codex:setup
如果缺少Codex CLI,
/codex:setup
可以通过npm为你安装,你也可以手动安装:
bash
npm install -g @openai/codex

3. Authenticate with Codex

3. 完成Codex身份验证

bash
!codex login
Supports ChatGPT account login or API key. Your existing Codex CLI authentication is reused automatically if already logged in.

bash
!codex login
支持ChatGPT账号登录或API密钥验证。如果你已经完成登录,已有的Codex CLI身份验证信息会被自动复用。

Key Commands

核心命令

/codex:review

/codex:review

Runs a standard read-only Codex review on your current work.
bash
undefined
对你当前的工作内容执行标准只读Codex审查。
bash
undefined

Review uncommitted changes

审查未提交的变更

/codex:review
/codex:review

Review diff against a base branch

审查与基准分支的差异

/codex:review --base main
/codex:review --base main

Run in the background (recommended for multi-file changes)

后台运行(推荐多文件变更场景使用)

/codex:review --background
/codex:review --background

Run and wait inline

运行并等待执行完成

/codex:review --wait
undefined
/codex:review --wait
undefined

/codex:adversarial-review

/codex:adversarial-review

Challenges implementation decisions, tradeoffs, and hidden assumptions. Accepts optional free-text focus after flags.
bash
undefined
质疑实现决策、权衡方案和隐含假设。可在参数后添加可选的自由文本指定审查重点。
bash
undefined

Basic adversarial review

基础对抗性审查

/codex:adversarial-review
/codex:adversarial-review

Target a branch diff with a specific focus

针对分支差异审查,指定审查重点

/codex:adversarial-review --base main challenge whether this caching approach was correct
/codex:adversarial-review --base main challenge whether this caching approach was correct

Run in background, focus on race conditions

后台运行,重点排查竞态条件

/codex:adversarial-review --background look for race conditions and question the retry design
undefined
/codex:adversarial-review --background look for race conditions and question the retry design
undefined

/codex:rescue

/codex:rescue

Hands off a task to Codex via the
codex:codex-rescue
subagent.
bash
undefined
通过
codex:codex-rescue
子代理将任务交给Codex处理。
bash
undefined

Investigate a failing test

调研测试失败的原因

/codex:rescue investigate why the tests started failing
/codex:rescue investigate why the tests started failing

Apply a minimal fix

应用最小化修复方案

/codex:rescue fix the failing test with the smallest safe patch
/codex:rescue fix the failing test with the smallest safe patch

Resume the most recent Codex session for this repo

恢复当前仓库最近一次的Codex会话

/codex:rescue --resume apply the top fix from the last run
/codex:rescue --resume apply the top fix from the last run

Start fresh (ignore previous session)

开启全新会话(忽略之前的会话记录)

/codex:rescue --fresh investigate the regression
/codex:rescue --fresh investigate the regression

Use a specific model and effort level

指定使用的模型和推理投入等级

/codex:rescue --model gpt-5.4-mini --effort medium investigate the flaky integration test
/codex:rescue --model gpt-5.4-mini --effort medium investigate the flaky integration test

Use the faster "spark" model (maps to gpt-5.3-codex-spark)

使用速度更快的"spark"模型(对应gpt-5.3-codex-spark)

/codex:rescue --model spark fix the issue quickly
/codex:rescue --model spark fix the issue quickly

Run in the background

后台运行

/codex:rescue --background investigate why the build is failing in CI

You can also trigger rescue via natural language to Claude:

```text
Ask Codex to redesign the database connection to be more resilient.
/codex:rescue --background investigate why the build is failing in CI

你也可以通过自然语言向Claude发起委派请求:

```text
Ask Codex to redesign the database connection to be more resilient.

/codex:status

/codex:status

bash
undefined
bash
undefined

List all running and recent jobs for this repo

列出当前仓库所有运行中及最近的任务

/codex:status
/codex:status

Check a specific job

查看指定任务的状态

/codex:status task-abc123
undefined
/codex:status task-abc123
undefined

/codex:result

/codex:result

bash
undefined
bash
undefined

Get result of the most recent finished job

获取最近一次已完成任务的结果

/codex:result
/codex:result

Get result for a specific job

获取指定任务的结果

/codex:result task-abc123

Output includes a Codex session ID. Resume that session directly in Codex:

```bash
codex resume <session-id>
/codex:result task-abc123

输出内容包含Codex会话ID,你可以直接在Codex中恢复该会话:

```bash
codex resume <session-id>

/codex:cancel

/codex:cancel

bash
undefined
bash
undefined

Cancel the most recent active job

取消最近一次运行中的任务

/codex:cancel
/codex:cancel

Cancel a specific job

取消指定任务

/codex:cancel task-abc123
undefined
/codex:cancel task-abc123
undefined

/codex:setup
— Review Gate

/codex:setup
— 审查闸门

bash
undefined
bash
undefined

Enable the stop hook review gate

启用停止钩子审查闸门

/codex:setup --enable-review-gate
/codex:setup --enable-review-gate

Disable it

禁用审查闸门

/codex:setup --disable-review-gate

> **Warning:** The review gate runs a Codex review on every Claude response and blocks the stop if issues are found. This can trigger long Claude/Codex loops and drain usage limits. Only enable it when actively monitoring the session.

---
/codex:setup --disable-review-gate

> **警告:** 审查闸门会对Claude的每一次响应执行Codex审查,如果发现问题就会阻止停止操作。这可能会触发Claude/Codex长时间循环,消耗使用额度。请仅在主动监控会话时启用该功能。

---

Configuration

配置说明

The plugin uses the same
config.toml
as the Codex CLI. Configuration is layered:
LocationScope
~/.codex/config.toml
User-level defaults
.codex/config.toml
(project root)
Project-level overrides (requires trusted project)
该插件使用与Codex CLI相同的
config.toml
配置文件,配置采用分层生效规则:
位置作用范围
~/.codex/config.toml
用户级默认配置
.codex/config.toml
(项目根目录)
项目级覆盖配置(需要项目处于可信状态)

Example: Set default model and effort for a project

示例:为项目设置默认模型和推理投入等级

toml
undefined
toml
undefined

.codex/config.toml

.codex/config.toml

model = "gpt-5.4-mini" model_reasoning_effort = "xhigh"
undefined
model = "gpt-5.4-mini" model_reasoning_effort = "xhigh"
undefined

Example: Point to a custom OpenAI-compatible endpoint

示例:指定自定义的OpenAI兼容接口端点

toml
undefined
toml
undefined

~/.codex/config.toml

~/.codex/config.toml


API keys and authentication are managed via `codex login` — do not hardcode keys in config files. The CLI reads from the authenticated session or from the `OPENAI_API_KEY` environment variable.

---

API密钥和身份验证信息通过`codex login`管理 — 请勿在配置文件中硬编码密钥。CLI会读取已认证的会话信息,或者从`OPENAI_API_KEY`环境变量中获取密钥。

---

Common Patterns

常用使用场景

Review before shipping

发布前审查

bash
/codex:review --base main
bash
/codex:review --base main

Start a long-running review, check back later

启动长时间运行的审查,后续再查看结果

bash
/codex:adversarial-review --background look for auth and data-loss risks
/codex:status
/codex:result
bash
/codex:adversarial-review --background look for auth and data-loss risks
/codex:status
/codex:result

Delegate a bug investigation and resume in Codex

委派漏洞调研任务,之后在Codex中恢复会话

bash
/codex:rescue --background investigate why the integration test is flaky
bash
/codex:rescue --background investigate why the integration test is flaky

... later ...

... 后续操作 ...

/codex:result
/codex:result

Copy session ID from output, then:

从输出中复制会话ID,然后执行:

codex resume <session-id>
undefined
codex resume <session-id>
undefined

Iterative rescue workflow

迭代式修复工作流

bash
undefined
bash
undefined

First pass

首次排查

/codex:rescue investigate the failing build
/codex:rescue investigate the failing build

Apply what Codex found, continuing the same thread

应用Codex发现的问题,延续同一会话继续处理

/codex:rescue --resume apply the recommended fix from the last run
/codex:rescue --resume apply the recommended fix from the last run

Start completely fresh

开启全新会话重新排查

/codex:rescue --fresh re-investigate with a clean slate
undefined
/codex:rescue --fresh re-investigate with a clean slate
undefined

Use Claude to delegate naturally

通过Claude自然语言委派任务

text
Ask Codex to refactor the authentication module to remove the global state.
Claude will invoke the
codex:codex-rescue
subagent automatically.

text
Ask Codex to refactor the authentication module to remove the global state.
Claude会自动调用
codex:codex-rescue
子代理完成请求。

Troubleshooting

问题排查

/codex:setup
says Codex is not installed

/codex:setup
提示Codex未安装

bash
npm install -g @openai/codex
bash
npm install -g @openai/codex

or let /codex:setup install it for you

或者让/codex:setup自动为你安装

undefined
undefined

Codex is installed but not authenticated

Codex已安装但未完成身份验证

bash
!codex login
Supports ChatGPT account or API key. If using an API key directly:
bash
export OPENAI_API_KEY=your-key-here
bash
!codex login
支持ChatGPT账号或API密钥验证。如果直接使用API密钥,可以执行:
bash
export OPENAI_API_KEY=your-key-here

Background job seems stuck

后台任务疑似卡住

bash
/codex:status
/codex:cancel task-abc123
bash
/codex:status
/codex:cancel task-abc123

Plugin commands not appearing after install

安装后插件命令未显示

bash
/reload-plugins
bash
/reload-plugins

Project-level config not being picked up

项目级配置未生效

Project config in
.codex/config.toml
only loads when the project is trusted by Codex. Run
codex
directly in the project directory to trust it, or check the Codex advanced config docs.
.codex/config.toml
中的项目配置仅在Codex信任该项目时才会加载。在项目目录下直接运行
codex
命令将项目添加到可信列表,或者参考Codex高级配置文档排查。

Review gate creating runaway loops

审查闸门引发无限循环

Disable it immediately:
bash
/codex:setup --disable-review-gate

立即禁用该功能:
bash
/codex:setup --disable-review-gate

How It Works Internally

内部工作原理

  • The plugin wraps the local
    codex
    binary and the Codex app server
  • All jobs run in your local environment against your local repository checkout
  • Authentication, config, and model settings come from your existing Codex CLI setup
  • Background jobs are tracked per-repository and can be resumed in Codex directly via session IDs
  • The
    codex:codex-rescue
    subagent is registered in
    /agents
    and can be invoked by Claude automatically when you ask it to delegate work to Codex
  • 该插件封装了本地
    codex
    二进制文件和Codex应用服务
  • 所有任务都在你的本地环境中运行,基于你本地的仓库代码执行操作
  • 身份验证、配置和模型设置都复用你已有的Codex CLI配置
  • 后台任务按仓库维度追踪,可通过会话ID直接在Codex中恢复
  • codex:codex-rescue
    子代理已注册在
    /agents
    路径下,当你要求Claude将任务委派给Codex时会自动调用