claude-flow 3.6.9 → 3.6.11

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.
@@ -32,6 +32,7 @@ import { githubTools } from './mcp-tools/github-tools.js';
32
32
  import { daaTools } from './mcp-tools/daa-tools.js';
33
33
  import { coordinationTools } from './mcp-tools/coordination-tools.js';
34
34
  import { browserTools } from './mcp-tools/browser-tools.js';
35
+ import { execFileSync } from 'node:child_process';
35
36
  // Phase 6: AgentDB v3 controller tools
36
37
  import { agentdbTools } from './mcp-tools/agentdb-tools.js';
37
38
  // RuVector WASM tools
@@ -39,6 +40,20 @@ import { ruvllmWasmTools } from './mcp-tools/ruvllm-tools.js';
39
40
  import { wasmAgentTools } from './mcp-tools/wasm-agent-tools.js';
40
41
  import { guidanceTools } from './mcp-tools/guidance-tools.js';
41
42
  import { autopilotTools } from './mcp-tools/autopilot-tools.js';
43
+ // #1605: Only register browser tools if agent-browser is available
44
+ let _browserAvailable = null;
45
+ function getBrowserTools() {
46
+ if (_browserAvailable === null) {
47
+ try {
48
+ execFileSync('agent-browser', ['--version'], { stdio: 'ignore', timeout: 3000 });
49
+ _browserAvailable = true;
50
+ }
51
+ catch {
52
+ _browserAvailable = false;
53
+ }
54
+ }
55
+ return _browserAvailable ? browserTools : [];
56
+ }
42
57
  /**
43
58
  * MCP Tool Registry
44
59
  * Maps tool names to their handler functions
@@ -75,7 +90,7 @@ registerTools([
75
90
  ...githubTools,
76
91
  ...daaTools,
77
92
  ...coordinationTools,
78
- ...browserTools,
93
+ ...getBrowserTools(),
79
94
  // Phase 6: AgentDB v3 controller tools
80
95
  ...agentdbTools,
81
96
  // RuVector WASM tools
@@ -12,9 +12,10 @@
12
12
  import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from 'fs';
13
13
  import { join, resolve } from 'path';
14
14
  import { validateIdentifier } from './validate-input.js';
15
- // Paths
16
- const MEMORY_DIR = '.claude-flow/memory';
15
+ // #1604: Align with memory-initializer.ts — single source of truth is .swarm/memory.db
16
+ const MEMORY_DIR = '.swarm';
17
17
  const LEGACY_MEMORY_FILE = 'store.json';
18
+ const LEGACY_MEMORY_DIR = '.claude-flow/memory';
18
19
  const MIGRATION_MARKER = '.migrated-to-sqlite';
19
20
  function getMemoryDir() {
20
21
  return resolve(MEMORY_DIR);
@@ -55,11 +56,11 @@ function validateMemoryInput(key, value, query, namespace) {
55
56
  }
56
57
  }
57
58
  /**
58
- * Check if legacy JSON store exists and needs migration
59
+ * Check if legacy JSON store exists in old .claude-flow/memory/ location
59
60
  */
60
61
  function hasLegacyStore() {
61
- const legacyPath = getLegacyPath();
62
- const migrationMarker = getMigrationMarkerPath();
62
+ const legacyPath = resolve(join(LEGACY_MEMORY_DIR, LEGACY_MEMORY_FILE));
63
+ const migrationMarker = resolve(join(LEGACY_MEMORY_DIR, MIGRATION_MARKER));
63
64
  return existsSync(legacyPath) && !existsSync(migrationMarker);
64
65
  }
65
66
  /**
@@ -67,9 +68,9 @@ function hasLegacyStore() {
67
68
  */
68
69
  function loadLegacyStore() {
69
70
  try {
70
- const path = getLegacyPath();
71
- if (existsSync(path)) {
72
- const data = readFileSync(path, 'utf-8');
71
+ const legacyPath = resolve(join(LEGACY_MEMORY_DIR, LEGACY_MEMORY_FILE));
72
+ if (existsSync(legacyPath)) {
73
+ const data = readFileSync(legacyPath, 'utf-8');
73
74
  return JSON.parse(data);
74
75
  }
75
76
  }
@@ -82,8 +83,10 @@ function loadLegacyStore() {
82
83
  * Mark migration as complete
83
84
  */
84
85
  function markMigrationComplete() {
85
- ensureMemoryDir();
86
- writeFileSync(getMigrationMarkerPath(), JSON.stringify({
86
+ const legacyDir = resolve(LEGACY_MEMORY_DIR);
87
+ if (!existsSync(legacyDir))
88
+ mkdirSync(legacyDir, { recursive: true });
89
+ writeFileSync(resolve(join(LEGACY_MEMORY_DIR, MIGRATION_MARKER)), JSON.stringify({
87
90
  migratedAt: new Date().toISOString(),
88
91
  version: '3.0.0',
89
92
  }), 'utf-8');
@@ -104,41 +107,47 @@ async function getMemoryFunctions() {
104
107
  };
105
108
  }
106
109
  /**
107
- * Ensure memory database is initialized and migrate legacy data if needed
110
+ * Ensure memory database is initialized and migrate legacy data if needed.
111
+ * #1606: Wrapped in try/catch to prevent process-level crashes that kill
112
+ * the stdio MCP transport on Windows/Codex.
108
113
  */
109
114
  async function ensureInitialized() {
110
- const { initializeMemoryDatabase, checkMemoryInitialization, storeEntry } = await getMemoryFunctions();
111
- // Check if already initialized
112
- const status = await checkMemoryInitialization();
113
- if (!status.initialized) {
114
- await initializeMemoryDatabase({ force: false, verbose: false });
115
- }
116
- // Migrate legacy JSON data if exists
117
- if (hasLegacyStore()) {
118
- const legacyStore = loadLegacyStore();
119
- if (legacyStore && Object.keys(legacyStore.entries).length > 0) {
120
- console.error('[MCP Memory] Migrating legacy JSON store to sql.js...');
121
- let migrated = 0;
122
- for (const [key, entry] of Object.entries(legacyStore.entries)) {
123
- try {
124
- // Convert value to string for storage
125
- const value = typeof entry.value === 'string' ? entry.value : JSON.stringify(entry.value);
126
- await storeEntry({
127
- key,
128
- value,
129
- namespace: 'default',
130
- generateEmbeddingFlag: true,
131
- });
132
- migrated++;
133
- }
134
- catch (e) {
135
- console.error(`[MCP Memory] Failed to migrate key "${key}":`, e);
115
+ try {
116
+ const { initializeMemoryDatabase, checkMemoryInitialization, storeEntry } = await getMemoryFunctions();
117
+ // Check if already initialized
118
+ const status = await checkMemoryInitialization();
119
+ if (!status.initialized) {
120
+ await initializeMemoryDatabase({ force: false, verbose: false });
121
+ }
122
+ // Migrate legacy JSON data if exists (from old .claude-flow/memory/ location)
123
+ if (hasLegacyStore()) {
124
+ const legacyStore = loadLegacyStore();
125
+ if (legacyStore && Object.keys(legacyStore.entries).length > 0) {
126
+ console.error('[MCP Memory] Migrating legacy JSON store to sql.js...');
127
+ let migrated = 0;
128
+ for (const [key, entry] of Object.entries(legacyStore.entries)) {
129
+ try {
130
+ const value = typeof entry.value === 'string' ? entry.value : JSON.stringify(entry.value);
131
+ await storeEntry({
132
+ key,
133
+ value,
134
+ namespace: 'default',
135
+ generateEmbeddingFlag: true,
136
+ });
137
+ migrated++;
138
+ }
139
+ catch (e) {
140
+ console.error(`[MCP Memory] Failed to migrate key "${key}":`, e);
141
+ }
136
142
  }
143
+ console.error(`[MCP Memory] Migrated ${migrated}/${Object.keys(legacyStore.entries).length} entries`);
144
+ markMigrationComplete();
137
145
  }
138
- console.error(`[MCP Memory] Migrated ${migrated}/${Object.keys(legacyStore.entries).length} entries`);
139
- markMigrationComplete();
140
146
  }
141
147
  }
148
+ catch (error) {
149
+ console.error('[MCP Memory] Initialization failed:', error instanceof Error ? error.message : error);
150
+ }
142
151
  }
143
152
  export const memoryTools = [
144
153
  {
@@ -286,6 +295,7 @@ export const memoryTools = [
286
295
  namespace: { type: 'string', description: 'Namespace to search (default: "default")' },
287
296
  limit: { type: 'number', description: 'Maximum results (default: 10)' },
288
297
  threshold: { type: 'number', description: 'Minimum similarity threshold 0-1 (default: 0.3)' },
298
+ smart: { type: 'boolean', description: 'Enable SmartRetrieval pipeline — query expansion, RRF fusion, recency boost, MMR diversity (default: false)' },
289
299
  },
290
300
  required: ['query'],
291
301
  },
@@ -299,6 +309,57 @@ export const memoryTools = [
299
309
  validateMemoryInput(undefined, undefined, query);
300
310
  const startTime = performance.now();
301
311
  try {
312
+ if (input.smart) {
313
+ // SmartRetrieval pipeline (ADR-090)
314
+ const { smartSearch } = await import('@claude-flow/memory');
315
+ // Adapt searchEntries to the SearchFn interface
316
+ const rawSearch = async (req) => {
317
+ const r = await searchEntries({
318
+ query: req.query,
319
+ namespace: req.namespace || namespace,
320
+ limit: req.limit || limit * 3,
321
+ threshold: req.threshold ?? threshold,
322
+ });
323
+ return {
324
+ results: r.results.map(e => ({
325
+ id: e.id,
326
+ key: e.key,
327
+ content: e.content,
328
+ score: e.score,
329
+ namespace: e.namespace,
330
+ })),
331
+ };
332
+ };
333
+ const smartResult = await smartSearch(rawSearch, {
334
+ query,
335
+ namespace,
336
+ limit,
337
+ threshold,
338
+ });
339
+ const duration = performance.now() - startTime;
340
+ const results = smartResult.results.map(r => {
341
+ let value = r.content;
342
+ try {
343
+ value = JSON.parse(r.content);
344
+ }
345
+ catch { /* keep as string */ }
346
+ return {
347
+ key: r.key,
348
+ namespace: r.namespace,
349
+ value,
350
+ similarity: r.score,
351
+ };
352
+ });
353
+ return {
354
+ query,
355
+ results,
356
+ total: results.length,
357
+ searchTime: `${duration.toFixed(2)}ms`,
358
+ backend: 'SmartRetrieval (RRF + MMR + Recency)',
359
+ stats: smartResult.stats,
360
+ };
361
+ }
362
+ // Original non-smart path (unchanged)
302
363
  const result = await searchEntries({
303
364
  query,
304
365
  namespace,
@@ -183,6 +183,7 @@ export class PluginDiscoveryService {
183
183
  { id: 'devops', name: 'DevOps', description: 'CI/CD and deployment plugins', pluginCount: 1 },
184
184
  { id: 'integrations', name: 'Integrations', description: 'Third-party integrations', pluginCount: 2 },
185
185
  { id: 'agents', name: 'Agents', description: 'Custom agent types', pluginCount: 1 },
186
+ { id: 'iot', name: 'IoT', description: 'IoT device management and fleet orchestration', pluginCount: 1 },
186
187
  ],
187
188
  authors: [
188
189
  {
@@ -197,10 +198,10 @@ export class PluginDiscoveryService {
197
198
  totalPlugins: plugins.length,
198
199
  totalDownloads: plugins.reduce((sum, p) => sum + p.downloads, 0),
199
200
  totalAuthors: 1,
200
- featured: ['@claude-flow/plugin-agentic-qe', '@claude-flow/plugin-prime-radiant', '@claude-flow/security', '@claude-flow/claims', '@claude-flow/teammate-plugin'],
201
- trending: ['@claude-flow/plugin-agentic-qe', '@claude-flow/plugin-prime-radiant'],
202
- newest: ['@claude-flow/plugin-agentic-qe', '@claude-flow/plugin-prime-radiant'],
203
- official: ['@claude-flow/plugin-agentic-qe', '@claude-flow/plugin-prime-radiant', '@claude-flow/security', '@claude-flow/claims'],
201
+ featured: ['@claude-flow/plugin-iot-cognitum', '@claude-flow/plugin-agent-federation', '@claude-flow/plugin-agentic-qe', '@claude-flow/plugin-prime-radiant', '@claude-flow/security', '@claude-flow/claims', '@claude-flow/teammate-plugin'],
202
+ trending: ['@claude-flow/plugin-iot-cognitum', '@claude-flow/plugin-agent-federation', '@claude-flow/plugin-agentic-qe', '@claude-flow/plugin-prime-radiant'],
203
+ newest: ['@claude-flow/plugin-iot-cognitum', '@claude-flow/plugin-agent-federation', '@claude-flow/plugin-agentic-qe', '@claude-flow/plugin-prime-radiant'],
204
+ official: ['@claude-flow/plugin-iot-cognitum', '@claude-flow/plugin-agent-federation', '@claude-flow/plugin-agentic-qe', '@claude-flow/plugin-prime-radiant', '@claude-flow/security', '@claude-flow/claims'],
204
205
  compatibilityMatrix: [
205
206
  { pluginId: '@claude-flow/neural', pluginVersion: '3.0.0', claudeFlowVersions: ['3.x'], tested: true },
206
207
  { pluginId: '@claude-flow/security', pluginVersion: '3.0.0', claudeFlowVersions: ['3.x'], tested: true },
@@ -855,35 +856,6 @@ export class PluginDiscoveryService {
855
856
  verified: true,
856
857
  trustLevel: 'official',
857
858
  },
858
- {
859
- id: '@claude-flow/plugin-cognitive-kernel',
860
- name: '@claude-flow/plugin-cognitive-kernel',
861
- displayName: 'Cognitive Kernel',
862
- description: 'Core cognitive processing engine with working memory, attention mechanisms, and meta-cognitive monitoring.',
863
- version: '0.1.0',
864
- cid: 'bafybeicognitivekernelplugin2024',
865
- size: 295000,
866
- checksum: 'sha256:cognitivekernel2024xyz',
867
- author: officialAuthor,
868
- license: 'MIT',
869
- categories: ['ai-ml'],
870
- tags: ['cognitive', 'kernel', 'attention', 'memory', 'meta-cognition'],
871
- keywords: ['cognitive', 'kernel', 'attention'],
872
- downloads: 0,
873
- rating: 0,
874
- ratingCount: 0,
875
- lastUpdated: baseTime,
876
- createdAt: '2026-01-20T00:00:00Z',
877
- minClaudeFlowVersion: '3.0.0',
878
- dependencies: [{ name: '@claude-flow/core', version: '^3.0.0' }],
879
- type: 'core',
880
- hooks: ['cognitive:process', 'cognitive:attend'],
881
- commands: ['cognitive process', 'cognitive attend', 'cognitive monitor'],
882
- permissions: ['memory'],
883
- exports: ['CognitiveProcessor', 'AttentionMechanism', 'MetaCognitiveMonitor'],
884
- verified: true,
885
- trustLevel: 'official',
886
- },
887
859
  {
888
860
  id: '@claude-flow/plugin-quantum-optimizer',
889
861
  name: '@claude-flow/plugin-quantum-optimizer',
@@ -979,6 +951,83 @@ export class PluginDiscoveryService {
979
951
  issues: [],
980
952
  },
981
953
  },
954
+ // Agent Federation - Cross-installation agent collaboration
955
+ {
956
+ id: '@claude-flow/plugin-agent-federation',
957
+ name: '@claude-flow/plugin-agent-federation',
958
+ displayName: 'Agent Federation',
959
+ description: 'Cross-installation agent federation with zero-trust security, PII-gated data flow, 5-tier trust model, and HIPAA/SOC2/GDPR compliance. The comms layer for multi-agent AI.',
960
+ version: '1.0.0-alpha.1',
961
+ cid: 'bafybeifederationplugin2026',
962
+ size: 520000,
963
+ checksum: 'sha256:agentfederation2026xyz',
964
+ author: officialAuthor,
965
+ license: 'MIT',
966
+ categories: ['security', 'agents', 'integrations'],
967
+ tags: ['federation', 'trust', 'pii', 'mtls', 'zero-trust', 'compliance', 'hipaa', 'soc2', 'gdpr'],
968
+ keywords: ['federation', 'trust', 'security'],
969
+ downloads: 0,
970
+ rating: 0,
971
+ ratingCount: 0,
972
+ lastUpdated: baseTime,
973
+ createdAt: '2026-04-29T00:00:00Z',
974
+ minClaudeFlowVersion: '3.0.0',
975
+ dependencies: [{ name: '@claude-flow/security', version: '^3.0.0' }],
976
+ type: 'integration',
977
+ hooks: ['pre-federation-send', 'post-federation-receive', 'federation-audit', 'federation-trust-change'],
978
+ commands: ['federation init', 'federation join', 'federation leave', 'federation peers', 'federation status', 'federation audit', 'federation trust', 'federation config'],
979
+ permissions: ['network', 'memory', 'hooks', 'agents'],
980
+ exports: ['AgentFederationPlugin', 'PIIPipelineService', 'TrustEvaluator', 'FederationCoordinator', 'AuditService'],
981
+ verified: true,
982
+ trustLevel: 'official',
983
+ securityAudit: {
984
+ auditor: 'claude-flow-security-team',
985
+ auditDate: '2026-04-29T00:00:00Z',
986
+ auditVersion: '1.0.0-alpha.1',
987
+ passed: true,
988
+ issues: [],
989
+ },
990
+ },
991
+ // IoT Cognitum - Cognitum Seed device-agent bridge
992
+ {
993
+ id: '@claude-flow/plugin-iot-cognitum',
994
+ name: '@claude-flow/plugin-iot-cognitum',
995
+ displayName: 'IoT Cognitum',
996
+ description: 'Cognitum Seed device-agent bridge — treat every Seed as a Ruflo agent with 5-tier trust scoring, Ed25519 witness chains, mesh networking, and fleet management.',
997
+ version: '1.0.0-alpha.1',
998
+ cid: 'bafybeiiotcognitumplugin2026',
999
+ size: 340000,
1000
+ checksum: 'sha256:iotcognitum2026xyz',
1001
+ author: officialAuthor,
1002
+ license: 'MIT',
1003
+ categories: ['integrations', 'agents'],
1004
+ tags: ['iot', 'cognitum', 'seed', 'device', 'fleet', 'mesh', 'trust', 'witness', 'edge'],
1005
+ keywords: ['iot', 'cognitum', 'device', 'fleet'],
1006
+ downloads: 0,
1007
+ rating: 0,
1008
+ ratingCount: 0,
1009
+ lastUpdated: baseTime,
1010
+ createdAt: '2026-04-29T00:00:00Z',
1011
+ minClaudeFlowVersion: '3.0.0',
1012
+ dependencies: [
1013
+ { name: '@claude-flow/shared', version: '^3.0.0' },
1014
+ { name: '@cognitum-one/sdk', version: '^0.2.1' },
1015
+ ],
1016
+ type: 'integration',
1017
+ hooks: ['iot:device-registered', 'iot:trust-change', 'iot:device-offline', 'iot:device-online', 'iot:anomaly-detected', 'iot:mesh-partition', 'iot:firmware-mismatch', 'iot:witness-gap'],
1018
+ commands: ['iot init', 'iot register', 'iot status', 'iot list', 'iot remove', 'iot pair', 'iot unpair', 'iot query', 'iot ingest', 'iot mesh', 'iot witness', 'iot witness verify', 'iot fleet', 'iot fleet create', 'iot fleet list', 'iot fleet add', 'iot fleet remove', 'iot fleet delete', 'iot firmware deploy', 'iot firmware advance', 'iot firmware rollback', 'iot firmware status', 'iot firmware list', 'iot anomalies', 'iot baseline'],
1019
+ permissions: ['network', 'memory', 'hooks'],
1020
+ exports: ['IoTCognitumPlugin', 'IoTCoordinator', 'SeedClientFactory', 'HealthProbeWorker', 'TelemetryIngestWorker', 'AnomalyScanWorker', 'MeshSyncWorker', 'FirmwareWatchWorker', 'WitnessAuditWorker', 'AnomalyDetectionService', 'TelemetryIngestionService', 'FleetTopologyService', 'FirmwareOrchestrationService', 'WitnessVerificationService', 'SONAIntegrationService', 'AgentDBTelemetryRepository'],
1021
+ verified: true,
1022
+ trustLevel: 'official',
1023
+ securityAudit: {
1024
+ auditor: 'claude-flow-security-team',
1025
+ auditDate: '2026-04-29T00:00:00Z',
1026
+ auditVersion: '1.0.0-alpha.1',
1027
+ passed: true,
1028
+ issues: [],
1029
+ },
1030
+ },
982
1031
  // Teammate Plugin - Claude Code v2.1.19+ integration
983
1032
  {
984
1033
  id: '@claude-flow/teammate-plugin',
@@ -1047,11 +1096,14 @@ export class PluginDiscoveryService {
1047
1096
  '@claude-flow/plugin-perf-optimizer',
1048
1097
  // Advanced AI/reasoning plugins
1049
1098
  '@claude-flow/plugin-neural-coordination',
1050
- '@claude-flow/plugin-cognitive-kernel',
1051
1099
  '@claude-flow/plugin-quantum-optimizer',
1052
1100
  '@claude-flow/plugin-hyperbolic-reasoning',
1053
1101
  // Gas Town Bridge
1054
1102
  '@claude-flow/plugin-gastown-bridge',
1103
+ // Agent Federation
1104
+ '@claude-flow/plugin-agent-federation',
1105
+ // IoT Cognitum
1106
+ '@claude-flow/plugin-iot-cognitum',
1055
1107
  ];
1056
1108
  // Fetch stats in parallel
1057
1109
  const statsPromises = realNpmPackages.map(pkg => fetchNpmStats(pkg));
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.6.9",
3
+ "version": "3.6.11",
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",
@@ -13,7 +13,8 @@
13
13
  "./hooks": "./dist/hooks/index.js",
14
14
  "./mcp": "./dist/mcp/index.js",
15
15
  "./security": "./dist/security/index.js",
16
- "./resilience": "./dist/resilience/index.js"
16
+ "./resilience": "./dist/resilience/index.js",
17
+ "./src/plugin-interface.js": "./dist/plugin-interface.js"
17
18
  },
18
19
  "scripts": {
19
20
  "test": "vitest run",