Skip to content

fix: swarm start now spawns real Claude processes#1265

Open
younes3334 wants to merge 1 commit intoruvnet:mainfrom
younes3334:fix/swarm-start-real-execution
Open

fix: swarm start now spawns real Claude processes#1265
younes3334 wants to merge 1 commit intoruvnet:mainfrom
younes3334:fix/swarm-start-real-execution

Conversation

@younes3334
Copy link

Summary

  • swarm start was showing a fake 500ms spinner without spawning any agents. Now it writes state files, generates per-role prompts, and launches a detached Node manager that runs up to 3 concurrent claude --print processes
  • swarm stop now reads PIDs from .swarm/agents/*.json and kills them, auto-detects swarm ID from state file
  • agent_spawn MCP tool gains an optional execute flag to spawn a real Claude process (default false, backward compatible)

What was wrong

swarm start ran await new Promise(resolve => setTimeout(resolve, 500)) then printed "deployed" — zero processes were ever started. swarm stop printed fake messages without killing anything.

How it works now

  1. swarm start flattens the agent plan, writes agent/task/prompt files to .swarm/
  2. A detached manager script (.swarm/.manager.js) picks up pending agents and spawns claude --print <prompt> with max 3 concurrent
  3. Manager deletes CLAUDECODE env var to bypass nested-session guard
  4. On completion, agent/task JSON files are updated; output saved to .swarm/results/
  5. swarm status reads real state from these files
  6. swarm stop sends SIGTERM (or SIGKILL with --force) to tracked PIDs

Files changed

  • v3/@claude-flow/cli/src/commands/swarm.ts — start + stop commands
  • v3/@claude-flow/cli/src/mcp-tools/agent-tools.ts — execute flag in agent_spawn

Testing

Tested on macOS with claude CLI installed. Verified agents spawn, PIDs are tracked, status reflects real state, and stop kills processes.

Fixes #1196, #1034, #984

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How do I use this? Paradox of choice and confusion as a beginner

1 participant