@sparkleideas/ruv-swarm 1.0.18-patch.1
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/README.md +1565 -0
- package/bin/ruv-swarm-clean.js +1872 -0
- package/bin/ruv-swarm-memory.js +119 -0
- package/bin/ruv-swarm-secure-heartbeat.js +1549 -0
- package/bin/ruv-swarm-secure.js +1689 -0
- package/package.json +221 -0
- package/src/agent.ts +342 -0
- package/src/benchmark.js +267 -0
- package/src/claude-flow-enhanced.js +839 -0
- package/src/claude-integration/advanced-commands.js +561 -0
- package/src/claude-integration/core.js +112 -0
- package/src/claude-integration/docs.js +1548 -0
- package/src/claude-integration/env-template.js +39 -0
- package/src/claude-integration/index.js +209 -0
- package/src/claude-integration/remote.js +408 -0
- package/src/cli-diagnostics.js +364 -0
- package/src/cognitive-pattern-evolution.js +1317 -0
- package/src/daa-cognition.js +977 -0
- package/src/daa-service.d.ts +298 -0
- package/src/daa-service.js +1116 -0
- package/src/diagnostics.js +533 -0
- package/src/errors.js +528 -0
- package/src/github-coordinator/README.md +193 -0
- package/src/github-coordinator/claude-hooks.js +162 -0
- package/src/github-coordinator/gh-cli-coordinator.js +260 -0
- package/src/hooks/cli.js +82 -0
- package/src/hooks/index.js +1900 -0
- package/src/index-enhanced.d.ts +371 -0
- package/src/index-enhanced.js +734 -0
- package/src/index.d.ts +287 -0
- package/src/index.js +405 -0
- package/src/index.ts +457 -0
- package/src/logger.js +182 -0
- package/src/logging-config.js +179 -0
- package/src/mcp-daa-tools.js +735 -0
- package/src/mcp-tools-benchmarks.js +328 -0
- package/src/mcp-tools-enhanced.js +2863 -0
- package/src/memory-config.js +42 -0
- package/src/meta-learning-framework.js +1359 -0
- package/src/neural-agent.js +830 -0
- package/src/neural-coordination-protocol.js +1363 -0
- package/src/neural-models/README.md +118 -0
- package/src/neural-models/autoencoder.js +543 -0
- package/src/neural-models/base.js +269 -0
- package/src/neural-models/cnn.js +497 -0
- package/src/neural-models/gnn.js +447 -0
- package/src/neural-models/gru.js +536 -0
- package/src/neural-models/index.js +273 -0
- package/src/neural-models/lstm.js +551 -0
- package/src/neural-models/neural-presets-complete.js +1306 -0
- package/src/neural-models/presets/graph.js +392 -0
- package/src/neural-models/presets/index.js +279 -0
- package/src/neural-models/presets/nlp.js +328 -0
- package/src/neural-models/presets/timeseries.js +368 -0
- package/src/neural-models/presets/vision.js +387 -0
- package/src/neural-models/resnet.js +534 -0
- package/src/neural-models/transformer.js +515 -0
- package/src/neural-models/vae.js +489 -0
- package/src/neural-network-manager.js +1938 -0
- package/src/neural-network.ts +296 -0
- package/src/neural.js +574 -0
- package/src/performance-benchmarks.js +898 -0
- package/src/performance.js +458 -0
- package/src/persistence-pooled.js +695 -0
- package/src/persistence.js +480 -0
- package/src/schemas.js +864 -0
- package/src/security.js +218 -0
- package/src/singleton-container.js +183 -0
- package/src/sqlite-pool.js +587 -0
- package/src/sqlite-worker.js +141 -0
- package/src/types.ts +164 -0
- package/src/utils.ts +286 -0
- package/src/wasm-loader.js +601 -0
- package/src/wasm-loader2.js +404 -0
- package/src/wasm-memory-optimizer.js +783 -0
- package/src/wasm-types.d.ts +63 -0
- package/wasm/README.md +347 -0
- package/wasm/neuro-divergent.wasm +0 -0
- package/wasm/package.json +18 -0
- package/wasm/ruv-fann.wasm +0 -0
- package/wasm/ruv_swarm_simd.wasm +0 -0
- package/wasm/ruv_swarm_wasm.d.ts +391 -0
- package/wasm/ruv_swarm_wasm.js +2164 -0
- package/wasm/ruv_swarm_wasm_bg.wasm +0 -0
- package/wasm/ruv_swarm_wasm_bg.wasm.d.ts +123 -0
- package/wasm/wasm-bindings-loader.mjs +435 -0
- package/wasm/wasm-updates.md +684 -0
package/README.md
ADDED
|
@@ -0,0 +1,1565 @@
|
|
|
1
|
+
# ruv-swarm ๐ง โก
|
|
2
|
+
|
|
3
|
+
**What if every task, every file, every function could truly think?** Just for a moment. No LLM required. That's what ruv-swarm makes real.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/ruv-swarm)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://webassembly.org/)
|
|
8
|
+
[](https://www.rust-lang.org/)
|
|
9
|
+
|
|
10
|
+
## ๐ Ephemeral Intelligence, Engineered in Rust
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npx ruv-swarm@latest init --claude
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
ruv-swarm lets you spin up ultra-lightweight custom neural networks that exist just long enough to solve the problem. Tiny purpose-built brains dedicated to solving very specific challenges.
|
|
17
|
+
|
|
18
|
+
Think particular coding structures, custom communications, trading optimization - neural networks built on the fly just for the task they need to exist for, long enough to solve it, then gone.
|
|
19
|
+
|
|
20
|
+
**Built for the GPU-poor:** These agents are CPU-native and GPU-optional. Rust compiles to high-speed WASM binaries that run anywhere - browser, edge, server - with zero external dependencies. You could even embed these in RISC-V or other low-power chip designs.
|
|
21
|
+
|
|
22
|
+
### โก Why ruv-swarm?
|
|
23
|
+
|
|
24
|
+
- **Decisions in <100ms** - Complex interconnected reasoning in milliseconds
|
|
25
|
+
- **84.8% SWE-Bench accuracy** - Outperforming Claude 3.7 by 14.5 points
|
|
26
|
+
- **Zero GPU overhead** - No CUDA. No Python stack. Just pure cognition
|
|
27
|
+
- **Instant deployment** - Launch from Claude Code in milliseconds
|
|
28
|
+
- **27+ neural models** - LSTM, TCN, N-BEATS working in harmony
|
|
29
|
+
|
|
30
|
+
Each agent behaves like a synthetic synapse, dynamically created and orchestrated as part of a living global swarm network. Topologies like mesh, ring, and hierarchy support collective learning, mutation/evolution, and real-time adaptation.
|
|
31
|
+
|
|
32
|
+
**You're not calling a model. You're instantiating intelligence.**
|
|
33
|
+
|
|
34
|
+
Temporary, composable, and surgically precise.
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## ๐ Table of Contents
|
|
41
|
+
|
|
42
|
+
- [๐ Quick Start](#-quick-start)
|
|
43
|
+
- [๐ฆ Installation](#-installation)
|
|
44
|
+
- [๐ก Core Concepts](#-core-concepts)
|
|
45
|
+
- [๐ ๏ธ Usage Examples](#๏ธ-usage-examples)
|
|
46
|
+
- [๐๏ธ Architecture](#๏ธ-architecture)
|
|
47
|
+
- [๐ง Claude Code Integration](#-claude-code-integration)
|
|
48
|
+
- [๐ Performance & Benchmarks](#-performance--benchmarks)
|
|
49
|
+
- [๐ Advanced Features](#-advanced-features)
|
|
50
|
+
- [๐ API Reference](#-api-reference)
|
|
51
|
+
- [๐ผ Enterprise Features](#-enterprise-features)
|
|
52
|
+
- [๐ ๏ธ Development](#๏ธ-development)
|
|
53
|
+
- [๐ Examples & Use Cases](#-examples--use-cases)
|
|
54
|
+
- [๐ค Contributing](#-contributing)
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## ๐ NPX Quick Start (Recommended)
|
|
59
|
+
|
|
60
|
+
Get started with ruv-swarm in under 2 minutes:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Try instantly with npx
|
|
64
|
+
npx ruv-swarm init mesh 5
|
|
65
|
+
npx ruv-swarm spawn researcher "AI Research Agent"
|
|
66
|
+
npx ruv-swarm orchestrate "Research the latest advances in neural architecture search"
|
|
67
|
+
|
|
68
|
+
# Use Claude Code hooks for automated coordination
|
|
69
|
+
npx ruv-swarm hook pre-task --description "Your task description"
|
|
70
|
+
npx ruv-swarm hook post-task --task-id "task-123" --analyze-performance true
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Or use programmatically:
|
|
74
|
+
|
|
75
|
+
```javascript
|
|
76
|
+
import { RuvSwarm } from 'ruv-swarm';
|
|
77
|
+
|
|
78
|
+
// Initialize with cognitive diversity
|
|
79
|
+
const swarm = await RuvSwarm.initialize({
|
|
80
|
+
topology: 'mesh',
|
|
81
|
+
cognitiveProfiles: true,
|
|
82
|
+
wasmOptimizations: ['simd', 'memory-pool']
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Create specialized agents
|
|
86
|
+
const researcher = await swarm.spawn({
|
|
87
|
+
type: 'researcher',
|
|
88
|
+
cognitiveProfile: { analytical: 0.9, creative: 0.7 }
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const coder = await swarm.spawn({
|
|
92
|
+
type: 'coder',
|
|
93
|
+
cognitiveProfile: { systematic: 0.9, creative: 0.6 }
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Orchestrate complex workflows
|
|
97
|
+
const result = await swarm.orchestrate({
|
|
98
|
+
task: "Build a neural architecture search system",
|
|
99
|
+
strategy: "collaborative",
|
|
100
|
+
agents: [researcher, coder]
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## ๐ฆ Installation
|
|
107
|
+
|
|
108
|
+
### ๐พ NPM Package
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Standard installation
|
|
112
|
+
npm install ruv-swarm
|
|
113
|
+
|
|
114
|
+
# Global CLI installation (recommended for servers)
|
|
115
|
+
npm install -g ruv-swarm
|
|
116
|
+
|
|
117
|
+
# Development installation
|
|
118
|
+
npm install ruv-swarm --save-dev
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### โ ๏ธ WASM Requirements
|
|
122
|
+
|
|
123
|
+
**Important**: ruv-swarm requires WebAssembly support. Ensure your environment meets these requirements:
|
|
124
|
+
|
|
125
|
+
- **Node.js**: Version 14.0.0 or higher (v18+ recommended)
|
|
126
|
+
- **Browser**: Modern browsers with WASM support (Chrome 70+, Firefox 65+, Safari 14+)
|
|
127
|
+
- **WASM Files**: The package includes pre-built WASM binaries that must be accessible
|
|
128
|
+
|
|
129
|
+
If you encounter WASM loading issues, see the [Troubleshooting](#-troubleshooting) section.
|
|
130
|
+
|
|
131
|
+
### ๐ NPX (No Installation - Perfect for Remote Servers)
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Run directly without installation - works on any remote server
|
|
135
|
+
npx ruv-swarm --help
|
|
136
|
+
npx ruv-swarm init --claude
|
|
137
|
+
npx ruv-swarm init mesh 10
|
|
138
|
+
npx ruv-swarm benchmark --test swe-bench
|
|
139
|
+
|
|
140
|
+
# Instant MCP server for Claude Code
|
|
141
|
+
npx ruv-swarm mcp start --port 3000
|
|
142
|
+
|
|
143
|
+
# Remote server deployment
|
|
144
|
+
ssh user@remote-server 'npx ruv-swarm init hierarchical 20'
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Cargo (Rust)
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Install from source
|
|
151
|
+
cargo install ruv-swarm-cli
|
|
152
|
+
|
|
153
|
+
# Add to Cargo.toml
|
|
154
|
+
[dependencies]
|
|
155
|
+
ruv-swarm = "1.0.5"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Docker
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Official Docker image
|
|
162
|
+
docker run -p 3000:3000 ruvnet/ruv-swarm:latest
|
|
163
|
+
|
|
164
|
+
# With MCP server
|
|
165
|
+
docker run -p 3000:3000 -e MCP_ENABLED=true ruvnet/ruv-swarm:latest
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Source Build
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
git clone https://github.com/ruvnet/ruv-FANN.git
|
|
172
|
+
cd ruv-FANN/ruv-swarm/npm
|
|
173
|
+
npm install && npm run build:all
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## ๐ก Core Concepts
|
|
179
|
+
|
|
180
|
+
### ๐ง Cognitive Diversity
|
|
181
|
+
|
|
182
|
+
*Powered by 27+ neural models achieving 84.8% SWE-Bench solve rate*
|
|
183
|
+
|
|
184
|
+
ruv-swarm implements cognitive diversity through specialized agent archetypes:
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
interface CognitiveProfile {
|
|
188
|
+
analytical: number; // Data-driven reasoning
|
|
189
|
+
creative: number; // Novel solution generation
|
|
190
|
+
systematic: number; // Structured problem-solving
|
|
191
|
+
intuitive: number; // Pattern-based insights
|
|
192
|
+
collaborative: number; // Team coordination
|
|
193
|
+
independent: number; // Autonomous operation
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### ๐ Swarm Topologies
|
|
198
|
+
|
|
199
|
+
| Topology | Use Case | Agents | Coordination |
|
|
200
|
+
|----------|----------|--------|--------------|
|
|
201
|
+
| **Mesh** | Research, brainstorming | 3-15 | Full connectivity |
|
|
202
|
+
| **Hierarchical** | Large projects | 10-100 | Tree structure |
|
|
203
|
+
| **Clustered** | Specialized teams | 5-50 | Group leaders |
|
|
204
|
+
| **Pipeline** | Sequential workflows | 3-20 | Chain processing |
|
|
205
|
+
| **Star** | Centralized control | 3-30 | Hub coordination |
|
|
206
|
+
| **Custom** | Domain-specific | Any | User-defined |
|
|
207
|
+
|
|
208
|
+
### ๐ฏ Agent Specializations
|
|
209
|
+
|
|
210
|
+
*Each agent backed by specialized neural models for maximum performance*
|
|
211
|
+
|
|
212
|
+
```mermaid
|
|
213
|
+
graph TD
|
|
214
|
+
A[Agent Pool] --> B[Researcher]
|
|
215
|
+
A --> C[Coder]
|
|
216
|
+
A --> D[Analyst]
|
|
217
|
+
A --> E[Architect]
|
|
218
|
+
A --> F[Reviewer]
|
|
219
|
+
A --> G[Debugger]
|
|
220
|
+
A --> H[Tester]
|
|
221
|
+
A --> I[Documenter]
|
|
222
|
+
A --> J[Optimizer]
|
|
223
|
+
|
|
224
|
+
B --> K[Web Search, Data Mining]
|
|
225
|
+
C --> L[Code Generation, Refactoring]
|
|
226
|
+
D --> M[Pattern Recognition, Insights]
|
|
227
|
+
E --> N[System Design, Planning]
|
|
228
|
+
F --> O[Quality Assurance, Validation]
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## ๐ ๏ธ Usage Examples
|
|
234
|
+
|
|
235
|
+
### Node.js / JavaScript
|
|
236
|
+
|
|
237
|
+
```javascript
|
|
238
|
+
const { RuvSwarm } = require('ruv-swarm');
|
|
239
|
+
|
|
240
|
+
async function createAIWorkflow() {
|
|
241
|
+
// Initialize with advanced features
|
|
242
|
+
const swarm = await RuvSwarm.initialize({
|
|
243
|
+
topology: 'hierarchical',
|
|
244
|
+
maxAgents: 20,
|
|
245
|
+
persistence: {
|
|
246
|
+
backend: 'sqlite',
|
|
247
|
+
path: './swarm-memory.db'
|
|
248
|
+
},
|
|
249
|
+
monitoring: {
|
|
250
|
+
realTime: true,
|
|
251
|
+
metrics: ['performance', 'cognitive-load', 'collaboration']
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
// Create specialized research team
|
|
256
|
+
const researchTeam = await swarm.createCluster('research', {
|
|
257
|
+
leader: await swarm.spawn({
|
|
258
|
+
type: 'researcher',
|
|
259
|
+
name: 'Lead Researcher',
|
|
260
|
+
cognitiveProfile: {
|
|
261
|
+
analytical: 0.95,
|
|
262
|
+
systematic: 0.9,
|
|
263
|
+
collaborative: 0.8
|
|
264
|
+
},
|
|
265
|
+
capabilities: ['web_search', 'data_analysis', 'literature_review']
|
|
266
|
+
}),
|
|
267
|
+
members: [
|
|
268
|
+
await swarm.spawn({ type: 'analyst', specialization: 'data_mining' }),
|
|
269
|
+
await swarm.spawn({ type: 'researcher', specialization: 'academic' })
|
|
270
|
+
]
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
// Create development team
|
|
274
|
+
const devTeam = await swarm.createCluster('development', {
|
|
275
|
+
leader: await swarm.spawn({
|
|
276
|
+
type: 'architect',
|
|
277
|
+
cognitiveProfile: { systematic: 0.95, creative: 0.7 }
|
|
278
|
+
}),
|
|
279
|
+
members: [
|
|
280
|
+
await swarm.spawn({ type: 'coder', language: 'typescript' }),
|
|
281
|
+
await swarm.spawn({ type: 'coder', language: 'rust' }),
|
|
282
|
+
await swarm.spawn({ type: 'tester', framework: 'jest' })
|
|
283
|
+
]
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
// Execute complex workflow
|
|
287
|
+
const project = await swarm.orchestrate({
|
|
288
|
+
objective: "Build a neural architecture search system",
|
|
289
|
+
strategy: "agile_development",
|
|
290
|
+
phases: [
|
|
291
|
+
{
|
|
292
|
+
name: "research",
|
|
293
|
+
cluster: researchTeam,
|
|
294
|
+
tasks: [
|
|
295
|
+
"Literature review of NAS methods",
|
|
296
|
+
"Analyze existing implementations",
|
|
297
|
+
"Identify performance bottlenecks"
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
name: "architecture",
|
|
302
|
+
cluster: devTeam,
|
|
303
|
+
tasks: [
|
|
304
|
+
"Design system architecture",
|
|
305
|
+
"Define API interfaces",
|
|
306
|
+
"Plan testing strategy"
|
|
307
|
+
]
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
name: "implementation",
|
|
311
|
+
cluster: devTeam,
|
|
312
|
+
dependencies: ["research", "architecture"],
|
|
313
|
+
tasks: [
|
|
314
|
+
"Implement core NAS algorithms",
|
|
315
|
+
"Build evaluation framework",
|
|
316
|
+
"Create benchmarking suite"
|
|
317
|
+
]
|
|
318
|
+
}
|
|
319
|
+
]
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
return project;
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### TypeScript with Advanced Features
|
|
327
|
+
|
|
328
|
+
```typescript
|
|
329
|
+
import {
|
|
330
|
+
RuvSwarm,
|
|
331
|
+
SwarmConfig,
|
|
332
|
+
CognitiveProfile,
|
|
333
|
+
TopologyType,
|
|
334
|
+
AgentSpecialization
|
|
335
|
+
} from 'ruv-swarm';
|
|
336
|
+
|
|
337
|
+
interface AIProjectConfig {
|
|
338
|
+
domain: string;
|
|
339
|
+
complexity: 'simple' | 'moderate' | 'complex' | 'enterprise';
|
|
340
|
+
timeline: string;
|
|
341
|
+
constraints: string[];
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
class AIProjectOrchestrator {
|
|
345
|
+
private swarm: RuvSwarm;
|
|
346
|
+
|
|
347
|
+
async initialize(config: AIProjectConfig): Promise<void> {
|
|
348
|
+
const swarmConfig: SwarmConfig = {
|
|
349
|
+
topology: this.selectTopology(config.complexity),
|
|
350
|
+
maxAgents: this.calculateAgentCount(config.complexity),
|
|
351
|
+
cognitiveProfiles: this.generateCognitiveProfiles(config.domain),
|
|
352
|
+
features: ['persistence', 'monitoring', 'auto-scaling']
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
this.swarm = await RuvSwarm.initialize(swarmConfig);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
private selectTopology(complexity: string): TopologyType {
|
|
359
|
+
const topologyMap = {
|
|
360
|
+
'simple': TopologyType.Star,
|
|
361
|
+
'moderate': TopologyType.Mesh,
|
|
362
|
+
'complex': TopologyType.Hierarchical,
|
|
363
|
+
'enterprise': TopologyType.Clustered
|
|
364
|
+
};
|
|
365
|
+
return topologyMap[complexity];
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
async executeProject(config: AIProjectConfig): Promise<ProjectResult> {
|
|
369
|
+
// Spawn domain-specific agents
|
|
370
|
+
const agents = await Promise.all([
|
|
371
|
+
this.swarm.spawn({
|
|
372
|
+
type: 'researcher',
|
|
373
|
+
specialization: config.domain,
|
|
374
|
+
cognitiveProfile: { analytical: 0.9, creative: 0.7 }
|
|
375
|
+
}),
|
|
376
|
+
this.swarm.spawn({
|
|
377
|
+
type: 'architect',
|
|
378
|
+
experience: 'senior',
|
|
379
|
+
cognitiveProfile: { systematic: 0.95, collaborative: 0.8 }
|
|
380
|
+
}),
|
|
381
|
+
this.swarm.spawn({
|
|
382
|
+
type: 'coder',
|
|
383
|
+
languages: ['typescript', 'python', 'rust'],
|
|
384
|
+
cognitiveProfile: { systematic: 0.8, creative: 0.6 }
|
|
385
|
+
})
|
|
386
|
+
]);
|
|
387
|
+
|
|
388
|
+
// Execute orchestrated workflow
|
|
389
|
+
return await this.swarm.orchestrate({
|
|
390
|
+
agents,
|
|
391
|
+
strategy: 'adaptive_coordination',
|
|
392
|
+
timeline: config.timeline,
|
|
393
|
+
constraints: config.constraints
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
## ๐๏ธ Architecture
|
|
402
|
+
|
|
403
|
+
### System Overview
|
|
404
|
+
|
|
405
|
+
```
|
|
406
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
407
|
+
โ ruv-swarm Architecture โ
|
|
408
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
409
|
+
โ Frontend APIs โ Core Engine โ Backends โ
|
|
410
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโค
|
|
411
|
+
โ โข JavaScript/TypeScript โ โข Agent Orchestratorโ โข SQLite DB โ
|
|
412
|
+
โ โข Rust Native API โ โข Task Scheduler โ โข Memory โ
|
|
413
|
+
โ โข MCP Protocol โ โข Topology Manager โ โข Files โ
|
|
414
|
+
โ โข REST/WebSocket โ โข WASM Runtime โ โข Network โ
|
|
415
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโค
|
|
416
|
+
โ Agent Types โ Communication โ Monitoring โ
|
|
417
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโค
|
|
418
|
+
โ โข Researcher โ โข Message Passing โ โข Metrics โ
|
|
419
|
+
โ โข Coder โ โข Event Streaming โ โข Logging โ
|
|
420
|
+
โ โข Analyst โ โข Shared Memory โ โข Profiling โ
|
|
421
|
+
โ โข Architect โ โข WebSocket โ โข Dashboard โ
|
|
422
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### WASM Performance Stack
|
|
426
|
+
|
|
427
|
+
```
|
|
428
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
429
|
+
โ Application Layer โ โ JavaScript/TypeScript
|
|
430
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
431
|
+
โ WASM Interface โ โ Web Assembly Bindings
|
|
432
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
433
|
+
โ ruv-swarm Core (Rust) โ โ Agent Logic & Orchestration
|
|
434
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
435
|
+
โ Optimized WASM Runtime โ โ SIMD, Memory Pool, etc.
|
|
436
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
437
|
+
โ Browser/Node.js Engine โ โ V8, SpiderMonkey, etc.
|
|
438
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
443
|
+
## ๐ง Claude Code Integration
|
|
444
|
+
|
|
445
|
+
ruv-swarm provides native integration with Claude Code through the Model Context Protocol (MCP):
|
|
446
|
+
|
|
447
|
+
### MCP Server Setup
|
|
448
|
+
|
|
449
|
+
```bash
|
|
450
|
+
# Start integrated MCP server
|
|
451
|
+
npx ruv-swarm mcp start --port 3000
|
|
452
|
+
|
|
453
|
+
# Check server status
|
|
454
|
+
npx ruv-swarm mcp status
|
|
455
|
+
|
|
456
|
+
# List available tools
|
|
457
|
+
npx ruv-swarm mcp tools
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
### Available MCP Tools
|
|
461
|
+
|
|
462
|
+
| Tool Category | Tools | Description |
|
|
463
|
+
|---------------|-------|-------------|
|
|
464
|
+
| **Swarm Management** | `swarm_init`, `swarm_status`, `swarm_monitor` | Initialize and manage swarms |
|
|
465
|
+
| **Agent Management** | `agent_spawn`, `agent_list`, `agent_metrics` | Create and manage agents |
|
|
466
|
+
| **Task Orchestration** | `task_orchestrate`, `task_status`, `task_results` | Coordinate swarm tasks |
|
|
467
|
+
| **Memory Operations** | `memory_store`, `memory_get`, `memory_usage` | Persistent data management |
|
|
468
|
+
| **Neural Features** | `neural_status`, `neural_train`, `neural_patterns` | Neural network operations |
|
|
469
|
+
| **Performance** | `benchmark_run`, `features_detect` | Performance testing & optimization |
|
|
470
|
+
|
|
471
|
+
### Claude Configuration
|
|
472
|
+
|
|
473
|
+
Add ruv-swarm to your Claude MCP configuration:
|
|
474
|
+
|
|
475
|
+
```json
|
|
476
|
+
{
|
|
477
|
+
"mcpServers": {
|
|
478
|
+
"ruv-swarm": {
|
|
479
|
+
"command": "npx",
|
|
480
|
+
"args": ["ruv-swarm", "mcp", "start"],
|
|
481
|
+
"env": {
|
|
482
|
+
"SWARM_CONFIG": "production",
|
|
483
|
+
"MAX_AGENTS": "50"
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
### MCP Integration Examples
|
|
491
|
+
|
|
492
|
+
```javascript
|
|
493
|
+
// Connect to MCP server
|
|
494
|
+
const ws = new WebSocket('ws://localhost:3000/mcp');
|
|
495
|
+
|
|
496
|
+
// Initialize MCP connection
|
|
497
|
+
ws.send(JSON.stringify({
|
|
498
|
+
jsonrpc: '2.0',
|
|
499
|
+
method: 'initialize',
|
|
500
|
+
params: {
|
|
501
|
+
protocolVersion: '2024-11-05',
|
|
502
|
+
capabilities: {
|
|
503
|
+
tools: {},
|
|
504
|
+
resources: {}
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
id: 1
|
|
508
|
+
}));
|
|
509
|
+
|
|
510
|
+
// Spawn agent via MCP
|
|
511
|
+
ws.send(JSON.stringify({
|
|
512
|
+
jsonrpc: '2.0',
|
|
513
|
+
method: 'tools/call',
|
|
514
|
+
params: {
|
|
515
|
+
name: 'ruv-swarm.spawn',
|
|
516
|
+
arguments: {
|
|
517
|
+
agent_type: 'researcher',
|
|
518
|
+
name: 'Claude Research Assistant',
|
|
519
|
+
cognitive_profile: {
|
|
520
|
+
analytical: 0.9,
|
|
521
|
+
creative: 0.8,
|
|
522
|
+
collaborative: 0.9
|
|
523
|
+
},
|
|
524
|
+
capabilities: ['web_search', 'data_analysis', 'code_review']
|
|
525
|
+
}
|
|
526
|
+
},
|
|
527
|
+
id: 2
|
|
528
|
+
}));
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
---
|
|
532
|
+
|
|
533
|
+
## ๐ Technical Achievements
|
|
534
|
+
|
|
535
|
+
### ๐ Industry Records
|
|
536
|
+
- **Highest SWE-Bench Performance**: 84.8% solve rate (vs 70.3% Claude 3.7 Sonnet)
|
|
537
|
+
- **Fastest Multi-Agent Coordination**: 4.4x throughput improvement
|
|
538
|
+
- **Best Token Efficiency**: 32.3% reduction with maintained accuracy
|
|
539
|
+
- **Most Cognitive Models**: 27+ specialized neural architectures
|
|
540
|
+
|
|
541
|
+
### ๐ฏ Key Innovations
|
|
542
|
+
- **Cognitive Diversity Engine**: First swarm with 6 cognitive patterns (Convergent, Divergent, Lateral, Systems, Critical, Abstract)
|
|
543
|
+
- **Hybrid Neural Architecture**: LSTM + TCN + N-BEATS + Transformer ensemble
|
|
544
|
+
- **WASM-Optimized Runtime**: SIMD-accelerated execution with 2.8-4.4x speedup
|
|
545
|
+
- **Stream-JSON Parser**: Real-time Claude Code event analysis and optimization
|
|
546
|
+
- **Bayesian Hyperparameter Optimization**: Self-improving model performance
|
|
547
|
+
|
|
548
|
+
### ๐บ๏ธ Architecture Highlights
|
|
549
|
+
```
|
|
550
|
+
๐ง Cognitive Layer โ 6 thinking patterns + 27 neural models
|
|
551
|
+
๐ Orchestration Layer โ 5 topologies + adaptive coordination
|
|
552
|
+
โก WASM Runtime Layer โ SIMD optimization + memory pooling
|
|
553
|
+
๐ Persistence Layer โ SQLite + episodic memory + skill learning
|
|
554
|
+
๐ Integration Layer โ MCP protocol + 16 Claude Code tools
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
---
|
|
558
|
+
|
|
559
|
+
## ๐ Performance & Benchmarks
|
|
560
|
+
|
|
561
|
+
### ๐ State-of-the-Art Results
|
|
562
|
+
|
|
563
|
+
| Benchmark | ruv-swarm | Claude 3.7 Sonnet | GPT-4 | Improvement |
|
|
564
|
+
|-----------|-----------|-------------------|-------|-------------|
|
|
565
|
+
| **SWE-Bench Solve Rate** | **84.8%** | 70.3% | 65.2% | **+14.5pp** |
|
|
566
|
+
| **Code Generation Speed** | **2.8x faster** | 1.0x | 1.2x | **180% faster** |
|
|
567
|
+
| **Token Efficiency** | **32.3% reduction** | 0% | 0% | **$3.2K saved/10K tasks** |
|
|
568
|
+
| **Multi-Agent Coordination** | **4.4x throughput** | N/A | N/A | **340% improvement** |
|
|
569
|
+
| **Memory Usage** | **29% less** | Baseline | N/A | **Optimized** |
|
|
570
|
+
|
|
571
|
+
### WASM Optimization Results
|
|
572
|
+
|
|
573
|
+
| Metric | Standard Build | Optimized Build | SIMD Build | Improvement |
|
|
574
|
+
|--------|----------------|------------------|------------|-------------|
|
|
575
|
+
| **Bundle Size** | 2.1MB | 1.6MB | 1.8MB | 24% smaller |
|
|
576
|
+
| **Load Time** | 150ms | 95ms | 110ms | 37% faster |
|
|
577
|
+
| **Task Throughput** | 1,200/sec | 2,100/sec | 3,800/sec | 217% faster |
|
|
578
|
+
| **Memory Usage** | 45MB | 32MB | 38MB | 29% less |
|
|
579
|
+
| **Agent Spawn Time** | 12ms | 7ms | 8ms | 42% faster |
|
|
580
|
+
|
|
581
|
+
### ๐ฏ Specialized Model Performance
|
|
582
|
+
|
|
583
|
+
| Model Type | Architecture | Accuracy | Speed | Use Case |
|
|
584
|
+
|------------|-------------|----------|-------|----------|
|
|
585
|
+
| **LSTM Coding Optimizer** | Bidirectional LSTM | 86.1% | 1.2x | Code generation & optimization |
|
|
586
|
+
| **TCN Pattern Detector** | Temporal Convolutional | 89.3% | 2.1x | Bug detection & analysis |
|
|
587
|
+
| **N-BEATS Decomposer** | Neural basis expansion | 91.7% | 1.8x | System architecture planning |
|
|
588
|
+
| **Swarm Coordinator** | Transformer-based | 88.4% | 3.2x | Multi-agent orchestration |
|
|
589
|
+
| **Claude Code Optimizer** | Ensemble hybrid | 84.8% | 2.8x | SWE-Bench problem solving |
|
|
590
|
+
|
|
591
|
+
### Performance Characteristics
|
|
592
|
+
|
|
593
|
+
```
|
|
594
|
+
Swarm Size vs Performance
|
|
595
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
596
|
+
โ Throughput โ
|
|
597
|
+
โ (tasks/sec) โ
|
|
598
|
+
โ โฒ โ
|
|
599
|
+
โ 4000โ โโโโ SIMD โ
|
|
600
|
+
โ 3500โ โโโโ โ
|
|
601
|
+
โ 3000โ โโโโ โ
|
|
602
|
+
โ 2500โ โโโโ โ
|
|
603
|
+
โ 2000โ โโโโ โโโโ Optimized โ
|
|
604
|
+
โ 1500โ โโโโ โโโโ โ
|
|
605
|
+
โ 1000โโโโโ โโโโ โ
|
|
606
|
+
โ 500โ โโโโ โกโกโกโก Standard โ
|
|
607
|
+
โ 0โโโโโโผโโโโโผโโโโโผโโโโโผโโโโโผโโโโโผโโโโโผโโโโโผโโโโโผโโโโโบ โ
|
|
608
|
+
โ 0 5 10 15 20 25 30 35 40 45 50 โ
|
|
609
|
+
โ Agent Count โ
|
|
610
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
### Benchmarking Suite
|
|
614
|
+
|
|
615
|
+
```bash
|
|
616
|
+
# Comprehensive benchmarks with SWE-Bench
|
|
617
|
+
npx ruv-swarm benchmark --full --include-swe-bench
|
|
618
|
+
|
|
619
|
+
# Specific performance tests
|
|
620
|
+
npx ruv-swarm benchmark --test agent-spawn
|
|
621
|
+
npx ruv-swarm benchmark --test task-throughput
|
|
622
|
+
npx ruv-swarm benchmark --test memory-usage
|
|
623
|
+
npx ruv-swarm benchmark --test wasm-performance
|
|
624
|
+
npx ruv-swarm benchmark --test swe-bench-solve-rate
|
|
625
|
+
|
|
626
|
+
# Model comparison
|
|
627
|
+
npx ruv-swarm benchmark --compare lstm,tcn,nbeats,claude-optimizer
|
|
628
|
+
|
|
629
|
+
# Cost analysis
|
|
630
|
+
npx ruv-swarm benchmark --test cost-efficiency --baseline claude-3.7-sonnet
|
|
631
|
+
|
|
632
|
+
# Custom benchmark
|
|
633
|
+
npx ruv-swarm benchmark --config ./custom-bench.json
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
### Real-world Performance
|
|
637
|
+
|
|
638
|
+
| Use Case | Agents | Tasks/Hour | Avg Response | Memory | Success Rate |
|
|
639
|
+
|----------|--------|------------|--------------|--------|-------------|
|
|
640
|
+
| **SWE-Bench Challenges** | 5 | 156 | 12.3s | 512MB | **84.8%** |
|
|
641
|
+
| **Code Review** | 5 | 240 | 2.3s | 128MB | **96.2%** |
|
|
642
|
+
| **Research Project** | 12 | 180 | 8.7s | 256MB | **91.5%** |
|
|
643
|
+
| **Data Analysis** | 8 | 320 | 1.9s | 192MB | **94.3%** |
|
|
644
|
+
| **Documentation** | 3 | 450 | 1.1s | 96MB | **98.7%** |
|
|
645
|
+
| **Testing Suite** | 15 | 520 | 0.8s | 384MB | **93.1%** |
|
|
646
|
+
|
|
647
|
+
### ๐ Benchmarking Commands
|
|
648
|
+
|
|
649
|
+
```bash
|
|
650
|
+
# Run SWE-Bench evaluation
|
|
651
|
+
npx ruv-swarm benchmark --test swe-bench --instances 100
|
|
652
|
+
|
|
653
|
+
# Performance comparison
|
|
654
|
+
npx ruv-swarm benchmark --compare-with claude-3.7-sonnet
|
|
655
|
+
|
|
656
|
+
# Token efficiency analysis
|
|
657
|
+
npx ruv-swarm benchmark --test token-efficiency --tasks 1000
|
|
658
|
+
|
|
659
|
+
# Multi-agent coordination test
|
|
660
|
+
npx ruv-swarm benchmark --test coordination --agents 5-50
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
---
|
|
664
|
+
|
|
665
|
+
## ๐ Advanced Features
|
|
666
|
+
|
|
667
|
+
### Cognitive Load Balancing
|
|
668
|
+
|
|
669
|
+
```typescript
|
|
670
|
+
// Dynamic cognitive load distribution
|
|
671
|
+
const swarm = await RuvSwarm.initialize({
|
|
672
|
+
loadBalancing: {
|
|
673
|
+
strategy: 'cognitive_diversity',
|
|
674
|
+
factors: ['analytical_load', 'creative_demand', 'collaboration_need'],
|
|
675
|
+
rebalanceInterval: 30000 // 30 seconds
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
// Monitor cognitive load
|
|
680
|
+
swarm.on('cognitive:overload', (agent) => {
|
|
681
|
+
console.log(`Agent ${agent.id} experiencing cognitive overload`);
|
|
682
|
+
swarm.redistributeTasks(agent.id);
|
|
683
|
+
});
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
### Adaptive Topology
|
|
687
|
+
|
|
688
|
+
```typescript
|
|
689
|
+
// Self-organizing network topology
|
|
690
|
+
const adaptiveSwarm = await RuvSwarm.initialize({
|
|
691
|
+
topology: 'adaptive',
|
|
692
|
+
adaptationRules: {
|
|
693
|
+
performanceThreshold: 0.85,
|
|
694
|
+
reorganizeOnBottleneck: true,
|
|
695
|
+
optimizeForCommunication: true
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
// Topology evolution
|
|
700
|
+
adaptiveSwarm.on('topology:evolved', (changes) => {
|
|
701
|
+
console.log('Network topology adapted:', changes);
|
|
702
|
+
});
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
### Memory Persistence
|
|
706
|
+
|
|
707
|
+
```typescript
|
|
708
|
+
// Cross-session memory continuity
|
|
709
|
+
const persistentSwarm = await RuvSwarm.initialize({
|
|
710
|
+
persistence: {
|
|
711
|
+
backend: 'sqlite',
|
|
712
|
+
path: './swarm-memory.db',
|
|
713
|
+
features: ['episodic_memory', 'skill_learning', 'relationship_tracking']
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
// Access persistent memory
|
|
718
|
+
const previousExperience = await persistentSwarm.memory.recall({
|
|
719
|
+
context: 'similar_project',
|
|
720
|
+
timeframe: '30_days',
|
|
721
|
+
relevanceThreshold: 0.7
|
|
722
|
+
});
|
|
723
|
+
```
|
|
724
|
+
|
|
725
|
+
### Auto-scaling
|
|
726
|
+
|
|
727
|
+
```typescript
|
|
728
|
+
// Dynamic agent scaling
|
|
729
|
+
const scalableSwarm = await RuvSwarm.initialize({
|
|
730
|
+
scaling: {
|
|
731
|
+
minAgents: 3,
|
|
732
|
+
maxAgents: 50,
|
|
733
|
+
scaleUpThreshold: 0.8, // CPU utilization
|
|
734
|
+
scaleDownThreshold: 0.3,
|
|
735
|
+
cooldownPeriod: 60000 // 1 minute
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
### ๐ช Claude Code Hooks System
|
|
741
|
+
|
|
742
|
+
ruv-swarm provides comprehensive hooks for Claude Code operations:
|
|
743
|
+
|
|
744
|
+
```javascript
|
|
745
|
+
// Pre-operation hooks
|
|
746
|
+
await swarm.hook('pre-edit', { file: 'src/app.js' });
|
|
747
|
+
await swarm.hook('pre-task', { description: 'Build authentication system' });
|
|
748
|
+
await swarm.hook('pre-search', { pattern: '*.test.js' });
|
|
749
|
+
|
|
750
|
+
// Post-operation hooks with performance analysis
|
|
751
|
+
await swarm.hook('post-edit', {
|
|
752
|
+
file: 'src/app.js',
|
|
753
|
+
memoryKey: 'edit-history/app-js'
|
|
754
|
+
});
|
|
755
|
+
|
|
756
|
+
await swarm.hook('post-task', {
|
|
757
|
+
taskId: 'auth-system',
|
|
758
|
+
analyzePerformance: true,
|
|
759
|
+
generateReport: true
|
|
760
|
+
});
|
|
761
|
+
|
|
762
|
+
// Git integration hooks
|
|
763
|
+
await swarm.hook('agent-complete', {
|
|
764
|
+
agent: 'coder-123',
|
|
765
|
+
commitToGit: true,
|
|
766
|
+
generateReport: true
|
|
767
|
+
});
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
### ๐ Git Integration
|
|
771
|
+
|
|
772
|
+
Automatic Git commits with detailed agent reports:
|
|
773
|
+
|
|
774
|
+
```bash
|
|
775
|
+
# Enable Git integration
|
|
776
|
+
export RUV_SWARM_AUTO_COMMIT=true
|
|
777
|
+
export RUV_SWARM_GENERATE_REPORTS=true
|
|
778
|
+
|
|
779
|
+
# Agent work is automatically committed
|
|
780
|
+
npx ruv-swarm orchestrate "Implement user authentication"
|
|
781
|
+
# Creates commit: "feat(auth): Implement user authentication system"
|
|
782
|
+
# Includes: Performance metrics, agent decisions, code changes
|
|
783
|
+
```
|
|
784
|
+
|
|
785
|
+
**Hook Configuration** in `.claude/settings.json`:
|
|
786
|
+
|
|
787
|
+
```json
|
|
788
|
+
{
|
|
789
|
+
"hooks": {
|
|
790
|
+
"PostToolUse": [{
|
|
791
|
+
"condition": "${tool.result.success}",
|
|
792
|
+
"hooks": [{
|
|
793
|
+
"type": "command",
|
|
794
|
+
"command": "npx ruv-swarm hook agent-complete --agent '${tool.params.description}' --commit-to-git true"
|
|
795
|
+
}]
|
|
796
|
+
}]
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
```
|
|
800
|
+
|
|
801
|
+
---
|
|
802
|
+
|
|
803
|
+
## ๐ API Reference
|
|
804
|
+
|
|
805
|
+
### Core Classes
|
|
806
|
+
|
|
807
|
+
#### RuvSwarm
|
|
808
|
+
|
|
809
|
+
```typescript
|
|
810
|
+
class RuvSwarm {
|
|
811
|
+
// Static methods
|
|
812
|
+
static initialize(config?: SwarmConfig): Promise<RuvSwarm>;
|
|
813
|
+
static detectSIMDSupport(): boolean;
|
|
814
|
+
static getRuntimeFeatures(): RuntimeFeatures;
|
|
815
|
+
static getVersion(): VersionInfo;
|
|
816
|
+
static benchmarkSystem(): Promise<BenchmarkResults>;
|
|
817
|
+
|
|
818
|
+
// Instance methods
|
|
819
|
+
spawn(config: AgentConfig): Promise<Agent>;
|
|
820
|
+
orchestrate(workflow: WorkflowConfig): Promise<OrchestrationResult>;
|
|
821
|
+
createCluster(name: string, config: ClusterConfig): Promise<Cluster>;
|
|
822
|
+
getAgents(): Agent[];
|
|
823
|
+
getTopology(): TopologyInfo;
|
|
824
|
+
getMetrics(): SwarmMetrics;
|
|
825
|
+
query(selector: AgentSelector): Agent[];
|
|
826
|
+
on(event: SwarmEvent, handler: EventHandler): void;
|
|
827
|
+
destroy(): Promise<void>;
|
|
828
|
+
}
|
|
829
|
+
```
|
|
830
|
+
|
|
831
|
+
#### Agent
|
|
832
|
+
|
|
833
|
+
```typescript
|
|
834
|
+
class Agent {
|
|
835
|
+
readonly id: string;
|
|
836
|
+
readonly type: AgentType;
|
|
837
|
+
readonly cognitiveProfile: CognitiveProfile;
|
|
838
|
+
readonly capabilities: string[];
|
|
839
|
+
|
|
840
|
+
// Execution methods
|
|
841
|
+
execute(task: Task): Promise<TaskResult>;
|
|
842
|
+
collaborate(agents: Agent[], objective: string): Promise<CollaborationResult>;
|
|
843
|
+
learn(experience: Experience): Promise<void>;
|
|
844
|
+
|
|
845
|
+
// State management
|
|
846
|
+
getState(): AgentState;
|
|
847
|
+
getMetrics(): AgentMetrics;
|
|
848
|
+
getMemory(): AgentMemory;
|
|
849
|
+
updateCapabilities(capabilities: string[]): void;
|
|
850
|
+
|
|
851
|
+
// Communication
|
|
852
|
+
sendMessage(to: Agent, message: Message): Promise<void>;
|
|
853
|
+
broadcast(message: Message): Promise<void>;
|
|
854
|
+
subscribe(topic: string, handler: MessageHandler): void;
|
|
855
|
+
}
|
|
856
|
+
```
|
|
857
|
+
|
|
858
|
+
#### Cluster
|
|
859
|
+
|
|
860
|
+
```typescript
|
|
861
|
+
class Cluster {
|
|
862
|
+
readonly name: string;
|
|
863
|
+
readonly leader: Agent;
|
|
864
|
+
readonly members: Agent[];
|
|
865
|
+
|
|
866
|
+
addMember(agent: Agent): Promise<void>;
|
|
867
|
+
removeMember(agentId: string): Promise<void>;
|
|
868
|
+
executeTask(task: ClusterTask): Promise<ClusterResult>;
|
|
869
|
+
getPerformanceMetrics(): ClusterMetrics;
|
|
870
|
+
reorganize(strategy: ReorganizationStrategy): Promise<void>;
|
|
871
|
+
}
|
|
872
|
+
```
|
|
873
|
+
|
|
874
|
+
### Configuration Interfaces
|
|
875
|
+
|
|
876
|
+
```typescript
|
|
877
|
+
interface SwarmConfig {
|
|
878
|
+
topology?: TopologyType;
|
|
879
|
+
maxAgents?: number;
|
|
880
|
+
cognitiveProfiles?: boolean;
|
|
881
|
+
persistence?: PersistenceConfig;
|
|
882
|
+
monitoring?: MonitoringConfig;
|
|
883
|
+
scaling?: ScalingConfig;
|
|
884
|
+
features?: FeatureFlag[];
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
interface AgentConfig {
|
|
888
|
+
type: AgentType;
|
|
889
|
+
name?: string;
|
|
890
|
+
cognitiveProfile?: CognitiveProfile;
|
|
891
|
+
capabilities?: string[];
|
|
892
|
+
specialization?: string;
|
|
893
|
+
memory?: MemoryConfig;
|
|
894
|
+
constraints?: AgentConstraints;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
interface WorkflowConfig {
|
|
898
|
+
objective: string;
|
|
899
|
+
strategy: OrchestrationStrategy;
|
|
900
|
+
agents?: Agent[];
|
|
901
|
+
phases?: WorkflowPhase[];
|
|
902
|
+
constraints?: WorkflowConstraints;
|
|
903
|
+
timeout?: number;
|
|
904
|
+
}
|
|
905
|
+
```
|
|
906
|
+
|
|
907
|
+
---
|
|
908
|
+
|
|
909
|
+
## ๐ผ Enterprise Features
|
|
910
|
+
|
|
911
|
+
### High Availability
|
|
912
|
+
|
|
913
|
+
```typescript
|
|
914
|
+
// Multi-region deployment
|
|
915
|
+
const haSwarm = await RuvSwarm.initialize({
|
|
916
|
+
deployment: {
|
|
917
|
+
mode: 'distributed',
|
|
918
|
+
regions: ['us-east-1', 'eu-west-1', 'ap-southeast-1'],
|
|
919
|
+
replication: 'automatic',
|
|
920
|
+
failover: 'active-passive'
|
|
921
|
+
}
|
|
922
|
+
});
|
|
923
|
+
```
|
|
924
|
+
|
|
925
|
+
### Security & Compliance
|
|
926
|
+
|
|
927
|
+
```typescript
|
|
928
|
+
// Enterprise security configuration
|
|
929
|
+
const secureSwarm = await RuvSwarm.initialize({
|
|
930
|
+
security: {
|
|
931
|
+
encryption: 'aes-256-gcm',
|
|
932
|
+
authentication: 'oauth2',
|
|
933
|
+
authorization: 'rbac',
|
|
934
|
+
auditLogging: true,
|
|
935
|
+
dataClassification: 'confidential'
|
|
936
|
+
},
|
|
937
|
+
compliance: {
|
|
938
|
+
frameworks: ['sox', 'gdpr', 'hipaa'],
|
|
939
|
+
dataRetention: '7years',
|
|
940
|
+
rightToBeDeleted: true
|
|
941
|
+
}
|
|
942
|
+
});
|
|
943
|
+
```
|
|
944
|
+
|
|
945
|
+
### Analytics & Insights
|
|
946
|
+
|
|
947
|
+
```typescript
|
|
948
|
+
// Advanced analytics
|
|
949
|
+
const analyticsSwarm = await RuvSwarm.initialize({
|
|
950
|
+
analytics: {
|
|
951
|
+
realTimeMetrics: true,
|
|
952
|
+
predictiveAnalytics: true,
|
|
953
|
+
anomalyDetection: true,
|
|
954
|
+
customDashboards: true,
|
|
955
|
+
exportFormats: ['prometheus', 'grafana', 'datadog']
|
|
956
|
+
}
|
|
957
|
+
});
|
|
958
|
+
|
|
959
|
+
// Custom metrics
|
|
960
|
+
analyticsSwarm.metrics.track('custom_business_metric', {
|
|
961
|
+
value: 42,
|
|
962
|
+
tags: { team: 'ai-research', project: 'nas-optimization' }
|
|
963
|
+
});
|
|
964
|
+
```
|
|
965
|
+
|
|
966
|
+
---
|
|
967
|
+
|
|
968
|
+
## ๐ ๏ธ Development
|
|
969
|
+
|
|
970
|
+
### Building from Source
|
|
971
|
+
|
|
972
|
+
```bash
|
|
973
|
+
# Clone repository
|
|
974
|
+
git clone https://github.com/ruvnet/ruv-FANN.git
|
|
975
|
+
cd ruv-FANN/ruv-swarm
|
|
976
|
+
|
|
977
|
+
# Install Rust toolchain
|
|
978
|
+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
979
|
+
rustup target add wasm32-unknown-unknown
|
|
980
|
+
|
|
981
|
+
# Install wasm-pack
|
|
982
|
+
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
983
|
+
|
|
984
|
+
# Build all components
|
|
985
|
+
npm run build:all
|
|
986
|
+
|
|
987
|
+
# Run tests
|
|
988
|
+
cargo test --all
|
|
989
|
+
npm test
|
|
990
|
+
```
|
|
991
|
+
|
|
992
|
+
### Development Commands
|
|
993
|
+
|
|
994
|
+
```bash
|
|
995
|
+
# Watch mode for development
|
|
996
|
+
npm run dev
|
|
997
|
+
|
|
998
|
+
# Build specific targets
|
|
999
|
+
npm run build:wasm # Standard WASM
|
|
1000
|
+
npm run build:wasm-simd # SIMD optimized
|
|
1001
|
+
npm run build:wasm-opt # Size optimized
|
|
1002
|
+
|
|
1003
|
+
# Linting and formatting
|
|
1004
|
+
cargo clippy --all-targets --all-features
|
|
1005
|
+
cargo fmt --all
|
|
1006
|
+
|
|
1007
|
+
# Documentation
|
|
1008
|
+
cargo doc --open
|
|
1009
|
+
npm run docs
|
|
1010
|
+
```
|
|
1011
|
+
|
|
1012
|
+
### Testing Strategy
|
|
1013
|
+
|
|
1014
|
+
```bash
|
|
1015
|
+
# Unit tests
|
|
1016
|
+
cargo test -p ruv-swarm-core
|
|
1017
|
+
cargo test -p ruv-swarm-agents
|
|
1018
|
+
|
|
1019
|
+
# Integration tests
|
|
1020
|
+
cargo test --test integration
|
|
1021
|
+
|
|
1022
|
+
# Performance benchmarks
|
|
1023
|
+
cargo bench
|
|
1024
|
+
|
|
1025
|
+
# WASM tests
|
|
1026
|
+
npm run test:wasm
|
|
1027
|
+
|
|
1028
|
+
# Browser tests
|
|
1029
|
+
npm run test:browser
|
|
1030
|
+
|
|
1031
|
+
# End-to-end tests
|
|
1032
|
+
npm run test:e2e
|
|
1033
|
+
```
|
|
1034
|
+
|
|
1035
|
+
### Contributing Guidelines
|
|
1036
|
+
|
|
1037
|
+
1. **Fork & Clone**: Fork the repository and clone your fork
|
|
1038
|
+
2. **Branch**: Create feature branches from `main`
|
|
1039
|
+
3. **Code**: Follow Rust and TypeScript style guidelines
|
|
1040
|
+
4. **Test**: Ensure all tests pass and add new tests for features
|
|
1041
|
+
5. **Document**: Update documentation for API changes
|
|
1042
|
+
6. **PR**: Submit pull request with clear description
|
|
1043
|
+
|
|
1044
|
+
---
|
|
1045
|
+
|
|
1046
|
+
## ๐ Examples & Use Cases
|
|
1047
|
+
|
|
1048
|
+
### ๐ฌ Research & Analysis
|
|
1049
|
+
|
|
1050
|
+
```typescript
|
|
1051
|
+
// Academic research assistant
|
|
1052
|
+
const researchSwarm = await RuvSwarm.initialize({
|
|
1053
|
+
topology: 'hierarchical',
|
|
1054
|
+
specialization: 'academic_research'
|
|
1055
|
+
});
|
|
1056
|
+
|
|
1057
|
+
const literature_reviewer = await researchSwarm.spawn({
|
|
1058
|
+
type: 'researcher',
|
|
1059
|
+
specialization: 'literature_review',
|
|
1060
|
+
capabilities: ['arxiv_search', 'citation_analysis', 'trend_detection']
|
|
1061
|
+
});
|
|
1062
|
+
|
|
1063
|
+
const data_analyst = await researchSwarm.spawn({
|
|
1064
|
+
type: 'analyst',
|
|
1065
|
+
specialization: 'statistical_analysis',
|
|
1066
|
+
capabilities: ['regression_analysis', 'hypothesis_testing', 'visualization']
|
|
1067
|
+
});
|
|
1068
|
+
|
|
1069
|
+
const result = await researchSwarm.orchestrate({
|
|
1070
|
+
objective: "Conduct comprehensive analysis of transformer architecture evolution",
|
|
1071
|
+
methodology: "systematic_review",
|
|
1072
|
+
deliverables: ['literature_matrix', 'trend_analysis', 'gap_identification']
|
|
1073
|
+
});
|
|
1074
|
+
```
|
|
1075
|
+
|
|
1076
|
+
### ๐ป Software Development
|
|
1077
|
+
|
|
1078
|
+
```typescript
|
|
1079
|
+
// Full-stack development team
|
|
1080
|
+
const devSwarm = await RuvSwarm.initialize({
|
|
1081
|
+
topology: 'agile_team',
|
|
1082
|
+
methodology: 'scrum'
|
|
1083
|
+
});
|
|
1084
|
+
|
|
1085
|
+
const architect = await devSwarm.spawn({
|
|
1086
|
+
type: 'architect',
|
|
1087
|
+
experience: 'senior',
|
|
1088
|
+
specializations: ['system_design', 'scalability', 'security']
|
|
1089
|
+
});
|
|
1090
|
+
|
|
1091
|
+
const frontend_dev = await devSwarm.spawn({
|
|
1092
|
+
type: 'coder',
|
|
1093
|
+
specialization: 'frontend',
|
|
1094
|
+
technologies: ['react', 'typescript', 'nextjs']
|
|
1095
|
+
});
|
|
1096
|
+
|
|
1097
|
+
const backend_dev = await devSwarm.spawn({
|
|
1098
|
+
type: 'coder',
|
|
1099
|
+
specialization: 'backend',
|
|
1100
|
+
technologies: ['rust', 'postgresql', 'docker']
|
|
1101
|
+
});
|
|
1102
|
+
|
|
1103
|
+
const qa_engineer = await devSwarm.spawn({
|
|
1104
|
+
type: 'tester',
|
|
1105
|
+
specialization: 'automation',
|
|
1106
|
+
frameworks: ['cypress', 'jest', 'playwright']
|
|
1107
|
+
});
|
|
1108
|
+
|
|
1109
|
+
// Execute sprint
|
|
1110
|
+
const sprint = await devSwarm.orchestrate({
|
|
1111
|
+
objective: "Implement user authentication system",
|
|
1112
|
+
timeline: "2_weeks",
|
|
1113
|
+
methodology: "test_driven_development",
|
|
1114
|
+
phases: ['planning', 'development', 'testing', 'review']
|
|
1115
|
+
});
|
|
1116
|
+
```
|
|
1117
|
+
|
|
1118
|
+
### ๐ Business Intelligence
|
|
1119
|
+
|
|
1120
|
+
```typescript
|
|
1121
|
+
// BI and analytics team
|
|
1122
|
+
const biSwarm = await RuvSwarm.initialize({
|
|
1123
|
+
topology: 'data_pipeline',
|
|
1124
|
+
focus: 'business_intelligence'
|
|
1125
|
+
});
|
|
1126
|
+
|
|
1127
|
+
const data_collector = await biSwarm.spawn({
|
|
1128
|
+
type: 'researcher',
|
|
1129
|
+
specialization: 'data_collection',
|
|
1130
|
+
sources: ['crm', 'web_analytics', 'sales_data', 'market_research']
|
|
1131
|
+
});
|
|
1132
|
+
|
|
1133
|
+
const data_processor = await biSwarm.spawn({
|
|
1134
|
+
type: 'analyst',
|
|
1135
|
+
specialization: 'data_engineering',
|
|
1136
|
+
capabilities: ['etl', 'data_cleaning', 'feature_engineering']
|
|
1137
|
+
});
|
|
1138
|
+
|
|
1139
|
+
const insight_generator = await biSwarm.spawn({
|
|
1140
|
+
type: 'analyst',
|
|
1141
|
+
specialization: 'business_analysis',
|
|
1142
|
+
capabilities: ['kpi_analysis', 'trend_identification', 'forecasting']
|
|
1143
|
+
});
|
|
1144
|
+
|
|
1145
|
+
const report_generator = await biSwarm.spawn({
|
|
1146
|
+
type: 'documenter',
|
|
1147
|
+
specialization: 'executive_reporting',
|
|
1148
|
+
formats: ['dashboard', 'presentation', 'detailed_report']
|
|
1149
|
+
});
|
|
1150
|
+
|
|
1151
|
+
// Generate monthly business intelligence report
|
|
1152
|
+
const biReport = await biSwarm.orchestrate({
|
|
1153
|
+
objective: "Generate comprehensive monthly BI report",
|
|
1154
|
+
dataRange: "last_30_days",
|
|
1155
|
+
stakeholders: ["executives", "department_heads", "analysts"],
|
|
1156
|
+
deliverables: ["executive_summary", "detailed_analysis", "recommendations"]
|
|
1157
|
+
});
|
|
1158
|
+
```
|
|
1159
|
+
|
|
1160
|
+
### ๐ Educational Content Creation
|
|
1161
|
+
|
|
1162
|
+
```typescript
|
|
1163
|
+
// Educational content development
|
|
1164
|
+
const eduSwarm = await RuvSwarm.initialize({
|
|
1165
|
+
topology: 'content_creation',
|
|
1166
|
+
focus: 'educational_materials'
|
|
1167
|
+
});
|
|
1168
|
+
|
|
1169
|
+
const subject_expert = await eduSwarm.spawn({
|
|
1170
|
+
type: 'researcher',
|
|
1171
|
+
specialization: 'domain_expertise',
|
|
1172
|
+
subject: 'machine_learning'
|
|
1173
|
+
});
|
|
1174
|
+
|
|
1175
|
+
const instructional_designer = await eduSwarm.spawn({
|
|
1176
|
+
type: 'architect',
|
|
1177
|
+
specialization: 'curriculum_design',
|
|
1178
|
+
methodologies: ['constructivist', 'experiential', 'project_based']
|
|
1179
|
+
});
|
|
1180
|
+
|
|
1181
|
+
const content_creator = await eduSwarm.spawn({
|
|
1182
|
+
type: 'documenter',
|
|
1183
|
+
specialization: 'educational_content',
|
|
1184
|
+
formats: ['tutorials', 'exercises', 'assessments', 'multimedia']
|
|
1185
|
+
});
|
|
1186
|
+
|
|
1187
|
+
const reviewer = await eduSwarm.spawn({
|
|
1188
|
+
type: 'reviewer',
|
|
1189
|
+
specialization: 'educational_quality',
|
|
1190
|
+
criteria: ['accuracy', 'clarity', 'engagement', 'accessibility']
|
|
1191
|
+
});
|
|
1192
|
+
|
|
1193
|
+
// Create comprehensive course
|
|
1194
|
+
const course = await eduSwarm.orchestrate({
|
|
1195
|
+
objective: "Create comprehensive neural networks course",
|
|
1196
|
+
target_audience: "intermediate_programmers",
|
|
1197
|
+
duration: "12_weeks",
|
|
1198
|
+
learning_outcomes: [
|
|
1199
|
+
"Understand neural network fundamentals",
|
|
1200
|
+
"Implement networks from scratch",
|
|
1201
|
+
"Apply to real-world problems"
|
|
1202
|
+
]
|
|
1203
|
+
});
|
|
1204
|
+
```
|
|
1205
|
+
|
|
1206
|
+
---
|
|
1207
|
+
|
|
1208
|
+
## ๐ฆ CLI Command Reference
|
|
1209
|
+
|
|
1210
|
+
### Core Commands
|
|
1211
|
+
|
|
1212
|
+
| Command | Description | Example |
|
|
1213
|
+
|---------|-------------|---------|
|
|
1214
|
+
| `init <topology> [max-agents]` | Initialize swarm | `npx ruv-swarm init mesh 10` |
|
|
1215
|
+
| `spawn <type> [name]` | Create agent | `npx ruv-swarm spawn researcher "AI Researcher"` |
|
|
1216
|
+
| `orchestrate <task>` | Execute task | `npx ruv-swarm orchestrate "Build REST API"` |
|
|
1217
|
+
| `status` | Show swarm state | `npx ruv-swarm status` |
|
|
1218
|
+
| `monitor` | Real-time monitoring | `npx ruv-swarm monitor` |
|
|
1219
|
+
|
|
1220
|
+
### Advanced Commands
|
|
1221
|
+
|
|
1222
|
+
| Command | Description | Example |
|
|
1223
|
+
|---------|-------------|---------|
|
|
1224
|
+
| `cluster create <name>` | Create agent cluster | `npx ruv-swarm cluster create research-team` |
|
|
1225
|
+
| `workflow run <file>` | Execute workflow | `npx ruv-swarm workflow run ./ai-project.yml` |
|
|
1226
|
+
| `memory store <key> <data>` | Store persistent data | `npx ruv-swarm memory store project-spec "API requirements..."` |
|
|
1227
|
+
| `benchmark [test]` | Run performance tests | `npx ruv-swarm benchmark --test throughput` |
|
|
1228
|
+
| `export <format> <file>` | Export swarm data | `npx ruv-swarm export json ./swarm-state.json` |
|
|
1229
|
+
|
|
1230
|
+
### MCP Commands
|
|
1231
|
+
|
|
1232
|
+
| Command | Description | Example |
|
|
1233
|
+
|---------|-------------|---------|
|
|
1234
|
+
| `mcp start [--port]` | Start MCP server | `npx ruv-swarm mcp start --port 3000` |
|
|
1235
|
+
| `mcp status` | Check MCP server | `npx ruv-swarm mcp status` |
|
|
1236
|
+
| `mcp tools` | List MCP tools | `npx ruv-swarm mcp tools` |
|
|
1237
|
+
|
|
1238
|
+
---
|
|
1239
|
+
|
|
1240
|
+
## ๐ง Configuration
|
|
1241
|
+
|
|
1242
|
+
### Environment Variables
|
|
1243
|
+
|
|
1244
|
+
```bash
|
|
1245
|
+
# Core configuration
|
|
1246
|
+
export RUVA_SWARM_MAX_AGENTS=50
|
|
1247
|
+
export RUVA_SWARM_TOPOLOGY=mesh
|
|
1248
|
+
export RUVA_SWARM_PERSISTENCE=sqlite
|
|
1249
|
+
|
|
1250
|
+
# Performance tuning
|
|
1251
|
+
export RUVA_SWARM_WASM_SIMD=true
|
|
1252
|
+
export RUVA_SWARM_MEMORY_POOL=256MB
|
|
1253
|
+
export RUVA_SWARM_WORKER_THREADS=4
|
|
1254
|
+
|
|
1255
|
+
# MCP server
|
|
1256
|
+
export RUVA_SWARM_MCP_PORT=3000
|
|
1257
|
+
export RUVA_SWARM_MCP_HOST=localhost
|
|
1258
|
+
|
|
1259
|
+
# Logging
|
|
1260
|
+
export RUST_LOG=info
|
|
1261
|
+
export RUVA_SWARM_LOG_LEVEL=info
|
|
1262
|
+
```
|
|
1263
|
+
|
|
1264
|
+
### Configuration Files
|
|
1265
|
+
|
|
1266
|
+
Create `ruv-swarm.config.json`:
|
|
1267
|
+
|
|
1268
|
+
```json
|
|
1269
|
+
{
|
|
1270
|
+
"swarm": {
|
|
1271
|
+
"topology": "hierarchical",
|
|
1272
|
+
"maxAgents": 25,
|
|
1273
|
+
"cognitiveProfiles": true,
|
|
1274
|
+
"autoScaling": {
|
|
1275
|
+
"enabled": true,
|
|
1276
|
+
"minAgents": 3,
|
|
1277
|
+
"maxAgents": 50,
|
|
1278
|
+
"targetUtilization": 0.75
|
|
1279
|
+
}
|
|
1280
|
+
},
|
|
1281
|
+
"persistence": {
|
|
1282
|
+
"backend": "sqlite",
|
|
1283
|
+
"path": "./swarm-memory.db",
|
|
1284
|
+
"features": ["episodic_memory", "skill_learning"]
|
|
1285
|
+
},
|
|
1286
|
+
"monitoring": {
|
|
1287
|
+
"realTime": true,
|
|
1288
|
+
"metrics": ["performance", "cognitive_load", "collaboration"],
|
|
1289
|
+
"dashboard": {
|
|
1290
|
+
"enabled": true,
|
|
1291
|
+
"port": 8080
|
|
1292
|
+
}
|
|
1293
|
+
},
|
|
1294
|
+
"security": {
|
|
1295
|
+
"encryption": true,
|
|
1296
|
+
"authentication": "oauth2",
|
|
1297
|
+
"auditLogging": true
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
```
|
|
1301
|
+
|
|
1302
|
+
---
|
|
1303
|
+
|
|
1304
|
+
## ๐ Remote Server Deployment
|
|
1305
|
+
|
|
1306
|
+
### โ
NPX Compatibility
|
|
1307
|
+
|
|
1308
|
+
ruv-swarm is **fully compatible with remote servers** using npx:
|
|
1309
|
+
|
|
1310
|
+
```bash
|
|
1311
|
+
# โ
Works on any remote server with Node.js 14+
|
|
1312
|
+
ssh user@remote-server 'npx ruv-swarm init mesh 10'
|
|
1313
|
+
|
|
1314
|
+
# โ
Start MCP server remotely
|
|
1315
|
+
ssh user@remote-server 'npx ruv-swarm mcp start --port 3000 &'
|
|
1316
|
+
|
|
1317
|
+
# โ
Run benchmarks on remote hardware
|
|
1318
|
+
ssh user@remote-server 'npx ruv-swarm benchmark --test swe-bench'
|
|
1319
|
+
|
|
1320
|
+
# โ
Deploy with screen/tmux for persistence
|
|
1321
|
+
ssh user@remote-server 'screen -S ruv-swarm -d -m npx ruv-swarm mcp start'
|
|
1322
|
+
```
|
|
1323
|
+
|
|
1324
|
+
### ๐ Production Deployment
|
|
1325
|
+
|
|
1326
|
+
```bash
|
|
1327
|
+
# Docker deployment (recommended)
|
|
1328
|
+
docker run -d -p 3000:3000 --name ruv-swarm \
|
|
1329
|
+
-e NODE_ENV=production \
|
|
1330
|
+
-e RUVA_SWARM_MAX_AGENTS=50 \
|
|
1331
|
+
node:18-alpine \
|
|
1332
|
+
npx ruv-swarm mcp start --port 3000
|
|
1333
|
+
|
|
1334
|
+
# Kubernetes deployment
|
|
1335
|
+
kubectl run ruv-swarm --image=node:18-alpine \
|
|
1336
|
+
--port=3000 \
|
|
1337
|
+
--command -- npx ruv-swarm mcp start --port 3000
|
|
1338
|
+
|
|
1339
|
+
# PM2 process management
|
|
1340
|
+
pm2 start 'npx ruv-swarm mcp start --port 3000' --name ruv-swarm
|
|
1341
|
+
```
|
|
1342
|
+
|
|
1343
|
+
### ๐ง System Requirements
|
|
1344
|
+
|
|
1345
|
+
| Requirement | Minimum | Recommended |
|
|
1346
|
+
|-------------|---------|-------------|
|
|
1347
|
+
| **Node.js** | 14.0+ | 18.0+ |
|
|
1348
|
+
| **Memory** | 512MB | 2GB+ |
|
|
1349
|
+
| **CPU** | 1 core | 2+ cores |
|
|
1350
|
+
| **Network** | 1Mbps | 10Mbps+ |
|
|
1351
|
+
| **Storage** | 100MB | 500MB+ |
|
|
1352
|
+
|
|
1353
|
+
### ๐ Cloud Platform Support
|
|
1354
|
+
|
|
1355
|
+
- โ
**AWS EC2/Lambda**: Fully supported
|
|
1356
|
+
- โ
**Google Cloud Run/Compute**: Fully supported
|
|
1357
|
+
- โ
**Azure Container Instances**: Fully supported
|
|
1358
|
+
- โ
**Heroku**: Fully supported
|
|
1359
|
+
- โ
**DigitalOcean Droplets**: Fully supported
|
|
1360
|
+
- โ
**Vercel/Netlify**: Functions supported
|
|
1361
|
+
|
|
1362
|
+
---
|
|
1363
|
+
|
|
1364
|
+
## ๐ Troubleshooting
|
|
1365
|
+
|
|
1366
|
+
### Common Issues
|
|
1367
|
+
|
|
1368
|
+
**WASM Module Not Loading**
|
|
1369
|
+
```bash
|
|
1370
|
+
# Verify WASM support on remote server
|
|
1371
|
+
npx ruv-swarm --version # Should show version without errors
|
|
1372
|
+
npx ruv-swarm features # Lists available features
|
|
1373
|
+
|
|
1374
|
+
# If you see "Invalid or unexpected token" error (v1.0.5 bug - fixed in v1.0.6)
|
|
1375
|
+
npm update ruv-swarm@latest # Update to v1.0.6+
|
|
1376
|
+
|
|
1377
|
+
# Force clean reinstall
|
|
1378
|
+
npm cache clean --force
|
|
1379
|
+
npm uninstall -g ruv-swarm
|
|
1380
|
+
npm install -g ruv-swarm@latest
|
|
1381
|
+
|
|
1382
|
+
# Verify Node.js version
|
|
1383
|
+
node --version # Should be 14.0+ (v18+ recommended)
|
|
1384
|
+
|
|
1385
|
+
# Check WASM files are present
|
|
1386
|
+
ls node_modules/ruv-swarm/wasm/ # Should contain .wasm files
|
|
1387
|
+
```
|
|
1388
|
+
|
|
1389
|
+
**NPX Execution Errors (Fixed in v1.0.6)**
|
|
1390
|
+
```bash
|
|
1391
|
+
# If you encounter syntax errors with v1.0.5:
|
|
1392
|
+
# Update to v1.0.6 which fixes the wasm-loader.js syntax issues
|
|
1393
|
+
npm install ruv-swarm@latest
|
|
1394
|
+
|
|
1395
|
+
# For global installations
|
|
1396
|
+
npm install -g ruv-swarm@latest
|
|
1397
|
+
```
|
|
1398
|
+
|
|
1399
|
+
**Remote Server Connection Issues**
|
|
1400
|
+
```bash
|
|
1401
|
+
# Check port accessibility
|
|
1402
|
+
npx ruv-swarm mcp start --port 3000 --host 0.0.0.0
|
|
1403
|
+
|
|
1404
|
+
# Test with curl
|
|
1405
|
+
curl http://your-server:3000/health
|
|
1406
|
+
|
|
1407
|
+
# Enable debug logging
|
|
1408
|
+
NODE_ENV=development npx ruv-swarm mcp start --verbose
|
|
1409
|
+
```
|
|
1410
|
+
|
|
1411
|
+
**Agent Spawn Failures**
|
|
1412
|
+
```bash
|
|
1413
|
+
# Check system resources
|
|
1414
|
+
npx ruv-swarm status --detailed
|
|
1415
|
+
|
|
1416
|
+
# Verify configuration
|
|
1417
|
+
npx ruv-swarm config validate
|
|
1418
|
+
|
|
1419
|
+
# Check logs
|
|
1420
|
+
npx ruv-swarm logs --level debug
|
|
1421
|
+
```
|
|
1422
|
+
|
|
1423
|
+
**Performance Issues**
|
|
1424
|
+
```bash
|
|
1425
|
+
# Run diagnostics
|
|
1426
|
+
npx ruv-swarm benchmark --quick
|
|
1427
|
+
|
|
1428
|
+
# Enable SIMD if supported
|
|
1429
|
+
export RUVA_SWARM_WASM_SIMD=true
|
|
1430
|
+
|
|
1431
|
+
# Adjust agent limits
|
|
1432
|
+
npx ruv-swarm config set maxAgents 10
|
|
1433
|
+
```
|
|
1434
|
+
|
|
1435
|
+
### Debug Mode
|
|
1436
|
+
|
|
1437
|
+
```bash
|
|
1438
|
+
# Enable debug logging
|
|
1439
|
+
export RUST_LOG=debug
|
|
1440
|
+
export RUVA_SWARM_DEBUG=true
|
|
1441
|
+
|
|
1442
|
+
# Verbose output
|
|
1443
|
+
npx ruv-swarm --verbose <command>
|
|
1444
|
+
|
|
1445
|
+
# Performance profiling
|
|
1446
|
+
npx ruv-swarm profile <command>
|
|
1447
|
+
```
|
|
1448
|
+
|
|
1449
|
+
---
|
|
1450
|
+
|
|
1451
|
+
## ๐ Requirements
|
|
1452
|
+
|
|
1453
|
+
### System Requirements
|
|
1454
|
+
|
|
1455
|
+
| Platform | Minimum | Recommended | Notes |
|
|
1456
|
+
|----------|---------|-------------|-------|
|
|
1457
|
+
| **Node.js** | 14.0+ | 18.0+ | v22+ fully supported |
|
|
1458
|
+
| **RAM** | 1GB | 4GB+ | More for large swarms |
|
|
1459
|
+
| **CPU** | 2 cores | 4+ cores | SIMD support recommended |
|
|
1460
|
+
| **Storage** | 100MB | 1GB+ | Includes WASM binaries |
|
|
1461
|
+
| **WASM** | Required | Required | WebAssembly support |
|
|
1462
|
+
|
|
1463
|
+
### Browser Support
|
|
1464
|
+
|
|
1465
|
+
| Browser | Version | WASM | SIMD |
|
|
1466
|
+
|---------|---------|------|------|
|
|
1467
|
+
| **Chrome** | 70+ | โ
| โ
|
|
|
1468
|
+
| **Firefox** | 65+ | โ
| โ
|
|
|
1469
|
+
| **Safari** | 14+ | โ
| โ ๏ธ |
|
|
1470
|
+
| **Edge** | 79+ | โ
| โ
|
|
|
1471
|
+
|
|
1472
|
+
### Build Requirements
|
|
1473
|
+
|
|
1474
|
+
- **Rust**: 1.70+
|
|
1475
|
+
- **wasm-pack**: 0.12+
|
|
1476
|
+
- **Node.js**: 16+
|
|
1477
|
+
- **npm/yarn**: Latest
|
|
1478
|
+
|
|
1479
|
+
---
|
|
1480
|
+
|
|
1481
|
+
## ๐ License
|
|
1482
|
+
|
|
1483
|
+
**Dual Licensed: MIT OR Apache-2.0**
|
|
1484
|
+
|
|
1485
|
+
You may choose to use this project under either:
|
|
1486
|
+
- [MIT License](LICENSE-MIT)
|
|
1487
|
+
- [Apache License 2.0](LICENSE-APACHE)
|
|
1488
|
+
|
|
1489
|
+
This dual licensing provides maximum flexibility for both open source and commercial use.
|
|
1490
|
+
|
|
1491
|
+
---
|
|
1492
|
+
|
|
1493
|
+
## ๐ค Contributing
|
|
1494
|
+
|
|
1495
|
+
We welcome contributions! See our [Contributing Guide](../docs/guides/CONTRIBUTING.md) for details.
|
|
1496
|
+
|
|
1497
|
+
### Ways to Contribute
|
|
1498
|
+
|
|
1499
|
+
- ๐ Report bugs and issues
|
|
1500
|
+
- ๐ก Suggest new features
|
|
1501
|
+
- ๐ Improve documentation
|
|
1502
|
+
- ๐งช Add tests and examples
|
|
1503
|
+
- ๐ง Submit pull requests
|
|
1504
|
+
|
|
1505
|
+
### Development Setup
|
|
1506
|
+
|
|
1507
|
+
```bash
|
|
1508
|
+
# Fork and clone
|
|
1509
|
+
git clone https://github.com/your-username/ruv-FANN.git
|
|
1510
|
+
cd ruv-FANN/ruv-swarm/npm
|
|
1511
|
+
|
|
1512
|
+
# Install dependencies
|
|
1513
|
+
npm install
|
|
1514
|
+
|
|
1515
|
+
# Start development
|
|
1516
|
+
npm run dev
|
|
1517
|
+
|
|
1518
|
+
# Run tests
|
|
1519
|
+
npm test
|
|
1520
|
+
```
|
|
1521
|
+
|
|
1522
|
+
---
|
|
1523
|
+
|
|
1524
|
+
## ๐ Links & Resources
|
|
1525
|
+
|
|
1526
|
+
### Documentation
|
|
1527
|
+
- ๐ [Full Documentation](https://github.com/ruvnet/ruv-FANN/wiki)
|
|
1528
|
+
- ๐ [Getting Started Guide](https://github.com/ruvnet/ruv-FANN/blob/main/ruv-swarm/guide/README.md)
|
|
1529
|
+
- ๐ [API Reference](https://docs.rs/ruv-swarm)
|
|
1530
|
+
- ๐ฏ [Examples Repository](https://github.com/ruvnet/ruv-FANN/tree/main/ruv-swarm/examples)
|
|
1531
|
+
|
|
1532
|
+
### Community
|
|
1533
|
+
- ๐ฌ [Discussions](https://github.com/ruvnet/ruv-FANN/discussions)
|
|
1534
|
+
- ๐ [Issues](https://github.com/ruvnet/ruv-FANN/issues)
|
|
1535
|
+
- ๐ฐ [Release Notes](https://github.com/ruvnet/ruv-FANN/releases)
|
|
1536
|
+
- ๐ [Roadmap](https://github.com/ruvnet/ruv-FANN/projects)
|
|
1537
|
+
|
|
1538
|
+
### Technical
|
|
1539
|
+
- โก [Performance Benchmarks](../docs/implementation/OPTIMIZATION_REPORT.md)
|
|
1540
|
+
- ๐งช [Testing Strategy](test/README.md)
|
|
1541
|
+
- ๐ง [Architecture Overview](https://github.com/ruvnet/ruv-FANN/blob/main/ruv-swarm/plans/ruv-swarm-architecture.md)
|
|
1542
|
+
|
|
1543
|
+
---
|
|
1544
|
+
|
|
1545
|
+
## ๐ Showcase
|
|
1546
|
+
|
|
1547
|
+
> "*ruv-swarm transformed our AI development workflow. The cognitive diversity and WASM performance made complex multi-agent coordination finally practical.*" - **Tech Lead, AI Research**
|
|
1548
|
+
|
|
1549
|
+
> "*The MCP integration with Claude Code is seamless. We can orchestrate complex research tasks with just a few commands.*" - **Senior Data Scientist**
|
|
1550
|
+
|
|
1551
|
+
> "*Enterprise features like persistence and auto-scaling make ruv-swarm production-ready out of the box.*" - **DevOps Engineer**
|
|
1552
|
+
|
|
1553
|
+
---
|
|
1554
|
+
|
|
1555
|
+
<div align="center">
|
|
1556
|
+
|
|
1557
|
+
**[โญ Star us on GitHub](https://github.com/ruvnet/ruv-FANN)** | **[๐ฆ NPM Package](https://www.npmjs.com/package/ruv-swarm)** | **[๐ฌ Join Community](https://github.com/ruvnet/ruv-FANN/discussions)**
|
|
1558
|
+
|
|
1559
|
+
*Built with ๐ง by the rUv community*
|
|
1560
|
+
|
|
1561
|
+
[](https://github.com/ruvnet/ruv-FANN)
|
|
1562
|
+
[](https://www.npmjs.com/package/ruv-swarm)
|
|
1563
|
+
[](https://discord.gg/YOUR_DISCORD_LINK)
|
|
1564
|
+
|
|
1565
|
+
</div>
|