Advanced multi-agent coordination patterns including mesh, hierarchical, and adaptive topologies with state synchronization, consensus mechanisms, and distributed task execution. Use when orchestrating complex multi-agent workflows requiring sophisticated coordination, consensus building, or distributed decision-making.
Inherits all available tools
Additional assets for this skill
This skill inherits all available tools. When active, it can use any tool Claude has access to.
examples/example-1-hierarchical-swarm.mdexamples/example-2-mesh-topology.mdexamples/example-3-adaptive-scaling.mdreadme.mdresources/scripts/init-hierarchical-topology.jsresources/scripts/init-mesh-topology.jsresources/scripts/orchestrate-distributed-task.jsresources/scripts/spawn-coordinated-agents.jsresources/scripts/topology-selector.jsresources/templates/adaptive-topology.yamlresources/templates/agent-roles.yamlresources/templates/hierarchical-topology.yamlresources/templates/mesh-topology.yamltests/test-consensus-mechanisms.jstests/test-hierarchical-topology.jstests/test-mesh-topology.jsname: coordination description: Advanced multi-agent coordination patterns including mesh, hierarchical, and adaptive topologies with state synchronization, consensus mechanisms, and distributed task execution. Use when orchestrating complex multi-agent workflows requiring sophisticated coordination, consensus building, or distributed decision-making. version: 2.0.0 tier: gold tags:
Advanced multi-agent coordination system implementing sophisticated topologies (mesh, hierarchical, ring, star), consensus mechanisms (Byzantine, Raft, gossip), and distributed task execution patterns. This skill enables orchestration of complex workflows requiring multiple agents to collaborate, synchronize state, reach consensus, and execute tasks in a coordinated manner.
Activate this skill when:
When: All agents need to communicate directly with each other Characteristics:
Script: resources/scripts/init-mesh-topology.js
Template: resources/templates/mesh-topology.yaml
When: Clear command structure with parent-child relationships Characteristics:
Script: resources/scripts/init-hierarchical-topology.js
Template: resources/templates/hierarchical-topology.yaml
When: Topology needs to evolve based on task requirements Characteristics:
Script: resources/scripts/init-adaptive-topology.js
Template: resources/templates/adaptive-topology.yaml
When: Need fault tolerance against malicious or faulty agents Characteristics:
Script: resources/scripts/byzantine-consensus.js
When: Need leader-based consensus with strong consistency Characteristics:
Script: resources/scripts/raft-consensus.js
When: Tasks are independent and can run simultaneously Benefits: Maximum throughput, reduced latency Trade-offs: Higher resource usage, complex coordination
When: Tasks have strict dependencies Benefits: Simple coordination, deterministic order Trade-offs: Lower throughput, longer total time
When: Mix of dependent and independent tasks Benefits: Balanced throughput and coordination Trade-offs: Complex orchestration logic
1.1 Analyze Requirements
# Use topology selector script
node resources/scripts/topology-selector.js \
--agents 6 \
--task-type distributed \
--fault-tolerance high \
--output topology-recommendation.json
1.2 Initialize Topology
# Initialize selected topology (example: mesh)
node resources/scripts/init-mesh-topology.js \
--max-agents 6 \
--strategy balanced \
--config topology-config.yaml
Key Considerations:
2.1 Spawn Specialized Agents
# Spawn agents with role assignments
node resources/scripts/spawn-coordinated-agents.js \
--topology mesh \
--roles researcher,coder,analyst,optimizer \
--config agent-roles.yaml
2.2 Establish Communication Channels
2.3 Initialize Shared State
# Initialize distributed state store
npx claude-flow@alpha memory store \
--key "coordination/shared-state" \
--value '{
"topology": "mesh",
"agent_count": 6,
"consensus": "byzantine",
"session_id": "coord-2024-001"
}'
3.1 Task Decomposition Break complex tasks into agent-specific subtasks:
3.2 Distributed Task Assignment
# Orchestrate task across agents
node resources/scripts/orchestrate-distributed-task.js \
--task "Full-stack feature development" \
--strategy adaptive \
--priority high \
--agents researcher,coder,tester,reviewer
3.3 Execution Monitoring
# Monitor distributed execution
npx claude-flow@alpha swarm_monitor \
--duration 60 \
--interval 5 \
--output execution-metrics.json
4.1 Initiate Consensus Protocol For critical decisions requiring agreement among agents:
# Run Byzantine consensus
node resources/scripts/byzantine-consensus.js \
--proposal "Deploy to production" \
--agents agent-1,agent-2,agent-3,agent-4,agent-5 \
--threshold 0.67 \
--timeout 30
4.2 Validate Consensus
4.3 Execute Consensus Decision Once consensus achieved, coordinate execution across agents.
5.1 Continuous State Sync
# Synchronize state across agents
node resources/scripts/sync-agent-state.js \
--topology mesh \
--interval 10 \
--conflict-resolution last-write-wins
5.2 Conflict Resolution
6.1 Analyze Bottlenecks
# Identify coordination bottlenecks
npx claude-flow@alpha agent_metrics \
--metric all \
--output performance-analysis.json
6.2 Optimize Topology
6.3 Measure Improvements Track key metrics:
Adapt topology during execution:
# Reconfigure topology on-the-fly
node resources/scripts/reconfigure-topology.js \
--from mesh \
--to hierarchical \
--preserve-state true \
--migration-strategy gradual
Implement automatic fault handling:
# Enable fault detection
node resources/scripts/enable-fault-detection.js \
--heartbeat-interval 5 \
--failure-threshold 3 \
--recovery-strategy spawn-replacement
Distribute work evenly:
# Enable dynamic load balancing
node resources/scripts/load-balancer.js \
--strategy adaptive \
--rebalance-interval 30 \
--target-utilization 0.75
Topology: Hierarchical (coordinator → specialist agents) Execution: Sequential with parallel validation Consensus: Simple majority vote on validation
Topology: Mesh (peer review among 4-6 agents) Execution: Parallel analysis, consensus on approval Consensus: Byzantine (2f+1 security checks)
Topology: Star (hub routes requests to model agents) Execution: Parallel inference, ensemble aggregation Consensus: Weighted voting based on confidence
Symptoms: Consensus protocol fails to reach agreement Solutions:
Symptoms: Agents have conflicting state Solutions:
Symptoms: Slow task completion, high latency Solutions:
topology-selector.js - Recommend optimal topologyinit-mesh-topology.js - Initialize mesh coordinationinit-hierarchical-topology.js - Initialize hierarchical coordinationinit-adaptive-topology.js - Initialize adaptive coordinationspawn-coordinated-agents.js - Spawn agents with rolesorchestrate-distributed-task.js - Distribute tasksbyzantine-consensus.js - Run Byzantine consensusraft-consensus.js - Run Raft consensussync-agent-state.js - Synchronize agent statereconfigure-topology.js - Dynamic reconfigurationenable-fault-detection.js - Fault detection & recoveryload-balancer.js - Dynamic load balancingmesh-topology.yaml - Mesh coordination confighierarchical-topology.yaml - Hierarchical coordination configadaptive-topology.yaml - Adaptive coordination configagent-roles.yaml - Agent role definitionstest-mesh-topology.js - Mesh coordination teststest-hierarchical-topology.js - Hierarchical coordination teststest-consensus-mechanisms.js - Consensus protocol tests