diff --git a/.claude/checkpoints/task-1755010637.json b/.claude/checkpoints/task-1755010637.json new file mode 100644 index 0000000000..031a9d24b0 --- /dev/null +++ b/.claude/checkpoints/task-1755010637.json @@ -0,0 +1 @@ +{"checkpoint": "task-20250812-145716", "task": "the non-interactive args don't seem to insert the default prompt in the same way the interactive cla", "timestamp": "2025-08-12T14:57:17Z", "commit": "c7ec78db0d947c344decb1678976133988fbebf0", "github_release": "true"} diff --git a/src/cli/simple-commands/hive-mind.js b/src/cli/simple-commands/hive-mind.js index 9b1b6ea040..1cf1dadf70 100644 --- a/src/cli/simple-commands/hive-mind.js +++ b/src/cli/simple-commands/hive-mind.js @@ -2005,10 +2005,18 @@ async function spawnClaudeCodeInstances(swarmId, swarmName, objective, workers, // Respect --non-interactive flag regardless of --claude const isNonInteractive = flags['non-interactive'] || flags.nonInteractive; - // Pass the prompt directly as an argument to claude - const claudeArgs = [hiveMindPrompt]; + // Build arguments in correct order: flags first, then prompt + const claudeArgs = []; + + // Add non-interactive flags FIRST if needed + if (isNonInteractive) { + claudeArgs.push('-p'); // Print mode + claudeArgs.push('--output-format', 'stream-json'); // JSON streaming + claudeArgs.push('--verbose'); // Verbose output + console.log(chalk.cyan('🤖 Running in non-interactive mode')); + } - // Add auto-permission flag by default for hive-mind mode (unless explicitly disabled) + // Add auto-permission flag BEFORE the prompt if (flags['dangerously-skip-permissions'] !== false && !flags['no-auto-permissions']) { claudeArgs.push('--dangerously-skip-permissions'); if (!isNonInteractive) { @@ -2020,15 +2028,10 @@ async function spawnClaudeCodeInstances(swarmId, swarmName, objective, workers, } } - // Add non-interactive flags if needed - if (isNonInteractive) { - claudeArgs.push('-p'); // Print mode - claudeArgs.push('--output-format', 'stream-json'); // JSON streaming - claudeArgs.push('--verbose'); // Verbose output - console.log(chalk.cyan('🤖 Running in non-interactive mode')); - } + // Add the prompt as the LAST argument + claudeArgs.push(hiveMindPrompt); - // Spawn claude with the prompt as the first argument + // Spawn claude with properly ordered arguments const claudeProcess = childSpawn('claude', claudeArgs, { stdio: 'inherit', shell: false,