claude-flow 3.63.6 → 3.63.8

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 (43) hide show
  1. package/.claude/agents/github/github-modes.md +3 -3
  2. package/.claude/agents/github/issue-tracker.md +6 -6
  3. package/.claude/agents/github/pr-manager.md +6 -6
  4. package/.claude/agents/github/release-manager.md +11 -11
  5. package/.claude/agents/github/repo-architect.md +9 -9
  6. package/.claude/agents/github/swarm-issue.md +4 -4
  7. package/.claude/agents/github/swarm-pr.md +5 -5
  8. package/.claude/agents/github/sync-coordinator.md +18 -18
  9. package/.claude/agents/github/workflow-automation.md +7 -7
  10. package/.claude/agents/goal/code-goal-planner.md +2 -2
  11. package/.claude/commands/agents/agent-spawning.md +1 -1
  12. package/.claude/commands/github/github-modes.md +3 -3
  13. package/.claude/commands/github/issue-tracker.md +6 -6
  14. package/.claude/commands/github/pr-manager.md +6 -6
  15. package/.claude/commands/github/release-manager.md +11 -11
  16. package/.claude/commands/github/repo-architect.md +9 -9
  17. package/.claude/commands/github/sync-coordinator.md +9 -9
  18. package/.claude/commands/sparc/orchestrator.md +1 -1
  19. package/.claude/commands/sparc/sparc-modes.md +1 -1
  20. package/.claude/proven-config.json +1 -1
  21. package/.claude/skills/github-code-review/SKILL.md +3 -3
  22. package/.claude/skills/github-multi-repo/SKILL.md +6 -9
  23. package/.claude/skills/github-project-management/SKILL.md +7 -7
  24. package/.claude/skills/github-release-management/SKILL.md +12 -14
  25. package/.claude/skills/github-workflow-automation/SKILL.md +7 -7
  26. package/.claude/skills/sparc-methodology/SKILL.md +11 -11
  27. package/.claude/skills/swarm-advanced/SKILL.md +5 -5
  28. package/.claude-plugin/marketplace.json +3 -3
  29. package/README.md +1 -1
  30. package/package.json +1 -1
  31. package/v3/@claude-flow/cli/README.md +179 -63
  32. package/v3/@claude-flow/cli/catalog-manifest.json +5 -5
  33. package/v3/@claude-flow/cli/dist/src/commands/hooks.js +7 -0
  34. package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-tools.js +19 -5
  35. package/v3/@claude-flow/cli/dist/src/mcp-tools/coordination-tools.js +10 -12
  36. package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +11 -2
  37. package/v3/@claude-flow/cli/dist/src/mcp-tools/performance-tools.js +13 -23
  38. package/v3/@claude-flow/cli/dist/src/mcp-tools/session-tools.js +25 -8
  39. package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.js +40 -1
  40. package/v3/@claude-flow/cli/dist/src/missions/schemas.d.ts +113 -113
  41. package/v3/@claude-flow/cli/dist/src/mods/command-registry/schema.d.ts +87 -87
  42. package/v3/@claude-flow/cli/dist/src/services/worker-daemon.js +11 -4
  43. package/v3/@claude-flow/cli/package.json +3 -3
@@ -214,7 +214,7 @@ export const agentTools = [
214
214
  inputSchema: {
215
215
  type: 'object',
216
216
  properties: {
217
- agentType: { type: 'string', description: 'Type of agent to spawn' },
217
+ agentType: { type: 'string', description: 'Type of agent to spawn (a legacy `type` key is accepted as an alias)' },
218
218
  agentId: { type: 'string', description: 'Optional custom agent ID' },
219
219
  name: { type: 'string', description: 'Optional display name for the agent (shown by agent_list, agent_status and ruflo-console)' },
220
220
  // #2085 — accept swarmId so spawned agents register in the
@@ -234,7 +234,19 @@ export const agentTools = [
234
234
  },
235
235
  required: ['agentType'],
236
236
  },
237
- handler: async (input) => {
237
+ handler: async (rawInput) => {
238
+ // #4542: agent and command docs that `init` installed before 3.63.7 call
239
+ // agent_spawn with `type`. Accept it as an alias for `agentType`, and
240
+ // name the missing key ourselves: validateAgentSpawn maps agentType onto
241
+ // the security schema's `type` field and would report "type: Required".
242
+ let input = rawInput;
243
+ if (input.agentType === undefined && typeof input.type === 'string') {
244
+ const { type, ...rest } = input;
245
+ input = { ...rest, agentType: type };
246
+ }
247
+ if (typeof input.agentType !== 'string' || input.agentType === '') {
248
+ return { success: false, error: 'Input validation failed: agentType is required and must be a non-empty string (for example agentType: "coder")' };
249
+ }
238
250
  // Validate user-provided input (#1425: wire security validators to runtime)
239
251
  const validation = await validateAgentSpawn(input);
240
252
  if (!validation.valid) {
@@ -606,7 +618,7 @@ export const agentTools = [
606
618
  type: 'object',
607
619
  properties: {
608
620
  action: { type: 'string', enum: ['status', 'scale', 'drain', 'fill'], description: 'Pool action' },
609
- targetSize: { type: 'number', description: 'Target pool size (for scale action)' },
621
+ targetSize: { type: 'number', description: 'Target pool size (scale: grow or shrink to it; fill: grow to it, never shrink)' },
610
622
  agentType: { type: 'string', description: 'Agent type filter' },
611
623
  },
612
624
  required: ['action'],
@@ -653,7 +665,9 @@ export const agentTools = [
653
665
  avgHealth: agents.length > 0 ? agents.reduce((sum, a) => sum + a.health, 0) / agents.length : 0,
654
666
  };
655
667
  }
656
- if (action === 'scale') {
668
+ // #4555: fill was advertised in the enum but had no branch. It is scale
669
+ // without the shrink step: grow agentType's pool to targetSize, never terminate.
670
+ if (action === 'scale' || action === 'fill') {
657
671
  const targetSize = input.targetSize === undefined ? 5 : input.targetSize;
658
672
  if (typeof targetSize !== 'number' || !Number.isSafeInteger(targetSize) || targetSize < 0) {
659
673
  return { action, error: 'targetSize must be a non-negative safe integer' };
@@ -678,7 +692,7 @@ export const agentTools = [
678
692
  added.push(agentId);
679
693
  }
680
694
  }
681
- else if (delta < 0) {
695
+ else if (delta < 0 && action === 'scale') {
682
696
  const toRemove = agents.filter(a => a.agentType === agentType && a.status === 'idle').slice(0, -delta);
683
697
  for (const agent of toRemove) {
684
698
  store.agents[agent.agentId].status = 'terminated';
@@ -225,8 +225,8 @@ export const coordinationTools = [
225
225
  inputSchema: {
226
226
  type: 'object',
227
227
  properties: {
228
- action: { type: 'string', enum: ['status', 'trigger', 'resolve'], description: 'Action to perform' },
229
- force: { type: 'boolean', description: 'Force synchronization' },
228
+ action: { type: 'string', enum: ['status', 'trigger', 'resolve'], description: 'Action to perform. `trigger` is unavailable: nodes are local records with no sync backend, so it is refused (#4557)' },
229
+ force: { type: 'boolean', description: 'Unused: `trigger` is refused regardless (#4557)' },
230
230
  conflictResolution: { type: 'string', enum: ['latest', 'merge', 'manual'], description: 'Conflict resolution strategy' },
231
231
  },
232
232
  },
@@ -243,18 +243,16 @@ export const coordinationTools = [
243
243
  };
244
244
  }
245
245
  if (action === 'trigger') {
246
- store.sync.syncCount++;
247
- store.sync.lastSync = new Date().toISOString();
248
- store.sync.pendingChanges = 0;
249
- // Simulate sync
250
- await new Promise(resolve => setTimeout(resolve, 50));
251
- saveCoordStore(store);
246
+ // #4557: this waited on a simulated 50ms "sync", bumped syncCount/lastSync
247
+ // and reported every node synchronized, but no state moves between
248
+ // nodes. Refuse without touching the stored sync record, as
249
+ // neural_compress quantize/prune do (#4195, #4423).
252
250
  return {
253
- success: true,
254
- action: 'synchronized',
251
+ success: false,
252
+ action: 'trigger',
253
+ error: 'Synchronization is unavailable: coordination nodes are local records with no sync backend, so nothing would be transferred.',
255
254
  syncCount: store.sync.syncCount,
256
- syncedAt: store.sync.lastSync,
257
- nodesSync: Object.keys(store.nodes).length,
255
+ lastSync: store.sync.lastSync,
258
256
  };
259
257
  }
260
258
  if (action === 'resolve') {
@@ -2212,7 +2212,14 @@ export const hooksBuildAgents = {
2212
2212
  },
2213
2213
  },
2214
2214
  handler: async (params) => {
2215
- const outputDir = resolve(params.outputDir || './agents');
2215
+ // #4558: outputDir was never validated and resolved against the process
2216
+ // cwd, so a default call from another directory overwrote files there.
2217
+ if (params.outputDir !== undefined) {
2218
+ const v = validatePath(params.outputDir, 'outputDir');
2219
+ if (!v.valid)
2220
+ return { success: false, error: v.error };
2221
+ }
2222
+ const outputDir = resolve(getProjectCwd(), params.outputDir || './agents');
2216
2223
  const focus = params.focus || 'all';
2217
2224
  const format = params.format || 'yaml';
2218
2225
  const persist = params.persist !== false; // Default to true
@@ -2255,9 +2262,11 @@ export const hooksBuildAgents = {
2255
2262
  agents: filteredAgents,
2256
2263
  stats: {
2257
2264
  configsGenerated: filteredAgents.length,
2258
- patternsApplied: filteredAgents.length * 3,
2265
+ // #4558: was agents * 3; no pretrain data is read, the configs are templates.
2266
+ patternsApplied: 0,
2259
2267
  optimizationsIncluded: filteredAgents.reduce((acc, a) => acc + a.optimizations.length, 0),
2260
2268
  },
2269
+ _note: 'Configs are built-in templates; pretrain data is not read.',
2261
2270
  };
2262
2271
  },
2263
2272
  };
@@ -612,6 +612,14 @@ export const performanceTools = [
612
612
  };
613
613
  const cpuStats = calcStats(cpuHistory, cpuPercent);
614
614
  const memStats = calcStats(memHistory, memUsedMB);
615
+ // #4554: latency/throughput used to be fixed literals (45ms, 1250 ops/s).
616
+ // Report the samples performance_report records (ADR-093 F8), or say none exist.
617
+ const sampled = (values, unit) => {
618
+ const real = values.filter(n => Number.isFinite(n));
619
+ return real.length === 0
620
+ ? { available: false, unit, samples: 0, _real: false, _note: 'No samples recorded yet: run performance_report to record one.' }
621
+ : { ...calcStats(real, real[real.length - 1]), unit, samples: real.length, _real: true };
622
+ };
615
623
  const allMetrics = {
616
624
  cpu: {
617
625
  ...cpuStats,
@@ -630,30 +638,12 @@ export const performanceTools = [
630
638
  unit: 'MB',
631
639
  _real: true,
632
640
  },
633
- latency: {
634
- current: 45,
635
- avg: 52,
636
- min: 15,
637
- max: 250,
638
- p50: 48,
639
- p95: 150,
640
- p99: 220,
641
- unit: 'ms',
642
- },
643
- throughput: {
644
- current: 1250,
645
- avg: 1100,
646
- min: 500,
647
- max: 2000,
648
- p50: 1050,
649
- p95: 1800,
650
- p99: 1950,
651
- unit: 'ops/s',
652
- },
641
+ latency: sampled(history.map(m => m.latency?.avg), 'ms'),
642
+ throughput: sampled(history.map(m => m.throughput?.operations), 'ops/s'),
653
643
  };
654
644
  if (metric === 'all') {
655
645
  return {
656
- _real: true,
646
+ _real: Object.values(allMetrics).every(m => m._real),
657
647
  metrics: allMetrics,
658
648
  aggregation,
659
649
  historySize: history.length,
@@ -662,9 +652,9 @@ export const performanceTools = [
662
652
  }
663
653
  const selectedMetric = allMetrics[metric];
664
654
  return {
665
- _real: ['cpu', 'memory'].includes(metric),
655
+ _real: selectedMetric._real,
666
656
  metric,
667
- value: selectedMetric[aggregation],
657
+ value: selectedMetric[aggregation] ?? null,
668
658
  unit: selectedMetric.unit,
669
659
  details: selectedMetric,
670
660
  timestamp: new Date().toISOString(),
@@ -54,6 +54,21 @@ function ensureSessionDir() {
54
54
  mkdirRestricted(dir);
55
55
  }
56
56
  }
57
+ /**
58
+ * The session hook (`session.js` from init/helpers-generator.ts) writes its
59
+ * records into this same directory: `current.json` and `session-<n>.json`
60
+ * archives shaped `{ id, startedAt, ... }` rather than session_save's
61
+ * `{ sessionId, name, savedAt, stats }`. Read the id and time from either shape
62
+ * (ADR-093 F6), falling back to the file's own id.
63
+ */
64
+ function sessionIdentity(session, fileId) {
65
+ const raw = session;
66
+ const pick = (...values) => values.find((v) => typeof v === 'string' && v !== '');
67
+ return {
68
+ sessionId: pick(raw.sessionId, raw.id) ?? fileId,
69
+ savedAt: pick(raw.savedAt, raw.startedAt) ?? '',
70
+ };
71
+ }
57
72
  function loadSession(sessionId) {
58
73
  try {
59
74
  const path = getSessionPath(sessionId);
@@ -583,12 +598,13 @@ export const sessionTools = [
583
598
  if (session) {
584
599
  const path = getSessionPath(sessionId);
585
600
  const stat = statSync(path);
601
+ const identity = sessionIdentity(session, sessionId);
586
602
  return {
587
- sessionId: session.sessionId,
588
- name: session.name,
603
+ sessionId: identity.sessionId,
604
+ name: session.name ?? identity.sessionId,
589
605
  description: session.description,
590
- savedAt: session.savedAt,
591
- stats: session.stats,
606
+ savedAt: identity.savedAt,
607
+ stats: session.stats ?? null,
592
608
  fileSize: stat.size,
593
609
  path,
594
610
  hasData: {
@@ -631,12 +647,13 @@ export const sessionTools = [
631
647
  const session = loadSession(sessionId);
632
648
  if (!session)
633
649
  return { sessionId, status: 'unknown', startedAt: '', error: 'Session file unreadable' };
650
+ const identity = sessionIdentity(session, sessionId);
634
651
  return {
635
- sessionId: session.sessionId,
636
- name: session.name,
652
+ sessionId: identity.sessionId,
653
+ name: session.name ?? identity.sessionId,
637
654
  status: 'active',
638
- startedAt: session.savedAt,
639
- stats: session.stats,
655
+ startedAt: identity.savedAt,
656
+ stats: session.stats ?? null,
640
657
  };
641
658
  },
642
659
  },
@@ -2316,6 +2316,41 @@ export async function bridgeStorePattern(options) {
2316
2316
  controller: 'reasoningBank',
2317
2317
  };
2318
2318
  }
2319
+ // The intelligence module's LocalReasoningBank (registered when agentdb's
2320
+ // own ReasoningBank is unavailable) has store()/findSimilar() but no
2321
+ // storePattern(). bridgeSearchPatterns reads it through findSimilar(), so
2322
+ // the write must land there too, with an embedding from the same
2323
+ // generateEmbedding() the search uses. Otherwise store and search split
2324
+ // across two backends and a stored pattern is never found.
2325
+ if (reasoningBank && typeof reasoningBank.store === 'function' && typeof reasoningBank.findSimilar === 'function') {
2326
+ let embedding = [];
2327
+ try {
2328
+ const { generateEmbedding } = await import('./memory-initializer.js');
2329
+ const emb = await generateEmbedding(options.pattern);
2330
+ if (emb && Array.isArray(emb.embedding))
2331
+ embedding = emb.embedding;
2332
+ }
2333
+ catch { /* no embedder — findSimilar misses it, the getAll() substring scan still finds it */ }
2334
+ // store() returns false when it merges into an existing pattern with the
2335
+ // same content; that is still a successful write.
2336
+ reasoningBank.store({
2337
+ id: patternId,
2338
+ type: options.type,
2339
+ content: options.pattern,
2340
+ confidence: options.confidence,
2341
+ embedding,
2342
+ metadata: options.metadata,
2343
+ });
2344
+ // Saves are debounced; a short-lived CLI process can exit first.
2345
+ if (typeof reasoningBank.flushToDisk === 'function')
2346
+ reasoningBank.flushToDisk();
2347
+ return {
2348
+ success: true,
2349
+ patternId,
2350
+ controller: 'reasoningBank',
2351
+ hasEmbedding: embedding.length > 0,
2352
+ };
2353
+ }
2319
2354
  // Fallback: store via bridge SQL
2320
2355
  const patternValue = JSON.stringify({ pattern: options.pattern, type: options.type, confidence: options.confidence, metadata: options.metadata });
2321
2356
  const result = await bridgeStoreEntry({
@@ -2447,7 +2482,11 @@ export async function bridgeSearchPatterns(options) {
2447
2482
  .slice(0, k)
2448
2483
  .map((p) => ({ id: p.id ?? '', content: p.content ?? '', score: p.confidence ?? 0 }));
2449
2484
  }
2450
- return { results: mapped, controller: 'reasoningBank' };
2485
+ // Nothing in the bank: patterns written by the SQL fallback path (before
2486
+ // the bank was registered, or by a process without it) live in the
2487
+ // `pattern` namespace, so search that instead of returning empty.
2488
+ if (mapped.length > 0)
2489
+ return { results: mapped, controller: 'reasoningBank' };
2451
2490
  }
2452
2491
  // Fallback: search via bridge
2453
2492
  const result = await bridgeSearchEntries({