Skill instructions to use subagents are ignored unless repeated in the prompt
What version of Codex CLI is running?
codex-cli 0.130.0
Installed via Homebrew cask on this machine. Homebrew currently still serves 0.130.0 even though 0.131.0 is the latest upstream release.
What subscription do you have?
N/A / not subscription-specific.
Which model were you using?
Default Codex CLI model for the session. This does not appear to be model-specific.
What platform is your computer?
Linux 7.0.4-200.fc44.x86_64 x86_64 unknown
What terminal emulator and version are you using (if applicable)?
Linux terminal session. TERM=xterm-256color, COLORTERM=truecolor; no tmux/zellij detected.
The observed session was running Codex in YOLO mode / bypass-approval mode:
codex --dangerously-bypass-approvals-and-sandbox
Codex doctor report
{
"status": "not_available",
"reason": "The installed Codex CLI version does not support `codex doctor --json`; it exits with `error: unexpected argument '--json' found`. Running `codex doctor` in this non-interactive session exits with `Error: stdin is not a terminal`."
}
What issue are you seeing?
Codex CLI does not reliably use subagents when the instruction to use them comes from a loaded skill, even when YOLO mode is enabled. It only uses subagents when the user prompt also explicitly says to use subagents.
That means these two cases behave differently:
- Skill instructions say to use subagents, user asks for the skill-matching task, YOLO mode is enabled: Codex proceeds locally without spawning subagents.
- Same skill and same task, but the user also says something like "use subagents" in the prompt: Codex spawns subagents.
The second prompt-level instruction is redundant with the skill. If a skill is selected and its SKILL.md or supporting workflow instructions explicitly require subagents, the CLI should treat that as sufficient authorization/instruction to spawn them, especially when approval bypass / YOLO mode is already on.
What steps can reproduce the bug?
- Create or install a Codex skill whose instructions explicitly require subagents for a workflow. For example, a review skill that says to split independent surfaces across subagents and merge the findings.
- Start Codex CLI with YOLO/bypass mode enabled:
codex --dangerously-bypass-approvals-and-sandbox
- Ask for a task that clearly triggers the skill, but do not repeat "use subagents" in the prompt.
- Observe that Codex performs the work in the main agent and does not call
spawn_agent. - Repeat the same task, with the same skill available, but add explicit prompt text such as "use subagents".
- Observe that Codex now spawns subagents.
A concrete pattern that exposes the issue is a documentation or code review workflow where the skill already says to use subagents across independent review surfaces. Without the redundant prompt text, the intended subagent workflow is skipped.
What is the expected behavior?
When a selected skill explicitly instructs Codex to use subagents, Codex CLI should honor that instruction without requiring the user to repeat it in the prompt.
If the product intentionally requires prompt-level authorization for subagent spawning regardless of skill instructions, the CLI should make that explicit and warn when a skill requests subagents but the prompt did not separately authorize them. Otherwise skill-authored workflows are brittle: the same task can silently run with a different execution strategy depending on whether the user happens to duplicate the skill instruction in natural language.
Additional information
I searched open issues for subagents + skills + YOLO mode before filing and did not find an obvious duplicate.
This is not asking Codex to spawn subagents for every task. The problem is narrower: when a loaded skill itself requires subagents, that instruction should be honored the same way as other skill instructions, or the CLI should surface why it is being ignored.
7 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
This issue is not a duplicate.
Fix: Skill Instructions to Use Subagents Ignored Unless Repeated in Prompt
Root Cause Analysis
In Codex CLI v0.130.0, when a loaded skill's
SKILL.mdcontains instructions to use subagents, Codex ignores these instructions unless the user prompt also explicitly mentions subagents. This means:SKILL.mdsays "use subagents for verification" → Codex proceeds locally without spawning subagents ❌Root Cause
The subagent spawning decision is made at the prompt-level instruction parser, not at the skill context loader. The flow is:
The spawn decision happens before the skill context is fully integrated into the prompt. This is a classic ordering/precedence bug where the subagent spawn check is prompt-centric rather than context-centric.
Why YOLO Mode Doesn't Help
YOLO mode (
--dangerously-bypass-approvals-and-sandbox) only bypasses the approval prompt for subagent spawning. It does NOT change the detection logic that decides whether to spawn a subagent in the first place. The detection logic still requires an explicit prompt-level instruction.Why This Is Different from #22644 and #22116
Those issues likely dealt with subagent spawning failures (approved but didn't spawn) or subagent communication issues. This issue is about detection — the system never decides to spawn because it doesn't recognize skill-level instructions as valid spawn triggers.
---
Proposed Fix
Fix: Extend Spawn Detection to Include Skill Context
Fix: Respect YOLO Mode for Skill-Triggered Spawns
Fix: Add Logging for Debugging
---
Files to Modify
| File | Change |
|------|--------|
|
src/subagent/spawn-detector.ts| AddcheckSkillForSubagentInstructions()||
src/subagent/spawn-executor.ts| Handle skill-triggered spawns with proper approval flow ||
src/subagent/spawn-logging.ts| Add debug logging for spawn detection |---
Testing Plan
checkSkillForSubagentInstructionsdetects various subagent instruction patterns---
Estimated Impact
Additional reproduction nuance:
This appears to be an instruction-conflict problem, not only a skill-loading problem.
The current
spawn_agenttool description says:When a skill workflow requires subagents, the model has to reconcile two instructions:
In testing, Codex behavior was unstable:
That distinction matters: "subagent capability unavailable" is not the same as "subagent capability exists but needs prompt-level authorization."
Expected behavior should be deterministic. Either:
What should not happen is the current ambiguous behavior where the model may spawn, ask, or silently degrade to a fallback depending on how it resolves the instruction conflict.
Suggested policy shape:
Treat selected skill/workflow instructions that explicitly call for bounded sub-agent use as a valid spawn trigger, the same way an explicit user prompt is currently treated.
A good guardrail would be:
The important part is that "subagents are unavailable" and "subagents are available but require prompt-level authorization" should not collapse into the same fallback path. Codex should either honor the selected skill's subagent instruction or surface the missing authorization deterministically.
Adding a current Codex Desktop/tool-backed reproduction from a skill-governed PR-review workflow.
Feedback/session reference:
019eafa5-64f3-70c0-81f3-521257bacd1aEnvironment/context:
multi_agent_v1.spawn_agentConcrete repro:
spawn_agenttool metadata said:Only use spawn_agent if and only if the user explicitly asks for sub-agents, delegation, or parallel agent work.Why this is still a bug even after improving the skill text:
Expected behavior:
This is especially important for review workflows where independence is part of the correctness property. A parent-agent local review is not equivalent to a remote-blind local review subagent.
This — "instructions to use subagents ignored unless repeated" — is the runtime layer leaking into agent config. We took the inverse: dispatch is a kernel-level event (mention/event), so the runtime stays dumb and it isn't a prompt instruction that can be silently dropped. Would your case behave better if the dispatch weren't in the prompt at all? Happy to show what we do — we open-sourced it (Commonly — github.com/Team-Commonly/commonly).