Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

🔖 Checkpoint: Edit /workspaces/claude-code-flow/.claude/commands/automation/smart-spawn.md

rUv11bab9717da3
diff --git a/.claude/checkpoints/1758908614.json b/.claude/checkpoints/1758908614.json
new file mode 100644
index 0000000000..9a6e2b1453
--- /dev/null
+++ b/.claude/checkpoints/1758908614.json
@@ -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"}
diff --git a/.claude/checkpoints/1758908650.json b/.claude/checkpoints/1758908650.json
new file mode 100644
index 0000000000..ff052e6264
--- /dev/null
+++ b/.claude/checkpoints/1758908650.json
@@ -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"}
diff --git a/.claude/checkpoints/task-1758908593.json b/.claude/checkpoints/task-1758908593.json
new file mode 100644
index 0000000000..1124bd6e57
--- /dev/null
+++ b/.claude/checkpoints/task-1758908593.json
@@ -0,0 +1 @@
+{"checkpoint": "task-20250926-174312", "task": "{{user_prompt}} ", "timestamp": "2025-09-26T17:43:13Z", "commit": "bfa71031f9e5b263c6d45b27a1bc7ef402763128", "github_release": "true"}
diff --git a/.claude/commands/automation/smart-spawn.md b/.claude/commands/automation/smart-spawn.md
index f78c2a9c19..62344d90f0 100644
--- a/.claude/commands/automation/smart-spawn.md
+++ b/.claude/commands/automation/smart-spawn.md
@@ -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
+### 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
+```
-# Force topology
-npx claude-flow automation smart-spawn --topology hierarchical
+### 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