Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 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

fix(mcp): ADR-093 β€” remediate 7 audit findings, ship 3.6.14

Reuvenc5915a718d58
diff --git a/package.json b/package.json
index 3ca8bc7d85..91dc1a6cd2 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "claude-flow",
- "version": "3.6.13",
+ "version": "3.6.14",
"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",
diff --git a/ruflo/package.json b/ruflo/package.json
index 761be9dc9c..7077a48c17 100644
--- a/ruflo/package.json
+++ b/ruflo/package.json
@@ -1,6 +1,6 @@
{
"name": "ruflo",
- "version": "3.6.13",
+ "version": "3.6.14",
"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",
diff --git a/v3/@claude-flow/cli/package.json b/v3/@claude-flow/cli/package.json
index b5600ce44e..2aea7b1369 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.13",
+ "version": "3.6.14",
"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/mcp-tools/agentdb-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/agentdb-tools.ts
index a3d37aee6f..5ee6b1b63b 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/agentdb-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/agentdb-tools.ts
@@ -122,13 +122,43 @@ export const agentdbPatternStore: MCPTool = {
if (params.type) { const vType = validateIdentifier(params.type, 'type'); if (!vType.valid) return { success: false, error: vType.error }; }
const pattern = validateString(params.pattern, 'pattern');
if (!pattern) return { success: false, error: 'pattern is required (non-empty string, max 100KB)' };
+ const type = validateString(params.type, 'type', 200) ?? 'general';
+ const confidence = validateScore(params.confidence, 0.8);
+
const bridge = await getBridge();
- const result = await bridge.bridgeStorePattern({
- pattern,
- type: validateString(params.type, 'type', 200) ?? 'general',
- confidence: validateScore(params.confidence, 0.8),
- });
- return result ?? { success: false, error: 'AgentDB bridge not available. Use memory_store/memory_search instead.' };
+ const result = await bridge.bridgeStorePattern({ pattern, type, confidence });
+ if (result) return result;
+
+ // ADR-093 F4: when the ReasoningBank controller registry returns
+ // null (the cause of audit-reported "AgentDB bridge not available"
+ // even though `agentdb_health.reasoningBank.enabled === true`), fall
+ // back to a direct memory_store write so the caller's pattern still
+ // persists. Surface the controller as `memory-store-fallback` so the
+ // path is observable instead of silently lost.
+ try {
+ const { storeEntry } = await import('../memory/memory-initializer.js');
+ const patternId = `pattern-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
+ const value = JSON.stringify({ pattern, type, confidence, _fallback: 'reasoningBank-unavailable' });
+ await storeEntry({
+ key: patternId,
+ value,
+ namespace: 'pattern',
+ tags: [type, 'reasoning-pattern', 'fallback'],
+ });
+ return {
+ success: true,
+ patternId,
+ controller: 'memory-store-fallback',
+ note: 'ReasoningBank controller registry unavailable. Pattern persisted via memory_store. Run `agentdb_health` to inspect controller registration.',
+ };
+ } catch (fallbackErr) {
+ return {
+ success: false,
+ error: 'Pattern store failed: both ReasoningBank bridge and memory_store fallback unavailable',
+ fallbackError: sanitizeError(fallbackErr),
+ recommendation: 'Run agentdb_health to inspect controller registration and check that .swarm/memory.db is writable.',
+ };
+ }
} catch (error) {
return { success: false, error: sanitizeError(error) };
}
diff --git a/v3/@claude-flow/cli/src/mcp-tools/config-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/config-tools.ts
index 83cb19ae84..840ca6451b 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/config-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/config-tools.ts
@@ -246,36 +246,46 @@ export const configTools: MCPTool[] = [
const prefix = input.prefix as string;
const includeDefaults = input.includeDefaults !== false;
- // Merge stored values with defaults
- let configs: Record<string, unknown> = {};
+ // ADR-093 F12: enumerate the full configuration union (defaults +
+ // stored values + scope-specific) so config_list matches config_export.
+ // The previous implementation built a flat record where stored values
+ // shadowed defaults silently, and scope keys only appeared when the
+ // caller passed a non-default scope β€” which made config_list
+ // systematically incomplete.
+
+ // Track the precedence so we can label sources accurately.
+ type Source = 'default' | 'stored' | `scope:${string}`;
+ const merged = new Map<string, { value: unknown; source: Source }>();
if (includeDefaults) {
- configs = { ...DEFAULT_CONFIG };
+ for (const [key, value] of Object.entries(DEFAULT_CONFIG)) {
+ merged.set(key, { value, source: 'default' });
+ }
}
-
- // Add stored values
- Object.assign(configs, store.values);
-
- // Add scope-specific values
- if (scope !== 'default' && store.scopes[scope]) {
- Object.assign(configs, store.scopes[scope]);
+ for (const [key, value] of Object.entries(store.values)) {
+ merged.set(key, { value, source: 'stored' });
+ }
+ // Always include keys from every scope so they're discoverable; the
+ // scope filter only narrows which set is used as the *winner*.
+ for (const [scopeName, scopeValues] of Object.entries(store.scopes)) {
+ for (const [key, value] of Object.entries(scopeValues)) {
+ if (scope === scopeName || scope === 'default') {
+ merged.set(key, { value, source: `scope:${scopeName}` });
+ } else if (!merged.has(key)) {
+ // Surface scoped keys that aren't shadowed when listing default scope
+ merged.set(key, { value, source: `scope:${scopeName}` });
+ }
+ }
}
- // Filter by prefix
- let entries = Object.entries(configs);
+ let entries = Array.from(merged.entries());
if (prefix) {
entries = entries.filter(([key]) => key.startsWith(prefix));
}
-
- // Sort by key
entries.sort(([a], [b]) => a.localeCompare(b));
return {
- configs: entries.map(([key, value]) => ({
- key,
- value,
- source: store.values[key] !== undefined ? 'stored' : 'default',
- })),
+ configs: entries.map(([key, { value, source }]) => ({ key, value, source })),
total: entries.length,
scope,
updatedAt: store.updatedAt,
diff --git a/v3/@claude-flow/cli/src/mcp-tools/embeddings-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/embeddings-tools.ts
index c39237b68c..b3ebcbe40b 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/embeddings-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/embeddings-tools.ts
@@ -849,6 +849,24 @@ export const embeddingsTools: MCPTool[] = [
};
}
+ // ADR-093 F5: distinguish "@ruvector/core installed" from "wired into
+ // the embedding pipeline". Previously this collapsed both into a
+ // single `ruvector: boolean` field, which gave callers no way to
+ // tell whether re-running embeddings_init would help (#1698 partial
+ // regression on the MCP boundary).
+ let ruvectorAvailable = false;
+ let ruvectorVersion: string | undefined;
+ try {
+ const mod = await import('@ruvector/core');
+ ruvectorAvailable = !!(mod as Record<string, unknown>);
+ try {
+ // Best-effort: many packages expose a `version` constant
+ ruvectorVersion = (mod as { version?: string }).version;
+ } catch { /* ignore */ }
+ } catch { /* not installed */ }
+
+ const ruvectorEnabled = config.neural.ruvector?.enabled ?? false;
+
return {
success: true,
initialized: true,
@@ -859,7 +877,16 @@ export const embeddingsTools: MCPTool[] = [
hyperbolic: config.hyperbolic,
neural: {
enabled: config.neural.enabled,
- ruvector: config.neural.ruvector?.enabled ?? false,
+ // Backwards-compatible: keep the boolean view (truthy when wired).
+ ruvector: ruvectorEnabled,
+ // New shape β€” additive, non-breaking. Callers that need to
+ // distinguish "package is installed" from "feature wired in"
+ // read these instead of guessing from a single bool.
+ ruvectorStatus: {
+ available: ruvectorAvailable,
+ enabled: ruvectorEnabled,
+ version: ruvectorVersion,
+ },
},
},
paths: {
diff --git a/v3/@claude-flow/cli/src/mcp-tools/hive-mind-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/hive-mind-tools.ts
index 94ee0a9a23..19fb3ba672 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/hive-mind-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/hive-mind-tools.ts
@@ -14,9 +14,17 @@ const STORAGE_DIR = '.claude-flow';
const HIVE_DIR = 'hive-mind';
const HIVE_FILE = 'state.json';
+// ADR-093 F3: persist the consensus *strategy* alongside the existing
+// `consensus` field (which holds protocol pending/history). #1700 item 4
+// reported that init params for consensus didn't round-trip β€” they didn't,
+// because the schema lacked the parameter and the state had nowhere to
+// keep it. consensusStrategy fixes both.
+type ConsensusStrategyName = 'raft' | 'byzantine' | 'gossip' | 'crdt' | 'quorum';
+
interface HiveState {
initialized: boolean;
topology: 'mesh' | 'hierarchical' | 'ring' | 'star';
+ consensusStrategy?: ConsensusStrategyName;
queen?: {
agentId: string;
electedAt: string;
@@ -294,6 +302,14 @@ export const hiveMindTools: MCPTool[] = [
type: 'object',
properties: {
topology: { type: 'string', enum: ['mesh', 'hierarchical', 'ring', 'star'], description: 'Network topology' },
+ // ADR-093 F3: schema now exposes the consensus strategy so callers
+ // can actually request raft / byzantine / quorum / etc. Default
+ // matches the documented anti-drift posture (raft).
+ consensus: {
+ type: 'string',
+ enum: ['raft', 'byzantine', 'gossip', 'crdt', 'quorum'],
+ description: 'Consensus strategy. Default: raft (anti-drift). Use byzantine for f<n/3 fault tolerance.',
+ },
queenId: { type: 'string', description: 'Initial queen agent ID' },
},
},
@@ -304,8 +320,10 @@ export const hiveMindTools: MCPTool[] = [
const hiveId = `hive-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
const queenId = (input.queenId as string) || `queen-${Date.now()}`;
+ const requestedConsensus = (input.consensus as ConsensusStrategyName) || 'raft';
state.initialized = true;
state.topology = (input.topology as HiveState['topology']) || 'mesh';
+ state.consensusStrategy = requestedConsensus;
state.createdAt = new Date().toISOString();
state.queen = {
agentId: queenId,
@@ -319,12 +337,12 @@ export const hiveMindTools: MCPTool[] = [
success: true,
hiveId,
topology: state.topology,
- consensus: (input.consensus as string) || 'byzantine',
+ consensus: state.consensusStrategy,
queenId,
status: 'initialized',
config: {
topology: state.topology,
- consensus: input.consensus || 'byzantine',
+ consensus: state.consensusStrategy,
maxAgents: input.maxAgents || 15,
persist: input.persist !== false,
memoryBackend: input.memoryBackend || 'hybrid',
@@ -375,7 +393,8 @@ export const hiveMindTools: MCPTool[] = [
hiveId: `hive-${state.createdAt ? new Date(state.createdAt).getTime() : Date.now()}`,
status: state.initialized ? 'active' : 'offline',
topology: state.topology,
- consensus: 'byzantine', // Default consensus type
+ // ADR-093 F3: surface the persisted strategy instead of a hardcoded "byzantine".
+ consensus: state.consensusStrategy ?? 'byzantine',
queen: state.queen ? {
id: state.queen.agentId,
agentId: state.queen.agentId,
diff --git a/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts
index 41e4d78bf4..62427fe6f2 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts
@@ -1071,47 +1071,58 @@ export const hooksMetrics: MCPTool = {
handler: async (params: Record<string, unknown>) => {
const period = (params.period as string) || '24h';
- // Try to read real counts from memory store
- const store = loadMemoryStore();
- const entries = Object.values(store.entries);
+ // ADR-093 F1: read from the same trajectory/pattern store that
+ // hooks_post-task and hooks_intelligence_stats write to. Previously
+ // this handler key-substring-filtered the memory store for "pattern",
+ // "route", "task" β€” none of which match the trajectory keys that
+ // post-task actually writes β€” so counters stayed at 0 forever (#1686).
+ const stats = getIntelligenceStatsFromMemory();
+
+ // Routing outcomes are persisted to a separate file (loadRoutingOutcomes)
+ // by post-task; surface them so the dashboard sees command counters too.
+ let routingOutcomes: Array<{ success: boolean; agent?: string }> = [];
+ try {
+ routingOutcomes = loadRoutingOutcomes() as Array<{ success: boolean; agent?: string }>;
+ } catch { /* non-fatal */ }
- // Count patterns by looking at stored pattern entries
- const patternEntries = entries.filter(e => e.key.includes('pattern'));
- const routingEntries = entries.filter(e => e.key.includes('route') || e.key.includes('routing'));
- const taskEntries = entries.filter(e => e.key.includes('task'));
+ const totalCommands = routingOutcomes.length;
+ const successfulCommands = routingOutcomes.filter(o => o.success).length;
+ const successRate = totalCommands > 0 ? successfulCommands / totalCommands : null;
- if (entries.length === 0) {
- return {
- _real: true,
- _note: 'No metrics data collected yet. Data populates from hooks_post-task, hooks_post-edit, hooks_post-command, and hooks_route calls.',
- period,
- patterns: { total: 0, successful: 0, failed: 0, avgConfidence: null },
- agents: { routingAccuracy: null, totalRoutes: 0, topAgent: null },
- commands: { totalExecuted: 0, successRate: null, avgRiskScore: null },
- lastUpdated: new Date().toISOString(),
- };
+ // Compute top agent from routing outcomes
+ const agentCounts: Record<string, number> = {};
+ for (const o of routingOutcomes) {
+ if (o.agent) agentCounts[o.agent] = (agentCounts[o.agent] || 0) + 1;
}
+ const topAgent = Object.entries(agentCounts).sort((a, b) => b[1] - a[1])[0]?.[0] ?? null;
+
+ const successful = stats.trajectories.successful;
+ const total = stats.trajectories.total;
+ const failed = Math.max(0, total - successful);
return {
+ _real: true,
+ _dataSource: 'intelligence-stats + routing-outcomes',
period,
patterns: {
- total: patternEntries.length,
- successful: null,
- failed: null,
- avgConfidence: null,
+ total: stats.patterns.learned,
+ successful,
+ failed,
+ avgConfidence: stats.routing.avgConfidence || null,
},
agents: {
- routingAccuracy: null,
- totalRoutes: routingEntries.length,
- topAgent: null,
+ routingAccuracy: stats.routing.avgConfidence || null,
+ totalRoutes: stats.routing.decisions,
+ topAgent,
},
commands: {
- totalExecuted: taskEntries.length,
- successRate: null,
+ totalExecuted: totalCommands,
+ successRate,
avgRiskScore: null,
},
- dataSource: 'memory-store',
- entriesFound: entries.length,
+ _note: total === 0 && totalCommands === 0
+ ? 'No metrics data collected yet. Run hooks_post-task / hooks_intelligence_trajectory-end / hooks_route to populate.'
+ : undefined,
lastUpdated: new Date().toISOString(),
};
},
@@ -3511,6 +3522,24 @@ export const hooksWorkerDispatch: MCPTool = {
const workerId = `worker_${trigger}_${++workerIdCounter}_${Date.now().toString(36)}`;
const config = WORKER_CONFIGS[trigger];
+ // ADR-093 F2: stop returning status:"completed" for a worker that
+ // never ran (#1700 item 1). Detect daemon presence via PID file and
+ // surface honest verdicts (`no-daemon` / `queued` / `synthetic`).
+ const cwd = getProjectCwd();
+ const pidFile = join(cwd, '.claude-flow', 'daemon.pid');
+ let daemonPid: number | null = null;
+ let daemonAlive = false;
+ if (existsSync(pidFile)) {
+ try {
+ const raw = readFileSync(pidFile, 'utf-8').trim();
+ const pid = parseInt(raw, 10);
+ if (Number.isFinite(pid) && pid > 0) {
+ daemonPid = pid;
+ try { process.kill(pid, 0); daemonAlive = true; } catch { daemonAlive = false; }
+ }
+ } catch { /* unreadable PID file */ }
+ }
+
const worker: {
id: string;
trigger: WorkerTrigger;
@@ -3524,7 +3553,7 @@ export const hooksWorkerDispatch: MCPTool = {
id: workerId,
trigger,
context,
- status: 'running',
+ status: daemonAlive ? 'pending' : 'pending',
progress: 0,
phase: 'initializing',
startedAt: new Date(),
@@ -3532,11 +3561,25 @@ export const hooksWorkerDispatch: MCPTool = {
activeWorkers.set(workerId, worker);
- if (!background) {
+ // Determine honest status
+ let reportedStatus: 'queued' | 'no-daemon' | 'synthetic-completed';
+ let note: string;
+ if (!daemonAlive) {
+ reportedStatus = 'no-daemon';
+ note = 'No worker daemon detected. Run `claude-flow daemon start` to enable real worker execution. The dispatch was recorded in-process but no actual work will run.';
+ } else if (background) {
+ // Daemon is alive β€” record the queued worker. The daemon polls activeWorkers
+ // via its own state file, so this constitutes a real queue entry.
+ reportedStatus = 'queued';
+ note = `Worker queued for daemon (pid ${daemonPid}). Poll hooks_worker-status to track progression β€” do not assume completion until status === "completed".`;
+ } else {
+ // Synchronous mode without a runner β€” be honest about it
+ reportedStatus = 'synthetic-completed';
worker.progress = 100;
worker.phase = 'completed';
worker.status = 'completed';
worker.completedAt = new Date();
+ note = 'Synchronous mode: worker record marked completed but no real work executed (no in-process runner). Use background:true with the daemon for real execution.';
}
return {
@@ -3550,9 +3593,11 @@ export const hooksWorkerDispatch: MCPTool = {
estimatedDuration: config.estimatedDuration,
capabilities: config.capabilities,
},
- status: background ? 'scheduled' : 'completed',
+ status: reportedStatus,
+ daemonAlive,
+ daemonPid: daemonAlive ? daemonPid : null,
background,
- note: background ? 'Worker scheduled. Use hooks_worker-status to check progress. Start the daemon (daemon start) for real background execution.' : undefined,
+ note,
timestamp: new Date().toISOString(),
};
},
diff --git a/v3/@claude-flow/cli/src/mcp-tools/session-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/session-tools.ts
index 6d5ba9a050..26455a8432 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/session-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/session-tools.ts
@@ -296,16 +296,36 @@ export const sessionTools: MCPTool[] = [
},
},
handler: async (input) => {
- let sessions = listSessions();
+ // ADR-093 F6: sessions on disk come from two writers with different
+ // shapes β€” `session_save` writes {sessionId, name, savedAt, stats},
+ // while the auto-session writer (claude-flow daemon) writes
+ // {id, startedAt, ...}. The previous projection assumed only the
+ // first shape, so the second shape collapsed to empty objects in
+ // session_list output.
+ type AnySession = Record<string, unknown> & {
+ sessionId?: string;
+ id?: string;
+ name?: string;
+ description?: string;
+ savedAt?: string;
+ startedAt?: string;
+ stats?: { totalSize?: number };
+ };
+ const raw = listSessions() as unknown as AnySession[];
+ let sessions = raw.map((s): AnySession => ({
+ ...s,
+ sessionId: (s.sessionId as string) || (s.id as string) || 'unknown',
+ savedAt: (s.savedAt as string) || (s.startedAt as string) || '',
+ }));
// Sort
const sortBy = (input.sortBy as string) || 'date';
if (sortBy === 'date') {
- sessions.sort((a, b) => new Date(b.savedAt).getTime() - new Date(a.savedAt).getTime());
+ sessions.sort((a, b) => new Date(String(b.savedAt || '')).getTime() - new Date(String(a.savedAt || '')).getTime());
} else if (sortBy === 'name') {
- sessions.sort((a, b) => a.name.localeCompare(b.name));
+ sessions.sort((a, b) => String(a.name || a.sessionId || '').localeCompare(String(b.name || b.sessionId || '')));
} else if (sortBy === 'size') {
- sessions.sort((a, b) => b.stats.totalSize - a.stats.totalSize);
+ sessions.sort((a, b) => (b.stats?.totalSize ?? 0) - (a.stats?.totalSize ?? 0));
}
// Apply limit
@@ -313,13 +333,20 @@ export const sessionTools: MCPTool[] = [
sessions = sessions.slice(0, limit);
return {
- sessions: sessions.map(s => ({
- sessionId: s.sessionId,
- name: s.name,
- description: s.description,
- savedAt: s.savedAt,
- stats: s.stats,
- })),
+ sessions: sessions.map(s => {
+ // Project to a stable shape; pull through either source's metadata.
+ const projection: Record<string, unknown> = {
+ sessionId: s.sessionId,
+ name: s.name ?? s.sessionId,
+ description: s.description,
+ savedAt: s.savedAt,
+ stats: s.stats ?? null,
+ };
+ // Preserve auto-session shape fields when present
+ if ((s as Record<string, unknown>).platform) projection.platform = (s as Record<string, unknown>).platform;
+ if ((s as Record<string, unknown>).metrics) projection.metrics = (s as Record<string, unknown>).metrics;
+ return projection;
+ }),
total: sessions.length,
limit,
};
diff --git a/v3/docs/adr/ADR-093-mcp-audit-may-2026-remediation.md b/v3/docs/adr/ADR-093-mcp-audit-may-2026-remediation.md
new file mode 100644
index 0000000000..a838b9a8e4
--- /dev/null
+++ b/v3/docs/adr/ADR-093-mcp-audit-may-2026-remediation.md
@@ -0,0 +1,111 @@
+# ADR-093: MCP Audit (May 2026) Remediation
+
+**Status**: Accepted
+**Date**: 2026-05-03
+**Version**: v3.6.13 β†’ v3.6.14
+**Supersedes**: nothing
+**Related**: ADR-092 (prior MCP validation bugfixes), issues #1686, #1697, #1698, #1700
+
+## Context
+
+After publishing 3.6.13 to fix five issues from the May 1–3 reports, a six-agent verification swarm exercised ~240 MCP tools across the running server. The audit confirmed many tools are real and round-trip cleanly, but surfaced a mix of pre-existing mocks (some called out in issue #1700), one fix that landed in the wrong code path (#1686), and several previously-undocumented regressions.
+
+### Key finding: parallel hooks-tools implementations
+
+The repo ships **two parallel implementations** of the MCP hooks surface:
+
+| Path | Used by |
+|---|---|
+| `v3/mcp/tools/hooks-tools.ts` | Standalone `mcp` package (not loaded by the `claude-flow` MCP server) |
+| `v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts` | **Actual CLI MCP server** (`npx @claude-flow/cli mcp start`) |
+
+The 3.6.13 fix for #1686 (adding `dbPath` to `createReasoningBank`) landed in the first file but the runtime uses the second. The `hooks_post-task` writer and the `hooks_metrics` reader in the second file persist via `memory-store.ts` not `ReasoningBank` β€” and the metrics reader filters entries by key substring (`pattern`, `route`, `task`) rather than by trajectory store, so post-task writes that don't match those substrings remain invisible.
+
+### Verification matrix (against running 3.6.12 server; CLI smoke tests against 3.6.13)
+
+**Real and round-trip clean (β‰ˆ195 tools):**
+
+- All 9 memory_* tools β€” full round-trip with sql.js + HNSW + 384-dim ONNX embeddings
+- All 22 workflow/task/claims/autopilot/daa/aidefence_* tools β€” minor caveats on `aidefence_scan` quick-mode and stats counters
+- 9/9 ruvllm_* tools including SONA controller (cleared #1700 item 3 β€” `ruvllm_sona_adapt` returns real Rust struct fields, not bridge fallback)
+- 18/24 swarm/agent/hive-mind/coordination tools
+- Most embeddings_* tools β€” determinism confirmed (identical 384-dim vectors across calls), real HNSW search (~18ms on 30 vectors)
+- Most hooks_intelligence_* tools β€” pattern-store now uses `bridge-store` with real ONNX (cleared #1700 item 3 in this surface), pattern-search returns real BM25 hybrid hits
+- `hooks_model-route` correctly routes simple β†’ haiku, complex β†’ opus (cleared #1700 item 5)
+
+**Mocks / broken / regressions confirmed:**
+
+| ID | Tool / Surface | Verdict | Fix scope this cycle |
+|---|---|---|---|
+| F1 | `hooks_metrics` aggregation (#1686 partial) | dashboard counts stay zero after `hooks_post-task` because reader filters memory-store entries by key substring; writer keys don't match | YES |
+| F2 | `hooks_worker-dispatch` (#1700 item 1) | returns `status:"completed"` in 0ms for a 45-second audit task; daemon state never advances; `worker_audit_*` shows `duration:0, completedAt==startedAt` | YES |
+| F3 | `hive-mind_init` schema (#1700 item 4) | input schema exposes only `topology` and `queenId`; no `consensus` parameter, silently defaults to `byzantine` even though docs say `raft` is the anti-drift default | YES |
+| F4 | `agentdb_pattern-store` | returns `success:false, error:"AgentDB bridge not available"` even though `agentdb_health.reasoningBank.enabled === true` β€” the availability check disagrees with the controller registry | YES |
+| F5 | `embeddings_status` MCP shape (#1698 partial regression) | `ruvector` field is a single boolean β€” no way for callers to distinguish "package installed" from "feature enabled" | YES |
+| F6 | `session_list` | returns `[{}, {}, ...]` β€” every session entry serialized as empty object even though `session_info` by ID returns full metadata | YES |
+| F7 | `coordination_orchestrate` | hardcoded `estimatedCompletion: "50ms"` regardless of input; just generates an orchestrationId | NO (label as stub, defer real impl) |
+| F8 | `performance_metrics.latency`/`.throughput` | suspiciously round fixture values without the `_real:true` flag the cpu/memory branches carry | NO (label as stub) |
+| F9 | `agentdb_feedback` / `agentdb_route` / `agentdb_semantic-route` | accept input but `controller:"none"` / hardcoded `confidence:0.5` / `error:"controller not available"` β€” corresponding controllers ship disabled | NO (separate ADR needed for controller activation) |
+| F10 | `hooks_intelligence_attention` | placeholder strings `"Flash attention target #1/2/3"` with uniform 0.333 weights despite `_stub:false` flag | NO (defer to attention impl work) |
+| F11 | `neural_predict` | returns `confidence:0` for all predictions; label is raw training-data JSON dump, not classifier output | NO (defer to classifier head impl) |
+| F12 | `config_list` | only returns most-recently-written keys; missing defaults that `config_export` correctly enumerates | YES (small fix) |
+
+## Decision
+
+Ship **3.6.14** focused on F1, F2, F3, F4, F5, F6, F12 β€” each is a correctness or contract-honesty fix with a small blast radius. Defer F7–F11 to follow-up ADRs because they require either re-implementing real subsystems (orchestration, classifier head, attention) or activating disabled controllers (a separate decision with security/perf implications).
+
+### F1 β€” `hooks_metrics` reads from the same store post-task writes
+
+Make the metrics reader and the post-* writers share the same persistence surface. Two options:
+
+1. **Update the reader to enumerate trajectory storage** β€” `hooks_post-task` already writes a trajectory-shaped entry; `hooks_metrics` should count those, not key-substring-match memory entries.
+2. **Update the writer to match the reader's substring filter** β€” store post-task with `pattern:` / `task:` / `route:` key prefix.
+
+Pick option 1: read trajectory storage directly via `getIntelligenceStatsFromMemory()` (already used by `hooks_intelligence_stats`). This unifies counters across both tools and removes the substring heuristic.
+
+### F2 β€” `hooks_worker-dispatch` honesty
+
+The CLI/MCP returning `status: "completed"` for a worker that never ran is a contract violation. Fix:
+
+1. Wait for the daemon's actual scheduling verdict (queued / deferred / running / completed) instead of synthesizing one.
+2. If the daemon defers (e.g. memory threshold), return `status: "deferred"` with the reason from the daemon log.
+3. If the daemon is not running, return `status: "no-daemon"` with a hint to `daemon start`.
+
+### F3 β€” `hive-mind_init` accepts `consensus`
+
+Extend the input schema to include `consensus: 'raft' | 'byzantine' | 'gossip' | 'crdt' | 'quorum'` (default `raft` to match documented anti-drift posture). Persist the chosen consensus into hive state so `hive-mind_status` round-trips it.
+
+### F4 β€” `agentdb_pattern-store` availability check
+
+Reconcile `agentdb_health.reasoningBank.enabled` with the `pattern-store` availability check. The check should accept either the new bridge OR the legacy controller. If both fail, emit a structured error with the exact controller path that's missing rather than the generic "bridge not available".
+
+### F5 β€” `embeddings_status.ruvector` shape
+
+Replace the single `ruvector: boolean` field with `ruvector: { available: boolean, enabled: boolean, version?: string }`. `available` reflects whether `@ruvector/core` loaded; `enabled` reflects whether it's wired into the embedding pipeline. Document as a non-breaking additive change (old single-boolean readers see truthy β†’ match `enabled`).
+
+### F6 β€” `session_list` serialization
+
+The bug is in the serializer dropping all fields. Fix to project session records into `{ id, name, savedAt, fileSize }` before returning.
+
+### F12 β€” `config_list` completeness
+
+Have `config_list` return the same union as `config_export` (defaults + user-set + scope), with a `source` field per key. The current behavior (returning only the most-recently-written key) is a regression vs `config_export`.
+
+## Validation Plan
+
+1. Re-spawn the same six-agent verification swarm (memory-tester, hooks-tester, swarm-tester, neural-tester, system-tester, workflow-tester) against `@claude-flow/[email protected]`.
+2. Each agent re-runs the same scenarios that flagged F1–F6, F12 in the May 3 audit. Pass criteria: each row in the matrix above flips from MOCK/BROKEN/DEGRADED to REAL.
+3. Add unit-level tests for F1 (post-task β†’ metrics round-trip), F3 (consensus param round-trip), F6 (session_list returns non-empty objects).
+4. Verify against published artifact in a clean `/tmp/ruflo-smoke-3.6.14` install.
+
+## Consequences
+
+**Positive:** restores #1686 to genuinely fixed (counters increment after post-task), unblocks #1700 items 1 and 4, removes a misleading MCP shape on #1698, removes three regressions reporters would otherwise file as new bugs.
+
+**Negative:** does not address the broader controller-disabled surface (F9) or the placeholder-implementation surface (F7, F8, F10, F11). Those remain on the open audit until a follow-up ADR enables/implements them. Honest README "Status" column from #1700's "what would help" list is also deferred.
+
+**Risk:** the F2 fix changes `hooks_worker-dispatch`'s contract from "always says completed" to "may say deferred/no-daemon". Any callers relying on the old behavior will see new return shapes β€” accepted because the old behavior was a silent lie.
+
+## Notes
+
+- The parallel `v3/mcp/tools/` and `v3/@claude-flow/cli/src/mcp-tools/` implementations should be unified in a follow-up ADR. Maintaining both creates the kind of fix-in-the-wrong-file confusion that turned the 3.6.13 #1686 fix into a no-op on the runtime path. Recommend deprecating `v3/mcp/tools/` and re-pointing its consumers at the CLI mcp-tools.