Calleragent starts a helper; send_message reaches an existing agent
Admit JobLimits checked here; a busy target queues in the inbox
Branch turnOwn context and tool loop
Back to the callerForeground: the tool result. Background: a notice. Both carry reply, files and usage.
A saved AgentSpec is reusable configuration (Agent configuration). A runtime branch is conversation state and can run many Jobs; creating one creates no AgentSpec. To isolate code edits: worktree tools. How the 21 reference harnesses do this: comparison.
Tools
The model sees five collaboration tools. The others still run for stored transcripts and programs, but are not offered to the model.
Tool
Does
agent
Starts a new helper: fresh or forked, foreground or background, in the folder or its own worktree
send_message
Gives work or a question to an agent that exists: a saved Agent by name, a conversation, a helper, a branch. Also waits on one with notify_when_idle.
list_agents
Branches and conversations to address, plus running or queued work with its execution_id
read_conversation
Reads history; given an execution_id it reports that Job's status and result
close_agent
Stops a helper this conversation started and archives its branch; given an address, archives it
Hidden from the model
Replaced by
agent(to=...)
send_message(to=...); the parameter is refused with that pointer
handoff
Removed. send_message resolves conversations by title and Agents by name; stored hand-offs moved onto it (Stored hand-offs)
job_output, list_jobs
read_conversation(execution_id), list_agents
archive_agent
close_agent
mixture_of_agents
Opt-in: left out of the full preset, so an automatic Agent does not carry it; an Agent gets it by naming it or with the mixture_of_agents preset. It asks several models for one answer, which is not collaboration, and every listed tool costs prefix tokens (Pi keeps its list small for the same reason).
A stored call to a hidden tool still renders and replays. A background call returns execution_id, equal to Job.id. The UI and API cancel through the execution.command envelope (execution control).
Call
Branch
Execution
agent(prompt=..., description="scout")
New root; sees only the prompt
Admits a Job. Foreground returns the result; run_in_background=True returns execution_id.
agent(..., start_from="fork")
Copy of the caller's history, sharing its cached prefix
As above; the fork cannot start helpers of its own
agent(..., start_from="SID:MSG")
Forks that exact node
As above
agent(..., agent="Explorer")
New, on that saved Agent's model and tools
As above
send_message(to=..., message=...)
Existing
Always admits a Job and returns execution_id; a busy target gets it queued
Delivers nothing: answers now if idle, else one notice when idle
Parameters and their rules
Item
Rule
agent schema
prompt, description, agent, start_from="fresh", run_in_background=False, isolation="", archive_when_done=False. No model parameter.
send_message schema
to, message="", notify_when_idle=False
start_from
fresh (default): only the prompt. fork: the caller's history, and the system prompt the caller's branch recorded, byte for byte (loop_runner.forked_prompt), so the provider's prompt cache is shared; with another Agent it falls back to fresh and says so. SID:MSG: that node. The older inherit and clean still mean fork and fresh.
agent
A saved Agent, or an Agent from a Markdown agent file (Saved Agent settings), by id or name from the roster at the end of the tool description. Empty: the caller's own Agent. An Agent with delegation off is refused unless it is the caller's own.
The base instructions (runtime/context/prompt_assembly/guides/base.md) forbid spawning unless the user, AGENTS.md or a skill asks for sub-agents, delegation or parallel work, as Codex does. This rule is kept as is.
to address
In order: SID:HEAD, a branch or helper name, a conversation id or exact title, a saved Agent's name or id (its one conversation). Ambiguous names fail with candidates; a missing target is an error, never a new branch. A message to a running helper the sending turn started reaches it at its next tool step (Busy targets).
Direct self-delivery
Refused
Decisions
Each choice follows one of the 21 reference harnesses (comparison).
Choice
Follows
Compared and why
Depth 1
Codex agent_max_depth=1
Claude Code also lets helpers not spawn; OpenCode and Hermes allow nesting with no default bound. One level covers fan-out and keeps cost and review traceable; a setting raises it.
6 running per conversation, rest queued
Codex agent_max_threads=6
Claude Code caps concurrency only by its tool loop; Kimi queues past its pool. A queue keeps every request and needs no retry.
No peer stops on spend by default; a cap per tree, not per helper, bounds a fan-out as a whole. Unknown prices are not guessed.
Stalled after 10 min, stopped after 2 h
ZCode stall detection; Kimi Code's two-hour item limit
A stall is reported, not stopped: a long tool can be quiet and right. The hard stop catches a helper that never ends.
Fresh by default, fork on request
Claude Code subagents (fresh) and its fork (shared prefix)
Codex forks by default and pays for the history; a fresh brief is cheaper and forces a clear task. A fork shares the cached prefix, so it is cheap when asked for.
One result shape
Claude Code task-notification
OpenCode pushes a child's text only; usage and files make a result checkable without reading the transcript.
Stop is told to the caller
OpenCode push on child end
A stop by the person or a limit arrives as a notice like a finish, so the caller never waits on a helper that is gone.
Callable Agents in the description
Claude Code lists subagent_types in its Agent tool
OpenCode marks agents primary or subagent; one switch per Agent does the same. The list is sorted by id so one edit moves nothing else.
No per-call model
OpenCode and Claude Code agent files
Codex lets the call pick a model; keeping it on the Agent makes cost and behaviour a setting the person controls. A helper runs in its caller's conversation, whose model would otherwise win, so agent(agent=…) passes the specialist's own model with the call (delegation.delegate_model); running the caller's own Agent keeps the conversation's model.
Read-only Explorer on the utility model
Claude Code Explore, Codex explorer, OpenCode explore
A safe default helper for search and reading that never needs a worktree. All three run their scout on a small model; without a model of its own Explorer takes the Lightweight helper's, so the person picks the cheap model once.
One message tool
Codex send_input, Claude Code SendMessage
Three ways to reach an agent (agent(to=), send_message, handoff) differed only in addressing; one tool with all addresses removes the choice.
4 hops, 20 per hour, no approval
The earlier handoff limits; Hermes, Maka
A hop limit stops ping-pong; the hourly limit stops a loop the hop count misses, and is kept in the sender's conversation folder so a restart does not start a new hour. No peer asks the person between agents.
A message back up its own chain is refused
The always-on hand-off's ancestors
A→B→A otherwise runs until the hop count ends it, after several useless turns. Each delivery carries who waits above it, so the loop is refused when it forms.
A passed-on message waits for the real answer
The always-on hand-off's owed_after chain
Without it, when B passes A's message to C, A hears B say "I asked C". The answer to A is held until C's reply has reached B and B's turn on it has ended (a relay entry in A's notices.json). B's notice turn records its end (answered); after a restart, notices already taken count as answered.
A message to one's own running helper steers it
Hermes action: steer, Grok's steer delivery
Claude Code queues every SendMessage until the turn ends, which lets a helper finish the wrong task. The relation decides, with no parameter: the turn that started the helper reaches it at its next tool boundary through the same durable steer command Activity's "Add instruction" uses; anyone else's message queues.
Background writer gets a worktree
Claude Code isolation: worktree
Two writers in one folder corrupt each other's edits; a foreground helper has the caller waiting, so it shares.
Merge and discard wait for the helper
Kimi Tower (one writer per worktree)
A worktree merged while its helper still writes loses the rest of its work or merges half an edit. Merge and discard are refused with owner_running until the helper Job ends; the helper's own end and a spawn that failed to start pass owner_done.
A helper loses scheduling, channel and memory-writing tools
Hermes' delegate blocklist, reduced
A helper reports; the agent that started it schedules, posts and writes memory. scheduler (and its older name cron), remind, save_routine, always_on_schedule, chat_send and memory_update leave a fresh helper's list; a forked helper keeps them listed and refused, so its list stays its caller's bytes.
The caller's transcript only grows
Claude Code results in one call; OpenCode's child session
A background helper's card is written while it runs and renders only what it was written with (name, task, its execution_id); status, reply and usage stay on the node for the interface and the result arrives as the notice. Re-rendering the card when it ends would change bytes in the middle of the caller's cached prefix. Such a card is marked result_in="notice"; an older card without it still renders its report.
Markdown agent files are read
Kimi CLI reads its peers' agent files
A project's .claude/agents or .agents/agents works in every tool that opens it. They are read-only here: the file stays the place to edit them.
Activity shows a helper as the step that started it; there is no list of helpers
Claude Code's background task list and its one-line "Done" for a finished subagent; Codex's /agent switcher
Claude Code lists background work while it runs and shows a finished subagent as one line; Codex lists open agent threads; OpenCode keeps child sessions out of its session list. None keeps finished helpers in the open. On the work chart a helper is one line in the step that started it: a finished one takes no room and a failed one stays where it failed. What waits for the person is a red count on its glyph.
Todos carry no owner
Codex and Claude Code todo lists
Who works on what is the agent tree and Activity; an owner field on a todo was a second, unchecked claim. Old boards still show theirs.
A helper's permission is its caller's, cut by its own Agent
Codex roles (core/src/agent/role.rs)
Claude Code lets a parent in Bypass or Accept edits override the subagent's own permissionMode, so a strict Agent can be loosened by its caller. Intersecting both ways means neither side can widen the other, and an Agent that sets nothing runs as its caller, asking nothing new.
A foreground helper asks on its caller's card
Claude Code foreground subagents and fork (permissionMode: 'bubble', leaderPermissionBridge.ts)
Copilot CLI shows the prompt inside the subagent view and Antigravity makes the person jump to it (Alt+J); both move the person away from the conversation they are in. The caller is already waiting, so its card is where the person looks.
A background helper is refused instead of asking
Claude Code background agents (shouldAvoidPermissionPrompts)
Nobody waits on it, and a card left open would hold the helper and its worktree for good. The refusal tells it to report what it needed, so the caller can do it or ask.
Stored hand-offs move to send_message
Claude Code SendMessage; the Job-keyed recovery of wave 4
Keeping the old replay would keep a second store and its ten-minute drop. Every entry moves once, onto a tracked Job, a watch or a relay with an id fixed by the entry, so a repeated start delivers nothing twice and the replay code is gone.
Saved Agent settings
Setting
Rule
delegation
on: listed in the agent description and startable by other agents. Empty: on for an Agent with tools, off for one without (tools.mode="none"). Editing the list announces a prefix-cache break (agent_roster).
isolation
worktree or none when started by another agent. Empty: a background helper whose tools can write gets its own worktree in a git repository, otherwise shares the folder. A call's isolation wins. The worktree cannot be merged or discarded while its helper runs (owner_running).
permissions
What it may do when another agent starts it: mode, allow, deny, ask (rules), additional_directories, sandbox. Each key only narrows its caller (Permissions). Empty: it runs as its caller. Its tool policy narrows the same way.
Explorer
Built-in, read-only (read, search, web, read_conversation). Without a model of its own it runs on the utility tier: the Lightweight helper's model when that has one, else the usual fallback (builtin_agents.UTILITY_TIER).
Markdown agent files
.claude/agents/*.md and .agents/agents/*.md in the project folder (up to its git root) and the home folder, nearest first, at most 50. Frontmatter name and description are required; tools maps Claude Code names (Read, Bash, …) and drops the rest, none meaning every tool; model counts only as provider/model; isolation as above; the body is the system prompt.
A Markdown agent here
Id md:<file stem>, delegation on, memory off. A saved Agent wins a name. Writes do not see them (update, delete and set-default report not found); duplicate one to edit it here. Not on the Agents page.
The Agents page edits both: General has the switch "Other agents can use it" (delegation; an Agent that never set it shows its default), Advanced has "When delegated" (isolation: Automatic, Same folder, Own worktree). Both settings are stored on agent.json and travel through PATCH /api/agents/{id} and AgentConfigDTO. Empty means the default, so no stored Agent is rewritten.
Permissions
For every helper and delivered message, the caller's mode, rules, extra folders and Sandbox are frozen into the Job when it is admitted (spawn_permission_snapshot), a Sandbox left to the caller's project resolved against the caller's conversation; the Agent's permissions block then narrows them.
Setting
The helper gets
Mode
The stricter of the two, in the order Plan, Ask, Accept edits, Auto, Bypass
Deny and ask rules
The caller's plus the Agent's
Allow rules
The caller's; when the Agent lists allow rules, only those it also lists. An Agent's allow rule alone allows nothing.
Extra folders
The caller's; when the Agent lists folders, only those it also lists
Sandbox
On when either turns it on
A call that needs approval, in
Result
A foreground helper (fresh or fork) of a person's turn
The existing approval card in the caller's conversation. Its title row names the helper in a badge (asked_by on the question frame) on the command, screen and terminal cards; the CLI prompt and a channel message put the name after their heading. The answer resumes the helper; the caller's tool call keeps waiting through it. "Always allow" saves the rule for the conversation as usual.
A foreground helper forked into another conversation (start_from="SID:MSG")
The same card, shown in the caller's conversation where the person waits: the question carries asked_in_session, so the live frame and a reload's list (waits.list_open) put it there.
A background helper, a delivered message, or a caller no person answers for
Refused at once (HELPER_CANNOT_ASK): the tool result says to go on without it and name what was needed in the final reply. Nothing waits.
The route is frozen on the helper's stored input (asks_through) at admission, only when its caller is the live owner turn whose policy it inherited. This moves where an existing question is shown; it adds none.
Branches
Topic
Behaviour
list_agents(scope, limit, agent_id, source)
session (default): this session's branches and its running or queued work. all: every session, most recent first, no previews. archived: this session's archived branches.
Each line
Session: id, title, agent, busy or idle. Branch: name, to="SID:HEAD", turns, size, tip preview.
Names
From description, else the prompt truncated to about 24 characters; a background LLM retitles at turns 1, 6, 16 and 40 (branch naming)
Spawn name
The description as written, at most 48 characters cut at a word. Spaces stay as typed, two in a row included, as Claude Code keeps an Agent call's description; only a line break or tab becomes one space. The branch, list_agents, Activity, notices and the result's name show it. Only a worktree's ref and folder use a slug of it.
Addressing a name
Stays an address for life: to="scout" reaches the current tip after a rename or finish. A name with spaces is written as it is (to="Spell the word harbor"); case, spaces and punctuation are folded only when no exact match exists, so the underscore form older agents were stored with reaches the same agent.
Closing and archiving
close_agent(execution_id) checks the Job belongs to this conversation, stops it with its descendants (cancel.parent, so no stop notice comes back about the caller's own act), archives its branch and drops its pending notice. Archiving writes archived: true to the branch; history is kept and there is no unarchive.
On an archived branch
Result
Normal list_agents
Hidden; scope="archived" shows it
New send_message
Refused
Running execution
Continues, unless closed with close_agent
read_conversation, historical fork
Allowed; archive grants nothing
agent(archive_when_done=True)
Archived by the terminal hook once its result is back
Results
A finished, failed, stopped or stalled helper reports in one block, whether it comes back as the tool result or as a notice:
<agent name="scout" id="j_4f2…" status="completed">
Found the leak in pool.py: the reader never closes on timeout.
files: 2 changed (+14 −3): pool.py, test_pool.py
usage: 2 min 10 s · 18 tool calls · 41.2k tokens · $0.084
</agent>
Part
Rule
status
completed, failed, stopped or stalled; a limit adds reason (user, spend cap, timeout, idle limit)
Reply
The final reply, cut at 20,000 characters with a read_conversation pointer; a background spawn's reply travels in the notice (an older unmarked card carries it instead); a stopped helper, waited on or in the background, has no final reply and reads (no reply) Its work so far: read_conversation("<id>"), with its branch tip set to the reply row it was writing, as Claude Code tells the caller only that the task was stopped
Files
When the helper had its own worktree: changed files and line counts
Usage
Duration and tool calls on its branch; tokens and cost from the usage ledger for the helper and every helper under it (agent_result.subtree_job_ids); a cost with an unknown price is left out, not guessed
Stage
Behaviour
Queue
Every terminal path goes through JobRunner._update_attach_card: patches the card with status, usage and, for a helper with its own worktree, the files it changed (attach.files: count, branch, uncommitted), applies archive_when_done, queues an entry in the caller's notices.json. Background Jobs that completed, errored, or were stopped by the person or a limit; a stall is queued once as its own entry.
Deliver
run_job_notices wakes when a notice is queued and, while one waits for a busy session, when a conversation may have gone quiet (a turn ended, a run slot was given back, an execution or Job changed); it resyncs every 300 s; a session is busy while a foreground execution runs. All pending entries become one automated notice turn (source="job_followup"). A notice has no timeout, so a reply is never dropped while the caller is busy.
Failure
Reported the same way; the notice says to retry narrower with send_message or tell the user. Nothing is resubmitted automatically.
Stored hand-offs
The removed handoff tool kept its turns in <state>/always_on/handoffs.json. When the Worker starts, every entry moves (always_on/handoff_migration.py) and the file is left empty; the hand-off's own replay is gone:
Entry
Becomes
Waiting message
A delivery from its sender to its target, keeping its hop count and who waits above it; the reply comes back as a notice
Waiting reply
A delivery from the conversation that answered (named in the reply) to the one that asked
Running or paused turn
A watch: its sender gets the conversation's latest reply once it is idle (notices.watch)
Earlier conversations it also owes (owed_after)
A relay each, nearest first: each gets the answer of the one below it once that one has answered (notices.hold_reply)
Finished, or a reply naming no conversation
Kept in the record only
The file is copied once to handoffs.before-migration.json first. Every entry is kept as it was in handoffs.migrated.json with its delivery state and execution_id. Each delivery's Job id and each watch's id are fixed by its entry, so a Worker that stops midway delivers each one once.
A delivery send_message refuses stays pending under a new Job id and is tried again at the next Worker start; one whose conversation is gone is marked failed. migrate() without apply only reports. The transcripts' 📨 and ↩️ rows are unchanged.
The chat reads a stored row's header and draws it as the one-line row other agent traffic gets, when the conversation it names exists.
The recipient answers in its final reply; a send_message back would deliver it twice, and the receipt says so. A message from another conversation is marked as another agent's input, not the recipient's user.
Attach pointers and cross-session spawns
A spawn writes an attach pointer with predecessor = caller_msg_id; the sub-branch never merges into the caller. send_message writes none, so its reply stays inline in the notice.
Caller node A in S with start_from="T:M" runs in T. The Job records parent_session_id=T, parent_msg_id=M, caller_session_id=S, caller_msg_id=A. The card in S is looked up by extra.attach.session_id and head_id; neither creating nor finishing it moves the selected HEAD of S or T (DAG attach rendering).
Busy targets
Only the turn that started a helper can reach it mid-turn; every other message waits, and none is lost.
Case
Behaviour
Cross-session
Busy if run_control.is_turn_running(target)
Same session
Busy if an unfinished job's head or parent is the tip (inbox.branch_busy)
Queued in
<session-repo>/inbox.json; the entry also travels on the Job (Job.deferred_inbox), so a Worker that dies before or after the write recreates it once
Drained
At turn end and by the 2 s sweep. Deleted only after submission; a Job that already left the queue only removes the entry (hand-offs across a crash)
Full, duplicate
50 entries, the oldest dropped with a notice to its sender; the same text from the same sender within 60 s is refused and its Job cancelled
The sender started the target
A running helper the sending turn started (same conversation, same parent Job) gets the message as a steer at its next tool boundary (send_message/steer.py), stored with its execution like the person's "Add instruction" and written into its branch as agent input. The inbox entry is written too, marked with the steer's command id: a steer the turn never reached is delivered at turn end, one it took is dropped.
"Add instruction" on a helper
A helper's own turn takes steers, so the person's instruction reaches sub-agents too
Limits
Setting
Default
Counts
agent.max_spawn_depth
1
Generations along a chain: the person's agent may start helpers, a helper may not. A fork keeps the agent tool so its tool list matches its caller's cached prefix; its spawn is refused when run.
agent.max_running_agents
6
Jobs running at once in one conversation; the rest wait queued. An explicit resource_limits.max_live_per_session wins.
agent.max_tree_usd
2.0
Known-price spend of every helper started from one turn, and everything they started
agent.stall_minutes
10
Minutes without model or tool activity before a helper is reported stalled, once
agent.max_agent_hours
2
Hours a helper may run before it is stopped
agent.max_hops
4
Times a message may be passed on along a chain
agent.max_sends_per_hour
20
Messages one conversation sends per hour, counted in its folder (sends.json) so a restart keeps the hour
agent.max_spawn_fanout
0 (off)
New branches per caller turn
agent.max_messages
0 (off)
The older message budget along a chain; still honoured when set
0 turns a limit off. The spend, stall and hour bounds are watched from outside the Job (runtime/jobs/delegation_watch.py, every 5 s) rather than set as resource-governance limits: a governance limit makes a Job strict, which refuses every synchronous tool and every model with an unknown price, right for a limit set on purpose and wrong for a default (resource governance).
When exhausted
Result
Depth, fan-out, messages, tree spend
The spawn is refused with the setting to change; no branch or Job. At the depth limit the agent tool is not offered.
Hops, sends per hour
send_message is refused with the setting to change
A message to a conversation waiting on this chain
Refused when it would close the loop (depth.closes_cycle); nothing is sent
Tree spend while running
Running helpers of that tree stop with budget.tree_cost_exhausted; the caller gets the notice
Two hours
The helper stops with budget.runtime_exhausted; the caller gets the notice
Stall
Nothing stops; the caller gets one stalled notice and may close_agent or wait
Execution resources
Rule
Behaviour
Charged to
Job.parent_session_id, the session that runs the work
Reaches admission
Every agent call, foreground included, and every send_message
max_queued_per_session, max_jobs_per_session
quota.queue_full, quota.jobs_exhausted; no Job created
Worker pool
OPENPROGRAM_JOB_WORKERS (default 8) bounds the process; the running-agents default applies only below it. The pool sits above agent.max_running_agents so that default is reached; a narrower pool would quietly lower it. Codex runs its 6 agent threads at once and openclaw runs a pool of 8; 8 leaves one conversation its 6 with room for other work beside them.
Cancellation
Follows parent_job_id: prevents unstarted descendants, requests cancellation of active ones, stays stopping until exit is acknowledged.
A stop by the caller itself (close_agent, cancel.parent) sends it no notice.
A terminal Job stays queryable; cancellation is idempotent.
Live view and authority
Topic
Behaviour
Live updates
Both sides update as deliveries and replies land (event layer)
Agent traffic
Rows, never user bubbles; the receiver's row is named after the sender from the header [message from SID:HEAD (sender)], and a reply from another conversation reads “Butler” replied. Each is one line that opens in place to the full text; a find match inside a closed line opens it. A message a person typed stays a bubble.
Reference card
A helper that runs in another conversation, or a branch attached by hand, keeps a card in the caller's transcript: one row with its character, name, state, task, time and cost, opened to its reply and changed files (the reference card). A helper of this conversation is a step row in the turn's timeline.
Unattended
A policy denying side effects holds send_message and sub-agents before they act
Result access
read_conversation(execution_id) and close_agent require the execution, caller or an ancestor session
Activity roster
GET /api/session/{id}/activity/roster gives every Job of the conversation by id: agent_status (running, needs approval, needs input, stalled, idle, failed), queued and usage (tokens and cost of its subtree, its own tool_calls), plus outgoing, the unanswered messages to others. A helper that ended with everything under it is read once. A run's events carry the same status and usage; a Job's resource view adds budget.subtree. Source: the agent_roster_facts hook (runtime/jobs/agent_status.py). Drawn as in Activity panel.