A Claude Code plugin that lets you "phone a friend" by calling OpenAI's Codex CLI for a second opinion. Supports bidirectional loops: Claude Code can call Codex, and Codex can call Claude Code back, with depth limiting to prevent infinite recursion.
- Claude Code installed
- Codex CLI installed (
npm install -g @openai/codex) - OpenAI API key configured for Codex
# From GitHub
claude plugins install --url https://github.com/orban/phone-a-friend
# From a local checkout
claude plugins install --path /path/to/phone-a-friend
# Or use --plugin-dir for session-only
claude --plugin-dir /path/to/phone-a-friend/phone-a-friend "What's the best way to handle concurrent writes to this database?"
/phone-a-friend "Review this error and suggest fixes" --mode critique
/phone-a-friend "Is this migration safe?" --mode verify
/phone-a-friend "What other approaches should I consider?" --mode explore
/phone-a-friend --input-file /tmp/diff.txt --mode critique
Claude Code will automatically recognize when a second opinion would help and offer to phone Codex.
Claude Code asks Codex, Codex asks Claude back:
You: /phone-a-friend "Is this SQL query optimal for 10M rows?"
Claude Code → Codex: "Analyze this SQL query for performance at 10M rows: SELECT ..."
Codex → Claude (if needed): "What indexes exist on this table?"
Claude → back to Codex: "The table has indexes on id, created_at, and user_id"
Codex → final answer back to Claude Code
Claude Code: synthesizes both perspectives for you
| Environment Variable | Default | Purpose |
|---|---|---|
PHONE_A_FRIEND_DEPTH |
0 | Current loop depth (managed automatically) |
PHONE_A_FRIEND_MAX_DEPTH |
3 | Max depth (inherited by child hops) |
PHONE_A_FRIEND_CHAIN |
(auto) | Call chain trace, e.g. claude>codex>claude |
| Flag | Default | Purpose |
|---|---|---|
--mode |
(general) | explore, critique, verify, or omit |
--input-file |
— | Attach file content (diffs, code, logs) |
--model |
(codex default) | Override Codex model |
--max-depth |
3 | Maximum cc<->codex loop depth |
--timeout |
120 | Seconds before killing a hung call |
--working-dir |
$(pwd) |
Codex working directory |
Depth 0: Claude Code (this session)
│
├─ Runs: call-codex.sh "prompt"
│
Depth 1: Codex processes request
│ │
│ ├─ (optional) Runs: call-claude.sh "sub-question"
│ │
│ Depth 2: Claude Code answers sub-question
│ │
│ └─ (optional) Runs call-codex.sh again if depth < max
│
└─ Returns synthesized response
All hops go through the helper scripts, which enforce depth limits, timeouts, call-chain tracking, and proper error handling.
The scripts/call-claude.sh script is included for Codex to call Claude Code back. Codex receives instructions in its prompt about how to use it.
phone-a-friend/
commands/
phone-a-friend.md # /phone-a-friend slash command
skills/
phone-a-friend/
SKILL.md # Auto-detected skill
scripts/
call-codex.sh # Claude Code → Codex
call-claude.sh # Codex → Claude Code (reverse)
README.md