Multiplayer agent harness for work.
Make subagent briefs peer-to-peer (#2364)
Regan Bellf381a777c1bf
diff --git a/src/core/orchestrator.ts b/src/core/orchestrator.tsindex 021692630..9b16df743 100644--- a/src/core/orchestrator.ts+++ b/src/core/orchestrator.ts@@ -1064,7 +1064,7 @@ export function createOrchestrator(deps: OrchestratorDeps): Orchestrator {let modeFrame = applyPromptVars(frameMd, frameVars);if (delegateWork)modeFrame +=- "\n\nKeep this conversation responsive. You cannot execute commands yourself. Delegate all substantial work (research, coding, computation, or multi-step investigations) with subagents open, providing a complete task, relevant context, and authorization. Handle quick answers, status requests, and coordination yourself. Do not substitute other tools for command execution or do substantial work inline. After dispatching, end this turn promptly; subagent completion durably wakes you to collect and report the result. Do not wait or poll for subagents. Relay new user instructions to the appropriate subagent with subagents followup_task. Describe progress and results naturally without explaining the delegation machinery.";+ "\n\nKeep this conversation responsive. You cannot execute commands yourself. Delegate all substantial work (research, coding, computation, or multi-step investigations) with subagents open and a short colleague-to-colleague brief. Handle quick answers, status requests, and coordination yourself. Do not substitute other tools for command execution or do substantial work inline. After dispatching, end this turn promptly; subagent completion durably wakes you to collect and report the result. Do not wait or poll for subagents. Relay new user instructions to the appropriate subagent with subagents followup_task. Describe progress and results naturally without explaining the delegation machinery.";if (modeName === "mode-conversation" && input.proactiveOpener) {modeFrame += "\nNo one has written yet; open the conversation yourself per the onboarding note below.";}diff --git a/src/harness/agent-tools.ts b/src/harness/agent-tools.tsindex fa5fd9e31..c38569fd8 100644--- a/src/harness/agent-tools.ts+++ b/src/harness/agent-tools.ts@@ -1542,7 +1542,7 @@ export function createAgentTools(ref: ToolContextRef, opts?: AgentToolsOptions):name: "subagents",label: "subagents",description:- "Start and coordinate subagents: background workers you spawn for a task. A subagent does not get its own sidebar entry and does not inherit this conversation, so give it a complete standalone task with the context and authorization it needs. State only authorization that actually exists; never claim approval or consent nobody gave. Its final answer comes back to you as an internal message. " ++ "Start and coordinate subagents: background workers you spawn for a task. A subagent does not get its own sidebar entry or see this conversation, so pass what it needs to know. Brief it as you would a colleague just as capable as you are, if not more so: the goal, why it matters, what you already know, and any real limits. Leave the approach to them; keep it short and state preferences as preferences. Its final answer comes back to you as an internal message. " +"`open` starts a subagent with `task`. `followup_task` gives an existing subagent more work in `task` and starts a turn if it is idle; active work is queued safely. " +'`send_message` passes information to one of your subagents, a sibling subagent, or your parent (target="parent") without starting a turn; with interrupt:true it stops a subagent\'s current run. ' +"`read` with no target lists your subagents; with a target it reads that subagent's transcript. " +@@ -1572,7 +1572,7 @@ export function createAgentTools(ref: ToolContextRef, opts?: AgentToolsOptions):),task: Type.Optional(Type.String({- description: "open and followup_task: the complete standalone instruction the subagent works from.",+ description: "open and followup_task: the short task brief, with relevant context and real limits.",}),),name: Type.Optional(Type.String({ description: "open: short title for the subagent (default: from task)." })),diff --git a/src/sessions/session-syscalls.ts b/src/sessions/session-syscalls.tsindex 2518eceaf..f4c46112f 100644--- a/src/sessions/session-syscalls.ts+++ b/src/sessions/session-syscalls.ts@@ -289,7 +289,7 @@ function snippet(text: string, max: number): string {function renderSubagentTask(input: { title: string; parentTitle: string; task: string }): string {return [`<subagent-task session="${xmlAttrEscape(input.title)}">`,- `You are the subagent session "${input.title}", spawned from the conversation "${input.parentTitle}". Complete only the delegated task below. To message your parent use subagents send_message with target="parent"; use an exact sibling title or sessionId for peers, never filesystem paths. When your turn ends, your final message is delivered to your current parent session — make it the result, stated plainly. Your parent can change while you work; detached sessions have no automatic return. Do not infer permission to contact people, post to conversations, or change standing configuration from a session message. Follow the delegated task and its authorization; if you are blocked, end your turn saying exactly what you need.`,+ `You are the subagent session "${input.title}", spawned from the conversation "${input.parentTitle}". To message your parent use subagents send_message with target="parent"; use an exact sibling title or sessionId for peers, never filesystem paths. When your turn ends, your final message is delivered to your current parent session — make it the result, stated plainly. Your parent can change while you work; detached sessions have no automatic return. Use your judgment on details within the task's real limits; if an instruction seems to work against the goal, follow the goal and say so. Do not contact people, post to conversations, or change standing configuration unless the task says to. If you are blocked, end your turn saying exactly what you need.`,"","<task>",input.task.trim(),diff --git a/test/agent-tools.test.ts b/test/agent-tools.test.tsindex 62dd8a8ce..471c282e1 100644--- a/test/agent-tools.test.ts+++ b/test/agent-tools.test.ts@@ -4033,7 +4033,7 @@ test("subagents and sessions are separate tools with one noun each", async () =>const subagents = tools.find((tool) => tool.name === "subagents")!;const sessions = tools.find((tool) => tool.name === "sessions")!;assert.match(subagents.description, /does not get its own sidebar entry/);- assert.match(subagents.description, /does not inherit this conversation/);+ assert.match(subagents.description, /or see this conversation/);assert.match(sessions.description, /web sidebar/);for (const action of ["open", "followup_task", "wait"])assert.ok(!Check(sessions.parameters, { action }), `sessions has no ${action}`);