config.json keys, see Subagent reference.
The following table helps you choose between working in main chat and delegating to a subagent:
Every subagent runs in the background. Let completion notices report back instead of polling, and call
subagent({ action: "wait", id }) only when your next step depends on the result.
Start with plain language
To delegate work in chat, describe the goal, boundaries, and verification check in plain language. Atomic picks the specialist and execution shape (single subagent, parallel batch, or forked context) for you. For example, ask Atomic to map a subsystem before editing:Bundled agents
Atomic ships nine bundled specialists. All of them usemodel: "auto" with no pinned fallback chain. You can pin a role persistently in settings.json under subagents.agentOverrides.<name>.model or per call with model. A concrete model runs only that model and the agent’s own fallbackModels (see Fallback models).
The following table lists each bundled agent, its default context, whether it edits files, and its preloaded skills:
worker also enables defaultProgress: true (isolated run-scoped progress.md), inheritProjectContext: true, and inheritSkills: false.
Browse agents with /agents
To inspect active agents in an interactive session, run /agents (or /agents <filter>). Atomic groups definitions in precedence order: Project, User, Built-in, and Package. Use these keys in the browser:
- Type to filter by name, description, or source.
- Select an agent and press
Enterto inspect its model, fallbacks, default context, tools, file path, and system prompt. - Press
Escto return to the list, then again to return to chat.
/agents is read-only: it never launches or edits agents, and it hides shadowed or disabled definitions so the view matches runtime precedence. Leaving /agents open never marks Herdr as blocked.
Outside interactive mode, run subagent({ action: "list" }). Unlike /agents, action: "list" hides overridden package agents while still showing shadowed user or built-in definitions alongside project overrides.
Compose review panels
You can combine specialists from distinct angles and synthesize their findings in your main session. The following table maps common review angles to bundled specialists:
For example, ask Atomic to run a three-angle diff review:
Context and Git worktrees
Choose the right context mode and Git worktree isolation before launching writers or independent reviewers.Fresh versus forked context
context: "fresh"starts an isolated child session with only the agent’s prompt and task. Usefreshfor independent research and adversarial reviews.context: "fork"branches from your main session’s latest settled turn. It fails fast if the main session can’t be forked (for example, an empty session with no settled turn) instead of downgrading silently tofresh. A forked subagent inherits the main session’s model, thinking level, active tool changes, and saved tool outputs without taking over other subagents or replaying Intercom cards.
fork when a subagent needs decisions already made in your main chat. A forked subagent sends the exact prefix the main session last sent (system prompt, project context, skills, tools, and messages), followed by its own role, a brief handoff note, and its task. On the same model and thinking level, its first request reuses the main session’s prompt cache and pays only for the new suffix. On another model or provider, it doesn’t share that cache; on another thinking level, it might share only part of it.
In a fork, inheritProjectContext and inheritSkills don’t hide what the main session already sent; those flags apply only to fresh subagents. A subagent’s own tool allowlist still applies: calling a disallowed tool returns an error naming the allowed tools, and child-only tools not exposed directly run through codemode restricted to the subagent’s allowed tools.
Fresh subagents inherit the main session’s model registry, authentication, and workspace discovery settings. A subagent’s tool list can only narrow permissions, never widen them beyond the main session.
Temporary worktrees
To isolate each parallel writer in a disposable Git worktree, passworktree: true on a parallel tasks call:
- Parallel mode only. Atomic creates temporary worktrees only for parallel
tasks: [...]batches (or multiple single-agent calls emitted in one assistant message). On a standalone{ agent, task }call,worktree: truehas no effect; useworktree: { branch }instead. - Clean tracked tree required. Launch fails before starting any subagent if tracked files have staged or unstaged edits (
git status --porcelain --untracked-files=no). Untracked files don’t block launch. - Base branch. Temporary worktrees branch from
origin/<default-branch>(fetching if needed), falling back toHEADwhen no origin default branch exists. - Automatic post-creation setup. After creating each worktree, Atomic copies
.atomic/settings.local.jsonand any untracked.atomic/settings.json, shares.huskyor.git/hooksthroughcore.hooksPath, symlinks (or creates a Windows junction for)node_modules, copies gitignored files listed in.worktreeinclude, and runsworktreeSetupHookif configured in subagentconfig.json. - Shared
cwd. Every task in aworktree: truebatch must share the samecwd; per-taskcwdoverrides that differ are rejected. - Patch capture and cleanup. After every subagent in the batch finishes, Atomic saves each subagent’s changes as a patch under
worktree-diffs/<run-id>and removes the temporary worktrees and branches. If patch capture fails for a worktree, Atomic keeps that worktree on disk and reports it in the diff summary. - Paused, quit, and cancelled subagents. Paused, quit, or session-closed subagents keep their temporary worktree only if it has uncommitted changes, untracked files, or new commits. Clean worktrees are removed;
resumerecreates them from base plus the saved patch (task-<n>-<agent>.<execution>.patch). Permanently cancelled subagents release their worktrees, while unresumed stopped worktrees with changes remain under.atomic/worktrees/. - Waiting on cleanup.
pause,quit, completion, and failed resume wait for Git cleanup. PressingEscstops waiting without cancelling cleanup; cleanup lasting over 10 seconds warns and continues in the background. Don’t delete a worktree directory while cleanup is finishing, a sibling holds the batch, or a Git process is still running. - Git hook integration. Git hooks can check
ATOMIC_SUBAGENT_WORKTREE_PHASE=finishingduring teardown, and extensions can subscribe tosubagent:finishing(see SDK integration and errors).
Named worktrees
To run a single subagent or specific parallel tasks on a permanent branch and directory, passworktree: { branch, base?, path? }. You can’t combine named worktrees with worktree: true. A top-level named worktree object applies to every task in tasks that doesn’t set its own worktree.
The following calls create named worktrees for single and parallel runs:
- No clean-tree requirement or automatic setup. Named worktrees work with dirty local checkouts. They don’t symlink
node_modules, copy settings or.worktreeincludefiles, setcore.hooksPath, runworktreeSetupHook, or save diff patches. - Permanent ownership. Atomic never deletes a named worktree or its branch. Resuming reuses the worktree, or checks the branch back out there if it was removed.
- Branch and path rules.
pathdefaults to.atomic/worktrees/<branch>(/replaced with+). Relative paths resolve against the caller’scwd, and an existing empty directory atpathis allowed. New branches use--no-trackand start frombase, then@{upstream}, thenHEAD. Atomic uses unused existing branches as-is and reuses a branch already checked out atpath. Launch fails fast if the branch is checked out elsewhere orpathcontains something else. - Subdirectory
cwd. If your session runs inside a repository subdirectory, the subagent starts in that same subdirectory inside the worktree (falling back to the worktree root if absent on the branch). - Concurrency and hooks. Different branches and paths run concurrently. Duplicate
(branch, path)launches wait and reuse; the same branch at a different path fails after the first finishes. A checkout hook can’t synchronously create another named worktree for the same branch or path (WorktreeReentryError). Preferworktree: { ... }over runninggit worktree addalongside subagents in the same turn.
Recover an interrupted named-worktree checkout. External Git locks time out after 30 seconds (
another git process seems to be running at <path>), and an interrupted prior checkout fails immediately (an interrupted named-worktree checkout left an incomplete worktree at <path>). To recover, confirm no Git process is running, back up any needed files, run git worktree unlock PATH, remove the directory, run git worktree prune, and clear stale HEAD.lock or branch .lock files (or run git worktree remove --force --force PATH). Never fix a partial checkout by deleting only index.lock.Background launches and waiting
Everysubagent launch runs in the background and returns immediately with each subagent’s taskId and intercomTarget (for example subagent-worker-1a2b3c4d-1). Use intercomTarget verbatim when messaging a subagent.
Subagents return their results directly. Atomic doesn’t infer acceptance gates, so put required tests, commands, or evidence checks directly in the task prompt.
The following examples launch a subagent, wait up to two minutes for its result, and check its status:
TASK_ID: ThetaskIdreturned by the launch (for exampletask-1-0-2).
- Waiting.
subagent({ action: "wait", id: "<taskId>", budgetMs? })observes an existing task launched by this session for up tobudgetMsmilliseconds (default30000ms). Ending a wait on budget, pressingEsc, user steering (input-needed), or an inbound Intercom message (intercom-coordination) leaves the subagent running. Wait again when you need its result (see Observation and wait matrix). - Repeating tasks (
count). In paralleltasks, setcount(integer>= 1) on an item to repeat itNtimes. Expanded items count towardparallel.maxTasks. - Concurrency. Multiple single-agent calls emitted in one assistant message combine into one parallel run sharing
concurrency(shared options must match across those calls; prefer one explicit{ tasks: [...] }call). Returning from launch or ending a wait doesn’t free a running slot. - Heartbeats. Running subagents send task heartbeats every 15 minutes by default. Override with
heartbeatMs(0disables; minimum60000ms). - Read directives (
reads).readsdoesn’t inline file contents. Instead, it prepends[Read from: <abs-path>, ...](resolved relative to the child’scwd) to the prompt so the subagent reads those files with its own tools. Single-agent mode accepts an array of paths orfalse(reads: trueis rejected and frontmatterdefaultReadsisn’t applied). Paralleltasks[]usesdefaultReadswhenreadsis omitted ortrue, and disables it onreads: false. - Output files (
outputandoutputMode). Whenoutputis set, Atomic injects**Output:** Write your findings to: <path>. If the subagent writes or updates that file, Atomic reads it back; otherwise Atomic writes the subagent’s final text there (creating parent directories). Passoutput: trueto use frontmatteroutput, oroutput: false(or"false") to disable it.outputMode: "file-only"requires anoutputpath and returns only the saved-file reference inline on success (failures still return inline details). Duplicateoutputpaths in one parallel batch are rejected. - Progress files (
progressandincludeProgress).progress: truecreates an isolated run-scopedprogress.mdin an artifacts directory outside your repository and childcwd. OmittingprogressinheritsdefaultProgress, suppressed automatically when the prompt uses read-only phrasing (review-only,no edits,do not edit, orleave files unchanged).includeProgress: trueadds progress telemetry only on direct blocking SDK runs without a background task host. - Settled output.
waitandstatusreturn up to 16 KB inline, plusFull output: <path>(Atomic keeps the 256 most recent copies in a private temporary directory cleaned on exit) andRequested output:whenoutputwas set. - Startup progress and retries. Before a subagent’s first turn,
statusreports its exact startup step (opening its session,loading its resources, waiting for a session-startup slot,creating its agent session,registering on Intercom, ordispatching its task) with elapsed time. If startup exceedssessionStartTimeoutMs(default 5 minutes), Atomic marks the attempt stalled and retries once after releasing its session (failing without retry if the stalled attempt still holds its session after half the budget, capped at 30 seconds). - Session close and reopen. Closing a session stops running subagents; reopening the same session restores them automatically.
Inspect and switch to tasks
Run/tasks (or /tasks <taskId>) or press ↓ on an empty prompt to focus the agent panel under the prompt. From either view you can monitor running, waiting, and finished subagents and their nested shells:
- Switch to a subagent. Select a subagent row and press
Enter(or click it) to view its live transcript and message it on the shared chat screen. Press←on an empty prompt or selectmainin the panel to return without interrupting the subagent. - Pause or stop. While viewing a working subagent, press
Esc(orCtrl+Con an empty prompt) to pause its active turn without affecting main chat. In/tasksor the agent panel, pressxtwice within three seconds to stop a running task resumably, orxonce to dismiss a finished row. - Subagent shells and questions. Running subagent shells nest beneath their subagent in the agent panel. A subagent’s
ask_user_questionor approval dialogs wait inside its own transcript (Needs input) without blocking main chat. - Launch cards and history. Each subagent renders
Agent(<agent> · <short task title>)(Ctrl+Oexpands prompt, tool calls, and result). Atomic keeps live status for the 256 most recently finished runs plus all active runs; older subagents stay resumable withsubagent({ action: "resume", id }).
Run control
Usepause, quit, and resume to control subagent runs. The id parameter accepts a child ID (<runId>:<index>), task ID, Intercom name, or single-child run ID.
The following examples show common run-control calls:
CHILD_ID: The subagent’s child ID, task ID, or Intercom name.
pause. Stops the active turn and keeps queued steering or follow-up messages to deliver once in order beforeresume’smessage. Intercom messages to a paused subagent don’t resume it; they wait without expiry and arrive afterresume’smessage.quit. Stops the subagent gracefully, including already-paused subagents, while keeping it resumable.- Awaiting resume. Completion notices show
paused · awaiting resumeorquit · awaiting resumewithStop reason: pauseorquitand the exactresumecall.subagent({ action: "status" })lists them under Awaiting resume across restarts without auto-relaunching. - Queued parallel subagents. You can
pauseorquita subagent still waiting for a concurrency slot. Callingresumestarts it with its original task, optionalmessage, model, thinking level, worktree, and fork copy, re-entering the concurrency queue (or reporting it gone if its model or fork copy no longer exists). resume. Continues the subagent’s saved session under the same child ID, Intercom name, and group (all: trueisn’t supported). For paused, quit, or interrupted subagents,messageruns before continuing; for completed or failed subagents,messagestarts a fresh turn. Omittingmessageprompts the subagent to continue or stop if done.- Resumable versus terminal. Paused, quit, interrupted, completed, failed, and session-closed subagents are resumable. Killed (explicit cancellation) and Gone (unrestorable after restart) subagents are terminal and reject
resume. Running subagents rejectresume—pause or quit them first, or message them through Intercom. Failed resumes keepworktree: truecheckouts intact. - Interrupting control calls. Pressing
Escstops waiting onpause,quit, orresume. Already-requested stops finish, and unstarted resumes cancel cleanly. - Removed actions.
killandinterruptwere removed; calls fail and point to{ action: "quit", id }.
Ctrl+O (or your custom expand binding) to inspect what happened, the task ID, and any message sent.
Messages that resume a finished subagent
Any session allowed to message a subagent under Intercom group and reach rules can wake it. A single-targetintercom send or ask to a completed or failed subagent returns immediately with queued: true, and the launching session resumes the subagent to handle the message. Calling subagent({ action: "resume", id: "<intercom-name>", message }) for a subagent launched by another session sends message through that same wake queue.
Messages to a paused or quit subagent wait in a durable queue without resuming it until the launching session continues it. Message-triggered resumes are capped at six resumes in 10 minutes and chain depth 4 (see Messages that resume a finished subagent).
Released subagents
A background subagent that waits more than one minute on a long-running detachable external tool call (such as a continuous integration (CI) run or deploy tool marked detachable), a budgetless shellwait, an intercom ask, or a blocking contact_supervisor (need_decision or interview_request) is released. The waited operation keeps running while the subagent frees its session resources and wakes automatically when the result arrives. Released subagents behave as follows:
- What you see. Main chat displays a dim notice (
◌ <name> is waiting on <tool> (<call id>)) without starting a model turn./tasks, the agent panel, and the launch card list it under Waiting with◌.subagent({ action: "status" })reportsreleased · waiting on <tool> (<call id>). - Inspecting, waking, or holding. Opening a released subagent shows its saved transcript without waking it. Press
Alt+W(or click· alt+w opens it) to inspect its newest waited shell in/tasks. Sending a message in its view, sending an Intercomsendorask, or callingresumewakes it immediately. Pressingxtwice or callingpauseorquitdisables auto-wake and holds arriving results until youresume. - Late results and crash recovery. If something else wakes the subagent first, the waited call returns as still running and its late result arrives later as a notice card inside the subagent’s chat. Queued messages persist before wake so nothing is lost on crash. On reopen after a restart, detachable external calls re-run with the same call IDs and arguments; local Intercom asks time out while multi-node database asks stay open. At most
parallel.runningCapacityreleased subagents wake concurrently.
Automatic restore and session storage
If Atomic exits, crashes, or switches sessions (/new, /resume, /fork), running subagents stay resumable and relaunch automatically when you reopen the launching session. They keep their Intercom name, group, model, thinking level, original agent definition, forked context, and unread queued messages.
Finished, paused, quit, and permanently cancelled subagents don’t auto-relaunch, and session forks (/fork, --fork) never relaunch the original session’s subagents. If a subagent can’t be restored, Atomic posts one recovery notice with its IDs, worktree or branch, git inspection commands, and relaunch call, then marks it gone.
Every subagent stores its session in the launching session’s own session storage (local SQLite by default, shared PostgreSQL, JSON Lines (JSONL) directory, or in-memory), regardless of cwd, worktrees, forks, or codemode launches. Subagents resume, wake, and export wherever the launching session opens, including another machine sharing the same database:
- Visibility and
history://. Subagent sessions are marked internal, so/resume,atomic -r,-c, andhistory://sessionsomit them. You can still read a subagent session directly withhistory://sessions/<sessionId>(add?project=<dir>if it ran in another directory or worktree). In SQLite and PostgreSQL session storage, forked subagents share their parent’s conversation history instead of copying it (see Shared-history forks). - Unsaved sessions. Sessions started with
--no-sessionor in-memory session storage keep subagent sessions in memory and move finished transcripts to a temporary file cleaned on exit. - Worktree snapshots. When worktree snapshots are enabled, subagents record snapshots of checkouts they modify so reopening restores the newest state cleanly.
Coordination and swarms
Subagents coordinate directly with each other over Intercom and escalate scope decisions to the launching supervisor.Supervisor coordination
By default (intercomBridge.mode: "always" in config.json), Atomic injects both intercom and contact_supervisor into every subagent whose launching session has Intercom active. Tool frontmatter controls Intercom availability alone only when intercomBridge.mode is "off" (or "fork-only" for fresh subagents). A subagent without read or search also receives a read-only session_history tool after compaction to recover its own history (see Agents without read or search). Supervisor coordination follows these rules:
- Decision waits versus
intercomask.contact_supervisor({ reason: "need_decision", message })andinterview_requestwait inside the requesting subagent and continue that same subagent when you answer withintercom({ action: "reply", message: "..." })(usependingandreplyTowhen multiple asks are open). Never relaunch a subagent just to answer it. By contrast,intercomaskreturns at delivery and delivers late replies as messages. - Non-blocking updates.
intercomsendandcontact_supervisor({ reason: "progress_update", message })return immediately without interrupting siblings or worktrees. - Messaging a running subagent. Subagents register on Intercom before their first turn. Address a subagent by its
intercomTargetor ID fromintercom list, and setdeliveryto"steer"(default),"followUp", or"interrupt"(see Theintercomtool). - Embedded SDK sessions without background task management. When an SDK host runs a single subagent directly without a background task host,
subagentblocks until completion and a blockingcontact_supervisorends the subagent with[TASK_CONTEXT]so the caller can launch a fresh subagent with the supervisor’s answer.
Peer coordination
Peer-to-peer coordination is the default. Siblings in a parallel batch—or sharing an explicitgroup—discover each other with intercom({ action: "list" }) and communicate directly with send and ask instead of routing peer updates through the supervisor.
Use peer coordination to share findings, divide file ownership or slow test runs, pass reproductions, and challenge disagreements with evidence. Each subagent still returns its own complete result. Reserve contact_supervisor for supervisor decisions. Peer asks and one blocking supervisor ask can wait concurrently. Run /skill:intercom for peer patterns.
The following parallel launch instructs three reviewers to coordinate findings directly over Intercom:
Scale a swarm
Tune parallel limits and group boundaries when running large subagent batches:- Parallel limits.
parallel.maxTasks,parallel.concurrency, andparallel.runningCapacityeach default to1000with no hard upper cap. Adjust all three inconfig.jsonto raise limits, or lowerparallel.concurrencyto throttle. Provider rate limits and host memory are the practical bounds. - Teams. Intercom groups have no member cap. Give each team a named
group(orgroup: truefor a unique shared universally unique identifier (UUID) group); members can still reach the supervisor throughcontact_supervisor.
Launch subagents from codemode scripts
When bothcodemode and subagent are active, tools.subagent() launches the same background subagents and resolves at admission, not completion. Admitted subagents belong to the main session and keep running even if the script returns, throws, or times out. Separate tools.subagent() calls aren’t merged automatically; pass tasks: [...] for a parallel batch.
The following script launches two workers in a shared Intercom group and saves their launch receipts:
{ action: "launch", tasks }. Each slot contains agent, state ("admitted", "queued", or "refused" with reason), taskId, childId, and intercomTarget when available. Don’t retry already-started siblings if one slot is refused.
Keep these script-mode rules in mind:
- Use
id, notrunId. Passing the legacyrunIdalias fails in codemode ("Use id instead of runId in subagent scripts."). Inwait,budgetMstakes a finite non-negative number or plain decimal string such as"2000"(defaults to30000ms even when a host configures unlimited foreground waits;0checks immediately). waitoutcomes.waitreturnsoutcome: "settled","running", or"stopped-waiting"(when the script’s signal aborts; script timeouts cancelwait, not the subagent). On settled results, non-releasedpauseandquitstops resolve toresult.status: "paused"(withresult.reason: "pause"or"quit"), while a released child resolves toresult.status: "cancelled".- Inspect and control. Call
list,get,models,status(reconcilechildrenafter reopening a session), andpause,quit, orresumewithid(orall: trueforpauseandquit). Creating, updating, or deleting agent definitions requires a direct tool call. - Temporary worktrees.
statuscan reportfinishingwhilewaitstill returnsrunning. CheckworktreeNoteorworktreeNotesin script results before deleting any temporary worktree directory.
Configure defaults and start timeouts
Configure subagent runtime defaults in~/.atomic/agent/extensions/subagent/config.json (falling back to ~/.pi/agent/extensions/subagent/config.json when the Atomic file is absent) and inspect scoped models with subagent({ action: "models" }). Subagents enforce your active enabledModels / --models / /scoped-models scope and skip providers without credentials before launch. For every config.json key, model resolution rule, fallback chain, and tool parameter, see Subagent reference.
Subagent start timeouts
Subagents have a five-minute (300000 ms) startup budget covering session open, resource load, agent session creation (including slot wait), and task dispatch. Queue wait under parallel.runningCapacity doesn’t count.
To raise the startup budget, set sessionStartTimeoutMs (1 to 2147483647 ms) in ~/.atomic/agent/extensions/subagent/config.json:
SessionStartTimeoutError (shown in status and serialized as startError for SDK callers). The following table lists each failure phase and recovery action:
For SDK configuration (
createAgentSession, builtins: { subagents: false }, excludedTools: ["subagent"], humanInput) and error rehydration, see Subagent children in the SDK and Session start errors.
Delegation boundaries
Delegation is fixed at one level: only the main session can launch,pause, resume, or quit subagents, and restricted subagents can’t create, update, or delete agent definitions. Subagents can still run background shells (nested beneath them in the agent panel) and inspect status with list, get, status, and wait. Subagent prompts omit parent orchestration artifacts and prior control traffic.
Removed acceptance-gate fields. Older calls or agent files that passed
acceptance or completionGuard: false should remove them (tool-based updates strip completionGuard automatically) and put required tests, commands, or evidence checks directly in the task prompt.Troubleshoot subagents
The following table lists common subagent launch and control issues and how to fix them:Next steps
Create custom subagents
Define custom Markdown agents, YAML frontmatter fields, and built-in overrides.
Subagent reference
Discovery precedence, automatic model selection, fallback models,
config.json, and tool parameters.Manage background tasks
Agent panel,
/tasks, steering, stopping work, and task heartbeats.Orchestrate multi-step work
Coordinate parallel subagents from codemode and recover cleanly after interruptions.