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

Security fixes, backward compatibility, and Agent Teams hooks

rUv099902a4db8e
diff --git a/.claude/helpers/hook-handler.cjs b/.claude/helpers/hook-handler.cjs
index 860ef2f1c4..22d01b244b 100644
--- a/.claude/helpers/hook-handler.cjs
+++ b/.claude/helpers/hook-handler.cjs
@@ -30,9 +30,9 @@ function safeRequire(modulePath) {
return null;
}
-const router = safeRequire(path.join(helpersDir, 'router.js'));
-const session = safeRequire(path.join(helpersDir, 'session.js'));
-const memory = safeRequire(path.join(helpersDir, 'memory.js'));
+const router = safeRequire(path.join(helpersDir, 'router.cjs'));
+const session = safeRequire(path.join(helpersDir, 'session.cjs'));
+const memory = safeRequire(path.join(helpersDir, 'memory.cjs'));
const intelligence = safeRequire(path.join(helpersDir, 'intelligence.cjs'));
const [,, command, ...args] = process.argv;
diff --git a/.claude/helpers/memory.js b/.claude/helpers/memory.cjs
similarity index 82%
rename from .claude/helpers/memory.js
rename to .claude/helpers/memory.cjs
index 7bd7dfbca9..467fde3f2f 100644
--- a/.claude/helpers/memory.js
+++ b/.claude/helpers/memory.cjs
@@ -70,14 +70,15 @@ const commands = {
},
};
-// CLI
-const [,, command, key, ...valueParts] = process.argv;
-const value = valueParts.join(' ');
+module.exports = commands;
-if (command && commands[command]) {
- commands[command](key, value);
-} else {
- console.log('Usage: memory.js <get|set|delete|clear|keys> [key] [value]');
+// CLI - only run when executed directly
+if (require.main === module) {
+ const [,, command, key, ...valueParts] = process.argv;
+ const value = valueParts.join(' ');
+ if (command && commands[command]) {
+ commands[command](key, value);
+ } else {
+ console.log('Usage: memory.js <get|set|delete|clear|keys> [key] [value]');
+ }
}
-
-module.exports = commands;
diff --git a/.claude/helpers/router.js b/.claude/helpers/router.cjs
similarity index 82%
rename from .claude/helpers/router.js
rename to .claude/helpers/router.cjs
index 4161cd0c28..816bba20e2 100644
--- a/.claude/helpers/router.js
+++ b/.claude/helpers/router.cjs
@@ -47,15 +47,16 @@ function routeTask(task) {
};
}
-// CLI
-const task = process.argv.slice(2).join(' ');
+module.exports = { routeTask, AGENT_CAPABILITIES, TASK_PATTERNS };
-if (task) {
- const result = routeTask(task);
- console.log(JSON.stringify(result, null, 2));
-} else {
- console.log('Usage: router.js <task description>');
- console.log('\nAvailable agents:', Object.keys(AGENT_CAPABILITIES).join(', '));
+// CLI - only run when executed directly
+if (require.main === module) {
+ const task = process.argv.slice(2).join(' ');
+ if (task) {
+ const result = routeTask(task);
+ console.log(JSON.stringify(result, null, 2));
+ } else {
+ console.log('Usage: router.js <task description>');
+ console.log('\nAvailable agents:', Object.keys(AGENT_CAPABILITIES).join(', '));
+ }
}
-
-module.exports = { routeTask, AGENT_CAPABILITIES, TASK_PATTERNS };
diff --git a/.claude/helpers/session.js b/.claude/helpers/session.cjs
similarity index 90%
rename from .claude/helpers/session.js
rename to .claude/helpers/session.cjs
index 4c1b458e6b..8c21959d04 100644
--- a/.claude/helpers/session.js
+++ b/.claude/helpers/session.cjs
@@ -110,14 +110,16 @@ const commands = {
}
};
-// CLI
-const [,, command, ...args] = process.argv;
-if (command && commands[command]) {
- commands[command](...args);
-} else {
- console.log('Usage: session.js <start|restore|end|status|metric>');
- console.log(`Platform: ${platform}`);
- console.log(`Data dir: ${SESSION_DIR}`);
-}
-
module.exports = commands;
+
+// CLI - only run when executed directly
+if (require.main === module) {
+ const [,, command, ...args] = process.argv;
+ if (command && commands[command]) {
+ commands[command](...args);
+ } else {
+ console.log('Usage: session.js <start|restore|end|status|metric>');
+ console.log(`Platform: ${platform}`);
+ console.log(`Data dir: ${SESSION_DIR}`);
+ }
+}
diff --git a/package.json b/package.json
index 319d3a7b66..15ed5bb305 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "claude-flow",
- "version": "3.1.0-alpha.32",
+ "version": "3.1.0-alpha.34",
"description": "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",
@@ -65,9 +65,8 @@
"@ruvector/router": "^0.1.27",
"@ruvector/router-linux-x64-gnu": "^0.1.27",
"@ruvector/sona": "^0.1.5",
- "agentdb": "2.0.0-alpha.3.4",
- "agentic-flow": "^2.0.1-alpha.80",
- "bcrypt": "^5.1.1"
+ "agentdb": "2.0.0-alpha.3.5",
+ "agentic-flow": "^2.0.1-alpha.80"
},
"overrides": {
"hono": ">=4.11.4"
diff --git a/v3/@claude-flow/cli/package.json b/v3/@claude-flow/cli/package.json
index 3806c0ca4f..10d015e893 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.1.0-alpha.32",
+ "version": "3.1.0-alpha.34",
"type": "module",
"description": "Claude Flow 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/hooks.ts b/v3/@claude-flow/cli/src/commands/hooks.ts
index 08bbce8f37..b38f0bf7d2 100644
--- a/v3/@claude-flow/cli/src/commands/hooks.ts
+++ b/v3/@claude-flow/cli/src/commands/hooks.ts
@@ -58,14 +58,10 @@ const preEditCommand: Command = {
{ command: 'claude-flow hooks pre-edit -f src/api.ts -o refactor', description: 'Pre-edit with operation type' }
],
action: async (ctx: CommandContext): Promise<CommandResult> => {
- const filePath = ctx.args[0] || ctx.flags.file as string;
+ // Default file to 'unknown' for backward compatibility (env var may be empty)
+ const filePath = ctx.args[0] || ctx.flags.file as string || 'unknown';
const operation = ctx.flags.operation as string || 'update';
- if (!filePath) {
- output.printError('File path is required. Use --file or -f flag.');
- return { success: false, exitCode: 1 };
- }
-
output.printInfo(`Analyzing context for: ${output.highlight(filePath)}`);
try {
@@ -191,18 +187,10 @@ const postEditCommand: Command = {
{ command: 'claude-flow hooks post-edit -f src/api.ts --success false -o "Type error"', description: 'Record failed edit' }
],
action: async (ctx: CommandContext): Promise<CommandResult> => {
- const filePath = ctx.args[0] || ctx.flags.file as string;
- const success = ctx.flags.success as boolean;
-
- if (!filePath) {
- output.printError('File path is required. Use --file or -f flag.');
- return { success: false, exitCode: 1 };
- }
-
- if (success === undefined) {
- output.printError('Success flag is required. Use --success true/false.');
- return { success: false, exitCode: 1 };
- }
+ // Default file to 'unknown' for backward compatibility (env var may be empty)
+ const filePath = ctx.args[0] || ctx.flags.file as string || 'unknown';
+ // Default success to true for backward compatibility (PostToolUse = success, PostToolUseFailure = failure)
+ const success = ctx.flags.success !== undefined ? (ctx.flags.success as boolean) : true;
output.printInfo(`Recording outcome for: ${output.highlight(filePath)}`);
@@ -429,18 +417,14 @@ const postCommandCommand: Command = {
],
action: async (ctx: CommandContext): Promise<CommandResult> => {
const command = ctx.args[0] || ctx.flags.command as string;
- const success = ctx.flags.success as boolean;
+ // Default success to true for backward compatibility
+ const success = ctx.flags.success !== undefined ? (ctx.flags.success as boolean) : true;
if (!command) {
output.printError('Command is required. Use --command or -c flag.');
return { success: false, exitCode: 1 };
}
- if (success === undefined) {
- output.printError('Success flag is required. Use --success true/false.');
- return { success: false, exitCode: 1 };
- }
-
output.printInfo(`Recording command outcome: ${output.highlight(command)}`);
try {
@@ -1641,12 +1625,8 @@ const postTaskCommand: Command = {
action: async (ctx: CommandContext): Promise<CommandResult> => {
// Auto-generate task ID if not provided
const taskId = (ctx.flags.taskId as string) || `task_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
- const success = ctx.flags.success as boolean;
-
- if (success === undefined) {
- output.printError('Success flag is required. Use --success true/false.');
- return { success: false, exitCode: 1 };
- }
+ // Default success to true for backward compatibility
+ const success = ctx.flags.success !== undefined ? (ctx.flags.success as boolean) : true;
output.printInfo(`Recording outcome for task: ${output.highlight(taskId)}`);
diff --git a/v3/@claude-flow/cli/src/init/settings-generator.ts b/v3/@claude-flow/cli/src/init/settings-generator.ts
index 111d8ef087..efdbeeffe7 100644
--- a/v3/@claude-flow/cli/src/init/settings-generator.ts
+++ b/v3/@claude-flow/cli/src/init/settings-generator.ts
@@ -325,6 +325,32 @@ function generateHooksConfig(config: HooksConfig): object {
},
];
+ // TeammateIdle — auto-assign pending tasks to idle teammates
+ hooks.TeammateIdle = [
+ {
+ hooks: [
+ {
+ type: 'command',
+ command: 'node .claude/helpers/hook-handler.cjs post-task',
+ timeout: 5000,
+ },
+ ],
+ },
+ ];
+
+ // TaskCompleted — train patterns and record completion
+ hooks.TaskCompleted = [
+ {
+ hooks: [
+ {
+ type: 'command',
+ command: 'node .claude/helpers/hook-handler.cjs post-task',
+ timeout: 5000,
+ },
+ ],
+ },
+ ];
+
return hooks;
}
diff --git a/v3/@claude-flow/memory/package.json b/v3/@claude-flow/memory/package.json
index abb1740f52..b9e21f7433 100644
--- a/v3/@claude-flow/memory/package.json
+++ b/v3/@claude-flow/memory/package.json
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/memory",
- "version": "3.0.0-alpha.8",
+ "version": "3.0.0-alpha.9",
"type": "module",
"description": "Memory module - AgentDB unification, HNSW indexing, vector search, hybrid SQLite+AgentDB backend (ADR-009)",
"main": "dist/index.js",
@@ -15,7 +15,7 @@
"build": "tsc"
},
"dependencies": {
- "agentdb": "alpha",
+ "agentdb": "2.0.0-alpha.3.5",
"sql.js": "^1.10.3"
},
"optionalDependencies": {