claude_swarm 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d905c9233bd290f36581e1507efcfb081c4c06e25182d84cf7fc1aa5fd167468
4
- data.tar.gz: 666090b2014f5b451cb264bf4bffc658a6d543e1d4e074e7ccb0f9ab03e44327
3
+ metadata.gz: 37bc8baf6ea837fcd1e8936a1ae5a6a13138fad6e6efb3708deca991673e119d
4
+ data.tar.gz: 1e3d06c4138a42e7ab54a121c4bd3e584db3859e640a5965aac88d04fe0e6132
5
5
  SHA512:
6
- metadata.gz: 6dd8b14d36a9ae772be13170fa28c30e85a93a02b5bfe6793294eca51d34520e02dc9d1ddefd5312cb2682472e6bcaa7dcb36213d28d6adf0b08852889117f36
7
- data.tar.gz: d1762b2fd34da13e3262ebf82e3fd3576844c2487154c8b68a35f7e9ff270e96fa61f19a83e8488a8a2f630c96f6a61d78e827b352062cd695d5c656b06b9ca0
6
+ metadata.gz: dba5aab927293d3cc5fc4190b0cd84f7addf7ae0f90224df425a166d33c5feb5e062be21c8b915589191a14609f25f6fc68da63402c5295588bd5c4ed1d177ab
7
+ data.tar.gz: 6a7d5058d8583bd1bf6fec8d148fe62e617535528f49f960412eb6da065db01a0405f4de6cff8963c63c523ce81cbf661dc49fe8840df3d568eaa2fcba853284
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [0.1.0] - 2025-05-24
3
+ ## [0.1.2] - 2025-05-29
4
+
5
+ ### Added
6
+ - Added `-p` / `--prompt` flag to pass prompts directly to the main Claude instance for non-interactive mode
7
+ - Output suppression when running with the `-p` flag for cleaner scripted usage
8
+
9
+ ## [0.1.1] - 2025-05-24
4
10
 
5
11
  - Initial release
data/CLAUDE.md CHANGED
@@ -76,14 +76,12 @@ swarm:
76
76
  main: lead
77
77
  instances:
78
78
  lead:
79
- role: "Lead Developer"
80
79
  directory: .
81
80
  model: opus
82
81
  connections: [frontend, backend]
83
82
  prompt: "You are the lead developer coordinating the team"
84
83
  tools: [Read, Edit, Bash]
85
84
  frontend:
86
- role: "Frontend Developer"
87
85
  directory: ./frontend
88
86
  model: sonnet
89
87
  prompt: "You specialize in frontend development with React"
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Claude Swarm
2
2
 
3
- Claude Swarm orchestrates multiple Claude Code instances as a collaborative AI development team. It enables running AI agents with specialized roles, tools, and directory contexts, communicating via MCP (Model Context Protocol). Define your swarm topology in simple YAML and let Claude instances collaborate across codebases. Perfect for complex projects requiring specialized AI agents for frontend, backend, testing, DevOps, or research tasks.
3
+ Claude Swarm orchestrates multiple Claude Code instances as a collaborative AI development team. It enables running AI agents with specialized roles, tools, and directory contexts, communicating via MCP (Model Context Protocol) in a tree-like hierarchy. Define your swarm topology in simple YAML and let Claude instances delegate tasks through connected instances. Perfect for complex projects requiring specialized AI agents for frontend, backend, testing, DevOps, or research tasks.
4
4
 
5
5
  ## Installation
6
6
 
@@ -32,7 +32,7 @@ bundle install
32
32
 
33
33
  ### Quick Start
34
34
 
35
- 1. Create a `claude-swarm.yml` file in your project:
35
+ 1. Run `claude-swarm init` or create a `claude-swarm.yml` file in your project:
36
36
 
37
37
  ```yaml
38
38
  version: 1
@@ -41,16 +41,14 @@ swarm:
41
41
  main: lead
42
42
  instances:
43
43
  lead:
44
- role: "Lead Developer"
45
44
  directory: .
46
45
  model: opus
47
46
  connections: [frontend, backend]
48
- tools:
47
+ tools: # Tools aren't required if you run it with `--vibe`
49
48
  - Read
50
49
  - Edit
51
50
  - Bash
52
51
  frontend:
53
- role: "Frontend Developer"
54
52
  directory: ./frontend
55
53
  model: sonnet
56
54
  tools:
@@ -58,7 +56,6 @@ swarm:
58
56
  - Write
59
57
  - Bash
60
58
  backend:
61
- role: "Backend Developer"
62
59
  directory: ./backend
63
60
  model: sonnet
64
61
  tools:
@@ -72,14 +69,104 @@ swarm:
72
69
  ```bash
73
70
  claude-swarm
74
71
  ```
72
+ or if you are feeling the vibes...
73
+ ```bash
74
+ claude-swarm --vibe # That will allow ALL tools for all instances! Be Careful!
75
+ ```
75
76
 
76
77
  This will:
77
- - Generate MCP configuration files in `.claude-swarm/`
78
- - Create a shared session timestamp for centralized logging
79
78
  - Launch the main instance (lead) with connections to other instances
80
- - The lead instance can communicate with frontend and backend instances via MCP
79
+ - The lead instance can communicate with the other instances via MCP
81
80
  - All instances log to `.claude-swarm/logs/session-{timestamp}/`
82
81
 
82
+ #### Multi-Level Swarm Example
83
+
84
+ Here's a more complex example showing specialized teams working on different parts of a project:
85
+
86
+ ```yaml
87
+ version: 1
88
+ swarm:
89
+ name: "Multi-Service Development Team"
90
+ main: architect
91
+ instances:
92
+ architect:
93
+ directory: .
94
+ model: opus
95
+ connections: [frontend_lead, backend_lead, mobile_lead, devops]
96
+ prompt: "You are the system architect coordinating between different service teams"
97
+ tools: [Read, Edit, WebSearch]
98
+
99
+ frontend_lead:
100
+ directory: ./web-frontend
101
+ model: opus
102
+ connections: [react_dev, css_expert]
103
+ prompt: "You lead the web frontend team working with React"
104
+ tools: [Read, Edit, Bash]
105
+
106
+ react_dev:
107
+ directory: ./web-frontend/src
108
+ model: sonnet
109
+ prompt: "You specialize in React components and state management"
110
+ tools: [Edit, Write, "Bash(npm:*)"]
111
+
112
+ css_expert:
113
+ directory: ./web-frontend/styles
114
+ model: sonnet
115
+ prompt: "You handle all CSS and styling concerns"
116
+ tools: [Edit, Write, Read]
117
+
118
+ backend_lead:
119
+ directory: ./api-server
120
+ model: opus
121
+ connections: [api_dev, database_expert]
122
+ prompt: "You lead the API backend team"
123
+ tools: [Read, Edit, Bash]
124
+
125
+ api_dev:
126
+ directory: ./api-server/src
127
+ model: sonnet
128
+ prompt: "You develop REST API endpoints"
129
+ tools: [Edit, Write, Bash]
130
+
131
+ database_expert:
132
+ directory: ./api-server/db
133
+ model: sonnet
134
+ prompt: "You handle database schema and migrations"
135
+ tools: [Edit, Write, "Bash(psql:*, migrate:*)"]
136
+
137
+ mobile_lead:
138
+ directory: ./mobile-app
139
+ model: sonnet
140
+ connections: [ios_dev, android_dev]
141
+ prompt: "You coordinate mobile development across platforms"
142
+ tools: [Read, Edit]
143
+
144
+ ios_dev:
145
+ directory: ./mobile-app/ios
146
+ model: sonnet
147
+ prompt: "You develop the iOS application"
148
+ tools: [Edit, Write, "Bash(xcodebuild:*, pod:*)"]
149
+
150
+ android_dev:
151
+ directory: ./mobile-app/android
152
+ model: sonnet
153
+ prompt: "You develop the Android application"
154
+ tools: [Edit, Write, "Bash(gradle:*, adb:*)"]
155
+
156
+ devops:
157
+ directory: ./infrastructure
158
+ model: sonnet
159
+ prompt: "You handle CI/CD and infrastructure"
160
+ tools: [Read, Edit, "Bash(docker:*, kubectl:*)"]
161
+ ```
162
+
163
+ In this setup:
164
+ - The architect (main instance) can delegate tasks to team leads
165
+ - Each team lead can work with their specialized developers
166
+ - Each instance is independent - connections create separate MCP server instances
167
+ - Teams work in isolated directories with role-appropriate tools
168
+
169
+
83
170
  ### Configuration Format
84
171
 
85
172
  #### Top Level
@@ -97,7 +184,6 @@ swarm:
97
184
 
98
185
  Each instance can have:
99
186
 
100
- - **role**: Human-readable role description (defaults to instance name)
101
187
  - **directory**: Working directory for this instance (can use ~ for home)
102
188
  - **model**: Claude model to use (opus, sonnet, haiku)
103
189
  - **connections**: Array of other instances this one can communicate with
@@ -107,7 +193,6 @@ Each instance can have:
107
193
 
108
194
  ```yaml
109
195
  instance_name:
110
- role: "Role Description"
111
196
  directory: ~/project/path
112
197
  model: opus
113
198
  connections: [other_instance1, other_instance2]
@@ -188,7 +273,6 @@ swarm:
188
273
  main: architect
189
274
  instances:
190
275
  architect:
191
- role: "Software Architect"
192
276
  directory: .
193
277
  model: opus
194
278
  connections: [frontend, backend, devops]
@@ -199,7 +283,6 @@ swarm:
199
283
  - WebSearch
200
284
 
201
285
  frontend:
202
- role: "Frontend Developer"
203
286
  directory: ./frontend
204
287
  model: sonnet
205
288
  connections: [architect]
@@ -210,7 +293,6 @@ swarm:
210
293
  - Bash
211
294
 
212
295
  backend:
213
- role: "Backend Developer"
214
296
  directory: ./backend
215
297
  model: sonnet
216
298
  connections: [architect, database]
@@ -220,7 +302,6 @@ swarm:
220
302
  - Bash
221
303
 
222
304
  database:
223
- role: "Database Administrator"
224
305
  directory: ./db
225
306
  model: haiku
226
307
  tools:
@@ -228,7 +309,6 @@ swarm:
228
309
  - Bash
229
310
 
230
311
  devops:
231
- role: "DevOps Engineer"
232
312
  directory: .
233
313
  model: sonnet
234
314
  connections: [architect]
@@ -247,7 +327,6 @@ swarm:
247
327
  main: lead_researcher
248
328
  instances:
249
329
  lead_researcher:
250
- role: "Lead Researcher"
251
330
  directory: ~/research
252
331
  model: opus
253
332
  connections: [data_analyst, writer]
@@ -261,7 +340,6 @@ swarm:
261
340
  url: "https://arxiv-mcp.example.com"
262
341
 
263
342
  data_analyst:
264
- role: "Data Analyst"
265
343
  directory: ~/research/data
266
344
  model: sonnet
267
345
  tools:
@@ -275,7 +353,6 @@ swarm:
275
353
  args: ["--notebook-dir", "."]
276
354
 
277
355
  writer:
278
- role: "Technical Writer"
279
356
  directory: ~/research/papers
280
357
  model: sonnet
281
358
  tools:
@@ -297,6 +374,10 @@ claude-swarm -c team-config.yml
297
374
  # Run with --dangerously-skip-permissions for all instances
298
375
  claude-swarm --vibe
299
376
 
377
+ # Run in non-interactive mode with a prompt
378
+ claude-swarm -p "Implement the new user authentication feature"
379
+ claude-swarm --prompt "Fix the bug in the payment module"
380
+
300
381
  # Show version
301
382
  claude-swarm version
302
383
 
data/claude-swarm.yml CHANGED
@@ -1,36 +1,19 @@
1
1
  version: 1
2
2
  swarm:
3
- name: "Rails Expert Team"
4
- main: lead_rails_dev
3
+ name: "Swarm Name"
4
+ main: lead_developer
5
5
  instances:
6
- lead_rails_dev:
7
- role: "Lead Rails Developer"
8
- directory: .
9
- model: opus
10
- connections: [backend_dev, frontend_dev, test_engineer]
11
- prompt: "You are a senior Ruby on Rails developer with 10+ years of experience. You excel at Rails architecture, performance optimization, and best practices. You coordinate the team and make architectural decisions."
12
-
13
- backend_dev:
14
- role: "Backend Rails Developer"
6
+ lead_developer:
15
7
  directory: .
16
8
  model: sonnet
17
- connections: [test_engineer]
18
- prompt: "You specialize in Rails backend development including models, controllers, services, jobs, and API design. You follow Rails conventions and write clean, maintainable code with a focus on performance and security."
19
- mcps:
20
- - name: "headless_browser"
21
- type: "stdio"
22
- command: "bundle"
23
- args: ["exec", "hbt", "stdio"]
24
-
9
+ prompt: "You are the lead developer coordinating the team"
10
+ tools: [Read, Edit, Bash, Write]
11
+ connections: [frontend_dev]
12
+
13
+ # Example instances (uncomment and modify as needed):
14
+
25
15
  frontend_dev:
26
- role: "Rails Frontend Developer"
27
- directory: .
28
- model: sonnet
29
- connections: [test_engineer]
30
- prompt: "You are a Rails developer specializing in views, partials, helpers, Stimulus/Turbo, and asset pipeline. You excel at creating responsive UIs with Rails' built-in tools and modern CSS/JavaScript integration."
31
-
32
- test_engineer:
33
- role: "Rails Test Engineer"
34
16
  directory: .
35
17
  model: sonnet
36
- prompt: "You are a Rails testing expert specializing in Minitest. You write comprehensive unit tests, integration tests, system tests, and fixtures. You ensure high test coverage and follow Rails testing best practices including proper use of assertions, test helpers, and factories."
18
+ prompt: "You specialize in frontend development with React, TypeScript, and modern web technologies"
19
+ tools: [Read, Edit, Write, "Bash(npm:*)", "Bash(yarn:*)", "Bash(pnpm:*)"]
@@ -0,0 +1,36 @@
1
+ version: 1
2
+ swarm:
3
+ name: "Rails Expert Team"
4
+ main: lead_rails_dev
5
+ instances:
6
+ lead_rails_dev:
7
+ role: "Lead Rails Developer"
8
+ directory: .
9
+ model: opus
10
+ connections: [backend_dev, frontend_dev, test_engineer]
11
+ prompt: "You are a senior Ruby on Rails developer with 10+ years of experience. You excel at Rails architecture, performance optimization, and best practices. You coordinate the team and make architectural decisions."
12
+
13
+ backend_dev:
14
+ role: "Backend Rails Developer"
15
+ directory: .
16
+ model: sonnet
17
+ connections: [test_engineer]
18
+ prompt: "You specialize in Rails backend development including models, controllers, services, jobs, and API design. You follow Rails conventions and write clean, maintainable code with a focus on performance and security."
19
+ mcps:
20
+ - name: "headless_browser"
21
+ type: "stdio"
22
+ command: "bundle"
23
+ args: ["exec", "hbt", "stdio"]
24
+
25
+ frontend_dev:
26
+ role: "Rails Frontend Developer"
27
+ directory: .
28
+ model: sonnet
29
+ connections: [test_engineer]
30
+ prompt: "You are a Rails developer specializing in views, partials, helpers, Stimulus/Turbo, and asset pipeline. You excel at creating responsive UIs with Rails' built-in tools and modern CSS/JavaScript integration."
31
+
32
+ test_engineer:
33
+ role: "Rails Test Engineer"
34
+ directory: .
35
+ model: sonnet
36
+ prompt: "You are a Rails testing expert specializing in Minitest. You write comprehensive unit tests, integration tests, system tests, and fixtures. You ensure high test coverage and follow Rails testing best practices including proper use of assertions, test helpers, and factories."
@@ -17,6 +17,8 @@ module ClaudeSwarm
17
17
  desc: "Path to configuration file"
18
18
  method_option :vibe, type: :boolean, default: false,
19
19
  desc: "Run with --dangerously-skip-permissions for all instances"
20
+ method_option :prompt, aliases: "-p", type: :string,
21
+ desc: "Prompt to pass to the main Claude instance (non-interactive mode)"
20
22
  def start(config_file = nil)
21
23
  config_path = config_file || options[:config]
22
24
  unless File.exist?(config_path)
@@ -24,11 +26,11 @@ module ClaudeSwarm
24
26
  exit 1
25
27
  end
26
28
 
27
- say "Starting Claude Swarm from #{config_path}..."
29
+ say "Starting Claude Swarm from #{config_path}..." unless options[:prompt]
28
30
  begin
29
31
  config = Configuration.new(config_path)
30
32
  generator = McpGenerator.new(config, vibe: options[:vibe])
31
- orchestrator = Orchestrator.new(config, generator, vibe: options[:vibe])
33
+ orchestrator = Orchestrator.new(config, generator, vibe: options[:vibe], prompt: options[:prompt])
32
34
  orchestrator.start
33
35
  rescue Error => e
34
36
  error e.message
@@ -78,6 +80,63 @@ module ClaudeSwarm
78
80
  end
79
81
  end
80
82
 
83
+ desc "init", "Initialize a new claude-swarm.yml configuration file"
84
+ method_option :force, aliases: "-f", type: :boolean, default: false,
85
+ desc: "Overwrite existing configuration file"
86
+ def init
87
+ config_path = "claude-swarm.yml"
88
+
89
+ if File.exist?(config_path) && !options[:force]
90
+ error "Configuration file already exists: #{config_path}"
91
+ error "Use --force to overwrite"
92
+ exit 1
93
+ end
94
+
95
+ template = <<~YAML
96
+ version: 1
97
+ swarm:
98
+ name: "Swarm Name"
99
+ main: lead_developer
100
+ instances:
101
+ lead_developer:
102
+ directory: .
103
+ model: sonnet
104
+ prompt: "You are the lead developer coordinating the team"
105
+ tools: [Read, Edit, Bash, Write]
106
+ # connections: [frontend_dev, backend_dev]
107
+
108
+ # Example instances (uncomment and modify as needed):
109
+
110
+ # frontend_dev:
111
+ # directory: ./frontend
112
+ # model: sonnet
113
+ # prompt: "You specialize in frontend development with React, TypeScript, and modern web technologies"
114
+ # tools: [Read, Edit, Write, "Bash(npm:*)", "Bash(yarn:*)", "Bash(pnpm:*)"]
115
+
116
+ # backend_dev:
117
+ # directory: ../other-app/backend
118
+ # model: sonnet
119
+ # prompt: "You specialize in backend development, APIs, databases, and server architecture"
120
+ # tools: [Read, Edit, Write, Bash]
121
+
122
+ # devops_engineer:
123
+ # directory: .
124
+ # model: sonnet
125
+ # prompt: "You specialize in infrastructure, CI/CD, containerization, and deployment"
126
+ # tools: [Read, Edit, Write, "Bash(docker:*)", "Bash(kubectl:*)", "Bash(terraform:*)"]
127
+
128
+ # qa_engineer:
129
+ # directory: ./tests
130
+ # model: sonnet
131
+ # prompt: "You specialize in testing, quality assurance, and test automation"
132
+ # tools: [Read, Edit, Write, Bash]
133
+ YAML
134
+
135
+ File.write(config_path, template)
136
+ say "Created #{config_path}", :green
137
+ say "Edit this file to configure your swarm, then run 'claude-swarm' to start"
138
+ end
139
+
81
140
  desc "version", "Show Claude Swarm version"
82
141
  def version
83
142
  say "Claude Swarm #{VERSION}"
@@ -74,7 +74,6 @@ module ClaudeSwarm
74
74
  config ||= {}
75
75
  {
76
76
  name: name,
77
- role: config["role"] || name.to_s.tr("_", " ").capitalize,
78
77
  directory: expand_path(config["directory"] || "."),
79
78
  model: config["model"] || "sonnet",
80
79
  connections: Array(config["connections"]),
@@ -4,39 +4,48 @@ require "shellwords"
4
4
 
5
5
  module ClaudeSwarm
6
6
  class Orchestrator
7
- def initialize(configuration, mcp_generator, vibe: false)
7
+ def initialize(configuration, mcp_generator, vibe: false, prompt: nil)
8
8
  @config = configuration
9
9
  @generator = mcp_generator
10
10
  @vibe = vibe
11
+ @prompt = prompt
11
12
  end
12
13
 
13
14
  def start
14
- puts "🐝 Starting Claude Swarm: #{@config.swarm_name}"
15
- puts "😎 Vibe mode ON" if @vibe
16
- puts
15
+ unless @prompt
16
+ puts "🐝 Starting Claude Swarm: #{@config.swarm_name}"
17
+ puts "😎 Vibe mode ON" if @vibe
18
+ puts
19
+ end
17
20
 
18
21
  # Set session timestamp for all instances to share the same log file
19
22
  session_timestamp = Time.now.strftime("%Y%m%d_%H%M%S")
20
23
  ENV["CLAUDE_SWARM_SESSION_TIMESTAMP"] = session_timestamp
21
- puts "📝 Session logs will be saved to: .claude-swarm/logs/session_#{session_timestamp}.log"
22
- puts
24
+ unless @prompt
25
+ puts "📝 Session logs will be saved to: .claude-swarm/logs/session_#{session_timestamp}.log"
26
+ puts
27
+ end
23
28
 
24
29
  # Generate all MCP configuration files
25
30
  @generator.generate_all
26
- puts "✓ Generated MCP configurations in .claude-swarm/"
27
- puts
31
+ unless @prompt
32
+ puts "✓ Generated MCP configurations in .claude-swarm/"
33
+ puts
34
+ end
28
35
 
29
36
  # Launch the main instance
30
37
  main_instance = @config.main_instance_config
31
- puts "🚀 Launching main instance: #{@config.main_instance} (#{main_instance[:role]})"
32
- puts " Model: #{main_instance[:model]}"
33
- puts " Directory: #{main_instance[:directory]}"
34
- puts " Tools: #{main_instance[:tools].join(", ")}" if main_instance[:tools].any?
35
- puts " Connections: #{main_instance[:connections].join(", ")}" if main_instance[:connections].any?
36
- puts
38
+ unless @prompt
39
+ puts "🚀 Launching main instance: #{@config.main_instance}"
40
+ puts " Model: #{main_instance[:model]}"
41
+ puts " Directory: #{main_instance[:directory]}"
42
+ puts " Tools: #{main_instance[:tools].join(", ")}" if main_instance[:tools].any?
43
+ puts " Connections: #{main_instance[:connections].join(", ")}" if main_instance[:connections].any?
44
+ puts
45
+ end
37
46
 
38
47
  command = build_main_command(main_instance)
39
- if ENV["DEBUG"]
48
+ if ENV["DEBUG"] && !@prompt
40
49
  puts "Running: #{command}"
41
50
  puts
42
51
  end
@@ -65,6 +74,8 @@ module ClaudeSwarm
65
74
  mcp_config_path = @generator.mcp_config_path(@config.main_instance)
66
75
  parts << "--mcp-config #{mcp_config_path}"
67
76
 
77
+ parts << "-p #{Shellwords.escape(@prompt)}" if @prompt
78
+
68
79
  parts.join(" ")
69
80
  end
70
81
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClaudeSwarm
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: claude_swarm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Arruda
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-05-28 00:00:00.000000000 Z
10
+ date: 2025-05-29 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: thor
@@ -58,6 +58,7 @@ files:
58
58
  - README.md
59
59
  - Rakefile
60
60
  - claude-swarm.yml
61
+ - example/claude-swarm.yml
61
62
  - exe/claude-swarm
62
63
  - lib/claude_swarm.rb
63
64
  - lib/claude_swarm/claude_code_executor.rb