claude-flow 3.25.5 → 3.25.6

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.
@@ -1 +1 @@
1
- 3.25.4
1
+ 3.23.0
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "manifest": {
3
- "version": "3.25.4",
3
+ "version": "3.23.0",
4
4
  "files": {
5
5
  "auto-memory-hook.mjs": "68be7e9a9eba7bf9c4e8a230db7bf61a243b965639f8504842799d6c6ca28762",
6
6
  "hook-handler.cjs": "bc4d2d26823d49b3ab1dded2946b66369f1f67bd76b4c30dca9f3b6df3cca8f0",
7
- "intelligence.cjs": "bd1f8e4b034944aee1df0391dc47ac2e8cc4b3aa542c65407a59d49620bbf76b"
7
+ "intelligence.cjs": "760cb82ed2000031abc1ac1fa90a014e7d91d93966e3aa4741b07ab7aff8d066"
8
8
  }
9
9
  },
10
- "signature": "F3TIRoNcQTCkNeMEk5Isah5CWkV/zddUKR/6pieOlAWoYgI2BEUO7avQj8B8UP4vhvgT9TSgbYsis2UnnnQyBg==",
10
+ "signature": "of5l9RP68iPcmcC5dckDv+KIOiENJKifWxYKwQTwAiXiyRNNZuMwQ8y8Bd8+wGviTRxIzBfSuxL1nuJ/rX3xDQ==",
11
11
  "algorithm": "ed25519"
12
12
  }
@@ -587,16 +587,6 @@ function recordEdit(file, success) {
587
587
  sessionId: sessionGet('sessionId') || null,
588
588
  });
589
589
  fs.appendFileSync(PENDING_PATH, entry + '\n', 'utf-8');
590
- // Runaway-storage guard: pending-insights is append-only and only drained by
591
- // consolidation. If it grows past ~512KB (thousands of un-consolidated edits
592
- // — e.g. the daemon never ran), keep only the most recent 2000 lines so it
593
- // can never grow unbounded. Cheap (a statSync per edit; rewrite only when over).
594
- try {
595
- if (fs.statSync(PENDING_PATH).size > 512 * 1024) {
596
- const lines = fs.readFileSync(PENDING_PATH, 'utf-8').split('\n').filter(Boolean);
597
- if (lines.length > 2000) fs.writeFileSync(PENDING_PATH, lines.slice(-2000).join('\n') + '\n', 'utf-8');
598
- }
599
- } catch (e) { /* non-fatal */ }
600
590
  }
601
591
 
602
592
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "3.25.5",
3
+ "version": "3.25.6",
4
4
  "description": "Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -442,53 +442,98 @@ async function checkMcpServers() {
442
442
  '.mcp.json',
443
443
  ];
444
444
  const isRufloKey = (k) => k === 'ruflo' || k === 'ruflo_alpha' || k === 'claude-flow' || k === 'claude-flow_alpha';
445
+ // Canonical MCP-server key is `claude-flow` — matches the `mcp__claude-flow__*`
446
+ // prefix that ~166 plugin tool references depend on (#2206). A `ruflo`-keyed
447
+ // entry pointing at the same binary is the legacy duplicate created by
448
+ // pre-rename setup docs that #2612 tracks; doctor treats it as removable.
449
+ const isCurrentRufloKey = (k) => k === 'claude-flow' || k === 'claude-flow_alpha';
450
+ const isLegacyRufloKey = (k) => k === 'ruflo' || k === 'ruflo_alpha';
451
+ const isRufloServer = (server) => {
452
+ if (!server || typeof server !== 'object')
453
+ return false;
454
+ const entry = server;
455
+ const command = typeof entry.command === 'string' ? entry.command : '';
456
+ const args = Array.isArray(entry.args)
457
+ ? entry.args.filter((arg) => typeof arg === 'string')
458
+ : [];
459
+ const haystack = [command, ...args].join(' ');
460
+ return /\b(?:ruflo|claude-flow|@claude-flow\/cli)(?:@[\w.-]+)?\b/.test(haystack);
461
+ };
462
+ let totalServersSeen = 0;
463
+ const rufloLocations = [];
464
+ const duplicateLocations = [];
465
+ const legacyLocations = [];
466
+ const currentLocations = [];
467
+ const inspectServers = (servers, location) => {
468
+ if (!servers || typeof servers !== 'object')
469
+ return { total: 0, hasRuflo: false };
470
+ const entries = Object.entries(servers);
471
+ const activeRufloEntries = entries.filter(([key, server]) => isRufloKey(key) && isRufloServer(server));
472
+ const hasLegacy = activeRufloEntries.some(([key]) => isLegacyRufloKey(key));
473
+ const hasCurrent = activeRufloEntries.some(([key]) => isCurrentRufloKey(key));
474
+ if (activeRufloEntries.length > 0) {
475
+ rufloLocations.push(`${location}: ${activeRufloEntries.map(([key]) => key).join(', ')}`);
476
+ }
477
+ if (hasLegacy && hasCurrent) {
478
+ duplicateLocations.push(`${location}: ${activeRufloEntries.map(([key]) => key).join(' + ')}`);
479
+ }
480
+ for (const [key] of activeRufloEntries) {
481
+ if (isLegacyRufloKey(key))
482
+ legacyLocations.push(`${location}: ${key}`);
483
+ if (isCurrentRufloKey(key))
484
+ currentLocations.push(`${location}: ${key}`);
485
+ }
486
+ return { total: entries.length, hasRuflo: activeRufloEntries.length > 0 };
487
+ };
445
488
  for (const configPath of mcpConfigPaths) {
446
489
  if (!existsSync(configPath))
447
490
  continue;
448
491
  try {
449
492
  const content = JSON.parse(readFileSync(configPath, 'utf8'));
450
493
  // Top-level mcpServers (legacy / desktop form)
451
- const topServers = content.mcpServers || content.servers || {};
452
- const topServerKeys = Object.keys(topServers);
453
- const topHasRuflo = topServerKeys.some(isRufloKey);
494
+ const topResult = inspectServers(content.mcpServers || content.servers || {}, `${configPath} top-level`);
495
+ totalServersSeen += topResult.total;
454
496
  // Project-scoped (Claude Code shape): projects[*].mcpServers.ruflo
455
- let projectHits = 0;
456
- let projectScannedServers = 0;
457
497
  if (content.projects && typeof content.projects === 'object') {
458
- for (const projectVal of Object.values(content.projects)) {
498
+ for (const [projectKey, projectVal] of Object.entries(content.projects)) {
459
499
  const pm = projectVal?.mcpServers;
460
500
  if (pm && typeof pm === 'object') {
461
- const keys = Object.keys(pm);
462
- projectScannedServers += keys.length;
463
- if (keys.some(isRufloKey))
464
- projectHits += 1;
501
+ const projectResult = inspectServers(pm, `${configPath} projects[${projectKey}]`);
502
+ totalServersSeen += projectResult.total;
465
503
  }
466
504
  }
467
505
  }
468
- const totalServers = topServerKeys.length + projectScannedServers;
469
- if (topHasRuflo || projectHits > 0) {
470
- const where = topHasRuflo
471
- ? 'top-level'
472
- : `${projectHits} project-scoped`;
473
- return {
474
- name: 'MCP Servers',
475
- status: 'pass',
476
- message: `${totalServers} servers (ruflo configured: ${where})`,
477
- };
478
- }
479
- if (totalServers > 0) {
480
- return {
481
- name: 'MCP Servers',
482
- status: 'warn',
483
- message: `${totalServers} servers (ruflo not found)`,
484
- fix: 'claude mcp add ruflo -- npx -y ruflo@latest mcp start',
485
- };
486
- }
487
506
  }
488
507
  catch {
489
508
  // continue to next path
490
509
  }
491
510
  }
511
+ if (duplicateLocations.length > 0 || (legacyLocations.length > 0 && currentLocations.length > 0)) {
512
+ const locations = duplicateLocations.length > 0
513
+ ? duplicateLocations.join('; ')
514
+ : `legacy ${legacyLocations.join('; ')} + current ${currentLocations.join('; ')}`;
515
+ return {
516
+ name: 'MCP Servers',
517
+ status: 'warn',
518
+ message: `Duplicate Ruflo MCP registrations found (${locations}) — Claude Code will start both tool schemas`,
519
+ fix: 'Remove the legacy `ruflo`-keyed MCP registration (pre-rename duplicate) and keep the canonical `claude-flow` entry: `claude mcp add claude-flow -- npx -y ruflo@latest mcp start`. The canonical key stays `claude-flow` so the ~166 `mcp__claude-flow__*` plugin tool references keep resolving (#2206).',
520
+ };
521
+ }
522
+ if (rufloLocations.length > 0) {
523
+ return {
524
+ name: 'MCP Servers',
525
+ status: 'pass',
526
+ message: `${totalServersSeen} servers (ruflo configured: ${rufloLocations.join('; ')})`,
527
+ };
528
+ }
529
+ if (totalServersSeen > 0) {
530
+ return {
531
+ name: 'MCP Servers',
532
+ status: 'warn',
533
+ message: `${totalServersSeen} servers (ruflo not found)`,
534
+ fix: 'claude mcp add claude-flow -- npx -y ruflo@latest mcp start',
535
+ };
536
+ }
492
537
  return {
493
538
  name: 'MCP Servers',
494
539
  status: 'warn',
@@ -807,7 +807,7 @@ async function writeSettings(targetDir, options, result) {
807
807
  * "same MCP server twice under two different prefixes" duplication the
808
808
  * issue describes.
809
809
  *
810
- * Returns the path of the file that already declares `ruflo` (so we can
810
+ * Returns the path of the file that already declares `ruflo`/`claude-flow` (so we can
811
811
  * surface it in the skipped-message), or null if none found.
812
812
  */
813
813
  function detectExistingRufloMCP(targetDir) {
@@ -840,10 +840,9 @@ function detectExistingRufloMCP(targetDir) {
840
840
  if (!parsed || typeof parsed !== 'object')
841
841
  continue;
842
842
  // (a) Top-level mcpServers (legacy / global form).
843
- // #2207: accept BOTH the old 'ruflo' key AND the new 'claude-flow' key so that
844
- // a prior install with either key is correctly detected as already-initialized.
845
- // This also avoids the reverse problem: after #2206 fixed the generator to write
846
- // 'claude-flow', a second `ruflo init` must still recognise the existing install.
843
+ // Accept BOTH names so init does not add a second server for the same
844
+ // binary when a project carries a pre-rename `claude-flow` registration
845
+ // and the current generator would write `ruflo` (#2612).
847
846
  if (parsed.mcpServers && typeof parsed.mcpServers === 'object') {
848
847
  const servers = parsed.mcpServers;
849
848
  // #2369: also recognise the legacy dist-tag keys generated by
@@ -859,10 +858,9 @@ function detectExistingRufloMCP(targetDir) {
859
858
  }
860
859
  // (b) #1840: Claude Code project-scoped registrations under
861
860
  // parsed.projects[<projectPath>].mcpServers. Match by
862
- // normalized path against targetDir or any of its ancestors so
863
- // a `claude mcp add claude-flow` (or legacy `ruflo`) in this repo is
861
+ // normalized path against targetDir or any of its ancestors so an
862
+ // existing `claude-flow` or `ruflo` registration in this repo is
864
863
  // detected even when Claude stored the key with different casing/slash style.
865
- // #2207: accept both keys here too.
866
864
  if (parsed.projects && typeof parsed.projects === 'object') {
867
865
  for (const [projectKey, projectVal] of Object.entries(parsed.projects)) {
868
866
  if (!projectVal || typeof projectVal !== 'object')
@@ -925,16 +923,18 @@ async function writeMCPConfig(targetDir, options, result) {
925
923
  result.skipped.push('.mcp.json');
926
924
  return;
927
925
  }
928
- // #1779 — Skip writing if the user already has a `ruflo`-keyed MCP
929
- // server registered elsewhere (parent .mcp.json, ~/.claude.json, etc).
930
- // Writing our `claude-flow`-keyed entry on top of that produces the
931
- // duplicate-registration the issue describes (~250 duplicate tools).
932
- // Force-mode (`--force`) bypasses this guard for users who actually
933
- // want both registrations.
926
+ // #1779/#2612 — Skip writing if the user already has this MCP server
927
+ // registered elsewhere (parent .mcp.json, ~/.claude.json, etc). The
928
+ // canonical key is `claude-flow` (per #2206 — matches mcp__claude-flow__*
929
+ // plugin tool refs); a stray `ruflo`-keyed entry pointing at the same
930
+ // binary is the legacy-duplicate form that #2612 healed. Writing our
931
+ // fresh `claude-flow` entry on top of either variant starts the same
932
+ // binary twice under two tool namespaces. Force-mode (`--force`)
933
+ // bypasses this guard for users who actually want both registrations.
934
934
  if (!options.force) {
935
935
  const existingRufloPath = detectExistingRufloMCP(targetDir);
936
936
  if (existingRufloPath) {
937
- result.skipped.push(`.mcp.json (existing 'ruflo' MCP registration found at ${existingRufloPath} — would create duplicate; pass --force to write anyway)`);
937
+ result.skipped.push(`.mcp.json (existing ruflo/claude-flow MCP registration found at ${existingRufloPath} — would create duplicate; pass --force to write anyway)`);
938
938
  return;
939
939
  }
940
940
  }
@@ -1880,7 +1880,7 @@ npx @claude-flow/cli@latest hive-mind consensus --propose "task"
1880
1880
  ### MCP Server Setup
1881
1881
  \`\`\`bash
1882
1882
  # Add Ruflo MCP
1883
- claude mcp add ruflo -- npx -y ruflo@latest
1883
+ claude mcp add ruflo -- npx -y ruflo@latest mcp start
1884
1884
 
1885
1885
  # Optional servers
1886
1886
  claude mcp add ruv-swarm -- npx -y ruv-swarm mcp start
@@ -40,10 +40,15 @@ export function generateMCPConfig(options) {
40
40
  const npmEnv = {
41
41
  npm_config_update_notifier: 'false',
42
42
  };
43
- // Ruflo MCP server (core) — uses ruflo wrapper for portable npm-resolved invocation.
44
- // #2206: key MUST be 'claude-flow' so all plugins resolve as mcp__claude-flow__*.
45
- // The command args (ruflo@latest mcp start) are the correct wrapper invocation — only the
46
- // registration KEY changes here.
43
+ // Ruflo MCP server (core) — the registration KEY is intentionally
44
+ // `claude-flow` (not `ruflo`) because #2206 established that all ~166
45
+ // plugin tool references use `mcp__claude-flow__*`. The invoked binary
46
+ // is `ruflo@latest` (the post-rename wrapper) — only the registration
47
+ // name stays legacy so plugin tool resolution keeps working.
48
+ // #2612 (duplicate `claude-flow` + `ruflo` registrations after users
49
+ // followed pre-rename setup docs) is healed by `ruflo doctor`, which
50
+ // detects the duplicate and instructs the operator to remove the
51
+ // extra `ruflo`-keyed entry — NOT by flipping the canonical key here.
47
52
  if (config.claudeFlow) {
48
53
  mcpServers['claude-flow'] = createMCPServerEntry(['ruflo@latest', 'mcp', 'start'], {
49
54
  ...npmEnv,
@@ -79,7 +84,7 @@ export function generateMCPCommands(options) {
79
84
  const config = options.mcp;
80
85
  if (isWindows()) {
81
86
  if (config.claudeFlow) {
82
- // #2206: registration name must be 'claude-flow' to match mcp__claude-flow__* tool naming
87
+ // #2206: registration name must be `claude-flow` to match mcp__claude-flow__* plugin tool references
83
88
  commands.push('claude mcp add claude-flow -- cmd /c npx -y ruflo@latest mcp start');
84
89
  }
85
90
  if (config.ruvSwarm) {
@@ -91,7 +96,7 @@ export function generateMCPCommands(options) {
91
96
  }
92
97
  else {
93
98
  if (config.claudeFlow) {
94
- // #2206: registration name must be 'claude-flow' to match mcp__claude-flow__* tool naming
99
+ // #2206: registration name must be `claude-flow` to match mcp__claude-flow__* plugin tool references
95
100
  commands.push("claude mcp add claude-flow -- npx -y ruflo@latest mcp start");
96
101
  }
97
102
  if (config.ruvSwarm) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.25.5",
3
+ "version": "3.25.6",
4
4
  "type": "module",
5
5
  "description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",
@@ -88,7 +88,10 @@
88
88
  "test": "vitest run",
89
89
  "test:plugin-store": "npx tsx src/plugins/tests/standalone-test.ts",
90
90
  "test:pattern-store": "npx tsx src/transfer/store/tests/standalone-test.ts",
91
- "postinstall": "node ./scripts/postinstall.cjs"
91
+ "postinstall": "node ./scripts/postinstall.cjs",
92
+ "prepublishOnly": "cp ../../../README.md ./README.md && rm -rf plugins && mkdir -p plugins && cp -r ../../../plugins/ruflo-metaharness plugins/ && node scripts/sign-helpers.mjs && node scripts/verify-helpers.mjs",
93
+ "release": "npm version prerelease --preid=alpha && npm run publish:all",
94
+ "publish:all": "./scripts/publish.sh"
92
95
  },
93
96
  "devDependencies": {
94
97
  "typescript": "^5.3.0",
package/v3/README.md ADDED
@@ -0,0 +1,493 @@
1
+ # Claude Flow V3
2
+
3
+ > **Modular AI Agent Coordination System** - A complete reimagining of Claude-Flow with 15-agent hierarchical mesh swarm coordination.
4
+
5
+ [![Version](https://img.shields.io/badge/version-3.0.0--alpha.1-blue.svg)](https://github.com/ruvnet/claude-flow)
6
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D20.0.0-green.svg)](https://nodejs.org/)
7
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.3+-blue.svg)](https://www.typescriptlang.org/)
8
+ [![License](https://img.shields.io/badge/license-MIT-purple.svg)](../LICENSE)
9
+
10
+ ## Introduction
11
+
12
+ Claude Flow V3 is a next-generation AI agent coordination system built on 10 Architecture Decision Records (ADRs). It provides a modular, security-first, high-performance platform for orchestrating multi-agent swarms with hierarchical mesh topology.
13
+
14
+ V3 represents a complete architectural overhaul:
15
+ - **10x faster testing** with Vitest
16
+ - **150x-12,500x faster search** with HNSW indexing
17
+ - **2.49x-7.47x Flash Attention speedup**
18
+ - **50-75% memory reduction**
19
+
20
+ ## Features
21
+
22
+ ### Core Capabilities
23
+
24
+ - **15-Agent Hierarchical Mesh** - Queen-led coordination with specialized worker agents
25
+ - **Domain-Driven Design** - Clean bounded contexts with separation of concerns
26
+ - **Plugin Architecture** - Microkernel pattern for extensibility
27
+ - **MCP-First API** - Consistent interfaces across all modules
28
+ - **Event Sourcing** - Full audit trail for state changes
29
+ - **Hybrid Memory Backend** - SQLite + AgentDB for optimal performance
30
+
31
+ ### Security
32
+
33
+ - **CVE Remediation** - All known vulnerabilities addressed
34
+ - **Input Validation** - Zod-based schema validation
35
+ - **Secure ID Generation** - Cryptographic random IDs
36
+ - **Path Security** - Traversal protection
37
+ - **SQL Injection Prevention** - Parameterized queries
38
+
39
+ ### Performance
40
+
41
+ | Metric | Target | Achieved |
42
+ |--------|--------|----------|
43
+ | Event Bus (100k events) | <50ms | ~6ms |
44
+ | Map Lookup (100k gets) | <20ms | ~16ms |
45
+ | Array.find vs Map O(1) | N/A | 978x speedup |
46
+ | Flash Attention | 2.49x-7.47x | Validated |
47
+ | AgentDB Search | 150x-12,500x | HNSW indexed |
48
+
49
+ ## Architecture
50
+
51
+ ### Architecture Decision Records (ADRs)
52
+
53
+ | ADR | Decision |
54
+ |-----|----------|
55
+ | ADR-001 | Adopt agentic-flow as core foundation |
56
+ | ADR-002 | Domain-Driven Design structure |
57
+ | ADR-003 | Single coordination engine (UnifiedSwarmCoordinator) |
58
+ | ADR-004 | Plugin-based architecture (microkernel) |
59
+ | ADR-005 | MCP-first API design |
60
+ | ADR-006 | Unified memory service (AgentDB) |
61
+ | ADR-007 | Event sourcing for state changes |
62
+ | ADR-008 | Vitest over Jest (10x faster) |
63
+ | ADR-009 | Hybrid memory backend default |
64
+ | ADR-010 | Remove Deno support (Node.js 20+ only) |
65
+
66
+ ### Module Architecture
67
+
68
+ ```
69
+ ┌─────────────────────────────────────────────────────────────────┐
70
+ │ @claude-flow/v3-monorepo │
71
+ ├─────────────────────────────────────────────────────────────────┤
72
+ │ │
73
+ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
74
+ │ │ security │ │ memory │ │ swarm │ │
75
+ │ │ CVE fixes │ │ AgentDB │ │ 15-agent │ │
76
+ │ │ validation │ │ HNSW │ │ coordination │ │
77
+ │ └──────────────┘ └──────────────┘ └──────────────┘ │
78
+ │ │
79
+ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
80
+ │ │ integration │ │ performance │ │ neural │ │
81
+ │ │ agentic-flow │ │ Flash Attn │ │ SONA │ │
82
+ │ │ bridge │ │ benchmarks │ │ learning │ │
83
+ │ └──────────────┘ └──────────────┘ └──────────────┘ │
84
+ │ │
85
+ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
86
+ │ │ cli │ │ testing │ │ deployment │ │
87
+ │ │ commands │ │ TDD London │ │ release │ │
88
+ │ │ prompts │ │ School │ │ CI/CD │ │
89
+ │ └──────────────┘ └──────────────┘ └──────────────┘ │
90
+ │ │
91
+ │ ┌─────────────────────────────────────────────────────────┐ │
92
+ │ │ shared │ │
93
+ │ │ types • events • core • hooks • resilience • plugins │ │
94
+ │ └─────────────────────────────────────────────────────────┘ │
95
+ │ │
96
+ └─────────────────────────────────────────────────────────────────┘
97
+ ```
98
+
99
+ ## Directory Structure
100
+
101
+ ```
102
+ v3/
103
+ ├── @claude-flow/ # Modular packages
104
+ │ ├── security/ # Security module
105
+ │ │ └── src/
106
+ │ │ ├── index.ts # Password hashing, validators
107
+ │ │ └── ...
108
+ │ │
109
+ │ ├── memory/ # Memory module
110
+ │ │ ├── src/
111
+ │ │ │ ├── agentdb-backend.ts # AgentDB integration
112
+ │ │ │ ├── hnsw-index.ts # HNSW vector indexing
113
+ │ │ │ ├── hybrid-backend.ts # SQLite + AgentDB
114
+ │ │ │ ├── sqlite-backend.ts # SQLite backend
115
+ │ │ │ ├── cache-manager.ts # Caching layer
116
+ │ │ │ └── domain/ # DDD entities
117
+ │ │ ├── benchmarks/ # Performance benchmarks
118
+ │ │ └── examples/ # Usage examples
119
+ │ │
120
+ │ ├── swarm/ # Swarm coordination
121
+ │ │ └── src/
122
+ │ │ ├── unified-coordinator.ts # Main coordinator
123
+ │ │ ├── topology-manager.ts # Topology management
124
+ │ │ ├── consensus/ # Consensus protocols
125
+ │ │ └── domain/ # DDD entities
126
+ │ │
127
+ │ ├── integration/ # agentic-flow integration
128
+ │ │ └── src/
129
+ │ │ ├── agentic-flow-bridge.ts # Core bridge
130
+ │ │ ├── agent-adapter.ts # Agent adaptation
131
+ │ │ └── sona-adapter.ts # SONA learning
132
+ │ │
133
+ │ ├── performance/ # Performance module
134
+ │ │ ├── src/
135
+ │ │ │ └── framework/ # Benchmark framework
136
+ │ │ └── benchmarks/
137
+ │ │ ├── startup/ # Startup benchmarks
138
+ │ │ └── attention/ # Flash Attention
139
+ │ │
140
+ │ ├── neural/ # Neural/SONA module
141
+ │ │ └── src/
142
+ │ │ ├── algorithms/ # Learning algorithms
143
+ │ │ └── modes/ # Neural modes
144
+ │ │
145
+ │ ├── cli/ # CLI module
146
+ │ │ ├── bin/ # Executable
147
+ │ │ └── src/
148
+ │ │ └── commands/ # Command handlers
149
+ │ │
150
+ │ ├── testing/ # Testing framework
151
+ │ │ └── src/
152
+ │ │ ├── fixtures/ # Test fixtures
153
+ │ │ ├── mocks/ # Mock services
154
+ │ │ ├── helpers/ # Test helpers
155
+ │ │ └── regression/ # Regression tests
156
+ │ │
157
+ │ ├── shared/ # Shared utilities
158
+ │ │ └── src/
159
+ │ │ ├── types/ # Shared types
160
+ │ │ ├── events/ # Event system
161
+ │ │ ├── core/ # Core interfaces
162
+ │ │ ├── hooks/ # Hook system
163
+ │ │ ├── resilience/ # Retry, circuit breaker
164
+ │ │ ├── plugins/ # Plugin system
165
+ │ │ └── security/ # Security utilities
166
+ │ │
167
+ │ └── deployment/ # Deployment module
168
+ │ └── src/ # Release management
169
+ │
170
+ ├── mcp/ # MCP Server
171
+ │ ├── server.ts # Main server
172
+ │ ├── tools/ # MCP tools
173
+ │ │ ├── agent-tools.ts
174
+ │ │ ├── swarm-tools.ts
175
+ │ │ ├── memory-tools.ts
176
+ │ │ └── hooks-tools.ts
177
+ │ └── transport/ # Transport layers
178
+ │ ├── stdio.ts
179
+ │ ├── http.ts
180
+ │ └── websocket.ts
181
+ │
182
+ ├── __tests__/ # Integration tests
183
+ │ └── integration/
184
+ │ ├── memory-integration.test.ts
185
+ │ ├── swarm-integration.test.ts
186
+ │ ├── mcp-integration.test.ts
187
+ │ └── workflow-integration.test.ts
188
+ │
189
+ ├── docs/ # Documentation
190
+ │ ├── README.md # Docs overview
191
+ │ ├── guides/ # User guides
192
+ │ └── implementation/ # Implementation details
193
+ │
194
+ ├── helpers/ # Cross-platform helpers
195
+ │ ├── claude-flow-v3.sh # Master helper (Linux/macOS)
196
+ │ ├── claude-flow-v3.ps1 # Master helper (Windows)
197
+ │ └── templates/ # Helper templates
198
+ │
199
+ ├── scripts/ # Utility scripts
200
+ │ └── quick-benchmark.mjs # Quick perf test
201
+ │
202
+ ├── index.ts # Main entry point
203
+ ├── swarm.config.ts # Swarm configuration
204
+ ├── vitest.config.ts # Test configuration
205
+ └── package.json # Monorepo package
206
+ ```
207
+
208
+ ## Modules
209
+
210
+ ### @claude-flow/security
211
+ Security-first implementation with CVE fixes, input validation, and credential management.
212
+
213
+ ```typescript
214
+ import { PasswordHasher, validateInput, sanitizePath } from '@claude-flow/security';
215
+
216
+ const hasher = new PasswordHasher();
217
+ const hash = await hasher.hash('password');
218
+ const valid = await hasher.verify('password', hash);
219
+ ```
220
+
221
+ ### @claude-flow/memory
222
+ Unified memory service with AgentDB, HNSW indexing, and 150x-12,500x faster search.
223
+
224
+ ```typescript
225
+ import { HybridMemoryRepository, HNSWIndex } from '@claude-flow/memory';
226
+
227
+ const memory = new HybridMemoryRepository({
228
+ backend: 'agentdb',
229
+ vectorSearch: true
230
+ });
231
+
232
+ await memory.store({ key: 'knowledge', value: 'context', embedding: [...] });
233
+ const results = await memory.search({ query: 'knowledge', limit: 10 });
234
+ ```
235
+
236
+ ### @claude-flow/swarm
237
+ 15-agent hierarchical mesh coordination with consensus protocols.
238
+
239
+ ```typescript
240
+ import { UnifiedSwarmCoordinator } from '@claude-flow/swarm';
241
+
242
+ const coordinator = new UnifiedSwarmCoordinator({
243
+ topology: 'hierarchical-mesh',
244
+ maxAgents: 15
245
+ });
246
+
247
+ await coordinator.initialize();
248
+ await coordinator.spawnAgent({ type: 'queen-coordinator' });
249
+ ```
250
+
251
+ ### @claude-flow/integration
252
+ Deep integration with agentic-flow@alpha per ADR-001.
253
+
254
+ ```typescript
255
+ import { AgenticFlowBridge } from '@claude-flow/integration';
256
+
257
+ const bridge = new AgenticFlowBridge();
258
+ await bridge.initialize();
259
+ const agent = await bridge.createAgent({ type: 'coder' });
260
+ ```
261
+
262
+ ### @claude-flow/performance
263
+ Benchmarking framework with Flash Attention validation.
264
+
265
+ ```typescript
266
+ import { BenchmarkRunner, formatTime } from '@claude-flow/performance';
267
+
268
+ const runner = new BenchmarkRunner();
269
+ const result = await runner.run('map-lookup', () => map.get(key), {
270
+ iterations: 100000,
271
+ targetTime: 20
272
+ });
273
+ ```
274
+
275
+ ### @claude-flow/neural
276
+ SONA learning integration for self-optimizing agents.
277
+
278
+ ```typescript
279
+ import { SONAAdapter } from '@claude-flow/neural';
280
+
281
+ const sona = new SONAAdapter();
282
+ await sona.train({ patterns: learningData });
283
+ const prediction = await sona.predict(context);
284
+ ```
285
+
286
+ ### @claude-flow/cli
287
+ Modern CLI with interactive prompts and formatted output.
288
+
289
+ ```bash
290
+ npx @claude-flow/cli swarm init --topology hierarchical-mesh
291
+ npx @claude-flow/cli agent spawn --type queen-coordinator
292
+ npx @claude-flow/cli memory search "knowledge"
293
+ ```
294
+
295
+ ### @claude-flow/testing
296
+ TDD London School framework with mocks, fixtures, and regression testing.
297
+
298
+ ```typescript
299
+ import { createMockAgent, createTestFixture } from '@claude-flow/testing';
300
+
301
+ const mockAgent = createMockAgent({ type: 'coder' });
302
+ const fixture = createTestFixture('swarm-coordination');
303
+ ```
304
+
305
+ ### @claude-flow/shared
306
+ Common types, events, utilities, and core interfaces.
307
+
308
+ ```typescript
309
+ import { EventBus, Result, success, failure } from '@claude-flow/shared';
310
+ import type { AgentId, TaskStatus } from '@claude-flow/shared/types';
311
+ ```
312
+
313
+ ### @claude-flow/deployment
314
+ Release management and CI/CD automation.
315
+
316
+ ```typescript
317
+ import { ReleaseManager } from '@claude-flow/deployment';
318
+
319
+ const release = new ReleaseManager();
320
+ await release.prepare({ version: '3.0.0', changelog: '...' });
321
+ ```
322
+
323
+ ## Usage
324
+
325
+ ### Quick Start
326
+
327
+ ```typescript
328
+ import { initializeV3Swarm } from '@claude-flow/v3';
329
+
330
+ // Initialize the swarm
331
+ const swarm = await initializeV3Swarm();
332
+
333
+ // Spawn agents
334
+ await swarm.spawnAllAgents();
335
+
336
+ // Submit a task
337
+ const task = swarm.submitTask({
338
+ type: 'implementation',
339
+ title: 'Implement feature X',
340
+ description: 'Detailed description...',
341
+ domain: 'core',
342
+ phase: 'phase-2-core',
343
+ priority: 'high'
344
+ });
345
+
346
+ // Wait for completion
347
+ const result = await swarm.waitForTask(task.id);
348
+ ```
349
+
350
+ ### Import Specific Modules
351
+
352
+ ```typescript
353
+ // Import everything
354
+ import * as claudeFlow from '@claude-flow/v3';
355
+
356
+ // Or import specific modules for tree-shaking
357
+ import { UnifiedSwarmCoordinator } from '@claude-flow/swarm';
358
+ import { PasswordHasher } from '@claude-flow/security';
359
+ import { HNSWIndex } from '@claude-flow/memory';
360
+ ```
361
+
362
+ ### MCP Server
363
+
364
+ ```typescript
365
+ import { createMCPServer } from '@claude-flow/v3/mcp';
366
+
367
+ const server = createMCPServer({
368
+ transport: 'stdio',
369
+ tools: ['agent', 'swarm', 'memory', 'hooks']
370
+ });
371
+
372
+ await server.start();
373
+ ```
374
+
375
+ ## Helper System
376
+
377
+ Cross-platform automation for V3 development:
378
+
379
+ ```bash
380
+ # Linux/macOS
381
+ ./helpers/claude-flow-v3.sh init
382
+ ./helpers/claude-flow-v3.sh status
383
+ ./helpers/claude-flow-v3.sh update domain 3
384
+
385
+ # Windows (PowerShell)
386
+ .\helpers\claude-flow-v3.ps1 init
387
+ .\helpers\claude-flow-v3.ps1 status
388
+ .\helpers\claude-flow-v3.ps1 update domain 3
389
+ ```
390
+
391
+ Features:
392
+ - **Progress Tracking**: Real-time domain/agent/performance metrics
393
+ - **Checkpointing**: Auto-commit with development milestones
394
+ - **Validation**: Environment and configuration verification
395
+ - **GitHub Integration**: PR management and issue tracking
396
+
397
+ ## Installation
398
+
399
+ ```bash
400
+ # Clone the repository
401
+ git clone https://github.com/ruvnet/claude-flow.git
402
+ cd claude-flow/v3
403
+
404
+ # Install dependencies
405
+ pnpm install
406
+
407
+ # Build all modules
408
+ pnpm build
409
+ ```
410
+
411
+ ## Testing
412
+
413
+ ```bash
414
+ # Run all tests
415
+ pnpm test
416
+
417
+ # Run integration tests
418
+ pnpm test:integration
419
+
420
+ # Run specific module tests
421
+ pnpm test:memory
422
+ pnpm test:swarm
423
+ pnpm test:security
424
+
425
+ # Run benchmarks
426
+ pnpm bench
427
+
428
+ # Quick benchmark (no dependencies)
429
+ node scripts/quick-benchmark.mjs
430
+
431
+ # Coverage report
432
+ pnpm test:coverage
433
+ ```
434
+
435
+ ## Performance Targets
436
+
437
+ | Category | Metric | Target |
438
+ |----------|--------|--------|
439
+ | **Search** | AgentDB HNSW | 150x-12,500x faster |
440
+ | **Attention** | Flash Attention | 2.49x-7.47x speedup |
441
+ | **Memory** | Reduction | 50-75% |
442
+ | **Code** | Total lines | <5,000 |
443
+ | **Startup** | Cold start | <500ms |
444
+ | **Learning** | SONA adaptation | <0.05ms |
445
+
446
+ ## Links
447
+
448
+ ### Documentation
449
+ - [Docs Overview](./docs/README.md)
450
+ - [Implementation Details](./docs/implementation/)
451
+ - [User Guides](./docs/guides/)
452
+ - [Helper System](./helpers/README.md)
453
+
454
+ ### Modules
455
+ - [@claude-flow/security](./@claude-flow/security/)
456
+ - [@claude-flow/memory](./@claude-flow/memory/)
457
+ - [@claude-flow/swarm](./@claude-flow/swarm/)
458
+ - [@claude-flow/integration](./@claude-flow/integration/)
459
+ - [@claude-flow/performance](./@claude-flow/performance/)
460
+ - [@claude-flow/neural](./@claude-flow/neural/)
461
+ - [@claude-flow/cli](./@claude-flow/cli/)
462
+ - [@claude-flow/testing](./@claude-flow/testing/)
463
+ - [@claude-flow/shared](./@claude-flow/shared/)
464
+ - [@claude-flow/deployment](./@claude-flow/deployment/)
465
+
466
+ ### Examples
467
+ - [AgentDB Example](./@claude-flow/memory/examples/agentdb-example.ts)
468
+ - [Cross-Platform Usage](./@claude-flow/memory/examples/cross-platform-usage.ts)
469
+
470
+ ### MCP Tools
471
+ - [Agent Tools](./mcp/tools/agent-tools.ts)
472
+ - [Swarm Tools](./mcp/tools/swarm-tools.ts)
473
+ - [Memory Tools](./mcp/tools/memory-tools.ts)
474
+ - [Hooks Tools](./mcp/tools/hooks-tools.ts)
475
+
476
+ ### External
477
+ - [GitHub Repository](https://github.com/ruvnet/claude-flow)
478
+ - [agentic-flow Integration](https://github.com/ruvnet/agentic-flow)
479
+ - [AgentDB](https://github.com/ruvnet/agentdb)
480
+
481
+ ## Requirements
482
+
483
+ - **Node.js**: >=20.0.0
484
+ - **pnpm**: >=8.0.0
485
+ - **TypeScript**: >=5.3.0
486
+
487
+ ## License
488
+
489
+ MIT License - See [LICENSE](../LICENSE) for details.
490
+
491
+ ---
492
+
493
+ **Built with the SPARC methodology and 15-agent hierarchical mesh coordination.**