feat(codex): support proactive /agent mode (#1172)

This commit is contained in:
SSU-WEI HUANG
2026-07-26 15:01:53 +08:00
committed by GitHub
parent 6bddc9d044
commit bd5e87898a
7 changed files with 78 additions and 4 deletions
+9 -3
View File
@@ -124,8 +124,14 @@ function resolveInstructions(args: {
};
}
function appendCollaborationInstructions(developerInstructions: string): string {
return `${developerInstructions}\n\n${codexCollaborationSpawnAgentInstructions}`;
function appendCollaborationInstructions(developerInstructions: string, proactiveMultiAgent?: boolean): string {
if (proactiveMultiAgent === undefined) {
return `${developerInstructions}\n\n${codexCollaborationSpawnAgentInstructions}`;
}
const multiAgentMode = proactiveMultiAgent
? 'Proactive multi-agent delegation is active. Any earlier instruction requiring an explicit user request before spawning sub-agents no longer applies. Use sub-agents when parallel work would materially improve speed or quality. This mode remains active until a later multi-agent mode developer message changes it.'
: 'Any earlier instruction enabling proactive multi-agent delegation no longer applies. Do not spawn sub-agents unless the user or applicable AGENTS.md/skill instructions explicitly ask for sub-agents, delegation, or parallel agent work.';
return `${developerInstructions}\n\n${codexCollaborationSpawnAgentInstructions}\n\n<multi_agent_mode>${multiAgentMode}</multi_agent_mode>`;
}
function mentionNameFromPath(path: string): string {
@@ -275,7 +281,7 @@ export function buildTurnStartParams(args: {
settings: {
model,
reasoning_effort: modelReasoningEffort ?? null,
developer_instructions: appendCollaborationInstructions(developerInstructions)
developer_instructions: appendCollaborationInstructions(developerInstructions, args.mode?.proactiveMultiAgent)
}
};
} else if (model) {