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

v1.0.50

rUv04f665bc7330
diff --git a/src/cli/simple-commands/swarm.js b/src/cli/simple-commands/swarm.js
index eb709deb2e..468bc58943 100644
--- a/src/cli/simple-commands/swarm.js
+++ b/src/cli/simple-commands/swarm.js
@@ -251,7 +251,9 @@ Please coordinate this swarm task by:
Use all available tools including file operations, web search, and code execution as needed.`;
- // Execute Claude with the swarm prompt
+ // Execute Claude non-interactively by piping the prompt
+ const { spawn } = await import('child_process');
+
const claudeArgs = [];
// Add auto-permission flag if requested
@@ -259,14 +261,29 @@ Use all available tools including file operations, web search, and code executio
claudeArgs.push('--dangerously-skip-permissions');
}
- // Build the command - pass the prompt as the last argument
- const promptEscaped = swarmPrompt.replace(/"/g, '\\"').replace(/\$/g, '\\$').replace(/`/g, '\\`');
- const command = `claude ${claudeArgs.join(' ')} "${promptEscaped}"`;
+ // Spawn claude process
+ const claudeProcess = spawn('claude', claudeArgs, {
+ stdio: ['pipe', 'inherit', 'inherit'],
+ shell: false
+ });
+
+ // Write the prompt to stdin and close it
+ claudeProcess.stdin.write(swarmPrompt);
+ claudeProcess.stdin.end();
- // Execute with stdio inherit to see output in real-time
- execSync(command, {
- stdio: 'inherit',
- shell: true
+ // Wait for the process to complete
+ await new Promise((resolve, reject) => {
+ claudeProcess.on('close', (code) => {
+ if (code === 0) {
+ resolve();
+ } else {
+ reject(new Error(`Claude process exited with code ${code}`));
+ }
+ });
+
+ claudeProcess.on('error', (err) => {
+ reject(err);
+ });
});
} catch (error) {
diff --git a/src/cli/swarm-standalone.js b/src/cli/swarm-standalone.js
index f09a91f8aa..81d715ad30 100644
--- a/src/cli/swarm-standalone.js
+++ b/src/cli/swarm-standalone.js
@@ -163,7 +163,9 @@ Please coordinate this swarm task by:
Use all available tools including file operations, web search, and code execution as needed.`;
- // Execute Claude with the swarm prompt
+ // Execute Claude non-interactively by piping the prompt
+ const { spawn } = await import('child_process');
+
const claudeArgs = [];
// Add auto-permission flag if requested
@@ -171,14 +173,29 @@ Use all available tools including file operations, web search, and code executio
claudeArgs.push('--dangerously-skip-permissions');
}
- // Build the command - pass the prompt as the last argument
- const promptEscaped = swarmPrompt.replace(/"/g, '\\"').replace(/\$/g, '\\$').replace(/`/g, '\\`');
- const command = `claude ${claudeArgs.join(' ')} "${promptEscaped}"`;
+ // Spawn claude process
+ const claudeProcess = spawn('claude', claudeArgs, {
+ stdio: ['pipe', 'inherit', 'inherit'],
+ shell: false
+ });
+
+ // Write the prompt to stdin and close it
+ claudeProcess.stdin.write(swarmPrompt);
+ claudeProcess.stdin.end();
- // Execute with stdio inherit to see output in real-time
- execSync(command, {
- stdio: 'inherit',
- shell: true
+ // Wait for the process to complete
+ await new Promise((resolve, reject) => {
+ claudeProcess.on('close', (code) => {
+ if (code === 0) {
+ resolve();
+ } else {
+ reject(new Error(`Claude process exited with code ${code}`));
+ }
+ });
+
+ claudeProcess.on('error', (err) => {
+ reject(err);
+ });
});
} catch (error) {