From codex-collab
This skill should be used when the user asks to "collaborate with Codex", "use Codex for planning", "get Codex review", "delegate to Codex", "code review", "PR review", "review this code", "review this PR", "Codexと協調", "Codexにレビュー", "Codexに計画を作成させたい", "Codexに任せる", "Codexに委任", "Codexと連携", "Codexに相談", "Codexの意見", "Claude plans", "Claude-led", "Claudeが計画", "Claude主導", "Codexに実装させる", "Codexに実装を任せる", "Claudeがレビュー", "コードレビューして", "PRをレビューして", "コードをレビューして", "このコードをレビュー", or mentions coordinating tasks between Claude Code and Codex CLI. NOTE: This is the default skill for generic code/PR review requests. Use devils-advocate only when the user explicitly asks for adversarial/red-team critique of a design or proposal.
npx claudepluginhub masup9/codex-collab --plugin codex-collabThis skill uses the workspace's default tool permissions.
Coordinate tasks between Claude Code and OpenAI Codex CLI using adaptive workflow selection based on model strengths.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Guides building MCP servers enabling LLMs to interact with external services via tools. Covers best practices, TypeScript/Node (MCP SDK), Python (FastMCP).
Generates original PNG/PDF visual art via design philosophy manifestos for posters, graphics, and static designs on user request.
Coordinate tasks between Claude Code and OpenAI Codex CLI using adaptive workflow selection based on model strengths.
This skill enables effective collaboration between two AI systems with two workflow modes:
Codex-Leads (従来):
Claude-Leads (新規):
デフォルト(auto)は常に Codex-Leads を選択。claude-leads は workflow: claude-leads を明示指定した場合のみ有効。
通信方式: MCP primary + Bash fallback のデュアルモード。
mcp__codex__codex/codex-reply): ステートフルな会話(threadId で文脈保持)。ANSI 除去不要、ファイル I/O 不要。codex exec/codex review): ステートレス実行。codex_run_exec() が入出力、ANSI 除去、exit code ハンドリングを統合処理。MCP 未設定時の自動フォールバック。Before starting collaboration:
mcp__codex__codex with a lightweight probe. If available → MCP mode.codex CLI is available: which codex or codex --versioncodex exec works (Bash mode): codex exec -s read-only - <<< "test".claude/codex-collab.local.mdWhen receiving a task for collaboration:
Parse the task description to identify:
Gather relevant context:
MCP mode (primary):
mcp__codex__codex(prompt: "[planning prompt]", sandbox: "read-only")
→ Returns response + threadId (saved for Phase 4)
Bash mode (fallback):
source scripts/codex-helpers.sh
PROMPT_FILE=$(codex_write_prompt "$PLANNING_PROMPT" "plan")
OUTPUT_FILE="$(codex_tmp_path 'codex-plan-output.md')"
codex_run_exec "$PROMPT_FILE" "$OUTPUT_FILE" "read-only"
Read results from tool response (MCP) or output file (Bash).
After receiving Codex's plan:
After implementation:
git add -A
git reset -- tmp/ 2>/dev/null || true
Why? Staging ensures all changes are visible to Codex regardless of its file discovery method.
MCP mode (primary):
# Get diff, embed in prompt, continue same thread from Phase 2
mcp__codex__codex-reply(threadId: "[from Phase 2]", prompt: "[review prompt with diff]")
→ Parse verdict directly from response (no codex_infer_verdict needed)
Bash mode (fallback):
source scripts/codex-helpers.sh
REVIEW_OUTPUT="$(codex_tmp_path 'codex-review-output.md')"
codex_run_review "$REVIEW_OUTPUT" "$MODEL" || REVIEW_EXIT=$?
if [ "${REVIEW_EXIT:-0}" -ne 0 ]; then
REVIEW_PROMPT_FILE=$(codex_write_prompt "$REVIEW_PROMPT" "review")
codex_run_exec "$REVIEW_PROMPT_FILE" "$REVIEW_OUTPUT" "read-only"
fi
RESPONSE=$(cat "$REVIEW_OUTPUT")
VERDICT=$(codex_infer_verdict "$RESPONSE") || true
FINDINGS=$(codex_extract_review_findings "$RESPONSE")
The review uses [P1]-[P4] priority markers as the primary source for verdict inference:
[P1]/[P2] → fail[P3]/[P4] → conditionalverdict: pass/conditional/fail) is also supported as an alternativeBased on review verdict:
Pass: Report completion to user
Conditional:
Fail:
Check for .claude/codex-collab.local.md in project root:
---
model: o4-mini
sandbox: read-only
---
# Project-specific instructions
Parse YAML frontmatter for:
model: Codex model to usesandbox: read-only | workspace-write | danger-full-accessworkflow: Workflow mode (auto | codex-leads | claude-leads, default: auto; auto は常に codex-leads を選択)exchange.enabled: Enable planning exchange (default: true, codex-leads only)exchange.max_iterations: Maximum rounds for multi-turn exchange (default: 3)exchange.user_confirm: When to ask user confirmation (never | always | on_important)exchange.history_mode: How to handle history (full | summarize)review.enabled: Enable review iteration (default: true, codex-leads only)review.max_iterations: Maximum rounds for review iteration (default: 5)review.user_confirm: When to ask user confirmation for reviews (default: never)claude_leads.sandbox: Sandbox for Codex implementation (default: workspace-write)claude_leads.consult_codex: Enable plan consultation phase (default: true)claude_leads.safety_checkpoint: Pre-implementation checkpoint (stash | wip-commit | none, default: stash)claude_leads.review.max_iterations: Max review-fix iterations (default: 3)Apply settings in this order (later overrides earlier):
Always start with secure defaults:
workflow: auto - 常に codex-leads を選択(claude-leads は明示指定時のみ)sandbox: read-only - Codex cannot modify files (codex-leads)exchange.enabled: true - Planning exchange enabled by defaultexchange.max_iterations: 3 - Prevent runaway exchangesexchange.user_confirm: on_important - Ask user for major decisionsexchange.history_mode: summarize - Efficient token usagereview.enabled: true - Review iteration enabled by defaultreview.max_iterations: 5 - More iterations allowed (goal is clear, diff is small)review.user_confirm: never - Auto-iterate without confirmationclaude_leads.sandbox: workspace-write - Codex can modify project files (claude-leads)claude_leads.consult_codex: true - Plan consultation enabledclaude_leads.safety_checkpoint: stash - Git stash before implementationclaude_leads.review.max_iterations: 3 - Claude review iterationsA valid plan from Codex must include:
If plan is incomplete, request clarification from Codex.
Accept review as "Pass" only when:
MCP ツールが利用可能な場合、ステートフルな通信を使用:
# 新規セッション開始
mcp__codex__codex(prompt: "...", sandbox: "read-only")
→ Returns response + threadId
# 同一スレッドで継続
mcp__codex__codex-reply(threadId: "...", prompt: "...")
→ Returns response (conversation context preserved)
MCP が利用できない場合、codex exec(ステートレス実行)を使用:
# ヘルパー関数を使用(推奨)
source scripts/codex-helpers.sh
PROMPT_FILE=$(codex_write_prompt "$PROMPT_CONTENT" "plan")
OUTPUT_FILE="$(codex_tmp_path 'codex-output.md')"
codex_run_exec "$PROMPT_FILE" "$OUTPUT_FILE" "read-only" "o4-mini"
# 直接実行
codex exec -s read-only -m o4-mini - < prompt.txt 2>&1 | tee output.md
-m, --model <model> - Specify model (e.g., o4-mini, o3)-s, --sandbox <mode> - read-only | workspace-write | danger-full-access-C, --cd <dir> - Working directory--full-auto - Automatic execution mode- - Read prompt from stdincodex exec call is stateless (no conversation history between calls). Include all necessary context in each prompt.-s read-only for planning/review tasks (Codex won't modify files)-s workspace-write for implementation tasks (claude-leads workflow)codex_strip_ansi() or codex_run_exec() to cleancodex exec - < file) for reliable inputrun_in_background: true) require pre-approved Bash permissions in ~/.claude/settings.json or .claude/settings.json. Without pre-approval, Bash tool calls are auto-denied because permission prompts are unavailable in background mode.If codex command is not found:
If codex exec returns non-zero exit code or times out:
Bash tool has max 600s (10 minutes) timeout. For long-running tasks:
codex.wait_timeout settingrun_in_background: true for background executionThis plugin uses a minimal protocol header to enable structured communication between Claude Code and Codex CLI.
Every prompt to Codex includes a ~15-line protocol header:
## Protocol (codex-collab/v1)
format: yaml
rules:
- respond with exactly one top-level YAML mapping
- include required fields: type, id, status, body
- if unsure or blocked, use type=action_request with clarifying questions
types:
task_card: {body: title, context, requirements, acceptance_criteria, proposed_steps, risks, test_considerations}
result_report: {body: summary, changes, tests, risks, checks}
action_request: {body: question, options, expected_response}
review: {body: verdict, summary, findings, suggestions}
status: [ok, partial, blocked]
verdict: [pass, conditional, fail]
severity: [low, medium, high]
next_action: [continue, stop]
| Type | Purpose | Used By |
|---|---|---|
task_card | Task definition with acceptance criteria | Codex (planning) |
result_report | Execution results with check status | Claude (reporting) |
action_request | Request for information or decision | Both |
review | Review verdict and findings | Codex (review) |
The protocol supports two independent iteration modes:
exchange.*)Iterative discussion during planning phase:
Flow Control:
next_action: continue - Request further exchangenext_action: stop - Exchange completetype: action_request - Implies next_action: continueSettings:
exchange.enabled: true - Global kill-switchexchange.max_iterations: 3 - Max roundsexchange.user_confirm: on_important - User confirmation timingexchange.history_mode: summarize - History managementTermination Conditions:
next_action: stop receivedexchange.max_iterations reachedreview.*)Auto-iterate on review findings:
Flow:
Settings:
review.enabled: true - Enable auto-iterationreview.max_iterations: 5 - Higher than exchange (goal is clear, diff is small)review.user_confirm: never - Auto-iterate without confirmationNote: exchange.* and review.* are completely independent (no inheritance).
Detailed documentation in references/:
protocol-cheatsheet.yaml - Minimal protocol header for promptsprotocol-schema.yaml - Full protocol schema with examplesplanning-prompt.md - Template for requesting plansreview-prompt.md - Template for requesting reviewscodex-options.md - Codex CLI configuration optionsworkflow-patterns.md - Alternative workflow patterns