claude-flow 3.56.8 → 3.56.10

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 (92) hide show
  1. package/.claude/.proven-config-version +1 -0
  2. package/.claude/helpers/hook-handler.cjs +109 -23
  3. package/.claude/helpers/intelligence.cjs +51 -9
  4. package/.claude/proven-config.json +42 -0
  5. package/.claude/skills/verification-quality/SKILL.md +14 -11
  6. package/README.md +1 -1
  7. package/node_modules/@claude-flow/codex/dist/cli.js +0 -0
  8. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts +1 -0
  9. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts.map +1 -1
  10. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js +3 -1
  11. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js.map +1 -1
  12. package/node_modules/@claude-flow/codex/dist/index.d.ts +3 -3
  13. package/node_modules/@claude-flow/codex/dist/index.js +1 -1
  14. package/node_modules/@claude-flow/codex/package.json +1 -1
  15. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +0 -0
  16. package/node_modules/@claude-flow/security/dist/input-validator.d.ts +6 -6
  17. package/node_modules/@claude-flow/security/dist/policy/envelope.js +6 -6
  18. package/node_modules/@claude-flow/security/dist/policy/envelope.js.map +1 -1
  19. package/node_modules/@claude-flow/security/package.json +1 -1
  20. package/package.json +5 -5
  21. package/v3/@claude-flow/cli/dist/src/autopilot-state.d.ts +2 -0
  22. package/v3/@claude-flow/cli/dist/src/autopilot-state.js +36 -8
  23. package/v3/@claude-flow/cli/dist/src/command-resolution.d.ts +15 -0
  24. package/v3/@claude-flow/cli/dist/src/command-resolution.js +25 -0
  25. package/v3/@claude-flow/cli/dist/src/commands/agent.js +17 -17
  26. package/v3/@claude-flow/cli/dist/src/commands/analyze.js +40 -29
  27. package/v3/@claude-flow/cli/dist/src/commands/claims.js +6 -8
  28. package/v3/@claude-flow/cli/dist/src/commands/daemon.js +86 -31
  29. package/v3/@claude-flow/cli/dist/src/commands/memory.js +14 -2
  30. package/v3/@claude-flow/cli/dist/src/commands/security-code-patterns.d.ts +2 -2
  31. package/v3/@claude-flow/cli/dist/src/commands/security-code-patterns.js +61 -3
  32. package/v3/@claude-flow/cli/dist/src/commands/security.d.ts +24 -0
  33. package/v3/@claude-flow/cli/dist/src/commands/security.js +81 -35
  34. package/v3/@claude-flow/cli/dist/src/commands/tui.d.ts +9 -0
  35. package/v3/@claude-flow/cli/dist/src/commands/tui.js +29 -3
  36. package/v3/@claude-flow/cli/dist/src/config/proven-config-refresh.d.ts +9 -0
  37. package/v3/@claude-flow/cli/dist/src/config/proven-config-refresh.js +24 -3
  38. package/v3/@claude-flow/cli/dist/src/funnel/local-signals.js +2 -1
  39. package/v3/@claude-flow/cli/dist/src/index.js +6 -42
  40. package/v3/@claude-flow/cli/dist/src/init/helpers-generator.js +109 -23
  41. package/v3/@claude-flow/cli/dist/src/init/types.js +1 -1
  42. package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-execute-core.d.ts +2 -0
  43. package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-execute-core.js +15 -0
  44. package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-health-metrics.d.ts +22 -0
  45. package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-health-metrics.js +33 -0
  46. package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-tools.js +45 -22
  47. package/v3/@claude-flow/cli/dist/src/mcp-tools/agentbbs-federation.d.ts +1 -1
  48. package/v3/@claude-flow/cli/dist/src/mcp-tools/agentbbs-federation.js +7 -2
  49. package/v3/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.js +25 -2
  50. package/v3/@claude-flow/cli/dist/src/mcp-tools/aidefence-known-misses.d.ts +22 -0
  51. package/v3/@claude-flow/cli/dist/src/mcp-tools/aidefence-known-misses.js +57 -0
  52. package/v3/@claude-flow/cli/dist/src/mcp-tools/analyze-tools.js +10 -11
  53. package/v3/@claude-flow/cli/dist/src/mcp-tools/autopilot-tools.js +2 -2
  54. package/v3/@claude-flow/cli/dist/src/mcp-tools/browser-intent-tools.js +6 -2
  55. package/v3/@claude-flow/cli/dist/src/mcp-tools/embeddings-tools.js +29 -7
  56. package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +4 -0
  57. package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +70 -20
  58. package/v3/@claude-flow/cli/dist/src/mcp-tools/neural-tools.js +28 -4
  59. package/v3/@claude-flow/cli/dist/src/mcp-tools/ruvllm-tools.js +6 -0
  60. package/v3/@claude-flow/cli/dist/src/mcp-tools/security-tools.js +55 -17
  61. package/v3/@claude-flow/cli/dist/src/mcp-tools/workflow-tools.js +66 -17
  62. package/v3/@claude-flow/cli/dist/src/memory/intelligence.d.ts +5 -1
  63. package/v3/@claude-flow/cli/dist/src/memory/intelligence.js +105 -29
  64. package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.js +10 -3
  65. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +2 -1
  66. package/v3/@claude-flow/cli/dist/src/memory/search-defaults.d.ts +54 -0
  67. package/v3/@claude-flow/cli/dist/src/memory/search-defaults.js +37 -0
  68. package/v3/@claude-flow/cli/dist/src/memory/sona-optimizer.d.ts +28 -0
  69. package/v3/@claude-flow/cli/dist/src/memory/sona-optimizer.js +59 -2
  70. package/v3/@claude-flow/cli/dist/src/mods/command-registry/schema.d.ts +24 -24
  71. package/v3/@claude-flow/cli/dist/src/parser.js +32 -22
  72. package/v3/@claude-flow/cli/dist/src/production/monitoring.d.ts +1 -0
  73. package/v3/@claude-flow/cli/dist/src/production/monitoring.js +19 -6
  74. package/v3/@claude-flow/cli/dist/src/production/rate-limiter.js +5 -4
  75. package/v3/@claude-flow/cli/dist/src/production/retry.js +3 -0
  76. package/v3/@claude-flow/cli/dist/src/ruvector/agent-wasm.d.ts +10 -0
  77. package/v3/@claude-flow/cli/dist/src/ruvector/agent-wasm.js +27 -1
  78. package/v3/@claude-flow/cli/dist/src/ruvector/diff-classifier.d.ts +2 -4
  79. package/v3/@claude-flow/cli/dist/src/ruvector/diff-classifier.js +202 -69
  80. package/v3/@claude-flow/cli/dist/src/ruvector/ruvllm-wasm.d.ts +4 -0
  81. package/v3/@claude-flow/cli/dist/src/ruvector/ruvllm-wasm.js +12 -1
  82. package/v3/@claude-flow/cli/dist/src/services/config-file-manager.js +3 -3
  83. package/v3/@claude-flow/cli/dist/src/services/policy-runtime.d.ts +1 -1
  84. package/v3/@claude-flow/cli/dist/src/services/policy-runtime.js +7 -1
  85. package/v3/@claude-flow/cli/dist/src/services/worker-daemon.d.ts +11 -0
  86. package/v3/@claude-flow/cli/dist/src/services/worker-daemon.js +37 -0
  87. package/v3/@claude-flow/cli/dist/src/transfer/store/discovery.js +16 -17
  88. package/v3/@claude-flow/cli/dist/src/transfer/store/types.d.ts +4 -0
  89. package/v3/@claude-flow/cli/package.json +7 -7
  90. package/v3/@claude-flow/shared/dist/resilience/rate-limiter.js +3 -3
  91. package/v3/@claude-flow/shared/dist/resilience/retry.js +3 -1
  92. package/v3/@claude-flow/shared/package.json +1 -1
@@ -316,6 +316,17 @@ export declare class WorkerDaemon extends EventEmitter {
316
316
  * Execute a worker with timeout protection
317
317
  */
318
318
  private executeWorker;
319
+ /**
320
+ * Feed a finished worker job into the self-learning pipeline as a one-step
321
+ * trajectory (SONA + ReasoningBank + @ruvector/ruvllm forwarding, persisted
322
+ * to `.claude-flow/neural/stats.json`). Before this, the daemon could run
323
+ * hundreds of jobs at "100% success" while `trajectoriesRecorded` stayed 0:
324
+ * no daemon code path ever called the intelligence module.
325
+ *
326
+ * Best-effort and bounded: never throws, never changes the WorkerResult.
327
+ * Opt-out: RUFLO_DAEMON_NO_LEARN=1.
328
+ */
329
+ private recordWorkerTrajectory;
319
330
  /**
320
331
  * Run a function with timeout (P1 fix)
321
332
  * @param fn - The async function to execute
@@ -75,6 +75,9 @@ const CONSOLIDATE_DEDUP_DISTANCE = 0.2;
75
75
  // `--no-distill` flag on `daemon start` (see commands/daemon.ts), which sets
76
76
  // this env var on the forked/foreground daemon process.
77
77
  const NO_DISTILL_ENV = 'RUFLO_DAEMON_NO_DISTILL';
78
+ // Opt-out for recording each finished worker job as a learning trajectory
79
+ // (see WorkerDaemon.recordWorkerTrajectory).
80
+ const NO_LEARN_ENV = 'RUFLO_DAEMON_NO_LEARN';
78
81
  // #2356 — Self-terminating lifecycle defaults. A background daemon with no
79
82
  // upper bound on its lifetime runs until the box reboots; in the field this
80
83
  // leaked tens of thousands of headless `claude --print` sweeps over many days
@@ -1234,6 +1237,7 @@ export class WorkerDaemon extends EventEmitter {
1234
1237
  this.emit('worker:complete', result);
1235
1238
  this.log('info', `Worker ${workerConfig.type} completed in ${durationMs}ms`);
1236
1239
  this.saveState();
1240
+ await this.recordWorkerTrajectory(result);
1237
1241
  return result;
1238
1242
  }
1239
1243
  catch (error) {
@@ -1253,6 +1257,7 @@ export class WorkerDaemon extends EventEmitter {
1253
1257
  this.emit('worker:error', result);
1254
1258
  this.log('error', `Worker ${workerConfig.type} failed: ${result.error}`);
1255
1259
  this.saveState();
1260
+ await this.recordWorkerTrajectory(result);
1256
1261
  return result;
1257
1262
  }
1258
1263
  finally {
@@ -1261,6 +1266,38 @@ export class WorkerDaemon extends EventEmitter {
1261
1266
  this.processPendingWorkers();
1262
1267
  }
1263
1268
  }
1269
+ /**
1270
+ * Feed a finished worker job into the self-learning pipeline as a one-step
1271
+ * trajectory (SONA + ReasoningBank + @ruvector/ruvllm forwarding, persisted
1272
+ * to `.claude-flow/neural/stats.json`). Before this, the daemon could run
1273
+ * hundreds of jobs at "100% success" while `trajectoriesRecorded` stayed 0:
1274
+ * no daemon code path ever called the intelligence module.
1275
+ *
1276
+ * Best-effort and bounded: never throws, never changes the WorkerResult.
1277
+ * Opt-out: RUFLO_DAEMON_NO_LEARN=1.
1278
+ */
1279
+ async recordWorkerTrajectory(result) {
1280
+ if (process.env[NO_LEARN_ENV] === '1')
1281
+ return;
1282
+ try {
1283
+ const intel = await import('../memory/intelligence.js');
1284
+ await intel.recordTrajectory([{
1285
+ type: 'result',
1286
+ // A worker error is free text (it can quote command output): keep only its first line, cut, so it cannot fill the learning store.
1287
+ content: `daemon worker ${result.type} ${result.success ? 'succeeded' : `failed: ${String(result.error ?? 'unknown error').split('\n')[0].slice(0, 200)}`}`,
1288
+ metadata: {
1289
+ source: 'worker-daemon',
1290
+ worker: result.type,
1291
+ success: result.success,
1292
+ durationMs: result.durationMs,
1293
+ },
1294
+ timestamp: Date.now(),
1295
+ }], result.success ? 'success' : 'failure');
1296
+ }
1297
+ catch (error) {
1298
+ this.log('warn', `Worker ${result.type}: trajectory recording skipped: ${error instanceof Error ? error.message : String(error)}`);
1299
+ }
1300
+ }
1264
1301
  /**
1265
1302
  * Run a function with timeout (P1 fix)
1266
1303
  * @param fn - The async function to execute
@@ -251,9 +251,12 @@ export class PatternDiscovery {
251
251
  * Get built-in genesis registry (always available offline)
252
252
  */
253
253
  getGenesisRegistry(cid) {
254
+ // #4157: this is an offline placeholder, so it claims nothing it cannot back: no
255
+ // verification, no signature, no popularity numbers, and fixed (not "now") dates.
254
256
  return {
257
+ source: 'builtin-fallback',
255
258
  version: '1.0.0',
256
- updatedAt: new Date().toISOString(),
259
+ updatedAt: '2026-01-08T18:42:31.126Z',
257
260
  ipnsName: 'k51qzi5uqu5dj0w8q1xvqn8ql2g4p7x8qpk9vz3xm1y2n3o4p5q6r7s8t9u0v',
258
261
  previousCid: undefined,
259
262
  patterns: [
@@ -269,25 +272,24 @@ export class PatternDiscovery {
269
272
  author: {
270
273
  id: 'claude-flow-team',
271
274
  displayName: 'Claude Flow Team',
272
- verified: true,
275
+ verified: false,
273
276
  patterns: 1,
274
- totalDownloads: 1000,
277
+ totalDownloads: 0,
275
278
  },
276
279
  license: 'MIT',
277
280
  categories: ['routing', 'coordination'],
278
281
  tags: ['genesis', 'foundational', 'routing', 'swarm', 'coordination', 'multi-agent', 'hello-world'],
279
282
  language: 'typescript',
280
283
  framework: 'claude-flow',
281
- downloads: 1000,
282
- rating: 5.0,
283
- ratingCount: 42,
284
- lastUpdated: new Date().toISOString(),
284
+ downloads: 0,
285
+ rating: 0,
286
+ ratingCount: 0,
287
+ lastUpdated: '2026-01-08T18:42:31.126Z',
285
288
  createdAt: '2026-01-08T18:42:31.126Z',
286
289
  minClaudeFlowVersion: '3.0.0',
287
- verified: true,
288
- trustLevel: 'verified',
289
- signature: 'ed25519:genesis-pattern-signature',
290
- publicKey: 'ed25519:claude-flow-team-key',
290
+ verified: false,
291
+ trustLevel: 'unverified',
292
+ source: 'builtin-fallback',
291
293
  },
292
294
  ],
293
295
  categories: [
@@ -301,20 +303,17 @@ export class PatternDiscovery {
301
303
  {
302
304
  id: 'claude-flow-team',
303
305
  displayName: 'Claude Flow Team',
304
- publicKey: 'ed25519:claude-flow-team-key',
305
- verified: true,
306
+ verified: false,
306
307
  patterns: 1,
307
- totalDownloads: 1000,
308
+ totalDownloads: 0,
308
309
  },
309
310
  ],
310
311
  totalPatterns: 1,
311
- totalDownloads: 1000,
312
+ totalDownloads: 0,
312
313
  totalAuthors: 1,
313
314
  featured: ['seraphine-genesis-v1'],
314
315
  trending: ['seraphine-genesis-v1'],
315
316
  newest: ['seraphine-genesis-v1'],
316
- registrySignature: crypto.randomBytes(32).toString('hex'),
317
- registryPublicKey: 'ed25519:claude-flow-registry-key',
318
317
  };
319
318
  }
320
319
  /**
@@ -32,6 +32,8 @@ export interface PatternEntry {
32
32
  trustLevel: TrustLevel;
33
33
  signature?: string;
34
34
  publicKey?: string;
35
+ /** Where the entry came from. 'builtin-fallback' = the offline placeholder, not live registry data (#4157). */
36
+ source?: 'registry' | 'builtin-fallback';
35
37
  }
36
38
  /**
37
39
  * Pattern author info
@@ -60,6 +62,8 @@ export interface PatternCategory {
60
62
  * Stored on IPFS with IPNS pointer for updates
61
63
  */
62
64
  export interface PatternRegistry {
65
+ /** 'builtin-fallback' when discovery could not reach a registry and used the offline placeholder (#4157). */
66
+ source?: 'registry' | 'builtin-fallback';
63
67
  version: string;
64
68
  updatedAt: string;
65
69
  ipnsName: string;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.56.8",
3
+ "version": "3.56.10",
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",
@@ -98,13 +98,13 @@
98
98
  "vitest": "^4.1.0"
99
99
  },
100
100
  "dependencies": {
101
- "@claude-flow/cli-core": "3.7.1",
102
- "@claude-flow/codex": "3.0.4",
101
+ "@claude-flow/cli-core": "3.7.3",
102
+ "@claude-flow/codex": "3.0.5",
103
103
  "@claude-flow/mcp": "3.1.1",
104
104
  "@claude-flow/neural": "3.0.0",
105
105
  "@claude-flow/plugin-agent-federation": "1.0.1",
106
- "@claude-flow/security": "3.0.4",
107
- "@claude-flow/shared": "3.0.4",
106
+ "@claude-flow/security": "3.0.5",
107
+ "@claude-flow/shared": "3.0.5",
108
108
  "@iarna/toml": "^2.2.5",
109
109
  "@noble/ed25519": "2.3.0",
110
110
  "@ruvector/rabitq-wasm": "0.1.0",
@@ -125,11 +125,11 @@
125
125
  "ws": "^8.21.0",
126
126
  "yaml": "^2.8.0",
127
127
  "zod": "^3.22.0",
128
- "@claude-flow/memory": "3.0.4"
128
+ "@claude-flow/memory": "3.0.5"
129
129
  },
130
130
  "optionalDependencies": {
131
131
  "@agntcy/slim-bindings": "2.0.0-alpha.5",
132
- "@claude-flow/memory": "3.0.4",
132
+ "@claude-flow/memory": "3.0.5",
133
133
  "@metaharness/darwin": "~0.10.2",
134
134
  "@metaharness/flywheel": "~0.1.10",
135
135
  "@metaharness/radio": "~0.1.0",
@@ -120,7 +120,7 @@ export class SlidingWindowRateLimiter {
120
120
  if (!entries)
121
121
  return;
122
122
  const cutoff = Date.now() - this.options.windowMs;
123
- const filtered = entries.filter((e) => e.timestamp >= cutoff);
123
+ const filtered = entries.filter((e) => e.timestamp > cutoff);
124
124
  if (filtered.length === 0) {
125
125
  this.requests.delete(key);
126
126
  }
@@ -190,7 +190,7 @@ export class TokenBucketRateLimiter {
190
190
  allowed: bucket.tokens >= 1,
191
191
  remaining: Math.floor(bucket.tokens),
192
192
  resetAt: new Date(bucket.lastRefill + this.options.windowMs),
193
- retryAfter: bucket.tokens >= 1 ? 0 : this.options.windowMs,
193
+ retryAfter: bucket.tokens >= 1 ? 0 : Math.max(0, bucket.lastRefill + this.options.windowMs - Date.now()),
194
194
  total: this.options.maxRequests,
195
195
  used: this.options.maxRequests - Math.floor(bucket.tokens),
196
196
  };
@@ -206,7 +206,7 @@ export class TokenBucketRateLimiter {
206
206
  allowed: false,
207
207
  remaining: 0,
208
208
  resetAt: new Date(bucket.lastRefill + this.options.windowMs),
209
- retryAfter: this.options.windowMs,
209
+ retryAfter: Math.max(0, bucket.lastRefill + this.options.windowMs - Date.now()),
210
210
  total: this.options.maxRequests,
211
211
  used: this.options.maxRequests,
212
212
  };
@@ -144,7 +144,9 @@ export const RetryableErrors = {
144
144
  /** Network errors (ECONNRESET, ETIMEDOUT, etc.) */
145
145
  network: (error) => {
146
146
  const networkCodes = ['ECONNRESET', 'ETIMEDOUT', 'ECONNREFUSED', 'ENOTFOUND', 'EAI_AGAIN'];
147
- return networkCodes.some((code) => error.message.includes(code));
147
+ const code = error.code;
148
+ return (typeof code === 'string' && networkCodes.includes(code)) ||
149
+ networkCodes.some((code) => error.message.includes(code));
148
150
  },
149
151
  /** Rate limit errors (429) */
150
152
  rateLimit: (error) => {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/shared",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "type": "module",
5
5
  "description": "Shared module - common types, events, utilities, core interfaces",
6
6
  "main": "dist/index.js",