mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 22:28:10 +09:00
🔖 Checkpoint: Edit /workspaces/claude-code-flow/.claude/commands/automation/smart-spawn.md
This commit is contained in:
1 parent
0ecafe1eec
commit
11bab9717d
4 files changed
+151
-11
No files matched your search
@@ -0,0 +1 @@
|
||||
{"branch": "checkpoint/pre-edit-20250926-174334", "file": "/workspaces/claude-code-flow/.claude/commands/memory/memory-usage.md", "timestamp": "2025-09-26T17:43:34Z", "type": "pre-edit", "original_branch": "alpha-125"}
|
||||
@@ -0,0 +1 @@
|
||||
{"branch": "checkpoint/pre-edit-20250926-174410", "file": "/workspaces/claude-code-flow/.claude/commands/coordination/task-orchestrate.md", "timestamp": "2025-09-26T17:44:10Z", "type": "pre-edit", "original_branch": "alpha-125"}
|
||||
@@ -0,0 +1 @@
|
||||
{"checkpoint": "task-20250926-174312", "task": "{{user_prompt}} ", "timestamp": "2025-09-26T17:43:13Z", "commit": "bfa71031f9e5b263c6d45b27a1bc7ef402763128", "github_release": "true"}
|
||||
@@ -1,6 +1,6 @@
|
||||
# smart-spawn
|
||||
|
||||
Intelligently spawn agents based on workload analysis.
|
||||
Intelligently spawn agents based on workload analysis using MCP coordination and Claude Code execution.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
@@ -8,18 +8,155 @@ npx claude-flow automation smart-spawn [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--analyze` - Analyze before spawning
|
||||
- `--threshold <n>` - Spawn threshold
|
||||
- `--topology <type>` - Preferred topology
|
||||
- `--analyze` - Analyze workload before spawning
|
||||
- `--threshold <n>` - Spawn threshold for agent count
|
||||
- `--topology <type>` - Preferred topology (mesh, hierarchical, ring, star)
|
||||
- `--memory` - Enable memory coordination
|
||||
|
||||
## MCP Tool Integration
|
||||
|
||||
```javascript
|
||||
// Analyze workload and spawn agents
|
||||
mcp__claude-flow__swarm_init {
|
||||
topology: "hierarchical",
|
||||
strategy: "adaptive"
|
||||
}
|
||||
|
||||
// Smart agent spawning based on task complexity
|
||||
mcp__claude-flow__agent_spawn {
|
||||
type: "researcher",
|
||||
capabilities: ["code-analysis", "pattern-detection"]
|
||||
}
|
||||
|
||||
// Check memory for prior decisions
|
||||
mcp__claude-flow__memory_usage {
|
||||
action: "retrieve",
|
||||
key: "swarm/shared/agent-allocation",
|
||||
namespace: "coordination"
|
||||
}
|
||||
```
|
||||
|
||||
## Claude Code Execution
|
||||
|
||||
After smart analysis, spawn agents with Task tool:
|
||||
|
||||
```javascript
|
||||
// Smart spawn based on workload analysis
|
||||
[Single Message]:
|
||||
// Analyze task complexity
|
||||
Task("Analyzer", "Analyze project complexity and requirements", "code-analyzer")
|
||||
|
||||
// Based on analysis, spawn appropriate agents
|
||||
Task("Architect", "Design system architecture", "system-architect")
|
||||
Task("Backend Dev", "Implement server logic", "backend-dev")
|
||||
Task("Frontend Dev", "Build user interface", "coder")
|
||||
Task("Tester", "Create comprehensive tests", "tester")
|
||||
|
||||
// Store spawning decisions
|
||||
mcp__claude-flow__memory_usage {
|
||||
action: "store",
|
||||
key: "swarm/shared/spawn-decisions",
|
||||
namespace: "coordination",
|
||||
value: JSON.stringify({
|
||||
agents_spawned: 5,
|
||||
topology: "hierarchical",
|
||||
reason: "complex full-stack project"
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
## Smart Spawning Logic
|
||||
|
||||
### Analysis Phase
|
||||
1. Analyze codebase size and complexity
|
||||
2. Check existing agent workload
|
||||
3. Review memory for past patterns
|
||||
4. Determine optimal agent count
|
||||
|
||||
### Decision Factors
|
||||
- **Code Complexity**: More complex = more specialized agents
|
||||
- **File Count**: Large projects need more workers
|
||||
- **Task Type**: Different tasks need different specialists
|
||||
- **Performance Metrics**: Spawn more if bottlenecks detected
|
||||
|
||||
### Agent Selection
|
||||
```javascript
|
||||
// Smart selection based on task
|
||||
if (task.includes("API")) {
|
||||
spawn("backend-dev", "api-docs", "tester")
|
||||
}
|
||||
if (task.includes("UI")) {
|
||||
spawn("coder", "mobile-dev", "tester")
|
||||
}
|
||||
if (task.includes("database")) {
|
||||
spawn("code-analyzer", "migration-planner")
|
||||
}
|
||||
```
|
||||
|
||||
## Memory Coordination
|
||||
|
||||
Smart spawn uses memory to learn and improve:
|
||||
|
||||
```javascript
|
||||
// Store spawn patterns for learning
|
||||
mcp__claude-flow__memory_usage {
|
||||
action: "store",
|
||||
key: "swarm/smart-spawn/patterns",
|
||||
namespace: "coordination",
|
||||
value: JSON.stringify({
|
||||
task_type: "full-stack",
|
||||
agents_used: ["backend-dev", "coder", "tester"],
|
||||
success_rate: 0.92,
|
||||
completion_time: 3600000
|
||||
})
|
||||
}
|
||||
|
||||
// Retrieve past patterns for decision
|
||||
mcp__claude-flow__memory_usage {
|
||||
action: "retrieve",
|
||||
key: "swarm/smart-spawn/patterns",
|
||||
namespace: "coordination"
|
||||
}
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic Smart Spawn
|
||||
```bash
|
||||
# Smart spawn with analysis
|
||||
npx claude-flow automation smart-spawn --analyze
|
||||
|
||||
# Set spawn threshold
|
||||
npx claude-flow automation smart-spawn --threshold 5
|
||||
|
||||
# Force topology
|
||||
npx claude-flow automation smart-spawn --topology hierarchical
|
||||
```
|
||||
|
||||
### With Spawn Threshold
|
||||
```bash
|
||||
npx claude-flow automation smart-spawn --threshold 8 --analyze
|
||||
```
|
||||
|
||||
### Force Hierarchical Topology
|
||||
```bash
|
||||
npx claude-flow automation smart-spawn --topology hierarchical --memory
|
||||
```
|
||||
|
||||
### Full Automation Example
|
||||
```javascript
|
||||
// Complete smart spawn workflow
|
||||
[Single Message]:
|
||||
// Initialize with smart defaults
|
||||
mcp__claude-flow__swarm_init {
|
||||
topology: "adaptive",
|
||||
strategy: "balanced"
|
||||
}
|
||||
|
||||
// Analyze and spawn
|
||||
Task("Analyzer", "Analyze project and determine agent needs", "code-analyzer")
|
||||
|
||||
// Based on analysis, spawn optimal agents
|
||||
Task("Queen", "Coordinate smart spawn decisions", "queen-coordinator")
|
||||
Task("Memory Manager", "Track spawn patterns", "swarm-memory-manager")
|
||||
Task("Workers", "Execute based on analysis", "worker-specialist")
|
||||
```
|
||||
|
||||
## See Also
|
||||
- `auto-agent` - Automatic agent management
|
||||
- `swarm-init` - Initialize swarm topology
|
||||
- `agent-spawn` - Manual agent spawning
|
||||
- `memory-usage` - Coordination memory
|
||||
Reference in new issue
Block a user