@claude-flow/cli 3.1.0-alpha.51 → 3.1.0-alpha.53

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.
Files changed (38) hide show
  1. package/README.md +137 -60
  2. package/dist/src/commands/hooks.d.ts.map +1 -1
  3. package/dist/src/commands/hooks.js +17 -13
  4. package/dist/src/commands/hooks.js.map +1 -1
  5. package/dist/src/commands/neural.js.map +1 -1
  6. package/dist/src/init/executor.d.ts.map +1 -1
  7. package/dist/src/init/executor.js +11 -1
  8. package/dist/src/init/executor.js.map +1 -1
  9. package/dist/src/init/mcp-generator.d.ts +0 -7
  10. package/dist/src/init/mcp-generator.d.ts.map +1 -1
  11. package/dist/src/init/mcp-generator.js +9 -29
  12. package/dist/src/init/mcp-generator.js.map +1 -1
  13. package/dist/src/init/settings-generator.d.ts.map +1 -1
  14. package/dist/src/init/settings-generator.js +4 -4
  15. package/dist/src/init/settings-generator.js.map +1 -1
  16. package/dist/src/init/statusline-generator.d.ts.map +1 -1
  17. package/dist/src/init/statusline-generator.js +85 -2
  18. package/dist/src/init/statusline-generator.js.map +1 -1
  19. package/dist/src/mcp-client.d.ts.map +1 -1
  20. package/dist/src/mcp-client.js +4 -0
  21. package/dist/src/mcp-client.js.map +1 -1
  22. package/dist/src/mcp-tools/agentdb-tools.d.ts +27 -0
  23. package/dist/src/mcp-tools/agentdb-tools.d.ts.map +1 -0
  24. package/dist/src/mcp-tools/agentdb-tools.js +450 -0
  25. package/dist/src/mcp-tools/agentdb-tools.js.map +1 -0
  26. package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
  27. package/dist/src/mcp-tools/hooks-tools.js +184 -32
  28. package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
  29. package/dist/src/memory/memory-bridge.d.ts +183 -4
  30. package/dist/src/memory/memory-bridge.d.ts.map +1 -1
  31. package/dist/src/memory/memory-bridge.js +707 -26
  32. package/dist/src/memory/memory-bridge.js.map +1 -1
  33. package/dist/src/services/ruvector-training.d.ts +2 -1
  34. package/dist/src/services/ruvector-training.d.ts.map +1 -1
  35. package/dist/src/services/ruvector-training.js +1 -2
  36. package/dist/src/services/ruvector-training.js.map +1 -1
  37. package/dist/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +1 -1
package/README.md CHANGED
@@ -1017,6 +1017,85 @@ flowchart LR
1017
1017
 
1018
1018
  </details>
1019
1019
 
1020
+ <details>
1021
+ <summary>🧠 <strong>AgentDB v3 Controllers</strong> — 20+ intelligent memory controllers</summary>
1022
+
1023
+ Claude Flow V3 integrates AgentDB v3 (3.0.0-alpha.9) providing 20+ memory controllers accessible via MCP tools and the CLI.
1024
+
1025
+ **Core Memory:**
1026
+
1027
+ | Controller | MCP Tool | Description |
1028
+ |-----------|----------|-------------|
1029
+ | HierarchicalMemory | `agentdb_hierarchical-store/recall` | Working → short-term → long-term memory tiers with automatic promotion and retention decay |
1030
+ | MemoryConsolidation | `agentdb_consolidate` | Automatic clustering and merging of related memories into semantic summaries |
1031
+ | BatchOperations | `agentdb_batch` | Bulk insert/update/delete operations for high-throughput memory management |
1032
+ | ReasoningBank | `agentdb_pattern-store/search` | Pattern storage with BM25+semantic hybrid search |
1033
+
1034
+ **Intelligence:**
1035
+
1036
+ | Controller | MCP Tool | Description |
1037
+ |-----------|----------|-------------|
1038
+ | SemanticRouter | `agentdb_semantic-route` | Route tasks to agents using vector similarity instead of manual rules |
1039
+ | ContextSynthesizer | `agentdb_context-synthesize` | Auto-generate context summaries from memory entries |
1040
+ | GNNService | — | Graph neural network for intent classification and skill recommendation |
1041
+ | SonaTrajectoryService | — | Record and predict learning trajectories for agents |
1042
+ | GraphTransformerService | — | Sublinear attention, causal attention, Granger causality extraction |
1043
+
1044
+ **Causal & Explainable:**
1045
+
1046
+ | Controller | MCP Tool | Description |
1047
+ |-----------|----------|-------------|
1048
+ | CausalRecall | `agentdb_causal-edge` | Recall with causal re-ranking and utility scoring |
1049
+ | ExplainableRecall | — | Certificates proving *why* a memory was recalled |
1050
+ | CausalMemoryGraph | — | Directed causal relationships between memory entries |
1051
+ | MMRDiversityRanker | — | Maximal Marginal Relevance for diverse search results |
1052
+
1053
+ **Security & Integrity:**
1054
+
1055
+ | Controller | MCP Tool | Description |
1056
+ |-----------|----------|-------------|
1057
+ | GuardedVectorBackend | — | Cryptographic proof-of-work before vector insert/search |
1058
+ | MutationGuard | — | Token-validated mutations with cryptographic proofs |
1059
+ | AttestationLog | — | Immutable audit trail of all memory operations |
1060
+ | RVFOptimizer | — | 4-bit adaptive quantization and progressive compression |
1061
+
1062
+ **MCP Tool Examples:**
1063
+ ```bash
1064
+ # Store to hierarchical memory
1065
+ agentdb_hierarchical-store --key "auth-pattern" --value "JWT refresh" --tier "longTerm"
1066
+
1067
+ # Recall from memory tiers
1068
+ agentdb_hierarchical-recall --query "authentication" --topK 5
1069
+
1070
+ # Run memory consolidation
1071
+ agentdb_consolidate
1072
+
1073
+ # Batch insert
1074
+ agentdb_batch --operation insert --entries '[{"key":"k1","value":"v1"}]'
1075
+
1076
+ # Synthesize context
1077
+ agentdb_context-synthesize --query "error handling patterns"
1078
+
1079
+ # Semantic routing
1080
+ agentdb_semantic-route --input "fix auth bug in login"
1081
+ ```
1082
+
1083
+ **Hierarchical Memory Tiers:**
1084
+ ```
1085
+ ┌─────────────────────────────────────────────┐
1086
+ │ Working Memory (capacity: 7±2 items) │ ← Active context, fast access
1087
+ │ TTL: ~30 seconds, auto-evict oldest │
1088
+ ├─────────────────────────────────────────────┤
1089
+ │ Short-Term Memory │ ← Recent patterns, moderate retention
1090
+ │ Rehearsal strengthens, decay weakens │
1091
+ ├─────────────────────────────────────────────┤
1092
+ │ Long-Term Memory │ ← Consolidated knowledge, persistent
1093
+ │ Promoted from short-term via consolidation │
1094
+ └─────────────────────────────────────────────┘
1095
+ ```
1096
+
1097
+ </details>
1098
+
1020
1099
  <details>
1021
1100
  <summary>🐝 <strong>Swarm Topology</strong> — Multi-agent coordination patterns</summary>
1022
1101
 
@@ -2395,85 +2474,83 @@ npx ruflo hive-mind status # Check status
2395
2474
  <details>
2396
2475
  <summary>📊 <strong>V3 Statusline</strong> — Real-time development status for Claude Code</summary>
2397
2476
 
2398
- Real-time development status display for Claude Code integration showing DDD progress, swarm activity, security status, and system metrics.
2477
+ Real-time development status display integrated directly into Claude Code's status bar. Shows DDD progress, swarm activity, security status, AgentDB metrics, and live session data (model, context usage, cost).
2478
+
2479
+ **How It Works:**
2480
+
2481
+ Claude Code pipes JSON session data via **stdin** to the statusline script after each assistant message (debounced ~300ms). The script reads this data and combines it with local project metrics to produce a single-line status output.
2399
2482
 
2400
2483
  **Output Format:**
2401
2484
  ```
2402
- Ruflo V3 ● ruvnet │ ⎇ v3 │ Opus 4.5
2403
- ─────────────────────────────────────────────────────
2404
- 🏗️ DDD Domains [●●●●●] 5/5 ⚡ 1.0x → 2.49x-7.47x
2405
- 🤖 Swarm ◉ [58/15] 👥 0 🟢 CVE 3/3 💾 22282MB 📂 47% 🧠 10%
2406
- 🔧 Architecture DDD ● 98% │ Security ●CLEAN │ Memory ●AgentDB │ Integration ●
2485
+ Claude Flow V3 ● ruvnet │ ⎇ main │ Opus 4.6 | ●42% ctx | $0.15
2486
+ 🏗️ DDD [●●●●○] 4/5 ⚡ HNSW 150x 🤖 ◉ [12/8] 👥 3 🟢 CVE 3/3 💾 512MB 🧠 15% 📦 AgentDB ●1.2K vectors
2407
2487
  ```
2408
2488
 
2409
- | Indicator | Description | Values |
2489
+ | Indicator | Description | Source |
2410
2490
  |-----------|-------------|--------|
2411
- | `▊ Ruflo V3` | Project header | Always shown |
2412
- | `● ruvnet` | GitHub user (via `gh` CLI) | Dynamic |
2413
- | `⎇ v3` | Current git branch | Dynamic |
2414
- | `Opus 4.5` | Claude model name | From Claude Code |
2415
- | `[●●●●●]` | DDD domain progress bar | 0-5 domains |
2416
- | `⚡ 1.0x → 2.49x-7.47x` | Performance speedup target | Current Target |
2417
- | `◉/○` | Swarm coordination status | Active/Inactive |
2418
- | `[58/15]` | Active agents / max agents | Process count |
2419
- | `👥 0` | Sub-agents spawned | Task tool agents |
2420
- | `🟢 CVE 3/3` | Security CVE remediation | Fixed/Total |
2421
- | `💾 22282MB` | Memory usage (Node.js processes) | Real-time |
2422
- | `📂 47%` | Context window usage | From Claude Code |
2423
- | `🧠 10%` | Intelligence score (patterns learned) | 0-100% |
2424
- | `DDD ● 98%` | Domain-Driven Design progress | Percentage |
2425
- | `SecurityCLEAN` | Security audit status | CLEAN/PENDING/FAILED |
2426
- | `Memory ●AgentDB` | Memory backend in use | AgentDB/SQLite/Hybrid |
2427
- | `Integration ●` | agentic-flow integration status | Active/Inactive |
2428
-
2429
- **Usage:**
2430
- ```bash
2431
- # Default: Safe multi-line (avoids Claude Code collision zone)
2432
- npx ruflo@v3alpha hooks statusline
2433
-
2434
- # Single-line mode (completely avoids collision)
2435
- npx ruflo@v3alpha hooks statusline --single
2491
+ | `▊ Claude Flow V3` | Project header | Always shown |
2492
+ | `● ruvnet` | GitHub user | `gh api user` CLI |
2493
+ | `⎇ main` | Current git branch | `git branch --show-current` |
2494
+ | `Opus 4.6` | Claude model name | Stdin JSON `model.display_name` |
2495
+ | `●42% ctx` | Context window usage | Stdin JSON `context_window.used_percentage` |
2496
+ | `$0.15` | Session cost | Stdin JSON `cost.total_cost_usd` |
2497
+ | `[●●●●○]` | DDD domain progress bar | `.claude-flow/metrics/v3-progress.json` |
2498
+ | `⚡ HNSW 150x` | HNSW search speedup | AgentDB file stats |
2499
+ | `◉/○` | Swarm coordination status | Process detection |
2500
+ | `[12/8]` | Active agents / max agents | `ps aux` process count |
2501
+ | `👥 3` | Sub-agents spawned | Task tool agent count |
2502
+ | `🟢 CVE 3/3` | Security CVE remediation | `.claude-flow/security/audit-status.json` |
2503
+ | `💾 512MB` | Memory usage | Node.js process RSS |
2504
+ | `🧠 15%` | Intelligence score | Pattern count from AgentDB |
2505
+ | `📦 AgentDB 1.2K` | AgentDB vector count | File size estimate (`size / 2KB`) |
2506
+
2507
+ **Setup (Automatic):**
2508
+
2509
+ Run `npx claude-flow@v3alpha init` — this generates `.claude/settings.json` with the correct statusline config and creates the helper script at `.claude/helpers/statusline.cjs`.
2510
+
2511
+ The generated config uses a **fast local script** (no `npx` cold-start):
2512
+ ```json
2513
+ {
2514
+ "statusLine": {
2515
+ "type": "command",
2516
+ "command": "node .claude/helpers/statusline.cjs"
2517
+ }
2518
+ }
2519
+ ```
2436
2520
 
2437
- # Legacy multi-line (original behavior, may have bleeding)
2438
- npx ruflo@v3alpha hooks statusline --legacy
2521
+ > **Note:** Only `type`, `command`, and `padding` are valid statusLine fields. Do not add `refreshMs`, `enabled`, or other fields — Claude Code will ignore them.
2439
2522
 
2440
- # JSON output for scripting
2441
- npx ruflo@v3alpha hooks statusline --json
2523
+ **For Existing Users:**
2442
2524
 
2443
- # Compact JSON (single line)
2444
- npx ruflo@v3alpha hooks statusline --compact
2525
+ If your statusline is not updating, run the upgrade command to regenerate helpers and fix the config:
2526
+ ```bash
2527
+ npx claude-flow@v3alpha init --update --settings
2445
2528
  ```
2446
2529
 
2447
- **Collision Zone Fix (Issue #985):**
2530
+ This removes invalid config fields and regenerates the statusline helper with stdin support.
2448
2531
 
2449
- Claude Code writes internal status (e.g., `7s • 1p`) at absolute terminal coordinates (columns 15-25 on the second-to-last line). The safe mode pads the collision line with spaces to push content past column 25, preventing character bleeding.
2450
-
2451
- | Option | Description |
2452
- |--------|-------------|
2453
- | (default) | Safe multi-line with collision zone avoidance |
2454
- | `--single` | Single-line output (complete collision avoidance) |
2455
- | `--legacy` | Original multi-line (may cause bleeding) |
2456
- | `--json` | JSON output with pretty printing |
2457
- | `--compact` | JSON output without formatting |
2532
+ **Stdin JSON Protocol:**
2458
2533
 
2459
- **Claude Code Integration:**
2460
-
2461
- Add to `.claude/settings.json`:
2534
+ Claude Code provides session data via stdin in this format:
2462
2535
  ```json
2463
2536
  {
2464
- "statusLine": {
2465
- "type": "command",
2466
- "command": "npx ruflo@v3alpha hooks statusline --single"
2467
- }
2537
+ "model": { "display_name": "Opus 4.6" },
2538
+ "context_window": { "used_percentage": 42, "remaining_percentage": 58 },
2539
+ "cost": { "total_cost_usd": 0.15, "total_duration_ms": 45000 },
2540
+ "workspace": { "current_dir": "/path/to/project" },
2541
+ "session_id": "abc-123"
2468
2542
  }
2469
2543
  ```
2470
2544
 
2545
+ The statusline script reads stdin synchronously, falls back to local detection when run manually (TTY mode).
2546
+
2471
2547
  **Data Sources:**
2472
- - `.ruflo/metrics/v3-progress.json` - DDD domain progress
2473
- - `.ruflo/metrics/swarm-activity.json` - Active agent counts
2474
- - `.ruflo/security/audit-status.json` - CVE remediation status
2475
- - `.ruflo/learning/patterns.db` - Intelligence score (pattern count)
2476
- - Process detection via `ps aux` - Real-time memory and agent counts
2548
+ - **Stdin JSON** Model name, context %, cost, duration (from Claude Code)
2549
+ - `.claude-flow/metrics/v3-progress.json` DDD domain progress
2550
+ - `.claude-flow/metrics/swarm-activity.json` Active agent counts
2551
+ - `.claude-flow/security/audit-status.json` CVE remediation status
2552
+ - **AgentDB files** Vector count (estimated from file size), HNSW index status
2553
+ - Process detection via `ps aux` — Real-time memory and agent counts
2477
2554
  - Git branch via `git branch --show-current`
2478
2555
  - GitHub user via `gh api user`
2479
2556
 
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAiC,MAAM,aAAa,CAAC;AAyzI1E,eAAO,MAAM,YAAY,EAAE,OAyG1B,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAiC,MAAM,aAAa,CAAC;AA6zI1E,eAAO,MAAM,YAAY,EAAE,OAyG1B,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -915,13 +915,14 @@ const metricsCommand = {
915
915
  ]
916
916
  });
917
917
  if (v3Dashboard && result.performance) {
918
+ const p = result.performance;
918
919
  output.writeln();
919
920
  output.writeln(output.bold('🚀 V3 Performance Gains'));
920
921
  output.printList([
921
- `Flash Attention: ${output.success(result.performance.flashAttention)}`,
922
- `Memory Reduction: ${output.success(result.performance.memoryReduction)}`,
923
- `Search Improvement: ${output.success(result.performance.searchImprovement)}`,
924
- `Token Reduction: ${output.success(result.performance.tokenReduction)}`
922
+ `Flash Attention: ${output.success(p.flashAttention ?? 'N/A')}`,
923
+ `Memory Reduction: ${output.success(p.memoryReduction ?? 'N/A')}`,
924
+ `Search Improvement: ${output.success(p.searchImprovement ?? 'N/A')}`,
925
+ `Token Reduction: ${output.success(p.tokenReduction ?? 'N/A')}`
925
926
  ]);
926
927
  }
927
928
  return { success: true, data: result };
@@ -1719,15 +1720,18 @@ const intelligenceCommand = {
1719
1720
  output.writeln(output.dim(' Not initialized'));
1720
1721
  }
1721
1722
  // V3 Performance
1722
- output.writeln();
1723
- output.writeln(output.bold('🚀 V3 Performance Gains'));
1724
- output.printList([
1725
- `Flash Attention: ${output.success(result.performance.flashAttention)}`,
1726
- `Memory Reduction: ${output.success(result.performance.memoryReduction)}`,
1727
- `Search Improvement: ${output.success(result.performance.searchImprovement)}`,
1728
- `Token Reduction: ${output.success(result.performance.tokenReduction)}`,
1729
- `SWE-Bench Score: ${output.success(result.performance.sweBenchScore)}`
1730
- ]);
1723
+ const perf = result.performance;
1724
+ if (perf) {
1725
+ output.writeln();
1726
+ output.writeln(output.bold('🚀 V3 Performance Gains'));
1727
+ output.printList([
1728
+ `Flash Attention: ${output.success(perf.flashAttention ?? 'N/A')}`,
1729
+ `Memory Reduction: ${output.success(perf.memoryReduction ?? 'N/A')}`,
1730
+ `Search Improvement: ${output.success(perf.searchImprovement ?? 'N/A')}`,
1731
+ `Token Reduction: ${output.success(perf.tokenReduction ?? 'N/A')}`,
1732
+ `SWE-Bench Score: ${output.success(perf.sweBenchScore ?? 'N/A')}`
1733
+ ]);
1734
+ }
1731
1735
  return { success: true, data: result };
1732
1736
  }
1733
1737
  catch (error) {