moflo 4.7.1 → 4.7.3

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.
@@ -1039,61 +1039,61 @@ async function writeRuntimeConfig(targetDir, options, result) {
1039
1039
  result.skipped.push('.claude-flow/config.yaml');
1040
1040
  return;
1041
1041
  }
1042
- const config = `# MoFlo V4 Runtime Configuration
1043
- # Generated: ${new Date().toISOString()}
1044
-
1045
- version: "3.0.0"
1046
-
1047
- swarm:
1048
- topology: ${options.runtime.topology}
1049
- maxAgents: ${options.runtime.maxAgents}
1050
- autoScale: true
1051
- coordinationStrategy: consensus
1052
-
1053
- memory:
1054
- backend: ${options.runtime.memoryBackend}
1055
- enableHNSW: ${options.runtime.enableHNSW}
1056
- persistPath: .claude-flow/data
1057
- cacheSize: 100
1058
- # ADR-049: Self-Learning Memory
1059
- learningBridge:
1060
- enabled: ${options.runtime.enableLearningBridge ?? options.runtime.enableNeural}
1061
- sonaMode: balanced
1062
- confidenceDecayRate: 0.005
1063
- accessBoostAmount: 0.03
1064
- consolidationThreshold: 10
1065
- memoryGraph:
1066
- enabled: ${options.runtime.enableMemoryGraph ?? true}
1067
- pageRankDamping: 0.85
1068
- maxNodes: 5000
1069
- similarityThreshold: 0.8
1070
- agentScopes:
1071
- enabled: ${options.runtime.enableAgentScopes ?? true}
1072
- defaultScope: project
1073
-
1074
- neural:
1075
- enabled: ${options.runtime.enableNeural}
1076
- modelPath: .claude-flow/neural
1077
-
1078
- hooks:
1079
- enabled: true
1080
- autoExecute: true
1081
-
1082
- mcp:
1083
- autoStart: ${options.mcp.autoStart}
1084
- port: ${options.mcp.port}
1042
+ const config = `# MoFlo V4 Runtime Configuration
1043
+ # Generated: ${new Date().toISOString()}
1044
+
1045
+ version: "3.0.0"
1046
+
1047
+ swarm:
1048
+ topology: ${options.runtime.topology}
1049
+ maxAgents: ${options.runtime.maxAgents}
1050
+ autoScale: true
1051
+ coordinationStrategy: consensus
1052
+
1053
+ memory:
1054
+ backend: ${options.runtime.memoryBackend}
1055
+ enableHNSW: ${options.runtime.enableHNSW}
1056
+ persistPath: .claude-flow/data
1057
+ cacheSize: 100
1058
+ # ADR-049: Self-Learning Memory
1059
+ learningBridge:
1060
+ enabled: ${options.runtime.enableLearningBridge ?? options.runtime.enableNeural}
1061
+ sonaMode: balanced
1062
+ confidenceDecayRate: 0.005
1063
+ accessBoostAmount: 0.03
1064
+ consolidationThreshold: 10
1065
+ memoryGraph:
1066
+ enabled: ${options.runtime.enableMemoryGraph ?? true}
1067
+ pageRankDamping: 0.85
1068
+ maxNodes: 5000
1069
+ similarityThreshold: 0.8
1070
+ agentScopes:
1071
+ enabled: ${options.runtime.enableAgentScopes ?? true}
1072
+ defaultScope: project
1073
+
1074
+ neural:
1075
+ enabled: ${options.runtime.enableNeural}
1076
+ modelPath: .claude-flow/neural
1077
+
1078
+ hooks:
1079
+ enabled: true
1080
+ autoExecute: true
1081
+
1082
+ mcp:
1083
+ autoStart: ${options.mcp.autoStart}
1084
+ port: ${options.mcp.port}
1085
1085
  `;
1086
1086
  fs.writeFileSync(configPath, config, 'utf-8');
1087
1087
  result.created.files.push('.claude-flow/config.yaml');
1088
1088
  // Write .gitignore
1089
1089
  const gitignorePath = path.join(targetDir, '.claude-flow', '.gitignore');
1090
- const gitignore = `# Claude Flow runtime files
1091
- data/
1092
- logs/
1093
- sessions/
1094
- neural/
1095
- *.log
1096
- *.tmp
1090
+ const gitignore = `# Claude Flow runtime files
1091
+ data/
1092
+ logs/
1093
+ sessions/
1094
+ neural/
1095
+ *.log
1096
+ *.tmp
1097
1097
  `;
1098
1098
  if (!fs.existsSync(gitignorePath) || options.force) {
1099
1099
  fs.writeFileSync(gitignorePath, gitignore, 'utf-8');
@@ -1219,409 +1219,409 @@ async function writeCapabilitiesDoc(targetDir, options, result) {
1219
1219
  result.skipped.push('.claude-flow/CAPABILITIES.md');
1220
1220
  return;
1221
1221
  }
1222
- const capabilities = `# MoFlo V4 - Complete Capabilities Reference
1223
- > Generated: ${new Date().toISOString()}
1224
- > Full documentation: https://github.com/eric-cielo/moflo
1225
-
1226
- ## 📋 Table of Contents
1227
-
1228
- 1. [Overview](#overview)
1229
- 2. [Swarm Orchestration](#swarm-orchestration)
1230
- 3. [Available Agents (60+)](#available-agents)
1231
- 4. [CLI Commands (26 Commands, 140+ Subcommands)](#cli-commands)
1232
- 5. [Hooks System (27 Hooks + 12 Workers)](#hooks-system)
1233
- 6. [Memory & Intelligence (RuVector)](#memory--intelligence)
1234
- 7. [Hive-Mind Consensus](#hive-mind-consensus)
1235
- 8. [Performance Targets](#performance-targets)
1236
- 9. [Integration Ecosystem](#integration-ecosystem)
1237
-
1238
- ---
1239
-
1240
- ## Overview
1241
-
1242
- MoFlo V4 is a domain-driven design architecture for multi-agent AI coordination with:
1243
-
1244
- - **15-Agent Swarm Coordination** with hierarchical and mesh topologies
1245
- - **HNSW Vector Search** - 150x-12,500x faster pattern retrieval
1246
- - **SONA Neural Learning** - Self-optimizing with <0.05ms adaptation
1247
- - **Byzantine Fault Tolerance** - Queen-led consensus mechanisms
1248
- - **MCP Server Integration** - Model Context Protocol support
1249
-
1250
- ### Current Configuration
1251
- | Setting | Value |
1252
- |---------|-------|
1253
- | Topology | ${options.runtime.topology} |
1254
- | Max Agents | ${options.runtime.maxAgents} |
1255
- | Memory Backend | ${options.runtime.memoryBackend} |
1256
- | HNSW Indexing | ${options.runtime.enableHNSW ? 'Enabled' : 'Disabled'} |
1257
- | Neural Learning | ${options.runtime.enableNeural ? 'Enabled' : 'Disabled'} |
1258
- | LearningBridge | ${options.runtime.enableLearningBridge ? 'Enabled (SONA + ReasoningBank)' : 'Disabled'} |
1259
- | Knowledge Graph | ${options.runtime.enableMemoryGraph ? 'Enabled (PageRank + Communities)' : 'Disabled'} |
1260
- | Agent Scopes | ${options.runtime.enableAgentScopes ? 'Enabled (project/local/user)' : 'Disabled'} |
1261
-
1262
- ---
1263
-
1264
- ## Swarm Orchestration
1265
-
1266
- ### Topologies
1267
- | Topology | Description | Best For |
1268
- |----------|-------------|----------|
1269
- | \`hierarchical\` | Queen controls workers directly | Anti-drift, tight control |
1270
- | \`mesh\` | Fully connected peer network | Distributed tasks |
1271
- | \`hierarchical-mesh\` | V3 hybrid (recommended) | 10+ agents |
1272
- | \`ring\` | Circular communication | Sequential workflows |
1273
- | \`star\` | Central coordinator | Simple coordination |
1274
- | \`adaptive\` | Dynamic based on load | Variable workloads |
1275
-
1276
- ### Strategies
1277
- - \`balanced\` - Even distribution across agents
1278
- - \`specialized\` - Clear roles, no overlap (anti-drift)
1279
- - \`adaptive\` - Dynamic task routing
1280
-
1281
- ### Quick Commands
1282
- \`\`\`bash
1283
- # Initialize swarm
1284
- npx moflo swarm init --topology hierarchical --max-agents 8 --strategy specialized
1285
-
1286
- # Check status
1287
- npx moflo swarm status
1288
-
1289
- # Monitor activity
1290
- npx moflo swarm monitor
1291
- \`\`\`
1292
-
1293
- ---
1294
-
1295
- ## Available Agents
1296
-
1297
- ### Core Development (5)
1298
- \`coder\`, \`reviewer\`, \`tester\`, \`planner\`, \`researcher\`
1299
-
1300
- ### V3 Specialized (4)
1301
- \`security-architect\`, \`security-auditor\`, \`memory-specialist\`, \`performance-engineer\`
1302
-
1303
- ### Swarm Coordination (5)
1304
- \`hierarchical-coordinator\`, \`mesh-coordinator\`, \`adaptive-coordinator\`, \`collective-intelligence-coordinator\`, \`swarm-memory-manager\`
1305
-
1306
- ### Consensus & Distributed (7)
1307
- \`byzantine-coordinator\`, \`raft-manager\`, \`gossip-coordinator\`, \`consensus-builder\`, \`crdt-synchronizer\`, \`quorum-manager\`, \`security-manager\`
1308
-
1309
- ### Performance & Optimization (5)
1310
- \`perf-analyzer\`, \`performance-benchmarker\`, \`task-orchestrator\`, \`memory-coordinator\`, \`smart-agent\`
1311
-
1312
- ### GitHub & Repository (9)
1313
- \`github-modes\`, \`pr-manager\`, \`code-review-swarm\`, \`issue-tracker\`, \`release-manager\`, \`workflow-automation\`, \`project-board-sync\`, \`repo-architect\`, \`multi-repo-swarm\`
1314
-
1315
- ### SPARC Methodology (6)
1316
- \`sparc-coord\`, \`sparc-coder\`, \`specification\`, \`pseudocode\`, \`architecture\`, \`refinement\`
1317
-
1318
- ### Specialized Development (8)
1319
- \`backend-dev\`, \`mobile-dev\`, \`ml-developer\`, \`cicd-engineer\`, \`api-docs\`, \`system-architect\`, \`code-analyzer\`, \`base-template-generator\`
1320
-
1321
- ### Testing & Validation (2)
1322
- \`tdd-london-swarm\`, \`production-validator\`
1323
-
1324
- ### Agent Routing by Task
1325
- | Task Type | Recommended Agents | Topology |
1326
- |-----------|-------------------|----------|
1327
- | Bug Fix | researcher, coder, tester | mesh |
1328
- | New Feature | coordinator, architect, coder, tester, reviewer | hierarchical |
1329
- | Refactoring | architect, coder, reviewer | mesh |
1330
- | Performance | researcher, perf-engineer, coder | hierarchical |
1331
- | Security | security-architect, auditor, reviewer | hierarchical |
1332
- | Docs | researcher, api-docs | mesh |
1333
-
1334
- ---
1335
-
1336
- ## CLI Commands
1337
-
1338
- ### Core Commands (12)
1339
- | Command | Subcommands | Description |
1340
- |---------|-------------|-------------|
1341
- | \`init\` | 4 | Project initialization |
1342
- | \`agent\` | 8 | Agent lifecycle management |
1343
- | \`swarm\` | 6 | Multi-agent coordination |
1344
- | \`memory\` | 11 | AgentDB with HNSW search |
1345
- | \`mcp\` | 9 | MCP server management |
1346
- | \`task\` | 6 | Task assignment |
1347
- | \`session\` | 7 | Session persistence |
1348
- | \`config\` | 7 | Configuration |
1349
- | \`status\` | 3 | System monitoring |
1350
- | \`workflow\` | 6 | Workflow templates |
1351
- | \`hooks\` | 17 | Self-learning hooks |
1352
- | \`hive-mind\` | 6 | Consensus coordination |
1353
-
1354
- ### Advanced Commands (14)
1355
- | Command | Subcommands | Description |
1356
- |---------|-------------|-------------|
1357
- | \`daemon\` | 5 | Background workers |
1358
- | \`neural\` | 5 | Pattern training |
1359
- | \`security\` | 6 | Security scanning |
1360
- | \`performance\` | 5 | Profiling & benchmarks |
1361
- | \`providers\` | 5 | AI provider config |
1362
- | \`plugins\` | 5 | Plugin management |
1363
- | \`deployment\` | 5 | Deploy management |
1364
- | \`embeddings\` | 4 | Vector embeddings |
1365
- | \`claims\` | 4 | Authorization |
1366
- | \`migrate\` | 5 | V2→V3 migration |
1367
- | \`process\` | 4 | Process management |
1368
- | \`doctor\` | 1 | Health diagnostics |
1369
- | \`completions\` | 4 | Shell completions |
1370
-
1371
- ### Example Commands
1372
- \`\`\`bash
1373
- # Initialize
1374
- npx moflo init --wizard
1375
-
1376
- # Spawn agent
1377
- npx moflo agent spawn -t coder --name my-coder
1378
-
1379
- # Memory operations
1380
- npx moflo memory store --key "pattern" --value "data" --namespace patterns
1381
- npx moflo memory search --query "authentication"
1382
-
1383
- # Diagnostics
1384
- npx moflo doctor --fix
1385
- \`\`\`
1386
-
1387
- ---
1388
-
1389
- ## Hooks System
1390
-
1391
- ### 27 Available Hooks
1392
-
1393
- #### Core Hooks (6)
1394
- | Hook | Description |
1395
- |------|-------------|
1396
- | \`pre-edit\` | Context before file edits |
1397
- | \`post-edit\` | Record edit outcomes |
1398
- | \`pre-command\` | Risk assessment |
1399
- | \`post-command\` | Command metrics |
1400
- | \`pre-task\` | Task start + agent suggestions |
1401
- | \`post-task\` | Task completion learning |
1402
-
1403
- #### Session Hooks (4)
1404
- | Hook | Description |
1405
- |------|-------------|
1406
- | \`session-start\` | Start/restore session |
1407
- | \`session-end\` | Persist state |
1408
- | \`session-restore\` | Restore previous |
1409
- | \`notify\` | Cross-agent notifications |
1410
-
1411
- #### Intelligence Hooks (5)
1412
- | Hook | Description |
1413
- |------|-------------|
1414
- | \`route\` | Optimal agent routing |
1415
- | \`explain\` | Routing decisions |
1416
- | \`pretrain\` | Bootstrap intelligence |
1417
- | \`build-agents\` | Generate configs |
1418
- | \`transfer\` | Pattern transfer |
1419
-
1420
- #### Coverage Hooks (3)
1421
- | Hook | Description |
1422
- |------|-------------|
1423
- | \`coverage-route\` | Coverage-based routing |
1424
- | \`coverage-suggest\` | Improvement suggestions |
1425
- | \`coverage-gaps\` | Gap analysis |
1426
-
1427
- ### 12 Background Workers
1428
- | Worker | Priority | Purpose |
1429
- |--------|----------|---------|
1430
- | \`ultralearn\` | normal | Deep knowledge |
1431
- | \`optimize\` | high | Performance |
1432
- | \`consolidate\` | low | Memory consolidation |
1433
- | \`predict\` | normal | Predictive preload |
1434
- | \`audit\` | critical | Security |
1435
- | \`map\` | normal | Codebase mapping |
1436
- | \`preload\` | low | Resource preload |
1437
- | \`deepdive\` | normal | Deep analysis |
1438
- | \`document\` | normal | Auto-docs |
1439
- | \`refactor\` | normal | Suggestions |
1440
- | \`benchmark\` | normal | Benchmarking |
1441
- | \`testgaps\` | normal | Coverage gaps |
1442
-
1443
- ---
1444
-
1445
- ## Memory & Intelligence
1446
-
1447
- ### RuVector Intelligence System
1448
- - **SONA**: Self-Optimizing Neural Architecture (<0.05ms)
1449
- - **MoE**: Mixture of Experts routing
1450
- - **HNSW**: 150x-12,500x faster search
1451
- - **EWC++**: Prevents catastrophic forgetting
1452
- - **Flash Attention**: 2.49x-7.47x speedup
1453
- - **Int8 Quantization**: 3.92x memory reduction
1454
-
1455
- ### 4-Step Intelligence Pipeline
1456
- 1. **RETRIEVE** - HNSW pattern search
1457
- 2. **JUDGE** - Success/failure verdicts
1458
- 3. **DISTILL** - LoRA learning extraction
1459
- 4. **CONSOLIDATE** - EWC++ preservation
1460
-
1461
- ### Self-Learning Memory (ADR-049)
1462
-
1463
- | Component | Status | Description |
1464
- |-----------|--------|-------------|
1465
- | **LearningBridge** | ${options.runtime.enableLearningBridge ? '✅ Enabled' : '⏸ Disabled'} | Connects insights to SONA/ReasoningBank neural pipeline |
1466
- | **MemoryGraph** | ${options.runtime.enableMemoryGraph ? '✅ Enabled' : '⏸ Disabled'} | PageRank knowledge graph + community detection |
1467
- | **AgentMemoryScope** | ${options.runtime.enableAgentScopes ? '✅ Enabled' : '⏸ Disabled'} | 3-scope agent memory (project/local/user) |
1468
-
1469
- **LearningBridge** - Insights trigger learning trajectories. Confidence evolves: +0.03 on access, -0.005/hour decay. Consolidation runs the JUDGE/DISTILL/CONSOLIDATE pipeline.
1470
-
1471
- **MemoryGraph** - Builds a knowledge graph from entry references. PageRank identifies influential insights. Communities group related knowledge. Graph-aware ranking blends vector + structural scores.
1472
-
1473
- **AgentMemoryScope** - Maps Claude Code 3-scope directories:
1474
- - \`project\`: \`<gitRoot>/.claude/agent-memory/<agent>/\`
1475
- - \`local\`: \`<gitRoot>/.claude/agent-memory-local/<agent>/\`
1476
- - \`user\`: \`~/.claude/agent-memory/<agent>/\`
1477
-
1478
- High-confidence insights (>0.8) can transfer between agents.
1479
-
1480
- ### Memory Commands
1481
- \`\`\`bash
1482
- # Store pattern
1483
- npx moflo memory store --key "name" --value "data" --namespace patterns
1484
-
1485
- # Semantic search
1486
- npx moflo memory search --query "authentication"
1487
-
1488
- # List entries
1489
- npx moflo memory list --namespace patterns
1490
-
1491
- # Initialize database
1492
- npx moflo memory init --force
1493
- \`\`\`
1494
-
1495
- ---
1496
-
1497
- ## Hive-Mind Consensus
1498
-
1499
- ### Queen Types
1500
- | Type | Role |
1501
- |------|------|
1502
- | Strategic Queen | Long-term planning |
1503
- | Tactical Queen | Execution coordination |
1504
- | Adaptive Queen | Dynamic optimization |
1505
-
1506
- ### Worker Types (8)
1507
- \`researcher\`, \`coder\`, \`analyst\`, \`tester\`, \`architect\`, \`reviewer\`, \`optimizer\`, \`documenter\`
1508
-
1509
- ### Consensus Mechanisms
1510
- | Mechanism | Fault Tolerance | Use Case |
1511
- |-----------|-----------------|----------|
1512
- | \`byzantine\` | f < n/3 faulty | Adversarial |
1513
- | \`raft\` | f < n/2 failed | Leader-based |
1514
- | \`gossip\` | Eventually consistent | Large scale |
1515
- | \`crdt\` | Conflict-free | Distributed |
1516
- | \`quorum\` | Configurable | Flexible |
1517
-
1518
- ### Hive-Mind Commands
1519
- \`\`\`bash
1520
- # Initialize
1521
- npx moflo hive-mind init --queen-type strategic
1522
-
1523
- # Status
1524
- npx moflo hive-mind status
1525
-
1526
- # Spawn workers
1527
- npx moflo hive-mind spawn --count 5 --type worker
1528
-
1529
- # Consensus
1530
- npx moflo hive-mind consensus --propose "task"
1531
- \`\`\`
1532
-
1533
- ---
1534
-
1535
- ## Performance Targets
1536
-
1537
- | Metric | Target | Status |
1538
- |--------|--------|--------|
1539
- | HNSW Search | 150x-12,500x faster | ✅ Implemented |
1540
- | Memory Reduction | 50-75% | ✅ Implemented (3.92x) |
1541
- | SONA Integration | Pattern learning | ✅ Implemented |
1542
- | Flash Attention | 2.49x-7.47x | 🔄 In Progress |
1543
- | MCP Response | <100ms | ✅ Achieved |
1544
- | CLI Startup | <500ms | ✅ Achieved |
1545
- | SONA Adaptation | <0.05ms | 🔄 In Progress |
1546
- | Graph Build (1k) | <200ms | ✅ 2.78ms (71.9x headroom) |
1547
- | PageRank (1k) | <100ms | ✅ 12.21ms (8.2x headroom) |
1548
- | Insight Recording | <5ms/each | ✅ 0.12ms (41x headroom) |
1549
- | Consolidation | <500ms | ✅ 0.26ms (1,955x headroom) |
1550
- | Knowledge Transfer | <100ms | ✅ 1.25ms (80x headroom) |
1551
-
1552
- ---
1553
-
1554
- ## Integration Ecosystem
1555
-
1556
- ### Integrated Packages
1557
- | Package | Version | Purpose |
1558
- |---------|---------|---------|
1559
- | agentic-flow | 3.0.0-alpha.1 | Core coordination + ReasoningBank + Router |
1560
- | agentdb | 3.0.0-alpha.10 | Vector database + 8 controllers |
1561
- | @ruvector/attention | 0.1.3 | Flash attention |
1562
- | @ruvector/sona | 0.1.5 | Neural learning |
1563
-
1564
- ### Optional Integrations
1565
- | Package | Command |
1566
- |---------|---------|
1567
- | ruv-swarm | \`npx ruv-swarm mcp start\` |
1568
- | flow-nexus | \`npx flow-nexus@latest mcp start\` |
1569
- | agentic-jujutsu | \`npx agentic-jujutsu@latest\` |
1570
-
1571
- ### MCP Server Setup
1572
- \`\`\`bash
1573
- # Add Claude Flow MCP
1574
- claude mcp add claude-flow -- npx -y @claude-flow/cli@latest
1575
-
1576
- # Optional servers
1577
- claude mcp add ruv-swarm -- npx -y ruv-swarm mcp start
1578
- claude mcp add flow-nexus -- npx -y flow-nexus@latest mcp start
1579
- \`\`\`
1580
-
1581
- ---
1582
-
1583
- ## Quick Reference
1584
-
1585
- ### Essential Commands
1586
- \`\`\`bash
1587
- # Setup
1588
- npx moflo init --wizard
1589
- npx moflo daemon start
1590
- npx moflo doctor --fix
1591
-
1592
- # Swarm
1593
- npx moflo swarm init --topology hierarchical --max-agents 8
1594
- npx moflo swarm status
1595
-
1596
- # Agents
1597
- npx moflo agent spawn -t coder
1598
- npx moflo agent list
1599
-
1600
- # Memory
1601
- npx moflo memory search --query "patterns"
1602
-
1603
- # Hooks
1604
- npx moflo hooks pre-task --description "task"
1605
- npx moflo hooks worker dispatch --trigger optimize
1606
- \`\`\`
1607
-
1608
- ### File Structure
1609
- \`\`\`
1610
- .claude-flow/
1611
- ├── config.yaml # Runtime configuration
1612
- ├── CAPABILITIES.md # This file
1613
- ├── data/ # Memory storage
1614
- ├── logs/ # Operation logs
1615
- ├── sessions/ # Session state
1616
- ├── hooks/ # Custom hooks
1617
- ├── agents/ # Agent configs
1618
- └── workflows/ # Workflow templates
1619
- \`\`\`
1620
-
1621
- ---
1622
-
1623
- **Full Documentation**: https://github.com/eric-cielo/moflo
1624
- **Issues**: https://github.com/eric-cielo/moflo/issues
1222
+ const capabilities = `# MoFlo V4 - Complete Capabilities Reference
1223
+ > Generated: ${new Date().toISOString()}
1224
+ > Full documentation: https://github.com/eric-cielo/moflo
1225
+
1226
+ ## 📋 Table of Contents
1227
+
1228
+ 1. [Overview](#overview)
1229
+ 2. [Swarm Orchestration](#swarm-orchestration)
1230
+ 3. [Available Agents (60+)](#available-agents)
1231
+ 4. [CLI Commands (26 Commands, 140+ Subcommands)](#cli-commands)
1232
+ 5. [Hooks System (27 Hooks + 12 Workers)](#hooks-system)
1233
+ 6. [Memory & Intelligence (RuVector)](#memory--intelligence)
1234
+ 7. [Hive-Mind Consensus](#hive-mind-consensus)
1235
+ 8. [Performance Targets](#performance-targets)
1236
+ 9. [Integration Ecosystem](#integration-ecosystem)
1237
+
1238
+ ---
1239
+
1240
+ ## Overview
1241
+
1242
+ MoFlo V4 is a domain-driven design architecture for multi-agent AI coordination with:
1243
+
1244
+ - **15-Agent Swarm Coordination** with hierarchical and mesh topologies
1245
+ - **HNSW Vector Search** - 150x-12,500x faster pattern retrieval
1246
+ - **SONA Neural Learning** - Self-optimizing with <0.05ms adaptation
1247
+ - **Byzantine Fault Tolerance** - Queen-led consensus mechanisms
1248
+ - **MCP Server Integration** - Model Context Protocol support
1249
+
1250
+ ### Current Configuration
1251
+ | Setting | Value |
1252
+ |---------|-------|
1253
+ | Topology | ${options.runtime.topology} |
1254
+ | Max Agents | ${options.runtime.maxAgents} |
1255
+ | Memory Backend | ${options.runtime.memoryBackend} |
1256
+ | HNSW Indexing | ${options.runtime.enableHNSW ? 'Enabled' : 'Disabled'} |
1257
+ | Neural Learning | ${options.runtime.enableNeural ? 'Enabled' : 'Disabled'} |
1258
+ | LearningBridge | ${options.runtime.enableLearningBridge ? 'Enabled (SONA + ReasoningBank)' : 'Disabled'} |
1259
+ | Knowledge Graph | ${options.runtime.enableMemoryGraph ? 'Enabled (PageRank + Communities)' : 'Disabled'} |
1260
+ | Agent Scopes | ${options.runtime.enableAgentScopes ? 'Enabled (project/local/user)' : 'Disabled'} |
1261
+
1262
+ ---
1263
+
1264
+ ## Swarm Orchestration
1265
+
1266
+ ### Topologies
1267
+ | Topology | Description | Best For |
1268
+ |----------|-------------|----------|
1269
+ | \`hierarchical\` | Queen controls workers directly | Anti-drift, tight control |
1270
+ | \`mesh\` | Fully connected peer network | Distributed tasks |
1271
+ | \`hierarchical-mesh\` | V3 hybrid (recommended) | 10+ agents |
1272
+ | \`ring\` | Circular communication | Sequential workflows |
1273
+ | \`star\` | Central coordinator | Simple coordination |
1274
+ | \`adaptive\` | Dynamic based on load | Variable workloads |
1275
+
1276
+ ### Strategies
1277
+ - \`balanced\` - Even distribution across agents
1278
+ - \`specialized\` - Clear roles, no overlap (anti-drift)
1279
+ - \`adaptive\` - Dynamic task routing
1280
+
1281
+ ### Quick Commands
1282
+ \`\`\`bash
1283
+ # Initialize swarm
1284
+ npx moflo swarm init --topology hierarchical --max-agents 8 --strategy specialized
1285
+
1286
+ # Check status
1287
+ npx moflo swarm status
1288
+
1289
+ # Monitor activity
1290
+ npx moflo swarm monitor
1291
+ \`\`\`
1292
+
1293
+ ---
1294
+
1295
+ ## Available Agents
1296
+
1297
+ ### Core Development (5)
1298
+ \`coder\`, \`reviewer\`, \`tester\`, \`planner\`, \`researcher\`
1299
+
1300
+ ### V3 Specialized (4)
1301
+ \`security-architect\`, \`security-auditor\`, \`memory-specialist\`, \`performance-engineer\`
1302
+
1303
+ ### Swarm Coordination (5)
1304
+ \`hierarchical-coordinator\`, \`mesh-coordinator\`, \`adaptive-coordinator\`, \`collective-intelligence-coordinator\`, \`swarm-memory-manager\`
1305
+
1306
+ ### Consensus & Distributed (7)
1307
+ \`byzantine-coordinator\`, \`raft-manager\`, \`gossip-coordinator\`, \`consensus-builder\`, \`crdt-synchronizer\`, \`quorum-manager\`, \`security-manager\`
1308
+
1309
+ ### Performance & Optimization (5)
1310
+ \`perf-analyzer\`, \`performance-benchmarker\`, \`task-orchestrator\`, \`memory-coordinator\`, \`smart-agent\`
1311
+
1312
+ ### GitHub & Repository (9)
1313
+ \`github-modes\`, \`pr-manager\`, \`code-review-swarm\`, \`issue-tracker\`, \`release-manager\`, \`workflow-automation\`, \`project-board-sync\`, \`repo-architect\`, \`multi-repo-swarm\`
1314
+
1315
+ ### SPARC Methodology (6)
1316
+ \`sparc-coord\`, \`sparc-coder\`, \`specification\`, \`pseudocode\`, \`architecture\`, \`refinement\`
1317
+
1318
+ ### Specialized Development (8)
1319
+ \`backend-dev\`, \`mobile-dev\`, \`ml-developer\`, \`cicd-engineer\`, \`api-docs\`, \`system-architect\`, \`code-analyzer\`, \`base-template-generator\`
1320
+
1321
+ ### Testing & Validation (2)
1322
+ \`tdd-london-swarm\`, \`production-validator\`
1323
+
1324
+ ### Agent Routing by Task
1325
+ | Task Type | Recommended Agents | Topology |
1326
+ |-----------|-------------------|----------|
1327
+ | Bug Fix | researcher, coder, tester | mesh |
1328
+ | New Feature | coordinator, architect, coder, tester, reviewer | hierarchical |
1329
+ | Refactoring | architect, coder, reviewer | mesh |
1330
+ | Performance | researcher, perf-engineer, coder | hierarchical |
1331
+ | Security | security-architect, auditor, reviewer | hierarchical |
1332
+ | Docs | researcher, api-docs | mesh |
1333
+
1334
+ ---
1335
+
1336
+ ## CLI Commands
1337
+
1338
+ ### Core Commands (12)
1339
+ | Command | Subcommands | Description |
1340
+ |---------|-------------|-------------|
1341
+ | \`init\` | 4 | Project initialization |
1342
+ | \`agent\` | 8 | Agent lifecycle management |
1343
+ | \`swarm\` | 6 | Multi-agent coordination |
1344
+ | \`memory\` | 11 | AgentDB with HNSW search |
1345
+ | \`mcp\` | 9 | MCP server management |
1346
+ | \`task\` | 6 | Task assignment |
1347
+ | \`session\` | 7 | Session persistence |
1348
+ | \`config\` | 7 | Configuration |
1349
+ | \`status\` | 3 | System monitoring |
1350
+ | \`workflow\` | 6 | Workflow templates |
1351
+ | \`hooks\` | 17 | Self-learning hooks |
1352
+ | \`hive-mind\` | 6 | Consensus coordination |
1353
+
1354
+ ### Advanced Commands (14)
1355
+ | Command | Subcommands | Description |
1356
+ |---------|-------------|-------------|
1357
+ | \`daemon\` | 5 | Background workers |
1358
+ | \`neural\` | 5 | Pattern training |
1359
+ | \`security\` | 6 | Security scanning |
1360
+ | \`performance\` | 5 | Profiling & benchmarks |
1361
+ | \`providers\` | 5 | AI provider config |
1362
+ | \`plugins\` | 5 | Plugin management |
1363
+ | \`deployment\` | 5 | Deploy management |
1364
+ | \`embeddings\` | 4 | Vector embeddings |
1365
+ | \`claims\` | 4 | Authorization |
1366
+ | \`migrate\` | 5 | V2→V3 migration |
1367
+ | \`process\` | 4 | Process management |
1368
+ | \`doctor\` | 1 | Health diagnostics |
1369
+ | \`completions\` | 4 | Shell completions |
1370
+
1371
+ ### Example Commands
1372
+ \`\`\`bash
1373
+ # Initialize
1374
+ npx moflo init --wizard
1375
+
1376
+ # Spawn agent
1377
+ npx moflo agent spawn -t coder --name my-coder
1378
+
1379
+ # Memory operations
1380
+ npx moflo memory store --key "pattern" --value "data" --namespace patterns
1381
+ npx moflo memory search --query "authentication"
1382
+
1383
+ # Diagnostics
1384
+ npx moflo doctor --fix
1385
+ \`\`\`
1386
+
1387
+ ---
1388
+
1389
+ ## Hooks System
1390
+
1391
+ ### 27 Available Hooks
1392
+
1393
+ #### Core Hooks (6)
1394
+ | Hook | Description |
1395
+ |------|-------------|
1396
+ | \`pre-edit\` | Context before file edits |
1397
+ | \`post-edit\` | Record edit outcomes |
1398
+ | \`pre-command\` | Risk assessment |
1399
+ | \`post-command\` | Command metrics |
1400
+ | \`pre-task\` | Task start + agent suggestions |
1401
+ | \`post-task\` | Task completion learning |
1402
+
1403
+ #### Session Hooks (4)
1404
+ | Hook | Description |
1405
+ |------|-------------|
1406
+ | \`session-start\` | Start/restore session |
1407
+ | \`session-end\` | Persist state |
1408
+ | \`session-restore\` | Restore previous |
1409
+ | \`notify\` | Cross-agent notifications |
1410
+
1411
+ #### Intelligence Hooks (5)
1412
+ | Hook | Description |
1413
+ |------|-------------|
1414
+ | \`route\` | Optimal agent routing |
1415
+ | \`explain\` | Routing decisions |
1416
+ | \`pretrain\` | Bootstrap intelligence |
1417
+ | \`build-agents\` | Generate configs |
1418
+ | \`transfer\` | Pattern transfer |
1419
+
1420
+ #### Coverage Hooks (3)
1421
+ | Hook | Description |
1422
+ |------|-------------|
1423
+ | \`coverage-route\` | Coverage-based routing |
1424
+ | \`coverage-suggest\` | Improvement suggestions |
1425
+ | \`coverage-gaps\` | Gap analysis |
1426
+
1427
+ ### 12 Background Workers
1428
+ | Worker | Priority | Purpose |
1429
+ |--------|----------|---------|
1430
+ | \`ultralearn\` | normal | Deep knowledge |
1431
+ | \`optimize\` | high | Performance |
1432
+ | \`consolidate\` | low | Memory consolidation |
1433
+ | \`predict\` | normal | Predictive preload |
1434
+ | \`audit\` | critical | Security |
1435
+ | \`map\` | normal | Codebase mapping |
1436
+ | \`preload\` | low | Resource preload |
1437
+ | \`deepdive\` | normal | Deep analysis |
1438
+ | \`document\` | normal | Auto-docs |
1439
+ | \`refactor\` | normal | Suggestions |
1440
+ | \`benchmark\` | normal | Benchmarking |
1441
+ | \`testgaps\` | normal | Coverage gaps |
1442
+
1443
+ ---
1444
+
1445
+ ## Memory & Intelligence
1446
+
1447
+ ### RuVector Intelligence System
1448
+ - **SONA**: Self-Optimizing Neural Architecture (<0.05ms)
1449
+ - **MoE**: Mixture of Experts routing
1450
+ - **HNSW**: 150x-12,500x faster search
1451
+ - **EWC++**: Prevents catastrophic forgetting
1452
+ - **Flash Attention**: 2.49x-7.47x speedup
1453
+ - **Int8 Quantization**: 3.92x memory reduction
1454
+
1455
+ ### 4-Step Intelligence Pipeline
1456
+ 1. **RETRIEVE** - HNSW pattern search
1457
+ 2. **JUDGE** - Success/failure verdicts
1458
+ 3. **DISTILL** - LoRA learning extraction
1459
+ 4. **CONSOLIDATE** - EWC++ preservation
1460
+
1461
+ ### Self-Learning Memory (ADR-049)
1462
+
1463
+ | Component | Status | Description |
1464
+ |-----------|--------|-------------|
1465
+ | **LearningBridge** | ${options.runtime.enableLearningBridge ? '✅ Enabled' : '⏸ Disabled'} | Connects insights to SONA/ReasoningBank neural pipeline |
1466
+ | **MemoryGraph** | ${options.runtime.enableMemoryGraph ? '✅ Enabled' : '⏸ Disabled'} | PageRank knowledge graph + community detection |
1467
+ | **AgentMemoryScope** | ${options.runtime.enableAgentScopes ? '✅ Enabled' : '⏸ Disabled'} | 3-scope agent memory (project/local/user) |
1468
+
1469
+ **LearningBridge** - Insights trigger learning trajectories. Confidence evolves: +0.03 on access, -0.005/hour decay. Consolidation runs the JUDGE/DISTILL/CONSOLIDATE pipeline.
1470
+
1471
+ **MemoryGraph** - Builds a knowledge graph from entry references. PageRank identifies influential insights. Communities group related knowledge. Graph-aware ranking blends vector + structural scores.
1472
+
1473
+ **AgentMemoryScope** - Maps Claude Code 3-scope directories:
1474
+ - \`project\`: \`<gitRoot>/.claude/agent-memory/<agent>/\`
1475
+ - \`local\`: \`<gitRoot>/.claude/agent-memory-local/<agent>/\`
1476
+ - \`user\`: \`~/.claude/agent-memory/<agent>/\`
1477
+
1478
+ High-confidence insights (>0.8) can transfer between agents.
1479
+
1480
+ ### Memory Commands
1481
+ \`\`\`bash
1482
+ # Store pattern
1483
+ npx moflo memory store --key "name" --value "data" --namespace patterns
1484
+
1485
+ # Semantic search
1486
+ npx moflo memory search --query "authentication"
1487
+
1488
+ # List entries
1489
+ npx moflo memory list --namespace patterns
1490
+
1491
+ # Initialize database
1492
+ npx moflo memory init --force
1493
+ \`\`\`
1494
+
1495
+ ---
1496
+
1497
+ ## Hive-Mind Consensus
1498
+
1499
+ ### Queen Types
1500
+ | Type | Role |
1501
+ |------|------|
1502
+ | Strategic Queen | Long-term planning |
1503
+ | Tactical Queen | Execution coordination |
1504
+ | Adaptive Queen | Dynamic optimization |
1505
+
1506
+ ### Worker Types (8)
1507
+ \`researcher\`, \`coder\`, \`analyst\`, \`tester\`, \`architect\`, \`reviewer\`, \`optimizer\`, \`documenter\`
1508
+
1509
+ ### Consensus Mechanisms
1510
+ | Mechanism | Fault Tolerance | Use Case |
1511
+ |-----------|-----------------|----------|
1512
+ | \`byzantine\` | f < n/3 faulty | Adversarial |
1513
+ | \`raft\` | f < n/2 failed | Leader-based |
1514
+ | \`gossip\` | Eventually consistent | Large scale |
1515
+ | \`crdt\` | Conflict-free | Distributed |
1516
+ | \`quorum\` | Configurable | Flexible |
1517
+
1518
+ ### Hive-Mind Commands
1519
+ \`\`\`bash
1520
+ # Initialize
1521
+ npx moflo hive-mind init --queen-type strategic
1522
+
1523
+ # Status
1524
+ npx moflo hive-mind status
1525
+
1526
+ # Spawn workers
1527
+ npx moflo hive-mind spawn --count 5 --type worker
1528
+
1529
+ # Consensus
1530
+ npx moflo hive-mind consensus --propose "task"
1531
+ \`\`\`
1532
+
1533
+ ---
1534
+
1535
+ ## Performance Targets
1536
+
1537
+ | Metric | Target | Status |
1538
+ |--------|--------|--------|
1539
+ | HNSW Search | 150x-12,500x faster | ✅ Implemented |
1540
+ | Memory Reduction | 50-75% | ✅ Implemented (3.92x) |
1541
+ | SONA Integration | Pattern learning | ✅ Implemented |
1542
+ | Flash Attention | 2.49x-7.47x | 🔄 In Progress |
1543
+ | MCP Response | <100ms | ✅ Achieved |
1544
+ | CLI Startup | <500ms | ✅ Achieved |
1545
+ | SONA Adaptation | <0.05ms | 🔄 In Progress |
1546
+ | Graph Build (1k) | <200ms | ✅ 2.78ms (71.9x headroom) |
1547
+ | PageRank (1k) | <100ms | ✅ 12.21ms (8.2x headroom) |
1548
+ | Insight Recording | <5ms/each | ✅ 0.12ms (41x headroom) |
1549
+ | Consolidation | <500ms | ✅ 0.26ms (1,955x headroom) |
1550
+ | Knowledge Transfer | <100ms | ✅ 1.25ms (80x headroom) |
1551
+
1552
+ ---
1553
+
1554
+ ## Integration Ecosystem
1555
+
1556
+ ### Integrated Packages
1557
+ | Package | Version | Purpose |
1558
+ |---------|---------|---------|
1559
+ | agentic-flow | 3.0.0-alpha.1 | Core coordination + ReasoningBank + Router |
1560
+ | agentdb | 3.0.0-alpha.10 | Vector database + 8 controllers |
1561
+ | @ruvector/attention | 0.1.3 | Flash attention |
1562
+ | @ruvector/sona | 0.1.5 | Neural learning |
1563
+
1564
+ ### Optional Integrations
1565
+ | Package | Command |
1566
+ |---------|---------|
1567
+ | ruv-swarm | \`npx ruv-swarm mcp start\` |
1568
+ | flow-nexus | \`npx flow-nexus@latest mcp start\` |
1569
+ | agentic-jujutsu | \`npx agentic-jujutsu@latest\` |
1570
+
1571
+ ### MCP Server Setup
1572
+ \`\`\`bash
1573
+ # Add Claude Flow MCP
1574
+ claude mcp add claude-flow -- npx -y @claude-flow/cli@latest
1575
+
1576
+ # Optional servers
1577
+ claude mcp add ruv-swarm -- npx -y ruv-swarm mcp start
1578
+ claude mcp add flow-nexus -- npx -y flow-nexus@latest mcp start
1579
+ \`\`\`
1580
+
1581
+ ---
1582
+
1583
+ ## Quick Reference
1584
+
1585
+ ### Essential Commands
1586
+ \`\`\`bash
1587
+ # Setup
1588
+ npx moflo init --wizard
1589
+ npx moflo daemon start
1590
+ npx moflo doctor --fix
1591
+
1592
+ # Swarm
1593
+ npx moflo swarm init --topology hierarchical --max-agents 8
1594
+ npx moflo swarm status
1595
+
1596
+ # Agents
1597
+ npx moflo agent spawn -t coder
1598
+ npx moflo agent list
1599
+
1600
+ # Memory
1601
+ npx moflo memory search --query "patterns"
1602
+
1603
+ # Hooks
1604
+ npx moflo hooks pre-task --description "task"
1605
+ npx moflo hooks worker dispatch --trigger optimize
1606
+ \`\`\`
1607
+
1608
+ ### File Structure
1609
+ \`\`\`
1610
+ .claude-flow/
1611
+ ├── config.yaml # Runtime configuration
1612
+ ├── CAPABILITIES.md # This file
1613
+ ├── data/ # Memory storage
1614
+ ├── logs/ # Operation logs
1615
+ ├── sessions/ # Session state
1616
+ ├── hooks/ # Custom hooks
1617
+ ├── agents/ # Agent configs
1618
+ └── workflows/ # Workflow templates
1619
+ \`\`\`
1620
+
1621
+ ---
1622
+
1623
+ **Full Documentation**: https://github.com/eric-cielo/moflo
1624
+ **Issues**: https://github.com/eric-cielo/moflo/issues
1625
1625
  `;
1626
1626
  fs.writeFileSync(capabilitiesPath, capabilities, 'utf-8');
1627
1627
  result.created.files.push('.claude-flow/CAPABILITIES.md');