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

๐Ÿ”– Checkpoint: Edit /workspaces/claude-code-flow/src/cli/simple-commands/automation-executor.js

rUvd7008ccd8dc2
diff --git a/.claude/checkpoints/task-1754362637.json b/.claude/checkpoints/task-1754362637.json
new file mode 100644
index 0000000000..6d42085cd5
--- /dev/null
+++ b/.claude/checkpoints/task-1754362637.json
@@ -0,0 +1 @@
+{"checkpoint": "task-20250805-025716", "task": "{{user_prompt}} ", "timestamp": "2025-08-05T02:57:17Z", "commit": "1c5d2d5c817829c4162d4a349d5b560c7b5203f9", "github_release": "true"}
diff --git a/src/cli/simple-commands/automation-executor.js b/src/cli/simple-commands/automation-executor.js
index 27700bfd57..e3c72cda5a 100644
--- a/src/cli/simple-commands/automation-executor.js
+++ b/src/cli/simple-commands/automation-executor.js
@@ -210,8 +210,13 @@ export class WorkflowExecutor {
/**
* Spawn a Claude CLI instance for an agent
+ * @param {Object} agent - The agent configuration
+ * @param {string} prompt - The prompt for the agent
+ * @param {Object} options - Additional options
+ * @param {Stream} options.inputStream - Optional input stream from previous agent
+ * @param {boolean} options.enableChaining - Whether to enable stream-json chaining
*/
- async spawnClaudeInstance(agent, prompt) {
+ async spawnClaudeInstance(agent, prompt, options = {}) {
const claudeArgs = [];
// Add flags based on mode
@@ -221,6 +226,11 @@ export class WorkflowExecutor {
if (this.options.outputFormat === 'stream-json') {
claudeArgs.push('--output-format', 'stream-json');
claudeArgs.push('--verbose'); // Required for stream-json
+
+ // Add input format if we're chaining from a previous agent
+ if (options.inputStream) {
+ claudeArgs.push('--input-format', 'stream-json');
+ }
}
}
@@ -233,13 +243,15 @@ export class WorkflowExecutor {
// Log the command being executed (truncate long prompts)
const displayPrompt = prompt.length > 100 ? prompt.substring(0, 100) + '...' : prompt;
const flagsDisplay = this.options.nonInteractive ?
- (this.options.outputFormat === 'stream-json' ? '--print --output-format stream-json --verbose --dangerously-skip-permissions' : '--print --dangerously-skip-permissions') :
+ (this.options.outputFormat === 'stream-json' ?
+ (options.inputStream ? '--print --input-format stream-json --output-format stream-json --verbose --dangerously-skip-permissions' : '--print --output-format stream-json --verbose --dangerously-skip-permissions') :
+ '--print --dangerously-skip-permissions') :
'--dangerously-skip-permissions';
console.log(` ๐Ÿค– Spawning Claude for ${agent.name}: claude ${flagsDisplay} "${displayPrompt}"`);
- // Determine stdio configuration based on mode
+ // Determine stdio configuration based on mode and chaining
const stdioConfig = this.options.nonInteractive ?
- ['inherit', 'pipe', 'pipe'] : // Non-interactive: pipe output for processing
+ [options.inputStream ? 'pipe' : 'inherit', 'pipe', 'pipe'] : // Non-interactive: pipe for chaining
['inherit', 'inherit', 'inherit']; // Interactive: inherit all for normal Claude interaction
// Spawn Claude process
@@ -248,6 +260,12 @@ export class WorkflowExecutor {
shell: false,
});
+ // If we have an input stream, pipe it to Claude's stdin
+ if (options.inputStream && claudeProcess.stdin) {
+ console.log(` ๐Ÿ”— Chaining: Piping output from previous agent to ${agent.name}`);
+ options.inputStream.pipe(claudeProcess.stdin);
+ }
+
// Handle stdout with stream processor for better formatting (only in non-interactive mode)
if (this.options.nonInteractive && this.options.outputFormat === 'stream-json' && claudeProcess.stdout) {
// Import and use stream processor