claude_swarm 0.1.0
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 +7 -0
- data/.rubocop.yml +62 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +5 -0
- data/CLAUDE.md +103 -0
- data/LICENSE +21 -0
- data/README.md +391 -0
- data/Rakefile +12 -0
- data/claude-swarm.yml +36 -0
- data/exe/claude-swarm +6 -0
- data/lib/claude_swarm/claude_code_executor.rb +93 -0
- data/lib/claude_swarm/claude_mcp_server.rb +190 -0
- data/lib/claude_swarm/cli.rb +94 -0
- data/lib/claude_swarm/configuration.rb +126 -0
- data/lib/claude_swarm/mcp_generator.rb +112 -0
- data/lib/claude_swarm/orchestrator.rb +71 -0
- data/lib/claude_swarm/version.rb +5 -0
- data/lib/claude_swarm.rb +10 -0
- metadata +94 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d905c9233bd290f36581e1507efcfb081c4c06e25182d84cf7fc1aa5fd167468
|
4
|
+
data.tar.gz: 666090b2014f5b451cb264bf4bffc658a6d543e1d4e074e7ccb0f9ab03e44327
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6dd8b14d36a9ae772be13170fa28c30e85a93a02b5bfe6793294eca51d34520e02dc9d1ddefd5312cb2682472e6bcaa7dcb36213d28d6adf0b08852889117f36
|
7
|
+
data.tar.gz: d1762b2fd34da13e3262ebf82e3fd3576844c2487154c8b68a35f7e9ff270e96fa61f19a83e8488a8a2f630c96f6a61d78e827b352062cd695d5c656b06b9ca0
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 3.4
|
3
|
+
NewCops: enable
|
4
|
+
|
5
|
+
plugins:
|
6
|
+
- rubocop-minitest
|
7
|
+
- rubocop-rake
|
8
|
+
|
9
|
+
|
10
|
+
Style/StringLiterals:
|
11
|
+
EnforcedStyle: double_quotes
|
12
|
+
|
13
|
+
Style/StringLiteralsInInterpolation:
|
14
|
+
EnforcedStyle: double_quotes
|
15
|
+
|
16
|
+
# Disable documentation for internal classes
|
17
|
+
Style/Documentation:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
# Allow slightly longer methods
|
21
|
+
Metrics/MethodLength:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
# Disable gemspec specific cops
|
25
|
+
Gemspec/RequireMFA:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Gemspec/RequiredRubyVersion:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Gemspec/DevelopmentDependencies:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Naming/AccessorMethodName:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Metrics/BlockLength:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
Metrics/ClassLength:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
Metrics/PerceivedComplexity:
|
44
|
+
Enabled: false
|
45
|
+
|
46
|
+
Metrics/CyclomaticComplexity:
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
Metrics/AbcSize:
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
Naming/PredicateName:
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
Layout/LineLength:
|
56
|
+
Max: 150
|
57
|
+
|
58
|
+
Metrics/ModuleLength:
|
59
|
+
Enabled: false
|
60
|
+
|
61
|
+
Minitest/MultipleAssertions:
|
62
|
+
Enabled: false
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-3.4.2
|
data/CHANGELOG.md
ADDED
data/CLAUDE.md
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
# CLAUDE.md
|
2
|
+
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
4
|
+
|
5
|
+
## Overview
|
6
|
+
|
7
|
+
Claude Swarm is a Ruby gem that 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).
|
8
|
+
|
9
|
+
## Development Commands
|
10
|
+
|
11
|
+
### Setup
|
12
|
+
```bash
|
13
|
+
bin/setup # Install dependencies
|
14
|
+
```
|
15
|
+
|
16
|
+
### Testing
|
17
|
+
```bash
|
18
|
+
rake test # Run the Minitest test suite
|
19
|
+
```
|
20
|
+
|
21
|
+
### Linting
|
22
|
+
```bash
|
23
|
+
rake rubocop -A # Run RuboCop linter to auto fix problems
|
24
|
+
```
|
25
|
+
|
26
|
+
### Development Console
|
27
|
+
```bash
|
28
|
+
bin/console # Start IRB session with gem loaded
|
29
|
+
```
|
30
|
+
|
31
|
+
### Build & Release
|
32
|
+
```bash
|
33
|
+
bundle exec rake install # Install gem locally
|
34
|
+
bundle exec rake release # Release gem to RubyGems.org
|
35
|
+
```
|
36
|
+
|
37
|
+
### Default Task
|
38
|
+
```bash
|
39
|
+
rake # Runs both tests and RuboCop
|
40
|
+
```
|
41
|
+
|
42
|
+
## Architecture
|
43
|
+
|
44
|
+
The gem is fully implemented with the following components:
|
45
|
+
|
46
|
+
### Core Classes
|
47
|
+
|
48
|
+
- **ClaudeSwarm::CLI** (`lib/claude_swarm/cli.rb`): Thor-based CLI that handles command parsing and orchestration
|
49
|
+
- **ClaudeSwarm::Configuration** (`lib/claude_swarm/configuration.rb`): YAML parser and validator for swarm configurations
|
50
|
+
- **ClaudeSwarm::McpGenerator** (`lib/claude_swarm/mcp_generator.rb`): Generates MCP JSON configurations for each instance
|
51
|
+
- **ClaudeSwarm::Orchestrator** (`lib/claude_swarm/orchestrator.rb`): Launches the main Claude instance with proper configuration
|
52
|
+
|
53
|
+
### Key Features
|
54
|
+
|
55
|
+
1. **YAML Configuration**: Define swarms with instances, connections, tools, and MCP servers
|
56
|
+
2. **Inter-Instance Communication**: Instances connect via MCP using `claude mcp serve` with `-p` flag
|
57
|
+
3. **Tool Restrictions**: Support for pattern-based tool restrictions (e.g., `Bash(npm:*)`)
|
58
|
+
4. **Multiple MCP Types**: Supports both stdio and SSE MCP server types
|
59
|
+
5. **Automatic MCP Generation**: Creates `.claude-swarm/` directory with MCP configs
|
60
|
+
6. **Custom System Prompts**: Each instance can have a custom prompt via `--append-system-prompt`
|
61
|
+
|
62
|
+
### How It Works
|
63
|
+
|
64
|
+
1. User creates a `claude-swarm.yml` file defining the swarm topology
|
65
|
+
2. Running `claude-swarm` parses the configuration and validates it
|
66
|
+
3. MCP configuration files are generated for each instance in `.claude-swarm/`
|
67
|
+
4. The main instance is launched with `exec`, replacing the current process
|
68
|
+
5. Connected instances are available as MCP servers to the main instance
|
69
|
+
|
70
|
+
### Configuration Example
|
71
|
+
|
72
|
+
```yaml
|
73
|
+
version: 1
|
74
|
+
swarm:
|
75
|
+
name: "Dev Team"
|
76
|
+
main: lead
|
77
|
+
instances:
|
78
|
+
lead:
|
79
|
+
role: "Lead Developer"
|
80
|
+
directory: .
|
81
|
+
model: opus
|
82
|
+
connections: [frontend, backend]
|
83
|
+
prompt: "You are the lead developer coordinating the team"
|
84
|
+
tools: [Read, Edit, Bash]
|
85
|
+
frontend:
|
86
|
+
role: "Frontend Developer"
|
87
|
+
directory: ./frontend
|
88
|
+
model: sonnet
|
89
|
+
prompt: "You specialize in frontend development with React"
|
90
|
+
tools: [Edit, Write, "Bash(npm:*)"]
|
91
|
+
```
|
92
|
+
|
93
|
+
## Testing
|
94
|
+
|
95
|
+
The gem includes basic tests for version number and CLI existence. Additional tests should be added for:
|
96
|
+
- Configuration parsing and validation
|
97
|
+
- MCP generation logic
|
98
|
+
- Error handling scenarios
|
99
|
+
|
100
|
+
## Dependencies
|
101
|
+
|
102
|
+
- **thor** (~> 1.3): Command-line interface framework
|
103
|
+
- **yaml**: Built-in Ruby YAML parser (no explicit dependency needed)
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025-present Paulo Arruda
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,391 @@
|
|
1
|
+
# Claude Swarm
|
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.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install the gem by executing:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
gem install claude_swarm
|
11
|
+
```
|
12
|
+
|
13
|
+
Or add it to your Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'claude_swarm'
|
17
|
+
```
|
18
|
+
|
19
|
+
Then run:
|
20
|
+
|
21
|
+
```bash
|
22
|
+
bundle install
|
23
|
+
```
|
24
|
+
|
25
|
+
## Prerequisites
|
26
|
+
|
27
|
+
- Ruby 3.1.0 or higher
|
28
|
+
- Claude CLI installed and configured
|
29
|
+
- Any MCP servers you plan to use (optional)
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
### Quick Start
|
34
|
+
|
35
|
+
1. Create a `claude-swarm.yml` file in your project:
|
36
|
+
|
37
|
+
```yaml
|
38
|
+
version: 1
|
39
|
+
swarm:
|
40
|
+
name: "My Dev Team"
|
41
|
+
main: lead
|
42
|
+
instances:
|
43
|
+
lead:
|
44
|
+
role: "Lead Developer"
|
45
|
+
directory: .
|
46
|
+
model: opus
|
47
|
+
connections: [frontend, backend]
|
48
|
+
tools:
|
49
|
+
- Read
|
50
|
+
- Edit
|
51
|
+
- Bash
|
52
|
+
frontend:
|
53
|
+
role: "Frontend Developer"
|
54
|
+
directory: ./frontend
|
55
|
+
model: sonnet
|
56
|
+
tools:
|
57
|
+
- Edit
|
58
|
+
- Write
|
59
|
+
- Bash
|
60
|
+
backend:
|
61
|
+
role: "Backend Developer"
|
62
|
+
directory: ./backend
|
63
|
+
model: sonnet
|
64
|
+
tools:
|
65
|
+
- Edit
|
66
|
+
- Write
|
67
|
+
- Bash
|
68
|
+
```
|
69
|
+
|
70
|
+
2. Start the swarm:
|
71
|
+
|
72
|
+
```bash
|
73
|
+
claude-swarm
|
74
|
+
```
|
75
|
+
|
76
|
+
This will:
|
77
|
+
- Generate MCP configuration files in `.claude-swarm/`
|
78
|
+
- Create a shared session timestamp for centralized logging
|
79
|
+
- Launch the main instance (lead) with connections to other instances
|
80
|
+
- The lead instance can communicate with frontend and backend instances via MCP
|
81
|
+
- All instances log to `.claude-swarm/logs/session-{timestamp}/`
|
82
|
+
|
83
|
+
### Configuration Format
|
84
|
+
|
85
|
+
#### Top Level
|
86
|
+
|
87
|
+
```yaml
|
88
|
+
version: 1 # Required, currently only version 1 is supported
|
89
|
+
swarm:
|
90
|
+
name: "Swarm Name" # Display name for your swarm
|
91
|
+
main: instance_key # Which instance to launch as the main interface
|
92
|
+
instances:
|
93
|
+
# Instance definitions...
|
94
|
+
```
|
95
|
+
|
96
|
+
#### Instance Configuration
|
97
|
+
|
98
|
+
Each instance can have:
|
99
|
+
|
100
|
+
- **role**: Human-readable role description (defaults to instance name)
|
101
|
+
- **directory**: Working directory for this instance (can use ~ for home)
|
102
|
+
- **model**: Claude model to use (opus, sonnet, haiku)
|
103
|
+
- **connections**: Array of other instances this one can communicate with
|
104
|
+
- **tools**: Array of tools this instance can use
|
105
|
+
- **mcps**: Array of additional MCP servers to connect
|
106
|
+
- **prompt**: Custom system prompt to append to the instance
|
107
|
+
|
108
|
+
```yaml
|
109
|
+
instance_name:
|
110
|
+
role: "Role Description"
|
111
|
+
directory: ~/project/path
|
112
|
+
model: opus
|
113
|
+
connections: [other_instance1, other_instance2]
|
114
|
+
prompt: "You are a specialized agent focused on..."
|
115
|
+
tools:
|
116
|
+
- Read
|
117
|
+
- Edit
|
118
|
+
- Write
|
119
|
+
- Bash
|
120
|
+
- WebFetch
|
121
|
+
- WebSearch
|
122
|
+
mcps:
|
123
|
+
- name: server_name
|
124
|
+
type: stdio
|
125
|
+
command: command_to_run
|
126
|
+
args: ["arg1", "arg2"]
|
127
|
+
env:
|
128
|
+
VAR1: value1
|
129
|
+
```
|
130
|
+
|
131
|
+
### MCP Server Types
|
132
|
+
|
133
|
+
#### stdio (Standard I/O)
|
134
|
+
```yaml
|
135
|
+
mcps:
|
136
|
+
- name: my_tool
|
137
|
+
type: stdio
|
138
|
+
command: /path/to/executable
|
139
|
+
args: ["--flag", "value"]
|
140
|
+
env:
|
141
|
+
API_KEY: "secret"
|
142
|
+
```
|
143
|
+
|
144
|
+
#### sse (Server-Sent Events)
|
145
|
+
```yaml
|
146
|
+
mcps:
|
147
|
+
- name: remote_api
|
148
|
+
type: sse
|
149
|
+
url: "https://api.example.com/mcp"
|
150
|
+
```
|
151
|
+
|
152
|
+
### Tools
|
153
|
+
|
154
|
+
Specify which tools each instance can use:
|
155
|
+
|
156
|
+
```yaml
|
157
|
+
tools:
|
158
|
+
- Bash # Command execution
|
159
|
+
- Edit # File editing
|
160
|
+
- Write # File creation
|
161
|
+
- Read # File reading
|
162
|
+
- WebFetch # Fetch web content
|
163
|
+
- WebSearch # Search the web
|
164
|
+
```
|
165
|
+
|
166
|
+
Tools are passed to Claude using the `--allowedTools` flag with comma-separated values.
|
167
|
+
|
168
|
+
#### Tool Restrictions
|
169
|
+
|
170
|
+
You can restrict tools with pattern-based filters:
|
171
|
+
|
172
|
+
```yaml
|
173
|
+
tools:
|
174
|
+
- Read # Unrestricted read access
|
175
|
+
- Edit # Unrestricted edit access
|
176
|
+
- "Bash(npm:*)" # Only allow npm commands
|
177
|
+
- "Bash(git:*, make:*)" # Only allow git and make commands
|
178
|
+
```
|
179
|
+
|
180
|
+
### Examples
|
181
|
+
|
182
|
+
#### Full Stack Development Team
|
183
|
+
|
184
|
+
```yaml
|
185
|
+
version: 1
|
186
|
+
swarm:
|
187
|
+
name: "Full Stack Team"
|
188
|
+
main: architect
|
189
|
+
instances:
|
190
|
+
architect:
|
191
|
+
role: "Software Architect"
|
192
|
+
directory: .
|
193
|
+
model: opus
|
194
|
+
connections: [frontend, backend, devops]
|
195
|
+
prompt: "You are the lead architect responsible for system design and code quality"
|
196
|
+
tools:
|
197
|
+
- Read
|
198
|
+
- Edit
|
199
|
+
- WebSearch
|
200
|
+
|
201
|
+
frontend:
|
202
|
+
role: "Frontend Developer"
|
203
|
+
directory: ./frontend
|
204
|
+
model: sonnet
|
205
|
+
connections: [architect]
|
206
|
+
prompt: "You specialize in React, TypeScript, and modern frontend development"
|
207
|
+
tools:
|
208
|
+
- Edit
|
209
|
+
- Write
|
210
|
+
- Bash
|
211
|
+
|
212
|
+
backend:
|
213
|
+
role: "Backend Developer"
|
214
|
+
directory: ./backend
|
215
|
+
model: sonnet
|
216
|
+
connections: [architect, database]
|
217
|
+
tools:
|
218
|
+
- Edit
|
219
|
+
- Write
|
220
|
+
- Bash
|
221
|
+
|
222
|
+
database:
|
223
|
+
role: "Database Administrator"
|
224
|
+
directory: ./db
|
225
|
+
model: haiku
|
226
|
+
tools:
|
227
|
+
- Read
|
228
|
+
- Bash
|
229
|
+
|
230
|
+
devops:
|
231
|
+
role: "DevOps Engineer"
|
232
|
+
directory: .
|
233
|
+
model: sonnet
|
234
|
+
connections: [architect]
|
235
|
+
tools:
|
236
|
+
- Read
|
237
|
+
- Edit
|
238
|
+
- Bash
|
239
|
+
```
|
240
|
+
|
241
|
+
#### Research Team with External Tools
|
242
|
+
|
243
|
+
```yaml
|
244
|
+
version: 1
|
245
|
+
swarm:
|
246
|
+
name: "Research Team"
|
247
|
+
main: lead_researcher
|
248
|
+
instances:
|
249
|
+
lead_researcher:
|
250
|
+
role: "Lead Researcher"
|
251
|
+
directory: ~/research
|
252
|
+
model: opus
|
253
|
+
connections: [data_analyst, writer]
|
254
|
+
tools:
|
255
|
+
- Read
|
256
|
+
- WebSearch
|
257
|
+
- WebFetch
|
258
|
+
mcps:
|
259
|
+
- name: arxiv
|
260
|
+
type: sse
|
261
|
+
url: "https://arxiv-mcp.example.com"
|
262
|
+
|
263
|
+
data_analyst:
|
264
|
+
role: "Data Analyst"
|
265
|
+
directory: ~/research/data
|
266
|
+
model: sonnet
|
267
|
+
tools:
|
268
|
+
- Read
|
269
|
+
- Write
|
270
|
+
- Bash
|
271
|
+
mcps:
|
272
|
+
- name: jupyter
|
273
|
+
type: stdio
|
274
|
+
command: jupyter-mcp
|
275
|
+
args: ["--notebook-dir", "."]
|
276
|
+
|
277
|
+
writer:
|
278
|
+
role: "Technical Writer"
|
279
|
+
directory: ~/research/papers
|
280
|
+
model: sonnet
|
281
|
+
tools:
|
282
|
+
- Edit
|
283
|
+
- Write
|
284
|
+
- Read
|
285
|
+
```
|
286
|
+
|
287
|
+
### Command Line Options
|
288
|
+
|
289
|
+
```bash
|
290
|
+
# Use default claude-swarm.yml in current directory
|
291
|
+
claude-swarm
|
292
|
+
|
293
|
+
# Specify a different configuration file
|
294
|
+
claude-swarm --config my-swarm.yml
|
295
|
+
claude-swarm -c team-config.yml
|
296
|
+
|
297
|
+
# Run with --dangerously-skip-permissions for all instances
|
298
|
+
claude-swarm --vibe
|
299
|
+
|
300
|
+
# Show version
|
301
|
+
claude-swarm version
|
302
|
+
|
303
|
+
# Internal command for MCP server (used by connected instances)
|
304
|
+
claude-swarm mcp-serve INSTANCE_NAME --config CONFIG_FILE --session-timestamp TIMESTAMP
|
305
|
+
```
|
306
|
+
|
307
|
+
## How It Works
|
308
|
+
|
309
|
+
1. **Configuration Parsing**: Claude Swarm reads your YAML configuration and validates it
|
310
|
+
2. **MCP Generation**: For each instance, it generates an MCP configuration file that includes:
|
311
|
+
- Any explicitly defined MCP servers
|
312
|
+
- MCP servers for each connected instance (using `claude-swarm mcp-serve`)
|
313
|
+
3. **Session Management**: Claude Swarm maintains session continuity:
|
314
|
+
- Generates a shared session timestamp for all instances
|
315
|
+
- Each instance can maintain its own Claude session ID
|
316
|
+
- Sessions can be reset via the MCP server interface
|
317
|
+
4. **Main Instance Launch**: The main instance is launched with its MCP configuration, giving it access to all connected instances
|
318
|
+
5. **Inter-Instance Communication**: Connected instances expose themselves as MCP servers with these tools:
|
319
|
+
- **task**: Execute tasks using Claude Code with configurable tools and return results
|
320
|
+
- **session_info**: Get current Claude session information including ID and working directory
|
321
|
+
- **reset_session**: Reset the Claude session for a fresh start
|
322
|
+
6. **Centralized Logging**: All instances log to `.claude-swarm/logs/session-{timestamp}/` with detailed request/response tracking
|
323
|
+
|
324
|
+
## Troubleshooting
|
325
|
+
|
326
|
+
### Common Issues
|
327
|
+
|
328
|
+
**"Configuration file not found"**
|
329
|
+
- Ensure `claude-swarm.yml` exists in the current directory
|
330
|
+
- Or specify the path with `--config`
|
331
|
+
|
332
|
+
**"Main instance not found in instances"**
|
333
|
+
- Check that your `main:` field references a valid instance key
|
334
|
+
|
335
|
+
**"Unknown instance in connections"**
|
336
|
+
- Verify all instances in `connections:` arrays are defined
|
337
|
+
|
338
|
+
**Permission Errors**
|
339
|
+
- Ensure Claude CLI is properly installed and accessible
|
340
|
+
- Check directory permissions for specified paths
|
341
|
+
|
342
|
+
### Debug Output
|
343
|
+
|
344
|
+
The swarm will display:
|
345
|
+
- Generated MCP configuration location
|
346
|
+
- Main instance details (model, directory, tools, connections)
|
347
|
+
- The exact command being run
|
348
|
+
|
349
|
+
### Logs
|
350
|
+
|
351
|
+
Check the centralized logs in `.claude-swarm/logs/session-{timestamp}/` for:
|
352
|
+
- Individual instance logs
|
353
|
+
- MCP server communication
|
354
|
+
- Error messages and debugging information
|
355
|
+
|
356
|
+
## Architecture
|
357
|
+
|
358
|
+
Claude Swarm consists of these core components:
|
359
|
+
|
360
|
+
- **ClaudeSwarm::CLI** (`cli.rb`): Thor-based command-line interface with `start` and `mcp-serve` commands
|
361
|
+
- **ClaudeSwarm::Configuration** (`configuration.rb`): YAML parser and validator with path expansion
|
362
|
+
- **ClaudeSwarm::McpGenerator** (`mcp_generator.rb`): Generates MCP JSON configs for each instance
|
363
|
+
- **ClaudeSwarm::Orchestrator** (`orchestrator.rb`): Launches the main Claude instance with shared session management
|
364
|
+
- **ClaudeSwarm::ClaudeCodeExecutor** (`claude_code_executor.rb`): Wrapper for executing Claude commands with session persistence
|
365
|
+
- **ClaudeSwarm::ClaudeMcpServer** (`claude_mcp_server.rb`): FastMCP-based server providing task execution, session info, and reset capabilities
|
366
|
+
|
367
|
+
## Development
|
368
|
+
|
369
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
370
|
+
|
371
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
372
|
+
|
373
|
+
### Development Commands
|
374
|
+
|
375
|
+
```bash
|
376
|
+
bin/setup # Install dependencies
|
377
|
+
rake test # Run the Minitest test suite
|
378
|
+
rake rubocop -A # Run RuboCop linter with auto-fix
|
379
|
+
bin/console # Start IRB session with gem loaded
|
380
|
+
bundle exec rake install # Install gem locally
|
381
|
+
bundle exec rake release # Release gem to RubyGems.org
|
382
|
+
rake # Default: runs both tests and RuboCop
|
383
|
+
```
|
384
|
+
|
385
|
+
## Contributing
|
386
|
+
|
387
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/parruda/claude-swarm.
|
388
|
+
|
389
|
+
## License
|
390
|
+
|
391
|
+
The gem is available as open source under the terms of the [MIT License](LICENSE).
|
data/Rakefile
ADDED
data/claude-swarm.yml
ADDED
@@ -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."
|