codex-team
Use when you have 2+ tasks that Codex agents should execute. Runtime-native: Codex sub-agents when available, Codex CLI fallback otherwise. Handles file conflicts via merge/wave strategies. Triggers: "codex team", "spawn codex", "codex agents", "use codex for", "codex fix".
Best use case
codex-team is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Use when you have 2+ tasks that Codex agents should execute. Runtime-native: Codex sub-agents when available, Codex CLI fallback otherwise. Handles file conflicts via merge/wave strategies. Triggers: "codex team", "spawn codex", "codex agents", "use codex for", "codex fix".
Teams using codex-team should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/codex-team/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How codex-team Compares
| Feature / Agent | codex-team | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Use when you have 2+ tasks that Codex agents should execute. Runtime-native: Codex sub-agents when available, Codex CLI fallback otherwise. Handles file conflicts via merge/wave strategies. Triggers: "codex team", "spawn codex", "codex agents", "use codex for", "codex fix".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
SKILL.md Source
# Codex Team
The lead orchestrates, Codex agents execute. Each agent gets one focused task. The team lead prevents file conflicts before spawning — the orchestrator IS the lock manager.
For Claude-runtime feature compatibility (agents/hooks/worktree/settings), use `../shared/references/claude-code-latest-features.md` when this skill falls back to `/swarm`.
## When to Use
- You have 2+ tasks (bug fixes, implementations, refactors)
- Tasks are well-scoped with clear instructions
- You want Codex execution with predictable isolation
- You may be in Claude or Codex runtime (skill auto-selects backend)
**Don't use when:** Tasks need tight shared-state coordination. Use `/swarm` for dependency-heavy wave orchestration.
## Backend Selection (MANDATORY)
Select backend in this order:
1. `spawn_agent` available -> **Codex experimental sub-agents** (preferred)
2. Codex CLI available -> **Codex CLI via Bash** (`codex exec ...`)
3. `skill` tool is read-only (OpenCode) -> **OpenCode subagents** — `task(subagent_type="general", prompt="<task prompt>")`
4. None of the above -> fall back to `/swarm`
## Pre-Flight (CLI backend only)
```
# REQUIRED before spawning with Codex CLI backend
if ! which codex > /dev/null 2>&1; then
echo "Codex CLI not found. Install: npm i -g @openai/codex"
# Fallback: use /swarm
fi
# Model availability test
CODEX_MODEL="${CODEX_MODEL:-gpt-5.3-codex}"
if ! codex exec --full-auto -m "$CODEX_MODEL" -C "$(pwd)" "echo ok" > /dev/null 2>&1; then
echo "Codex model $CODEX_MODEL unavailable. Falling back to /swarm."
fi
```
## Canonical Command
```bash
codex exec --full-auto -m "gpt-5.3-codex" -C "$(pwd)" -o <output-file> "<prompt>"
```
Flag order: `--full-auto` -> `-m` -> `-C` -> `-o` -> prompt. Always this order.
**Valid flags:** `--full-auto`, `-m`, `-C`, `-o`, `--json`, `--output-schema`, `--add-dir`, `-s`
**DO NOT USE:** `-q`, `--quiet` (don't exist)
## Cross-Project Tasks
When tasks span multiple repos/directories, use `--add-dir` to grant access:
```bash
codex exec --full-auto -m gpt-5.3-codex -C "$(pwd)" --add-dir /path/to/other/repo -o output.md "prompt"
```
The `--add-dir` flag is repeatable for multiple additional directories.
## Progress Monitoring (optional)
Add `--json` to stream JSONL events to stdout for real-time monitoring:
```bash
codex exec --full-auto --json -m gpt-5.3-codex -C "$(pwd)" -o output.md "prompt" 2>/dev/null
```
Key events:
- `turn.started` / `turn.completed` — track progress
- `turn.completed` includes token `usage` field
- No events for 60s → agent likely stuck
## Sandbox Levels
Use `-s` to control the sandbox:
| Level | Flag | Use When |
|-------|------|----------|
| Read-only | `-s read-only` | Judges, reviewers (no file writes needed) |
| Workspace write | `-s workspace-write` | Default with `--full-auto` |
| Full access | `-s danger-full-access` | Only in externally sandboxed environments |
For code review and analysis tasks, prefer `-s read-only` over `--full-auto`.
## Execution
### Step 1: Define Tasks
Break work into focused tasks. Each task = one Codex agent (unless merged).
### Step 2: Analyze File Targets (REQUIRED)
**Before spawning, identify which files each task will edit.** Codex agents are headless — they can't negotiate locks or wait turns. All conflict prevention happens here.
For each task, list the target files. Then apply the right strategy:
| File Overlap | Strategy | Action |
|-------------|----------|--------|
| All tasks touch same file | **Merge** | Combine into 1 agent with all fixes |
| Some tasks share files | **Multi-wave** | Shared-file tasks go sequential across waves |
| No overlap | **Parallel** | Spawn all agents at once |
```
# Decision logic (team lead performs this mentally):
tasks = [
{name: "fix spec_path", files: ["cmd/zeus.go"]},
{name: "remove beads field", files: ["cmd/zeus.go"]},
{name: "fix dispatch counter", files: ["cmd/zeus.go"]},
]
# All touch zeus.go → MERGE into 1 agent
```
```
tasks = [
{name: "fix auth bug", files: ["pkg/auth.go"]},
{name: "add rate limiting", files: ["pkg/auth.go", "pkg/middleware.go"]},
{name: "update config", files: ["internal/config.go"]},
]
# Task 1 and 2 share auth.go → MULTI-WAVE (1+3 parallel, then 2)
# Task 3 is independent → runs in Wave 1 alongside Task 1
```
```
tasks = [
{name: "fix auth", files: ["pkg/auth.go"]},
{name: "fix config", files: ["internal/config.go"]},
{name: "fix logging", files: ["pkg/log.go"]},
]
# No overlap → PARALLEL (all 3 at once)
```
### Step 3: Spawn Agents
**Strategy: Parallel (no file overlap)**
Codex sub-agent backend (preferred):
```
spawn_agent(message="Fix the null check in pkg/auth.go:validateToken around line 89...")
spawn_agent(message="Add timeout field to internal/config.go:Config struct...")
spawn_agent(message="Fix log rotation in pkg/log.go:rotateLogFile...")
```
Codex CLI backend:
```
Bash(command='codex exec --full-auto -m "gpt-5.3-codex" -C "$(pwd)" -o .agents/codex-team/auth-fix.md "Fix the null check in pkg/auth.go:validateToken around line 89..."', run_in_background=true)
Bash(command='codex exec --full-auto -m "gpt-5.3-codex" -C "$(pwd)" -o .agents/codex-team/config-fix.md "Add timeout field to internal/config.go:Config struct..."', run_in_background=true)
Bash(command='codex exec --full-auto -m "gpt-5.3-codex" -C "$(pwd)" -o .agents/codex-team/logging-fix.md "Fix log rotation in pkg/log.go:rotateLogFile..."', run_in_background=true)
```
**Strategy: Merge (same file)**
Combine all fixes into a single agent prompt:
```
spawn_agent(message="Fix these 3 issues in cmd/zeus.go: (1) rename spec_path to spec_location in QUEST_REQUEST payload (2) remove beads field (3) fix dispatch counter increment location")
# CLI equivalent:
Bash(command='codex exec --full-auto -m "gpt-5.3-codex" -C "$(pwd)" -o .agents/codex-team/zeus-fixes.md \
"Fix these 3 issues in cmd/zeus.go: \
(1) Line 245: rename spec_path to spec_location in QUEST_REQUEST payload \
(2) Line 250: remove the spurious beads field from the payload \
(3) Line 196: fix dispatch counter — increment inside the loop, not outside"', run_in_background=true)
```
One agent, one file, no conflicts possible.
**Strategy: Multi-wave (partial overlap)**
```
# Wave 1: non-overlapping tasks (sub-agent backend)
spawn_agent(message='Fix null check in pkg/auth.go:89...')
spawn_agent(message='Add timeout to internal/config.go...')
# Wait for Wave 1 (sub-agent backend)
wait(ids=["<id-1>", "<id-2>"], timeout_ms=120000)
# Wave 1: non-overlapping tasks (CLI backend)
Bash(command='codex exec ... -o .agents/codex-team/auth-fix.md "Fix null check in pkg/auth.go:89..."', run_in_background=true)
Bash(command='codex exec ... -o .agents/codex-team/config-fix.md "Add timeout to internal/config.go..."', run_in_background=true)
# Wait for Wave 1
TaskOutput(task_id="<id-1>", block=true, timeout=120000)
TaskOutput(task_id="<id-2>", block=true, timeout=120000)
# Read Wave 1 results — understand what changed
Read(.agents/codex-team/auth-fix.md)
git diff pkg/auth.go
# Wave 2: task that shares files with Wave 1 (sub-agent backend)
spawn_agent(message='Add rate limiting to pkg/auth.go and pkg/middleware.go. Note: validateToken now has a null check at line 89. Build on current file state.')
# Wave 2: CLI backend equivalent
Bash(command='codex exec ... -o .agents/codex-team/rate-limit.md \
"Add rate limiting to pkg/auth.go and pkg/middleware.go. \
Note: pkg/auth.go was recently modified — the validateToken function now has a null check at line 89. \
Build on the current state of the file."', run_in_background=true)
TaskOutput(task_id="<id-3>", block=true, timeout=120000)
```
The team lead synthesizes Wave 1 results and injects relevant context into Wave 2 prompts. Don't dump raw diffs — describe what changed and why it matters for the next task.
### Step 4: Wait for Completion
```
# Sub-agent backend:
wait(ids=["<id-1>", "<id-2>", "<id-3>"], timeout_ms=120000)
# CLI backend:
TaskOutput(task_id="<id-1>", block=true, timeout=120000)
TaskOutput(task_id="<id-2>", block=true, timeout=120000)
TaskOutput(task_id="<id-3>", block=true, timeout=120000)
```
### Step 5: Verify Results
- Read output files from `.agents/codex-team/`
- Check `git diff` for changes made by each agent
- Run tests if applicable
- For multi-wave: verify Wave 2 agents built correctly on Wave 1 changes
## Output Directory
```
mkdir -p .agents/codex-team
```
Output files: `.agents/codex-team/<task-name>.md`
## Prompt Guidelines
Good Codex prompts are **specific and self-contained**:
```
# GOOD: Specific file, line, exact change
"Fix in cmd/zeus.go line 245: rename spec_path to spec_location in the QUEST_REQUEST payload struct"
# BAD: Vague, requires exploration
"Fix the spec path issue somewhere in the codebase"
```
Include in each prompt:
- Exact file path(s)
- Line numbers or function names
- What to change and why
- Any constraints (don't touch other files, preserve API compatibility)
For multi-wave Wave 2+ prompts, also include:
- What changed in prior waves (summarized, not raw diffs)
- Current state of shared files after prior edits
## Limits
- **Max agents:** 6 per wave (resource-reasonable)
- **Timeout:** 2 minutes default per agent. Increase with `timeout` param for larger tasks
- **Max waves:** 3 recommended. If you need more, reconsider task decomposition
## Fallback
If Codex is unavailable, delegate to `/swarm` which auto-selects the best available backend (native teams with messaging/redirect/graceful shutdown, or background tasks as last resort):
```
Skill(skill="swarm")
```
> **Note:** `/codex-team` runs Codex CLI processes as background shell commands — this is fine (separate OS processes). For Claude agent orchestration, use `/swarm` which uses your runtime's native multi-agent primitives.
## Quick Reference
| Item | Value |
|------|-------|
| Model | `gpt-5.3-codex` |
| Command | `codex exec --full-auto -m "gpt-5.3-codex" -C "$(pwd)" -o <file> "prompt"` |
| Output dir | `.agents/codex-team/` |
| Max agents/wave | 6 recommended |
| Timeout | 120s default |
| Strategies | Parallel (no overlap), Merge (same file), Multi-wave (partial overlap) |
| Fallback | `/swarm` (runtime-native) |
---
## Examples
### Parallel Execution (No File Overlap)
**User says:** Fix three bugs in auth.go, config.go, and logging.go using `/codex-team`
**What happens:**
1. Agent analyzes file targets (auth.go, config.go, log.go — no overlap)
2. Agent selects PARALLEL strategy
3. Agent spawns three Codex agents (sub-agents if available, else CLI via Bash)
4. All agents execute simultaneously, write to `.agents/codex-team/*.md`
5. Team lead verifies results with `git diff` and tests
6. Team lead commits all changes together
**Result:** Three bugs fixed in parallel with zero file conflicts.
### Merge Strategy (Same File)
**User says:** Fix three issues in zeus.go: rename field, remove unused field, fix counter
**What happens:**
1. Agent analyzes file targets (all three tasks touch zeus.go)
2. Agent selects MERGE strategy
3. Agent combines all three fixes into a single Codex prompt with line-specific instructions
4. Agent spawns ONE Codex agent with merged prompt
5. Agent completes all three fixes in one pass
6. Team lead verifies and commits
**Result:** One agent, one file, no conflicts possible.
### Multi-Wave (Partial Overlap)
**User says:** Fix auth.go, add rate limiting to auth.go + middleware.go, update config.go
**What happens:**
1. Agent identifies overlap: tasks 1 and 2 both touch auth.go
2. Agent decomposes into waves: W1 = task 1 + task 3 (non-overlapping), W2 = task 2
3. Agent spawns Wave 1 agents in parallel, waits for completion
4. Agent reads Wave 1 results, synthesizes context for Wave 2
5. Agent spawns Wave 2 agent with updated file-state context
6. Team lead validates and commits after Wave 2
**Result:** Sequential wave execution prevents conflicts, context flows forward.
---
## Troubleshooting
| Problem | Cause | Solution |
|---------|-------|----------|
| Codex CLI not found | `codex` not installed or not on PATH | Run `npm i -g @openai/codex` or use fallback `/swarm` |
| Model `gpt-5.3-codex` unavailable | ChatGPT account, not API account | Use API account or switch to `gpt-4o` |
| Agents produce file conflicts | Multiple agents editing same file | Use file-target analysis and apply merge or multi-wave strategy |
| Agent timeout with no output | Task too complex or vague prompt | Break into smaller tasks, add specific file:line instructions |
| Output files empty or missing | `-o` path invalid or permission denied | Check `.agents/codex-team/` directory exists and is writable |
## Reference Documents
- [references/claude-code-latest-features.md](references/claude-code-latest-features.md)Related Skills
julien-workflow-advice-codex
Get OpenAI Codex CLI's opinion on code, bugs, or implementation. Use when you want a second AI perspective during coding sessions.
consult-codex
Compare OpenAI Codex GPT-5.2 and code-searcher responses for comprehensive dual-AI code analysis. Use when you need multiple AI perspectives on code questions.
codex
Run OpenAI's Codex CLI agent in non-interactive mode using `codex exec`. Use when delegating coding tasks to Codex, running Codex in scripts/automation, or when needing a second agent to work on a task in parallel.
codex-sessions-skill-scan
Daily skill health scan: analyze ~/.codex/sessions plus per-repo session logs under ~/dev (default last 1 day) and summarize skill invocations + likely failures for personal skills in ~/dev/agent-skills (missing paths, tool failures, complex-task word triggers). Optional: include best-effort local OTel signals.
codex-reviewer
Use OpenAI's Codex CLI as an independent code reviewer to provide second opinions on code implementations, architectural decisions, code specifications, and pull requests. Trigger when users request code review, second opinion, independent review, architecture validation, or mention Codex review. Provides unbiased analysis using GPT-5-Codex model through the codex exec command for non-interactive reviews.
codex-review
Two-pass adversarial review of design documents and implementation plans using OpenAI Codex CLI. Invokes Codex to review plans section-by-section (pass 1), then holistically (pass 2), feeding critique back for revision. Use when you have a design doc, architecture plan, or implementation plan that should be stress-tested before execution.
codex-cli-bridge
Bridge between Claude Code and OpenAI Codex CLI - generates AGENTS.md from CLAUDE.md, provides Codex CLI execution helpers, and enables seamless interoperability between both tools
codex-advisor
Get a second opinion from OpenAI Codex CLI for plan reviews, code reviews, architecture decisions, and hard problems. Use when you need external validation, want to compare approaches, or are stuck on a difficult problem.
ai-agent-team
AI Agent 协作团队系统 - 基于 newtype-profile 架构。模拟编辑团队模型,通过多个专业 Agent 协作完成复杂任务。适用于内容创作、研究分析、知识管理等场景。核心 Agent: chief(主编/协调者), researcher(研究员), writer(作者), editor(编辑), fact-checker(核查员), archivist(档案员)。支持任务分类、并行处理、质量验证等高级协作模式。触发词: 'agent team', '协作', '研究分析', '内容创作', '多角度分析'
microsoft-teams-automation
Automate Microsoft Teams tasks via Rube MCP (Composio): send messages, manage channels, create meetings, handle chats, and search messages. Always search tools first for current schemas.
superteam-writing-plans
Create structured implementation plans with machine-parseable task blocks
plan-refine-codex
Refine a Claude Code plan using OpenAI Codex. Use when you have a plan file and want a second opinion or to improve robustness.