codex-subagents

A command for coordinating several Codex coding agents on a complex task. It splits work into smaller assignments, runs agents in parallel where possible, and combines and checks their results.

In plain words
What is it for?
Use it to assign separate research or implementation tasks, run up to three agents at a time, continue in batches, save activity logs, and validate the combined result.
Why use it?
It reduces the need to handle every part of a large task in one conversation. It also provides a process for tracking delegated work and reviewing the output.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/codermagefox/claudecode-codex-subagents/codex-subagents
Clone the repo
git clone --depth 1 https://github.com/CoderMageFox/claudecode-codex-subagents
Per session 27 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,435 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 95% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00027 $0.03435
Opus 5 $0.00014 $0.01717
Sonnet 5 $0.00005 $0.00687
Haiku 4.5 $0.00003 $0.00344

Measured 2d ago against content hash 0ad9077b16a6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

codex-subagents scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

95% identical to codex-subagents — 8 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

commands/codex-subagents.md · 452 lines

How it starts

The opening of the file, as written. The whole thing — 452 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Codex Subagents - Codex 子代理编排

You are coordinating a complex task by delegating to multiple Codex sub-agents via MCP.

Your Role

Act as an intelligent orchestrator that:

  1. Analyzes the task and breaks it into parallelizable units
  2. Delegates to Codex agents via mcp__codex-subagent__spawn_agents_parallel (max 3 agents per batch)
  3. Chains execution if >3 agents needed, with progress tracking using TodoWrite
  4. Logs all subagent activities to .codex-temp/[timestamp]/[function-name].log
  5. Collects results and intelligently merges them
  6. Validates quality through comprehensive checks
  7. Reports results with actionable next steps

Task: $ARGUMENTS

Process Flow

Step 0: Ensure .gitignore Setup (5 seconds)

IMPORTANT: Prevent committing temporary files

Before starting, ensure the project has proper .gitignore configuration:

# Check if .gitignore exists
if [ ! -f .gitignore ]; then
  echo "Creating .gitignore to prevent committing temporary files..."
  cat > .gitignore << 'EOF'
# Codex Subagents temporary files
.codex-temp/

# Common temporary files
*.log
.DS_Store
EOF
  echo "✓ Created .gitignore"
else
  # Check if .codex-temp/ is already ignored
  if ! grep -q "\.codex-temp/" .gitignore; then
    echo "Adding .codex-temp/ to .gitignore..."
    echo "" >> .gitignore
    echo "# Codex Subagents temporary files" >> .gitignore
    echo ".codex-temp/" >> .gitignore
    echo "✓ Updated .gitignore"
  fi
fi

Why this matters:

  • .codex-temp/ contains agent logs and temporary files
  • These files are project-specific and should NOT be committed
  • Ensures clean git history without temporary artifacts

Step 1: Task Analysis (30 seconds)

Analyze the task to understand:

  • Scope and boundaries
  • File dependencies
  • Optimal parallelization strategy
  • Expected complexity

Questions to answer:

  • What files/components need changes?
  • Are changes independent or dependent?
  • What's the optimal agent count (3-7)?
  • What patterns should be followed?

Read the full file on GitHub · 452 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 452 lines · 27 tokens per session scan A 0ad9077b16a6

Subscribe to this mod's changes

codex-subagents is a command published in the GitHub repository CoderMageFox/claudecode-codex-subagents (49 stars, last pushed 9mo ago), licensed MIT. It adds 27 tokens to every session and 3,435 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 95% identical to codex-subagents, differing in 8 lines, and is treated as a copy.