Make MultiAgentV2 spawned-agent context prompt configurable
What variant of Codex are you using?
CLI
What feature would you like to see?
Make the MultiAgentV2 spawned-agent context prompt configurable, or at least only inject it when history/context is actually forked.
Today codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rs unconditionally appends SPAWN_AGENT_DEVELOPER_INSTRUCTIONS to every spawned child agent:
<spawned_agent_context>
... Treat the next user message as your assigned task, and use the forked history only as background context.
</spawned_agent_context>
The problem is that this prompt is added even when the child is spawned with no forked history (for example fork_turns = none, or when no forked context is otherwise provided).
That creates two issues:
- the prompt describes forked history even when there is none
- there is currently no config knob to disable or override this block for custom multi-agent workflows
It looks like later work improved surrounding spawn behavior (parent model/config inheritance, role-level fork defaults, prompt cache keys, etc.), but I could not find a way to:
- disable
SPAWN_AGENT_DEVELOPER_INSTRUCTIONS - replace it with a custom block
- gate it on whether forked context is actually present
A few reasonable options:
- only inject this prompt when
fork_turnsactually results in forked history/context - add a config option to disable it
- add a config option to override the text
- split it into two variants: one for forked children, one for no-history children
Additional information
Current code path:
codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rs
Specifically, the block is appended unconditionally after spawn config is built, independent of fork_turns / fork mode.
This matters for users building custom multi-agent workflows because the injected prompt becomes part of the child agent's behavior contract even when it is semantically wrong for the spawn mode.