Skip to main content
Use this guide to coordinate multi-step tasks and parallel reviews with Atomic, recover cleanly after restarts, and pick the right coordination pattern. For single-agent options and worktree flags, see Run subagents. For turning a recurring workflow into a reusable command, see Skills. The following table matches each orchestration task to the right entry point:

Before you begin

Confirm the following in your Atomic session before coordinating multi-step work:
  • Both codemode and subagent are active (run /tools to check).
  • For parallel edits in the same repository, your repository is a Git checkout so writers can run in isolated worktrees.

Start in plain language

For one-off tasks, give Atomic three things in chat: your goal, how to verify the result, and any limits on edits, cost, or time. Atomic can answer directly, run checks in codemode, or delegate independent jobs to subagents. For example, send this prompt to split a documentation check across two read-only reviewers:
Atomic launches both subagents in the background, collects their findings as they finish, and reports a combined summary.
Who writes codemode JavaScript? During ordinary chat, Atomic writes and runs the following codemode snippets for you. Write tools.subagent(...) calls yourself only when authoring a custom skill or prompt template for a repeatable workflow.

Launch now, use the result later

Three pieces work together when Atomic orchestrates multi-step work:
  • Main session: Decides what to run next and verifies final results.
  • Subagent: A separate background session assigned one focused job, such as checking Linux installation steps.
  • Codemode: Short JavaScript steps that call Atomic tools. One step can launch background jobs, and a later step can act on their results. Run /tools if codemode or subagent isn’t available.
The following script starts two independent reviews in one parallel batch and stores their task metadata for later steps:
The launch call returns at admission with one entry per subagent:
Each field in the launch response serves a specific purpose:
  • agent: The role assigned to the job.
  • state: Whether the job started (admitted), is waiting for a slot (queued), or was rejected (refused, with a reason).
  • taskId: The handle shown in /tasks and passed to wait.
  • childId: The persistent subagent session ID used to pause, stop, or resume the subagent, including after reopening the main session.
  • intercomTarget: The exact address other sessions use to message this subagent over Intercom.
A launch response only confirms admission, not success. Wait for the completion notice, or check /tasks or the agent panel, and confirm that every required subagent settles and passes your checks.

Rules for scripted orchestration

Follow these rules when writing codemode orchestration snippets:
  • Batch parallel launches explicitly. Atomic doesn’t merge separate tools.subagent() calls inside one script. Pass tasks: [...] to run jobs in parallel.
  • Wait on an existing taskId instead of relaunching. When a later step needs a result immediately, pass action: "wait" with id (codemode rejects the legacy runId alias). budgetMs sets the wait window in milliseconds (default 30000 ms; both 2000 and "2000" wait up to two seconds). Use a // @options comment to set per-script codemode options such as timeout_ms:
  • Keep delegation one level deep. Only the main session launches subagents. If a subagent finds follow-up work, it reports back so the main session can launch the next batch.
  • Coordinate peers through Intercom groups. Pass group: true to give a batch its own shared Intercom group, or reuse a named group across launches. Address each peer by its exact intercomTarget, not its taskId. Keep independent reviewers ungrouped until each reaches an independent verdict.
  • Track long runs with progress files. Pass progress: true to give a long-running writer an isolated progress.md outside your checkout. Progress notes help with handoffs, not as proof that checks passed.
  • Stop subagents explicitly. Ending a wait or hitting a script timeout leaves launched subagents running. To stop a subagent, call quit with its childId (both pause and quit report result.status: "paused" on settled non-released waits):
    Replace the following:
    • CHILD_ID: The childId value returned at launch (for example a1b2c3d4:0).

What survives interruption

Subagents are saved sessions; codemode scripts aren’t checkpointed programs. If Atomic closes or restarts mid-run, know what survives:
  • Running subagents relaunch automatically. Reopening the original main session relaunches subagents that were running. Paused and quit subagents stay awaiting manual resume in /tasks or through tools.subagent({ action: "resume", id: "<childId>" }) unless you change resumeInFlight in subagent config.json.
  • Forks and unsaved sessions don’t restore subagents. Forking a session (/fork or --fork) never restores the original session’s subagents. Sessions started with --no-session aren’t saved, so their subagents can’t be restored after exit.
  • Codemode store values persist per branch on success. Save small handoff state—task IDs, round counts, and next checks—with the codemode store. store() writes persist only when the script finishes without throwing or timing out, even though admitted subagents keep running.
  • Reconcile before relaunching. After a restart, run await tools.subagent({ action: "status" }) and match children against stored childId values before starting new work. Collect settled results, resume paused work that is still needed, and inspect /tasks, chat, and modified files before repeating side effects.

Troubleshoot orchestration

The following table lists common issues when coordinating multi-step work and how to resolve them:

Choose a pattern

Pick a coordination pattern that matches your task, or ask /skill:workflow to draft a reusable skill or migrate an earlier workflow:

Classify-and-act

Triage input with a read-only subagent, validate the label, then dispatch the matching specialist.

Fan-out-and-synthesize

Split a broad review or investigation across parallel subagents and reconcile their evidence.

Adversarial verification

Ask a fresh read-only subagent to find a concrete failing input against a candidate fix.

Generate-and-filter

Gather candidate inputs or cases from fresh subagents and filter them with a deterministic check.

Tournament

Compare competing implementations in isolated named worktrees against shared fixtures.

Loop-until-done

Run verification checks in the main session between bounded repair rounds.

Stacked slices

Branch each dependent slice from the verified commit of the previous slice.

Skills as workflows

Save repeatable multi-step instructions as a skill, or migrate legacy workflow files.