claude-flow 3.7.0-alpha.3 → 3.7.0-alpha.30

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 (104) hide show
  1. package/.claude/agents/dual-mode/codex-coordinator.md +34 -29
  2. package/.claude/agents/dual-mode/codex-worker.md +39 -32
  3. package/.claude/helpers/hook-handler.cjs +4 -1
  4. package/.claude/helpers/statusline.cjs +26 -5
  5. package/.claude/scheduled_tasks.lock +1 -0
  6. package/.claude/settings.json +2 -0
  7. package/.claude/settings.local.json +10 -1
  8. package/.claude/skills/browser/SKILL.md +204 -0
  9. package/.claude/skills/github-project-management/SKILL.md +13 -0
  10. package/.claude/skills/verification-quality/SKILL.md +117 -73
  11. package/.claude-plugin/hooks/hooks.json +6 -5
  12. package/.claude-plugin/marketplace.json +3 -3
  13. package/.claude-plugin/scripts/ruflo-hook.sh +33 -0
  14. package/README.md +43 -39
  15. package/package.json +8 -2
  16. package/v3/@claude-flow/cli/README.md +43 -39
  17. package/v3/@claude-flow/cli/bin/cli.js +15 -2
  18. package/v3/@claude-flow/cli/bin/mcp-server.js +1 -1
  19. package/v3/@claude-flow/cli/dist/src/commands/agent-wasm.js +2 -2
  20. package/v3/@claude-flow/cli/dist/src/commands/daemon.d.ts +20 -0
  21. package/v3/@claude-flow/cli/dist/src/commands/daemon.js +338 -3
  22. package/v3/@claude-flow/cli/dist/src/commands/doctor.js +224 -46
  23. package/v3/@claude-flow/cli/dist/src/commands/hive-mind.js +25 -7
  24. package/v3/@claude-flow/cli/dist/src/commands/hooks.js +56 -29
  25. package/v3/@claude-flow/cli/dist/src/commands/memory.js +90 -3
  26. package/v3/@claude-flow/cli/dist/src/commands/start.js +1 -1
  27. package/v3/@claude-flow/cli/dist/src/commands/swarm.js +1 -1
  28. package/v3/@claude-flow/cli/dist/src/commands/task.js +8 -4
  29. package/v3/@claude-flow/cli/dist/src/config-adapter.js +1 -1
  30. package/v3/@claude-flow/cli/dist/src/index.d.ts +5 -1
  31. package/v3/@claude-flow/cli/dist/src/index.js +61 -18
  32. package/v3/@claude-flow/cli/dist/src/init/executor.js +92 -0
  33. package/v3/@claude-flow/cli/dist/src/init/helpers-generator.js +6 -2
  34. package/v3/@claude-flow/cli/dist/src/init/mcp-generator.js +4 -4
  35. package/v3/@claude-flow/cli/dist/src/init/settings-generator.js +44 -17
  36. package/v3/@claude-flow/cli/dist/src/init/statusline-generator.js +25 -14
  37. package/v3/@claude-flow/cli/dist/src/init/types.d.ts +7 -0
  38. package/v3/@claude-flow/cli/dist/src/mcp-client.js +12 -0
  39. package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-execute-core.d.ts +3 -2
  40. package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-execute-core.js +16 -9
  41. package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-tools.js +88 -11
  42. package/v3/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.d.ts +3 -0
  43. package/v3/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.js +206 -21
  44. package/v3/@claude-flow/cli/dist/src/mcp-tools/analyze-tools.js +6 -6
  45. package/v3/@claude-flow/cli/dist/src/mcp-tools/autopilot-tools.js +10 -10
  46. package/v3/@claude-flow/cli/dist/src/mcp-tools/browser-session-tools.js +5 -5
  47. package/v3/@claude-flow/cli/dist/src/mcp-tools/browser-tools.js +23 -23
  48. package/v3/@claude-flow/cli/dist/src/mcp-tools/claims-tools.js +12 -12
  49. package/v3/@claude-flow/cli/dist/src/mcp-tools/config-tools.js +6 -6
  50. package/v3/@claude-flow/cli/dist/src/mcp-tools/coordination-tools.js +7 -7
  51. package/v3/@claude-flow/cli/dist/src/mcp-tools/daa-tools.js +8 -8
  52. package/v3/@claude-flow/cli/dist/src/mcp-tools/embeddings-tools.js +10 -10
  53. package/v3/@claude-flow/cli/dist/src/mcp-tools/github-tools.js +5 -5
  54. package/v3/@claude-flow/cli/dist/src/mcp-tools/guidance-tools.js +21 -21
  55. package/v3/@claude-flow/cli/dist/src/mcp-tools/hive-mind-tools.js +53 -9
  56. package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.d.ts +2 -0
  57. package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +183 -48
  58. package/v3/@claude-flow/cli/dist/src/mcp-tools/managed-agent-tools.d.ts +22 -0
  59. package/v3/@claude-flow/cli/dist/src/mcp-tools/managed-agent-tools.js +357 -0
  60. package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +400 -63
  61. package/v3/@claude-flow/cli/dist/src/mcp-tools/neural-tools.js +20 -7
  62. package/v3/@claude-flow/cli/dist/src/mcp-tools/performance-tools.js +6 -6
  63. package/v3/@claude-flow/cli/dist/src/mcp-tools/progress-tools.js +4 -4
  64. package/v3/@claude-flow/cli/dist/src/mcp-tools/ruvllm-tools.js +10 -10
  65. package/v3/@claude-flow/cli/dist/src/mcp-tools/security-tools.js +34 -9
  66. package/v3/@claude-flow/cli/dist/src/mcp-tools/session-tools.js +130 -6
  67. package/v3/@claude-flow/cli/dist/src/mcp-tools/swarm-tools.js +76 -7
  68. package/v3/@claude-flow/cli/dist/src/mcp-tools/system-tools.js +91 -18
  69. package/v3/@claude-flow/cli/dist/src/mcp-tools/task-tools.js +55 -7
  70. package/v3/@claude-flow/cli/dist/src/mcp-tools/terminal-tools.js +5 -5
  71. package/v3/@claude-flow/cli/dist/src/mcp-tools/transfer-tools.js +11 -11
  72. package/v3/@claude-flow/cli/dist/src/mcp-tools/wasm-agent-tools.js +11 -11
  73. package/v3/@claude-flow/cli/dist/src/mcp-tools/workflow-tools.js +118 -10
  74. package/v3/@claude-flow/cli/dist/src/memory/intelligence.js +28 -3
  75. package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.d.ts +69 -0
  76. package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.js +282 -5
  77. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.d.ts +8 -0
  78. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +80 -16
  79. package/v3/@claude-flow/cli/dist/src/memory/neural-package-bridge.d.ts +48 -0
  80. package/v3/@claude-flow/cli/dist/src/memory/neural-package-bridge.js +87 -0
  81. package/v3/@claude-flow/cli/dist/src/memory/sona-optimizer.js +3 -0
  82. package/v3/@claude-flow/cli/dist/src/parser.d.ts +9 -0
  83. package/v3/@claude-flow/cli/dist/src/parser.js +11 -0
  84. package/v3/@claude-flow/cli/dist/src/plugins/store/discovery.d.ts +6 -3
  85. package/v3/@claude-flow/cli/dist/src/plugins/store/discovery.js +11 -8
  86. package/v3/@claude-flow/cli/dist/src/ruvector/agent-wasm.js +4 -1
  87. package/v3/@claude-flow/cli/dist/src/ruvector/coverage-tools.js +6 -6
  88. package/v3/@claude-flow/cli/dist/src/ruvector/index.d.ts +0 -2
  89. package/v3/@claude-flow/cli/dist/src/ruvector/index.js +8 -2
  90. package/v3/@claude-flow/cli/dist/src/ruvector/model-router.d.ts +22 -1
  91. package/v3/@claude-flow/cli/dist/src/ruvector/model-router.js +125 -5
  92. package/v3/@claude-flow/cli/dist/src/services/headless-worker-executor.d.ts +6 -0
  93. package/v3/@claude-flow/cli/dist/src/services/headless-worker-executor.js +37 -3
  94. package/v3/@claude-flow/cli/dist/src/services/worker-daemon.d.ts +80 -2
  95. package/v3/@claude-flow/cli/dist/src/services/worker-daemon.js +372 -11
  96. package/v3/@claude-flow/cli/package.json +7 -5
  97. package/v3/@claude-flow/guidance/dist/analyzer.js +9 -0
  98. package/v3/@claude-flow/guidance/package.json +1 -1
  99. package/v3/@claude-flow/shared/dist/events/event-store.js +20 -9
  100. package/v3/@claude-flow/shared/dist/hooks/executor.js +7 -4
  101. package/v3/@claude-flow/shared/dist/hooks/verify-exports.test.js +6 -6
  102. package/v3/@claude-flow/shared/dist/mcp/server.js +3 -6
  103. package/v3/@claude-flow/shared/dist/mcp/types.d.ts +4 -6
  104. package/v3/@claude-flow/shared/package.json +1 -1
@@ -39,8 +39,16 @@ import { agentdbTools } from './mcp-tools/agentdb-tools.js';
39
39
  // RuVector WASM tools
40
40
  import { ruvllmWasmTools } from './mcp-tools/ruvllm-tools.js';
41
41
  import { wasmAgentTools } from './mcp-tools/wasm-agent-tools.js';
42
+ // ADR-115: Anthropic Claude Managed Agents — a cloud agent runtime alongside
43
+ // the local WASM-sandboxed `wasm_agent_*` (rvagent) tools. Lives in the
44
+ // `ruflo-agent` plugin.
45
+ import { managedAgentTools } from './mcp-tools/managed-agent-tools.js';
42
46
  import { guidanceTools } from './mcp-tools/guidance-tools.js';
43
47
  import { autopilotTools } from './mcp-tools/autopilot-tools.js';
48
+ // #1916: coverage-aware routing tools — defined in ruvector/coverage-tools.ts
49
+ // but were never registered, so the `ruflo hooks coverage-*` CLI subcommands
50
+ // failed with `Tool not found: hooks_coverage-route`.
51
+ import { coverageRouterTools } from './ruvector/coverage-tools.js';
44
52
  // #1605: Only register browser tools if agent-browser is available
45
53
  let _browserAvailable = null;
46
54
  function getBrowserTools() {
@@ -107,10 +115,14 @@ registerTools([
107
115
  // RuVector WASM tools
108
116
  ...ruvllmWasmTools,
109
117
  ...wasmAgentTools,
118
+ // ADR-115: Anthropic Claude Managed Agents (cloud agent runtime)
119
+ ...managedAgentTools,
110
120
  // Guidance & discovery tools
111
121
  ...guidanceTools,
112
122
  // Autopilot persistent completion tools
113
123
  ...autopilotTools,
124
+ // #1916: coverage-aware routing (hooks_coverage-route / -suggest / -gaps)
125
+ ...coverageRouterTools,
114
126
  ]);
115
127
  /**
116
128
  * MCP Client Error
@@ -21,6 +21,7 @@ export interface AgentRecord {
21
21
  modelRoutedBy?: 'explicit' | 'router' | 'agent-booster' | 'default';
22
22
  lastResult?: Record<string, unknown>;
23
23
  }
24
+ export declare const DEFAULT_ANTHROPIC_MODEL = "claude-sonnet-4-6";
24
25
  export interface AnthropicCallInput {
25
26
  prompt: string;
26
27
  systemPrompt?: string;
@@ -58,8 +59,8 @@ export declare function callAnthropicMessages(input: AnthropicCallInput): Promis
58
59
  /**
59
60
  * Resolve a model identifier to an Anthropic model ID. Accepts:
60
61
  * - logical names: 'haiku', 'sonnet', 'opus', 'inherit'
61
- * - prefixed: 'anthropic:claude-3-5-sonnet-latest'
62
- * - direct: 'claude-3-5-sonnet-latest'
62
+ * - prefixed: 'anthropic:claude-sonnet-4-6'
63
+ * - direct: 'claude-sonnet-4-6'
63
64
  */
64
65
  export declare function resolveAnthropicModel(input: string | undefined): string;
65
66
  export interface AgentExecuteInput {
@@ -32,11 +32,18 @@ function saveAgentStore(store) {
32
32
  ensureAgentDir();
33
33
  writeFileSync(getAgentPath(), JSON.stringify(store, null, 2), 'utf-8');
34
34
  }
35
+ // #1906 — these were stuck on Claude-3.x ids that the Anthropic API now
36
+ // 404s. Current model ids (Claude 4.x family):
37
+ // Opus 4.7 → claude-opus-4-7
38
+ // Sonnet 4.6 → claude-sonnet-4-6
39
+ // Haiku 4.5 → claude-haiku-4-5-20251001
40
+ // `inherit` and the various defaults below all map to Sonnet 4.6.
41
+ export const DEFAULT_ANTHROPIC_MODEL = 'claude-sonnet-4-6';
35
42
  const MODEL_MAP = {
36
- haiku: 'claude-3-5-haiku-latest',
37
- sonnet: 'claude-3-5-sonnet-latest',
38
- opus: 'claude-3-opus-latest',
39
- inherit: 'claude-3-5-sonnet-latest',
43
+ haiku: 'claude-haiku-4-5-20251001',
44
+ sonnet: 'claude-sonnet-4-6',
45
+ opus: 'claude-opus-4-7',
46
+ inherit: DEFAULT_ANTHROPIC_MODEL,
40
47
  };
41
48
  /**
42
49
  * Generic Anthropic Messages API call. No agent registry coupling — used
@@ -63,7 +70,7 @@ export async function callAnthropicMessages(input) {
63
70
  error: 'No LLM provider configured. Set ANTHROPIC_API_KEY (Tier-3) or OLLAMA_API_KEY (Tier-2 Ollama Cloud — see issue #1725).',
64
71
  };
65
72
  }
66
- const model = input.model || 'claude-3-5-sonnet-latest';
73
+ const model = input.model || DEFAULT_ANTHROPIC_MODEL;
67
74
  const startedAt = Date.now();
68
75
  try {
69
76
  const controller = new AbortController();
@@ -212,12 +219,12 @@ function resolveOllamaModel(input) {
212
219
  /**
213
220
  * Resolve a model identifier to an Anthropic model ID. Accepts:
214
221
  * - logical names: 'haiku', 'sonnet', 'opus', 'inherit'
215
- * - prefixed: 'anthropic:claude-3-5-sonnet-latest'
216
- * - direct: 'claude-3-5-sonnet-latest'
222
+ * - prefixed: 'anthropic:claude-sonnet-4-6'
223
+ * - direct: 'claude-sonnet-4-6'
217
224
  */
218
225
  export function resolveAnthropicModel(input) {
219
226
  if (!input)
220
- return 'claude-3-5-sonnet-latest';
227
+ return DEFAULT_ANTHROPIC_MODEL;
221
228
  if (input in MODEL_MAP)
222
229
  return MODEL_MAP[input];
223
230
  if (input.startsWith('anthropic:'))
@@ -240,7 +247,7 @@ export async function executeAgentTask(input) {
240
247
  return { success: false, agentId: input.agentId, error: 'Agent not found' };
241
248
  if (agent.status === 'terminated')
242
249
  return { success: false, agentId: input.agentId, error: 'Agent has been terminated' };
243
- const anthropicModel = MODEL_MAP[agent.model || 'sonnet'] || 'claude-3-5-sonnet-latest';
250
+ const anthropicModel = MODEL_MAP[agent.model || 'sonnet'] || DEFAULT_ANTHROPIC_MODEL;
244
251
  const systemPrompt = input.systemPrompt ||
245
252
  `You are a ${agent.agentType} agent operating as part of a Ruflo swarm. ` +
246
253
  `Agent ID: ${input.agentId}. Domain: ${agent.domain ?? 'general'}. ` +
@@ -13,6 +13,11 @@ import { executeAgentTask } from './agent-execute-core.js';
13
13
  const STORAGE_DIR = '.claude-flow';
14
14
  const AGENT_DIR = 'agents';
15
15
  const AGENT_FILE = 'store.json';
16
+ // #1916: hive-mind_spawn writes its workers to `.claude-flow/agents.json`
17
+ // (a *different* file from the canonical `.claude-flow/agents/store.json`
18
+ // used here). agent_status / agent_list / agent_logs merge that store so a
19
+ // hive-spawned worker is resolvable instead of returning `not_found`.
20
+ const HIVE_AGENT_FILE = 'agents.json';
16
21
  function getAgentDir() {
17
22
  return join(getProjectCwd(), STORAGE_DIR, AGENT_DIR);
18
23
  }
@@ -42,6 +47,33 @@ function saveAgentStore(store) {
42
47
  ensureAgentDir();
43
48
  writeFileSync(getAgentPath(), JSON.stringify(store, null, 2), 'utf-8');
44
49
  }
50
+ // #1916: read hive-mind-spawned workers from `.claude-flow/agents.json`.
51
+ function getHiveAgentPath() {
52
+ return join(getProjectCwd(), STORAGE_DIR, HIVE_AGENT_FILE);
53
+ }
54
+ function loadHiveAgents() {
55
+ try {
56
+ const path = getHiveAgentPath();
57
+ if (existsSync(path)) {
58
+ const data = JSON.parse(readFileSync(path, 'utf-8'));
59
+ if (data && typeof data.agents === 'object' && data.agents) {
60
+ return data.agents;
61
+ }
62
+ }
63
+ }
64
+ catch {
65
+ // Ignore — hive store is optional/best-effort.
66
+ }
67
+ return {};
68
+ }
69
+ /**
70
+ * #1916: merged view of every tracked agent — the canonical agent store
71
+ * plus hive-mind-spawned workers. On an id collision the canonical record
72
+ * wins (it carries model-routing + lastResult that the hive store omits).
73
+ */
74
+ function loadAllAgents() {
75
+ return { ...loadHiveAgents(), ...loadAgentStore().agents };
76
+ }
45
77
  // Default model mappings for agent types (can be overridden)
46
78
  const AGENT_TYPE_MODEL_DEFAULTS = {
47
79
  // Complex agents → opus
@@ -228,7 +260,7 @@ export const agentTools = [
228
260
  // updating the agent record with lastResult / taskCount / status.
229
261
  // No mock — actual HTTP request to api.anthropic.com.
230
262
  name: 'agent_execute',
231
- description: 'Execute a task on a spawned agent calls the Anthropic Messages API with the agent\'s configured model. Requires ANTHROPIC_API_KEY in env.',
263
+ description: 'Run a task on a previously-spawned agent_spawn record via the Anthropic Messages API with that agent\'s configured model. Use when native Task tool is wrong because (a) you need the spawned agent\'s persistent config (model, instructions, cost-tracking attribution) to apply to this turn, (b) the result needs to feed back into the agent\'s lifecycle (taskCount, lastResult, swarm-coordinated state), or (c) you want explicit model routing via the spawn record\'s `model` field instead of inheriting. For one-shot Claude prompts without a tracked agent, native Task is fine. Requires ANTHROPIC_API_KEY in env.',
232
264
  category: 'agent',
233
265
  inputSchema: {
234
266
  type: 'object',
@@ -261,7 +293,7 @@ export const agentTools = [
261
293
  },
262
294
  {
263
295
  name: 'agent_terminate',
264
- description: 'Terminate an agent',
296
+ description: 'Remove a Ruflo-tracked agent from the registry and free its swarm slot. Use when you need to (a) clean up a spawned agent so its cost-tracking row finalizes, (b) reclaim a swarm-topology slot for another agent, or (c) end a stuck agent without restarting the whole swarm. For one-shot Task tool invocations that already self-terminate, this tool is not needed. Pair with agent_list first to confirm the agentId.',
265
297
  category: 'agent',
266
298
  inputSchema: {
267
299
  type: 'object',
@@ -296,7 +328,7 @@ export const agentTools = [
296
328
  },
297
329
  {
298
330
  name: 'agent_status',
299
- description: 'Get agent status',
331
+ description: 'Read the lifecycle state of a single tracked agent: idle/running/stopped, current taskCount, lastResult, model, health score. Use when native Task tool is wrong because you need agent-level state (status across turns, accumulated taskCount, last error, swarm coordination) rather than a one-shot response. For inspecting a Task you just ran, native Task output is fine. Pair with agent_list to find the agentId first.',
300
332
  category: 'agent',
301
333
  inputSchema: {
302
334
  type: 'object',
@@ -309,9 +341,8 @@ export const agentTools = [
309
341
  const v = validateIdentifier(input.agentId, 'agentId');
310
342
  if (!v.valid)
311
343
  return { agentId: input.agentId, status: 'not_found', error: `Input validation failed: ${v.error}` };
312
- const store = loadAgentStore();
313
344
  const agentId = input.agentId;
314
- const agent = store.agents[agentId];
345
+ const agent = loadAllAgents()[agentId]; // #1916: includes hive-mind-spawned workers
315
346
  if (agent) {
316
347
  return {
317
348
  agentId: agent.agentId,
@@ -333,7 +364,7 @@ export const agentTools = [
333
364
  },
334
365
  {
335
366
  name: 'agent_list',
336
- description: 'List all agents',
367
+ description: 'List every Ruflo-tracked agent in the registry with its type, model, status, and taskCount. Use when native Task tool is wrong because you need to see the swarm-wide agent inventory across turns (which agents exist, their roles, their cost-tracking handles) rather than spawn a new one-shot Task. Filter by status/domain/agentType if needed. For starting a fresh single-shot subagent, native Task is fine.',
337
368
  category: 'agent',
338
369
  inputSchema: {
339
370
  type: 'object',
@@ -354,8 +385,7 @@ export const agentTools = [
354
385
  if (!v.valid)
355
386
  return { agents: [], total: 0, error: `Input validation failed: ${v.error}` };
356
387
  }
357
- const store = loadAgentStore();
358
- let agents = Object.values(store.agents);
388
+ let agents = Object.values(loadAllAgents()); // #1916: includes hive-mind-spawned workers
359
389
  // Filter by status
360
390
  if (input.status) {
361
391
  agents = agents.filter(a => a.status === input.status);
@@ -388,7 +418,7 @@ export const agentTools = [
388
418
  },
389
419
  {
390
420
  name: 'agent_pool',
391
- description: 'Manage agent pool',
421
+ description: 'Manage a fixed-size warm pool of pre-spawned agents to skip cold-start cost on bursty workloads. Use when native Task is wrong because (a) you have a queue of similar tasks and want to amortize spawn latency, (b) cost-tracking wants stable agentIds across requests, or (c) swarm topology requires a known agent count at all times. For one-shot work, just call agent_spawn or native Task. Pool sizes and warm/idle thresholds are set per-pool.',
392
422
  category: 'agent',
393
423
  inputSchema: {
394
424
  type: 'object',
@@ -505,7 +535,7 @@ export const agentTools = [
505
535
  },
506
536
  {
507
537
  name: 'agent_health',
508
- description: 'Check agent health',
538
+ description: 'Compute an agent\'s rolling health score (0-1) from recent task success ratio + response-latency p50/p95 + error rate. Use when native Task tool is wrong because you\'re running a long-lived agent (autonomous loop / hive-mind worker / federation peer) and need to detect degradation before the breaker trips it. For one-shot Task invocations there is no history to score. Pair with hooks_post-task so the scores stay current.',
509
539
  category: 'agent',
510
540
  inputSchema: {
511
541
  type: 'object',
@@ -580,7 +610,7 @@ export const agentTools = [
580
610
  },
581
611
  {
582
612
  name: 'agent_update',
583
- description: 'Update agent status or config',
613
+ description: 'Mutate a tracked agent\'s config (model, instructions, status, health) without re-spawning. Use when native Task tool is wrong because the agent already has accumulated state (taskCount, swarm membership, cost-tracking attribution) and you only need to tweak one field — for example, promoting an idle agent to running on a new task, or rotating its model from haiku to sonnet mid-loop. For a brand-new subagent, agent_spawn (or native Task) is the right call.',
584
614
  category: 'agent',
585
615
  inputSchema: {
586
616
  type: 'object',
@@ -635,5 +665,52 @@ export const agentTools = [
635
665
  };
636
666
  },
637
667
  },
668
+ {
669
+ // #1916 — the `ruflo agent logs <id>` CLI subcommand and the guidance
670
+ // surface both reference an `agent_logs` MCP tool that was never
671
+ // registered, so it errored with `MCP tool not found: agent_logs`.
672
+ // This is the registered handler. Note: agents don't yet keep a
673
+ // structured per-agent activity log (that lands with hive worker
674
+ // execution wiring — see #1916), so for now we surface the agent's
675
+ // last task result as a single synthetic entry, or an explicit empty
676
+ // response. The shape matches what the CLI `logs` subcommand expects:
677
+ // `{ agentId, entries: [{timestamp,level,message,context?}], total }`.
678
+ name: 'agent_logs',
679
+ description: 'Return recorded activity-log entries for a tracked agent (idle/running history, last task result). Use when native Task tool is wrong because you need the agent\'s log across turns (what it did, last error/result, swarm context) rather than a one-shot Task transcript. For a Task you just ran, native Task output is fine. Pair with agent_list to find the agentId. (Hive-mind-spawned workers are resolved here too.) Today this returns the last task result as a synthetic entry — full per-agent activity logs land with hive worker execution wiring (ruvnet/ruflo#1916).',
680
+ category: 'agent',
681
+ inputSchema: {
682
+ type: 'object',
683
+ properties: {
684
+ agentId: { type: 'string', description: 'ID of agent' },
685
+ tail: { type: 'number', description: 'Max recent entries to return (default 50)' },
686
+ level: { type: 'string', enum: ['debug', 'info', 'warn', 'error'], description: 'Minimum log level (currently advisory — entries are synthetic)' },
687
+ since: { type: 'string', description: 'Show logs since, e.g. "1h" / "30m" (currently advisory)' },
688
+ },
689
+ required: ['agentId'],
690
+ },
691
+ handler: async (input) => {
692
+ const v = validateIdentifier(input.agentId, 'agentId');
693
+ if (!v.valid)
694
+ return { agentId: input.agentId, entries: [], total: 0, error: `Input validation failed: ${v.error}` };
695
+ const agentId = input.agentId;
696
+ const agent = loadAllAgents()[agentId]; // #1916: includes hive-mind-spawned workers
697
+ if (!agent) {
698
+ return { agentId, entries: [], total: 0, error: 'Agent not found' };
699
+ }
700
+ const entries = [];
701
+ entries.push({ timestamp: agent.createdAt, level: 'info', message: `agent created (type=${agent.agentType}, status=${agent.status})` });
702
+ if (agent.lastResult) {
703
+ entries.push({ timestamp: agent.createdAt, level: 'info', message: 'last task result', context: agent.lastResult });
704
+ }
705
+ const tail = typeof input.tail === 'number' && input.tail > 0 ? Math.floor(input.tail) : 50;
706
+ const sliced = entries.slice(-tail);
707
+ return {
708
+ agentId: agent.agentId,
709
+ entries: sliced,
710
+ total: entries.length,
711
+ note: 'per-agent activity logging is not yet wired; entries are synthetic (ruvnet/ruflo#1916)',
712
+ };
713
+ },
714
+ },
638
715
  ];
639
716
  //# sourceMappingURL=agent-tools.js.map
@@ -26,5 +26,8 @@ export declare const agentdbConsolidate: MCPTool;
26
26
  export declare const agentdbBatch: MCPTool;
27
27
  export declare const agentdbContextSynthesize: MCPTool;
28
28
  export declare const agentdbSemanticRoute: MCPTool;
29
+ export declare const agentdbHierarchicalDelete: MCPTool;
30
+ export declare const agentdbCausalEdgeDelete: MCPTool;
31
+ export declare const agentdbCausalNodeDelete: MCPTool;
29
32
  export declare const agentdbTools: MCPTool[];
30
33
  //# sourceMappingURL=agentdb-tools.d.ts.map