Using the Codex plugin in Claude Code
openai/codex-plugin-cc plugin lets Claude Code hand work to
OpenAI Codex (GPT-5.x) via a local runtime. Short answer:
default to /codex:review. For high-risk changes (security, public API contract,
wide blast radius) use /codex:adversarial-review. Note:
/codex:rescue is not a review step — it hands Codex a fix when you are stuck.
Review output is always verbatim and runs on your real git state.
Summary diagrams (ASCII)
Quick summary: when code is done and you want Codex (GPT-5.x) to re-check,
use /codex:review — that is the main command. rescue is not for review; it
asks Codex to fix when you are stuck. Diagrams below are plain text (scroll sideways if needed).
7 LỆNH CODEX PLUGIN v1.0.3
┌──────────────────────────────────────────────────────────────┐
│ │
│ NHÓM KIỂM TRA (dùng sau khi code xong) │
│ ┌────────────────────┐ ┌──────────────────────────────┐ │
│ │ /codex:review │ │ /codex:adversarial-review │ │
│ │ Review bình thường │ │ Review kiểu "phá hoại", │ │
│ │ MẶC ĐỊNH dùng │ │ cố tìm chỗ hỏng. Chỉ dùng │ │
│ │ cái này │ │ khi thay đổi rủi ro cao │ │
│ └────────────────────┘ └──────────────────────────────┘ │
│ │
│ NHÓM SỬA LỖI (dùng khi bị bí, KHÔNG phải để kiểm tra) │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ /codex:rescue │ │
│ │ Giao Codex điều tra nguyên nhân + sửa khi Claude bị │ │
│ │ kẹt. Đây là bước sửa, không phải bước kiểm tra │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
│ NHÓM THIẾT LẬP + VẬN HÀNH (không dùng cho từng lần code) │
│ ┌──────────────┐ ┌──────────┐ ┌──────────┐ ┌────────────┐ │
│ │ /codex:setup │ │ status │ │ result │ │ cancel │ │
│ │ Cài 1 lần, │ │ Xem job │ │ Lấy kết │ │ Huỷ job │ │
│ │ bật gate │ │ đang chạy│ │ quả job │ │ đang chạy │ │
│ └──────────────┘ └──────────┘ └──────────┘ └────────────┘ │
│ │
└──────────────────────────────────────────────────────────────┘
Bạn muốn làm gì sau khi code xong?
│
├─ Muốn Codex kiểm tra lại code?
│ │
│ ├─ Thay đổi bình thường ──► /codex:review
│ │
│ └─ Thay đổi rủi ro cao ──► /codex:adversarial-review
│ (bảo mật, đổi API công khai,
│ ảnh hưởng rộng)
│
├─ Review ra lỗi, tự sửa không nổi? ──► /codex:rescue
│
└─ Muốn Codex tự review mỗi phiên? ──► /codex:setup
(bật review gate 1 lần)
Ý tưởng cốt lõi: Opus 4.8 viết code, GPT-5.5 (Codex) review lại. Không để mô hình viết code tự chấm điểm chính mình. BƯỚC 1 BƯỚC 2 BƯỚC 3 BƯỚC 4 ┌────────┐ ┌────────┐ ┌────────────────┐ ┌─────────────────┐ │/ak:test│──► │/verify │──► │/ak:code-review │──► │ /codex:review │ └────────┘ └────────┘ └────────────────┘ └─────────────────┘ Chạy test Chạy thử Opus review GPT-5.5 review độc (unit, thật, xem (phía Opus) lập, bắt lỗi Opus build...) có đúng không không thấy Ai làm: Ai làm: Ai làm: Ai làm: AgentKit Built-in AgentKit Codex (GPT-5.x) Rủi ro cao ──► đổi bước 4 thành /codex:adversarial-review
┌───────────────────────────────────────────────────────────────┐ │ Sửa nhỏ, cơ học → /verify là đủ, khỏi cần Codex │ │ │ │ Thay đổi bình thường → /ak:code-review + /codex:review │ │ │ │ Rủi ro cao → thêm /codex:adversarial-review │ │ + bật review gate qua /codex:setup │ └───────────────────────────────────────────────────────────────┘ Chạy đủ 4 bước cho MỌI thay đổi là dư thừa (vi phạm YAGNI). Chỉ chạy nhiều khi thay đổi thực sự đáng.
Bạn gõ /codex:review
│
▼
┌──────────────────────┐ ┌─────────────┐ ┌──────────────┐
│ codex-companion.mjs │──► │ Codex CLI │──► │ GPT-5.x │
│ (runtime trung gian) │ │ │ │ đọc diff, │
└──────────────────────┘ └─────────────┘ │ chấm điểm │
▲ └──────┬───────┘
│ │
└───────── Kết quả trả về nguyên văn ◄──────────┘
(verbatim, không chỉnh sửa)
01Which command?
Match your situation, then pick the command on the right. Green = review, orange = fix.
/codex:review/codex:adversarial-review/codex:rescue/codex:setup/codex:review is valuable.
027 commands, 3 groups
Memorize by group: review after coding, fix when stuck, setup/ops for jobs — not every commit.
/codex:review
/codex:adversarial-review
/codex:rescue
/codex:setup
/codex:status
/codex:result
/codex:cancel
03How the pieces fit
Claude stays in the driver's seat. Codex is a second engine Claude calls for review or a tight task, then returns raw output to you.
04Place in the review pipeline
Idea: run tests and real tryouts first, review next, then a second model. Codex is the last step.
/codex:adversarial-review. Running all four steps
on every change is wasteful (YAGNI): tiny mechanical edits only need /verify, no Codex.
05Install
Four commands inside Claude Code. Needs Node.js 18.18+ plus a ChatGPT plan or OpenAI API key.
- Add marketplace.
/plugin marketplace add openai/codex-plugin-cc - Install plugin.
/plugin install codex@openai-codex - Reload.
/reload-plugins: registers commands, subagent, hooks. - Verify.
/codex:setup: checks Node, npm, Codex CLI, login.
/codex:setup can offer install
(npm install -g @openai/codex) when npm is present. Otherwise install first, then re-run setup.
06Setup & login
/codex:setup reports readiness per component. Login reuses the local Codex CLI
session. If logged out, run !codex login and pick ChatGPT or an API key.
| Check | Status | Example detail |
|---|---|---|
| Node | ✓ ready | v22.18.0 |
| npm | ✓ ready | 11.7.0 |
| Codex CLI | ✓ ready | codex-cli 0.144.1 · advanced runtime available |
| Login | ✓ logged in | using ChatGPT login |
| Session runtime | direct start | first review/task starts shared runtime if needed |
| Review gate | off | enable with --enable-review-gate |
!codex login. The
! prefix runs the command in-session so output lands in the chat.
07Command reference
Seven commands under /codex:. Review and rescue return Codex output
verbatim: Claude does not paraphrase or act unless you ask.
codex-rescue subagent: investigate, fix, or
continue prior work. Default can write files. For diagnose-only, ask for review/research with no edits.
08Auto review gate
An opt-in safety layer. When on, the plugin runs a focused Codex review at session end against Claude's answer. Blocking findings keep the turn open so Claude can fix before finishing.
/codex:setup --enable-review-gate # Codex reviews before Claude stops each turn.
/codex:setup --disable-review-gate # Back to manual review only.
# At end of turn: 1. Claude drafts final answer 2. Codex focused review of the change 3. Blocking issues -> keep turn open, Claude continues 4. Clean -> turn ends normally
09Rescue flow
/codex:rescue routes your task to the codex-rescue subagent: a thin
prompt wrapper, one Codex call, raw output back. Nothing else auto-reads files or continues steps.
- Describe the work. Free text after the command: "investigate why X fails", "apply best fix", "port this to the new API".
-
Resume or fresh. If a Codex thread can resume, you are asked once for
--resumeor--fresh. Follow-ups like "continue" default to resume. -
Foreground or background. Small tight tasks run in front. Open-ended/long work defaults
to background — check with
/codex:status. -
Verbatim result. Codex output is unedited. Re-fetch the full saved payload later with
/codex:result.
10Model & effort
Set model and reasoning effort per run via flags, or defaults in Codex config. Flags win over config.
# model + effort for one rescue /codex:rescue --model gpt-5.4-mini --effort high fix flaky tests # 'spark' maps to gpt-5.3-codex-spark /codex:rescue --model spark investigate regression # effort: none | minimal | low | medium | high | xhigh
# .codex/config.toml (project level; repo must be trusted) model = "gpt-5.4-mini" model_reasoning_effort = "high"
# ~/.codex/config.toml (user defaults) model = "gpt-5.4-mini" model_reasoning_effort = "high"
--model and --effort empty to use Codex defaults. Rescue only
overrides when you set them.
11Job lifecycle
Background review/rescue become tracked jobs, scoped per repo. Three commands cover their lifecycle.
FAQ
- Is an OpenAI API key required?
-
Not necessarily: a ChatGPT plan works too. The plugin uses whatever the local Codex CLI is logged
into. Run
!codex logineither way. - Does review change my code?
-
No.
/codex:reviewand/codex:adversarial-reviewonly review and return verbatim findings. Only/codex:rescuecan write files — and you can still ask for diagnose-only. - review vs adversarial-review — which?
-
Use
/codex:reviewfor implementation bugs. Use/codex:adversarial-reviewto stress the approach: assumptions, trade-offs, and designs that break under real conditions. - Wait or background?
-
Without
--waitor--background, the command estimates diff size and asks. Small changes (1–2 files) often suggest wait. Larger/unclear defaults to background. - How do I continue a Codex thread outside Claude?
-
/codex:resultprints the Codex session ID. Resume that thread in the Codex CLI to keep context. - Why does rescue pick up work I did not request?
-
The
codex-rescuesubagent is used proactively when Claude is stuck or wants a second pass on a hard task. It does not snatch tiny jobs Claude can finish alone.