Codex Bridge
Call OpenAI's Codex CLI to get responses, reviews, or perform tasks.
When to Use
Activate when user says:
- "Ask Codex...", "Have Codex...", "Let Codex..."
- "Get GPT's opinion on...", "What does OpenAI think..."
- "Get a second opinion on..."
- "Have Codex review...", "Let Codex fix/refactor/implement..."
- "Compare Claude vs Codex...", "Run this through Codex..."
Quick Reference
| Flag |
When |
Example |
| (none) |
Opinions, reviews, questions, analysis |
node "$CODEX_BRIDGE" "Review this code" --working-dir "<project>" |
--full-auto |
Fix, refactor, implement, update files |
node "$CODEX_BRIDGE" "Fix errors" --full-auto --working-dir "<project>" |
--model MODEL |
Override model (default: Codex default) |
node "$CODEX_BRIDGE" "Explain" --model gpt-4o --working-dir "<project>" |
--json |
Bridge outputs raw JSON events (debugging) |
node "$CODEX_BRIDGE" "Analyze" --json --working-dir "<project>" |
--timeout MS |
Override 20-minute default timeout |
node "$CODEX_BRIDGE" "Long task" --timeout 2400000 --working-dir "<project>" |
Setup
# Resolve bridge path (one command):
CODEX_BRIDGE=$(ls -1 "$HOME/.claude/plugins/cache/saurun-marketplace/saurun/"*/skills/codex-bridge/codex-bridge.mjs 2>/dev/null | head -1)
CRITICAL: Always pass --working-dir with the project directory. Without it, Codex runs in its install location and can't access project files.
Decision Logic
| Mode |
When |
| Read-only (no flags) |
Opinion, explanation, review, comparison, questions |
--full-auto |
Modify files. Trigger words: "fix", "refactor", "implement", "update", "change" |
Handling File Reviews
When user wants Codex to review a file:
- Read the file content with the Read tool
- Include content in the prompt to Codex
node "$CODEX_BRIDGE" "Review this document for feasibility, risks, and suggestions:
---
[FILE CONTENT HERE]
---" --working-dir "/path/to/project"
Response Format
For opinions/reviews:
Codex (OpenAI) says:
[response]
For comparisons: Provide your own analysis AND Codex's response, noting differences.
For file modifications: After Codex completes, show changes with git diff.
Common Mistakes
| Mistake |
Fix |
Omitting --working-dir |
Codex can't read project files. Always pass it. |
Using --full-auto for reviews |
Read-only is safer for opinions. Only use --full-auto when user wants file changes. |
| Sending huge files as CLI args |
Bridge handles this automatically (writes to temp file for prompts >7000 chars). |
| Forgetting prerequisites |
Codex CLI must be installed (npm install -g @openai/codex) and authenticated (codex login). |
Error Handling
If the bridge fails (exit code non-zero), check:
- Codex CLI installed:
which codex (install: npm install -g @openai/codex)
- Authentication valid:
codex login
- Working directory exists and is accessible
- Timeout: increase with
--timeout MS (default: 1,200,000ms / 20 min)
1---2name: codex-bridge3description: Use when user wants to ask Codex, get GPT's opinion, get a second opinion from OpenAI, compare perspectives, have Codex review code or docs, or let Codex fix/refactor/implement something.4---5
6# Codex Bridge
7
8Call OpenAI's Codex CLI to get responses, reviews, or perform tasks.
9
10## When to Use
11
12Activate when user says:
13- "Ask Codex...", "Have Codex...", "Let Codex..."
14- "Get GPT's opinion on...", "What does OpenAI think..."
15- "Get a second opinion on..."
16- "Have Codex review...", "Let Codex fix/refactor/implement..."
17- "Compare Claude vs Codex...", "Run this through Codex..."
18
19## Quick Reference
20
21| Flag | When | Example |
22|------|------|---------|
23| _(none)_ | Opinions, reviews, questions, analysis | `node "$CODEX_BRIDGE" "Review this code" --working-dir "<project>"` |
24| `--full-auto` | Fix, refactor, implement, update files | `node "$CODEX_BRIDGE" "Fix errors" --full-auto --working-dir "<project>"` |
25| `--model MODEL` | Override model (default: Codex default) | `node "$CODEX_BRIDGE" "Explain" --model gpt-4o --working-dir "<project>"` |
26| `--json` | Bridge outputs raw JSON events (debugging) | `node "$CODEX_BRIDGE" "Analyze" --json --working-dir "<project>"` |
27| `--timeout MS` | Override 20-minute default timeout | `node "$CODEX_BRIDGE" "Long task" --timeout 2400000 --working-dir "<project>"` |
28
29## Setup
30
31```bash
32# Resolve bridge path (one command):
33CODEX_BRIDGE=$(ls -1 "$HOME/.claude/plugins/cache/saurun-marketplace/saurun/"*/skills/codex-bridge/codex-bridge.mjs 2>/dev/null | head -1)
34```
35
36**CRITICAL:** Always pass `--working-dir` with the project directory. Without it, Codex runs in its install location and can't access project files.
37
38## Decision Logic
39
40| Mode | When |
41|------|------|
42| Read-only _(no flags)_ | Opinion, explanation, review, comparison, questions |
43| `--full-auto` | Modify files. Trigger words: "fix", "refactor", "implement", "update", "change" |
44
45## Handling File Reviews
46
47When user wants Codex to review a file:
481. Read the file content with the Read tool
492. Include content in the prompt to Codex
50
51```bash
52node "$CODEX_BRIDGE" "Review this document for feasibility, risks, and suggestions:
53
54---
55[FILE CONTENT HERE]
56---" --working-dir "/path/to/project"
57```
58
59## Response Format
60
61**For opinions/reviews:**
62> **Codex (OpenAI) says:**
63> [response]
64
65**For comparisons:** Provide your own analysis AND Codex's response, noting differences.
66
67**For file modifications:** After Codex completes, show changes with `git diff`.
68
69## Common Mistakes
70
71| Mistake | Fix |
72|---------|-----|
73| Omitting `--working-dir` | Codex can't read project files. Always pass it. |
74| Using `--full-auto` for reviews | Read-only is safer for opinions. Only use `--full-auto` when user wants file changes. |
75| Sending huge files as CLI args | Bridge handles this automatically (writes to temp file for prompts >7000 chars). |
76| Forgetting prerequisites | Codex CLI must be installed (`npm install -g @openai/codex`) and authenticated (`codex login`). |
77
78## Error Handling
79
80If the bridge fails (exit code non-zero), check:
81- Codex CLI installed: `which codex` (install: `npm install -g @openai/codex`)
82- Authentication valid: `codex login`
83- Working directory exists and is accessible
84- Timeout: increase with `--timeout MS` (default: 1,200,000ms / 20 min)