| name | connect-codex |
| description | Use when the user wants to wire OpenAI Codex CLI into Claude Code as a second-brain reviewer / adversarial critic / rescue sub-agent. Triggers on "подключи кодекс", "поставь codex в claude code", "связка claude+codex", "настрой codex", "install codex plugin", "connect codex to claude code", "set up codex cli". Installs Codex CLI, authenticates via ChatGPT subscription, adds the official `codex@openai-codex` plugin, and exposes `/codex:*` slash commands inside Claude Code. |
Connect Codex to Claude Code
Goal: stand up the official OpenAI Codex CLI as a sub-agent inside Claude Code so the user gets /codex:review, /codex:adversarial-review, /codex:rescue, /codex:status, /codex:result, /codex:cancel, and /codex:setup slash commands. Codex acts as a second AI agent for diff review, devil's-advocate critique, and delegated rescue tasks. Authentication uses a ChatGPT Plus/Pro/Business subscription, not an API key.
When NOT to invoke
- User only wants the Codex CLI on its own (no Claude Code integration) — install
brew install codex and stop.
- User is on a free ChatGPT plan — Codex quota is gated by paid subscription, do not proceed.
- Plugin already installed (
/codex:status works) — skip to verification.
- User wants a UI / visual review agent — Codex is for tests, lint, and architecture; it does not see rendered pages.
Requirements
- Codex CLI ≥ 0.125.0 (Homebrew or npm)
- ChatGPT Plus, Pro, or Business subscription (Codex auth uses the subscription, not an API key)
- Claude Code installed and running
- macOS or Linux with
brew or npm available
- Active browser session for OAuth on the correct ChatGPT account
Process
1. Install Codex CLI
brew install codex
codex --version
Confirm output reports >= 0.125.0. If lower, run brew upgrade codex.
2. Authenticate Codex against ChatGPT
codex login
The browser opens an OAuth flow. Sign into the ChatGPT account that holds the Plus/Pro/Business subscription. Tokens are written to ~/.codex/auth.json. Verify:
codex whoami
3. Add the OpenAI plugin marketplace inside Claude Code
In a running Claude Code session:
/plugin marketplace add openai/codex-plugin-cc
4. Install the plugin
/plugin install codex@openai-codex
This writes the entry to ~/.claude/settings.json under enabledPlugins at user scope, so the plugin is active in every project.
5. Restart Claude Code
Slash commands do not register until Claude Code restarts. Fully quit and relaunch.
6. Verify
In Claude Code, run:
/codex:status
Expected: Codex reports available, no background jobs. Smoke-test with /codex:review on a current diff.
Resulting slash commands
/codex:review — read-only review of the current diff
/codex:adversarial-review — devil's-advocate critique (paste the plan text inline)
/codex:rescue — delegate a task to Codex as a sub-agent
/codex:status — list background Codex jobs
/codex:result — fetch the result of a completed job
/codex:cancel — cancel a running job
/codex:setup — re-authenticate
Anti-patterns
- Skipping the Claude Code restart after
/plugin install — slash commands stay invisible.
- Running
codex login while a different ChatGPT account is logged into the browser — OAuth hangs or grants wrong quota.
- Letting
~/.codex/auth.json expire — symptoms look like "not authenticated"; rerun codex login.
- Trying to use Codex on a free ChatGPT plan — no quota, every call fails.
- Asking Codex to verify UI / visual bugs — it reviews code, tests, and architecture only.