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/FIX_NON_INTERACTIVE_MODE.md

rUva19ac3acb23f
diff --git a/.claude/checkpoints/task-1754486772.json b/.claude/checkpoints/task-1754486772.json
new file mode 100644
index 0000000000..4af354f881
--- /dev/null
+++ b/.claude/checkpoints/task-1754486772.json
@@ -0,0 +1 @@
+{"checkpoint": "task-20250806-132611", "task": "You are orchestrating a Claude Flow Swarm with advanced MCP tool coordination. 🎯 OBJECTIVE: test", "timestamp": "2025-08-06T13:26:12Z", "commit": "5cba18143cdc9580c2a357dbe7417afe69a2b88c", "github_release": "true"}
diff --git a/FIX_NON_INTERACTIVE_MODE.md b/FIX_NON_INTERACTIVE_MODE.md
new file mode 100644
index 0000000000..0791581853
--- /dev/null
+++ b/FIX_NON_INTERACTIVE_MODE.md
@@ -0,0 +1,81 @@
+# Non-Interactive Mode Fix - Regression from alpha.83
+
+## Summary
+Fixed a regression where the `--non-interactive` flag was not being properly handled in swarm and hive-mind commands. The issue was that the code was checking for the flag AFTER spawning Claude in interactive mode, instead of BEFORE.
+
+## Issue
+In claude-flow versions after alpha.83 (including alpha.87), the --non-interactive flag was being ignored because:
+1. The code would check if Claude CLI exists
+2. If it exists, immediately spawn Claude in interactive mode
+3. Only THEN check if --non-interactive was specified
+4. By that point, Claude was already running interactively
+
+## Root Cause
+The non-interactive flag check was happening too late in the execution flow.
+
+## Solution
+Moved the non-interactive flag check to happen FIRST, before any Claude spawning occurs.
+
+## Files Modified
+
+### 1. `/src/cli/simple-commands/swarm.js`
+- **Line 842-846**: Added early check for non-interactive mode BEFORE checking for Claude
+- **Line 854-870**: Made error messages conditional based on interactive/non-interactive mode
+- **Line 875-889**: Made launch messages conditional based on mode
+- **Line 770-807**: Fixed --claude flag to always use interactive mode (as intended)
+
+### 2. `/src/cli/simple-commands/hive-mind.js`
+- **Line 1484-1492**: Added early check for non-interactive mode in spawn subcommand
+- **Line 426-446**: Added non-interactive check at start of spawnSwarm function
+
+## Key Changes
+
+### Before (Broken):
+```javascript
+// Check if claude exists
+execSync('which claude');
+// Launch claude immediately
+console.log('Launching...');
+spawn('claude', args);
+// Only then check non-interactive (too late!)
+if (flags['non-interactive']) { ... }
+```
+
+### After (Fixed):
+```javascript
+// Check non-interactive FIRST
+const isNonInteractive = flags['non-interactive'] || ...;
+// Then check if claude exists
+execSync('which claude');
+// Launch with appropriate mode
+if (!isNonInteractive) {
+ console.log('Launching...');
+}
+spawn('claude', isNonInteractive ? [..., '-p'] : args);
+```
+
+## Special Cases
+
+### --claude Flag
+The `--claude` flag is meant to force interactive mode, so it bypasses non-interactive checks:
+- `claude-flow swarm "task" --claude` β†’ Always interactive
+- `claude-flow swarm "task" --non-interactive` β†’ Non-interactive
+- `claude-flow swarm "task"` β†’ Interactive by default
+
+## Testing
+
+### Working Commands:
+```bash
+# Non-interactive mode (fixed)
+./claude-flow swarm "Test task" --non-interactive
+./claude-flow hive-mind spawn "Test task" --count 2 --non-interactive
+
+# Interactive mode with --claude flag (preserved)
+./claude-flow swarm "Test task" --claude
+
+# Default interactive mode
+./claude-flow swarm "Test task"
+```
+
+## Compatibility
+This fix restores the behavior from alpha.83 where --non-interactive flag was properly respected.
\ No newline at end of file