Multi-agent collaboration

Project roles organize independent work. Agent ancestry organizes subtasks.

Project main
  ├─ Worker A, independent /root
  │    └─ Child /root/review
  └─ Worker B, independent /root

Main and workers

Main answers simple requests directly and delegates substantial work through create_thread. A worker starts with fresh history and its assignment. Both roles run the model-and-tool loop with configured permissions.

Worker outcomes enter a project report queue. One collector runs report turns under main's execution lock. Main therefore ends its turn after dispatch so collection can proceed. Reports are attributed data rather than new tasks or authorization to restart completed work.

Children and messages

A worker uses spawn_agent for scoped subtasks. Children have independent conversations and inboxes, inherit effective settings, and can receive a filtered fork of parent history. They remain available after completion.

OperationEffect
spawn_agentRegister a child and start its assignment
send_messageQueue attributed information without starting a turn
followup_taskDeliver more work to a child and start it if idle
list_agentsRead tree status
wait_agentWait for activity in the caller's mailbox
interrupt_agentCancel a child's execution while preserving history

Child completion automatically notifies its parent. The parent waits for needed child results before answering. Independent workers report to project main.

Main uses create_thread to delegate authorized work. Other callers use it when the user explicitly requests a new chat. An idle worker continues through a direct follow-up in its chat; send_message only queues information.

Shared workspace

Separate conversations share files and processes. Concurrent writes need coordination. Messages, report queues, and agent registries live in memory; shutdown cancels outstanding work.

Implementation: agent/control.rs.