Delegation tools
Delegation is not a prompt trick in this codebase. It is a first-class tool family built around:AgentToolSendMessageToolTaskStopToolTeamCreateToolTeamDeleteTool
Agent lifecycle
The high-level cycle is:- spawn a worker or subagent
- let it run asynchronously
- receive a task notification back into the main transcript
- continue, stop, or synthesize the result
src/coordinator/coordinatorMode.ts documents this model more explicitly than most modules in the repo.
Approval model
Delegation is security-sensitive because it can create more tool-executing actors.permissionSetup.ts explicitly treats agent allow rules as dangerous in auto mode. The code comment is direct: auto-approving agent spawns would bypass prompt-level review of the subagent task.
Worker capabilities
Coordinator mode computes worker-visible tool context dynamically. In simple mode, workers are limited to a smaller set such as Bash, Read, and Edit. Outside simple mode they inherit a larger allowlist and may also receive MCP tools and skills.Teams and swarms
TeamCreateTool and TeamDeleteTool only appear when agent swarms are enabled. They are not part of the baseline public tool set.
This matters because source-level presence does not imply a stable public feature.
Transcript behavior
Subagent work is persisted in separate transcript paths under the session directory.src/utils/sessionStorage.ts includes explicit helper functions for agent transcript and metadata files.
That is why subagent resumption is stateful rather than a transient UI illusion.