Spawn threads on running claude-threads orchestrator
Spawn and manage threads on a running claude-threads orchestrator. Enables parallel execution of epics, stories, or any tasks from within a Claude Code session.
API Server Running: The orchestrator API must be running
ct api start --token <your-token>
Environment Variable: Set the API token
export CT_API_TOKEN=<your-token>
# Auto-discover running orchestrator
ct remote discover
# Or connect explicitly
ct remote connect localhost:31337 --token $CT_API_TOKEN
# Check connection status
ct remote status
Note: Remote threads ALWAYS use isolated git worktrees by default.
# Basic spawn (creates worktree automatically for remote)
ct spawn epic-7a --template bmad-developer.md
# Spawn with custom worktree base branch
ct spawn epic-7a --template bmad-developer.md --worktree-base develop
# Spawn with custom context
ct spawn story-123 --template developer.md --context '{"story_id":"123","title":"Add login"}'
# Spawn and wait for completion
ct spawn fix-ci --template fixer.md --wait
# Spawn multiple epics in parallel
ct spawn epic-7a --template bmad-developer.md --worktree --context '{"epic_id":"7A"}'
ct spawn epic-8a --template bmad-developer.md --worktree --context '{"epic_id":"8A"}'
ct spawn epic-9a --template bmad-developer.md --worktree --context '{"epic_id":"9A"}'
| Command | Description |
|---|---|
ct remote connect <host:port> |
Connect to orchestrator API |
ct remote disconnect |
Disconnect from remote |
ct remote status |
Show connection status |
ct remote discover |
Auto-discover running orchestrator |
ct spawn <name> [options]
| Option | Description |
|---|---|
--template, -t <file> |
Prompt template file |
--mode, -m <mode> |
Thread mode (automatic, semi-auto, interactive) |
--context, -c <json> |
Thread context as JSON |
--worktree, -w |
Create with isolated git worktree (DEFAULT for remote) |
--no-worktree |
Disable worktree isolation (not recommended) |
--worktree-base <branch> |
Base branch for worktree (default: main) |
--wait |
Wait for thread completion |
--remote |
Force use of remote API |
--local |
Force use of local database |
When the orchestrator assigns multiple epics, spawn them in parallel:
# Connect to orchestrator
ct remote connect localhost:31337 --token $CT_API_TOKEN
# Read epic assignments from artifacts
for epic_id in 7A 8A 9A; do
ct spawn "epic-${epic_id}" \
--template bmad-developer.md \
--worktree \
--worktree-base develop \
--context "{\"epic_id\":\"${epic_id}\"}"
done
When CI fails, spawn a fixer thread:
ct spawn ci-fix-pr-123 \
--template bmad-fixer.md \
--worktree \
--context '{"pr_number":"123","failure":"test:lint"}'
Spawn threads for individual stories:
ct spawn story-add-logout \
--template developer.md \
--context '{"story_title":"Add logout button","acceptance_criteria":["Button in header","Clears session"]}'
# List all threads
ct thread list
# Check specific thread status
ct thread status <thread-id>
# View thread logs
ct thread logs <thread-id>
| Variable | Description |
|---|---|
CT_API_TOKEN |
Authentication token for API |
CT_API_URL |
API URL for auto-discovery |
N8N_API_TOKEN |
Alternative token variable |
External Claude Code Instance
โ
โโโ ct remote connect โโโโโโโโโโโ
โ โ
โโโ ct spawn โโโโโโโโโโโโโโโโโโโโค
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ API Server โ
โ (port 31337) โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ Orchestrator โ
โ (threads.db) โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโ
โผ โผ โผ
โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ
โ Thread 1 โ โ Thread 2 โ โ Thread 3 โ
โ (worktree) โ โ (worktree) โ โ (worktree) โ
โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ
Authorization: Bearer <token> header.claude-threads/remote.json after connectingCT_API_TOKEN or --token flag