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