Skill Tracer
Skills › Superpowers › using-superpowers › codex-tools.md

codex-tools.md

108 lines · skills/using-superpowers/references/codex-tools.md at 2ce8aa1

Open on GitHub

Most marks come from matching words in the file, so treat them as pointers.

1## Subagent dispatch requires multi-agent support
2
3Add to your Codex config (`~/.codex/config.toml`):
4
5```toml
6[features]
7multi_agent = true
8```
9
10This enables the multi-agent tools that skills like
12Which tools you get depends on the multi-agent version your model
13preset selects (current presets run V2; older ones run V1). Trust your
14actual tool list over any table — including this one — when they
15disagree.
17- **Spawning:** give children a clean context with
18 `spawn_agent {fork_turns: "none"}`; the default `"all"` copies your
19 entire transcript into the child. On Codex 0.145+, role files under
20 `~/.codex/agents/` attach to isolated forks via `agent_type`.
21 Full-history forks accept `model` and `reasoning_effort` overrides
22 (only `agent_type` is refused there) — isolated forks are the SDD
23 default for context hygiene, not because overrides require them.
24- **Fix rounds:** resume the implementer with `followup_task` — it
25 delivers your message, triggers a turn, and transparently reloads a
26 child the harness evicted. Never dispatch a fresh implementer on the
27 theory that a spawned agent cannot be messaged again; on V2 it
28 always can.
29- **Lifecycle:** V2 has no `close_agent`. Finished children are
30 evicted automatically when slots are needed; leaving them unclosed
31 costs nothing. Only V1 sessions have `close_agent` — there, close
32 reviewers when their review returns, and close each implementer
33 after its task's review passes.
34- **Model names:** never copy a model name from a skill, table, or old
35 session into `spawn_agent` without checking it against your current
36 spawn allowlist — V2 accepts only V2-capable presets and hard-errors
37 on the rest.

Subagent dispatch requires multi-agent support

Add to your Codex config (~/.codex/config.toml):

[features]
multi_agent = true

This enables the multi-agent tools that skills like dispatching-parallel-agents and subagent-driven-development use. Which tools you get depends on the multi-agent version your model preset selects (current presets run V2; older ones run V1). Trust your actual tool list over any table — including this one — when they disagree.

  • Spawning: give children a clean context with spawn_agent {fork_turns: "none"}; the default "all" copies your entire transcript into the child. On Codex 0.145+, role files under ~/.codex/agents/ attach to isolated forks via agent_type. Full-history forks accept model and reasoning_effort overrides (only agent_type is refused there) — isolated forks are the SDD default for context hygiene, not because overrides require them.
  • Fix rounds: resume the implementer with followup_task — it delivers your message, triggers a turn, and transparently reloads a child the harness evicted. Never dispatch a fresh implementer on the theory that a spawned agent cannot be messaged again; on V2 it always can.
  • Lifecycle: V2 has no close_agent. Finished children are evicted automatically when slots are needed; leaving them unclosed costs nothing. Only V1 sessions have close_agent — there, close reviewers when their review returns, and close each implementer after its task's review passes.
  • Model names: never copy a model name from a skill, table, or old session into spawn_agent without checking it against your current spawn allowlist — V2 accepts only V2-capable presets and hard-errors on the rest.
Raw lines 1 to 38
Starts an agent Subagent :1
Starts an agent dispatch :1
Names a skill dispatching-parallel-agents :11
Names a skill subagent-driven-development :11
Starts an agent Spawning :17
Starts an agent spawned :27
Starts an agent spawn :36
39## Waiting on children
41`wait_agent` is an event subscription, not a poll: a long wait wakes
42the moment a child produces mailbox activity, with the same latency as
43a short one. Short-timeout polling buys nothing and costs a tool call —
44and a context rebill — per poll. In measured sessions, roughly
45two-thirds of all wait calls were short polls that timed out.
47- While you still have local work, do not wait at all. A completed
48 child's final answer is pushed into your mailbox and arrives with
49 your next turn.
50- When you are genuinely idle with children outstanding, wait in
51 bounded stretches: `wait_agent` with `timeout_ms` 300000-600000
52 (5-10 minutes). After each stretch — wake or timeout — post one
53 status line, run `list_agents`, and chase any child that finished
54 without reporting. Never stack polls shorter than five minutes; the
55 event subscription wakes a bounded stretch just as fast as a short
56 one.
57- Completion mail cannot wake an idle controller (it is delivered
58 without triggering a turn); covering that idle window is
59 `wait_agent`'s only job. A stretch that times out with no activity
60 is your cue to reconcile, not to shorten the next stretch.

Waiting on children

wait_agent is an event subscription, not a poll: a long wait wakes the moment a child produces mailbox activity, with the same latency as a short one. Short-timeout polling buys nothing and costs a tool call — and a context rebill — per poll. In measured sessions, roughly two-thirds of all wait calls were short polls that timed out.

  • While you still have local work, do not wait at all. A completed child's final answer is pushed into your mailbox and arrives with your next turn.
  • When you are genuinely idle with children outstanding, wait in bounded stretches: wait_agent with timeout_ms 300000-600000 (5-10 minutes). After each stretch — wake or timeout — post one status line, run list_agents, and chase any child that finished without reporting. Never stack polls shorter than five minutes; the event subscription wakes a bounded stretch just as fast as a short one.
  • Completion mail cannot wake an idle controller (it is delivered without triggering a turn); covering that idle window is wait_agent's only job. A stretch that times out with no activity is your cue to reconcile, not to shorten the next stretch.
Raw lines 39 to 61
62## Model routing on spawns
64Every `spawn_agent` you issue — including when you are yourself a
65spawned child running a fan-out — sets `model` AND `reasoning_effort`
66explicitly, per the Model Selection rules of the skill you are
67executing. Setting `model` alone is a trap: the child's effort
68silently resets to that model's default, not to yours.
70Ask your human partner to add a machine-level backstop to
71`~/.codex/config.toml` so any spawn that slips through still routes to
72a deliberate tier instead of silently inheriting the session's most
73expensive model:
75```toml
76[agents]
77default_subagent_model = "<a mid-tier model from your spawn allowlist>"
78default_subagent_reasoning_effort = "medium"
79```

Model routing on spawns

Every spawn_agent you issue — including when you are yourself a spawned child running a fan-out — sets model AND reasoning_effort explicitly, per the Model Selection rules of the skill you are executing. Setting model alone is a trap: the child's effort silently resets to that model's default, not to yours.

Ask your human partner to add a machine-level backstop to ~/.codex/config.toml so any spawn that slips through still routes to a deliberate tier instead of silently inheriting the session's most expensive model:

[agents]
default_subagent_model = "<a mid-tier model from your spawn allowlist>"
default_subagent_reasoning_effort = "medium"
Raw lines 62 to 80
Starts an agent spawns :62
Starts an agent spawned :65
Involves a person Ask your human partner :70
Starts an agent spawn :71
81## Environment Detection
83Skills that create worktrees or finish branches should detect their
84environment with read-only git commands before proceeding:
86```bash
87GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
88GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
89BRANCH=$(git branch --show-current)
90```
92- `GIT_DIR != GIT_COMMON` → already in a linked worktree (skip creation)
93- `BRANCH` empty → detached HEAD (cannot branch/push/PR from sandbox)
96Step 1 for how each skill uses these signals.

Environment Detection

Skills that create worktrees or finish branches should detect their environment with read-only git commands before proceeding:

GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
BRANCH=$(git branch --show-current)
  • GIT_DIR != GIT_COMMON → already in a linked worktree (skip creation)
  • BRANCH empty → detached HEAD (cannot branch/push/PR from sandbox)

See using-git-worktrees Step 0 and finishing-a-development-branch Step 1 for how each skill uses these signals.

Raw lines 81 to 97
Names a skill using-git-worktrees :95
98## Codex App Finishing
100When the sandbox blocks branch/push operations (detached HEAD in an
101externally managed worktree), the agent commits all work and informs
102the user to use the App's native controls:
104- **"Create branch"** — names the branch, then commit/push/PR via App UI
105- **"Hand off to local"** — transfers work to the user's local checkout
107The agent can still run tests, stage files, and output suggested branch
108names, commit messages, and PR descriptions for the user to copy.

Codex App Finishing

When the sandbox blocks branch/push operations (detached HEAD in an externally managed worktree), the agent commits all work and informs the user to use the App's native controls:

  • "Create branch" — names the branch, then commit/push/PR via App UI
  • "Hand off to local" — transfers work to the user's local checkout

The agent can still run tests, stage files, and output suggested branch names, commit messages, and PR descriptions for the user to copy.

Raw lines 98 to 108