codex-subagent
Codex Subagent
Dispatch one or more tasks to Codex CLI subagents. Multiple tasks run in parallel. Collect structured results with durable artifacts.
When to Use
- The user or a calling skill needs to offload tasks to Codex to save Claude Code tokens.
- For 2+ independent tasks, parallel dispatch is the primary value.
Do NOT use this skill when:
- Tasks depend on each other's output (run them sequentially instead).
Task Types (Reference)
run_batch.py is the single source of truth for this mapping. This table is informational only.
| Type | Sandbox | Effort |
|---|---|---|
review |
read-only | high |
analyze |
read-only | high |
search |
read-only | high |
document |
read-only | high |
implement |
workspace-write | xhigh |
refactor |
workspace-write | xhigh |
debug |
workspace-write | xhigh |
architect |
workspace-write | xhigh |
Unknown types default to read-only / high.
Construct the Task Manifest
- Receive explicit task descriptions from the user or calling skill.
- Do NOT invent tasks beyond what was described.
- Build a manifest JSON with a
tasksarray. Each task requires:id-- unique string identifier using only letters, numbers,.,_, or-type-- one of the canonical types aboveprompt-- full task instruction stringcwd-- working directory relative to git root and staying inside the repo (usually".")
Example manifest:
{
"tasks": [
{
"id": "lint-config",
"type": "review",
"prompt": "Review the ESLint configuration for deprecated rules and report findings.",
"cwd": "."
},
{
"id": "add-retry-logic",
"type": "implement",
"prompt": "Add exponential backoff retry logic to src/api/client.ts for transient HTTP errors.",
"cwd": "."
}
]
}
Execution Flow
- Create
.context/codex-subagent/under the repo root if it does not exist. - Write the manifest to
.context/codex-subagent/manifest.json. - Run the runner:
python "<skill-install-path>/codex-subagent/scripts/run_batch.py" \
--manifest ".context/codex-subagent/manifest.json" \
--run-id "$(date +%Y%m%d-%H%M%S)"
To specify a model, add --model <model>.
--run-id must also use only letters, numbers, ., _, or -.
- The runner prints summary JSON to stdout.
Monitoring Long-Running Tasks
Every 5 minutes while the runner is executing, check .context/codex-subagent/<run-id>/ for task progress:
- Task directory has only
prompt.txt-- still launching. - Task directory has
prompt.txt+pid-- currently running. - Task directory has
meta.json(nopid) -- completed.
If a read-only task has been running >15 minutes or a workspace-write task >30 minutes, read the pid file and consider killing it with kill <pid>.
Presenting Results
- Read summary JSON from runner stdout.
- If any task has
truncated: true, read the full output from.context/codex-subagent/<run-id>/<task-id>/stdout.txt. - Present results as concatenated per-task outputs with task ID headers.
- If any task failed, report which ones and offer to retry.
Write Isolation Warning
When dispatching multiple workspace-write tasks, the caller must ensure non-overlapping file sets. The runner only warns when multiple workspace-write tasks share the same cwd; it does not detect overlapping file sets within a directory and does not prevent concurrent writes. If isolation cannot be guaranteed, use distinct cwd values or run the tasks sequentially instead.
Exit Codes
| Code | Meaning |
|---|---|
| 0 | All tasks succeeded |
| 1 | One or more tasks failed (partial results available) |
| 2 | Runner error (bad manifest, missing codex, auth failure) |
Error Recovery
- Exit code 2: verify
codexis installed and authenticated (codex login status). - Individual task failure: check stderr in
.context/codex-subagent/<run-id>/<task-id>/stderr.txt.
More from henryqw/skills
gh-autopilot
Run a standalone autonomous GitHub Copilot pull request review loop with explicit stage entry and event logs. Use when Codex should start from a user-selected stage (create PR, monitor review, or address existing comments), execute deterministic cycle transitions, and continue looping until Copilot reports no comments or the configured Stage 2 max-wait limit is reached.
10gh-pr-creation
Create a new GitHub pull request end-to-end when the user asks to open or create a PR. Use when Codex must turn local uncommitted work into a reviewable PR by making multiple scoped commits, running and passing all repository quality gates, renaming the branch so it reflects the changes, creating a Conventional Commits PR title, writing a PR description with summary/rationale/migration steps, and assigning Copilot as reviewer.
6gh-address-copilot-review
Handle GitHub PR review comments when comments are provided by the user as context. Use when Codex must evaluate comments one by one, classify each as actionable or non-actionable or needs clarification, implement only necessary fixes, keep changes scoped per comment, run validation, avoid intermediate pushes, perform one final push for the full batch, resolve addressed threads, respond to rejected comments with rationale, and re-request Copilot reviewer exactly once at the end via gh-assign-copilot-reviewer.
5triangulate
Evaluate supplied artifacts and return a consolidated findings table with evidence-based conclusions. Use this skill when the user wants a proposal, plan, code change, document, prompt, transcript, or other material reviewed through a structured multi-perspective evaluation instead of a single opinion.
3trueflow
Run the full generic trueflow pipeline by invoking `trueflow_initializer`, `trueflow_adversary`, and `trueflow_referee` in sequence, persisting stage outputs under `.context/trueflow/`, and returning a consolidated `findings.md` table. Use this skill whenever the user asks to "use trueflow" or wants multiple agents to review artifacts, solution proposals, coding implementation plans, documents, prompts, or other material and return adjudicated findings rather than a single opinion.
1gh-pilot
Iteratively drive a PR through GitHub Copilot review using a simple loop with direct `gh` commands and no helper scripts. Reuse existing Copilot feedback first, fetch unresolved thread state via GraphQL, request/re-request Copilot when needed, and require a fresh Copilot pass after pushed fixes.
1