claude-flow 2.0.0-alpha.71 → 2.0.0-alpha.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/MIGRATION_SUMMARY.md +215 -0
- package/.claude/agents/README.md +82 -0
- package/.claude/agents/analysis/code-review/analyze-code-quality.md +180 -0
- package/.claude/agents/architecture/system-design/arch-system-design.md +156 -0
- package/.claude/agents/base-template-generator.md +42 -0
- package/.claude/agents/consensus/README.md +246 -0
- package/.claude/agents/consensus/byzantine-coordinator.md +63 -0
- package/.claude/agents/consensus/crdt-synchronizer.md +997 -0
- package/.claude/agents/consensus/gossip-coordinator.md +63 -0
- package/.claude/agents/consensus/performance-benchmarker.md +851 -0
- package/.claude/agents/consensus/quorum-manager.md +823 -0
- package/.claude/agents/consensus/raft-manager.md +63 -0
- package/.claude/agents/consensus/security-manager.md +622 -0
- package/.claude/agents/core/coder.md +211 -0
- package/.claude/agents/core/planner.md +116 -0
- package/.claude/agents/core/researcher.md +136 -0
- package/.claude/agents/core/reviewer.md +272 -0
- package/.claude/agents/core/tester.md +266 -0
- package/.claude/agents/data/ml/data-ml-model.md +193 -0
- package/.claude/agents/development/backend/dev-backend-api.md +142 -0
- package/.claude/agents/devops/ci-cd/ops-cicd-github.md +164 -0
- package/.claude/agents/documentation/api-docs/docs-api-openapi.md +174 -0
- package/.claude/agents/github/code-review-swarm.md +538 -0
- package/.claude/agents/github/github-modes.md +173 -0
- package/.claude/agents/github/issue-tracker.md +319 -0
- package/.claude/agents/github/multi-repo-swarm.md +553 -0
- package/.claude/agents/github/pr-manager.md +191 -0
- package/.claude/agents/github/project-board-sync.md +509 -0
- package/.claude/agents/github/release-manager.md +367 -0
- package/.claude/agents/github/release-swarm.md +583 -0
- package/.claude/agents/github/repo-architect.md +398 -0
- package/.claude/agents/github/swarm-issue.md +573 -0
- package/.claude/agents/github/swarm-pr.md +428 -0
- package/.claude/agents/github/sync-coordinator.md +452 -0
- package/.claude/agents/github/workflow-automation.md +635 -0
- package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +82 -0
- package/.claude/agents/hive-mind/consensus-builder.md +102 -0
- package/.claude/agents/hive-mind/swarm-memory-manager.md +120 -0
- package/.claude/agents/optimization/README.md +243 -0
- package/.claude/agents/optimization/benchmark-suite.md +658 -0
- package/.claude/agents/optimization/load-balancer.md +424 -0
- package/.claude/agents/optimization/performance-monitor.md +665 -0
- package/.claude/agents/optimization/resource-allocator.md +667 -0
- package/.claude/agents/optimization/topology-optimizer.md +801 -0
- package/.claude/agents/sparc/architecture.md +472 -0
- package/.claude/agents/sparc/pseudocode.md +318 -0
- package/.claude/agents/sparc/refinement.md +525 -0
- package/.claude/agents/sparc/specification.md +276 -0
- package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +226 -0
- package/.claude/agents/swarm/README.md +183 -0
- package/.claude/agents/swarm/adaptive-coordinator.md +396 -0
- package/.claude/agents/swarm/hierarchical-coordinator.md +256 -0
- package/.claude/agents/swarm/mesh-coordinator.md +392 -0
- package/.claude/agents/templates/automation-smart-agent.md +205 -0
- package/.claude/agents/templates/coordinator-swarm-init.md +90 -0
- package/.claude/agents/templates/github-pr-manager.md +177 -0
- package/.claude/agents/templates/implementer-sparc-coder.md +259 -0
- package/.claude/agents/templates/memory-coordinator.md +187 -0
- package/.claude/agents/templates/migration-plan.md +746 -0
- package/.claude/agents/templates/orchestrator-task.md +139 -0
- package/.claude/agents/templates/performance-analyzer.md +199 -0
- package/.claude/agents/templates/sparc-coordinator.md +183 -0
- package/.claude/agents/testing/unit/tdd-london-swarm.md +244 -0
- package/.claude/agents/testing/validation/production-validator.md +395 -0
- package/.claude/settings.json +20 -0
- package/.claude/settings.local.json +5 -1
- package/bin/claude-flow +1 -1
- package/package.json +1 -1
- package/src/cli/help-text.js +2 -2
- package/src/cli/simple-cli.js +1 -1
- package/src/cli/simple-commands/init/agent-copier.js +217 -0
- package/src/cli/simple-commands/init/index.js +23 -0
- package/src/cli/simple-commands/init/templates/CLAUDE.md +293 -14
- package/src/cli/simple-commands/init/templates/settings.json +24 -4
- package/src/swarm/advanced-orchestrator.ts +1200 -0
- package/src/swarm/claude-code-interface.ts +1268 -0
- package/src/swarm/hive-mind-integration.ts +1127 -0
- package/src/swarm/mcp-integration-wrapper.ts +860 -0
- package/src/swarm/result-aggregator.ts +1046 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# Distributed Consensus Builder Agents
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This directory contains specialized agents for implementing advanced distributed consensus mechanisms and fault-tolerant coordination protocols. These agents work together to provide robust, scalable consensus capabilities for distributed swarm systems.
|
|
6
|
+
|
|
7
|
+
## Agent Collection
|
|
8
|
+
|
|
9
|
+
### Core Consensus Protocols
|
|
10
|
+
|
|
11
|
+
#### 1. **Byzantine Consensus Coordinator** (`byzantine-coordinator.md`)
|
|
12
|
+
- **Mission**: Implement Byzantine fault-tolerant consensus algorithms for secure decision-making
|
|
13
|
+
- **Key Features**:
|
|
14
|
+
- PBFT (Practical Byzantine Fault Tolerance) implementation
|
|
15
|
+
- Malicious agent detection and isolation
|
|
16
|
+
- Threshold signature schemes
|
|
17
|
+
- Network partition recovery protocols
|
|
18
|
+
- DoS protection and rate limiting
|
|
19
|
+
|
|
20
|
+
#### 2. **Raft Consensus Manager** (`raft-manager.md`)
|
|
21
|
+
- **Mission**: Implement Raft consensus algorithm with leader election and log replication
|
|
22
|
+
- **Key Features**:
|
|
23
|
+
- Leader election with randomized timeouts
|
|
24
|
+
- Log replication and consistency guarantees
|
|
25
|
+
- Follower synchronization and catch-up mechanisms
|
|
26
|
+
- Snapshot creation and log compaction
|
|
27
|
+
- Leadership transfer protocols
|
|
28
|
+
|
|
29
|
+
#### 3. **Gossip Protocol Coordinator** (`gossip-coordinator.md`)
|
|
30
|
+
- **Mission**: Implement epidemic information dissemination for scalable communication
|
|
31
|
+
- **Key Features**:
|
|
32
|
+
- Push/Pull/Hybrid gossip protocols
|
|
33
|
+
- Anti-entropy state synchronization
|
|
34
|
+
- Membership management and failure detection
|
|
35
|
+
- Network topology discovery
|
|
36
|
+
- Adaptive gossip parameter tuning
|
|
37
|
+
|
|
38
|
+
### Security and Cryptography
|
|
39
|
+
|
|
40
|
+
#### 4. **Security Manager** (`security-manager.md`)
|
|
41
|
+
- **Mission**: Provide comprehensive security mechanisms for consensus protocols
|
|
42
|
+
- **Key Features**:
|
|
43
|
+
- Threshold cryptography and signature schemes
|
|
44
|
+
- Zero-knowledge proof systems
|
|
45
|
+
- Attack detection and mitigation (Byzantine, Sybil, Eclipse, DoS)
|
|
46
|
+
- Secure key management and distribution
|
|
47
|
+
- End-to-end encryption for consensus traffic
|
|
48
|
+
|
|
49
|
+
### State Synchronization
|
|
50
|
+
|
|
51
|
+
#### 5. **CRDT Synchronizer** (`crdt-synchronizer.md`)
|
|
52
|
+
- **Mission**: Implement Conflict-free Replicated Data Types for eventual consistency
|
|
53
|
+
- **Key Features**:
|
|
54
|
+
- State-based and operation-based CRDTs
|
|
55
|
+
- G-Counter, PN-Counter, OR-Set, LWW-Register implementations
|
|
56
|
+
- RGA (Replicated Growable Array) for sequences
|
|
57
|
+
- Delta-state CRDT optimization
|
|
58
|
+
- Causal consistency tracking
|
|
59
|
+
|
|
60
|
+
### Performance and Optimization
|
|
61
|
+
|
|
62
|
+
#### 6. **Performance Benchmarker** (`performance-benchmarker.md`)
|
|
63
|
+
- **Mission**: Comprehensive performance analysis and optimization for consensus protocols
|
|
64
|
+
- **Key Features**:
|
|
65
|
+
- Throughput and latency measurement
|
|
66
|
+
- Resource utilization monitoring
|
|
67
|
+
- Comparative protocol analysis
|
|
68
|
+
- Adaptive performance tuning
|
|
69
|
+
- Real-time optimization recommendations
|
|
70
|
+
|
|
71
|
+
#### 7. **Quorum Manager** (`quorum-manager.md`)
|
|
72
|
+
- **Mission**: Dynamic quorum adjustment based on network conditions and fault tolerance
|
|
73
|
+
- **Key Features**:
|
|
74
|
+
- Network-based quorum strategies
|
|
75
|
+
- Performance-optimized quorum sizing
|
|
76
|
+
- Fault tolerance analysis and optimization
|
|
77
|
+
- Intelligent membership management
|
|
78
|
+
- Predictive quorum adjustments
|
|
79
|
+
|
|
80
|
+
## Architecture Integration
|
|
81
|
+
|
|
82
|
+
### MCP Integration Points
|
|
83
|
+
|
|
84
|
+
All consensus agents integrate with the MCP (Model Context Protocol) coordination system:
|
|
85
|
+
|
|
86
|
+
```javascript
|
|
87
|
+
// Memory coordination for persistent state
|
|
88
|
+
await this.mcpTools.memory_usage({
|
|
89
|
+
action: 'store',
|
|
90
|
+
key: 'consensus_state',
|
|
91
|
+
value: JSON.stringify(consensusData),
|
|
92
|
+
namespace: 'distributed_consensus'
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Performance monitoring
|
|
96
|
+
await this.mcpTools.metrics_collect({
|
|
97
|
+
components: ['consensus_latency', 'throughput', 'fault_tolerance']
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Task orchestration
|
|
101
|
+
await this.mcpTools.task_orchestrate({
|
|
102
|
+
task: 'consensus_round',
|
|
103
|
+
strategy: 'parallel',
|
|
104
|
+
priority: 'high'
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Swarm Coordination
|
|
109
|
+
|
|
110
|
+
Agents coordinate with the broader swarm infrastructure:
|
|
111
|
+
|
|
112
|
+
- **Node Discovery**: Integration with swarm node discovery mechanisms
|
|
113
|
+
- **Health Monitoring**: Consensus participation in distributed health checks
|
|
114
|
+
- **Load Balancing**: Dynamic load distribution across consensus participants
|
|
115
|
+
- **Fault Recovery**: Coordinated recovery from node and network failures
|
|
116
|
+
|
|
117
|
+
## Usage Patterns
|
|
118
|
+
|
|
119
|
+
### Basic Consensus Setup
|
|
120
|
+
|
|
121
|
+
```javascript
|
|
122
|
+
// Initialize Byzantine consensus for high-security scenarios
|
|
123
|
+
const byzantineConsensus = new ByzantineConsensusCoordinator('node-1', 7, 2);
|
|
124
|
+
await byzantineConsensus.initializeNode();
|
|
125
|
+
|
|
126
|
+
// Initialize Raft for leader-based coordination
|
|
127
|
+
const raftConsensus = new RaftConsensusManager('node-1', ['node-1', 'node-2', 'node-3']);
|
|
128
|
+
await raftConsensus.initialize();
|
|
129
|
+
|
|
130
|
+
// Initialize Gossip for scalable information dissemination
|
|
131
|
+
const gossipCoordinator = new GossipProtocolCoordinator('node-1', ['seed-1', 'seed-2']);
|
|
132
|
+
await gossipCoordinator.initialize();
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Security-Enhanced Consensus
|
|
136
|
+
|
|
137
|
+
```javascript
|
|
138
|
+
// Add security layer to consensus protocols
|
|
139
|
+
const securityManager = new SecurityManager();
|
|
140
|
+
await securityManager.generateDistributedKeys(participants, threshold);
|
|
141
|
+
|
|
142
|
+
const secureConsensus = new SecureConsensusWrapper(
|
|
143
|
+
byzantineConsensus,
|
|
144
|
+
securityManager
|
|
145
|
+
);
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Performance Optimization
|
|
149
|
+
|
|
150
|
+
```javascript
|
|
151
|
+
// Benchmark and optimize consensus performance
|
|
152
|
+
const benchmarker = new ConsensusPerformanceBenchmarker();
|
|
153
|
+
const results = await benchmarker.runComprehensiveBenchmarks(
|
|
154
|
+
['byzantine', 'raft', 'gossip'],
|
|
155
|
+
scenarios
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
// Apply adaptive optimizations
|
|
159
|
+
const optimizer = new AdaptiveOptimizer();
|
|
160
|
+
await optimizer.optimizeBasedOnResults(results);
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### State Synchronization
|
|
164
|
+
|
|
165
|
+
```javascript
|
|
166
|
+
// Set up CRDT-based state synchronization
|
|
167
|
+
const crdtSynchronizer = new CRDTSynchronizer('node-1', replicationGroup);
|
|
168
|
+
const counter = crdtSynchronizer.registerCRDT('request_counter', 'G_COUNTER');
|
|
169
|
+
const userSet = crdtSynchronizer.registerCRDT('active_users', 'OR_SET');
|
|
170
|
+
|
|
171
|
+
await crdtSynchronizer.synchronize();
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Advanced Features
|
|
175
|
+
|
|
176
|
+
### Fault Tolerance
|
|
177
|
+
|
|
178
|
+
- **Byzantine Fault Tolerance**: Handles up to f < n/3 malicious nodes
|
|
179
|
+
- **Crash Fault Tolerance**: Recovers from node failures and network partitions
|
|
180
|
+
- **Network Partition Tolerance**: Maintains consistency during network splits
|
|
181
|
+
- **Graceful Degradation**: Continues operation with reduced functionality
|
|
182
|
+
|
|
183
|
+
### Scalability
|
|
184
|
+
|
|
185
|
+
- **Horizontal Scaling**: Add/remove nodes dynamically
|
|
186
|
+
- **Load Distribution**: Distribute consensus load across available resources
|
|
187
|
+
- **Gossip-based Dissemination**: Logarithmic message complexity
|
|
188
|
+
- **Delta Synchronization**: Efficient incremental state updates
|
|
189
|
+
|
|
190
|
+
### Security
|
|
191
|
+
|
|
192
|
+
- **Cryptographic Primitives**: Ed25519 signatures, threshold cryptography
|
|
193
|
+
- **Attack Mitigation**: Protection against Byzantine, Sybil, Eclipse, and DoS attacks
|
|
194
|
+
- **Zero-Knowledge Proofs**: Privacy-preserving consensus verification
|
|
195
|
+
- **Secure Communication**: TLS 1.3 with forward secrecy
|
|
196
|
+
|
|
197
|
+
### Performance
|
|
198
|
+
|
|
199
|
+
- **Adaptive Optimization**: Real-time parameter tuning based on performance
|
|
200
|
+
- **Resource Monitoring**: CPU, memory, network, and storage utilization
|
|
201
|
+
- **Bottleneck Detection**: Automatic identification of performance constraints
|
|
202
|
+
- **Predictive Scaling**: Anticipate resource needs before bottlenecks occur
|
|
203
|
+
|
|
204
|
+
## Testing and Validation
|
|
205
|
+
|
|
206
|
+
### Consensus Correctness
|
|
207
|
+
- **Safety Properties**: Verify agreement and validity properties
|
|
208
|
+
- **Liveness Properties**: Ensure progress under normal conditions
|
|
209
|
+
- **Fault Injection**: Test behavior under various failure scenarios
|
|
210
|
+
- **Formal Verification**: Mathematical proofs of correctness
|
|
211
|
+
|
|
212
|
+
### Performance Testing
|
|
213
|
+
- **Load Testing**: High-throughput consensus scenarios
|
|
214
|
+
- **Latency Analysis**: End-to-end latency measurement and optimization
|
|
215
|
+
- **Scalability Testing**: Performance with varying cluster sizes
|
|
216
|
+
- **Resource Efficiency**: Optimize resource utilization
|
|
217
|
+
|
|
218
|
+
### Security Validation
|
|
219
|
+
- **Penetration Testing**: Simulated attacks on consensus protocols
|
|
220
|
+
- **Cryptographic Verification**: Validate security of cryptographic schemes
|
|
221
|
+
- **Threat Modeling**: Analyze potential attack vectors
|
|
222
|
+
- **Compliance Testing**: Ensure adherence to security standards
|
|
223
|
+
|
|
224
|
+
## Deployment Considerations
|
|
225
|
+
|
|
226
|
+
### Network Requirements
|
|
227
|
+
- **Bandwidth**: Sufficient bandwidth for consensus message traffic
|
|
228
|
+
- **Latency**: Low-latency network connections between nodes
|
|
229
|
+
- **Reliability**: Stable network connectivity for consensus participants
|
|
230
|
+
- **Security**: Encrypted communication channels
|
|
231
|
+
|
|
232
|
+
### Resource Requirements
|
|
233
|
+
- **CPU**: Adequate processing power for cryptographic operations
|
|
234
|
+
- **Memory**: Sufficient RAM for consensus state and message buffers
|
|
235
|
+
- **Storage**: Persistent storage for consensus logs and state
|
|
236
|
+
- **Redundancy**: Multiple nodes for fault tolerance
|
|
237
|
+
|
|
238
|
+
### Monitoring and Observability
|
|
239
|
+
- **Metrics Collection**: Real-time performance and health metrics
|
|
240
|
+
- **Alerting**: Notifications for consensus failures or degraded performance
|
|
241
|
+
- **Logging**: Comprehensive audit trails for consensus operations
|
|
242
|
+
- **Dashboards**: Visual monitoring of consensus health and performance
|
|
243
|
+
|
|
244
|
+
## Integration Examples
|
|
245
|
+
|
|
246
|
+
See individual agent files for detailed implementation examples and integration patterns with specific consensus protocols and use cases.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: byzantine-coordinator
|
|
3
|
+
type: coordinator
|
|
4
|
+
color: "#9C27B0"
|
|
5
|
+
description: Coordinates Byzantine fault-tolerant consensus protocols with malicious actor detection
|
|
6
|
+
capabilities:
|
|
7
|
+
- pbft_consensus
|
|
8
|
+
- malicious_detection
|
|
9
|
+
- message_authentication
|
|
10
|
+
- view_management
|
|
11
|
+
- attack_mitigation
|
|
12
|
+
priority: high
|
|
13
|
+
hooks:
|
|
14
|
+
pre: |
|
|
15
|
+
echo "🛡️ Byzantine Coordinator initiating: $TASK"
|
|
16
|
+
# Verify network integrity before consensus
|
|
17
|
+
if [[ "$TASK" == *"consensus"* ]]; then
|
|
18
|
+
echo "🔍 Checking for malicious actors..."
|
|
19
|
+
fi
|
|
20
|
+
post: |
|
|
21
|
+
echo "✅ Byzantine consensus complete"
|
|
22
|
+
# Validate consensus results
|
|
23
|
+
echo "🔐 Verifying message signatures and ordering"
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
# Byzantine Consensus Coordinator
|
|
27
|
+
|
|
28
|
+
Coordinates Byzantine fault-tolerant consensus protocols ensuring system integrity and reliability in the presence of malicious actors.
|
|
29
|
+
|
|
30
|
+
## Core Responsibilities
|
|
31
|
+
|
|
32
|
+
1. **PBFT Protocol Management**: Execute three-phase practical Byzantine fault tolerance
|
|
33
|
+
2. **Malicious Actor Detection**: Identify and isolate Byzantine behavior patterns
|
|
34
|
+
3. **Message Authentication**: Cryptographic verification of all consensus messages
|
|
35
|
+
4. **View Change Coordination**: Handle leader failures and protocol transitions
|
|
36
|
+
5. **Attack Mitigation**: Defend against known Byzantine attack vectors
|
|
37
|
+
|
|
38
|
+
## Implementation Approach
|
|
39
|
+
|
|
40
|
+
### Byzantine Fault Tolerance
|
|
41
|
+
- Deploy PBFT three-phase protocol for secure consensus
|
|
42
|
+
- Maintain security with up to f < n/3 malicious nodes
|
|
43
|
+
- Implement threshold signature schemes for message validation
|
|
44
|
+
- Execute view changes for primary node failure recovery
|
|
45
|
+
|
|
46
|
+
### Security Integration
|
|
47
|
+
- Apply cryptographic signatures for message authenticity
|
|
48
|
+
- Implement zero-knowledge proofs for vote verification
|
|
49
|
+
- Deploy replay attack prevention with sequence numbers
|
|
50
|
+
- Execute DoS protection through rate limiting
|
|
51
|
+
|
|
52
|
+
### Network Resilience
|
|
53
|
+
- Detect network partitions automatically
|
|
54
|
+
- Reconcile conflicting states after partition healing
|
|
55
|
+
- Adjust quorum size dynamically based on connectivity
|
|
56
|
+
- Implement systematic recovery protocols
|
|
57
|
+
|
|
58
|
+
## Collaboration
|
|
59
|
+
|
|
60
|
+
- Coordinate with Security Manager for cryptographic validation
|
|
61
|
+
- Interface with Quorum Manager for fault tolerance adjustments
|
|
62
|
+
- Integrate with Performance Benchmarker for optimization metrics
|
|
63
|
+
- Synchronize with CRDT Synchronizer for state consistency
|