Skip to content

About

Use Codex from Claude Code to review code or delegate tasks.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Codex plugin for Claude Code

Use Codex from inside Claude Code for code reviews or to delegate tasks to Codex.

Claude sends a task through a plugin on a Mac mini. Codex works on it and sends back a checkmark.

This plugin is for Claude Code users who want an easy way to start using Codex from the workflow they already have.

Note

This is a personal fork of openai/codex-plugin-cc for one Mac. When Claude starts a Codex job, Codex should behave as it does in the Codex app: the permissions, model and effort from config.toml, the newest installed Codex, a browser in your signed-in Chrome, and a chat link you can open in the app. It accepts ChatGPT sign-in only. The design is in docs/superpowers/specs/2026-11-29-codex-app-parity-design.md, and the fixes and ideas adopted from other forks and upstream pull requests are in docs/research/.

What You Get

  • /codex:review for a normal read-only Codex review
  • /codex:adversarial-review for a steerable challenge review
  • /codex:review-plan for an independent read-only review of a plan
  • /codex:worktree to list, merge, or discard isolated Codex work
  • /codex:rescue, /codex:transfer, /codex:status, /codex:result, and /codex:cancel to delegate work, hand off sessions, and manage background jobs

Requirements

  • ChatGPT subscription (incl. Free). This fork refuses to run when Codex is signed in with an API key.
    • Usage will contribute to your Codex usage limits. Learn more.
  • Node.js 18.18 or later for the plugin. The optional Chrome browser (Playwright MCP) needs Node.js 20 or later.

Install

Add the marketplace in Claude Code:

/plugin marketplace add Vitaly-A-Ivanov/codex-plugin-cc

To run the plugin straight from a local clone, so edits apply after /reload-plugins, add the clone's folder instead (for example /plugin marketplace add ~/code/codex-plugin-cc).

Install the plugin (this fork uses the marketplace name vitaliy-codex, so uninstall the official codex@openai-codex first):

/plugin install codex@vitaliy-codex

Reload plugins:

/reload-plugins

Then run:

/codex:setup

/codex:setup will tell you whether Codex is ready. If Codex is missing and npm is available, it can offer to install Codex for you.

If you prefer to install Codex yourself, use:

npm install -g @openai/codex

If Codex is installed but not logged in yet, run:

!codex login

After install, you should see:

  • the slash commands listed below
  • the codex:codex-rescue and codex:codex-reviewer subagents in /agents

One simple first run is:

/codex:review --background
/codex:status
/codex:result

Usage

/codex:review

Runs a normal Codex review on your current work. It gives you the same quality of code review as running /review inside Codex directly.

Note

Code review especially for multi-file changes might take a while. It's generally recommended to run it in the background.

Use it when you want:

  • a review of your current uncommitted changes
  • a review of your branch compared to a base branch like main

Use --base <ref> for branch review. It also supports --wait and --background. It is not steerable and does not take custom focus text. Use /codex:adversarial-review when you want to challenge a specific decision or risk area.

Examples:

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

This command is read-only and will not perform any changes. When run in the background you can use /codex:status to check on the progress and /codex:cancel to cancel the ongoing task.

/codex:adversarial-review

Runs a steerable review that questions the chosen implementation and design.

It can be used to pressure-test assumptions, tradeoffs, failure modes, and whether a different approach would have been safer or simpler.

It uses the same review target selection as /codex:review, including --base <ref> for branch review. Use --effort <level> before the focus text to set the reasoning effort for both turns. It accepts the same model-specific levels as task. It also supports --wait and --background. Unlike /codex:review, it can take extra focus text after the flags.

Use it when you want:

  • a review before shipping that challenges the direction, not just the code details
  • review focused on design choices, tradeoffs, hidden assumptions, and alternative approaches
  • pressure-testing around specific risk areas like auth, data loss, rollback, race conditions, or reliability

Examples:

/codex:adversarial-review
/codex:adversarial-review --base main challenge whether this was the right caching and retry design
/codex:adversarial-review --background look for race conditions and question the chosen approach

Codex first investigates in a read-only turn, then gives the verdict and findings in a second turn on the same thread. If the investigation fails, the command reports the error.

codex:codex-reviewer

Claude can launch a read-only review with the Agent tool.

Agent({ subagent_type: "codex:codex-reviewer", prompt: "Review the working tree with --background" })

The agent runs one companion command and returns its output verbatim. A request with focus text or a design challenge uses adversarial review. The browser is off unless requested. The agent accepts --base, --scope, --model, --cwd, and --background or --wait. Use --effort with adversarial review.

/codex:review-plan

/codex:review-plan docs/superpowers/plans/my-plan.md
/codex:review-plan --background

Codex reads the plan and the code it refers to using a fixed, read-only prompt. It reports problems, missing steps, risks, wrong assumptions and questions by plan section. The command returns the review and a Codex chat link.

If you omit the path, the command selects the most recently modified *.md in docs/superpowers/plans/ under the current folder or --cwd <folder>. Use --background to run in the background or --wait to run in the foreground. You can also pass --model, --effort, or --no-browser. Put flags before the path.

/codex:rescue

Hands a task to Codex through the codex:codex-rescue subagent.

Use it when you want Codex to:

  • investigate a bug
  • try a fix
  • continue a previous Codex task
  • take a faster or cheaper pass with a smaller model

Note

Depending on the task and the model you choose these tasks might take a long time and it's generally recommended to force the task to be in the background or move the agent to the background.

It supports --background, --wait, --resume, --resume-id <thread-id>, and --fresh. Without a resume or fresh flag, the plugin can offer to continue the latest rescue thread for this repo.

Use /codex:rescue --resume-id <thread-id> or task --resume-id <thread-id> to continue a specific Codex chat. Copy the Codex session ID from a result or status report. The flag cannot be combined with --resume, --resume-last, --fresh, or --in-app.

Put all flags before the prompt. Everything from the first word of the prompt onward is sent to Codex as written, including text such as --help or --model. An unknown flag before the prompt, such as a typo, stops the command with Unknown option: <flag>. Use --prompt-file <path> for a long brief instead of typing it on the command line.

Tasks use the sandbox and approval settings from Codex's config.toml by default. Use task --read-only in the companion CLI to prevent file changes in CLI jobs. The old --write option is accepted for compatibility and has no effect.

Use /codex:rescue --in-app or task --in-app to open a new chat with your prompt in the Codex app. Check the folder, model, effort, and permissions in the app, then press Send. Omit --read-only, --model, --effort, and the resume flags when using --in-app. The plugin tracks the chat as a background job for up to two hours. The result reports the folder the app used and warns if it differs from the requested folder.

If the app link would exceed 6,000 characters, the plugin saves the full prompt in a private file at ~/.codex-companion/handoff/<jobId>.md. The app chat asks Codex to read that file. The file stays after the job finishes.

Examples:

/codex:rescue investigate why the tests started failing
/codex:rescue fix the failing test with the smallest safe patch
/codex:rescue --resume apply the top fix from the last run
/codex:rescue --model gpt-5.4-mini --effort medium investigate the flaky integration test
/codex:rescue --model spark fix the issue quickly
/codex:rescue --background investigate the regression
/codex:rescue --in-app investigate the regression

You can also just ask for a task to be delegated to Codex:

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

Notes:

  • If you do not pass --model or --effort, Codex uses the defaults from your config.toml. Available effort levels depend on the model. Sol levels include low, medium, high, xhigh, max, and ultra.
  • Task and review results show the model and effort that actually ran, for example Model: gpt-6.2-sol (effort medium).
  • The plugin checks the local model cache for supported effort levels. When it has no list for the request, it forwards a lowercase word for Codex to validate.
  • if you say spark, the plugin maps that to gpt-5.3-codex-spark
  • follow-up rescue requests can continue the latest Codex task in the repo

Include Claude session context

Use /codex:rescue --session-context fix the login or pass the same flag to the companion's task command. The rescue agent also includes context when the request refers to earlier discussion in this session. You can omit the task text to continue from the brief.

The companion reads the active session transcript from CODEX_COMPANION_TRANSCRIPT_PATH under ~/.claude/projects. It sends conversation text with secret-looking values redacted, along with the branch and uncommitted filenames. Tool calls and results, thinking, sidechains, system reminders, and Git diffs are excluded.

Use --session-context-mode before the task text to choose what to include.

Mode What Codex receives
auto The latest compact summary and the turns since it, or recent turns if there is no summary. With a resume flag, uses recent.
summary The latest compact summary.
recent Recent turns.
full Conversation turns without the turn cap, still subject to the character cap.
none No brief.

The defaults are --session-turns 30 and --session-max-chars 49152. The brief drops older turns first and reports how many were omitted. Session context works with background tasks, isolated worktrees, prompt files, and app handoffs.

/codex:worktree

/codex:rescue --worktree fix the failing test
/codex:worktree list
/codex:worktree merge <jobId>
/codex:worktree discard <jobId> [--force]

Use /codex:rescue --worktree or task --worktree to start a new task from the current Git HEAD on branch codex/<jobId>. Codex works and commits in .worktrees/codex-<jobId> under the starting checkout. The plugin adds .worktrees/ to the repository's shared Git exclude file. The result shows the branch, worktree path, commits, and diff stat, and flags uncommitted changes.

list shows this repository's worktree jobs, the branch each one will merge into, their commit counts since the starting commit, and whether they have uncommitted changes. merge merges back into the checkout the job started from, which can be a linked worktree. It refuses if that checkout no longer exists or now has a different branch checked out. It tries a fast-forward first, falls back to a merge commit when branches diverge, and aborts on conflicts. Both checkouts must be clean. After a successful merge, the plugin removes the worktree and its branch. discard removes both and requires --force when there are uncommitted changes.

--worktree requires an existing Git commit. It cannot be combined with --in-app, --read-only, or resume flags. Automatic resume skips worktree tasks.

/codex:transfer

Creates a persistent Codex thread from the current Claude Code session and prints a codex resume <session-id> command.

Use it when you started a debugging or implementation conversation in Claude Code and want to continue that same context directly in Codex.

Examples:

/codex:transfer
/codex:transfer --source ~/.claude/projects/-Users-me-repo/<session-id>.jsonl

The plugin's existing SessionStart hook supplies the current transcript path automatically; --source is available as a manual override. The transfer uses Codex's external-agent session importer, so it follows the same conversion rules as importing Claude history in the Codex App and creates visible turns that can be continued in the App or TUI. The source must be under ~/.claude/projects, and older Codex versions that do not expose session import must be upgraded before using this command.

/codex:status

Shows running and recent Codex jobs for the current repository.

Examples:

/codex:status
/codex:status task-abc123

Use it to:

  • check progress on background work
  • see the latest completed job
  • confirm whether a task is still running

/codex:status <job-id> --wait [--timeout-ms <ms>] waits for the job to finish. If the wait times out, the command says so and exits with an error.

Background jobs keep running when the Claude session that started them ends, and any session in the same folder can check them.

/codex:result

Shows the final stored Codex output for a finished job. Task results include the Codex session ID and a codex://threads/<id> link when available.

Examples:

/codex:result
/codex:result task-abc123

/codex:cancel

Cancels an active background Codex job. The command reports cancellation after Codex confirms the interrupt or the worker process has exited. If neither can be confirmed, the command fails and shows the Codex chat link when available.

Examples:

/codex:cancel
/codex:cancel task-abc123

/codex:setup

Checks whether Codex is installed and signed in with ChatGPT, and shows which Codex program the plugin will use. If Codex is missing and npm is available, it can offer to install Codex for you.

Setup also lists every running plugin broker on the Mac (the background process that runs jobs for one folder), with its age, folder and Codex version. Run /codex:setup --stop-stale to stop brokers that have no job running.

You can also use /codex:setup to manage the optional review gate.

Connecting Chrome

Install a pinned version of Playwright MCP and the Playwright browser extension in Chrome. Save the extension token in a file outside the repository and set the file permissions to 0600. Give setup the path to the installed executable and the path to that file.

On macOS, pass --executable-path "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" to Playwright MCP, for example in a small wrapper script that you give setup as the browser command. macOS blocks processes started from Claude from reading Chrome's profile folder, and without this flag Playwright reports the extension as not installed. With a token, the extension gives Codex a new tab in the last-used Chrome profile that has the extension.

/codex:setup --browser-command /path/to/playwright-mcp --browser-token-file /path/to/private-token-file

Setup saves the browser settings in ~/.codex-companion/settings.json and shows the file path. It reports whether the browser is configured or the executable or token file needs attention. Once configured, Codex can use Playwright with your signed-in Chrome in new and resumed tasks, reviews, and stop-time reviews. This includes --read-only tasks. The browser instructions tell Codex to make changes only when the task explicitly asks for them.

Use --no-browser with /codex:rescue, task, /codex:review, or /codex:adversarial-review to skip Playwright for one job, including a resumed task. The Codex app uses its own browser settings, so --no-browser cannot be combined with --in-app.

Run /codex:setup --disable-browser to turn off the browser for future jobs.

Enabling review gate

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

When the review gate is enabled, the plugin uses a Stop hook to run a targeted Codex review based on Claude's response. If that review finds issues, the stop is blocked so Claude can address them first.

Warning

The review gate can create a long-running Claude/Codex loop and may drain usage limits quickly. Only enable it when you plan to actively monitor the session.

Typical Flows

Review Before Shipping

/codex:review

Hand A Problem To Codex

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

Start Something Long-Running

/codex:adversarial-review --background
/codex:rescue --background investigate the flaky test

Then check in with:

/codex:status
/codex:result

Codex Integration

The Codex plugin wraps the Codex app server and applies the same configuration.

It runs the newest Codex it finds among the ChatGPT app's bundled Codex, ~/.local/bin/codex and codex on PATH, so after codex update the next job uses the new version. Set CODEX_COMPANION_CODEX_BIN to pin one program. Every Codex process it starts has OPENAI_API_KEY, CODEX_API_KEY and CODEX_ACCESS_TOKEN removed, and jobs refuse to start unless Codex is signed in with ChatGPT.

Jobs share one background broker per folder. A broker stops after 30 minutes with no job (CODEX_COMPANION_BROKER_IDLE_MS), never while a job is running, and is replaced when the Codex version changes. Requests that Codex should answer quickly time out after 120 seconds (CODEX_COMPANION_REQUEST_TIMEOUT_MS); a running turn has no time limit.

Common Configurations

If you want to change the default reasoning effort or the default model that gets used by the plugin, you can define that inside your user-level or project-level config.toml. For example to always use gpt-5.4-mini on high for a specific project you can add the following to a .codex/config.toml file at the root of the directory you started Claude in:

model = "gpt-5.4-mini"
model_reasoning_effort = "high"

Your configuration will be picked up based on:

  • user-level config in ~/.codex/config.toml
  • project-level overrides in .codex/config.toml
  • project-level overrides only load when the project is trusted

Check out the Codex docs for more configuration options.

Moving The Work Over To Codex

Open the chat link in a task result to continue in the Codex app. If the app says it is open in another app, wait for the job to finish or use Branch chat. You can also run codex resume <session-id> with the ID from /codex:result or /codex:status.

FAQ

Do I need a separate Codex account for this plugin?

If you are already signed into Codex on this machine, that account should work immediately here too. This plugin uses your local Codex CLI authentication.

If you only use Claude Code today and have not used Codex yet, you will also need to sign in to Codex with a ChatGPT account. Codex is available with your ChatGPT subscription. Run /codex:setup to check whether Codex is ready, and run !codex login yourself and choose ChatGPT sign-in if it is not. This fork never signs Codex in for you.

Does the plugin use a separate Codex runtime?

No. This plugin delegates through your local Codex CLI and Codex app server on the same machine.

That means:

  • it uses the same Codex install you would use directly
  • it uses the same local authentication state
  • it uses the same repository checkout and machine-local environment

Will it use the same Codex config I already have?

Yes. If you already use Codex, the plugin picks up the same configuration.

Can I use an API key instead of ChatGPT sign-in?

No. This fork runs Codex on a ChatGPT subscription only. It removes API key variables from every Codex process it starts and refuses to run if Codex reports API key sign-in. Use the official plugin if you need API key billing.

Other config, such as openai_base_url in your Codex config, still applies.

About

Use Codex from Claude Code to review code or delegate tasks.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages