Files
superpowers/skills/using-superpowers/references/codex-tools.md
Drew Ritter d123bde46e exp(codex): print dispatch tuples from SDD scripts — v2 chokepoint for PRI-2672
Run-2 dispatch-4 autopsy: after compaction, the codex-tools role table
fell out of context and the controller reasoned itself into an inherited
sol@max reviewer — the harness's own 'inherited parent model is preferred'
plus SKILL.md's 'most capable model' outvoted the compaction summary's
distilled 'terra/high' line. Its introspection named the only artifact it
actually consults at the moment of dispatch: the review-package output.

So the role tuple now rides the script output, reprinted fresh every
round, immune to compaction by construction:
- task-brief prints role=implementer terra/high fork_turns=none
- review-package prints per role via a new leading --role flag
  (task-review default | re-review | final-review), and SKILL.md call
  sites pass the flag at the re-review and final-review sites
- SKILL.md Model Selection now defers to platform role tables and the
  printed dispatch hints, closing the 'most capable model' loophole
- codex-tools.md tells the controller to copy the printed tuple verbatim

Harness detection considered and rejected: gating the print on CODEX_CI
risks a silent no-op in exactly the environment that needs it; the line
is labeled '(codex spawn_agent)' instead, and CC controllers — whose
templates carry their own model fields — can ignore it.

Experiment branch for PRI-2672 validation; not for merge without eval
evidence.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 14:30:12 -07:00

4.1 KiB

Subagent dispatch requires multi-agent support

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

[features]
multi_agent = true

This enables spawn_agent, wait_agent, and close_agent for skills like dispatching-parallel-agents and subagent-driven-development. When using subagent-driven-development, close reviewer subagents when their review returns. Keep each implementer subagent open until its task's review passes — the fix loop resumes the implementer — then close it. If your harness cannot send another message to a spawned agent, dispatch each fix round as a fresh implementer carrying the brief, the report file, and the findings.

SDD dispatch: pin fork_turns and the model on every spawn

Every spawn_agent call in subagent-driven-development sets fork_turns: "none". The parameter defaults to "all", which forks your entire session transcript into the child — the opposite of the fresh, constructed context SDD requires — and a full-history fork also refuses model and effort overrides. Never omit the parameter, and never pass "all" or a turn count for an SDD dispatch.

Before Task 1, check your spawn_agent tool schema for model and reasoning_effort parameters (present on Codex 0.145+).

If the parameters exist, set both explicitly on every dispatch:

Role model reasoning_effort
Implementer (all rounds) gpt-5.6-terra high
Task reviewer gpt-5.6-terra high
Scoped re-review gpt-5.6-terra medium
Final whole-branch review gpt-5.6-terra high

On Codex this table IS the Model Selection mapping — including the final review, which stays on terra/high rather than "most capable available." The task-brief and review-package scripts reprint the applicable row as a dispatch (codex spawn_agent): line with their output — copy those values onto the spawn_agent call verbatim, every time, even late in a long session. Never give a subagent your session's model when you run a frontier config (sol at xhigh or max): reviewer tier never exceeds implementer tier, and a fix round never gets an effort bump. Rounds 4-5's "more capable model" means a fresh implementer at the same tier; a task that genuinely needs more than terra/high is a BLOCKED escalation to your human partner, not a quiet tier climb. Frontier-tier subagents at inherited effort are the measured top driver of Codex SDD runs spinning out to 8+ hours (PRI-2672): review seats that inherited sol found real-but-endless defects every round, and fix diffs ballooned instead of converging.

If the parameters do not exist (Codex 0.144 and earlier), every child inherits your session's model and effort and no override is possible — role files in ~/.codex/agents/ do not attach to spawns either. Say so to your human partner before starting a plan of more than a few tasks, and offer the choice: proceed with inheritance, or restart the session at a lower effort so the whole run — controller and children — pays the lower rate.

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.

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.