Tag all multi-agent role instructions consistently (#62842)

## Why

Only catalog role instructions carried the `<multi_agent_role>` tag,
so the same guidance appeared in different formats depending on its source.

## What changed

Render bundled, catalog, and configured root and subagent guidance as
`multi_agent.role_instructions` developer messages. Wrap the guidance in
`<multi_agent_role>` tags and preserve configured text that's already tagged.
Match untagged parent guidance by its body when filtering forked history.

## Testing

Update prompt and session assertions for tagged role instructions, and keep
the cold-resume test exercising a rollout with legacy untagged guidance.

GitOrigin-RevId: 60c55b5d7227811b92bd1bf125f1cd3a965720fd
This commit is contained in:
rhan-oai
2026-11-20 21:42:17 +00:00
committed by copyberry
parent 5bee962f5e
commit 2b5111917c
30 changed files with 91 additions and 686 deletions
+1 -4
View File
@@ -3285,10 +3285,8 @@ async fn spawn_agent_can_fork_parent_thread_history_with_sanitized_items() {
.expect("parent shutdown should submit");
}
#[test_case::test_case(true; "marked catalog hints")]
#[test_case::test_case(false; "unmarked bundled hints")]
#[tokio::test]
async fn spawn_agent_fork_strips_parent_usage_hints_from_compacted_history(marked: bool) {
async fn spawn_agent_fork_strips_parent_usage_hints_from_compacted_history() {
let harness = AgentControlHarness::new().await;
let mut parent_config = harness.config.clone();
let _ = parent_config.features.enable(Feature::MultiAgentV2);
@@ -3318,7 +3316,6 @@ async fn spawn_agent_fork_strips_parent_usage_hints_from_compacted_history(marke
let parent_spawn_call_id = "spawn-call-compacted-usage-hints".to_string();
let catalog_role = |base: &str| MultiAgentRoleInstructions::Composed {
base: base.to_string(),
marked,
omit_update_plan_instructions: false,
max_concurrency: 2,
wait_agent_enabled: false,
+1 -1
View File
@@ -424,7 +424,7 @@ pub(super) async fn prepare_forked_history(
[parent_usage_hints.root, parent_usage_hints.subagent]
.into_iter()
.flatten()
.map(|instructions| instructions.render().into_text().unwrap_or_default())
.map(|instructions| instructions.body().into_text().unwrap_or_default())
.collect()
} else {
Vec::new()
@@ -3,7 +3,7 @@ use codex_protocol::models::ContentItem;
use codex_protocol::models::ContentItemKind;
use codex_protocol::models::input_text;
/// Configured multi-agent instructions emitted as a standalone developer message.
/// Developer note introducing a child after its inherited conversation prefix.
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) struct MultiAgentUsageHint {
text: String,
@@ -102,7 +102,6 @@ fn unchanged_mode_is_reemitted_after_usage_hint_migration() {
fn catalog_role_updates_remain_separate_from_active_mode() {
let catalog_role = |base: &str| MultiAgentRoleInstructions::Composed {
base: base.to_string(),
marked: true,
omit_update_plan_instructions: false,
max_concurrency: 2,
wait_agent_enabled: false,
@@ -5,7 +5,6 @@ use super::WorldStateSection;
use super::WorldStateUpdate;
use crate::context::ContextualUserFragment;
use crate::context::MultiAgentRoleInstructions;
use crate::context::MultiAgentUsageHint;
use codex_protocol::models::ContentItemMetadata;
use codex_protocol::models::ContentItemNamespace;
@@ -52,18 +51,9 @@ impl WorldStateSection for MultiAgentUsageHintState {
}
PreviousSectionState::Unknown => None,
PreviousSectionState::Known(_) | PreviousSectionState::Absent => {
if self.instructions.markers().0.is_empty() {
Some(Box::new(
MultiAgentUsageHint::new(
&self.instructions.body().into_text().unwrap_or_default(),
)
.with_metadata(ContentItemMetadata::tool(self.namespace.clone())),
))
} else {
Some(Box::new(self.instructions.clone().with_metadata(
ContentItemMetadata::tool(self.namespace.clone()),
)))
}
Some(Box::new(self.instructions.clone().with_metadata(
ContentItemMetadata::tool(self.namespace.clone()),
)))
}
};
(
@@ -59,7 +59,6 @@ pub(crate) fn resolve_usage_hints(
}
Some(MultiAgentRoleInstructions::Composed {
base: base.to_owned(),
marked: message.catalog_override().is_some(),
omit_update_plan_instructions,
max_concurrency: config.max_concurrent_threads_per_session,
wait_agent_enabled: config.wait_agent_enabled,
+19 -46
View File
@@ -10854,6 +10854,17 @@ async fn build_initial_context_omits_prompt_fragments_without_extension_state()
);
}
fn multi_agent_role_messages(items: &[ResponseItem]) -> Vec<Vec<&str>> {
developer_message_texts(items)
.into_iter()
.filter(|message| {
message
.iter()
.any(|text| MultiAgentRoleInstructions::matches_text(text))
})
.collect()
}
#[tokio::test]
async fn build_initial_context_adds_multi_agent_v2_root_usage_hint_as_developer_message() {
let (session, turn_context) =
@@ -10861,18 +10872,9 @@ async fn build_initial_context_adds_multi_agent_v2_root_usage_hint_as_developer_
let initial_context = build_initial_context(&session, &turn_context).await;
let developer_messages = developer_message_texts(&initial_context);
assert!(
developer_messages
.iter()
.any(|message| message.as_slice() == ["Root guidance."]),
"expected standalone root usage hint developer message, got {developer_messages:?}"
);
assert!(
!developer_messages
.iter()
.any(|message| message.as_slice() == ["Subagent guidance."]),
"did not expect subagent usage hint for root thread, got {developer_messages:?}"
assert_eq!(
multi_agent_role_messages(&initial_context),
[["<multi_agent_role>Root guidance.</multi_agent_role>"]]
);
}
@@ -10912,17 +10914,9 @@ async fn build_initial_context_adds_multi_agent_v2_subagent_usage_hint_as_develo
.contains("<context_window>\nAgent name: /root/worker\n")),
"expected subagent context window to include its canonical name, got {developer_messages:?}"
);
assert!(
developer_messages
.iter()
.any(|message| message.as_slice() == ["Subagent guidance."]),
"expected standalone subagent usage hint developer message, got {developer_messages:?}"
);
assert!(
!developer_messages
.iter()
.any(|message| message.as_slice() == ["Root guidance."]),
"did not expect root usage hint for subagent thread, got {developer_messages:?}"
assert_eq!(
multi_agent_role_messages(&initial_context),
[["<multi_agent_role>Subagent guidance.</multi_agent_role>"]]
);
}
@@ -10933,16 +10927,7 @@ async fn build_initial_context_omits_multi_agent_v2_usage_hints_when_feature_dis
let initial_context = build_initial_context(&session, &turn_context).await;
let developer_messages = developer_message_texts(&initial_context);
assert!(
!developer_messages.iter().any(|message| {
matches!(
message.as_slice(),
["Root guidance."] | ["Subagent guidance."]
)
}),
"did not expect multi-agent v2 usage hint developer messages, got {developer_messages:?}"
);
assert!(multi_agent_role_messages(&initial_context).is_empty());
}
#[tokio::test]
@@ -10960,19 +10945,7 @@ async fn build_initial_context_omits_multi_agent_v2_usage_hints_when_hint_is_emp
let initial_context = build_initial_context(&session, &turn_context).await;
let developer_messages = developer_message_texts(&initial_context);
assert!(
!developer_messages.iter().any(|message| {
matches!(
message.as_slice(),
["Root guidance."] | ["Subagent guidance."]
) || message.iter().any(|text| {
text.contains("You are `/root`, the primary agent")
|| text.contains("You are an agent in a team of agents")
})
}),
"did not expect multi-agent v2 usage hint developer messages, got {developer_messages:?}"
);
assert!(multi_agent_role_messages(&initial_context).is_empty());
}
#[tokio::test]
@@ -211,7 +211,7 @@ async fn first_request_item_types_roles_and_content_annotations() -> Result<()>
message developer ["guardian.approved_action"]
message developer ["generic.developer_instructions","token_budget.context_window_guidance","permissions.instructions","environments.instructions"]
message developer ["token_budget.context_window","token_budget.context_window","token_budget.context_window"]
message developer ["multi_agent.usage_hint"]
message developer ["multi_agent.role_instructions"]
message developer ["multi_agent.mode_instructions"]
message user ["environments.environment_context"]
message developer ["additional_content.automation_info"]
+2 -2
View File
@@ -3491,8 +3491,8 @@ async fn subagent_waits_for_its_inherited_environment_configuration() -> Result<
"<ENVIRONMENTS_INSTRUCTIONS>",
),
(
r"(?ms)(^\d+:message/developer:\n You are (?:`/root`, the primary agent|an agent) in a team of agents[^\n]+)\n.*?(\n^\d+:message/developer:)",
"${1}\n <STANDARD_MULTI_AGENT_INSTRUCTIONS>${2}",
r"(?s)<multi_agent_role>([^\n]+)\n.*?</multi_agent_role>[^\n]*",
"${1}\n <STANDARD_MULTI_AGENT_INSTRUCTIONS>",
),
(
r#"(environment_id"\s*:\s*"|<environment id=")(?:local|remote)"#,
@@ -12,23 +12,7 @@ Scenario: Real paginated mid-turn compaction and cold resume from the bounded su
[01] <PERMISSIONS_INSTRUCTIONS>
[02] <COLLABORATION_MODE>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -42,23 +26,7 @@ Scenario: Real paginated mid-turn compaction and cold resume from the bounded su
[01] <PERMISSIONS_INSTRUCTIONS>
[02] <COLLABORATION_MODE>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -76,23 +44,7 @@ Scenario: Real paginated mid-turn compaction and cold resume from the bounded su
[01] <PERMISSIONS_INSTRUCTIONS>
[02] <COLLABORATION_MODE>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -23,23 +23,7 @@ Scenario: A parent with no configured environment delegates an API migration, qu
02:message/developer:
<PERMISSIONS_INSTRUCTIONS>
03:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 2 available concurrency slots, meaning that up to 2 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
04:message/developer:
<MULTI_AGENT_MODE>
05:message/user:
@@ -82,23 +66,7 @@ Scenario: A parent with no configured environment delegates an API migration, qu
02:message/developer:
<PERMISSIONS_INSTRUCTIONS>
03:message/developer:
You are an agent in a team of agents collaborating to complete a task.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents. All ag...nd capable, and have access to the same set of tools. [hash=876a93c54d3f61d6]
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an... `send_message` to pass a message to a running agent. [hash=824c12425c7626dc]
Child agents can also spawn their own sub-agents.
When you provide a response in the final channel, that content is immediately delivered back to your parent agent.
<OMITTED 15 LINES; ~225 TOKENS; hash=fa366829bdb214be>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 2 available concurrency slots, meaning that up to 2 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
04:message/developer:
<MULTI_AGENT_MODE>
05:message/user:
@@ -11,23 +11,7 @@ Scenario: An active agent describes a channel, lists it, posts a shared decision
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -15,23 +15,7 @@ Scenario: A child posts through the HTTP MCP executable; its restarted parent di
- mcp__codex_message_board
</tools>
02:message/developer:
You are an agent in a team of agents collaborating to complete a task.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents. All ag...nd capable, and have access to the same set of tools. [hash=876a93c54d3f61d6]
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an... `send_message` to pass a message to a running agent. [hash=824c12425c7626dc]
Child agents can also spawn their own sub-agents.
When you provide a response in the final channel, that content is immediately delivered back to your parent agent.
<OMITTED 15 LINES; ~225 TOKENS; hash=fa366829bdb214be>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -61,23 +45,7 @@ Scenario: A child posts through the HTTP MCP executable; its restarted parent di
- mcp__codex_message_board
</tools>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -15,23 +15,7 @@ Scenario: The config flag starts an in-memory MCP board shared by a parent and c
- mcp__codex_message_board
</tools>
02:message/developer:
You are an agent in a team of agents collaborating to complete a task.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents. All ag...nd capable, and have access to the same set of tools. [hash=876a93c54d3f61d6]
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an... `send_message` to pass a message to a running agent. [hash=824c12425c7626dc]
Child agents can also spawn their own sub-agents.
When you provide a response in the final channel, that content is immediately delivered back to your parent agent.
<OMITTED 15 LINES; ~225 TOKENS; hash=fa366829bdb214be>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -61,23 +45,7 @@ Scenario: The config flag starts an in-memory MCP board shared by a parent and c
- mcp__codex_message_board
</tools>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -16,23 +16,7 @@ Scenario: A child posts through the HTTP MCP executable; its restarted parent di
- mcp__codex_message_board
</tools>
02:message/developer:
You are an agent in a team of agents collaborating to complete a task.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents. All ag...nd capable, and have access to the same set of tools. [hash=876a93c54d3f61d6]
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an... `send_message` to pass a message to a running agent. [hash=824c12425c7626dc]
Child agents can also spawn their own sub-agents.
When you provide a response in the final channel, that content is immediately delivered back to your parent agent.
<OMITTED 15 LINES; ~225 TOKENS; hash=fa366829bdb214be>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -63,23 +47,7 @@ Scenario: A child posts through the HTTP MCP executable; its restarted parent di
- mcp__codex_message_board
</tools>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -17,23 +17,7 @@ Scenario: Remote board tools and active-turn notifications share the existing se
03:message/developer:
<PERMISSIONS_INSTRUCTIONS>
04:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
05:message/developer:
<MULTI_AGENT_MODE>
06:message/user:
@@ -11,23 +11,7 @@ Scenario: A child interrupted during mid-turn and post-turn remote compaction ke
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
You are an agent in a team of agents collaborating to complete a task.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents. All ag...nd capable, and have access to the same set of tools. [hash=876a93c54d3f61d6]
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an... `send_message` to pass a message to a running agent. [hash=824c12425c7626dc]
Child agents can also spawn their own sub-agents.
When you provide a response in the final channel, that content is immediately delivered back to your parent agent.
<OMITTED 15 LINES; ~225 TOKENS; hash=fa366829bdb214be>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -46,23 +30,7 @@ Scenario: A child interrupted during mid-turn and post-turn remote compaction ke
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
You are an agent in a team of agents collaborating to complete a task.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents. All ag...nd capable, and have access to the same set of tools. [hash=876a93c54d3f61d6]
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an... `send_message` to pass a message to a running agent. [hash=824c12425c7626dc]
Child agents can also spawn their own sub-agents.
When you provide a response in the final channel, that content is immediately delivered back to your parent agent.
<OMITTED 15 LINES; ~225 TOKENS; hash=fa366829bdb214be>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -90,23 +58,7 @@ Scenario: A child interrupted during mid-turn and post-turn remote compaction ke
02:message/developer:
<PERMISSIONS_INSTRUCTIONS>
03:message/developer:
You are an agent in a team of agents collaborating to complete a task.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents. All ag...nd capable, and have access to the same set of tools. [hash=876a93c54d3f61d6]
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an... `send_message` to pass a message to a running agent. [hash=824c12425c7626dc]
Child agents can also spawn their own sub-agents.
When you provide a response in the final channel, that content is immediately delivered back to your parent agent.
<OMITTED 15 LINES; ~225 TOKENS; hash=fa366829bdb214be>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
04:message/developer:
<MULTI_AGENT_MODE>
05:message/user:
@@ -11,23 +11,7 @@ Scenario: A historical MAv2 send_message call and an encrypted parent reply reac
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -45,23 +29,7 @@ Scenario: A historical MAv2 send_message call and an encrypted parent reply reac
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -163,23 +131,7 @@ Scenario: A historical MAv2 send_message call and an encrypted parent reply reac
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -328,23 +280,7 @@ Scenario: A historical MAv2 send_message call and an encrypted parent reply reac
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -11,23 +11,7 @@ Scenario: A historical MAv2 send_message call and an encrypted parent reply reac
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -45,23 +29,7 @@ Scenario: A historical MAv2 send_message call and an encrypted parent reply reac
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -163,23 +131,7 @@ Scenario: A historical MAv2 send_message call and an encrypted parent reply reac
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -328,23 +280,7 @@ Scenario: A historical MAv2 send_message call and an encrypted parent reply reac
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -11,23 +11,7 @@ Scenario: An encrypted parent reply is delivered as a native agent message. Both
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -118,23 +102,7 @@ Scenario: An encrypted parent reply is delivered as a native agent message. Both
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -254,23 +222,7 @@ Scenario: An encrypted parent reply is delivered as a native agent message. Both
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -16,23 +16,7 @@ Scenario: A root uses Code Mode to send a confirmation and receives a real user
- mcp__codex_apps__user_message: Tools for working with user_message.
</tools>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -64,23 +48,7 @@ Scenario: A root uses Code Mode to send a confirmation and receives a real user
- mcp__codex_apps__user_message: Tools for working with user_message.
</tools>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 16 LINES; ~234 TOKENS; hash=b2e94283a8c22327>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -92,23 +60,7 @@ Scenario: A root uses Code Mode to send a confirmation and receives a real user
08:message/developer:
You are now a newly spawned child agent. The preceding conversation is inherited parent context. Follow ...are not inherited. Report your result to your parent. [hash=0e586a5d405d39db]
09:message/developer:
You are an agent in a team of agents collaborating to complete a task.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents. All ag...nd capable, and have access to the same set of tools. [hash=876a93c54d3f61d6]
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an... `send_message` to pass a message to a running agent. [hash=824c12425c7626dc]
Child agents can also spawn their own sub-agents.
When you provide a response in the final channel, that content is immediately delivered back to your parent agent.
<OMITTED 15 LINES; ~225 TOKENS; hash=fa366829bdb214be>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
10:message/developer:
<MULTI_AGENT_MODE>
11:agent_message
@@ -26,7 +26,7 @@ Settings:
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
Coordinate sub-agents.
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -57,7 +57,7 @@ Settings: relative to window 1
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
Coordinate sub-agents.
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -21,23 +21,7 @@ Scenario: A forked worker receives both stable answer fragments, with their phas
06:message/user:
Have a worker check both results.
07:message/developer:
You are an agent in a team of agents collaborating to complete a task.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents. All ag...nd capable, and have access to the same set of tools. [hash=876a93c54d3f61d6]
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an... `send_message` to pass a message to a running agent. [hash=824c12425c7626dc]
Child agents can also spawn their own sub-agents.
When you provide a response in the final channel, that content is immediately delivered back to your parent agent.
<OMITTED 15 LINES; ~225 TOKENS; hash=fa366829bdb214be>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
08:message/developer:
<MULTI_AGENT_MODE>
09:agent_message
@@ -38,7 +38,7 @@ Scenario: A worker inherits the parent prefix, then receives its own window hint
First context window id: <UUID 1>
Current context window id: <UUID 1>
04:message/developer:
You are /root. Coordinate the investigation.
<MULTI_AGENT_ROLE>
05:message/developer:
<MULTI_AGENT_MODE>
06:message/user:
@@ -92,7 +92,7 @@ Scenario: A worker inherits the parent prefix, then receives its own window hint
First context window id: <UUID 1>
Current context window id: <UUID 1>
04:message/developer:
You are /root. Coordinate the investigation.
<MULTI_AGENT_ROLE>
05:message/developer:
<MULTI_AGENT_MODE>
06:message/user:
@@ -114,7 +114,7 @@ Scenario: A worker inherits the parent prefix, then receives its own window hint
15:message/developer:
Check both results independently.
16:message/developer:
You are a worker. Report to your parent.
<MULTI_AGENT_ROLE>
17:function_call_output/agent.thread_hint:Agent name: /root/worker
First context window id: <UUID 2>
Current context window id: <UUID 2>
@@ -34,23 +34,7 @@ Settings:
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
At the start of your turn, you are the active agent.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents.
All agents in the team, including the agents that you can assign tasks to, are equally intelligent and capable, and have access to the same set of tools.
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an...message to a running agent without triggering a turn. [hash=7d40ff8b58977202]
Child agents can also spawn their own sub-agents.
<OMITTED 14 LINES; ~204 TOKENS; hash=f7be62db50c2fa5f>
All agents share the same directory. In detail:
- All agents have access to the same container and filesystem as you.
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -12,23 +12,7 @@ Scenario: Agent follow-ups interrupt at a reasoning boundary, preserve encrypted
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
You are an agent in a team of agents collaborating to complete a task.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents. All ag...nd capable, and have access to the same set of tools. [hash=876a93c54d3f61d6]
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an... `send_message` to pass a message to a running agent. [hash=824c12425c7626dc]
Child agents can also spawn their own sub-agents.
When you provide a response in the final channel, that content is immediately delivered back to your parent agent.
<OMITTED 15 LINES; ~225 TOKENS; hash=fa366829bdb214be>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -12,23 +12,7 @@ Scenario: Agent follow-ups interrupt at a reasoning boundary, preserve encrypted
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/developer:
You are an agent in a team of agents collaborating to complete a task.
You can spawn sub-agents to handle subtasks, and those sub-agents can spawn their own sub-agents. All ag...nd capable, and have access to the same set of tools. [hash=876a93c54d3f61d6]
You can use `spawn_agent` to create a new agent, `followup_task` to give an existing agent a new task an... `send_message` to pass a message to a running agent. [hash=824c12425c7626dc]
Child agents can also spawn their own sub-agents.
When you provide a response in the final channel, that content is immediately delivered back to your parent agent.
<OMITTED 15 LINES; ~225 TOKENS; hash=fa366829bdb214be>
- All agents use the same current working directory.
- As a result, edits made by one agent are immediately visible to all other agents.
When calling `wait_agent`, prefer longer waits (minutes) to avoid busy polling.
There are 4 available concurrency slots, meaning that up to 4 agents can be active at once, including you.
Full-history forks (`fork_turns` omitted or `"all"`) inherit the parent model and reasoning effort and d...uctions; when doing so, set `fork_turns` to `"none"`. [hash=18ccf7e93ecabab9]
<MULTI_AGENT_ROLE>
03:message/developer:
<MULTI_AGENT_MODE>
04:message/user:
@@ -58,7 +58,7 @@ fn spawn_agent_exposes_agent_type(body: &Value, namespace: &str) -> bool {
fn resolved_root_usage_hint(config: &Config, request: &ResponsesRequest) -> String {
if let Some(configured) = config.multi_agent_v2.root_agent_usage_hint_text.as_deref() {
return configured.to_string();
return format!("<multi_agent_role>{configured}</multi_agent_role>");
}
request
@@ -664,11 +664,12 @@ async fn multi_agent_v2_cold_resume_refreshes_legacy_usage_hints_once(
initial.submit_turn("before upgrading").await?;
let initial_request = initial_response.single_request();
let tagged_legacy_hint = resolved_root_usage_hint(&initial.config, &initial_request);
assert!(
initial_request
.message_input_text_groups("developer")
.iter()
.any(|group| { group.len() == 1 && group[0] == legacy_root_agent_usage_hint_text }),
.any(|group| group.len() == 1 && group[0] == tagged_legacy_hint),
"legacy usage hint should be its own developer message"
);
assert!(
@@ -690,6 +691,7 @@ async fn multi_agent_v2_cold_resume_refreshes_legacy_usage_hints_once(
let mut removed_recorded_usage_hint = false;
let mut removed_usage_hint_presence = false;
let legacy_rollout = std::fs::read_to_string(&rollout_path)?
.replace(&tagged_legacy_hint, legacy_root_agent_usage_hint_text)
.lines()
.map(codex_rollout::parse_rollout_line)
.collect::<std::result::Result<Vec<_>, _>>()?
@@ -21,12 +21,11 @@ All agents share the same directory. In detail:
/// Multi-agent role text and the captured capabilities used to render its context segment.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum MultiAgentRoleInstructions {
/// Complete configured instructions, emitted verbatim without catalog markers.
/// Complete configured role body.
Configured(String),
/// Selected catalog or bundled text, composed with captured runtime guidance.
Composed {
base: String,
marked: bool,
omit_update_plan_instructions: bool,
max_concurrency: usize,
wait_agent_enabled: bool,
@@ -50,8 +49,8 @@ impl ContextualUserFragment for MultiAgentRoleInstructions {
fn markers(&self) -> (&'static str, &'static str) {
match self {
Self::Composed { marked: true, .. } => Self::type_markers(),
Self::Configured(_) | Self::Composed { marked: false, .. } => ("", ""),
Self::Configured(text) if Self::matches_text(text) => ("", ""),
Self::Configured(_) | Self::Composed { .. } => Self::type_markers(),
}
}
@@ -68,7 +67,6 @@ impl ContextualUserFragment for MultiAgentRoleInstructions {
max_concurrency,
wait_agent_enabled,
expose_model_overrides,
..
} => {
let base = if *omit_update_plan_instructions {
without_update_plan_instructions(base)
@@ -14,31 +14,22 @@ fn role_segment_filters_base_and_appends_bundled_guidance() {
let expected_body = format!(
"Role.\n## Work\nContinue.\n{shared}\n{wait}\n\nThere are 2 available concurrency slots, meaning that up to 2 agents can be active at once, including you.\n\n{model_override}"
);
for marked in [false, true] {
let instructions = MultiAgentRoleInstructions::Composed {
base: "Role.\n## Plan tool\nOmit role checklist guidance.\n## Work\nContinue."
.to_string(),
marked,
omit_update_plan_instructions: true,
max_concurrency: 2,
wait_agent_enabled: true,
expose_model_overrides: true,
};
let expected_text = if marked {
format!("<multi_agent_role>{expected_body}</multi_agent_role>")
} else {
expected_body.clone()
};
assert_eq!(
instructions.render_fragment(),
RenderedFragment::new(
"developer",
AnnotatedContent::text(
expected_text,
ContentItemKind("multi_agent.role_instructions".to_string()),
ContentItemMetadata::harness(),
),
let instructions = MultiAgentRoleInstructions::Composed {
base: "Role.\n## Plan tool\nOmit role checklist guidance.\n## Work\nContinue.".to_string(),
omit_update_plan_instructions: true,
max_concurrency: 2,
wait_agent_enabled: true,
expose_model_overrides: true,
};
assert_eq!(
instructions.render_fragment(),
RenderedFragment::new(
"developer",
AnnotatedContent::text(
format!("<multi_agent_role>{expected_body}</multi_agent_role>"),
ContentItemKind("multi_agent.role_instructions".to_string()),
ContentItemMetadata::harness(),
),
);
}
),
);
}