Codex Orchestrator
Spawn specialized Codex CLI subagents for focused development tasks. Each profile injects a custom AGENTS.md persona that shapes the agent's behavior, focus areas, and output format.
Architecture
Claude Code (orchestrator)
↓ invokes skill
codex-orchestrator scripts
↓ spawns via Bash
Codex CLI with AGENTS.md
↓ executes
Specialized subagent task
Prerequisites
Verify Codex CLI is installed and configured:
~/.claude/skills/codex-orchestrator/scripts/codex-status.sh
Required:
- Codex CLI:
npm install -g @openai/codex - API Key:
export OPENAI_API_KEY=sk-...
Auto-Update
The skill automatically checks for Codex CLI updates on each invocation and updates if needed. This prevents issues caused by outdated CLI versions.
To manually check/update:
# Check version only
~/.claude/skills/codex-orchestrator/scripts/codex-version-check.sh
# Check and auto-update if needed
~/.claude/skills/codex-orchestrator/scripts/codex-version-check.sh --auto-update
Available Profiles
| Profile | Purpose | Use When | |---------|---------|----------| | reviewer | Code quality, bugs, performance | Pre-commit review, PR assessment | | debugger | Root cause analysis, fixes | Investigating bugs, tracing issues | | architect | System design, component boundaries | Planning changes, evaluating architecture | | security | OWASP, vulnerabilities, secrets | Security audits, compliance checks | | refactor | Code cleanup, modernization | Reducing tech debt, improving structure | | docs | API docs, READMEs, comments | Documentation tasks | | planner | ExecPlan design documents | Multi-hour tasks, complex features, significant refactors | | syseng | Infrastructure, DevOps, CI/CD, monitoring | Deployment, containers, observability, production ops | | builder | Greenfield implementation, new features | Creating new code from specs, incremental feature development | | researcher | Read-only Q&A, codebase analysis | Questions, analysis, comparisons (no file changes) | | adjudicator | Read-only comparative evidence weighing | Ambiguous hypotheses, rival interpretations, corpus comparisons, sign-value adjudication | | chat | Open-ended conversation | General questions, brainstorming, discussion (read-only, ephemeral) | | goal | Goal specification for /goal runs | Drafting structured objectives for autonomous multi-hour Codex sessions |
Quick Execution
Execute a one-shot task with a specific profile:
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh <profile> "<prompt>"
Examples:
# Code review
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh reviewer "Review src/auth.ts for security issues"
# Debug investigation
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh debugger "Debug the login timeout on slow networks"
# Architecture design
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh architect "Design a caching layer for the API"
# Security audit
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh security "Audit the payment module for vulnerabilities"
# Write profiles auto-approve by default (uses -a never + --sandbox workspace-write)
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh reviewer "Fix all lint errors"
# Create execution plan for complex feature
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh planner "Create an ExecPlan for adding WebSocket support"
# Build new feature from spec
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh builder "Implement user authentication with JWT"
# Continue from previous builder session
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh builder "continue"
# Open-ended conversation (read-only, ephemeral, gpt-5.4 via subscription)
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh chat "What are the tradeoffs of event sourcing vs CRUD?"
# Conversation via API billing (gpt-5.5, bypasses Codex subscription)
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh chat "Explain quantum error correction" --api --model gpt-5.5
# Multi-turn API chat with session file
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh chat "What is the tallest mountain?" --api --session /tmp/chat.json
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh chat "And the deepest ocean?" --api --session /tmp/chat.json
# Streaming API response
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh chat "Tell me about CQRS" --api --model gpt-5.5 --stream
# Ask a question about the codebase (read-only, no file changes)
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh researcher "Explain the authentication flow in this project"
# Weigh rival hypotheses or ambiguous evidence (read-only, high reasoning)
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh adjudicator "With Linear B and Linear A inscriptions side-by-side, weigh candidate values for the missing sound and rank the hypotheses."
# Research with Exa web search (injects Exa guide into AGENTS.md)
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh researcher "What are the latest React Server Component patterns?" --web-search
# Research with native Codex web search (model-level tool, works in all sandboxes)
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh researcher "What are the latest React patterns?" --search
# Review a screenshot (vision input)
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh reviewer "Review this mockup for UX issues" --image screenshot.png
# Resume previous builder session
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh builder "continue" --resume
# JSONL output for structured capture
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh researcher "What is 2+2?" --json | head -5
Session Management
For more control, use the Python session manager:
# List available profiles
python3 ~/.claude/skills/codex-orchestrator/scripts/codex-session.py list
# Start non-interactive session
python3 ~/.claude/skills/codex-orchestrator/scripts/codex-session.py start debugger "Trace the null pointer in UserService"
# Start interactive session
python3 ~/.claude/skills/codex-orchestrator/scripts/codex-session.py interactive architect
# Show profile details
python3 ~/.claude/skills/codex-orchestrator/scripts/codex-session.py info security
Profile Selection Guide
Review Tasks
- reviewer for general code quality and bugs
- security for vulnerability-focused review
- refactor for cleanup opportunities
Investigation Tasks
- debugger for bug investigation
- architect for understanding system behavior
- researcher for questions and analysis (read-only, no changes)
- adjudicator for weighing rival hypotheses, ambiguous evidence, and corpus-level comparisons (read-only, high reasoning)
- chat for open-ended conversation and brainstorming (read-only, ephemeral)
Creation Tasks
- architect for design decisions
- builder for new feature implementation
- docs for documentation
- refactor for implementation improvements
- planner for multi-hour implementation plans
- goal for autonomous /goal objective specifications
Chaining Patterns
Review → Debug → Fix
# 1. Identify issues
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh reviewer "Review src/api/ for bugs"
# 2. Investigate specific bug
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh debugger "Debug the race condition found in cache.ts"
Planner → Architect → Builder
# 1. Create comprehensive ExecPlan
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh planner "Create ExecPlan for new authentication system"
# 2. Validate architecture
~/.claude/skills/codex-orchestrator/scripts/codex-exec.sh architect "Review the auth system ExecPlan for design issues"
# 3. Build (plan guides implementation)
~/.claude/skills/codex-orchestrator/scrip