mirror of
https://github.com/duthaho/claudekit.git
synced 2026-07-19 05:59:41 +03:00
3.5 KiB
3.5 KiB
/spawn
Purpose
Launch background tasks for parallel execution. Enables concurrent work on independent tasks with result aggregation.
Launch a background task or manage running tasks.
Spawn Operations
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
Show running and completed tasks:
/spawn --list
Output:
## 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
Gather results from completed tasks:
/spawn --collect
Output:
## 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 below
Cancel Task
Stop a running task:
/spawn --cancel [id]
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 |
Flags
| 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 |
Usage Examples
/spawn "Research OAuth2 best practices"
/spawn "Analyze user service for performance issues"
/spawn "Review security of auth module" --agent=security-auditor
/spawn --list
/spawn --collect
/spawn --wait # Block until all complete
Arguments
$ARGUMENTS
If quoted text: spawn that task If flag: execute that operation
Parallel Workflow
Pattern: Research Phase
/spawn "Research authentication approaches"
/spawn "Analyze current auth implementation"
/spawn "Review competitor auth patterns"
# Continue other work...
/spawn --wait
/spawn --collect
# Synthesize findings
Pattern: Multi-File Review
/spawn "Review src/auth/ for security"
/spawn "Review src/api/ for performance"
/spawn "Review src/db/ for SQL injection"
/spawn --collect
# Address findings
Best Practices
- Independent Tasks: Only spawn truly independent work
- Clear Descriptions: Specific task descriptions get better results
- Regular Collection: Don't let results pile up
- Resource Awareness: Don't spawn too many concurrent tasks
Limitations
- Tasks cannot communicate with each other
- Results are collected, not streamed
- Heavy tasks may take time
- Some tasks benefit from sequential execution
Combines With
- Orchestration mode: Manages multiple spawned tasks
/plan: Plan tasks, then spawn parallel execution/execute-plan: Orchestrated task execution