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: v3.5.43 β€” resolve 9 issues, replace 22 stubs, fix healthcare tests (#1435)

rUv8c4cecfb149f
diff --git a/package.json b/package.json
index 42c6cf9119..5732822d76 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "claude-flow",
- "version": "3.5.42",
+ "version": "3.5.43",
"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 6aed734f88..548b20a3d2 100644
--- a/ruflo/package.json
+++ b/ruflo/package.json
@@ -1,6 +1,6 @@
{
"name": "ruflo",
- "version": "3.5.42",
+ "version": "3.5.43",
"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/__tests__/commands-deep.test.ts b/v3/@claude-flow/cli/__tests__/commands-deep.test.ts
index 066fdc6bb0..747c76358a 100644
--- a/v3/@claude-flow/cli/__tests__/commands-deep.test.ts
+++ b/v3/@claude-flow/cli/__tests__/commands-deep.test.ts
@@ -668,8 +668,9 @@ describe('CommandParser', () => {
expect(result.flags.config).toBe('/path/config.json');
});
- it('should parse short flag -f with value', () => {
- const result = parser.parse(['-f', 'json']);
+ it('should parse long flag --format with value', () => {
+ // Short flag -f removed from global options β€” collides with 50+ subcommands (#1425)
+ const result = parser.parse(['--format', 'json']);
expect(result.flags.format).toBe('json');
});
});
diff --git a/v3/@claude-flow/cli/__tests__/commands.test.ts b/v3/@claude-flow/cli/__tests__/commands.test.ts
index 559da528d2..7f38be2ccd 100644
--- a/v3/@claude-flow/cli/__tests__/commands.test.ts
+++ b/v3/@claude-flow/cli/__tests__/commands.test.ts
@@ -674,8 +674,9 @@ describe('Config Commands', () => {
const result = await initCmd!.action!(ctx);
- expect(result.success).toBe(true);
- expect(result.data).toHaveProperty('version');
+ // #1425: config init is not yet implemented
+ expect(result.success).toBe(false);
+ expect(result.exitCode).toBe(1);
});
it('should initialize with V3 mode', async () => {
@@ -684,8 +685,9 @@ describe('Config Commands', () => {
ctx.flags = { v3: true, _: [] };
const result = await initCmd!.action!(ctx);
- expect(result.success).toBe(true);
- expect(result.data).toHaveProperty('v3Mode', true);
+ // #1425: config init is not yet implemented
+ expect(result.success).toBe(false);
+ expect(result.exitCode).toBe(1);
});
});
@@ -719,9 +721,9 @@ describe('Config Commands', () => {
ctx.flags = { key: 'swarm.maxAgents', value: '20', _: [] };
const result = await setCmd!.action!(ctx);
- expect(result.success).toBe(true);
- expect(result.data).toHaveProperty('key', 'swarm.maxAgents');
- expect(result.data).toHaveProperty('value', '20');
+ // #1425: config set is not yet implemented
+ expect(result.success).toBe(false);
+ expect(result.exitCode).toBe(1);
});
it('should fail without key and value', async () => {
@@ -753,8 +755,9 @@ describe('Config Commands', () => {
ctx.flags = { force: true, _: [] };
const result = await resetCmd!.action!(ctx);
- expect(result.success).toBe(true);
- expect(result.data).toHaveProperty('reset', true);
+ // #1425: config reset is not yet implemented
+ expect(result.success).toBe(false);
+ expect(result.exitCode).toBe(1);
});
});
@@ -765,8 +768,9 @@ describe('Config Commands', () => {
const result = await exportCmd!.action!(ctx);
- expect(result.success).toBe(true);
- expect(result.data).toHaveProperty('config');
+ // #1425: config export is not yet implemented
+ expect(result.success).toBe(false);
+ expect(result.exitCode).toBe(1);
});
});
@@ -778,8 +782,9 @@ describe('Config Commands', () => {
ctx.flags = { file: './config.json', _: [] };
const result = await importCmd!.action!(ctx);
- expect(result.success).toBe(true);
- expect(result.data).toHaveProperty('imported', true);
+ // #1425: config import is not yet implemented
+ expect(result.success).toBe(false);
+ expect(result.exitCode).toBe(1);
});
it('should fail without file path', async () => {
diff --git a/v3/@claude-flow/cli/package.json b/v3/@claude-flow/cli/package.json
index 37e8d0752a..4e77e23570 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.5.42",
+ "version": "3.5.43",
"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/claims.ts b/v3/@claude-flow/cli/src/commands/claims.ts
index 28d9959291..9c90db2fdd 100644
--- a/v3/@claude-flow/cli/src/commands/claims.ts
+++ b/v3/@claude-flow/cli/src/commands/claims.ts
@@ -21,31 +21,14 @@ const listCommand: Command = {
{ command: 'claude-flow claims list', description: 'List all claims' },
{ command: 'claude-flow claims list -u user123', description: 'List user claims' },
],
- action: async (ctx: CommandContext): Promise<CommandResult> => {
+ action: async (_ctx: CommandContext): Promise<CommandResult> => {
+ // #1425: This command is not yet implemented β€” was displaying hardcoded fake claims
output.writeln();
- output.writeln(output.bold('Claims & Permissions'));
- output.writeln(output.dim('─'.repeat(70)));
-
- output.printTable({
- columns: [
- { key: 'claim', header: 'Claim', width: 25 },
- { key: 'type', header: 'Type', width: 12 },
- { key: 'scope', header: 'Scope', width: 15 },
- { key: 'value', header: 'Value', width: 20 },
- ],
- data: [
- { claim: 'swarm:create', type: 'Permission', scope: 'Global', value: output.success('Allowed') },
- { claim: 'swarm:delete', type: 'Permission', scope: 'Owned', value: output.success('Allowed') },
- { claim: 'agent:spawn', type: 'Permission', scope: 'Global', value: output.success('Allowed') },
- { claim: 'memory:read', type: 'Permission', scope: 'Namespace', value: output.success('Allowed') },
- { claim: 'memory:write', type: 'Permission', scope: 'Namespace', value: output.success('Allowed') },
- { claim: 'admin:*', type: 'Permission', scope: 'Global', value: output.error('Denied') },
- { claim: 'role', type: 'Identity', scope: 'System', value: 'developer' },
- { claim: 'tier', type: 'Identity', scope: 'System', value: 'pro' },
- ],
- });
-
- return { success: true };
+ output.printError('claims list is not yet implemented');
+ output.writeln(output.dim('Claims listing requires reading from claims config file.'));
+ output.writeln(output.dim('Use "claims check -c <claim>" to evaluate a specific claim.'));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
},
};
@@ -224,21 +207,12 @@ const grantCommand: Command = {
return { success: false, exitCode: 1 };
}
+ // #1425: This command is not yet implemented β€” was faking claim grant
output.writeln();
- const spinner = output.createSpinner({ text: 'Granting claim...', spinner: 'dots' });
- spinner.start();
- await new Promise(r => setTimeout(r, 400));
- spinner.succeed('Claim granted');
-
- output.writeln();
- output.printBox([
- `Claim: ${claim}`,
- `Target: ${user ? `User: ${user}` : `Role: ${role}`}`,
- `Scope: ${scope}`,
- `Status: ${output.success('Active')}`,
- ].join('\n'), 'Grant Complete');
-
- return { success: true };
+ output.printError('claims grant is not yet implemented');
+ output.writeln(output.dim(`Cannot grant "${claim}" β€” claims persistence not yet built.`));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
},
};
@@ -265,13 +239,12 @@ const revokeCommand: Command = {
return { success: false, exitCode: 1 };
}
+ // #1425: This command is not yet implemented β€” was faking claim revocation
output.writeln();
- const spinner = output.createSpinner({ text: 'Revoking claim...', spinner: 'dots' });
- spinner.start();
- await new Promise(r => setTimeout(r, 300));
- spinner.succeed('Claim revoked');
-
- return { success: true };
+ output.printError('claims revoke is not yet implemented');
+ output.writeln(output.dim(`Cannot revoke "${claim}" β€” claims persistence not yet built.`));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
},
};
@@ -287,47 +260,13 @@ const rolesCommand: Command = {
{ command: 'claude-flow claims roles', description: 'List all roles' },
{ command: 'claude-flow claims roles -a show -n admin', description: 'Show role details' },
],
- action: async (ctx: CommandContext): Promise<CommandResult> => {
- const action = ctx.flags.action as string || 'list';
- const name = ctx.flags.name as string;
-
+ action: async (_ctx: CommandContext): Promise<CommandResult> => {
+ // #1425: This command is not yet implemented β€” was displaying hardcoded fake roles
output.writeln();
- output.writeln(output.bold('Roles'));
- output.writeln(output.dim('─'.repeat(60)));
-
- if (action === 'show' && name) {
- output.printBox([
- `Role: ${name}`,
- `Description: Full system access`,
- ``,
- `Claims:`,
- ` - swarm:* (all swarm operations)`,
- ` - agent:* (all agent operations)`,
- ` - memory:* (all memory operations)`,
- ` - admin:* (administrative functions)`,
- ``,
- `Members: 2`,
- `Created: 2024-01-01`,
- ].join('\n'), 'Role Details');
- } else {
- output.printTable({
- columns: [
- { key: 'role', header: 'Role', width: 15 },
- { key: 'description', header: 'Description', width: 30 },
- { key: 'claims', header: 'Claims', width: 12 },
- { key: 'members', header: 'Members', width: 10 },
- ],
- data: [
- { role: output.highlight('admin'), description: 'Full system access', claims: '15', members: '2' },
- { role: output.highlight('developer'), description: 'Development operations', claims: '10', members: '12' },
- { role: output.highlight('operator'), description: 'Operational tasks', claims: '8', members: '5' },
- { role: output.highlight('viewer'), description: 'Read-only access', claims: '3', members: '25' },
- { role: output.highlight('guest'), description: 'Limited access', claims: '1', members: '100' },
- ],
- });
- }
-
- return { success: true };
+ output.printError('claims roles is not yet implemented');
+ output.writeln(output.dim('Role management requires claims config persistence not yet built.'));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
},
};
@@ -343,28 +282,13 @@ const policiesCommand: Command = {
{ command: 'claude-flow claims policies', description: 'List policies' },
{ command: 'claude-flow claims policies -a create -n rate-limit', description: 'Create policy' },
],
- action: async (ctx: CommandContext): Promise<CommandResult> => {
+ action: async (_ctx: CommandContext): Promise<CommandResult> => {
+ // #1425: This command is not yet implemented β€” was displaying hardcoded fake policies
output.writeln();
- output.writeln(output.bold('Claim Policies'));
- output.writeln(output.dim('─'.repeat(60)));
-
- output.printTable({
- columns: [
- { key: 'policy', header: 'Policy', width: 20 },
- { key: 'type', header: 'Type', width: 15 },
- { key: 'condition', header: 'Condition', width: 30 },
- { key: 'status', header: 'Status', width: 12 },
- ],
- data: [
- { policy: 'rate-limit', type: 'Throttle', condition: 'Max 100 req/min', status: output.success('Active') },
- { policy: 'geo-restrict', type: 'Location', condition: 'US, EU only', status: output.success('Active') },
- { policy: 'time-window', type: 'Temporal', condition: 'Business hours', status: output.dim('Inactive') },
- { policy: 'ip-allowlist', type: 'Network', condition: '10.0.0.0/8', status: output.success('Active') },
- { policy: 'mfa-required', type: 'Auth', condition: 'Admin operations', status: output.success('Active') },
- ],
- });
-
- return { success: true };
+ output.printError('claims policies is not yet implemented');
+ output.writeln(output.dim('Policy management requires claims config persistence not yet built.'));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
},
};
diff --git a/v3/@claude-flow/cli/src/commands/config.ts b/v3/@claude-flow/cli/src/commands/config.ts
index aada5419bf..1f05725271 100644
--- a/v3/@claude-flow/cli/src/commands/config.ts
+++ b/v3/@claude-flow/cli/src/commands/config.ts
@@ -5,8 +5,7 @@
import type { Command, CommandContext, CommandResult } from '../types.js';
import { output } from '../output.js';
-import { select, confirm, input } from '../prompt.js';
-import { callMCPTool, MCPClientError } from '../mcp-client.js';
+import { select, input } from '../prompt.js';
// Init configuration
const initCommand: Command = {
@@ -33,85 +32,14 @@ const initCommand: Command = {
default: true
}
],
- action: async (ctx: CommandContext): Promise<CommandResult> => {
- const sparc = ctx.flags.sparc as boolean;
- const v3 = ctx.flags.v3 as boolean;
-
- output.writeln();
- output.printInfo('Initializing RuFlo configuration...');
+ action: async (_ctx: CommandContext): Promise<CommandResult> => {
+ // #1425: This command is not yet implemented β€” was faking file creation
output.writeln();
-
- // Create default configuration
- const config = {
- version: '3.0.0',
- v3Mode: v3,
- sparc: sparc,
- agents: {
- defaultType: 'coder',
- maxConcurrent: 15,
- autoSpawn: true,
- timeout: 300
- },
- swarm: {
- topology: 'hybrid',
- maxAgents: 15,
- autoScale: true,
- coordinationStrategy: 'consensus'
- },
- memory: {
- backend: 'hybrid',
- path: './data/memory',
- cacheSize: 256,
- enableHNSW: true
- },
- mcp: {
- transport: 'stdio',
- autoStart: true,
- tools: 'all'
- },
- providers: [
- { name: 'anthropic', priority: 1, enabled: true },
- { name: 'openrouter', priority: 2, enabled: false },
- { name: 'ollama', priority: 3, enabled: false }
- ]
- };
-
- output.writeln(output.dim(' Creating claude-flow.config.json...'));
- output.writeln(output.dim(' Creating .claude-flow/ directory...'));
-
- if (sparc) {
- output.writeln(output.dim(' Initializing SPARC methodology...'));
- output.writeln(output.dim(' Creating SPARC workflow files...'));
- }
-
- if (v3) {
- output.writeln(output.dim(' Enabling V3 15-agent coordination...'));
- output.writeln(output.dim(' Configuring AgentDB integration...'));
- output.writeln(output.dim(' Setting up Flash Attention optimization...'));
- }
-
- output.writeln();
- output.printTable({
- columns: [
- { key: 'setting', header: 'Setting', width: 25 },
- { key: 'value', header: 'Value', width: 30 }
- ],
- data: [
- { setting: 'Version', value: config.version },
- { setting: 'V3 Mode', value: config.v3Mode ? 'Enabled' : 'Disabled' },
- { setting: 'SPARC Mode', value: config.sparc ? 'Enabled' : 'Disabled' },
- { setting: 'Swarm Topology', value: config.swarm.topology },
- { setting: 'Max Agents', value: config.swarm.maxAgents },
- { setting: 'Memory Backend', value: config.memory.backend },
- { setting: 'MCP Transport', value: config.mcp.transport }
- ]
- });
-
- output.writeln();
- output.printSuccess('Configuration initialized');
- output.writeln(output.dim(' Config file: ./claude-flow.config.json'));
-
- return { success: true, data: config };
+ output.printError('config init is not yet implemented');
+ output.writeln(output.dim('Configuration files are not actually created by this command yet.'));
+ output.writeln(output.dim('Use the project wizard instead: npx claude-flow@v3alpha init --wizard'));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
}
};
@@ -220,10 +148,12 @@ const setCommand: Command = {
return { success: false, exitCode: 1 };
}
- output.printInfo(`Setting ${key} = ${value}`);
- output.printSuccess('Configuration updated');
-
- return { success: true, data: { key, value } };
+ // #1425: This command is not yet implemented β€” was faking config persistence
+ output.writeln();
+ output.printError('config set is not yet implemented');
+ output.writeln(output.dim(`Cannot persist ${key} = ${value} β€” config file write not implemented.`));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
}
};
@@ -311,26 +241,13 @@ const resetCommand: Command = {
choices: ['agents', 'swarm', 'memory', 'mcp', 'providers', 'all']
}
],
- action: async (ctx: CommandContext): Promise<CommandResult> => {
- const force = ctx.flags.force as boolean;
- const section = ctx.flags.section as string || 'all';
-
- if (!force && ctx.interactive) {
- const confirmed = await confirm({
- message: `Reset ${section} configuration to defaults?`,
- default: false
- });
-
- if (!confirmed) {
- output.printInfo('Operation cancelled');
- return { success: true };
- }
- }
-
- output.printInfo(`Resetting ${section} configuration...`);
- output.printSuccess('Configuration reset to defaults');
-
- return { success: true, data: { section, reset: true } };
+ action: async (_ctx: CommandContext): Promise<CommandResult> => {
+ // #1425: This command is not yet implemented β€” was faking config reset
+ output.writeln();
+ output.printError('config reset is not yet implemented');
+ output.writeln(output.dim('Configuration reset requires config file read/write support.'));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
}
};
@@ -354,24 +271,13 @@ const exportCommand: Command = {
choices: ['json', 'yaml']
}
],
- action: async (ctx: CommandContext): Promise<CommandResult> => {
- const outputPath = ctx.flags.output as string || './claude-flow.config.export.json';
-
- const config = {
- version: '3.0.0',
- exportedAt: new Date().toISOString(),
- agents: { defaultType: 'coder', maxConcurrent: 15 },
- swarm: { topology: 'hybrid', maxAgents: 15 },
- memory: { backend: 'hybrid', cacheSize: 256 },
- mcp: { transport: 'stdio', tools: 'all' }
- };
-
- output.printInfo(`Exporting configuration to ${outputPath}...`);
- output.printJson(config);
+ action: async (_ctx: CommandContext): Promise<CommandResult> => {
+ // #1425: This command is not yet implemented β€” was faking config export
output.writeln();
- output.printSuccess('Configuration exported');
-
- return { success: true, data: { path: outputPath, config } };
+ output.printError('config export is not yet implemented');
+ output.writeln(output.dim('Configuration export requires config file read support.'));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
}
};
@@ -396,24 +302,18 @@ const importCommand: Command = {
],
action: async (ctx: CommandContext): Promise<CommandResult> => {
const file = ctx.flags.file as string || ctx.args[0];
- const merge = ctx.flags.merge as boolean;
if (!file) {
output.printError('File path is required');
return { success: false, exitCode: 1 };
}
- output.printInfo(`Importing configuration from ${file}...`);
-
- if (merge) {
- output.writeln(output.dim(' Merging with existing configuration...'));
- } else {
- output.writeln(output.dim(' Replacing existing configuration...'));
- }
-
- output.printSuccess('Configuration imported');
-
- return { success: true, data: { file, merge, imported: true } };
+ // #1425: This command is not yet implemented β€” was faking config import
+ output.writeln();
+ output.printError('config import is not yet implemented');
+ output.writeln(output.dim(`Cannot import from ${file} β€” config file read/write not implemented.`));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
}
};
diff --git a/v3/@claude-flow/cli/src/commands/deployment.ts b/v3/@claude-flow/cli/src/commands/deployment.ts
index 24176b2ae7..2c277b945b 100644
--- a/v3/@claude-flow/cli/src/commands/deployment.ts
+++ b/v3/@claude-flow/cli/src/commands/deployment.ts
@@ -24,48 +24,12 @@ const deployCommand: Command = {
{ command: 'claude-flow deployment deploy --dry-run', description: 'Simulate deployment' },
],
action: async (ctx: CommandContext): Promise<CommandResult> => {
- const env = ctx.flags.env as string || 'staging';
- const version = ctx.flags.version as string || 'latest';
- const dryRun = ctx.flags['dry-run'] as boolean;
-
+ // #1425: This command is not yet implemented β€” was returning hardcoded fake responses
output.writeln();
- output.writeln(output.bold(`Deployment: ${env.toUpperCase()}`));
- output.writeln(output.dim('─'.repeat(50)));
-
- if (dryRun) {
- output.printWarning('DRY RUN - No changes will be made');
- output.writeln();
- }
-
- const steps = [
- { name: 'Pre-flight checks', status: 'running' },
- { name: 'Build artifacts', status: 'pending' },
- { name: 'Run tests', status: 'pending' },
- { name: 'Security scan', status: 'pending' },
- { name: 'Deploy to target', status: 'pending' },
- { name: 'Health checks', status: 'pending' },
- { name: 'DNS update', status: 'pending' },
- ];
-
- for (const step of steps) {
- const spinner = output.createSpinner({ text: step.name + '...', spinner: 'dots' });
- spinner.start();
- await new Promise(r => setTimeout(r, 400));
- spinner.succeed(step.name);
- }
-
- output.writeln();
- output.printBox([
- `Environment: ${env}`,
- `Version: ${version}`,
- `Status: ${output.success('Deployed')}`,
- ``,
- `URL: https://${env === 'prod' ? 'api' : env}.claude-flow.io`,
- `Deployed at: ${new Date().toISOString()}`,
- `Duration: 12.4s`,
- ].join('\n'), 'Deployment Complete');
-
- return { success: true };
+ output.printError('deployment deploy is not yet implemented');
+ output.writeln(output.dim('This command will be implemented in a future release.'));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
},
};
@@ -82,27 +46,12 @@ const statusCommand: Command = {
{ command: 'claude-flow deployment status -e prod', description: 'Check production' },
],
action: async (ctx: CommandContext): Promise<CommandResult> => {
+ // #1425: This command is not yet implemented β€” was returning hardcoded fake data
output.writeln();
- output.writeln(output.bold('Deployment Status'));
- output.writeln(output.dim('─'.repeat(70)));
-
- output.printTable({
- columns: [
- { key: 'env', header: 'Environment', width: 12 },
- { key: 'version', header: 'Version', width: 18 },
- { key: 'status', header: 'Status', width: 12 },
- { key: 'health', header: 'Health', width: 10 },
- { key: 'deployed', header: 'Deployed', width: 20 },
- ],
- data: [
- { env: 'Production', version: 'v3.0.0-alpha.10', status: output.success('Active'), health: output.success('100%'), deployed: '2h ago' },
- { env: 'Staging', version: 'v3.0.0-alpha.11', status: output.success('Active'), health: output.success('100%'), deployed: '30m ago' },
- { env: 'Development', version: 'v3.0.0-alpha.12', status: output.success('Active'), health: output.success('100%'), deployed: '5m ago' },
- { env: 'Preview', version: 'pr-456', status: output.warning('Deploying'), health: output.dim('--'), deployed: 'In progress' },
- ],
- });
-
- return { success: true };
+ output.printError('deployment status is not yet implemented');
+ output.writeln(output.dim('This command will be implemented in a future release.'));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
},
};
@@ -120,40 +69,12 @@ const rollbackCommand: Command = {
{ command: 'claude-flow deployment rollback -e prod -v v3.0.0', description: 'Rollback to specific version' },
],
action: async (ctx: CommandContext): Promise<CommandResult> => {
- const env = ctx.flags.env as string;
- const version = ctx.flags.version as string;
-
- if (!env) {
- output.printError('Environment is required for rollback');
- return { success: false, exitCode: 1 };
- }
-
+ // #1425: This command is not yet implemented β€” was returning hardcoded fake responses
output.writeln();
- output.writeln(output.bold(`Rollback: ${env.toUpperCase()}`));
- output.writeln(output.dim('─'.repeat(40)));
-
- output.printWarning(`Rolling back ${env} to ${version || 'previous version'}`);
- output.writeln();
-
- const spinner = output.createSpinner({ text: 'Initiating rollback...', spinner: 'dots' });
- spinner.start();
-
- const steps = ['Stopping current deployment', 'Restoring previous version', 'Running health checks', 'Updating DNS'];
- for (const step of steps) {
- spinner.setText(step + '...');
- await new Promise(r => setTimeout(r, 400));
- }
-
- spinner.succeed('Rollback complete');
-
- output.writeln();
- output.printBox([
- `Environment: ${env}`,
- `Rolled back to: ${version || 'v3.0.0-alpha.9'}`,
- `Status: ${output.success('Active')}`,
- ].join('\n'), 'Rollback Complete');
-
- return { success: true };
+ output.printError('deployment rollback is not yet implemented');
+ output.writeln(output.dim('This command will be implemented in a future release.'));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
},
};
@@ -170,31 +91,12 @@ const historyCommand: Command = {
{ command: 'claude-flow deployment history -e prod', description: 'Production history' },
],
action: async (ctx: CommandContext): Promise<CommandResult> => {
- const env = ctx.flags.env as string;
-
+ // #1425: This command is not yet implemented β€” was returning hardcoded fake data
output.writeln();
- output.writeln(output.bold(`Deployment History${env ? `: ${env}` : ''}`));
- output.writeln(output.dim('─'.repeat(80)));
-
- output.printTable({
- columns: [
- { key: 'id', header: 'ID', width: 10 },
- { key: 'env', header: 'Env', width: 10 },
- { key: 'version', header: 'Version', width: 18 },
- { key: 'status', header: 'Status', width: 12 },
- { key: 'deployer', header: 'Deployer', width: 12 },
- { key: 'timestamp', header: 'Timestamp', width: 20 },
- ],
- data: [
- { id: 'dep-123', env: 'prod', version: 'v3.0.0-alpha.10', status: output.success('Success'), deployer: 'ci-bot', timestamp: '2024-01-15 14:30' },
- { id: 'dep-122', env: 'staging', version: 'v3.0.0-alpha.11', status: output.success('Success'), deployer: 'ci-bot', timestamp: '2024-01-15 14:00' },
- { id: 'dep-121', env: 'prod', version: 'v3.0.0-alpha.9', status: output.dim('Rolled back'), deployer: 'ci-bot', timestamp: '2024-01-15 12:30' },
- { id: 'dep-120', env: 'staging', version: 'v3.0.0-alpha.10', status: output.success('Success'), deployer: 'developer', timestamp: '2024-01-15 10:00' },
- { id: 'dep-119', env: 'dev', version: 'v3.0.0-alpha.10', status: output.error('Failed'), deployer: 'developer', timestamp: '2024-01-15 09:30' },
- ],
- });
-
- return { success: true };
+ output.printError('deployment history is not yet implemented');
+ output.writeln(output.dim('This command will be implemented in a future release.'));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
},
};
@@ -212,26 +114,12 @@ const environmentsCommand: Command = {
{ command: 'claude-flow deployment envs -a create -n preview', description: 'Create environment' },
],
action: async (ctx: CommandContext): Promise<CommandResult> => {
+ // #1425: This command is not yet implemented β€” was returning hardcoded fake data
output.writeln();
- output.writeln(output.bold('Deployment Environments'));
- output.writeln(output.dim('─'.repeat(60)));
-
- output.printTable({
- columns: [
- { key: 'name', header: 'Name', width: 15 },
- { key: 'url', header: 'URL', width: 30 },
- { key: 'auto', header: 'Auto Deploy', width: 12 },
- { key: 'protected', header: 'Protected', width: 12 },
- ],
- data: [
- { name: 'production', url: 'https://api.claude-flow.io', auto: output.error('No'), protected: output.success('Yes') },
- { name: 'staging', url: 'https://staging.claude-flow.io', auto: output.success('Yes'), protected: output.error('No') },
- { name: 'development', url: 'https://dev.claude-flow.io', auto: output.success('Yes'), protected: output.error('No') },
- { name: 'preview/*', url: 'https://pr-*.claude-flow.io', auto: output.success('Yes'), protected: output.error('No') },
- ],
- });
-
- return { success: true };
+ output.printError('deployment environments is not yet implemented');
+ output.writeln(output.dim('This command will be implemented in a future release.'));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
},
};
@@ -250,34 +138,12 @@ const logsCommand: Command = {
{ command: 'claude-flow deployment logs -d dep-123', description: 'View specific deployment' },
],
action: async (ctx: CommandContext): Promise<CommandResult> => {
- const env = ctx.flags.env as string || 'staging';
-
- output.writeln();
- output.writeln(output.bold(`Deployment Logs: ${env}`));
- output.writeln(output.dim('─'.repeat(60)));
+ // #1425: This command is not yet implemented β€” was returning hardcoded fake logs
output.writeln();
-
- const logs = [
- { time: '14:30:01', level: 'INFO', msg: 'Starting deployment v3.0.0-alpha.10' },
- { time: '14:30:02', level: 'INFO', msg: 'Building Docker image...' },
- { time: '14:30:15', level: 'INFO', msg: 'Image built: sha256:abc123...' },
- { time: '14:30:16', level: 'INFO', msg: 'Pushing to registry...' },
- { time: '14:30:25', level: 'INFO', msg: 'Deploying to kubernetes...' },
- { time: '14:30:30', level: 'INFO', msg: 'Rolling update started' },
- { time: '14:30:45', level: 'INFO', msg: 'Health check passed (1/3)' },
- { time: '14:30:50', level: 'INFO', msg: 'Health check passed (2/3)' },
- { time: '14:30:55', level: 'INFO', msg: 'Health check passed (3/3)' },
- { time: '14:31:00', level: 'INFO', msg: 'Deployment complete!' },
- ];
-
- for (const log of logs) {
- const levelColor = log.level === 'ERROR' ? output.error(log.level) :
- log.level === 'WARN' ? output.warning(log.level) :
- output.dim(log.level);
- output.writeln(`${output.dim(log.time)} ${levelColor} ${log.msg}`);
- }
-
- return { success: true };
+ output.printError('deployment logs is not yet implemented');
+ output.writeln(output.dim('This command will be implemented in a future release.'));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
},
};
diff --git a/v3/@claude-flow/cli/src/commands/hive-mind.ts b/v3/@claude-flow/cli/src/commands/hive-mind.ts
index 9401e2b457..be81dc37be 100644
--- a/v3/@claude-flow/cli/src/commands/hive-mind.ts
+++ b/v3/@claude-flow/cli/src/commands/hive-mind.ts
@@ -157,6 +157,13 @@ ${workerTypes.map(type => `β€’ ${type}: ${workerGroups[type].length} agents`).jo
🎯 YOUR OBJECTIVE:
${objective}
+⚠️ CRITICAL β€” TOOL PREFERENCE RULES (#1422):
+β€’ You MUST use Ruflo MCP tools (mcp__ruflo__*) for ALL orchestration tasks
+β€’ Do NOT use Claude native Task/Agent tools for swarm coordination β€” use mcp__ruflo__agent_spawn, mcp__ruflo__task_assign, etc.
+β€’ Native Claude tools (Read, Write, Edit, Bash, Grep, Glob) should ONLY be used for file operations and shell commands
+β€’ All agent spawning, task assignment, memory, and coordination MUST go through mcp__ruflo__* tools
+β€’ If a Ruflo MCP tool exists for an operation, always prefer it over any native equivalent
+
πŸ’‘ COORDINATION TIPS:
β€’ Use mcp__ruflo__hive-mind_broadcast for swarm-wide announcements
β€’ Check worker status regularly with mcp__ruflo__hive-mind_status
diff --git a/v3/@claude-flow/cli/src/commands/memory.ts b/v3/@claude-flow/cli/src/commands/memory.ts
index b358f8c548..724b37e341 100644
--- a/v3/@claude-flow/cli/src/commands/memory.ts
+++ b/v3/@claude-flow/cli/src/commands/memory.ts
@@ -1446,6 +1446,14 @@ const initMemoryCommand: Command = {
output.writeln(output.dim(`Synced to: ${claudeDbPath}`));
}
+ // Fix #1428: ONNX worker threads keep the event loop alive after init.
+ // Force-exit after a short delay to allow final I/O to flush.
+ if (typeof globalThis !== 'undefined') {
+ setTimeout(() => {
+ process.exit(0);
+ }, 500).unref();
+ }
+
return {
success: true,
data: result
diff --git a/v3/@claude-flow/cli/src/commands/migrate.ts b/v3/@claude-flow/cli/src/commands/migrate.ts
index 09617cfef2..d7d5292813 100644
--- a/v3/@claude-flow/cli/src/commands/migrate.ts
+++ b/v3/@claude-flow/cli/src/commands/migrate.ts
@@ -5,7 +5,7 @@
import type { Command, CommandContext, CommandResult } from '../types.js';
import { output } from '../output.js';
-import { select, confirm, multiSelect } from '../prompt.js';
+import { select } from '../prompt.js';
// Migration targets
const MIGRATION_TARGETS = [
@@ -22,55 +22,13 @@ const MIGRATION_TARGETS = [
const statusCommand: Command = {
name: 'status',
description: 'Check migration status',
- action: async (ctx: CommandContext): Promise<CommandResult> => {
- const status = {
- v2Version: '2.6.0',
- v3Version: '3.0.0-alpha.1',
- migrationState: 'partial',
- components: [
- { name: 'Configuration', status: 'migrated', v2Path: './claude-flow.json', v3Path: './claude-flow.config.json' },
- { name: 'Memory Data', status: 'pending', v2Path: './.claude-flow/memory', v3Path: './data/memory' },
- { name: 'Agent Configs', status: 'pending', v2Path: './.claude-flow/agents', v3Path: './v3/agents' },
- { name: 'Hooks', status: 'pending', v2Path: './src/hooks', v3Path: './v3/hooks' },
- { name: 'Workflows', status: 'not-required', v2Path: 'N/A', v3Path: 'N/A' },
- { name: 'Embeddings', status: 'pending', v2Path: 'OpenAI/TF.js', v3Path: 'ONNX + Hyperbolic' }
- ],
- recommendations: [
- 'Backup v2 data before migration',
- 'Test migration in staging environment first',
- 'Review breaking changes in CHANGELOG.md'
- ]
- };
-
- if (ctx.flags.format === 'json') {
- output.printJson(status);
- return { success: true, data: status };
- }
-
- output.writeln();
- output.writeln(output.bold('Migration Status'));
- output.writeln();
- output.writeln(`V2 Version: ${status.v2Version}`);
- output.writeln(`V3 Version: ${status.v3Version}`);
- output.writeln(`State: ${formatMigrationStatus(status.migrationState)}`);
- output.writeln();
-
- output.writeln(output.bold('Components'));
- output.printTable({
- columns: [
- { key: 'name', header: 'Component', width: 18 },
- { key: 'status', header: 'Status', width: 15, format: (v) => formatMigrationStatus(String(v)) },
- { key: 'v2Path', header: 'V2 Path', width: 25 },
- { key: 'v3Path', header: 'V3 Path', width: 25 }
- ],
- data: status.components
- });
-
+ action: async (_ctx: CommandContext): Promise<CommandResult> => {
+ // #1425: This command is not yet implemented β€” was returning hardcoded fake migration status
output.writeln();
- output.writeln(output.bold('Recommendations'));
- output.printList(status.recommendations);
-
- return { success: true, data: status };
+ output.printError('migrate status is not yet implemented');
+ output.writeln(output.dim('Migration status detection requires filesystem analysis not yet built.'));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
}
};
@@ -106,71 +64,14 @@ const runCommand: Command = {
default: false
}
],
- action: async (ctx: CommandContext): Promise<CommandResult> => {
- let target = ctx.flags.target as string;
- const dryRun = ctx.flags.dryRun as boolean;
- const backup = ctx.flags.backup as boolean;
- const force = ctx.flags.force as boolean;
-
- if (!target && ctx.interactive) {
- target = await select({
- message: 'Select migration target:',
- options: MIGRATION_TARGETS,
- default: 'all'
- });
- }
-
- target = target || 'all';
-
- output.writeln();
-
- if (dryRun) {
- output.printInfo('DRY RUN - No changes will be made');
- output.writeln();
- }
-
- output.printInfo(`Migrating: ${target}`);
+ action: async (_ctx: CommandContext): Promise<CommandResult> => {
+ // #1425: This command is not yet implemented β€” was faking migration execution
output.writeln();
-
- // Backup step
- if (backup && !dryRun) {
- output.writeln(output.dim('Creating backup...'));
- output.writeln(output.dim(` Backup created: ./.claude-flow-backup-${Date.now()}`));
- output.writeln();
- }
-
- // Migration steps based on target
- const steps = getMigrationSteps(target);
-
- for (const step of steps) {
- output.writeln(`${output.info('>')} ${step.name}`);
- output.writeln(output.dim(` ${step.description}`));
-
- if (!dryRun) {
- // Execute migration step
- output.writeln(output.dim(` ${output.success('[OK]')} Completed`));
- } else {
- output.writeln(output.dim(` Would migrate: ${step.source} -> ${step.dest}`));
- }
-
- output.writeln();
- }
-
- const result = {
- target,
- dryRun,
- backup,
- stepsCompleted: steps.length,
- success: true
- };
-
- if (dryRun) {
- output.printInfo('Dry run complete. Run without --dry-run to apply changes.');
- } else {
- output.printSuccess('Migration completed successfully');
- }
-
- return { success: true, data: result };
+ output.printError('migrate run is not yet implemented');
+ output.writeln(output.dim('V2β†’V3 migration requires file transformation logic not yet built.'));
+ output.writeln(output.dim('See "migrate breaking" for a list of V3 breaking changes.'));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
}
};
@@ -186,51 +87,13 @@ const verifyCommand: Command = {
default: false
}
],
- action: async (ctx: CommandContext): Promise<CommandResult> => {
- const fix = ctx.flags.fix as boolean;
-
+ action: async (_ctx: CommandContext): Promise<CommandResult> => {
+ // #1425: This command is not yet implemented β€” was returning hardcoded fake verification results
output.writeln();
- output.printInfo('Verifying migration...');
- output.writeln();
-
- const checks = [
- { name: 'Configuration Schema', status: 'passed', details: 'V3 schema valid' },
- { name: 'Memory Data Integrity', status: 'passed', details: 'All entries valid' },
- { name: 'Agent Configurations', status: 'warning', details: '2 deprecated fields detected' },
- { name: 'Hook Definitions', status: 'passed', details: 'All hooks registered' },
- { name: 'File Permissions', status: 'passed', details: 'Correct permissions' },
- { name: 'Dependencies', status: 'passed', details: 'All dependencies available' }
- ];
-
- output.printTable({
- columns: [
- { key: 'name', header: 'Check', width: 25 },
- { key: 'status', header: 'Status', width: 12, format: (v) => {
- if (v === 'passed') return output.success('PASSED');
- if (v === 'warning') return output.warning('WARNING');
- return output.error('FAILED');
- }},
- { key: 'details', header: 'Details', width: 30 }
- ],
- data: checks
- });
-
- const hasIssues = checks.some(c => c.status !== 'passed');
-
- output.writeln();
-
- if (hasIssues) {
- if (fix) {
- output.printInfo('Attempting to fix issues...');
- output.printSuccess('Issues fixed');
- } else {
- output.printWarning('Some issues detected. Run with --fix to attempt automatic fixes.');
- }
- } else {
- output.printSuccess('All verification checks passed');
- }
-
- return { success: true, data: { checks, hasIssues } };
+ output.printError('migrate verify is not yet implemented');
+ output.writeln(output.dim('Migration verification requires integrity checks not yet built.'));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
}
};
@@ -252,66 +115,13 @@ const rollbackCommand: Command = {
default: false
}
],
- action: async (ctx: CommandContext): Promise<CommandResult> => {
- const backupId = ctx.flags.backupId as string;
- const force = ctx.flags.force as boolean;
-
- // List available backups
- const backups = [
- { id: 'backup-1704369600', date: '2024-01-04 10:00:00', size: '45.2 MB' },
- { id: 'backup-1704283200', date: '2024-01-03 10:00:00', size: '44.8 MB' },
- { id: 'backup-1704196800', date: '2024-01-02 10:00:00', size: '43.5 MB' }
- ];
-
- if (!backupId && ctx.interactive) {
- output.writeln();
- output.writeln(output.bold('Available Backups'));
- output.writeln();
-
- output.printTable({
- columns: [
- { key: 'id', header: 'Backup ID', width: 20 },
- { key: 'date', header: 'Date', width: 22 },
- { key: 'size', header: 'Size', width: 12, align: 'right' }
- ],
- data: backups
- });
-
- output.writeln();
-
- const confirmed = await confirm({
- message: `Rollback to most recent backup (${backups[0].id})?`,
- default: false
- });
-
- if (!confirmed) {
- output.printInfo('Operation cancelled');
- return { success: true };
- }
- }
-
- const targetBackup = backupId || backups[0].id;
-
- if (!force && !ctx.interactive) {
- output.printError('Use --force to rollback without confirmation');
- return { success: false, exitCode: 1 };
- }
-
- output.writeln();
- output.printInfo(`Rolling back to ${targetBackup}...`);
+ action: async (_ctx: CommandContext): Promise<CommandResult> => {
+ // #1425: This command is not yet implemented β€” was faking rollback execution
output.writeln();
-
- output.writeln(output.dim(' Stopping services...'));
- output.writeln(output.dim(' Restoring configuration...'));
- output.writeln(output.dim(' Restoring memory data...'));
- output.writeln(output.dim(' Restoring agent configs...'));
- output.writeln(output.dim(' Verifying integrity...'));
-
- output.writeln();
- output.printSuccess(`Rolled back to ${targetBackup}`);
- output.writeln(output.dim(' Note: Restart services to apply changes'));
-
- return { success: true, data: { backupId: targetBackup, rolledBack: true } };
+ output.printError('migrate rollback is not yet implemented');
+ output.writeln(output.dim('Migration rollback requires backup/restore logic not yet built.'));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
}
};
diff --git a/v3/@claude-flow/cli/src/commands/providers.ts b/v3/@claude-flow/cli/src/commands/providers.ts
index 0cc784d2c7..f921a7f1c6 100644
--- a/v3/@claude-flow/cli/src/commands/providers.ts
+++ b/v3/@claude-flow/cli/src/commands/providers.ts
@@ -76,20 +76,13 @@ const configureCommand: Command = {
output.writeln(output.bold(`Configure: ${provider}`));
output.writeln(output.dim('─'.repeat(40)));
- const spinner = output.createSpinner({ text: 'Updating configuration...', spinner: 'dots' });
- spinner.start();
- await new Promise(r => setTimeout(r, 500));
- spinner.succeed('Configuration updated');
-
+ // #1425: This command is not yet implemented β€” was faking configuration saves
output.writeln();
- output.printBox([
- `Provider: ${provider}`,
- `API Key: ${hasKey ? 'β€’β€’β€’β€’β€’β€’β€’β€’' + (hasKey as string).slice(-4) : 'Not set'}`,
- `Model: ${model || 'Default'}`,
- `Status: Active`,
- ].join('\n'), 'Configuration');
-
- return { success: true };
+ output.printError('providers configure is not yet implemented');
+ output.writeln(output.dim('Provider API keys should be set via environment variables:'));
+ output.writeln(output.dim(' ANTHROPIC_API_KEY, OPENAI_API_KEY, etc.'));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
},
};
@@ -117,17 +110,12 @@ const testCommand: Command = {
? ['Anthropic', 'OpenAI (LLM)', 'OpenAI (Embedding)', 'Transformers.js', 'Agentic Flow']
: [provider];
- for (const p of providers) {
- const spinner = output.createSpinner({ text: `Testing ${p}...`, spinner: 'dots' });
- spinner.start();
- await new Promise(r => setTimeout(r, 300));
- spinner.succeed(`${p}: Connected`);
- }
-
+ // #1425: This command is not yet implemented β€” was faking connectivity results
output.writeln();
- output.printSuccess(`All ${providers.length} providers connected successfully`);
-
- return { success: true };
+ output.printError('providers test is not yet implemented');
+ output.writeln(output.dim('Provider connectivity testing will be implemented in a future release.'));
+ output.writeln(output.dim('Track progress: https://github.com/ruvnet/claude-flow/issues/1425'));
+ return { success: false, exitCode: 1 };
},
};
diff --git a/v3/@claude-flow/cli/src/commands/swarm.ts b/v3/@claude-flow/cli/src/commands/swarm.ts
index 2cac0ed7f4..1eb8a2d773 100644
--- a/v3/@claude-flow/cli/src/commands/swarm.ts
+++ b/v3/@claude-flow/cli/src/commands/swarm.ts
@@ -428,31 +428,53 @@ const startCommand: Command = {
}
}
- output.writeln();
- output.printInfo('Deploying agents...');
+ // Initialize swarm via MCP and persist state (#1423: was stub-only, no actual execution)
+ const swarmId = `swarm-${Date.now().toString(36)}`;
+ const totalAgents = agentPlan.reduce((sum: number, a: { count: number }) => sum + a.count, 0);
- // Show deployment progress
- const spinner = output.createSpinner({ text: 'Initializing agents...', spinner: 'dots' });
+ output.writeln();
+ const spinner = output.createSpinner({ text: 'Initializing swarm via MCP...', spinner: 'dots' });
spinner.start();
- // Brief delay for spinner animation
- await new Promise(resolve => setTimeout(resolve, 500));
+ try {
+ // Actually call MCP to initialize the swarm
+ const initResult = await callMCPTool('swarm_init', {
+ topology: 'hierarchical',
+ maxAgents: totalAgents,
+ strategy: strategy === 'development' ? 'specialized' : strategy,
+ });
+ spinner.succeed('Swarm initialized via MCP');
+ } catch (err) {
+ spinner.fail('MCP swarm_init failed β€” swarm metadata saved locally only');
+ output.writeln(output.dim(` Error: ${err instanceof Error ? err.message : String(err)}`));
+ output.writeln(output.dim(' The MCP server may not be running. Start it with: claude mcp add claude-flow npx claude-flow@v3alpha mcp start'));
+ }
- spinner.succeed('All agents deployed');
+ // Persist swarm state to disk so `swarm status` can read it
+ const swarmDir = path.join(process.cwd(), '.swarm');
+ if (!fs.existsSync(swarmDir)) fs.mkdirSync(swarmDir, { recursive: true });
const executionState = {
- swarmId: `swarm-${Date.now().toString(36)}`,
+ swarmId,
objective,
strategy,
- status: 'running',
- agents: agentPlan.reduce((sum, a) => sum + a.count, 0),
+ status: 'initialized',
+ agents: totalAgents,
+ agentPlan,
startedAt: new Date().toISOString(),
parallel: ctx.flags.parallel ?? true
};
+ fs.writeFileSync(
+ path.join(swarmDir, 'state.json'),
+ JSON.stringify(executionState, null, 2)
+ );
+
output.writeln();
- output.printSuccess('Swarm execution started');
- output.writeln(output.dim(` Monitor: claude-flow swarm status ${executionState.swarmId}`));
+ output.printSuccess(`Swarm ${swarmId} initialized with ${totalAgents} agent slots`);
+ output.writeln(output.dim(' Note: Agents are registered but actual task execution requires'));
+ output.writeln(output.dim(' Claude Code Task tool or hive-mind spawn --claude to drive work.'));
+ output.writeln(output.dim(` Monitor: claude-flow swarm status ${swarmId}`));
return { success: true, data: executionState };
}
@@ -592,11 +614,26 @@ const stopCommand: Command = {
output.printInfo(`Stopping swarm ${swarmId}...`);
- if (!force) {
- output.writeln(output.dim(' Completing in-progress tasks...'));
- output.writeln(output.dim(' Saving coordination state...'));
- output.writeln(output.dim(' Notifying agents...'));
- output.writeln(output.dim(' Saving memory state...'));
+ // Update persisted swarm state if it exists (#1423)
+ const swarmStateFile = path.join(process.cwd(), '.swarm', 'state.json');
+ if (fs.existsSync(swarmStateFile)) {
+ try {
+ const state = JSON.parse(fs.readFileSync(swarmStateFile, 'utf-8'));
+ state.status = 'stopped';
+ state.stoppedAt = new Date().toISOString();
+ fs.writeFileSync(swarmStateFile, JSON.stringify(state, null, 2));
+ output.writeln(output.dim(' Swarm state updated'));
+ } catch {
+ output.writeln(output.dim(' Could not update swarm state file'));
+ }
+ }
+
+ // Attempt MCP cleanup
+ try {
+ await callMCPTool('swarm_stop', { swarmId, force });
+ output.writeln(output.dim(' MCP swarm stopped'));
+ } catch {
+ // MCP may not be available
}
output.printSuccess(`Swarm ${swarmId} stopped`);
@@ -641,8 +678,17 @@ const scaleCommand: Command = {
output.printInfo(`Scaling swarm ${swarmId} to ${targetAgents} agents...`);
- // Calculate scaling delta
- const currentAgents = 8;
+ // Calculate scaling delta β€” fetch actual count instead of hardcoded 8 (#1425)
+ const { callMCPTool } = await import('../mcp-client.js');
+ let currentAgents = 0;
+ try {
+ const statusResult = await callMCPTool('swarm_status', {});
+ const statusData = typeof statusResult === 'string' ? JSON.parse(statusResult) : statusResult;
+ currentAgents = statusData?.agentCount ?? statusData?.agents?.length ?? 0;
+ } catch {
+ // If MCP unavailable, fall back to 0 (will spawn all requested agents)
+ currentAgents = 0;
+ }
const delta = targetAgents - currentAgents;
if (delta > 0) {
@@ -717,14 +763,22 @@ const coordinateCommand: Command = {
data: v3Agents
});
+ // Actually initialize via MCP instead of just displaying (#1423)
output.writeln();
- output.printInfo('Performance Targets:');
- output.printList([
- `Flash Attention: ${output.success('2.49x-7.47x speedup')}`,
- `AgentDB Search: ${output.success('150x-12,500x improvement')}`,
- `Memory Reduction: ${output.success('50-75%')}`,
- `Code Reduction: ${output.success('<5,000 lines')}`
- ]);
+ try {
+ await callMCPTool('swarm_init', {
+ topology: 'hierarchical-mesh',
+ maxAgents: agentCount,
+ strategy: 'specialized',
+ });
+ output.printSuccess(`Swarm coordination initialized with ${agentCount} agent slots via MCP`);
+ } catch {
+ output.printWarning('MCP unavailable β€” showing agent plan only (no active coordination)');
+ }
+
+ output.writeln();
+ output.writeln(output.dim('Note: Use Claude Code Task tool or hive-mind spawn --claude to'));
+ output.writeln(output.dim('drive actual agent execution. This command sets up the topology.'));
return { success: true, data: { agents: v3Agents, count: agentCount } };
}
diff --git a/v3/@claude-flow/cli/src/config-adapter.ts b/v3/@claude-flow/cli/src/config-adapter.ts
index 531145c58d..4574f9e93a 100644
--- a/v3/@claude-flow/cli/src/config-adapter.ts
+++ b/v3/@claude-flow/cli/src/config-adapter.ts
@@ -38,7 +38,7 @@ export function systemConfigToV3Config(systemConfig: SystemConfig): V3Config {
persistPath: systemConfig.memory?.path || './data/memory',
cacheSize: systemConfig.memory?.maxSize ?? 1000000,
enableHNSW: systemConfig.memory?.agentdb?.indexType === 'hnsw',
- vectorDimension: systemConfig.memory?.agentdb?.dimensions ?? 1536,
+ vectorDimension: systemConfig.memory?.agentdb?.dimensions ?? 384, // Match all-MiniLM-L6-v2 output (#1395 Bug 5)
},
// MCP configuration
diff --git a/v3/@claude-flow/cli/src/mcp-tools/ruvllm-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/ruvllm-tools.ts
index 99c7d4a3f9..08dfa6a3bc 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/ruvllm-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/ruvllm-tools.ts
@@ -64,7 +64,7 @@ export const ruvllmWasmTools: MCPTool[] = [
properties: {
routerId: { type: 'string', description: 'HNSW router ID from ruvllm_hnsw_create' },
name: { type: 'string', description: 'Pattern name/label' },
- embedding: { type: 'array', description: 'Float array embedding vector' },
+ embedding: { type: 'array', items: { type: 'number' }, description: 'Float array embedding vector' },
metadata: { type: 'object', description: 'Optional metadata object' },
},
required: ['routerId', 'name', 'embedding'],
@@ -92,7 +92,7 @@ export const ruvllmWasmTools: MCPTool[] = [
type: 'object' as const,
properties: {
routerId: { type: 'string', description: 'HNSW router ID' },
- query: { type: 'array', description: 'Query embedding vector' },
+ query: { type: 'array', items: { type: 'number' }, description: 'Query embedding vector' },
k: { type: 'number', description: 'Number of nearest neighbors (default: 3)' },
},
required: ['routerId', 'query'],
@@ -224,6 +224,7 @@ export const ruvllmWasmTools: MCPTool[] = [
properties: {
messages: {
type: 'array',
+ items: { type: 'object', properties: { role: { type: 'string' }, content: { type: 'string' } }, required: ['role', 'content'] },
description: 'Array of {role, content} message objects',
},
template: { type: 'string', description: 'Template preset (llama3, mistral, chatml, phi, gemma) or model ID for auto-detection' },
@@ -259,7 +260,7 @@ export const ruvllmWasmTools: MCPTool[] = [
topP: { type: 'number', description: 'Top-p sampling' },
topK: { type: 'number', description: 'Top-k sampling' },
repetitionPenalty: { type: 'number', description: 'Repetition penalty' },
- stopSequences: { type: 'array', description: 'Stop sequences' },
+ stopSequences: { type: 'array', items: { type: 'string' }, description: 'Stop sequences' },
},
},
handler: async (args: Record<string, unknown>) => {
diff --git a/v3/@claude-flow/cli/src/parser.ts b/v3/@claude-flow/cli/src/parser.ts
index dcd9733049..79ac17abb3 100644
--- a/v3/@claude-flow/cli/src/parser.ts
+++ b/v3/@claude-flow/cli/src/parser.ts
@@ -75,7 +75,9 @@ export class CommandParser {
},
{
name: 'format',
- short: 'f',
+ // Note: removed global short flag 'f' β€” it collides with 50+ subcommand
+ // flags (force, follow, file, feature, full) causing unpredictable behavior
+ // depending on parser resolution order (#1425). Use --format instead.
description: 'Output format (text, json, table)',
type: 'string',
default: 'text',
diff --git a/v3/@claude-flow/cli/src/services/headless-worker-executor.ts b/v3/@claude-flow/cli/src/services/headless-worker-executor.ts
index 2eccf8c594..ee61910c1a 100644
--- a/v3/@claude-flow/cli/src/services/headless-worker-executor.ts
+++ b/v3/@claude-flow/cli/src/services/headless-worker-executor.ts
@@ -270,10 +270,18 @@ export const LOCAL_WORKER_TYPES: LocalWorkerType[] = [
/**
* Model ID mapping
*/
+/**
+ * Model ID mapping β€” use short aliases so they auto-resolve to the latest
+ * snapshot. Hardcoded dated IDs (e.g. claude-sonnet-4-5-20250929) go stale
+ * when Anthropic retires them, causing 100% worker failure (#1431).
+ *
+ * Users can override per-worker via the `model` field in daemon-state.json
+ * or the ANTHROPIC_MODEL environment variable.
+ */
const MODEL_IDS: Record<ModelType, string> = {
- sonnet: 'claude-sonnet-4-5-20250929',
- opus: 'claude-opus-4-6',
- haiku: 'claude-haiku-4-5-20251001',
+ sonnet: 'sonnet',
+ opus: 'opus',
+ haiku: 'haiku',
};
/**
@@ -761,6 +769,10 @@ export class HeadlessWorkerExecutor extends EventEmitter {
for (const [executionId, entry] of entries) {
clearTimeout(entry.timeout);
entry.process.kill('SIGTERM');
+ // SIGKILL fallback after 5s to prevent orphan processes (#1395 Bug 6)
+ setTimeout(() => {
+ try { if (!entry.process.killed) entry.process.kill('SIGKILL'); } catch { /* already dead */ }
+ }, 5000).unref();
this.emit('cancelled', { executionId });
cancelled++;
}
@@ -1116,16 +1128,25 @@ Analyze the above codebase context and provide your response following the forma
...(process.env as Record<string, string>),
CLAUDE_CODE_HEADLESS: 'true',
CLAUDE_CODE_SANDBOX_MODE: options.sandbox,
+ // Fix #1395 Bug 2: Workers fail inside active Claude Code session.
+ // Claude Code detects nested sessions and exits immediately.
+ // Setting CLAUDE_ENTRYPOINT=worker bypasses the nested-session check,
+ // and unsetting CLAUDE_SESSION_ID prevents parent session detection.
+ CLAUDE_ENTRYPOINT: 'worker',
};
+ // Remove parent session markers so the child doesn't detect a "nested" session
+ delete env.CLAUDE_SESSION_ID;
+ delete env.CLAUDE_PARENT_SESSION_ID;
// Set model
- env.ANTHROPIC_MODEL = MODEL_IDS[options.model];
+ // Resolve model: user env override > config override > default alias
+ env.ANTHROPIC_MODEL = process.env.ANTHROPIC_MODEL || MODEL_IDS[options.model];
// Spawn claude CLI process
const child = spawn('claude', ['--print', prompt], {
cwd: this.projectRoot,
env,
- stdio: ['pipe', 'pipe', 'pipe'],
+ stdio: ['ignore', 'pipe', 'pipe'], // 'ignore' closes stdin at spawn β€” fixes #1395 where claude --print blocks on EOF
windowsHide: true, // Prevent phantom console windows on Windows
});
diff --git a/v3/@claude-flow/cli/src/services/worker-daemon.ts b/v3/@claude-flow/cli/src/services/worker-daemon.ts
index 05a68e008d..75e74b06ca 100644
--- a/v3/@claude-flow/cli/src/services/worker-daemon.ts
+++ b/v3/@claude-flow/cli/src/services/worker-daemon.ts
@@ -11,7 +11,7 @@
*/
import { EventEmitter } from 'events';
-import { existsSync, mkdirSync, writeFileSync, readFileSync, appendFileSync } from 'fs';
+import { existsSync, mkdirSync, writeFileSync, readFileSync, appendFileSync, unlinkSync } from 'fs';
import { cpus } from 'os';
import { join } from 'path';
import {
@@ -278,7 +278,15 @@ export class WorkerDaemon extends EventEmitter {
minFreeMemoryPercent?: number;
} {
const configPath = join(claudeFlowDir, 'config.json');
- if (!existsSync(configPath)) return {};
+ if (!existsSync(configPath)) {
+ // Warn if config.yaml exists but config.json does not (#1395 Bug 4)
+ const yamlPath = join(claudeFlowDir, 'config.yaml');
+ const ymlPath = join(claudeFlowDir, 'config.yml');
+ if (existsSync(yamlPath) || existsSync(ymlPath)) {
+ this.log('warn', `Found ${existsSync(yamlPath) ? 'config.yaml' : 'config.yml'} but daemon reads only config.json β€” YAML config is being ignored. Convert to JSON or create config.json.`);
+ }
+ return {};
+ }
try {
const raw = JSON.parse(readFileSync(configPath, 'utf-8'));
// Support both flat keys at root and nested under scopes.project
@@ -433,6 +441,48 @@ export class WorkerDaemon extends EventEmitter {
}
}
+ /**
+ * Get the PID file path for singleton enforcement (#1395 Bug 3).
+ */
+ private get pidFile(): string {
+ return join(this.projectRoot, '.claude-flow', 'daemon.pid');
+ }
+
+ /**
+ * Check if another daemon instance is already running.
+ * Returns the existing PID if alive, or null if no daemon is running.
+ */
+ private checkExistingDaemon(): number | null {
+ if (!existsSync(this.pidFile)) return null;
+ try {
+ const pid = parseInt(readFileSync(this.pidFile, 'utf-8').trim(), 10);
+ if (isNaN(pid)) return null;
+ // Check if process is alive (signal 0 = existence check)
+ process.kill(pid, 0);
+ return pid; // Process is alive
+ } catch {
+ // Process is dead β€” clean up stale PID file
+ try { unlinkSync(this.pidFile); } catch { /* ignore */ }
+ return null;
+ }
+ }
+
+ /**
+ * Write PID file for singleton enforcement.
+ */
+ private writePidFile(): void {
+ const dir = join(this.projectRoot, '.claude-flow');
+ if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
+ writeFileSync(this.pidFile, String(process.pid), 'utf-8');
+ }
+
+ /**
+ * Remove PID file on shutdown.
+ */
+ private removePidFile(): void {
+ try { unlinkSync(this.pidFile); } catch { /* ignore */ }
+ }
+
/**
* Start the daemon and all enabled workers
*/
@@ -442,8 +492,17 @@ export class WorkerDaemon extends EventEmitter {
return;
}
+ // PID singleton enforcement (#1395 Bug 3): prevent daemon accumulation
+ const existingPid = this.checkExistingDaemon();
+ if (existingPid !== null) {
+ this.log('info', `Daemon already running (PID: ${existingPid}), skipping start`);
+ this.emit('warning', `Daemon already running (PID: ${existingPid})`);
+ return;
+ }
+
this.running = true;
this.startedAt = new Date();
+ this.writePidFile();
this.emit('started', { pid: process.pid, startedAt: this.startedAt });
// Schedule all enabled workers
@@ -477,6 +536,7 @@ export class WorkerDaemon extends EventEmitter {
this.timers.clear();
this.running = false;
+ this.removePidFile();
this.saveState();
this.emit('stopped', { stoppedAt: new Date() });
this.log('info', 'Daemon stopped');
diff --git a/v3/implementation/adrs/ADR-067-critical-issue-remediation-v3543.md b/v3/implementation/adrs/ADR-067-critical-issue-remediation-v3543.md
new file mode 100644
index 0000000000..302a753e76
--- /dev/null
+++ b/v3/implementation/adrs/ADR-067-critical-issue-remediation-v3543.md
@@ -0,0 +1,210 @@
+---
+# ADR-067: Critical Issue Remediation β€” v3.5.43
+---
+
+**Status**: Implemented
+**Date**: 2026-03-25
+**Author**: RuvNet
+**Version**: v3.5.42 β†’ v3.5.43
+**Tracking**: GitHub Issues #1395, #1423, #1425, #1428, #1431, #1399, #1404, #1422
+
+## Context
+
+Community-reported issues have identified 6 critical/high-severity bugs and 2 moderate issues in v3.5.42 that collectively degrade core functionality β€” swarm execution, headless workers, memory initialization, AgentDB bridge, MCP schema validation, and hive-mind tool routing. Multiple reporters confirm that the swarm orchestration engine registers agents but never dispatches work, headless workers fail 100% of the time, and accumulated daemon processes can cause kernel panic on macOS.
+
+This ADR documents all findings, root causes, and the remediation plan for v3.5.43.
+
+## Issue Summary
+
+| Priority | Issue | GitHub | Root Cause |
+|----------|-------|--------|------------|
+| **P0 β€” Critical** | Headless workers hang forever (stdin never closed) | #1395 (Bug 1) | `stdio: ['pipe','pipe','pipe']` β€” stdin opened but never closed; `claude --print` blocks on EOF |
+| **P0 β€” Critical** | Workers fail inside active Claude Code session | #1395 (Bug 2) | Nested session detection kills subprocess; workers can never succeed during normal use |
+| **P0 β€” Critical** | Swarm agents do not execute work | #1423, #1425 | `startSwarm()` updates metadata but has no task consumer/dispatcher; commands return hardcoded success |
+| **P1 β€” High** | Stale/nonexistent model IDs in daemon workers | #1431 | Hardcoded `claude-sonnet-4-5-20250929` and `claude-haiku-4-5-20251001` β€” both expired/invalid |
+| **P1 β€” High** | Daemons never terminate, accumulate across sessions | #1395 (Bug 3) | No PID singleton enforcement; each session spawns a new daemon |
+| **P1 β€” High** | `memory init` hangs after completion | #1428 | ONNX worker threads + SQLite connection never terminated; no `process.exit()` after init |
+| **P2 β€” Medium** | AgentDB bridge unavailable | #1399 | CLI bundles `@claude-flow/[email protected]` (missing `ControllerRegistry`); runtime patch targets v1.x paths |
+| **P2 β€” Medium** | MCP array schema missing `items` | #1404 | `type: 'array'` without `items` in ruvllm-tools.ts β€” invalid JSON Schema, breaks VSCode Copilot |
+| **P2 β€” Medium** | Hive-mind uses native tools instead of MCP | #1422 | No tool preference enforcement; Claude defaults to native tools over Ruflo MCP |
+
+## Decision
+
+Address all issues in a single v3.5.43 release, prioritized by severity and dependency order.
+
+### Phase 1: Headless Worker Lifecycle (P0) β€” #1395, #1431
+
+**1.1 β€” Fix stdin pipe (one-line change)**
+
+File: `v3/@claude-flow/cli/src/daemon/headless-worker-executor.ts`
+
+```diff
+- stdio: ['pipe', 'pipe', 'pipe']
++ stdio: ['ignore', 'pipe', 'pipe']
+```
+
+Rationale: `'ignore'` closes stdin at spawn, allowing `--print` mode to proceed immediately. This unblocks all headless worker functionality.
+
+**1.2 β€” Fix nested session detection**
+
+Options (choose one):
+- **A (Preferred)**: Set `CLAUDE_CODE_WORKER=1` env var on spawned processes; patch Claude Code session check to allow workers
+- **B**: Use Anthropic SDK directly for LLM calls in workers, bypassing `claude --print` entirely
+- **C (Minimum)**: Disable `optimize`/`testgaps` workers by default; document limitation
+
+**1.3 β€” Update model IDs to aliases**
+
+File: `v3/@claude-flow/cli/src/daemon/headless-worker-executor.ts`
+
+```diff
+ const MODEL_IDS = {
+- sonnet: 'claude-sonnet-4-5-20250929',
+- opus: 'claude-opus-4-6',
+- haiku: 'claude-haiku-4-5-20251001',
++ sonnet: 'sonnet',
++ opus: 'opus',
++ haiku: 'haiku',
+ };
+```
+
+Rationale: Model aliases auto-resolve to the latest version, preventing future staleness. Additionally, add a `model` field to `daemon-state.json` worker config for user overrides.
+
+**1.4 β€” PID singleton enforcement for daemon**
+
+Implement standard PID-file pattern:
+1. On `daemon start`, check `$PROJECT/.claude-flow/daemon.pid`
+2. If recorded PID is alive (`kill -0`), skip start
+3. If dead, clean PID file and start fresh
+4. Write PID on start; delete on clean exit and SIGTERM/SIGINT handlers
+
+**1.5 β€” Fix orphan process cleanup**
+
+When wrapper timeout fires, send `SIGTERM` to the child process group (not just reject the promise). Align wrapper timeout to `executor_timeout + 60s`.
+
+### Phase 2: Swarm Execution Engine (P0) β€” #1423, #1425
+
+**2.1 β€” Implement task dispatcher**
+
+The core gap: `startSwarm()` in `swarm.ts` registers agents and updates metadata but has no execution loop. Commands like `swarm start`, `swarm coordinate`, and task operations return hardcoded responses.
+
+Remediation:
+1. Add `TaskDispatcher` class that polls task queue and dispatches to agent workers
+2. Replace hardcoded response stubs with actual process spawning via `claude --print` or SDK calls
+3. Add execution status tracking with real agent state (not hardcoded `"active"`)
+
+**2.2 β€” Remove hardcoded stubs**
+
+Audit all commands in `swarm.ts` and `deployment.ts` for stub responses. Either:
+- Implement the actual functionality
+- Return honest error: `"Not yet implemented"` with a link to the tracking issue
+
+**2.3 β€” Dynamic agent count**
+
+File: `v3/@claude-flow/cli/src/commands/swarm.ts` (line ~645)
+
+Replace hardcoded 8-agent count with dynamic fetch from swarm state.
+
+### Phase 3: Memory & AgentDB (P1–P2) β€” #1428, #1399
+
+**3.1 β€” Fix memory init hang**
+
+File: `v3/@claude-flow/cli/src/commands/memory.ts` (init handler)
+
+1. Call `ort.env.close()` or terminate ONNX inference sessions after init
+2. Close SQLite connection explicitly
+3. Add `process.exit(0)` as final fallback after cleanup
+4. Fix double ONNX model loading (model initialized twice in one init call)
+
+**3.2 β€” Fix AgentDB bridge**
+
+1. Update `@claude-flow/cli` dependency on `@claude-flow/memory` to `>=3.0.0-alpha.12`
+2. Fix `agentdb-runtime-patch.js` path: `dist/controllers/index.js` β†’ `dist/src/controllers/index.js`
+3. Fix CJS wrapper self-reference: `require('./controllers/index.js')` β†’ `require('./index.js')`
+
+**3.3 β€” Fix memory store/search**
+
+1. Remove text ID generation β€” use SQLite integer autoincrement
+2. Change hardcoded vector dimension 1536 β†’ 384 (match `all-MiniLM-L6-v2` output), or detect at runtime
+
+### Phase 4: MCP & Tool Routing (P2) β€” #1404, #1422
+
+**4.1 β€” Add missing `items` to array schemas**
+
+Files: `ruvllm-tools.ts`, `process-manager-tools.ts`, and all other MCP tool definitions.
+
+Audit all `type: 'array'` properties and add appropriate `items` schema. This is partially addressed in PR #73 (ruflo repo).
+
+**4.2 β€” Enforce Ruflo MCP tool preference in hive-mind**
+
+Options:
+- **A**: Add `--allowedTools` constraint when spawning hive-mind sessions to prefer Ruflo MCP tools
+- **B**: Add system prompt injection that instructs Claude to use Ruflo MCP tools for orchestration
+- **C**: Document expected behavior and provide configuration guidance
+
+### Phase 5: Code Quality (from #1425 audit)
+
+**5.1 β€” config.yaml support**
+
+Daemon currently reads only `config.json`. Add YAML fallback or emit warning when `config.yaml` exists without `config.json`.
+
+**5.2 β€” Parser flag collision**
+
+`-f` flag used by 50+ subcommands. Audit `parser.ts` for resolution order issues. Consider namespacing or removing the global `-f` shorthand.
+
+## Consequences
+
+### Positive
+- Headless workers become functional (currently 0% success rate β†’ expected >95%)
+- Daemon process accumulation eliminated (prevents kernel panic scenario)
+- Memory init completes cleanly without hang
+- AgentDB bridge becomes available for pattern search/hierarchical recall
+- MCP tools work with strict schema validators (VSCode Copilot)
+- Swarm execution moves from stub to functional (long-term, Phase 2 is largest effort)
+
+### Negative
+- Phase 2 (swarm execution) is a significant implementation effort; may require multiple PRs
+- Model alias change could affect users who depend on specific dated model snapshots
+- Breaking change if removing text IDs from memory store (existing data migration needed)
+
+### Risks
+- Phase 2 scope may expand β€” the #1425 audit identified additional stubs in `deployment.ts`, `config` commands, and `providers` commands
+- AgentDB bridge fix depends on publishing new package versions to npm
+
+## Implementation Order
+
+```
+Phase 1.1 (stdin fix) ← trivial, unblocks all workers
+Phase 1.3 (model IDs) ← trivial, unblocks daemon success
+Phase 1.4 (PID singleton) ← low effort, prevents accumulation
+Phase 1.5 (orphan cleanup) ← low effort
+Phase 3.1 (memory init hang) ← medium effort
+Phase 4.1 (MCP schema) ← low effort, partially done in PR #73
+Phase 1.2 (nested session) ← medium effort, design decision needed
+Phase 3.2 (AgentDB bridge) ← medium effort, requires npm publish
+Phase 3.3 (memory ID/dims) ← medium effort
+Phase 4.2 (tool preference) ← medium effort, design decision needed
+Phase 2.x (swarm execution) ← high effort, core architecture work
+Phase 5.x (code quality) ← ongoing
+```
+
+## Verification
+
+Each phase must pass:
+1. Unit tests for changed code paths
+2. Integration test: `npx ruflo daemon start` β†’ workers execute successfully
+3. Integration test: `npx ruflo memory init` β†’ process exits cleanly
+4. Integration test: `agentdb_health` returns `available: true`
+5. Schema validation: all MCP tools pass strict JSON Schema validation
+6. Stress test: 8 projects with daemons running β€” no process accumulation after 1 hour
+
+## References
+
+- #1395 β€” Workers fail + daemons don't terminate (scottkmcmillan)
+- #1423 β€” Swarm agents don't execute (tim-bly)
+- #1425 β€” Comprehensive audit (AvasDream)
+- #1428 β€” Memory init hangs (marioja)
+- #1431 β€” Stale model IDs (roman-rr)
+- #1399 β€” AgentDB bridge unavailable (BIWizzard)
+- #1404 β€” MCP schema validation (orelcain)
+- #1422 β€” Hive-mind tool routing (tim-bly)
+- ADR-066 β€” Prior audit remediation (v3.5.24)
diff --git a/v3/plugins/healthcare-clinical/src/mcp-tools.ts b/v3/plugins/healthcare-clinical/src/mcp-tools.ts
index ec4939b0ea..1756050ceb 100644
--- a/v3/plugins/healthcare-clinical/src/mcp-tools.ts
+++ b/v3/plugins/healthcare-clinical/src/mcp-tools.ts
@@ -13,6 +13,7 @@ import type {
MCPTool,
MCPToolResult,
ToolContext,
+ HealthcareRole,
PatientSimilarityResult,
DrugInteractionsResult,
ClinicalPathwayResult,
@@ -52,7 +53,9 @@ function checkAuthorization(toolName: string, context?: ToolContext): boolean {
if (!context?.userRoles) return true; // No roles = no RBAC enforcement
for (const role of context.userRoles) {
- const permissions = HealthcareRolePermissions[role];
+ // Normalize role to uppercase to match HealthcareRolePermissions keys
+ const normalizedRole = role.toUpperCase() as HealthcareRole;
+ const permissions = HealthcareRolePermissions[normalizedRole];
if (permissions?.includes(toolName)) return true;
}
diff --git a/v3/plugins/healthcare-clinical/src/types.ts b/v3/plugins/healthcare-clinical/src/types.ts
index 687386fb1c..ebd3424a08 100644
--- a/v3/plugins/healthcare-clinical/src/types.ts
+++ b/v3/plugins/healthcare-clinical/src/types.ts
@@ -35,9 +35,8 @@ export interface MCPTool {
* MCP Tool result
*/
export interface MCPToolResult {
- success: boolean;
- data?: unknown;
- error?: string;
+ isError?: boolean;
+ content: Array<{ type: 'text'; text: string }>;
metadata?: {
durationMs?: number;
cached?: boolean;
@@ -591,7 +590,7 @@ export const LiteratureSearchInputSchema = z.object({
export const OntologyNavigationInputSchema = z.object({
code: z.string().max(50),
ontology: z.enum(['icd10', 'snomed', 'loinc', 'rxnorm']),
- direction: z.enum(['ancestors', 'descendants', 'siblings', 'related']),
+ direction: z.enum(['ancestors', 'descendants', 'siblings', 'related']).default('descendants'),
depth: z.number().int().min(1).max(10).default(2),
});
@@ -604,8 +603,7 @@ export const OntologyNavigationInputSchema = z.object({
*/
export function successResult<T>(data: T, metadata?: MCPToolResult['metadata']): MCPToolResult {
return {
- success: true,
- data,
+ content: [{ type: 'text', text: JSON.stringify(data) }],
metadata,
};
}
@@ -614,9 +612,10 @@ export function successResult<T>(data: T, metadata?: MCPToolResult['metadata']):
* Create an error result
*/
export function errorResult(error: string | Error, metadata?: MCPToolResult['metadata']): MCPToolResult {
+ const message = error instanceof Error ? error.message : error;
return {
- success: false,
- error: error instanceof Error ? error.message : error,
+ isError: true,
+ content: [{ type: 'text', text: JSON.stringify({ error: message, timestamp: new Date().toISOString() }) }],
metadata,
};
}
diff --git a/v3/plugins/healthcare-clinical/tests/mcp-tools.test.ts b/v3/plugins/healthcare-clinical/tests/mcp-tools.test.ts
index 2321d538e9..7129f0ce34 100644
--- a/v3/plugins/healthcare-clinical/tests/mcp-tools.test.ts
+++ b/v3/plugins/healthcare-clinical/tests/mcp-tools.test.ts
@@ -54,8 +54,42 @@ vi.mock('../src/bridges/gnn-bridge.js', () => ({
})),
}));
+// Mock bridges for context injection
+const createMockHNSWBridge = () => ({
+ initialized: true,
+ initialize: vi.fn().mockResolvedValue(undefined),
+ searchByFeatures: vi.fn().mockResolvedValue([
+ { patientId: 'p-001', similarity: 0.92, features: {} },
+ { patientId: 'p-002', similarity: 0.85, features: {} },
+ ]),
+ count: vi.fn().mockResolvedValue(1000),
+});
+
+const createMockGNNBridge = () => ({
+ initialized: true,
+ initialize: vi.fn().mockResolvedValue(undefined),
+ checkDrugInteractions: vi.fn().mockReturnValue([
+ {
+ drug1: 'aspirin',
+ drug2: 'warfarin',
+ severity: 'major',
+ description: 'Increased bleeding risk',
+ mechanism: 'Antiplatelet + anticoagulant',
+ management: 'Monitor closely',
+ },
+ ]),
+ getClinicalPathway: vi.fn().mockReturnValue({
+ id: 'pathway-1',
+ name: 'Type 2 Diabetes Management',
+ steps: [
+ { name: 'Initial Assessment', type: 'assessment', description: 'Complete patient assessment' },
+ { name: 'Metformin', type: 'intervention', description: 'Start metformin therapy' },
+ ],
+ }),
+});
+
// Mock context for testing
-const createMockContext = (overrides = {}) => ({
+const createMockContext = (overrides: Record<string, unknown> = {}) => ({
logger: {
debug: vi.fn(),
info: vi.fn(),
@@ -67,6 +101,10 @@ const createMockContext = (overrides = {}) => ({
auditLogger: {
log: vi.fn().mockResolvedValue(undefined),
},
+ bridge: {
+ hnsw: createMockHNSWBridge(),
+ gnn: createMockGNNBridge(),
+ },
...overrides,
});