From codex-bridge
Delegate tasks to OpenAI Codex CLI via tmux. Use when the user asks to use Codex, says "have Codex do this", "ask Codex to", or invokes /codex. Claude acts as an expert prompter, monitors the session, and auto-reviews code output.
How this skill is triggered — by the user, by Claude, or both
Slash command
/codex-bridge:codexThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Delegate tasks to OpenAI Codex CLI running in a **tmux session**. Codex ALWAYS runs inside tmux — never directly. You are the expert prompter — you construct rich context, send it to Codex as a capable teammate, monitor the tmux session, and review the results.
Delegate tasks to OpenAI Codex CLI running in a tmux session. Codex ALWAYS runs inside tmux — never directly. You are the expert prompter — you construct rich context, send it to Codex as a capable teammate, monitor the tmux session, and review the results.
<EXTREMELY_IMPORTANT>
Codex runs inside tmux. Always. No exceptions.
You MUST:
You MUST NOT:
which codex, command -v codex, npm list, or any other binary detectionIf you are about to do the work yourself instead of delegating to Codex: STOP. That defeats the entire purpose of this skill.
</EXTREMELY_IMPORTANT>
/codex <task>The shell helper script is at ${CLAUDE_PLUGIN_ROOT}/scripts/codex-bridge.sh.
If ${CLAUDE_PLUGIN_ROOT} is not set, find the script:
find ~/.claude/plugins/cache -name "codex-bridge.sh" -path "*/scripts/*" 2>/dev/null | head -1
Store the result and use it for all subsequent commands. Do NOT run tmux commands directly — always go through the script.
Follow these steps IN ORDER. Do not skip steps. Do not combine steps.
SCRIPT="${CLAUDE_PLUGIN_ROOT}/scripts/codex-bridge.sh"
SESSION=$(bash "$SCRIPT" start)
This creates a tmux session, launches codex --yolo inside it, and handles startup prompts (trust, updates). It returns a session name like codex-session-7781.
If this fails, relay the error to the user and STOP. Do NOT fall back to doing the work yourself.
Immediately tell the user (before doing anything else):
Codex session started:
codex-session-XXXXWatch live:tmux attach -t codex-session-XXXX
Before sending anything to Codex, build a structured prompt. Codex starts with ZERO context each session — you must provide everything it needs to succeed.
Prompt template:
[CONTEXT]
- Working directory: <absolute path>
- Relevant files: <list exact file paths Codex needs>
- Recent changes: <brief summary if relevant>
- Project conventions: <patterns, naming, style>
[TASK]
<Clear, specific description. State what "done" looks like.>
[CONSTRAINTS]
- <Boundaries: don't modify X, use Y pattern, etc.>
Prompting principles — you are an expert prompter:
bash "$SCRIPT" send "$SESSION" "<your constructed prompt>"
The send command includes a built-in 5-second delay after submission. Do NOT poll immediately after calling send — the delay is handled internally.
Use the wait command — it handles all polling robustly. It requires two consecutive stable "ready" polls to prevent false positives during brief gaps between Codex work phases.
RESULT=$(bash "$SCRIPT" wait "$SESSION" 300)
ready when Codex is truly done (two consecutive stable polls).timeout after 300 seconds (5 minutes). You can pass a different timeout as the third argument.bash "$SCRIPT" abort "$SESSION"wait again with a new timeout.This is a blocking call. It will take at least 10 seconds to return "ready" (two polls at 5s intervals). This is by design — it prevents false positives.
OUTPUT=$(bash "$SCRIPT" capture "$SESSION")
Read the output carefully. Understand what Codex did. Look for:
› prompt line where your message was)• Ran)For code tasks (Codex created or modified files):
git status and git diff to identify what changedcode-simplifier agent — to simplify Codex's outputfeature-dev:code-reviewer agent — to review for bugs, logic errors, securityFor ideation/discussion tasks (no file changes):
bash "$SCRIPT" teardown "$SESSION"
Tell the user: Session log saved to .codex-logs/<SESSION>.log
On first run, check if .codex-logs/ is in the project's .gitignore. If not, add it.
| Situation | Action |
|---|---|
start fails | Tell user the error, STOP. Do NOT do the work yourself. |
wait returns timeout | Ask user: abort or keep waiting? |
| Codex errors (Traceback, Error:) in captured output | Report error snippet, save log, teardown |
| Captured output shows no response to your prompt | The prompt may not have submitted. Send another Enter and wait again. |
| Output looks wrong or incomplete | Warn user, provide log path for manual inspection |
NEVER bail and do the work yourself. If Codex fails, report the failure to the user and let them decide next steps.
Script not found at ${CLAUDE_PLUGIN_ROOT} — Use the find command: find ~/.claude/plugins/cache -name "codex-bridge.sh" -path "*/scripts/*" 2>/dev/null | head -1
start fails — Codex runs inside tmux which inherits the user's login shell. Ask the user to verify codex --version works in their terminal.
wait returns timeout — Codex may still be working on a long task. Ask the user if they want to abort or extend the timeout. Do NOT tear down the session without asking.
Prompt wasn't submitted — If captured output shows your prompt text in the input line without a Codex response below it, submit it: tmux send-keys -t "$SESSION" Enter
npx claudepluginhub madd86/codex-bridge --plugin codex-bridgeDelegates coding tasks (debug, implement, refactor) to OpenAI Codex CLI via codex exec, skipping the Node companion runtime for faster execution. Codex writes code; Claude verifies.
Delegates complex code generation, refactoring, architectural analysis, and review tasks to OpenAI's Codex CLI (GPT-5.3-codex models) via safe workflows with sandboxing and approvals. Activates on explicit triggers like 'use codex' or 'codex exec'.
Leverages OpenAI Codex/GPT models for autonomous code implementation, reviews, and sandboxed task execution. Triggers on 'codex', 'use gpt', 'full-auto' etc.