Skip to main content
The spawn command creates new agent sessions with isolated workspaces, issue tracking integration, and automatic branch creation.

ao spawn

Spawn a single agent session.

Syntax

Arguments

string
required
Project ID from your configuration
string
Issue identifier (e.g., INT-1234, #42) — must exist in your tracker
The issue must exist in your configured issue tracker (GitHub or Linear) before spawning.

Options

flag
Open the session in a new terminal tab automatically
string
Override the agent plugin (e.g., codex, claude-code, aider)

Basic Usage

What Happens During Spawn

  1. Pre-flight Checks
    • Validates project exists
    • Checks tmux is available (if using tmux runtime)
    • Verifies GitHub CLI authentication (if using GitHub tracker)
  2. Workspace Setup
    • Creates git worktree (or clones repo, depending on workspace plugin)
    • Checks out new branch (e.g., int-1234-issue-title)
    • Isolates work from other sessions
  3. Issue Fetch (if issue provided)
    • Fetches issue details from tracker
    • Extracts title and description
    • Passes context to agent
  4. Agent Launch
    • Starts agent in tmux session (or process, depending on runtime)
    • Provides system prompt with orchestrator context
    • Gives agent the issue details and project rules
  5. Session Registration
    • Creates session metadata file
    • Tracks session ID, project, issue, branch, and workspace path
    • Makes session visible in ao status and dashboard

Output Example

The last line (SESSION=ma-int-1234) is for scripting — you can capture it:

Session Naming

Session IDs follow the pattern:
For example:
  • Project sessionPrefix: ma
  • Issue: INT-1234
  • Session ID: ma-int-1234
The session prefix is defined in your project configuration. It keeps session names short and predictable.

Branch Naming

Branches are automatically created using the issue title:
The CLI:
  • Converts issue title to lowercase kebab-case
  • Prepends the issue number
  • Ensures branch name is Git-safe

ao batch-spawn

Spawn sessions for multiple issues with duplicate detection.

Syntax

Arguments

string
required
Project ID from configuration
string[]
required
Space-separated list of issue identifiers

Options

flag
Open all sessions in terminal tabs

Basic Usage

Duplicate Detection

The command prevents creating duplicate sessions:
  1. Existing Sessions - Skips if a session already exists for the issue
  2. Same Batch - Skips duplicate issues within the same command
  3. Case-Insensitive - Treats INT-1234 and int-1234 as duplicates
Dead sessions (killed, done, exited) are ignored — you can respawn for those issues.

Output Example

Error Handling

If some spawns fail, the command continues and reports errors at the end:

Agent Override

Use a different agent for a specific session:
The agent must be installed and available in your PATH. The orchestrator only handles session creation and routing.

Common Issues

Unknown Project

Solution: Use a valid project ID from your config:

tmux Not Found

Solution: Install tmux:

GitHub CLI Not Authenticated

Solution: Authenticate GitHub CLI:

Issue Not Found

Solution: Verify the issue exists in GitHub or Linear:

Worktree Already Exists

Solution: Remove the old worktree:

Examples

Basic Spawn

Open in Terminal

Custom Agent

Batch Workflow

Scripted Spawn

Exit Codes

  • 0 - Session created successfully
  • 1 - Error (project not found, tmux missing, issue not found)

Next Steps

Status

Monitor your spawned sessions

Send Messages

Interact with running sessions

Session Management

List, kill, and cleanup sessions