/spawn
/spawn
Section titled “/spawn”Purpose
Section titled “Purpose”Launch background tasks for parallel execution. Enables concurrent work on independent tasks with result aggregation.
/spawn "[task description]"/spawn [operation]Operations
Section titled “Operations”Launch Task
Section titled “Launch Task”Start a new background task:
/spawn "[task description]"Process:
- Analyze task for parallelizability
- Launch subagent with task
- Return task ID for tracking
- Continue main conversation
Output:
Spawned: Task #1- Description: Research authentication patterns- Status: Running- Agent: researcher
Continue working. Use `/spawn --list` to check status.List Tasks
Section titled “List Tasks”Show running and completed tasks:
/spawn --listOutput:
## Active Tasks
| ID | Description | Status | Duration ||----|-------------|--------|----------|| #1 | Research auth patterns | Running | 2m || #2 | Analyze security | Complete | 5m |
## Completed Tasks (last hour)| #2 | Analyze security | ✅ Complete | Results ready |Collect Results
Section titled “Collect Results”Gather results from completed tasks:
/spawn --collectOutput:
## Collected Results
### Task #1: Research auth patterns**Status**: Complete**Findings**:- Pattern A: JWT with refresh tokens- Pattern B: Session-based with Redis- Recommendation: JWT for stateless API
### Task #2: Analyze security**Status**: Complete**Findings**:- 2 high-priority issues found- See detailed report belowCancel Task
Section titled “Cancel Task”Stop a running task:
/spawn --cancel [id]Task Types
Section titled “Task Types”| Type | Best For | Agent Used |
|---|---|---|
| Research | Information gathering | researcher |
| Analysis | Code analysis | scout |
| Review | Code review | code-reviewer |
| Test | Test generation | tester |
| Scan | Security scanning | security-auditor |
| Flag | Description |
|---|---|
--list | Show all tasks |
--collect | Gather completed results |
--cancel [id] | Cancel running task |
--wait | Wait for all tasks to complete |
--agent=[type] | Specify agent type |
--priority=[high|normal] | Task priority |
Examples
Section titled “Examples”# Spawn research task/spawn "Research OAuth2 best practices"
# Spawn analysis with specific agent/spawn "Analyze user service for performance" --agent=scout
# Spawn security review/spawn "Review security of auth module" --agent=security-auditor
# Check task status/spawn --list
# Collect all results/spawn --collect
# Wait for all tasks to complete/spawn --wait
# Cancel a task/spawn --cancel 1Parallel Workflows
Section titled “Parallel Workflows”Research Phase
Section titled “Research Phase”# Launch multiple research tasks/spawn "Research authentication approaches"/spawn "Analyze current auth implementation"/spawn "Review competitor auth patterns"
# Continue other work...
# Wait for all to complete/spawn --wait
# Collect and synthesize/spawn --collectMulti-File Review
Section titled “Multi-File Review”# Review different modules in parallel/spawn "Review src/auth/ for security"/spawn "Review src/api/ for performance"/spawn "Review src/db/ for SQL injection"
# Collect findings/spawn --collect
# Address issuesComprehensive Analysis
Section titled “Comprehensive Analysis”# Multiple analysis tasks/spawn "Analyze dependencies for vulnerabilities"/spawn "Check code coverage gaps"/spawn "Find performance bottlenecks"
/spawn --collectBest Practices
Section titled “Best Practices”- Independent Tasks: Only spawn truly independent work that doesn’t depend on other tasks
- Clear Descriptions: Specific task descriptions get better results
- Regular Collection: Don’t let results pile up unchecked
- Resource Awareness: Don’t spawn too many concurrent tasks (3-5 is usually optimal)
Use Cases
Section titled “Use Cases”Feature Planning
Section titled “Feature Planning”# Parallel research before implementation/spawn "Research state management libraries"/spawn "Analyze existing state handling code"/spawn "Find examples of similar features"
/spawn --collect# Make informed decision based on all researchCode Quality Audit
Section titled “Code Quality Audit”# Audit different aspects simultaneously/spawn "Check for security vulnerabilities"/spawn "Identify performance issues"/spawn "Find code duplication"/spawn "Check test coverage gaps"
/spawn --collectDocumentation Tasks
Section titled “Documentation Tasks”# Generate docs for multiple modules/spawn "Document API endpoints"/spawn "Generate type documentation"/spawn "Create usage examples"
/spawn --collectLimitations
Section titled “Limitations”- Tasks cannot communicate with each other
- Results are collected, not streamed
- Heavy tasks may take time to complete
- Some tasks benefit from sequential execution (e.g., dependent work)
- Spawned tasks use additional API tokens
Combines With
Section titled “Combines With”- /mode orchestration - Manages multiple spawned tasks
- /plan - Plan tasks, then spawn parallel execution
- /checkpoint - Save state before spawning tasks