$npx -y skills add spencermarx/open-code-review --skill swarm-advancedAdvanced swarm orchestration patterns for research, development, testing, and complex distributed workflows
| 1 | # Advanced Swarm Orchestration |
| 2 | |
| 3 | Master advanced swarm patterns for distributed research, development, and testing workflows. This skill covers comprehensive orchestration strategies using both MCP tools and CLI commands. |
| 4 | |
| 5 | ## Quick Start |
| 6 | |
| 7 | ### Prerequisites |
| 8 | ```bash |
| 9 | # Ensure Claude Flow is installed |
| 10 | npm install -g claude-flow@alpha |
| 11 | |
| 12 | # Add MCP server (if using MCP tools) |
| 13 | claude mcp add claude-flow npx claude-flow@alpha mcp start |
| 14 | ``` |
| 15 | |
| 16 | ### Basic Pattern |
| 17 | ```javascript |
| 18 | // 1. Initialize swarm topology |
| 19 | mcp__claude-flow__swarm_init({ topology: "mesh", maxAgents: 6 }) |
| 20 | |
| 21 | // 2. Spawn specialized agents |
| 22 | mcp__claude-flow__agent_spawn({ type: "researcher", name: "Agent 1" }) |
| 23 | |
| 24 | // 3. Orchestrate tasks |
| 25 | mcp__claude-flow__task_orchestrate({ task: "...", strategy: "parallel" }) |
| 26 | ``` |
| 27 | |
| 28 | ## Core Concepts |
| 29 | |
| 30 | ### Swarm Topologies |
| 31 | |
| 32 | **Mesh Topology** - Peer-to-peer communication, best for research and analysis |
| 33 | - All agents communicate directly |
| 34 | - High flexibility and resilience |
| 35 | - Use for: Research, analysis, brainstorming |
| 36 | |
| 37 | **Hierarchical Topology** - Coordinator with subordinates, best for development |
| 38 | - Clear command structure |
| 39 | - Sequential workflow support |
| 40 | - Use for: Development, structured workflows |
| 41 | |
| 42 | **Star Topology** - Central coordinator, best for testing |
| 43 | - Centralized control and monitoring |
| 44 | - Parallel execution with coordination |
| 45 | - Use for: Testing, validation, quality assurance |
| 46 | |
| 47 | **Ring Topology** - Sequential processing chain |
| 48 | - Step-by-step processing |
| 49 | - Pipeline workflows |
| 50 | - Use for: Multi-stage processing, data pipelines |
| 51 | |
| 52 | ### Agent Strategies |
| 53 | |
| 54 | **Adaptive** - Dynamic adjustment based on task complexity |
| 55 | **Balanced** - Equal distribution of work across agents |
| 56 | **Specialized** - Task-specific agent assignment |
| 57 | **Parallel** - Maximum concurrent execution |
| 58 | |
| 59 | ## Pattern 1: Research Swarm |
| 60 | |
| 61 | ### Purpose |
| 62 | Deep research through parallel information gathering, analysis, and synthesis. |
| 63 | |
| 64 | ### Architecture |
| 65 | ```javascript |
| 66 | // Initialize research swarm |
| 67 | mcp__claude-flow__swarm_init({ |
| 68 | "topology": "mesh", |
| 69 | "maxAgents": 6, |
| 70 | "strategy": "adaptive" |
| 71 | }) |
| 72 | |
| 73 | // Spawn research team |
| 74 | const researchAgents = [ |
| 75 | { |
| 76 | type: "researcher", |
| 77 | name: "Web Researcher", |
| 78 | capabilities: ["web-search", "content-extraction", "source-validation"] |
| 79 | }, |
| 80 | { |
| 81 | type: "researcher", |
| 82 | name: "Academic Researcher", |
| 83 | capabilities: ["paper-analysis", "citation-tracking", "literature-review"] |
| 84 | }, |
| 85 | { |
| 86 | type: "analyst", |
| 87 | name: "Data Analyst", |
| 88 | capabilities: ["data-processing", "statistical-analysis", "visualization"] |
| 89 | }, |
| 90 | { |
| 91 | type: "analyst", |
| 92 | name: "Pattern Analyzer", |
| 93 | capabilities: ["trend-detection", "correlation-analysis", "outlier-detection"] |
| 94 | }, |
| 95 | { |
| 96 | type: "documenter", |
| 97 | name: "Report Writer", |
| 98 | capabilities: ["synthesis", "technical-writing", "formatting"] |
| 99 | } |
| 100 | ] |
| 101 | |
| 102 | // Spawn all agents |
| 103 | researchAgents.forEach(agent => { |
| 104 | mcp__claude-flow__agent_spawn({ |
| 105 | type: agent.type, |
| 106 | name: agent.name, |
| 107 | capabilities: agent.capabilities |
| 108 | }) |
| 109 | }) |
| 110 | ``` |
| 111 | |
| 112 | ### Research Workflow |
| 113 | |
| 114 | #### Phase 1: Information Gathering |
| 115 | ```javascript |
| 116 | // Parallel information collection |
| 117 | mcp__claude-flow__parallel_execute({ |
| 118 | "tasks": [ |
| 119 | { |
| 120 | "id": "web-search", |
| 121 | "command": "search recent publications and articles" |
| 122 | }, |
| 123 | { |
| 124 | "id": "academic-search", |
| 125 | "command": "search academic databases and papers" |
| 126 | }, |
| 127 | { |
| 128 | "id": "data-collection", |
| 129 | "command": "gather relevant datasets and statistics" |
| 130 | }, |
| 131 | { |
| 132 | "id": "expert-search", |
| 133 | "command": "identify domain experts and thought leaders" |
| 134 | } |
| 135 | ] |
| 136 | }) |
| 137 | |
| 138 | // Store research findings in memory |
| 139 | mcp__claude-flow__memory_usage({ |
| 140 | "action": "store", |
| 141 | "key": "research-findings-" + Date.now(), |
| 142 | "value": JSON.stringify(findings), |
| 143 | "namespace": "research", |
| 144 | "ttl": 604800 // 7 days |
| 145 | }) |
| 146 | ``` |
| 147 | |
| 148 | #### Phase 2: Analysis and Validation |
| 149 | ```javascript |
| 150 | // Pattern recognition in findings |
| 151 | mcp__claude-flow__pattern_recognize({ |
| 152 | "data": researchData, |
| 153 | "patterns": ["trend", "correlation", "outlier", "emerging-pattern"] |
| 154 | }) |
| 155 | |
| 156 | // Cognitive analysis |
| 157 | mcp__claude-flow__cognitive_analyze({ |
| 158 | "behavior": "research-synthesis" |
| 159 | }) |
| 160 | |
| 161 | // Quality assessment |
| 162 | mcp__claude-flow__quality_assess({ |
| 163 | "target": "research-sources", |
| 164 | "criteria": ["credibility", "relevance", "recency", "authority"] |
| 165 | }) |
| 166 | |
| 167 | // Cross-reference validation |
| 168 | mcp__claude-flow__neural_patterns({ |
| 169 | "action": "analyze", |
| 170 | "operation": "fact-checking", |
| 171 | "metadata": { "sources": sourcesArray } |
| 172 | }) |
| 173 | ``` |
| 174 | |
| 175 | #### Phase 3: Knowledge Management |
| 176 | ```javascript |
| 177 | // Search existing knowledge base |
| 178 | mcp__claude-flow__memory_search({ |
| 179 | "pattern": "topic X", |
| 180 | "namespace": "research", |
| 181 | "limit": 20 |
| 182 | }) |
| 183 | |
| 184 | // Create knowledge graph connections |
| 185 | mcp__claude-flow__neural_patterns({ |
| 186 | "action": "learn", |
| 187 | "operation": " |