Subchapter 54.46
spawn-reference.mdMarkdown9 KBView on GitHub
You MUST dispatch every agent spawn via the platform’s tool:
task toolrunSubagent toolcreate_session tool (when available — see Sub-Sessions below)Platform detection (run once at session start):
create_session tool exists → App mode → sub-sessions for commit-producing workrunSubagent tool exists → VS Code mode → subagentstask tool exists → CLI mode → task toolWhen create_session is available, spawn commit-producing agents as sub-sessions instead of tasks. Each agent appears as a clickable session in the left nav with real-time visibility.
When to use sub-sessions vs task:
create_session): Agent produces commits, needs worktree isolation, or benefits from persistent session visibilitytask tool): Pure analysis, coordination, read-only research, or quick one-shot workSub-session parameters:
name: "{Name} {verb}ing {noun}" — 40-char max, sentence case (e.g., “EECOM refactoring auth”, “Flight reviewing arch”)coordinate_with_creator: true (always — enables cross-session messaging)notify_on_idle: "once" (coordinator gets notified when agent finishes)kickoff.prompt: The full agent prompt (same as task prompt below)kickoff.mode: "autopilot" (agents work autonomously)kickoff.model: "{resolved_model}"Constraints:
task tool.create_session fails, degrade gracefully to task tool for that agent.Sub-session template:
create_session({
name: "{Name} {verb}ing {noun}",
coordinate_with_creator: true,
notify_on_idle: "once",
kickoff: {
prompt: "{full agent prompt — see template below}",
mode: "autopilot",
model: "{resolved_model}",
reasoning_effort: "{resolved_effort}"
}
})Result collection: When notify_on_idle fires, the coordinator receives the session result via cross-session notification. No polling required.
Standard spawn via task tool — used in CLI, or as fallback when create_session is unavailable:
agent_type: "general-purpose" (always — this gives agents full tool access)mode: "background" (default) or "sync" — use "background" for all parallelizable work; use "sync" only when the result is needed before the next step can proceeddescription: "{Name}: {brief task summary}" (e.g., "Ripley: Design REST API endpoints", "Dallas: Build login form") — this is what appears in the UI, so it MUST carry the agent’s name and what they’re doingprompt: The full agent prompt (see below)⚡ Inline the charter. Before spawning, read the agent’s charter.md (resolve from team root: {team_root}/.squad/agents/{name}/charter.md) and paste its contents directly into the spawn prompt. This eliminates a tool call from the agent’s critical path. The agent still reads its own history.md and decisions.md.
Background spawn (the default): Use the template below with mode: "background".
Sync spawn (when required): Use the template below and omit the mode parameter (sync is default).
VS Code equivalent: Use
runSubagentwith the prompt content below. Dropagent_type,mode,model, anddescriptionparameters. Multiple subagents in one turn run concurrently. Sync is the default on VS Code.
Template for any agent (substitute {Name}, {Role}, {name}, and inline the charter):
agent_type: "general-purpose"
model: "{resolved_model}"
mode: "background"
name: "{name}"
description: "{emoji} {Name}: {brief task summary}"
prompt: |
You are {Name}, the {Role} on this project.
YOUR CHARTER:
{paste contents of .squad/agents/{name}/charter.md here}
TEAM ROOT: {team_root}
CURRENT_DATETIME: <resolved CURRENT_DATETIME literal>
All `.squad/` paths are relative to this root.
Use the literal CURRENT_DATETIME value from your prompt for dated file content:
`<literal CURRENT_DATETIME value from your prompt>`. Substitute the actual CURRENT_DATETIME value; never write placeholder text.
PERSONAL_AGENT: {true|false} # Whether this is a personal agent
GHOST_PROTOCOL: {true|false} # Whether ghost protocol applies
{If PERSONAL_AGENT is true, append Ghost Protocol rules:}
## Ghost Protocol
You are a personal agent operating in a project context. You MUST follow these rules:
- Read-only project state: Do NOT write to project's .squad/ directory
- No project ownership: You advise; project agents execute
- Transparent origin: Tag all logs with [personal:{name}]
- Consult mode: Provide recommendations, not direct changes
{end Ghost Protocol block}
WORKTREE_PATH: {worktree_path}
WORKTREE_MODE: {true|false}