π The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix(cli,ui): resolve five issues from May 1-3 reports
Reuvena10a13e623a1
diff --git a/package.json b/package.jsonindex 820429bbc4..3ca8bc7d85 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "claude-flow",- "version": "3.6.12",+ "version": "3.6.13","description": "Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration","main": "dist/index.js","type": "module",@@ -69,7 +69,8 @@"agentic-flow": "^2.0.7"},"overrides": {- "hono": ">=4.11.4"+ "hono": ">=4.11.4",+ "@ruvector/rvf-wasm": "0.1.5"},"devDependencies": {"@openai/codex": "^0.98.0",diff --git a/ruflo/package.json b/ruflo/package.jsonindex df7ccaf0db..761be9dc9c 100644--- a/ruflo/package.json+++ b/ruflo/package.json@@ -1,6 +1,6 @@{"name": "ruflo",- "version": "3.6.12",+ "version": "3.6.13","description": "Ruflo - Enterprise AI agent orchestration platform. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration","main": "bin/ruflo.js","type": "module",@@ -41,6 +41,9 @@"dependencies": {"@claude-flow/cli": ">=3.0.0-alpha.1"},+ "overrides": {+ "@ruvector/rvf-wasm": "0.1.5"+ },"engines": {"node": ">=20.0.0"},diff --git a/v3/@claude-flow/cli/package.json b/v3/@claude-flow/cli/package.jsonindex fffc9d87cc..b5600ce44e 100644--- a/v3/@claude-flow/cli/package.json+++ b/v3/@claude-flow/cli/package.json@@ -1,6 +1,6 @@{"name": "@claude-flow/cli",- "version": "3.6.12",+ "version": "3.6.13","type": "module","description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code","main": "dist/src/index.js",diff --git a/v3/@claude-flow/cli/src/commands/daemon.ts b/v3/@claude-flow/cli/src/commands/daemon.tsindex 0b94ad8407..e791ef6189 100644--- a/v3/@claude-flow/cli/src/commands/daemon.ts+++ b/v3/@claude-flow/cli/src/commands/daemon.ts@@ -6,7 +6,7 @@import type { Command, CommandContext, CommandResult } from '../types.js';import { output } from '../output.js';import { WorkerDaemon, getDaemon, startDaemon, stopDaemon, type WorkerType, type DaemonConfig } from '../services/worker-daemon.js';-import { spawn, execFile } from 'child_process';+import { spawn, execFile, fork } from 'child_process';import { fileURLToPath } from 'url';import { dirname, join, resolve, isAbsolute } from 'path';import * as fs from 'fs';@@ -256,40 +256,44 @@ async function startBackgroundDaemon(projectRoot: string, quiet: boolean, maxCpureturn { success: false, exitCode: 1 };}- // Platform-aware spawn flags+ // Platform-aware spawn flags. We use child_process.fork() because the daemon+ // child is itself a Node script β fork() spawns Node directly and skips the+ // cmd.exe interpretation pass that broke Windows + Node 25 when+ // process.execPath contained a space (#1691). It also avoids the [DEP0190]+ // shell:true security warning.const isWin = process.platform === 'win32';- const spawnOpts: Record<string, unknown> = {+ const forkOpts: Record<string, unknown> = {cwd: resolvedRoot,- detached: !isWin, // detached is POSIX-only; Windows uses windowsHide- // Use 'ignore' for all stdio β passing fs.openSync() FDs causes the child to- // die on Windows when the parent exits and closes the FDs (#1478 Bug 3).- // The daemon writes its own logs via appendFileSync to .claude-flow/logs/.- stdio: ['ignore', 'ignore', 'ignore'],+ // detached is POSIX-only; on Windows we rely on windowsHide+ detached: !isWin,+ // Use 'ignore' for all stdio + 'ignore' for the IPC channel via silent:true off.+ // fork() defaults to creating an IPC channel; we don't need it here, so we+ // pass stdio explicitly. Passing fs.openSync() FDs causes the child to die+ // on Windows when the parent exits and closes the FDs (#1478 Bug 3) β the+ // daemon writes its own logs via appendFileSync to .claude-flow/logs/.+ stdio: ['ignore', 'ignore', 'ignore', 'ipc'],+ windowsHide: true,env: {...process.env,CLAUDE_FLOW_DAEMON: '1',// Prevent macOS SIGHUP kill when terminal closes...(process.platform === 'darwin' ? { NOHUP: '1' } : {}),},- ...(isWin ? { shell: true, windowsHide: true } : {}),};- // Use spawn with explicit arguments instead of shell string interpolation- // This prevents command injection via paths- const spawnArgs = [- cliPath,- 'daemon', 'start', '--foreground', '--quiet',- ];- // Forward resource threshold flags to the foreground child process- // Validate with strict numeric pattern to prevent shell injection on Windows (S1)+ // Forward args to the foreground child. fork() resolves the script path+ // via Node's normal module resolution, so cliPath does not need to be+ // shell-quoted even when it contains spaces.+ const forkArgs = ['daemon', 'start', '--foreground', '--quiet'];+ // Validate with strict numeric pattern to prevent injection via crafted flags.const SPAWN_NUMERIC_RE = /^\d+(\.\d+)?$/;if (maxCpuLoad && SPAWN_NUMERIC_RE.test(maxCpuLoad)) {- spawnArgs.push('--max-cpu-load', maxCpuLoad);+ forkArgs.push('--max-cpu-load', maxCpuLoad);}if (minFreeMemory && SPAWN_NUMERIC_RE.test(minFreeMemory)) {- spawnArgs.push('--min-free-memory', minFreeMemory);+ forkArgs.push('--min-free-memory', minFreeMemory);}- const child = spawn(process.execPath, spawnArgs, spawnOpts);+ const child = fork(cliPath, forkArgs, forkOpts);// Get PID from spawned process directly (no shell echo needed)const pid = child.pid;diff --git a/v3/@claude-flow/cli/src/commands/embeddings.ts b/v3/@claude-flow/cli/src/commands/embeddings.tsindex 019fe1463c..e6f4a63572 100644--- a/v3/@claude-flow/cli/src/commands/embeddings.ts+++ b/v3/@claude-flow/cli/src/commands/embeddings.ts@@ -572,6 +572,15 @@ const indexCommand: Command = {try {const { getHNSWStatus, getHNSWIndex, searchHNSWIndex, generateEmbedding } = await import('../memory/memory-initializer.js');+ // Trigger lazy initialization before reading status, otherwise the+ // singleton stays null and produces a misleading "@ruvector/core not+ // available" warning even when the package is present (#1698).+ await getHNSWIndex().catch(() => null);++ // Probe whether @ruvector/core is loadable so we can distinguish+ // "package missing" from "package present but index empty".+ const ruvectorAvailable = await import('@ruvector/core').then(() => true).catch(() => false);+// Get real HNSW statusconst status = getHNSWStatus();@@ -615,10 +624,15 @@ const indexCommand: Command = {` Speedup: ~${Math.round(speedup)}x`,` Results: ${results?.length || 0} matches`,].join('\n'), 'Search Performance');- } else if (!status.available) {+ } else if (!status.available && !ruvectorAvailable) {output.writeln();output.printWarning('@ruvector/core not available');output.printInfo('Install: npm install @ruvector/core');+ } else if (!status.available) {+ output.writeln();+ output.printWarning('HNSW index not initialized (but @ruvector/core is installed)');+ output.printInfo('This usually means no embeddings have been stored yet.');+ output.printInfo('Run: claude-flow memory store -k "key" --value "text"');} else {output.writeln();output.printInfo('Index is empty. Store some entries to populate it.');diff --git a/v3/@claude-flow/cli/src/commands/hooks.ts b/v3/@claude-flow/cli/src/commands/hooks.tsindex 776b05fdfb..d949924014 100644--- a/v3/@claude-flow/cli/src/commands/hooks.ts+++ b/v3/@claude-flow/cli/src/commands/hooks.ts@@ -1071,21 +1071,36 @@ const pretrainCommand: Command = {await new Promise(resolve => setTimeout(resolve, 800));}- // Call MCP tool for pretraining- const result = await callMCPTool<{- path: string;- depth: string;- stats: {- filesAnalyzed: number;- patternsExtracted: number;- strategiesLearned: number;- trajectoriesEvaluated: number;- contradictionsResolved: number;+ // Call MCP tool for pretraining. The tool currently returns+ // `{ statistics: { ..., executionTime }, ... }` but earlier CLI+ // versions read `result.stats` and `result.duration` (#1686). Accept+ // either shape so the dashboard works whether you upgraded the tool+ // or the CLI first.+ const rawResult = await callMCPTool<{+ path?: string;+ depth?: string;+ stats?: {+ filesAnalyzed?: number;+ patternsExtracted?: number;+ strategiesLearned?: number;+ trajectoriesEvaluated?: number;+ contradictionsResolved?: number;documentsIndexed?: number;embeddingsGenerated?: number;hyperbolicProjections?: number;};- duration: number;+ statistics?: {+ filesAnalyzed?: number;+ patternsExtracted?: number;+ strategiesLearned?: number;+ trajectoriesEvaluated?: number;+ contradictionsResolved?: number;+ documentsIndexed?: number;+ embeddingsGenerated?: number;+ hyperbolicProjections?: number;+ executionTime?: number;+ };+ duration?: number;}>('hooks_pretrain', {path: repoPath,depth,@@ -1097,6 +1112,11 @@ const pretrainCommand: Command = {spinner.succeed('Pretraining completed');+ // Normalize shape: prefer `statistics`, fall back to `stats` for older tools.+ const stats = (rawResult.statistics ?? rawResult.stats ?? {}) as Record<string, number | undefined>;+ const durationMs = rawResult.duration ?? (rawResult.statistics?.executionTime as number | undefined) ?? 0;+ const result = { ...rawResult, stats, duration: durationMs };+if (ctx.flags.format === 'json') {output.printJson(result);return { success: true, data: result };@@ -1104,25 +1124,26 @@ const pretrainCommand: Command = {output.writeln();- // Base stats+ // Base stats β use ?? 0 fallbacks to keep the table readable even when+ // the tool omits a counter rather than crashing on undefined.const tableData: Array<{ metric: string; value: string | number }> = [- { metric: 'Files Analyzed', value: result.stats.filesAnalyzed },- { metric: 'Patterns Extracted', value: result.stats.patternsExtracted },- { metric: 'Strategies Learned', value: result.stats.strategiesLearned },- { metric: 'Trajectories Evaluated', value: result.stats.trajectoriesEvaluated },- { metric: 'Contradictions Resolved', value: result.stats.contradictionsResolved },+ { metric: 'Files Analyzed', value: stats.filesAnalyzed ?? 0 },+ { metric: 'Patterns Extracted', value: stats.patternsExtracted ?? 0 },+ { metric: 'Strategies Learned', value: stats.strategiesLearned ?? 0 },+ { metric: 'Trajectories Evaluated', value: stats.trajectoriesEvaluated ?? 0 },+ { metric: 'Contradictions Resolved', value: stats.contradictionsResolved ?? 0 },];// Add embedding stats if available- if (withEmbeddings && result.stats.documentsIndexed !== undefined) {+ if (withEmbeddings && stats.documentsIndexed !== undefined) {tableData.push(- { metric: 'Documents Indexed', value: result.stats.documentsIndexed },- { metric: 'Embeddings Generated', value: result.stats.embeddingsGenerated || 0 },- { metric: 'Hyperbolic Projections', value: result.stats.hyperbolicProjections || 0 }+ { metric: 'Documents Indexed', value: stats.documentsIndexed },+ { metric: 'Embeddings Generated', value: stats.embeddingsGenerated ?? 0 },+ { metric: 'Hyperbolic Projections', value: stats.hyperbolicProjections ?? 0 });}- tableData.push({ metric: 'Duration', value: `${(result.duration / 1000).toFixed(1)}s` });+ tableData.push({ metric: 'Duration', value: `${(durationMs / 1000).toFixed(1)}s` });output.printTable({columns: [@@ -1302,30 +1323,50 @@ const metricsCommand: Command = {output.writeln();try {- // Call MCP tool for metrics- const result = await callMCPTool<{- period: string;- patterns: {- total: number;- successful: number;- failed: number;- avgConfidence: number;+ // Call MCP tool for metrics. The tool returns `{ summary, routing,+ // edits, commands }` (see MetricsResult in v3/mcp/tools/hooks-tools.ts)+ // but earlier CLI versions expected `{ patterns, agents, commands.avgRiskScore }`.+ // Accept the union and normalize below β without the `?? 0` guards the+ // dashboard crashed with "Cannot read properties of null (reading 'toFixed')"+ // whenever a counter was missing (#1686).+ const rawMetrics = await callMCPTool<{+ period?: string;+ category?: string;+ timeRange?: string;+ summary?: {+ totalOperations?: number;+ successRate?: number;+ avgQuality?: number;+ patternsLearned?: number;+ };+ patterns?: {+ total?: number;+ successful?: number;+ failed?: number;+ avgConfidence?: number;+ };+ routing?: {+ totalRoutes?: number;+ avgConfidence?: number;+ topAgents?: Array<{ agent: string; count: number; successRate: number }>;};- agents: {- routingAccuracy: number;- totalRoutes: number;- topAgent: string;+ agents?: {+ routingAccuracy?: number;+ totalRoutes?: number;+ topAgent?: string;};- commands: {- totalExecuted: number;- successRate: number;- avgRiskScore: number;+ commands?: {+ totalCommands?: number;+ totalExecuted?: number;+ successRate?: number;+ avgExecutionTime?: number;+ avgRiskScore?: number;};- performance: {- flashAttention: string;- memoryReduction: string;- searchImprovement: string;- tokenReduction: string;+ performance?: {+ flashAttention?: string;+ memoryReduction?: string;+ searchImprovement?: string;+ tokenReduction?: string;};}>('hooks_metrics', {period,@@ -1333,6 +1374,29 @@ const metricsCommand: Command = {category: ctx.flags.category,});+ // Normalize across both shapes; default every numeric to 0 so toFixed+ // never sees null/undefined.+ const totalPatterns = rawMetrics.patterns?.total ?? rawMetrics.summary?.patternsLearned ?? 0;+ const successfulPatterns = rawMetrics.patterns?.successful ?? Math.round((rawMetrics.summary?.successRate ?? 0) * totalPatterns);+ const failedPatterns = rawMetrics.patterns?.failed ?? Math.max(0, totalPatterns - successfulPatterns);+ const avgConfidence = rawMetrics.patterns?.avgConfidence ?? rawMetrics.summary?.avgQuality ?? 0;++ const routingAccuracy = rawMetrics.agents?.routingAccuracy+ ?? (rawMetrics.routing?.avgConfidence ?? 0);+ const totalRoutes = rawMetrics.agents?.totalRoutes ?? rawMetrics.routing?.totalRoutes ?? 0;+ const topAgent = rawMetrics.agents?.topAgent ?? rawMetrics.routing?.topAgents?.[0]?.agent ?? 'n/a';++ const totalCommands = rawMetrics.commands?.totalExecuted ?? rawMetrics.commands?.totalCommands ?? 0;+ const commandSuccessRate = rawMetrics.commands?.successRate ?? 0;+ const avgRiskScore = rawMetrics.commands?.avgRiskScore ?? rawMetrics.commands?.avgExecutionTime ?? 0;++ const result = {+ ...rawMetrics,+ patterns: { total: totalPatterns, successful: successfulPatterns, failed: failedPatterns, avgConfidence },+ agents: { routingAccuracy, totalRoutes, topAgent },+ commands: { totalExecuted: totalCommands, successRate: commandSuccessRate, avgRiskScore },+ };+if (ctx.flags.format === 'json') {output.printJson(result);return { success: true, data: result };@@ -1346,10 +1410,10 @@ const metricsCommand: Command = {{ key: 'value', header: 'Value', width: 20, align: 'right' }],data: [- { metric: 'Total Patterns', value: result.patterns.total },- { metric: 'Successful', value: output.success(String(result.patterns.successful)) },- { metric: 'Failed', value: output.error(String(result.patterns.failed)) },- { metric: 'Avg Confidence', value: `${(result.patterns.avgConfidence * 100).toFixed(1)}%` }+ { metric: 'Total Patterns', value: totalPatterns },+ { metric: 'Successful', value: output.success(String(successfulPatterns)) },+ { metric: 'Failed', value: output.error(String(failedPatterns)) },+ { metric: 'Avg Confidence', value: `${(avgConfidence * 100).toFixed(1)}%` }]});@@ -1363,9 +1427,9 @@ const metricsCommand: Command = {{ key: 'value', header: 'Value', width: 20, align: 'right' }],data: [- { metric: 'Routing Accuracy', value: `${(result.agents.routingAccuracy * 100).toFixed(1)}%` },- { metric: 'Total Routes', value: result.agents.totalRoutes },- { metric: 'Top Agent', value: output.highlight(result.agents.topAgent) }+ { metric: 'Routing Accuracy', value: `${(routingAccuracy * 100).toFixed(1)}%` },+ { metric: 'Total Routes', value: totalRoutes },+ { metric: 'Top Agent', value: output.highlight(topAgent) }]});@@ -1379,9 +1443,9 @@ const metricsCommand: Command = {{ key: 'value', header: 'Value', width: 20, align: 'right' }],data: [- { metric: 'Total Executed', value: result.commands.totalExecuted },- { metric: 'Success Rate', value: `${(result.commands.successRate * 100).toFixed(1)}%` },- { metric: 'Avg Risk Score', value: result.commands.avgRiskScore.toFixed(2) }+ { metric: 'Total Executed', value: totalCommands },+ { metric: 'Success Rate', value: `${(commandSuccessRate * 100).toFixed(1)}%` },+ { metric: 'Avg Risk Score', value: avgRiskScore.toFixed(2) }]});diff --git a/v3/@claude-flow/cli/src/commands/performance.ts b/v3/@claude-flow/cli/src/commands/performance.tsindex e5a57bd16e..ab23c69f4a 100644--- a/v3/@claude-flow/cli/src/commands/performance.ts+++ b/v3/@claude-flow/cli/src/commands/performance.ts@@ -41,6 +41,7 @@ const benchmarkCommand: Command = {batchCosineSim,flashAttentionSearch,getHNSWStatus,+ getHNSWIndex,storeEntry,searchEntries,} = await import('../memory/memory-initializer.js');@@ -122,6 +123,10 @@ const benchmarkCommand: Command = {// 3. HNSW Search Benchmarkif (suite === 'all' || suite === 'search') {spinner.setText('Benchmarking HNSW search...');+ // Trigger lazy initialization before reading status (#1698) β without+ // this the singleton stays null and we report "No index" even when+ // @ruvector/core is loadable and the index has data on disk.+ await getHNSWIndex().catch(() => null);const hnswStatus = getHNSWStatus();if (hnswStatus.available && hnswStatus.entryCount > 0) {diff --git a/v3/goal_ui/src/pages/Index.tsx b/v3/goal_ui/src/pages/Index.tsxindex 7f6d2f96b9..cd1b774a06 100644--- a/v3/goal_ui/src/pages/Index.tsx+++ b/v3/goal_ui/src/pages/Index.tsx@@ -24,6 +24,7 @@ import {RotateCcw,ExternalLink,Code,+ Play,} from "lucide-react";import { AgentStep, StepStatus } from "@/components/AgentStep";import { Button } from "@/components/ui/button";@@ -590,11 +591,8 @@ const Index = () => {setIsPlanning(false);setPlanGenerated(true);setVisibleSteps(1);-- // Auto-start execution with the generated plan- setTimeout(() => {- executeResearch(plan, goal);- }, 500);+ // Issue #1694: do NOT auto-execute. Wait for the user to click+ // "Start Research" so the planning step is observable and reversible.};// Execute research plan@@ -1119,7 +1117,20 @@ const Index = () => {<div className="text-xs sm:text-sm flex-1 min-w-0 text-center px-4" style={{ color: "#a3a3a3" }}><span className="font-medium" style={{ color: "#f5f5f5" }}>Objective:</span> <span className="break-words">{userGoal}</span></div>- <div className="w-[120px]" />+ {/* Issue #1694: explicit "Start Research" gate so the plan is reviewable before execution. */}+ {!isRunning && visibleSteps <= 1 ? (+ <Button+ onClick={() => executeResearch(steps, userGoal)}+ size="sm"+ className="gap-2"+ style={{ backgroundColor: widgetConfig.primaryColor, color: "#fff" }}+ >+ <Play className="w-4 h-4" />+ Start Research+ </Button>+ ) : (+ <div className="w-[120px]" />+ )}</div>{/* Timeline */}diff --git a/v3/mcp/tools/hooks-tools.ts b/v3/mcp/tools/hooks-tools.tsindex 6c1ee8f466..bca7e13ef9 100644--- a/v3/mcp/tools/hooks-tools.ts+++ b/v3/mcp/tools/hooks-tools.ts@@ -17,6 +17,8 @@*/import { z } from 'zod';+import * as path from 'path';+import * as fs from 'fs';import { MCPTool, ToolContext } from '../types.js';import {ReasoningBank,@@ -37,6 +39,15 @@ let reasoningBankInitPromise: Promise<void> | null = null;*/async function getReasoningBank(): Promise<ReasoningBank> {if (!reasoningBankInstance) {+ // Persist to .swarm/memory.db so post-* writes survive across processes+ // and the metrics dashboard can read them back (#1686). Without dbPath+ // ReasoningBank defaults to ':memory:' and writes vanish on exit.+ const swarmDir = path.resolve(process.cwd(), '.swarm');+ if (!fs.existsSync(swarmDir)) {+ try { fs.mkdirSync(swarmDir, { recursive: true }); } catch { /* ignore */ }+ }+ const dbPath = path.join(swarmDir, 'memory.db');+reasoningBankInstance = createReasoningBank({maxTrajectories: 5000,distillationThreshold: 0.6,@@ -44,6 +55,7 @@ async function getReasoningBank(): Promise<ReasoningBank> {mmrLambda: 0.7,enableAgentDB: true,namespace: 'hooks-learning',+ dbPath,});if (!reasoningBankInitPromise) {