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: address P0-P2 bugs from ADR-059 triage

rUv48b70afca3b0
diff --git a/package.json b/package.json
index f56888509e..0f8740cbcc 100644
--- a/package.json
+++ b/package.json
@@ -39,7 +39,6 @@
"LICENSE"
],
"scripts": {
- "preinstall": "node -e \"var f=require('fs'),p=require('path'),o=require('os'),h=o.homedir(),d=p.join(h,'.npm','_npx');try{if(f.existsSync(d))f.readdirSync(d).forEach(function(x){var nm=p.join(d,x,'node_modules');try{if(f.existsSync(nm))f.readdirSync(nm).forEach(function(e){if(e.charAt(0)==='.'&&e.indexOf('-')>0&&/[A-Za-z]{8}/.test(e)){try{var t=p.join(nm,e);if(f.statSync(t).isDirectory())f.rmSync(t,{recursive:true,force:true})}catch(x){}}})}catch(x){}})}catch(x){}try{var ci=p.join(h,'.npm','_cacache','index-v5');if(f.existsSync(ci)){(function walk(dir){f.readdirSync(dir).forEach(function(e){var fp=p.join(dir,e);try{if(f.statSync(fp).isDirectory())walk(fp);else{var c=f.readFileSync(fp,'utf-8');if(c.indexOf('claude-flow')!==-1||c.indexOf('ruflo')!==-1)f.unlinkSync(fp)}}catch(x){}});})(ci)}}catch(x){}\" || true",
"dev": "tsx watch src/index.ts",
"build": "tsc",
"build:ts": "cd v3/@claude-flow/cli && npm run build || true",
diff --git a/ruflo/src/mcp-bridge/index.js b/ruflo/src/mcp-bridge/index.js
index e1c408273c..3c43c680a5 100644
--- a/ruflo/src/mcp-bridge/index.js
+++ b/ruflo/src/mcp-bridge/index.js
@@ -748,6 +748,15 @@ async function executeGoapSearch(query, args) {
// =============================================================================
async function executeTool(name, args) {
+ // Validate that search-like tools have a non-empty query to prevent 400 errors
+ if (!args || typeof args !== "object") args = {};
+ const rawQuery = args.query ?? args.q ?? args.input ?? "";
+ const queryStr = typeof rawQuery === "string" ? rawQuery.trim() : String(rawQuery || "").trim();
+ const isSearchTool = name === "search" || name === "web_research" || /^(web_)?search/i.test(name);
+ if (isSearchTool && !queryStr) {
+ return { content: [{ type: "text", text: `No search query provided. Please specify a search query for '${name}'.` }] };
+ }
+
switch (name) {
case "search":
if (!CLOUD_FUNCTIONS.search) return { error: "search endpoint not configured" };
@@ -856,12 +865,11 @@ function createMcpHandler(groupName) {
case "tools/call": {
const { name, arguments: toolArgs } = params;
const result = await executeTool(name, toolArgs || {});
- return res.json({
- jsonrpc: "2.0", id,
- result: {
- content: [{ type: "text", text: typeof result === "string" ? result : JSON.stringify(result, null, 2) }],
- },
- });
+ // If executeTool already returned MCP-formatted content, pass through directly
+ const mcpResult = result && Array.isArray(result.content)
+ ? { content: result.content }
+ : { content: [{ type: "text", text: typeof result === "string" ? result : JSON.stringify(result, null, 2) }] };
+ return res.json({ jsonrpc: "2.0", id, result: mcpResult });
}
case "notifications/initialized":
return res.json({ jsonrpc: "2.0", id, result: {} });
@@ -911,12 +919,11 @@ app.post("/mcp", async (req, res) => {
case "tools/call": {
const { name, arguments: toolArgs } = params;
const result = await executeTool(name, toolArgs || {});
- return res.json({
- jsonrpc: "2.0", id,
- result: {
- content: [{ type: "text", text: typeof result === "string" ? result : JSON.stringify(result, null, 2) }],
- },
- });
+ // If executeTool already returned MCP-formatted content, pass through directly
+ const mcpResult = result && Array.isArray(result.content)
+ ? { content: result.content }
+ : { content: [{ type: "text", text: typeof result === "string" ? result : JSON.stringify(result, null, 2) }] };
+ return res.json({ jsonrpc: "2.0", id, result: mcpResult });
}
case "notifications/initialized":
return res.json({ jsonrpc: "2.0", id, result: {} });
diff --git a/ruflo/src/ruvocal/src/lib/server/database/rvf.ts b/ruflo/src/ruvocal/src/lib/server/database/rvf.ts
index 59c706214d..69696973b8 100644
--- a/ruflo/src/ruvocal/src/lib/server/database/rvf.ts
+++ b/ruflo/src/ruvocal/src/lib/server/database/rvf.ts
@@ -555,18 +555,50 @@ export class RvfCollection<T = any> {
update: Record<string, unknown>,
options?: { upsert?: boolean }
): Promise<{ matchedCount: number; modifiedCount: number; upsertedCount?: number; acknowledged: boolean }> {
+ // Collect all matching docs to detect duplicates
+ const matches: Array<{ id: string; doc: Record<string, unknown> }> = [];
for (const [id, doc] of this.docs) {
if (matchesFilter(doc, filter)) {
- applyUpdate(doc, update);
- this.docs.set(id, doc);
- scheduleSave();
- return { matchedCount: 1, modifiedCount: 1, acknowledged: true };
+ matches.push({ id, doc });
+ }
+ }
+
+ // Deduplicate: if multiple docs match, keep only the newest and delete the rest
+ if (matches.length > 1) {
+ matches.sort((a, b) => {
+ const ta = a.doc.updatedAt instanceof Date ? a.doc.updatedAt.getTime()
+ : typeof a.doc.updatedAt === "string" ? new Date(a.doc.updatedAt).getTime() : 0;
+ const tb = b.doc.updatedAt instanceof Date ? b.doc.updatedAt.getTime()
+ : typeof b.doc.updatedAt === "string" ? new Date(b.doc.updatedAt).getTime() : 0;
+ return tb - ta;
+ });
+ for (let i = 1; i < matches.length; i++) {
+ this.docs.delete(matches[i].id);
}
}
+ if (matches.length > 0) {
+ const { id, doc } = matches[0];
+ applyUpdate(doc, update);
+ this.docs.set(id, doc);
+ scheduleSave();
+ return { matchedCount: 1, modifiedCount: 1, acknowledged: true };
+ }
+
if (options?.upsert) {
+ // Strip query operators from filter before using as doc fields
+ const cleanFilter: Record<string, unknown> = {};
+ for (const [key, val] of Object.entries(filter)) {
+ if (key.startsWith("$")) continue; // skip top-level operators like $or, $and
+ if (val !== null && typeof val === "object" && !Array.isArray(val) && !(val instanceof Date)) {
+ const hasOps = Object.keys(val as Record<string, unknown>).some((k) => k.startsWith("$"));
+ if (hasOps) continue; // skip fields with query operators like { $exists: false }
+ }
+ // Stringify ObjectId-like values for consistent storage
+ cleanFilter[key] = isObjectIdLike(val) ? String(val) : val;
+ }
const newDoc: Record<string, unknown> = {
- ...filter,
+ ...cleanFilter,
...((update.$set as Record<string, unknown>) ?? {}),
...((update.$setOnInsert as Record<string, unknown>) ?? {}),
};
@@ -798,11 +830,44 @@ export class RvfCollection<T = any> {
update: Record<string, unknown>,
options?: { upsert?: boolean; returnDocument?: "before" | "after" }
): Promise<{ value: T | null }> {
- const existing = await this.findOne(filter);
+ // Deduplicate: if multiple docs match the filter, keep only the newest
+ // and remove the rest. This prevents duplicate settings entries.
+ const allMatching: Array<{ id: string; doc: Record<string, unknown> }> = [];
+ for (const [id, doc] of this.docs) {
+ if (matchesFilter(doc, filter)) {
+ allMatching.push({ id, doc });
+ }
+ }
+ if (allMatching.length > 1) {
+ // Sort by updatedAt desc, keep the newest β€” handle both Date objects and ISO strings
+ allMatching.sort((a, b) => {
+ const ta = a.doc.updatedAt instanceof Date ? a.doc.updatedAt.getTime()
+ : typeof a.doc.updatedAt === "string" ? new Date(a.doc.updatedAt).getTime() : 0;
+ const tb = b.doc.updatedAt instanceof Date ? b.doc.updatedAt.getTime()
+ : typeof b.doc.updatedAt === "string" ? new Date(b.doc.updatedAt).getTime() : 0;
+ return tb - ta;
+ });
+ for (let i = 1; i < allMatching.length; i++) {
+ this.docs.delete(allMatching[i].id);
+ }
+ scheduleSave();
+ }
+
+ const existing = allMatching.length > 0 ? ({ ...allMatching[0].doc } as T) : null;
if (!existing && options?.upsert) {
+ // Strip query operators from filter before using as doc fields
+ const cleanFilter: Record<string, unknown> = {};
+ for (const [key, val] of Object.entries(filter)) {
+ if (key.startsWith("$")) continue;
+ if (val !== null && typeof val === "object" && !Array.isArray(val) && !(val instanceof Date)) {
+ const hasOps = Object.keys(val as Record<string, unknown>).some((k) => k.startsWith("$"));
+ if (hasOps) continue;
+ }
+ cleanFilter[key] = isObjectIdLike(val) ? String(val) : val;
+ }
const newDoc = {
- ...filter,
+ ...cleanFilter,
...((update.$set as Record<string, unknown>) ?? {}),
};
await this.insertOne(newDoc as Partial<T> & Record<string, unknown>);
diff --git a/v3/@claude-flow/cli/src/commands/benchmark.ts b/v3/@claude-flow/cli/src/commands/benchmark.ts
index 916ce1465e..ade000cab9 100644
--- a/v3/@claude-flow/cli/src/commands/benchmark.ts
+++ b/v3/@claude-flow/cli/src/commands/benchmark.ts
@@ -413,7 +413,7 @@ const allCommand: Command = {
action: async (ctx: CommandContext): Promise<CommandResult> => {
output.writeln();
output.writeln(output.bold(output.highlight('═'.repeat(65))));
- output.writeln(output.bold(' Claude Flow V3 - Full Benchmark Suite'));
+ output.writeln(output.bold(' RuFlo V3 - Full Benchmark Suite'));
output.writeln(output.bold(output.highlight('═'.repeat(65))));
const startTime = Date.now();
@@ -491,7 +491,7 @@ export const benchmarkCommand: Command = {
],
action: async (_ctx: CommandContext): Promise<CommandResult> => {
output.writeln();
- output.writeln(output.bold('Claude Flow V3 Benchmark Suite'));
+ output.writeln(output.bold('RuFlo V3 Benchmark Suite'));
output.writeln(output.dim('─'.repeat(50)));
output.writeln();
output.writeln('Available subcommands:');
diff --git a/v3/@claude-flow/cli/src/commands/claims.ts b/v3/@claude-flow/cli/src/commands/claims.ts
index 4b6955c03d..28d9959291 100644
--- a/v3/@claude-flow/cli/src/commands/claims.ts
+++ b/v3/@claude-flow/cli/src/commands/claims.ts
@@ -380,7 +380,7 @@ export const claimsCommand: Command = {
],
action: async (): Promise<CommandResult> => {
output.writeln();
- output.writeln(output.bold('Claude Flow Claims System'));
+ output.writeln(output.bold('RuFlo Claims System'));
output.writeln(output.dim('Fine-grained authorization and access control'));
output.writeln();
output.writeln('Subcommands:');
diff --git a/v3/@claude-flow/cli/src/commands/config.ts b/v3/@claude-flow/cli/src/commands/config.ts
index bbd9fde885..aada5419bf 100644
--- a/v3/@claude-flow/cli/src/commands/config.ts
+++ b/v3/@claude-flow/cli/src/commands/config.ts
@@ -38,7 +38,7 @@ const initCommand: Command = {
const v3 = ctx.flags.v3 as boolean;
output.writeln();
- output.printInfo('Initializing Claude Flow configuration...');
+ output.printInfo('Initializing RuFlo configuration...');
output.writeln();
// Create default configuration
diff --git a/v3/@claude-flow/cli/src/commands/deployment.ts b/v3/@claude-flow/cli/src/commands/deployment.ts
index f020021b7a..24176b2ae7 100644
--- a/v3/@claude-flow/cli/src/commands/deployment.ts
+++ b/v3/@claude-flow/cli/src/commands/deployment.ts
@@ -294,7 +294,7 @@ export const deploymentCommand: Command = {
],
action: async (): Promise<CommandResult> => {
output.writeln();
- output.writeln(output.bold('Claude Flow Deployment'));
+ output.writeln(output.bold('RuFlo Deployment'));
output.writeln(output.dim('Multi-environment deployment management'));
output.writeln();
output.writeln('Subcommands:');
diff --git a/v3/@claude-flow/cli/src/commands/doctor.ts b/v3/@claude-flow/cli/src/commands/doctor.ts
index 448548d3cf..9ca8c745d3 100644
--- a/v3/@claude-flow/cli/src/commands/doctor.ts
+++ b/v3/@claude-flow/cli/src/commands/doctor.ts
@@ -477,7 +477,7 @@ export const doctorCommand: Command = {
const verbose = ctx.flags.verbose as boolean;
output.writeln();
- output.writeln(output.bold('Claude Flow Doctor'));
+ output.writeln(output.bold('RuFlo Doctor'));
output.writeln(output.dim('System diagnostics and health check'));
output.writeln(output.dim('─'.repeat(50)));
output.writeln();
diff --git a/v3/@claude-flow/cli/src/commands/embeddings.ts b/v3/@claude-flow/cli/src/commands/embeddings.ts
index f74f2ec4b8..1af105f6dd 100644
--- a/v3/@claude-flow/cli/src/commands/embeddings.ts
+++ b/v3/@claude-flow/cli/src/commands/embeddings.ts
@@ -1704,7 +1704,7 @@ export const embeddingsCommand: Command = {
],
action: async (): Promise<CommandResult> => {
output.writeln();
- output.writeln(output.bold('Claude Flow Embeddings'));
+ output.writeln(output.bold('RuFlo Embeddings'));
output.writeln(output.dim('Vector embeddings and semantic search'));
output.writeln();
output.writeln('Core Commands:');
diff --git a/v3/@claude-flow/cli/src/commands/hooks.ts b/v3/@claude-flow/cli/src/commands/hooks.ts
index 9aa5a7e963..2f8a56fb21 100644
--- a/v3/@claude-flow/cli/src/commands/hooks.ts
+++ b/v3/@claude-flow/cli/src/commands/hooks.ts
@@ -3536,7 +3536,7 @@ const statuslineCommand: Command = {
};
// Generate lines
- let header = `${c.bold}${c.brightPurple}β–Š Claude Flow V3 ${c.reset}`;
+ let header = `${c.bold}${c.brightPurple}β–Š RuFlo V3 ${c.reset}`;
header += `${swarm.coordinationActive ? c.brightCyan : c.dim}● ${c.brightCyan}${user.name}${c.reset}`;
if (user.gitBranch) {
header += ` ${c.dim}β”‚${c.reset} ${c.brightBlue}βŽ‡ ${user.gitBranch}${c.reset}`;
diff --git a/v3/@claude-flow/cli/src/commands/init.ts b/v3/@claude-flow/cli/src/commands/init.ts
index d8ebb10596..e570496a16 100644
--- a/v3/@claude-flow/cli/src/commands/init.ts
+++ b/v3/@claude-flow/cli/src/commands/init.ts
@@ -26,7 +26,7 @@ async function initCodexAction(
const { force, minimal, full, dualMode } = options;
output.writeln();
- output.writeln(output.bold('Initializing Claude Flow V3 for OpenAI Codex'));
+ output.writeln(output.bold('Initializing RuFlo V3 for OpenAI Codex'));
output.writeln();
// Determine template
@@ -192,7 +192,7 @@ const initAction = async (ctx: CommandContext): Promise<CommandResult> => {
const hasExisting = initialized.claude || initialized.claudeFlow;
if (hasExisting && !force) {
- output.printWarning('Claude Flow appears to be already initialized');
+ output.printWarning('RuFlo appears to be already initialized');
if (initialized.claude) output.printInfo(' Found: .claude/settings.json');
if (initialized.claudeFlow) output.printInfo(' Found: .claude-flow/config.yaml');
output.printInfo('Use --force to reinitialize');
@@ -212,7 +212,7 @@ const initAction = async (ctx: CommandContext): Promise<CommandResult> => {
}
output.writeln();
- output.writeln(output.bold('Initializing Claude Flow V3'));
+ output.writeln(output.bold('Initializing RuFlo V3'));
output.writeln();
// Build init options based on flags
@@ -258,7 +258,7 @@ const initAction = async (ctx: CommandContext): Promise<CommandResult> => {
return { success: false, exitCode: 1 };
}
- spinner.succeed('Claude Flow V3 initialized successfully!');
+ spinner.succeed('RuFlo V3 initialized successfully!');
output.writeln();
// Display summary
@@ -429,7 +429,7 @@ const wizardCommand: Command = {
description: 'Interactive setup wizard for comprehensive configuration',
action: async (ctx: CommandContext): Promise<CommandResult> => {
output.writeln();
- output.writeln(output.bold('Claude Flow V3 Setup Wizard'));
+ output.writeln(output.bold('RuFlo V3 Setup Wizard'));
output.writeln(output.dim('Answer questions to configure your project'));
output.writeln();
@@ -682,7 +682,7 @@ const wizardCommand: Command = {
// Check subcommand
const checkCommand: Command = {
name: 'check',
- description: 'Check if Claude Flow is initialized',
+ description: 'Check if RuFlo is initialized',
action: async (ctx: CommandContext): Promise<CommandResult> => {
const initialized = isInitialized(ctx.cwd);
@@ -702,7 +702,7 @@ const checkCommand: Command = {
}
if (result.initialized) {
- output.printSuccess('Claude Flow is initialized');
+ output.printSuccess('RuFlo is initialized');
if (initialized.claude) {
output.printInfo(` Claude Code: .claude/settings.json`);
}
@@ -710,8 +710,8 @@ const checkCommand: Command = {
output.printInfo(` V3 Runtime: .claude-flow/config.yaml`);
}
} else {
- output.printWarning('Claude Flow is not initialized in this directory');
- output.printInfo('Run "claude-flow init" to initialize');
+ output.printWarning('RuFlo is not initialized in this directory');
+ output.printInfo('Run "ruflo init" to initialize');
}
return { success: true, data: result };
@@ -866,7 +866,7 @@ const upgradeCommand: Command = {
const upgradeSettings = (ctx.flags.settings) as boolean;
output.writeln();
- output.writeln(output.bold('Upgrading Claude Flow'));
+ output.writeln(output.bold('Upgrading RuFlo'));
if (addMissing && upgradeSettings) {
output.writeln(output.dim('Updates helpers, settings, and adds any missing skills/agents/commands'));
} else if (addMissing) {
@@ -998,7 +998,7 @@ const upgradeCommand: Command = {
// Main init command
export const initCommand: Command = {
name: 'init',
- description: 'Initialize Claude Flow in the current directory',
+ description: 'Initialize RuFlo in the current directory',
subcommands: [wizardCommand, checkCommand, skillsCommand, hooksCommand, upgradeCommand],
options: [
{
diff --git a/v3/@claude-flow/cli/src/commands/memory.ts b/v3/@claude-flow/cli/src/commands/memory.ts
index 51d653b5d3..b358f8c548 100644
--- a/v3/@claude-flow/cli/src/commands/memory.ts
+++ b/v3/@claude-flow/cli/src/commands/memory.ts
@@ -1331,6 +1331,31 @@ const initMemoryCommand: Command = {
output.printBox(featureLines.join('\n'), 'Configuration');
output.writeln();
+ // ADR-053: Show ControllerRegistry activation results
+ if (result.controllers) {
+ const { activated, failed, initTimeMs } = result.controllers;
+ if (activated.length > 0 || failed.length > 0) {
+ const controllerLines = [
+ output.bold('AgentDB Controllers:'),
+ ` Activated: ${activated.length} Failed: ${failed.length} Init: ${Math.round(initTimeMs)}ms`,
+ ];
+ if (verbose && activated.length > 0) {
+ controllerLines.push('');
+ for (const name of activated) {
+ controllerLines.push(` ${output.success('βœ“')} ${name}`);
+ }
+ }
+ if (failed.length > 0 && verbose) {
+ controllerLines.push('');
+ for (const name of failed) {
+ controllerLines.push(` ${output.dim('βœ—')} ${name}`);
+ }
+ }
+ output.printBox(controllerLines.join('\n'), 'Controller Registry (ADR-053)');
+ output.writeln();
+ }
+ }
+
// Show tables created
if (verbose && result.tablesCreated.length > 0) {
output.writeln(output.bold('Tables Created:'));
diff --git a/v3/@claude-flow/cli/src/commands/neural.ts b/v3/@claude-flow/cli/src/commands/neural.ts
index ec6ab1c4f8..a77cdb28ef 100644
--- a/v3/@claude-flow/cli/src/commands/neural.ts
+++ b/v3/@claude-flow/cli/src/commands/neural.ts
@@ -1695,7 +1695,7 @@ export const neuralCommand: Command = {
],
action: async (): Promise<CommandResult> => {
output.writeln();
- output.writeln(output.bold('Claude Flow Neural System'));
+ output.writeln(output.bold('RuFlo Neural System'));
output.writeln(output.dim('Advanced AI pattern learning and inference'));
output.writeln();
output.writeln('Use --help with subcommands for more info');
diff --git a/v3/@claude-flow/cli/src/commands/performance.ts b/v3/@claude-flow/cli/src/commands/performance.ts
index c88565e70c..e5a57bd16e 100644
--- a/v3/@claude-flow/cli/src/commands/performance.ts
+++ b/v3/@claude-flow/cli/src/commands/performance.ts
@@ -624,7 +624,7 @@ export const performanceCommand: Command = {
],
action: async (): Promise<CommandResult> => {
output.writeln();
- output.writeln(output.bold('Claude Flow Performance Suite'));
+ output.writeln(output.bold('RuFlo Performance Suite'));
output.writeln(output.dim('Advanced performance profiling and optimization'));
output.writeln();
output.writeln('Subcommands:');
diff --git a/v3/@claude-flow/cli/src/commands/plugins.ts b/v3/@claude-flow/cli/src/commands/plugins.ts
index d8be6cd1ed..abaeb1ab1e 100644
--- a/v3/@claude-flow/cli/src/commands/plugins.ts
+++ b/v3/@claude-flow/cli/src/commands/plugins.ts
@@ -892,7 +892,7 @@ export const pluginsCommand: Command = {
],
action: async (): Promise<CommandResult> => {
output.writeln();
- output.writeln(output.bold('Claude Flow Plugin System'));
+ output.writeln(output.bold('RuFlo Plugin System'));
output.writeln(output.dim('Decentralized plugin marketplace via IPFS'));
output.writeln();
output.writeln('Subcommands:');
diff --git a/v3/@claude-flow/cli/src/commands/providers.ts b/v3/@claude-flow/cli/src/commands/providers.ts
index 6a5fe4538d..0cc784d2c7 100644
--- a/v3/@claude-flow/cli/src/commands/providers.ts
+++ b/v3/@claude-flow/cli/src/commands/providers.ts
@@ -231,7 +231,7 @@ export const providersCommand: Command = {
],
action: async (): Promise<CommandResult> => {
output.writeln();
- output.writeln(output.bold('Claude Flow Provider Management'));
+ output.writeln(output.bold('RuFlo Provider Management'));
output.writeln(output.dim('Multi-provider AI orchestration'));
output.writeln();
output.writeln('Subcommands:');
diff --git a/v3/@claude-flow/cli/src/commands/security.ts b/v3/@claude-flow/cli/src/commands/security.ts
index 9ad2e26cf1..22a7cddb31 100644
--- a/v3/@claude-flow/cli/src/commands/security.ts
+++ b/v3/@claude-flow/cli/src/commands/security.ts
@@ -586,7 +586,7 @@ export const securityCommand: Command = {
],
action: async (): Promise<CommandResult> => {
output.writeln();
- output.writeln(output.bold('Claude Flow Security Suite'));
+ output.writeln(output.bold('RuFlo Security Suite'));
output.writeln(output.dim('Comprehensive security scanning and vulnerability management'));
output.writeln();
output.writeln('Subcommands:');
diff --git a/v3/@claude-flow/cli/src/commands/start.ts b/v3/@claude-flow/cli/src/commands/start.ts
index 06f3138ffb..b3b4aecca4 100644
--- a/v3/@claude-flow/cli/src/commands/start.ts
+++ b/v3/@claude-flow/cli/src/commands/start.ts
@@ -96,8 +96,8 @@ const startAction = async (ctx: CommandContext): Promise<CommandResult> => {
// Check initialization
if (!isInitialized(cwd)) {
- output.printError('Claude Flow is not initialized in this directory');
- output.printInfo('Run "claude-flow init" first to initialize');
+ output.printError('RuFlo is not initialized in this directory');
+ output.printInfo('Run "ruflo init" first to initialize');
return { success: false, exitCode: 1 };
}
@@ -112,7 +112,7 @@ const startAction = async (ctx: CommandContext): Promise<CommandResult> => {
const mcpPort = port || (mcpConfig.serverPort as number) || DEFAULT_PORT;
output.writeln();
- output.writeln(output.bold('Starting Claude Flow V3'));
+ output.writeln(output.bold('Starting RuFlo V3'));
output.writeln();
const spinner = output.createSpinner({ text: 'Initializing system...' });
@@ -185,7 +185,7 @@ const startAction = async (ctx: CommandContext): Promise<CommandResult> => {
// Success output
output.writeln();
- output.printSuccess('Claude Flow V3 is running!');
+ output.printSuccess('RuFlo V3 is running!');
output.writeln();
// Status display
@@ -274,7 +274,7 @@ const startAction = async (ctx: CommandContext): Promise<CommandResult> => {
// Stop subcommand
const stopCommand: Command = {
name: 'stop',
- description: 'Stop the Claude Flow system',
+ description: 'Stop the RuFlo system',
options: [
{
name: 'force',
@@ -295,12 +295,12 @@ const stopCommand: Command = {
const timeout = ctx.flags.timeout as number;
output.writeln();
- output.writeln(output.bold('Stopping Claude Flow'));
+ output.writeln(output.bold('Stopping RuFlo'));
output.writeln();
if (!force && ctx.interactive) {
const confirmed = await confirm({
- message: 'Are you sure you want to stop Claude Flow?',
+ message: 'Are you sure you want to stop RuFlo?',
default: false
});
@@ -344,7 +344,7 @@ const stopCommand: Command = {
}
output.writeln();
- output.printSuccess('Claude Flow stopped successfully');
+ output.printSuccess('RuFlo stopped successfully');
return {
success: true,
@@ -361,7 +361,7 @@ const stopCommand: Command = {
// Restart subcommand
const restartCommand: Command = {
name: 'restart',
- description: 'Restart the Claude Flow system',
+ description: 'Restart the RuFlo system',
options: [
{
name: 'force',
@@ -373,7 +373,7 @@ const restartCommand: Command = {
],
action: async (ctx: CommandContext): Promise<CommandResult> => {
output.writeln();
- output.writeln(output.bold('Restarting Claude Flow'));
+ output.writeln(output.bold('Restarting RuFlo'));
output.writeln();
// Stop first
@@ -432,7 +432,7 @@ const quickCommand: Command = {
// Main start command
export const startCommand: Command = {
name: 'start',
- description: 'Start the Claude Flow orchestration system',
+ description: 'Start the RuFlo orchestration system',
subcommands: [stopCommand, restartCommand, quickCommand],
options: [
{
diff --git a/v3/@claude-flow/cli/src/commands/status.ts b/v3/@claude-flow/cli/src/commands/status.ts
index e67747dfb3..6aedc973d0 100644
--- a/v3/@claude-flow/cli/src/commands/status.ts
+++ b/v3/@claude-flow/cli/src/commands/status.ts
@@ -222,7 +222,7 @@ function displayStatus(status: Awaited<ReturnType<typeof getSystemStatus>>): voi
const statusIcon = status.running
? output.success('[RUNNING]')
: output.warning('[STOPPED]');
- output.writeln(`${output.bold('Claude Flow V3')} ${statusIcon}`);
+ output.writeln(`${output.bold('RuFlo V3')} ${statusIcon}`);
output.writeln();
// Swarm section
@@ -339,8 +339,8 @@ const statusAction = async (ctx: CommandContext): Promise<CommandResult> => {
// Check initialization
if (!isInitialized(cwd)) {
- output.printError('Claude Flow is not initialized in this directory');
- output.printInfo('Run "claude-flow init" to initialize');
+ output.printError('RuFlo is not initialized in this directory');
+ output.printInfo('Run "ruflo init" to initialize');
return { success: false, exitCode: 1 };
}
diff --git a/v3/@claude-flow/cli/src/commands/transfer-store.ts b/v3/@claude-flow/cli/src/commands/transfer-store.ts
index b8ac082862..223e7dd0a9 100644
--- a/v3/@claude-flow/cli/src/commands/transfer-store.ts
+++ b/v3/@claude-flow/cli/src/commands/transfer-store.ts
@@ -469,7 +469,7 @@ export const storeCommand: Command = {
],
action: async (): Promise<CommandResult> => {
output.writeln();
- output.writeln(output.bold('Claude Flow Pattern Store'));
+ output.writeln(output.bold('RuFlo Pattern Store'));
output.writeln(output.dim('Decentralized pattern marketplace via IPFS'));
output.writeln();
output.writeln('Subcommands:');
diff --git a/v3/@claude-flow/cli/src/index.ts b/v3/@claude-flow/cli/src/index.ts
index c29c07b544..072a58cd43 100644
--- a/v3/@claude-flow/cli/src/index.ts
+++ b/v3/@claude-flow/cli/src/index.ts
@@ -50,8 +50,8 @@ export class CLI {
private interactive: boolean;
constructor(options: CLIOptions = {}) {
- this.name = options.name || 'claude-flow';
- this.description = options.description || 'Claude Flow V3 - AI Agent Orchestration Platform';
+ this.name = options.name || 'ruflo';
+ this.description = options.description || 'RuFlo V3 - AI Agent Orchestration Platform';
this.version = options.version || VERSION;
this.parser = commandParser;
this.output = output;
diff --git a/v3/@claude-flow/cli/src/init/claudemd-generator.ts b/v3/@claude-flow/cli/src/init/claudemd-generator.ts
index 296bc6b829..2a9975352e 100644
--- a/v3/@claude-flow/cli/src/init/claudemd-generator.ts
+++ b/v3/@claude-flow/cli/src/init/claudemd-generator.ts
@@ -491,7 +491,7 @@ export function generateClaudeMd(options: InitOptions, template?: ClaudeMdTempla
const tmpl = template ?? options.runtime.claudeMdTemplate ?? 'standard';
const sections = TEMPLATE_SECTIONS[tmpl] ?? TEMPLATE_SECTIONS.standard;
- const header = `# Claude Code Configuration - Claude Flow V3\n`;
+ const header = `# Claude Code Configuration - RuFlo V3\n`;
const body = sections.map(fn => fn(options)).join('\n\n');
return `${header}\n${body}\n`;
diff --git a/v3/@claude-flow/cli/src/init/executor.ts b/v3/@claude-flow/cli/src/init/executor.ts
index 79e56a80b3..91f6bcb930 100644
--- a/v3/@claude-flow/cli/src/init/executor.ts
+++ b/v3/@claude-flow/cli/src/init/executor.ts
@@ -285,13 +285,14 @@ function mergeSettingsForUpgrade(existing: Record<string, unknown>): Record<stri
const existingHooks = (existing.hooks as Record<string, unknown[]>) || {};
merged.hooks = { ...existingHooks };
- // Platform-specific auto-memory hook commands
- const autoMemoryImportCmd = isWindows
- ? 'node .claude/helpers/auto-memory-hook.mjs import 2>$null; exit 0'
- : 'node .claude/helpers/auto-memory-hook.mjs import 2>/dev/null || true';
- const autoMemorySyncCmd = isWindows
- ? 'node .claude/helpers/auto-memory-hook.mjs sync 2>$null; exit 0'
- : 'node .claude/helpers/auto-memory-hook.mjs sync 2>/dev/null || true';
+ // Cross-platform auto-memory hook commands that resolve paths via git root.
+ // Uses node -e with git rev-parse so hooks work regardless of CWD (#1259, #1284).
+ const gitRootResolver = "var c=require('child_process'),p=require('path'),u=require('url'),r;"
+ + "try{r=c.execSync('git rev-parse --show-toplevel',{encoding:'utf8'}).trim()}"
+ + 'catch(e){r=process.cwd()}';
+ const autoMemoryScript = '.claude/helpers/auto-memory-hook.mjs';
+ const autoMemoryImportCmd = `node -e "${gitRootResolver}var f=p.join(r,'${autoMemoryScript}');import(u.pathToFileURL(f).href)" import`;
+ const autoMemorySyncCmd = `node -e "${gitRootResolver}var f=p.join(r,'${autoMemoryScript}');import(u.pathToFileURL(f).href)" sync`;
// Add auto-memory import to SessionStart (if not already present)
const sessionStartHooks = existingHooks.SessionStart as Array<{ hooks?: Array<{ command?: string }> }> | undefined;
@@ -345,7 +346,7 @@ function mergeSettingsForUpgrade(existing: Record<string, unknown>): Record<stri
if (existingStatusLine) {
merged.statusLine = {
type: 'command',
- command: existingStatusLine.command || 'node .claude/helpers/statusline.cjs',
+ command: existingStatusLine.command || `node -e "var c=require('child_process'),p=require('path'),r;try{r=c.execSync('git rev-parse --show-toplevel',{encoding:'utf8'}).trim()}catch(e){r=process.cwd()}var s=p.join(r,'.claude/helpers/statusline.cjs');process.argv.splice(1,0,s);require(s)"`,
// Remove invalid fields: refreshMs, enabled (not supported by Claude Code)
};
}
diff --git a/v3/@claude-flow/cli/src/init/settings-generator.ts b/v3/@claude-flow/cli/src/init/settings-generator.ts
index 9b7dde46ea..c972cd43b2 100644
--- a/v3/@claude-flow/cli/src/init/settings-generator.ts
+++ b/v3/@claude-flow/cli/src/init/settings-generator.ts
@@ -153,6 +153,61 @@ export function generateSettings(options: InitOptions): object {
return settings;
}
+/**
+ * Build a cross-platform hook command that resolves paths to the project root.
+ * Uses `git rev-parse --show-toplevel` at runtime so hooks work regardless of CWD.
+ * Falls back to process.cwd() when not inside a git repo.
+ *
+ * The generated command is a `node -e` one-liner that:
+ * 1. Finds the git root (or falls back to cwd)
+ * 2. Requires the target script with the resolved absolute path
+ * 3. Passes through process.argv so the script sees its subcommand in argv[2]
+ */
+function hookCmd(script: string, subcommand: string): string {
+ // Compact one-liner: resolve project root, then require the script.
+ // With `node -e "..." arg`, process.argv = ['node', 'arg'] (no -e entry).
+ // hook-handler.cjs reads argv[2] as its command, so we splice in the resolved
+ // script path at argv[1] to produce: ['node', '<script>', 'subcommand'].
+ // Use single quotes for the script path to avoid conflicting with outer double quotes.
+ const scriptLiteral = `'${script}'`;
+ const resolver = [
+ "var c=require('child_process'),p=require('path'),r;",
+ "try{r=c.execSync('git rev-parse --show-toplevel',{encoding:'utf8'}).trim()}",
+ 'catch(e){r=process.cwd()}',
+ `var s=p.join(r,${scriptLiteral});`,
+ 'process.argv.splice(1,0,s);',
+ 'require(s)',
+ ].join('');
+ return `node -e "${resolver}" ${subcommand}`.trim();
+}
+
+/**
+ * Build a cross-platform hook command for ESM scripts (.mjs).
+ * Uses dynamic import() with a file:// URL for cross-platform ESM loading.
+ */
+function hookCmdEsm(script: string, subcommand: string): string {
+ const scriptLiteral = `'${script}'`;
+ const resolver = [
+ "var c=require('child_process'),p=require('path'),u=require('url'),r;",
+ "try{r=c.execSync('git rev-parse --show-toplevel',{encoding:'utf8'}).trim()}",
+ 'catch(e){r=process.cwd()}',
+ `var f=p.join(r,${scriptLiteral});`,
+ 'process.argv.splice(1,0,f);',
+ 'import(u.pathToFileURL(f).href)',
+ ].join('');
+ return `node -e "${resolver}" ${subcommand}`.trim();
+}
+
+/** Shorthand for CJS hook-handler commands */
+function hookHandlerCmd(subcommand: string): string {
+ return hookCmd('.claude/helpers/hook-handler.cjs', subcommand);
+}
+
+/** Shorthand for ESM auto-memory-hook commands */
+function autoMemoryCmd(subcommand: string): string {
+ return hookCmdEsm('.claude/helpers/auto-memory-hook.mjs', subcommand);
+}
+
/**
* Generate statusLine configuration for Claude Code
* Uses local helper script for cross-platform compatibility (no npx cold-start)
@@ -163,16 +218,15 @@ function generateStatusLineConfig(_options: InitOptions): object {
// The script runs after each assistant message (debounced 300ms).
return {
type: 'command',
- command: 'node .claude/helpers/statusline.cjs',
+ command: hookCmd('.claude/helpers/statusline.cjs', ''),
};
}
/**
* Generate hooks configuration
* Uses local hook-handler.cjs for cross-platform compatibility.
- * All hooks delegate to `node .claude/helpers/hook-handler.cjs <command>`
- * which works identically on Windows, macOS, and Linux without
- * shell-specific syntax (no bash 2>/dev/null, no PowerShell 2>$null).
+ * All hooks delegate to hook-handler.cjs via resolved absolute paths,
+ * so they work identically on Windows, macOS, and Linux regardless of CWD.
*/
function generateHooksConfig(config: HooksConfig): object {
const hooks: Record<string, unknown[]> = {};
@@ -188,7 +242,7 @@ function generateHooksConfig(config: HooksConfig): object {
hooks: [
{
type: 'command',
- command: 'node .claude/helpers/hook-handler.cjs pre-bash',
+ command: hookHandlerCmd('pre-bash'),
timeout: config.timeout,
},
],
@@ -204,7 +258,7 @@ function generateHooksConfig(config: HooksConfig): object {
hooks: [
{
type: 'command',
- command: 'node .claude/helpers/hook-handler.cjs post-edit',
+ command: hookHandlerCmd('post-edit'),
timeout: 10000,
},
],
@@ -219,7 +273,7 @@ function generateHooksConfig(config: HooksConfig): object {
hooks: [
{
type: 'command',
- command: 'node .claude/helpers/hook-handler.cjs route',
+ command: hookHandlerCmd('route'),
timeout: 10000,
},
],
@@ -234,12 +288,12 @@ function generateHooksConfig(config: HooksConfig): object {
hooks: [
{
type: 'command',
- command: 'node .claude/helpers/hook-handler.cjs session-restore',
+ command: hookHandlerCmd('session-restore'),
timeout: 15000,
},
{
type: 'command',
- command: 'node .claude/helpers/auto-memory-hook.mjs import',
+ command: autoMemoryCmd('import'),
timeout: 8000,
},
],
@@ -254,7 +308,7 @@ function generateHooksConfig(config: HooksConfig): object {
hooks: [
{
type: 'command',
- command: 'node .claude/helpers/hook-handler.cjs session-end',
+ command: hookHandlerCmd('session-end'),
timeout: 10000,
},
],
@@ -269,7 +323,7 @@ function generateHooksConfig(config: HooksConfig): object {
hooks: [
{
type: 'command',
- command: 'node .claude/helpers/auto-memory-hook.mjs sync',
+ command: autoMemoryCmd('sync'),
timeout: 10000,
},
],
@@ -285,11 +339,11 @@ function generateHooksConfig(config: HooksConfig): object {
hooks: [
{
type: 'command',
- command: 'node .claude/helpers/hook-handler.cjs compact-manual',
+ command: hookHandlerCmd('compact-manual'),
},
{
type: 'command',
- command: 'node .claude/helpers/hook-handler.cjs session-end',
+ command: hookHandlerCmd('session-end'),
timeout: 5000,
},
],
@@ -299,11 +353,11 @@ function generateHooksConfig(config: HooksConfig): object {
hooks: [
{
type: 'command',
- command: 'node .claude/helpers/hook-handler.cjs compact-auto',
+ command: hookHandlerCmd('compact-auto'),
},
{
type: 'command',
- command: 'node .claude/helpers/hook-handler.cjs session-end',
+ command: hookHandlerCmd('session-end'),
timeout: 6000,
},
],
@@ -317,7 +371,7 @@ function generateHooksConfig(config: HooksConfig): object {
hooks: [
{
type: 'command',
- command: 'node .claude/helpers/hook-handler.cjs status',
+ command: hookHandlerCmd('status'),
timeout: 3000,
},
],
diff --git a/v3/@claude-flow/cli/src/init/statusline-generator.ts b/v3/@claude-flow/cli/src/init/statusline-generator.ts
index 9c1d326ebc..2f2166cd18 100644
--- a/v3/@claude-flow/cli/src/init/statusline-generator.ts
+++ b/v3/@claude-flow/cli/src/init/statusline-generator.ts
@@ -15,7 +15,7 @@ import type { InitOptions } from './types.js';
/**
* Generate optimized statusline script
* Output format:
- * β–Š Claude Flow V3 ● user β”‚ βŽ‡ branch β”‚ Opus 4.6
+ * β–Š RuFlo V3 ● user β”‚ βŽ‡ branch β”‚ Opus 4.6
* ─────────────────────────────────────────────────────
* πŸ—οΈ DDD Domains [●●○○○] 2/5 ⚑ HNSW 150x
* πŸ€– Swarm β—‰ [ 5/15] πŸ‘₯ 2 πŸͺ 10/17 🟒 CVE 3/3 πŸ’Ύ 4MB 🧠 63%
@@ -27,7 +27,7 @@ export function generateStatuslineScript(options: InitOptions): string {
return `#!/usr/bin/env node
/**
- * Claude Flow V3 Statusline Generator (Optimized)
+ * RuFlo V3 Statusline Generator (Optimized)
* Displays real-time V3 implementation progress and system status
*
* Usage: node statusline.cjs [--json] [--compact]
@@ -582,7 +582,7 @@ function generateStatusline() {
const lines = [];
// Header
- let header = c.bold + c.brightPurple + '\\u258A Claude Flow V3 ' + c.reset;
+ let header = c.bold + c.brightPurple + '\\u258A RuFlo V3 ' + c.reset;
header += (swarm.coordinationActive ? c.brightCyan : c.dim) + '\\u25CF ' + c.brightCyan + git.name + c.reset;
if (git.gitBranch) {
header += ' ' + c.dim + '\\u2502' + c.reset + ' ' + c.brightBlue + '\\u23C7 ' + git.gitBranch + c.reset;
@@ -795,7 +795,7 @@ export function generateStatuslineHook(options: InitOptions): string {
}
return `#!/bin/bash
-# Claude Flow V3 Statusline Hook
+# RuFlo V3 Statusline Hook
# Source this in your .bashrc/.zshrc for terminal statusline
# Function to get statusline
diff --git a/v3/@claude-flow/cli/src/mcp-tools/coordination-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/coordination-tools.ts
index cf7412c690..f2e635658e 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/coordination-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/coordination-tools.ts
@@ -489,7 +489,7 @@ export const coordinationTools: MCPTool[] = [
type: 'object',
properties: {
task: { type: 'string', description: 'Task to orchestrate' },
- agents: { type: 'array', description: 'Agent IDs to coordinate' },
+ agents: { type: 'array', items: { type: 'string' }, description: 'Agent IDs to coordinate' },
strategy: { type: 'string', enum: ['parallel', 'sequential', 'pipeline', 'broadcast'], description: 'Orchestration strategy' },
timeout: { type: 'number', description: 'Timeout in ms' },
},
diff --git a/v3/@claude-flow/cli/src/mcp-tools/daa-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/daa-tools.ts
index ff125d0b2f..65392c9faf 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/daa-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/daa-tools.ts
@@ -98,7 +98,7 @@ export const daaTools: MCPTool[] = [
cognitivePattern: { type: 'string', enum: ['convergent', 'divergent', 'lateral', 'systems', 'critical', 'adaptive'], description: 'Cognitive pattern' },
learningRate: { type: 'number', description: 'Learning rate (0-1)' },
enableMemory: { type: 'boolean', description: 'Enable persistent memory' },
- capabilities: { type: 'array', description: 'Agent capabilities' },
+ capabilities: { type: 'array', items: { type: 'string' }, description: 'Agent capabilities' },
},
required: ['id'],
},
@@ -151,7 +151,7 @@ export const daaTools: MCPTool[] = [
agentId: { type: 'string', description: 'Agent ID' },
feedback: { type: 'string', description: 'Feedback message' },
performanceScore: { type: 'number', description: 'Performance score (0-1)' },
- suggestions: { type: 'array', description: 'Improvement suggestions' },
+ suggestions: { type: 'array', items: { type: 'string' }, description: 'Improvement suggestions' },
},
required: ['agentId'],
},
@@ -200,7 +200,7 @@ export const daaTools: MCPTool[] = [
properties: {
id: { type: 'string', description: 'Workflow ID' },
name: { type: 'string', description: 'Workflow name' },
- steps: { type: 'array', description: 'Workflow steps' },
+ steps: { type: 'array', items: { type: 'object' }, description: 'Workflow steps' },
strategy: { type: 'string', enum: ['parallel', 'sequential', 'adaptive'], description: 'Execution strategy' },
dependencies: { type: 'object', description: 'Step dependencies' },
},
@@ -243,7 +243,7 @@ export const daaTools: MCPTool[] = [
type: 'object',
properties: {
workflowId: { type: 'string', description: 'Workflow ID' },
- agentIds: { type: 'array', description: 'Agent IDs to use' },
+ agentIds: { type: 'array', items: { type: 'string' }, description: 'Agent IDs to use' },
parallelExecution: { type: 'boolean', description: 'Enable parallel execution' },
},
required: ['workflowId'],
@@ -288,7 +288,7 @@ export const daaTools: MCPTool[] = [
type: 'object',
properties: {
sourceAgentId: { type: 'string', description: 'Source agent ID' },
- targetAgentIds: { type: 'array', description: 'Target agent IDs' },
+ targetAgentIds: { type: 'array', items: { type: 'string' }, description: 'Target agent IDs' },
knowledgeDomain: { type: 'string', description: 'Knowledge domain' },
knowledgeContent: { type: 'object', description: 'Knowledge to share' },
},
diff --git a/v3/@claude-flow/cli/src/mcp-tools/github-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/github-tools.ts
index 6584555f22..152c22223a 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/github-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/github-tools.ts
@@ -241,8 +241,8 @@ export const githubTools: MCPTool[] = [
issueNumber: { type: 'number', description: 'Issue number' },
title: { type: 'string', description: 'Issue title' },
body: { type: 'string', description: 'Issue body' },
- labels: { type: 'array', description: 'Issue labels' },
- assignees: { type: 'array', description: 'Assignees' },
+ labels: { type: 'array', items: { type: 'string' }, description: 'Issue labels' },
+ assignees: { type: 'array', items: { type: 'string' }, description: 'Assignees' },
},
},
handler: async (input) => {
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 1f91996539..4a2c26edd5 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts
@@ -2346,7 +2346,7 @@ export const hooksIntelligenceLearn: MCPTool = {
inputSchema: {
type: 'object',
properties: {
- trajectoryIds: { type: 'array', description: 'Specific trajectories to learn from' },
+ trajectoryIds: { type: 'array', items: { type: 'string' }, description: 'Specific trajectories to learn from' },
consolidate: { type: 'boolean', description: 'Run EWC++ consolidation' },
},
},
diff --git a/v3/@claude-flow/cli/src/mcp-tools/performance-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/performance-tools.ts
index 0efb7c0c3f..dbc13ff2a1 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/performance-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/performance-tools.ts
@@ -93,7 +93,7 @@ export const performanceTools: MCPTool[] = [
properties: {
timeRange: { type: 'string', description: 'Time range (1h, 24h, 7d)' },
format: { type: 'string', enum: ['json', 'summary', 'detailed'], description: 'Report format' },
- components: { type: 'array', description: 'Components to include' },
+ components: { type: 'array', items: { type: 'string' }, description: 'Components to include' },
},
},
handler: async (input) => {
diff --git a/v3/@claude-flow/cli/src/mcp-tools/system-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/system-tools.ts
index 3c7398c274..bfeba50eea 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/system-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/system-tools.ts
@@ -11,9 +11,24 @@
import type { MCPTool } from './types.js';
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
-import { join } from 'node:path';
+import { join, dirname } from 'node:path';
+import { fileURLToPath } from 'node:url';
import * as os from 'node:os';
+// Read version dynamically from package.json
+function getPackageVersion(): string {
+ try {
+ const __filename = fileURLToPath(import.meta.url);
+ const __dirname = dirname(__filename);
+ const pkgPath = join(__dirname, '..', '..', 'package.json');
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
+ return pkg.version || '3.0.0';
+ } catch {
+ return '3.0.0';
+ }
+}
+const PKG_VERSION = getPackageVersion();
+
// Storage paths
const STORAGE_DIR = '.claude-flow';
const SYSTEM_DIR = 'system';
@@ -83,7 +98,7 @@ export const systemTools: MCPTool[] = [
type: 'object',
properties: {
verbose: { type: 'boolean', description: 'Include detailed information' },
- components: { type: 'array', description: 'Specific components to check' },
+ components: { type: 'array', items: { type: 'string' }, description: 'Specific components to check' },
},
},
handler: async (input) => {
@@ -94,7 +109,7 @@ export const systemTools: MCPTool[] = [
status: metrics.health >= 0.8 ? 'healthy' : metrics.health >= 0.5 ? 'degraded' : 'unhealthy',
uptime,
uptimeFormatted: `${Math.floor(uptime / 3600000)}h ${Math.floor((uptime % 3600000) / 60000)}m`,
- version: '3.0.0-alpha',
+ version: PKG_VERSION,
components: {
swarm: { status: 'running', health: metrics.health },
memory: { status: 'running', health: 0.95 },
@@ -200,7 +215,7 @@ export const systemTools: MCPTool[] = [
type: 'object',
properties: {
deep: { type: 'boolean', description: 'Perform deep health check' },
- components: { type: 'array', description: 'Components to check' },
+ components: { type: 'array', items: { type: 'string' }, description: 'Components to check' },
fix: { type: 'boolean', description: 'Attempt to fix issues' },
},
},
@@ -283,12 +298,12 @@ export const systemTools: MCPTool[] = [
inputSchema: {
type: 'object',
properties: {
- include: { type: 'array', description: 'Information to include' },
+ include: { type: 'array', items: { type: 'string' }, description: 'Information to include' },
},
},
handler: async () => {
return {
- version: '3.0.0-alpha',
+ version: PKG_VERSION,
nodeVersion: process.version,
platform: process.platform,
arch: process.arch,
diff --git a/v3/@claude-flow/cli/src/memory/memory-initializer.ts b/v3/@claude-flow/cli/src/memory/memory-initializer.ts
index 130da33de2..749399bccd 100644
--- a/v3/@claude-flow/cli/src/memory/memory-initializer.ts
+++ b/v3/@claude-flow/cli/src/memory/memory-initializer.ts
@@ -941,6 +941,12 @@ export interface MemoryInitResult {
hnswIndexing: boolean;
migrationTracking: boolean;
};
+ /** ADR-053: Controllers activated via ControllerRegistry */
+ controllers?: {
+ activated: string[];
+ failed: string[];
+ initTimeMs: number;
+ };
error?: string;
}
@@ -1080,6 +1086,58 @@ export async function checkAndMigrateLegacy(options: {
return { needsMigration: false };
}
+/**
+ * ADR-053: Activate ControllerRegistry so AgentDB v3 controllers
+ * (ReasoningBank, SkillLibrary, ExplainableRecall, etc.) are instantiated.
+ *
+ * Uses the memory-bridge's getControllerRegistry() which lazily creates
+ * a singleton ControllerRegistry and initializes it with the given dbPath.
+ * After this call, all enabled controllers are ready for immediate use.
+ *
+ * Failures are isolated: if @claude-flow/memory or agentdb is not installed,
+ * this returns an empty result without throwing.
+ */
+async function activateControllerRegistry(
+ dbPath: string,
+ verbose?: boolean,
+): Promise<{ activated: string[]; failed: string[]; initTimeMs: number }> {
+ const startTime = performance.now();
+ const activated: string[] = [];
+ const failed: string[] = [];
+
+ try {
+ const bridge = await getBridge();
+ if (!bridge) {
+ return { activated, failed, initTimeMs: performance.now() - startTime };
+ }
+
+ const registry = await bridge.getControllerRegistry(dbPath);
+ if (!registry) {
+ return { activated, failed, initTimeMs: performance.now() - startTime };
+ }
+
+ // Collect controller status from the registry
+ if (typeof registry.listControllers === 'function') {
+ const controllers = registry.listControllers();
+ for (const ctrl of controllers) {
+ if (ctrl.enabled) {
+ activated.push(ctrl.name);
+ } else {
+ failed.push(ctrl.name);
+ }
+ }
+ }
+
+ if (verbose && activated.length > 0) {
+ console.log(`ControllerRegistry: ${activated.length} controllers activated`);
+ }
+ } catch {
+ // ControllerRegistry activation is best-effort
+ }
+
+ return { activated, failed, initTimeMs: performance.now() - startTime };
+}
+
/**
* Initialize the memory database properly using sql.js
*/
@@ -1178,6 +1236,10 @@ export async function initializeMemoryDatabase(options: {
const schemaPath = path.join(dbDir, 'schema.sql');
fs.writeFileSync(schemaPath, MEMORY_SCHEMA_V3 + '\n' + getInitialMetadata(backend));
+ // ADR-053: Activate ControllerRegistry so controllers (ReasoningBank,
+ // SkillLibrary, ExplainableRecall, etc.) are instantiated during init
+ const controllerResult = await activateControllerRegistry(dbPath, verbose);
+
return {
success: true,
backend,
@@ -1215,7 +1277,8 @@ export async function initializeMemoryDatabase(options: {
temporalDecay: true,
hnswIndexing: true,
migrationTracking: true
- }
+ },
+ controllers: controllerResult,
};
} else {
// Fall back to schema file approach
@@ -1237,6 +1300,9 @@ export async function initializeMemoryDatabase(options: {
fs.writeFileSync(dbPath, sqliteHeader);
+ // ADR-053: Activate ControllerRegistry even on fallback path
+ const controllerResult = await activateControllerRegistry(dbPath, verbose);
+
return {
success: true,
backend,
@@ -1260,7 +1326,8 @@ export async function initializeMemoryDatabase(options: {
temporalDecay: true,
hnswIndexing: true,
migrationTracking: true
- }
+ },
+ controllers: controllerResult,
};
}
} catch (error) {
diff --git a/v3/@claude-flow/cli/src/runtime/headless.ts b/v3/@claude-flow/cli/src/runtime/headless.ts
index 9a508a2978..7c39bd9729 100644
--- a/v3/@claude-flow/cli/src/runtime/headless.ts
+++ b/v3/@claude-flow/cli/src/runtime/headless.ts
@@ -98,7 +98,7 @@ function parseArgs(): HeadlessConfig {
*/
function showHelp(): void {
console.log(`
-Headless Runtime for Claude Flow V3
+Headless Runtime for RuFlo V3
Usage:
headless --worker <type> Run a specific worker
@@ -194,7 +194,7 @@ async function runDaemon(): Promise<void> {
* Run benchmarks
*/
async function runBenchmarks(): Promise<BenchmarkResults> {
- console.log('=== Claude Flow V3 Performance Benchmarks ===\n');
+ console.log('=== RuFlo V3 Performance Benchmarks ===\n');
// Initialize intelligence
await initializeIntelligence();
@@ -274,7 +274,7 @@ async function runBenchmarks(): Promise<BenchmarkResults> {
* Show system status
*/
async function showStatus(): Promise<void> {
- console.log('=== Claude Flow V3 System Status ===\n');
+ console.log('=== RuFlo V3 System Status ===\n');
// Check daemon
const daemon = getDaemon();
diff --git a/v3/@claude-flow/cli/src/services/claim-service.ts b/v3/@claude-flow/cli/src/services/claim-service.ts
index 837a49cfd1..ac0fe13dbc 100644
--- a/v3/@claude-flow/cli/src/services/claim-service.ts
+++ b/v3/@claude-flow/cli/src/services/claim-service.ts
@@ -957,7 +957,7 @@ export class GitHubSync {
const claimantStr = claimant.type === 'human'
? `@${claimant.name.replace(/[^a-zA-Z0-9_-]/g, '')}`
: `Agent: ${(claimant.agentType || 'unknown').replace(/[^a-zA-Z0-9_-]/g, '')}`;
- const comment = `πŸ€– **Issue claimed** by ${claimantStr}\n\n_Coordinated by Claude Flow V3_`;
+ const comment = `πŸ€– **Issue claimed** by ${claimantStr}\n\n_Coordinated by RuFlo V3_`;
try {
execFileSync('gh', [
'issue', 'comment', String(issueNumber),