@claude-flow/cli 3.32.40 → 3.32.41

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,6 +1,6 @@
1
1
  {
2
2
  "manifest": {
3
- "version": "3.32.40",
3
+ "version": "3.32.41",
4
4
  "files": {
5
5
  "auto-memory-hook.mjs": "68be7e9a9eba7bf9c4e8a230db7bf61a243b965639f8504842799d6c6ca28762",
6
6
  "hook-handler.cjs": "dae295fb9ae2626b89899c19a20cc911541af82b52d2eeb9b214d618b96e9a86",
@@ -8,6 +8,6 @@
8
8
  "statusline.cjs": "0457fe53f8cd2c56458ff178392536a5868efd1a573665fa43bc01d2d95ca677"
9
9
  }
10
10
  },
11
- "signature": "LKhT8u+7Osi/g/JGxIupJ26jkWtAi7RRh/RLPp/DplCdVEKcP6iTgWRYkBJ1flZNsAJGDkDpGfPbSWzLz3JcAg==",
11
+ "signature": "E9neB/wxzCHAXPsX8ICLwt7X02M0joPEtF9kqHMH6qBp6y0C5OblOxerCq/AOE+8UrtsA/utlCpnmdQL6iHqDw==",
12
12
  "algorithm": "ed25519"
13
13
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "adoptedAt": 1785415360835,
2
+ "adoptedAt": 1785428938153,
3
3
  "championId": "sha256:6141a8ea990c5063b77e090ae8f37f9c539d8aa8f58dcceb30f3a82f97e57319",
4
4
  "manifest": {
5
5
  "schema": "ruflo.proven-config/v1",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "generation": 4,
4
- "generatedAt": "2026-07-30T13:30:58.553Z",
5
- "gitSha": "76453115",
4
+ "generatedAt": "2026-07-30T16:29:15.655Z",
5
+ "gitSha": "48d532b4",
6
6
  "catalog": {
7
7
  "agents": 164,
8
8
  "tools": 397,
@@ -1387,6 +1387,16 @@ const transferFromProjectCommand = {
1387
1387
  minConfidence,
1388
1388
  mergeStrategy: 'keep-highest-confidence',
1389
1389
  });
1390
+ // #2859 — the handler reports success:false (no destination write
1391
+ // happened) when the source has no matching patterns at all. Surface
1392
+ // that honestly instead of claiming a transfer occurred.
1393
+ if (!result.success || typeof result.transferred === 'number') {
1394
+ spinner.fail(result.message ?? 'No patterns transferred');
1395
+ if (ctx.flags.format === 'json') {
1396
+ output.printJson(result);
1397
+ }
1398
+ return { success: false, exitCode: 1, data: result };
1399
+ }
1390
1400
  spinner.succeed(`Transferred ${result.transferred.total} patterns`);
1391
1401
  if (ctx.flags.format === 'json') {
1392
1402
  output.printJson(result);
@@ -1401,9 +1411,9 @@ const transferFromProjectCommand = {
1401
1411
  ],
1402
1412
  data: [
1403
1413
  { category: 'Total Transferred', count: output.success(String(result.transferred.total)) },
1404
- { category: 'Skipped (Low Confidence)', count: result.skipped.lowConfidence },
1405
- { category: 'Skipped (Duplicates)', count: result.skipped.duplicates },
1406
- { category: 'Skipped (Conflicts)', count: result.skipped.conflicts }
1414
+ { category: 'Skipped (Low Confidence)', count: result.skipped?.lowConfidence ?? 0 },
1415
+ { category: 'Skipped (Duplicates)', count: result.skipped?.duplicates ?? 0 },
1416
+ { category: 'Skipped (Conflicts)', count: result.skipped?.conflicts ?? 0 }
1407
1417
  ]
1408
1418
  });
1409
1419
  if (Object.keys(result.transferred.byType).length > 0) {
@@ -1417,11 +1427,19 @@ const transferFromProjectCommand = {
1417
1427
  data: Object.entries(result.transferred.byType).map(([type, count]) => ({ type, count }))
1418
1428
  });
1419
1429
  }
1420
- output.writeln();
1421
- output.printList([
1422
- `Avg Confidence: ${(result.stats.avgConfidence * 100).toFixed(1)}%`,
1423
- `Avg Age: ${result.stats.avgAge}`
1424
- ]);
1430
+ // #2865-style honesty: omit stats that have no real measured value
1431
+ // rather than showing a fabricated number.
1432
+ const statLines = [];
1433
+ if (result.stats?.avgConfidence != null) {
1434
+ statLines.push(`Avg Confidence: ${(result.stats.avgConfidence * 100).toFixed(1)}%`);
1435
+ }
1436
+ if (result.stats?.avgAgeDays != null) {
1437
+ statLines.push(`Avg Age: ${result.stats.avgAgeDays.toFixed(1)} days`);
1438
+ }
1439
+ if (statLines.length > 0) {
1440
+ output.writeln();
1441
+ output.printList(statLines);
1442
+ }
1425
1443
  return { success: true, data: result };
1426
1444
  }
1427
1445
  catch (error) {
@@ -2137,9 +2155,17 @@ const intelligenceCommand = {
2137
2155
  moe: {
2138
2156
  enabled: enableMoe,
2139
2157
  status: String(mcpMoe?.status ?? (hasLocalData ? 'active' : 'idle')),
2140
- expertsActive: Number(mcpMoe?.expertsActive ?? (hasLocalData ? 8 : 0)),
2141
- routingAccuracy: Number(mcpMoe?.routingAccuracy ?? (hasLocalData ? 0.82 : 0)),
2142
- loadBalance: Number(mcpMoe?.loadBalance ?? (hasLocalData ? 0.9 : 0)),
2158
+ // #2865 these three previously fell back to hardcoded
2159
+ // hasLocalData ? <constant> : 0 whenever the MCP tool didn't
2160
+ // report a real value, so "Routing Accuracy: 82.0%" displayed
2161
+ // on every project with local neural data regardless of actual
2162
+ // routing quality (measured 49% on a real store). None of these
2163
+ // three has a cheap, honest local substitute the way
2164
+ // `hooks metrics`' routingAccuracy falls back to averageConfidence,
2165
+ // so they are null (unmeasured) rather than a fabricated number.
2166
+ expertsActive: mcpMoe?.expertsActive == null ? null : Number(mcpMoe.expertsActive),
2167
+ routingAccuracy: mcpMoe?.routingAccuracy == null ? null : Number(mcpMoe.routingAccuracy),
2168
+ loadBalance: mcpMoe?.loadBalance == null ? null : Number(mcpMoe.loadBalance),
2143
2169
  },
2144
2170
  hnsw: {
2145
2171
  enabled: enableHnsw,
@@ -2235,9 +2261,11 @@ const intelligenceCommand = {
2235
2261
  ],
2236
2262
  data: [
2237
2263
  { metric: 'Status', value: formatIntelligenceStatus(moe.status) },
2238
- { metric: 'Active Experts', value: moe.expertsActive ?? 0 },
2239
- { metric: 'Routing Accuracy', value: `${((moe.routingAccuracy ?? 0) * 100).toFixed(1)}%` },
2240
- { metric: 'Load Balance', value: `${((moe.loadBalance ?? 0) * 100).toFixed(1)}%` }
2264
+ // #2865 omit rather than show a fabricated 0/0.0% when the
2265
+ // MCP tool hasn't reported a real value for these.
2266
+ ...(moe.expertsActive == null ? [] : [{ metric: 'Active Experts', value: moe.expertsActive }]),
2267
+ ...(moe.routingAccuracy == null ? [] : [{ metric: 'Routing Accuracy', value: `${(moe.routingAccuracy * 100).toFixed(1)}%` }]),
2268
+ ...(moe.loadBalance == null ? [] : [{ metric: 'Load Balance', value: `${(moe.loadBalance * 100).toFixed(1)}%` }]),
2241
2269
  ]
2242
2270
  });
2243
2271
  }
@@ -987,14 +987,20 @@ export const hooksRoute = {
987
987
  let agents;
988
988
  let confidence;
989
989
  let matchedPattern = '';
990
+ // Both static and learned patterns are gated on the same similarity
991
+ // score. Learned patterns additionally require support/reliability as a
992
+ // quality guard, but do NOT need a higher score bar — a learned pattern
993
+ // that outscores every static candidate must not lose to one anyway
994
+ // (#2864: a 25pp higher threshold made a top-scoring learned-researcher
995
+ // match at 0.57 lose to a static match at 0.52, discarding the learned
996
+ // store's output on the majority of routes).
990
997
  const eligibleSemantic = semanticResult.find((match) => {
991
998
  if (match.score <= 0.4)
992
999
  return false;
993
1000
  const learned = match.intent.startsWith('learned-') || match.metadata.source === 'learned';
994
1001
  if (!learned)
995
1002
  return true;
996
- return match.score >= 0.65
997
- && Number(match.metadata.support ?? 0) >= 2
1003
+ return Number(match.metadata.support ?? 0) >= 2
998
1004
  && Number(match.metadata.reliability ?? 0) >= 0.75;
999
1005
  });
1000
1006
  if (eligibleSemantic) {
@@ -1866,16 +1872,23 @@ export const hooksTransfer = {
1866
1872
  catch {
1867
1873
  // Fall back to empty store
1868
1874
  }
1869
- const sourceEntries = Object.values(sourceStore.entries);
1870
- // Count patterns by type from source
1871
- const byType = {
1872
- 'file-patterns': sourceEntries.filter(e => e.key.includes('file') || e.metadata?.type === 'file-pattern').length,
1873
- 'task-routing': sourceEntries.filter(e => e.key.includes('routing') || e.metadata?.type === 'routing').length,
1874
- 'command-risk': sourceEntries.filter(e => e.key.includes('command') || e.metadata?.type === 'command-risk').length,
1875
- 'agent-success': sourceEntries.filter(e => e.key.includes('agent') || e.metadata?.type === 'agent-success').length,
1875
+ const classifyType = (key, metadata) => {
1876
+ if (key.includes('file') || metadata?.type === 'file-pattern')
1877
+ return 'file-patterns';
1878
+ if (key.includes('routing') || metadata?.type === 'routing')
1879
+ return 'task-routing';
1880
+ if (key.includes('command') || metadata?.type === 'command-risk')
1881
+ return 'command-risk';
1882
+ if (key.includes('agent') || metadata?.type === 'agent-success')
1883
+ return 'agent-success';
1884
+ return null;
1876
1885
  };
1886
+ const candidates = Object.entries(sourceStore.entries)
1887
+ .map(([key, entry]) => ({ key, entry, type: classifyType(key, entry.metadata) }))
1888
+ .filter((c) => c.type !== null)
1889
+ .filter(c => !filter || c.type.includes(filter));
1877
1890
  // If source has no patterns, report honestly instead of substituting demo data
1878
- if (Object.values(byType).every(v => v === 0)) {
1891
+ if (candidates.length === 0) {
1879
1892
  return {
1880
1893
  success: false,
1881
1894
  message: 'No patterns found in source project',
@@ -1883,28 +1896,76 @@ export const hooksTransfer = {
1883
1896
  transferred: 0,
1884
1897
  };
1885
1898
  }
1886
- if (filter) {
1887
- Object.keys(byType).forEach(key => {
1888
- if (!key.includes(filter))
1889
- delete byType[key];
1890
- });
1899
+ // #2859 — this used to count source patterns, then invent skip counts
1900
+ // as fixed percentages of that count and a fixed avgConfidence/avgAge,
1901
+ // without ever reading or writing the destination store. An operator
1902
+ // could believe state moved between projects when nothing changed.
1903
+ // Perform a real merge: skip entries below the confidence threshold,
1904
+ // skip exact duplicates, skip real conflicts (destination already has
1905
+ // a different value for that key — never silently overwritten), and
1906
+ // actually write whatever remains into this project's own memory store.
1907
+ const destStore = loadMemoryStore();
1908
+ const byType = {};
1909
+ let lowConfidence = 0;
1910
+ let duplicates = 0;
1911
+ let conflicts = 0;
1912
+ let transferredCount = 0;
1913
+ let confidenceSum = 0;
1914
+ let confidenceCount = 0;
1915
+ let ageSumMs = 0;
1916
+ let ageCount = 0;
1917
+ const now = Date.now();
1918
+ for (const { key, entry, type } of candidates) {
1919
+ const confidenceRaw = entry.metadata?.confidence ?? entry.metadata?.reliability;
1920
+ const confidence = typeof confidenceRaw === 'number' ? confidenceRaw : undefined;
1921
+ if (confidence !== undefined && confidence < minConfidence) {
1922
+ lowConfidence++;
1923
+ continue;
1924
+ }
1925
+ const existing = destStore.entries[key];
1926
+ if (existing) {
1927
+ const same = JSON.stringify(existing.value) === JSON.stringify(entry.value);
1928
+ if (same) {
1929
+ duplicates++;
1930
+ continue;
1931
+ }
1932
+ conflicts++;
1933
+ continue;
1934
+ }
1935
+ destStore.entries[key] = entry;
1936
+ transferredCount++;
1937
+ byType[type] = (byType[type] ?? 0) + 1;
1938
+ if (confidence !== undefined) {
1939
+ confidenceSum += confidence;
1940
+ confidenceCount++;
1941
+ }
1942
+ const storedAtMs = Date.parse(entry.storedAt ?? '');
1943
+ if (!Number.isNaN(storedAtMs)) {
1944
+ ageSumMs += now - storedAtMs;
1945
+ ageCount++;
1946
+ }
1947
+ }
1948
+ if (transferredCount > 0) {
1949
+ const memDir = resolve(MEMORY_DIR);
1950
+ if (!existsSync(memDir))
1951
+ mkdirSync(memDir, { recursive: true });
1952
+ writeFileSync(getMemoryPath(), JSON.stringify(destStore, null, 2), 'utf-8');
1891
1953
  }
1892
- const total = Object.values(byType).reduce((a, b) => a + b, 0);
1893
1954
  return {
1894
1955
  success: true,
1895
1956
  sourcePath,
1896
1957
  transferred: {
1897
- total,
1958
+ total: transferredCount,
1898
1959
  byType,
1899
1960
  },
1900
1961
  skipped: {
1901
- lowConfidence: Math.floor(total * 0.15),
1902
- duplicates: Math.floor(total * 0.08),
1903
- conflicts: Math.floor(total * 0.03),
1962
+ lowConfidence,
1963
+ duplicates,
1964
+ conflicts,
1904
1965
  },
1905
1966
  stats: {
1906
- avgConfidence: 0.82 + (minConfidence > 0.8 ? 0.1 : 0),
1907
- avgAge: '3 days',
1967
+ avgConfidence: confidenceCount > 0 ? Number((confidenceSum / confidenceCount).toFixed(3)) : null,
1968
+ avgAgeDays: ageCount > 0 ? Number((ageSumMs / ageCount / 86_400_000).toFixed(1)) : null,
1908
1969
  },
1909
1970
  dataSource: 'source-project',
1910
1971
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.32.40",
3
+ "version": "3.32.41",
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",