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
@@ -159,14 +159,14 @@ export declare const SpawnAgentSchema: z.ZodObject<{
159
159
  timeout: z.ZodOptional<z.ZodNumber>;
160
160
  }, "strip", z.ZodTypeAny, {
161
161
  type: "coder" | "reviewer" | "tester" | "planner" | "researcher" | "security-architect" | "security-auditor" | "memory-specialist" | "swarm-specialist" | "integration-architect" | "performance-engineer" | "core-architect" | "test-architect" | "queen-coordinator" | "project-coordinator";
162
+ id?: string | undefined;
162
163
  config?: Record<string, unknown> | undefined;
163
164
  timeout?: number | undefined;
164
- id?: string | undefined;
165
165
  }, {
166
166
  type: "coder" | "reviewer" | "tester" | "planner" | "researcher" | "security-architect" | "security-auditor" | "memory-specialist" | "swarm-specialist" | "integration-architect" | "performance-engineer" | "core-architect" | "test-architect" | "queen-coordinator" | "project-coordinator";
167
+ id?: string | undefined;
167
168
  config?: Record<string, unknown> | undefined;
168
169
  timeout?: number | undefined;
169
- id?: string | undefined;
170
170
  }>;
171
171
  /**
172
172
  * Task input schema
@@ -181,13 +181,13 @@ export declare const TaskInputSchema: z.ZodObject<{
181
181
  taskId: string;
182
182
  content: string;
183
183
  agentType: "coder" | "reviewer" | "tester" | "planner" | "researcher" | "security-architect" | "security-auditor" | "memory-specialist" | "swarm-specialist" | "integration-architect" | "performance-engineer" | "core-architect" | "test-architect" | "queen-coordinator" | "project-coordinator";
184
- priority?: "critical" | "high" | "medium" | "low" | undefined;
184
+ priority?: "low" | "medium" | "high" | "critical" | undefined;
185
185
  metadata?: Record<string, unknown> | undefined;
186
186
  }, {
187
187
  taskId: string;
188
188
  content: string;
189
189
  agentType: "coder" | "reviewer" | "tester" | "planner" | "researcher" | "security-architect" | "security-auditor" | "memory-specialist" | "swarm-specialist" | "integration-architect" | "performance-engineer" | "core-architect" | "test-architect" | "queen-coordinator" | "project-coordinator";
190
- priority?: "critical" | "high" | "medium" | "low" | undefined;
190
+ priority?: "low" | "medium" | "high" | "critical" | undefined;
191
191
  metadata?: Record<string, unknown> | undefined;
192
192
  }>;
193
193
  /**
@@ -234,16 +234,16 @@ export declare const ExecutorConfigSchema: z.ZodObject<{
234
234
  cwd: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
235
235
  allowSudo: z.ZodDefault<z.ZodBoolean>;
236
236
  }, "strip", z.ZodTypeAny, {
237
- allowedCommands: string[];
238
237
  timeout: number;
238
+ allowedCommands: string[];
239
239
  maxBuffer: number;
240
240
  allowSudo: boolean;
241
241
  blockedPatterns?: string[] | undefined;
242
242
  cwd?: string | undefined;
243
243
  }, {
244
244
  allowedCommands: string[];
245
- blockedPatterns?: string[] | undefined;
246
245
  timeout?: number | undefined;
246
+ blockedPatterns?: string[] | undefined;
247
247
  maxBuffer?: number | undefined;
248
248
  cwd?: string | undefined;
249
249
  allowSudo?: boolean | undefined;
@@ -33,14 +33,14 @@ export function checkCapabilityEnvelope(action, envelope, now = Date.now()) {
33
33
  : envelope.writeNamespaces;
34
34
  checks.push([matches(namespaces, action.namespace), 'namespace-outside-envelope']);
35
35
  }
36
- if (action.costUsd !== undefined && envelope.maxCostUsd !== undefined) {
37
- checks.push([action.costUsd <= envelope.maxCostUsd, 'cost-outside-envelope']);
36
+ if (envelope.maxCostUsd !== undefined) {
37
+ checks.push([action.costUsd !== undefined && action.costUsd <= envelope.maxCostUsd, 'cost-outside-envelope']);
38
38
  }
39
- if (action.tokens !== undefined && envelope.maxTokens !== undefined) {
40
- checks.push([action.tokens <= envelope.maxTokens, 'tokens-outside-envelope']);
39
+ if (envelope.maxTokens !== undefined) {
40
+ checks.push([action.tokens !== undefined && action.tokens <= envelope.maxTokens, 'tokens-outside-envelope']);
41
41
  }
42
- if (action.concurrency !== undefined && envelope.maxConcurrency !== undefined) {
43
- checks.push([action.concurrency <= envelope.maxConcurrency, 'concurrency-outside-envelope']);
42
+ if (envelope.maxConcurrency !== undefined) {
43
+ checks.push([action.concurrency !== undefined && action.concurrency <= envelope.maxConcurrency, 'concurrency-outside-envelope']);
44
44
  }
45
45
  if (action.network === true)
46
46
  checks.push([envelope.network === true, 'network-outside-envelope']);
@@ -1 +1 @@
1
- {"version":3,"file":"envelope.js","sourceRoot":"","sources":["../../src/policy/envelope.ts"],"names":[],"mappings":"AAOA,SAAS,OAAO,CAAC,QAAuC,EAAE,KAAyB;IACjF,IAAI,CAAC,QAAQ,EAAE,MAAM;QAAE,OAAO,IAAI,CAAC;IACnC,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAChC,OAAO,KAAK,GAAG;WACZ,OAAO,KAAK,KAAK;WACjB,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,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AC,SAAS,IAAI,MAAM,CAAC,gBAAgB,CAC5C;KACF,CAAC;IACF,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAC9F,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/security",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "type": "module",
5
5
  "description": "Security module - CVE fixes, input validation, path security",
6
6
  "main": "dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "3.56.8",
3
+ "version": "3.56.10",
4
4
  "workspaces": [
5
5
  "v3/@claude-flow/codex",
6
6
  "v3/@claude-flow/mcp",
@@ -68,13 +68,13 @@
68
68
  "v3:security": "npm run security:audit && npm run security:test"
69
69
  },
70
70
  "dependencies": {
71
- "@claude-flow/cli-core": "3.7.1",
72
- "@claude-flow/codex": "3.0.4",
71
+ "@claude-flow/cli-core": "3.7.3",
72
+ "@claude-flow/codex": "3.0.5",
73
73
  "@claude-flow/mcp": "3.1.1",
74
74
  "@claude-flow/neural": "3.0.0",
75
75
  "@claude-flow/plugin-agent-federation": "1.0.1",
76
- "@claude-flow/security": "3.0.4",
77
- "@claude-flow/shared": "3.0.4",
76
+ "@claude-flow/security": "3.0.5",
77
+ "@claude-flow/shared": "3.0.5",
78
78
  "@iarna/toml": "^2.2.5",
79
79
  "@noble/ed25519": "2.3.0",
80
80
  "@ruvector/rabitq-wasm": "0.1.0",
@@ -80,6 +80,8 @@ export declare function discoverTasks(sources: string[]): TaskInfo[];
80
80
  export declare function isTerminal(status: string): boolean;
81
81
  export declare function getProgress(tasks: TaskInfo[]): TaskProgress;
82
82
  export declare function calculateReward(iterations: number, durationMs: number): number;
83
+ /** Why the last tryLoadLearning() returned null (null when it succeeded or was never called). */
84
+ export declare function getLearningLoadError(): string | null;
83
85
  export declare function tryLoadLearning(): Promise<{
84
86
  initialize: () => Promise<boolean>;
85
87
  [key: string]: unknown;
@@ -9,7 +9,9 @@
9
9
  */
10
10
  import { randomUUID } from 'node:crypto';
11
11
  import { existsSync, readFileSync, mkdirSync, readdirSync } from 'node:fs';
12
- import { resolve, join } from 'node:path';
12
+ import { resolve, join, dirname } from 'node:path';
13
+ import { createRequire } from 'node:module';
14
+ import { pathToFileURL } from 'node:url';
13
15
  import { homedir } from 'node:os';
14
16
  import { writeFileAtomic } from './fs-secure.js';
15
17
  // ── Constants ─────────────────────────────────────────────────
@@ -288,17 +290,43 @@ export function calculateReward(iterations, durationMs) {
288
290
  return Math.round((iterFactor + timeFactor) * 100) / 100;
289
291
  }
290
292
  // ── Learning Integration ──────────────────────────────────────
293
+ let lastLearningLoadError = null;
294
+ /** Why the last tryLoadLearning() returned null (null when it succeeded or was never called). */
295
+ export function getLearningLoadError() {
296
+ return lastLearningLoadError;
297
+ }
298
+ /**
299
+ * agentic-flow's `exports` map does not expose dist/coordination/*, so a bare
300
+ * specifier import throws ERR_PACKAGE_PATH_NOT_EXPORTED (#4146). Resolve the
301
+ * package root through its exported entry point and import the file by URL.
302
+ */
303
+ function resolveAutopilotLearningUrl() {
304
+ const req = createRequire(import.meta.url);
305
+ let dir = dirname(req.resolve('agentic-flow'));
306
+ for (let i = 0; i < 6; i++) {
307
+ if (existsSync(join(dir, 'package.json')) && existsSync(join(dir, 'dist', 'coordination', 'autopilot-learning.js'))) {
308
+ return pathToFileURL(join(dir, 'dist', 'coordination', 'autopilot-learning.js')).href;
309
+ }
310
+ dir = dirname(dir);
311
+ }
312
+ throw new Error('agentic-flow does not ship dist/coordination/autopilot-learning.js');
313
+ }
291
314
  export async function tryLoadLearning() {
315
+ lastLearningLoadError = null;
292
316
  try {
293
- const modPath = 'agentic-flow/dist/coordination/autopilot-learning.js';
294
- const mod = await import(/* webpackIgnore: true */ modPath).catch(() => null);
295
- if (mod?.AutopilotLearning) {
296
- const instance = new mod.AutopilotLearning();
297
- if (await instance.initialize())
298
- return instance;
317
+ const mod = await import(/* webpackIgnore: true */ resolveAutopilotLearningUrl());
318
+ if (!mod?.AutopilotLearning) {
319
+ lastLearningLoadError = 'agentic-flow autopilot-learning module has no AutopilotLearning export';
320
+ return null;
299
321
  }
322
+ const instance = new mod.AutopilotLearning();
323
+ if (await instance.initialize())
324
+ return instance;
325
+ lastLearningLoadError = 'AutopilotLearning.initialize() returned false (AgentDB not initialized)';
326
+ }
327
+ catch (e) {
328
+ lastLearningLoadError = `Could not load agentic-flow autopilot learning: ${e instanceof Error ? e.message : String(e)}`;
300
329
  }
301
- catch { /* not available */ }
302
330
  return null;
303
331
  }
304
332
  //# sourceMappingURL=autopilot-state.js.map
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Resolve which (sub)command an invocation targets.
3
+ *
4
+ * The parser reports the matched command path (for example
5
+ * ['hooks', 'transfer', 'store', 'search']) and the remaining positional arguments.
6
+ * Resolution walks the whole path through each command's `subcommands`, so a command
7
+ * can sit at any depth. #4157: it used to stop two levels below the top-level command,
8
+ * so `hooks transfer store search` ran the `store` help instead of `search`.
9
+ */
10
+ import type { Command } from './types.js';
11
+ export declare function resolveTargetCommand(command: Command, commandPath: string[], positional: string[]): {
12
+ target: Command;
13
+ args: string[];
14
+ };
15
+ //# sourceMappingURL=command-resolution.d.ts.map
@@ -0,0 +1,25 @@
1
+ const matches = (sc, name) => sc.name === name || !!sc.aliases?.includes(name);
2
+ export function resolveTargetCommand(command, commandPath, positional) {
3
+ let target = command;
4
+ if (commandPath.length > 1 && command.subcommands) {
5
+ // The parser already removed the path from `positional`.
6
+ for (const name of commandPath.slice(1)) {
7
+ const next = target.subcommands?.find((sc) => matches(sc, name));
8
+ if (!next)
9
+ break;
10
+ target = next;
11
+ }
12
+ return { target, args: positional };
13
+ }
14
+ // Positional form: the path only named the top-level command.
15
+ let args = positional;
16
+ while (args.length > 0 && target.subcommands) {
17
+ const next = target.subcommands.find((sc) => matches(sc, args[0]));
18
+ if (!next)
19
+ break;
20
+ target = next;
21
+ args = args.slice(1);
22
+ }
23
+ return { target, args };
24
+ }
25
+ //# sourceMappingURL=command-resolution.js.map
@@ -736,15 +736,16 @@ const healthCommand = {
736
736
  output.writeln(output.bold('Agent Health'));
737
737
  output.writeln();
738
738
  // Overall summary with null checks
739
- const overall = result.overall ?? { healthy: 0, degraded: 0, unhealthy: 0, avgCpu: 0, avgMemory: 0 };
740
- const avgCpu = overall.avgCpu ?? 0;
741
- const avgMemory = overall.avgMemory ?? 0;
739
+ const overall = result.overall ?? { healthy: 0, degraded: 0, unhealthy: 0, unknown: 0 };
740
+ const avgCpu = overall.avgCpu ?? overall.cpu;
741
+ const avgMemory = overall.avgMemory ?? overall.memory;
742
742
  output.printBox([
743
743
  `Healthy: ${output.success(String(overall.healthy ?? 0))}`,
744
744
  `Degraded: ${output.warning(String(overall.degraded ?? 0))}`,
745
745
  `Unhealthy: ${output.error(String(overall.unhealthy ?? 0))}`,
746
- `Avg CPU: ${avgCpu.toFixed(1)}%`,
747
- `Avg Memory: ${(avgMemory * 100).toFixed(1)}%`
746
+ `Unknown: ${String(overall.unknown ?? 0)}`,
747
+ `Avg CPU: ${typeof avgCpu === 'number' ? `${avgCpu.toFixed(1)}%` : 'n/a'}`,
748
+ `Avg Memory: ${typeof avgMemory === 'number' ? `${(avgMemory * 100).toFixed(1)}%` : 'n/a'}`
748
749
  ].join(' | '), 'Overall Status');
749
750
  const healthAgents = result.agents ?? [];
750
751
  output.writeln();
@@ -753,14 +754,14 @@ const healthCommand = {
753
754
  { key: 'id', header: 'Agent ID', width: 18 },
754
755
  { key: 'type', header: 'Type', width: 12 },
755
756
  { key: 'health', header: 'Health', width: 10, format: formatHealthStatus },
756
- { key: 'cpu', header: 'CPU %', width: 8, align: 'right', format: (v) => `${Number(v ?? 0).toFixed(1)}%` },
757
+ { key: 'cpu', header: 'CPU %', width: 8, align: 'right', format: (v) => typeof v === 'number' ? `${v.toFixed(1)}%` : 'n/a' },
757
758
  { key: 'memory', header: 'Memory', width: 10, align: 'right', format: (v) => {
758
759
  const mem = v;
759
- if (!mem)
760
- return '0%';
760
+ if (!mem || !mem.limit)
761
+ return 'n/a';
761
762
  return `${(mem.used / mem.limit * 100).toFixed(0)}%`;
762
763
  } },
763
- { key: 'tasks', header: 'Tasks', width: 12, align: 'right', format: (v) => {
764
+ { key: 'tasks', header: 'Calls', width: 12, align: 'right', format: (v) => {
764
765
  const t = v;
765
766
  if (!t)
766
767
  return '0/0';
@@ -775,15 +776,14 @@ const healthCommand = {
775
776
  for (const agent of healthAgents) {
776
777
  output.writeln();
777
778
  output.writeln(output.highlight(agent.id));
778
- const uptime = agent.uptime ?? 0;
779
- const latency = agent.latency ?? { avg: 0, p99: 0 };
780
- const tasks = agent.tasks ?? { completed: 0, failed: 0, queued: 0 };
781
- const errors = agent.errors ?? { count: 0 };
779
+ const latency = agent.latency;
780
+ const tasks = agent.tasks;
781
+ const errors = agent.errors;
782
782
  output.printList([
783
- `Uptime: ${(uptime / 1000 / 60).toFixed(1)} min`,
784
- `Latency: avg ${(latency.avg ?? 0).toFixed(1)}ms, p99 ${(latency.p99 ?? 0).toFixed(1)}ms`,
785
- `Tasks: ${tasks.completed ?? 0} completed, ${tasks.failed ?? 0} failed, ${tasks.queued ?? 0} queued`,
786
- `Errors: ${errors.count ?? 0}${errors.lastError ? ` (${errors.lastError})` : ''}`
783
+ `Registry age: ${typeof agent.registryAgeMs === 'number' ? `${(agent.registryAgeMs / 1000 / 60).toFixed(1)} min` : 'n/a'}`,
784
+ `Latency: p50 ${typeof latency?.p50 === 'number' ? `${latency.p50.toFixed(1)}ms` : 'n/a'}, p95 ${typeof latency?.p95 === 'number' ? `${latency.p95.toFixed(1)}ms` : 'n/a'}`,
785
+ `Observed provider calls (last 20): ${tasks?.completed ?? 0} API-success, ${tasks?.failed ?? 0} error`,
786
+ `Errors: ${errors?.count ?? 0}${errors?.lastError ? ` (${errors.lastError})` : ''}`
787
787
  ]);
788
788
  }
789
789
  }
@@ -97,11 +97,19 @@ const diffCommand = {
97
97
  output.printInfo(`Analyzing diff: ${output.highlight(ref)}`);
98
98
  try {
99
99
  // Call MCP tool for diff analysis
100
+ // Shape returned by the analyze_diff MCP tool (ruvector/diff-classifier.ts).
101
+ // Typed from the classifier itself so the renderer cannot drift from it again.
100
102
  const result = await callMCPTool('analyze_diff', {
101
103
  ref,
102
- includeFileRisks: verbose,
104
+ // Always request file risks: the handler computes them anyway, and the
105
+ // high-risk file list below is derived from them.
106
+ includeFileRisks: true,
103
107
  includeReviewers: showReviewers || showAll,
104
108
  });
109
+ if (result.error) {
110
+ output.printError(`Diff analysis failed: ${result.message ?? 'unknown error'}`);
111
+ return { success: false, exitCode: 1 };
112
+ }
105
113
  // JSON output
106
114
  if (formatType === 'json') {
107
115
  output.printJson(result);
@@ -110,13 +118,18 @@ const diffCommand = {
110
118
  output.writeln();
111
119
  // Summary box
112
120
  const files = result.files || [];
113
- const risk = result.risk || { overall: 'unknown', score: 0, breakdown: { fileCount: 0, totalChanges: 0, highRiskFiles: [], securityConcerns: [], breakingChanges: [], testCoverage: 'unknown' } };
114
- const classification = result.classification || { category: 'unknown', confidence: 0, reasoning: '' };
121
+ const fileRisks = result.fileRisks || [];
122
+ const risk = result.risk || { overall: 'low', score: 0, breakdown: { low: 0, medium: 0, high: 0, critical: 0 } };
123
+ const classification = result.classification;
124
+ const category = classification?.primary ?? 'unknown';
125
+ const secondary = classification?.secondary?.length ? classification.secondary.join(', ') : '';
126
+ const totalChanges = files.reduce((sum, f) => sum + f.additions + f.deletions, 0);
127
+ const highRiskFiles = fileRisks.filter((r) => r.risk === 'high' || r.risk === 'critical').map((r) => r.file);
115
128
  output.printBox([
116
129
  `Ref: ${result.ref || 'HEAD'}`,
117
130
  `Files: ${files.length}`,
118
131
  `Risk: ${getRiskDisplay(risk.overall)} (${risk.score}/100)`,
119
- `Type: ${classification.category}${classification.subcategory ? ` (${classification.subcategory})` : ''}`,
132
+ `Type: ${category}${secondary ? ` (${secondary})` : ''}`,
120
133
  ``,
121
134
  result.summary || 'No summary available',
122
135
  ].join('\n'), 'Diff Analysis');
@@ -128,33 +141,28 @@ const diffCommand = {
128
141
  output.printTable({
129
142
  columns: [
130
143
  { key: 'metric', header: 'Metric', width: 25 },
131
- { key: 'value', header: 'Value', width: 30 },
144
+ { key: 'value', header: 'Value', width: 42 },
132
145
  ],
133
146
  data: [
134
147
  { metric: 'Overall Risk', value: getRiskDisplay(risk.overall) },
135
148
  { metric: 'Risk Score', value: `${risk.score}/100` },
136
- { metric: 'Files Changed', value: risk.breakdown.fileCount },
137
- { metric: 'Total Lines Changed', value: risk.breakdown.totalChanges },
138
- { metric: 'Test Coverage', value: risk.breakdown.testCoverage },
149
+ { metric: 'Files Changed', value: files.length },
150
+ { metric: 'Total Lines Changed', value: totalChanges },
151
+ { metric: 'Files by Risk', value: `low ${risk.breakdown.low} / medium ${risk.breakdown.medium} / high ${risk.breakdown.high} / critical ${risk.breakdown.critical}` },
139
152
  ],
140
153
  });
141
- // Security concerns
142
- if (risk.breakdown.securityConcerns.length > 0) {
143
- output.writeln();
144
- output.writeln(output.bold(output.warning('Security Concerns')));
145
- output.printList(risk.breakdown.securityConcerns.map(c => output.warning(c)));
146
- }
147
- // Breaking changes
148
- if (risk.breakdown.breakingChanges.length > 0) {
154
+ // Risk factors reported by the classifier
155
+ const riskFactors = classification?.riskFactors ?? [];
156
+ if (riskFactors.length > 0) {
149
157
  output.writeln();
150
- output.writeln(output.bold(output.error('Potential Breaking Changes')));
151
- output.printList(risk.breakdown.breakingChanges.map(c => output.error(c)));
158
+ output.writeln(output.bold(output.warning('Risk Factors')));
159
+ output.printList(riskFactors.map(c => output.warning(c)));
152
160
  }
153
161
  // High risk files
154
- if (risk.breakdown.highRiskFiles.length > 0) {
162
+ if (highRiskFiles.length > 0) {
155
163
  output.writeln();
156
164
  output.writeln(output.bold('High Risk Files'));
157
- output.printList(risk.breakdown.highRiskFiles.map(f => output.warning(f)));
165
+ output.printList(highRiskFiles.map(f => output.warning(f)));
158
166
  }
159
167
  }
160
168
  // Classification
@@ -168,13 +176,16 @@ const diffCommand = {
168
176
  { key: 'value', header: 'Value', width: 40 },
169
177
  ],
170
178
  data: [
171
- { field: 'Category', value: classification.category },
172
- { field: 'Subcategory', value: classification.subcategory || '-' },
173
- { field: 'Confidence', value: `${(classification.confidence * 100).toFixed(0)}%` },
179
+ { field: 'Category', value: category },
180
+ { field: 'Secondary', value: secondary || '-' },
181
+ { field: 'Confidence', value: `${((classification?.confidence ?? 0) * 100).toFixed(0)}%` },
182
+ { field: 'Impact', value: classification?.impactLevel ?? '-' },
174
183
  ],
175
184
  });
176
- output.writeln();
177
- output.writeln(output.dim(`Reasoning: ${classification.reasoning}`));
185
+ if (classification?.testingStrategy?.length) {
186
+ output.writeln();
187
+ output.writeln(output.dim(`Testing strategy: ${classification.testingStrategy.join(', ')}`));
188
+ }
178
189
  }
179
190
  // Reviewers
180
191
  if (showReviewers || showAll) {
@@ -190,13 +201,13 @@ const diffCommand = {
190
201
  }
191
202
  }
192
203
  // Verbose file-level details
193
- if (verbose && result.fileRisks) {
204
+ if (verbose && fileRisks.length > 0) {
194
205
  output.writeln();
195
206
  output.writeln(output.bold('File-Level Analysis'));
196
207
  output.writeln(output.dim('-'.repeat(50)));
197
208
  output.printTable({
198
209
  columns: [
199
- { key: 'path', header: 'File', width: 40 },
210
+ { key: 'file', header: 'File', width: 40 },
200
211
  { key: 'risk', header: 'Risk', width: 12, format: (v) => getRiskDisplay(String(v)) },
201
212
  { key: 'score', header: 'Score', width: 8, align: 'right' },
202
213
  { key: 'reasons', header: 'Reasons', width: 30, format: (v) => {
@@ -204,7 +215,7 @@ const diffCommand = {
204
215
  return reasons.slice(0, 2).join('; ');
205
216
  } },
206
217
  ],
207
- data: result.fileRisks,
218
+ data: fileRisks.map((r) => ({ ...r })),
208
219
  });
209
220
  }
210
221
  // Files changed table
@@ -219,7 +230,7 @@ const diffCommand = {
219
230
  { key: 'additions', header: '+', width: 8, align: 'right', format: (v) => output.success(`+${v}`) },
220
231
  { key: 'deletions', header: '-', width: 8, align: 'right', format: (v) => output.error(`-${v}`) },
221
232
  ],
222
- data: files.slice(0, 20),
233
+ data: files.slice(0, 20).map((f) => ({ ...f })),
223
234
  });
224
235
  if (files.length > 20) {
225
236
  output.writeln(output.dim(` ... and ${files.length - 20} more files`));
@@ -5,7 +5,8 @@
5
5
  * Created with ❤️ by ruv.io
6
6
  */
7
7
  import { existsSync, readFileSync, writeFileSync, mkdirSync, renameSync } from 'node:fs';
8
- import { resolve, dirname } from 'node:path';
8
+ import { resolve, dirname, join } from 'node:path';
9
+ import { homedir } from 'node:os';
9
10
  import { output } from '../output.js';
10
11
  const CLAIMS_CONFIG_PATHS = [
11
12
  '.claude-flow/claims.json',
@@ -15,7 +16,9 @@ function getClaimsConfigPaths() {
15
16
  return [
16
17
  resolve(CLAIMS_CONFIG_PATHS[0]),
17
18
  resolve(CLAIMS_CONFIG_PATHS[1]),
18
- resolve(process.env.HOME || '~', '.config/claude-flow/claims.json'),
19
+ // os.homedir(), not $HOME: HOME is normally unset on Windows, and the old
20
+ // `process.env.HOME || '~'` fallback resolved to a literal <cwd>/~ folder.
21
+ join(homedir(), '.config', 'claude-flow', 'claims.json'),
19
22
  ];
20
23
  }
21
24
  function loadClaimsConfig() {
@@ -152,18 +155,13 @@ const checkCommand = {
152
155
  const spinner = output.createSpinner({ text: 'Evaluating claim...', spinner: 'dots' });
153
156
  spinner.start();
154
157
  const fs = await import('fs');
155
- const path = await import('path');
156
158
  // Real claims evaluation from config file
157
159
  let isGranted = false;
158
160
  let reason = 'Claim not found in policy';
159
161
  let policySource = 'default';
160
162
  try {
161
163
  // Check for claims config file
162
- const claimsConfigPaths = [
163
- path.resolve('.claude-flow/claims.json'),
164
- path.resolve('claude-flow.claims.json'),
165
- path.resolve(process.env.HOME || '~', '.config/claude-flow/claims.json'),
166
- ];
164
+ const claimsConfigPaths = getClaimsConfigPaths();
167
165
  let claimsConfig = {
168
166
  // Default policy - allows basic operations
169
167
  roles: {