claude_swarm 0.1.14 → 0.1.15
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 +4 -4
- data/CHANGELOG.md +7 -0
- data/EXAMPLES.md +164 -0
- data/README.md +1 -1
- data/example/test-generation.yml +2 -5
- data/lib/claude_swarm/claude_mcp_server.rb +1 -1
- data/lib/claude_swarm/permission_mcp_server.rb +1 -1
- data/lib/claude_swarm/permission_tool.rb +1 -1
- data/lib/claude_swarm/task_tool.rb +2 -1
- data/lib/claude_swarm/version.rb +1 -1
- data/llms.txt +384 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc1ac6dbcc7eac54e907f574c827580275e147e42e92122d467809addb614ae9
|
4
|
+
data.tar.gz: d579b2a49bc0323c4704736597c1d3a9bf8e24a29c0bfe63bd21969560b4dbf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20398e7167acc7f88c611da67a0d613fbfba9e225701c5dd1681f2a2ffac12bd81bbf9e4463c45564df0046edd17f3a299edbfedd1c79b0a463127c53853283f
|
7
|
+
data.tar.gz: be84c91452a5cc0e00ec725e9e4f3a75b8e4b94f72438a796a3a6e8f787c4c8a2c46ad857bb661c50971c2fda25ca51fe2e25fc650c3025001292dba054f293b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [0.1.15]
|
2
|
+
|
3
|
+
### Changed
|
4
|
+
- **Dependency update**: Switched from `fast-mcp` to `fast-mcp-annotations` for improved tool annotation support
|
5
|
+
- **Task tool annotations**: Added read-only, non-destructive, and closed-world hints to the task tool to allow parallel execution
|
6
|
+
- Change the task tool description to say there's no description parameter, so claude does not try to send it.
|
7
|
+
|
1
8
|
## [0.1.14]
|
2
9
|
|
3
10
|
### Changed
|
data/EXAMPLES.md
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
## Draft use case
|
2
|
+
|
3
|
+
Imagine you're working in the storefront-web repository. Page load times doubled yesterday. You're not sure why.
|
4
|
+
|
5
|
+
To investigate today you'd use a generalized Claude. It has access to dozens of MCP tools. Tools to read data from BigQuery. Tools to crawl repositories. Tools to checkout code it needs. Tools for GitHub interactions. Tools for Kafka. Tools for file operations.
|
6
|
+
|
7
|
+
You need to query BigQuery to pinpoint when the performance degraded. You also need to check recent gem upgrades. But Claude doesn't know which gem repositories to look at. You have to provide context about where to find gem source code. You have to guide it through vendor directories or gem installation paths.
|
8
|
+
|
9
|
+
Claude might be able to do this. But with dozens of MCP tools loaded and lots of context it can be overwhelmed and unfocused. It struggles to pick the right tools. It struggles to understand which repos to read. It struggles to keep context in mind while switching between data analysis and code exploration.
|
10
|
+
|
11
|
+
## Enter Claude-Swarm
|
12
|
+
|
13
|
+
```
|
14
|
+
Without Swarm: With Claude-Swarm:
|
15
|
+
|
16
|
+
┌──────────────────────────────┐ ┌─────────────────────────────────┐
|
17
|
+
│ You │ │ You │
|
18
|
+
└──────────────┬───────────────┘ └──────────────┬──────────────────┘
|
19
|
+
│ │
|
20
|
+
v v
|
21
|
+
┌──────────────────────────────┐ ┌─────────────────────────────────┐
|
22
|
+
│ Generalized Claude │ │ Coordinator │
|
23
|
+
│ │ │ │
|
24
|
+
│ [30+ MCP Tools] │ │ [Task delegation] │
|
25
|
+
│ • BigQuery tools │ └──────────────┬──────────────────┘
|
26
|
+
│ • File tools │ │
|
27
|
+
│ • Git tools │ ┌──────────────┼──────────────────┐
|
28
|
+
│ • GitHub tools │ │ │ │
|
29
|
+
│ • Kafka tools │ v v v
|
30
|
+
│ • ... │ ┌────────┐ ┌────────┐ ┌────────┐
|
31
|
+
│ │ │Data │ │Code │ │PR │
|
32
|
+
│ Overwhelmed & │ │Expert │ │Expert │ │Expert │
|
33
|
+
│ Context switching │ │[BQ] │ │[Files] │ │[GitHub]│
|
34
|
+
└──────────────────────────────┘ └────────┘ └────────┘ └────────┘
|
35
|
+
```
|
36
|
+
|
37
|
+
Claude-swarm is one AI that can hire specialist AIs. Each specialist lives in one domain. You talk to the manager not the specialists. Manager coordinates and gives you answers.
|
38
|
+
|
39
|
+
It's NOT multiple AIs running at once. It's ONE AI with "summon expert" superpowers. Experts appear and answer questions. Then they disappear.
|
40
|
+
|
41
|
+
## Three Key Features
|
42
|
+
|
43
|
+
### Domain Isolation
|
44
|
+
- Data expert can pull BigQuery and performance metrics
|
45
|
+
- Code expert lives in gem source directory
|
46
|
+
- PR Expert only cares about writing a quality PR
|
47
|
+
- Each expert focused on their domain. Each expert with custom context and prompts.
|
48
|
+
|
49
|
+
### Selective Tool Access
|
50
|
+
- Data expert ONLY gets BigQuery and Kafka tools (prompt it with best practices and context for querying)
|
51
|
+
- Code expert ONLY gets file and git tools. It instantiates in a specific repo (Prompt it and provide it special context)
|
52
|
+
- PR expert ONLY gets PR/GH tools. Can prompt it with best practices for PR submissions/context
|
53
|
+
|
54
|
+
### Coordinated Intelligence
|
55
|
+
- You ask one question
|
56
|
+
- Get answers from multiple domains, each with specialized context and prompts
|
57
|
+
- "Why are pages loading slowly?"
|
58
|
+
- Data expert finds timing spike at 2pm yesterday
|
59
|
+
- Code expert finds the problem
|
60
|
+
- Code expert fixes the problem
|
61
|
+
- PR Expert creates the PR with your specifications
|
62
|
+
|
63
|
+
## Example Configuration
|
64
|
+
|
65
|
+
```yaml
|
66
|
+
version: 1
|
67
|
+
swarm:
|
68
|
+
name: "Performance Investigation"
|
69
|
+
main: coordinator
|
70
|
+
instances:
|
71
|
+
coordinator:
|
72
|
+
description: "Lead developer coordinating performance investigation"
|
73
|
+
directory: ~/storefront-web
|
74
|
+
connections: [data_expert, code_expert, pr_expert]
|
75
|
+
prompt: |
|
76
|
+
You are a senior lead developer coordinating a performance investigation team.
|
77
|
+
Your role is to delegate tasks to specialists and synthesize their findings.
|
78
|
+
|
79
|
+
When investigating performance issues:
|
80
|
+
1. Start with data_expert to identify when/where problems occurred
|
81
|
+
2. Use code_expert to analyze code changes and identify root causes
|
82
|
+
3. Use pr_expert to implement fixes via pull requests
|
83
|
+
|
84
|
+
Always provide clear, actionable summaries to the user.
|
85
|
+
|
86
|
+
data_expert:
|
87
|
+
description: "Analyzes performance metrics and data"
|
88
|
+
directory: ~/analysis
|
89
|
+
tools: [data_mcp_portal_find_tables, data_mcp_portal_query]
|
90
|
+
prompt: |
|
91
|
+
You are a data analyst specializing in web performance metrics.
|
92
|
+
You have access to BigQuery and performance monitoring data.
|
93
|
+
|
94
|
+
When analyzing performance issues:
|
95
|
+
- Always use partition filters (date-based) to limit query scope
|
96
|
+
- Look for correlations between timing spikes and deployments
|
97
|
+
- Focus on p95/p99 latencies, not just averages
|
98
|
+
- Identify affected user segments and geographic regions
|
99
|
+
|
100
|
+
Provide specific timestamps and quantified impact metrics.
|
101
|
+
|
102
|
+
code_expert:
|
103
|
+
description: "Analyzes code, dependencies, and implementations"
|
104
|
+
directory: ~/gems/http-client
|
105
|
+
tools: [read, grep, glob, git]
|
106
|
+
prompt: |
|
107
|
+
You are a senior Ruby developer specializing in performance optimization.
|
108
|
+
You work primarily with gems, dependencies, and low-level implementations.
|
109
|
+
|
110
|
+
When investigating performance issues:
|
111
|
+
- Check recent version changes in Gemfile.lock
|
112
|
+
- Look for connection pooling, caching, and resource management patterns
|
113
|
+
- Identify blocking I/O operations and inefficient algorithms
|
114
|
+
- Consider memory allocation and garbage collection impacts
|
115
|
+
|
116
|
+
Focus on actionable code-level fixes and configuration changes.
|
117
|
+
|
118
|
+
pr_expert:
|
119
|
+
description: "Creates high-quality pull requests"
|
120
|
+
directory: ~/storefront-web
|
121
|
+
tools: [read, write, gh_cli, git]
|
122
|
+
prompt: |
|
123
|
+
You are a senior developer focused on creating excellent pull requests.
|
124
|
+
|
125
|
+
For performance fixes:
|
126
|
+
- Write clear, specific titles: "Fix: Enable HTTP connection pooling for 40% latency reduction"
|
127
|
+
- Include before/after performance metrics in description
|
128
|
+
- Add links to supporting data analysis
|
129
|
+
- Include deployment considerations and rollback plans
|
130
|
+
- Add relevant reviewers based on affected systems
|
131
|
+
|
132
|
+
Always follow the team's PR template and coding standards.
|
133
|
+
```
|
134
|
+
|
135
|
+
## Investigation and Fix Flow
|
136
|
+
|
137
|
+
**You:** "Why are pages loading slowly?"
|
138
|
+
|
139
|
+
**Coordinator asks data_expert:** "When did latency spike and what's the impact?"
|
140
|
+
|
141
|
+
**Data expert:**
|
142
|
+
```sql
|
143
|
+
-- Query shows latency spike at 2:15 PM yesterday
|
144
|
+
-- P95 response time increased from 250ms to 890ms
|
145
|
+
-- Affecting 15% of traffic, primarily checkout flows
|
146
|
+
```
|
147
|
+
|
148
|
+
**Coordinator asks code_expert:** "What changed around 2:15 PM yesterday that could cause this?"
|
149
|
+
|
150
|
+
**Code expert:**
|
151
|
+
```ruby
|
152
|
+
# Gemfile.lock shows http-client gem updated from 3.1.9 to 3.2.0 at 2:14 PM
|
153
|
+
# Version 3.2.0 changelog: "Removed automatic connection pooling for thread safety"
|
154
|
+
# Now creates new HTTP connection per request instead of reusing connections
|
155
|
+
```
|
156
|
+
|
157
|
+
**Coordinator:** "The http-client gem update removed connection pooling, causing 3x latency increase during checkout."
|
158
|
+
|
159
|
+
**You:** "Fix this and create a PR"
|
160
|
+
|
161
|
+
**Code expert:** "Two options: downgrade to 3.1.9 or configure explicit pooling with `pool_size: 10` in initializer"
|
162
|
+
|
163
|
+
**PR expert:** "Created PR #1234: 'Fix: Enable HTTP connection pooling for 40% latency reduction' with performance benchmarks and rollback plan"
|
164
|
+
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Claude Swarm
|
2
2
|
|
3
|
-
[](https://badge.fury.io/rb/claude_swarm)
|
4
4
|
[](https://github.com/parruda/claude-swarm/actions/workflows/ci.yml)
|
5
5
|
|
6
6
|
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.
|
data/example/test-generation.yml
CHANGED
@@ -36,7 +36,7 @@ swarm:
|
|
36
36
|
description: "Unit test specialist focusing on models, services, and isolated business logic with Minitest"
|
37
37
|
directory: ./spec
|
38
38
|
model: opus
|
39
|
-
connections: [
|
39
|
+
connections: [factory_specialist]
|
40
40
|
prompt: |
|
41
41
|
You are a Rails unit testing expert specializing in Minitest. Your focus areas:
|
42
42
|
|
@@ -76,7 +76,7 @@ swarm:
|
|
76
76
|
description: "Integration test specialist for controllers, API endpoints, and request specs"
|
77
77
|
directory: ./spec
|
78
78
|
model: opus
|
79
|
-
connections: [
|
79
|
+
connections: [factory_specialist]
|
80
80
|
prompt: |
|
81
81
|
You are a Rails integration testing expert focusing on request specs and controller tests. Your expertise:
|
82
82
|
|
@@ -117,7 +117,6 @@ swarm:
|
|
117
117
|
description: "System test specialist for end-to-end user flows and JavaScript interactions"
|
118
118
|
directory: ./spec/system
|
119
119
|
model: opus
|
120
|
-
connections: [test_architect]
|
121
120
|
prompt: |
|
122
121
|
You are a Rails system testing expert using Capybara and Selenium. Your specialization:
|
123
122
|
|
@@ -161,7 +160,6 @@ swarm:
|
|
161
160
|
description: "Test data specialist managing factories, traits, and test data generation"
|
162
161
|
directory: ./spec/factories
|
163
162
|
model: opus
|
164
|
-
connections: [test_architect, unit_test_expert, integration_test_expert]
|
165
163
|
prompt: |
|
166
164
|
You are a Rails test data expert specializing in FactoryBot. Your responsibilities:
|
167
165
|
|
@@ -206,7 +204,6 @@ swarm:
|
|
206
204
|
description: "Test quality assurance specialist ensuring best practices, coverage, and maintainability"
|
207
205
|
directory: .
|
208
206
|
model: opus
|
209
|
-
connections: [test_architect]
|
210
207
|
prompt: |
|
211
208
|
You are a Rails test quality reviewer ensuring all tests meet the highest standards. Your review criteria:
|
212
209
|
|
@@ -3,7 +3,8 @@
|
|
3
3
|
module ClaudeSwarm
|
4
4
|
class TaskTool < FastMcp::Tool
|
5
5
|
tool_name "task"
|
6
|
-
description "Execute a task using Claude Code"
|
6
|
+
description "Execute a task using Claude Code. There is no description parameter."
|
7
|
+
annotations(readOnlyHint: true, openWorldHint: false, destructiveHint: false)
|
7
8
|
|
8
9
|
arguments do
|
9
10
|
required(:prompt).filled(:string).description("The task or question for the agent")
|
data/lib/claude_swarm/version.rb
CHANGED
data/llms.txt
ADDED
@@ -0,0 +1,384 @@
|
|
1
|
+
# claude-swarm
|
2
|
+
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).
|
3
|
+
## Purpose
|
4
|
+
claude-swarm allows you to:
|
5
|
+
- Create teams of specialized AI agents working together
|
6
|
+
- Restrict tool access per agent for safety and focus
|
7
|
+
- Organize agents in tree-like hierarchies for delegation
|
8
|
+
- Maintain separate working directories per agent
|
9
|
+
- Enable inter-agent communication via MCP protocol
|
10
|
+
- Track sessions and restore previous swarm states
|
11
|
+
## Installation
|
12
|
+
```bash
|
13
|
+
# Install via RubyGems
|
14
|
+
gem install claude_swarm
|
15
|
+
# Or add to Gemfile
|
16
|
+
gem 'claude_swarm'
|
17
|
+
bundle install
|
18
|
+
```
|
19
|
+
### Prerequisites
|
20
|
+
- Ruby 3.2.0 or higher
|
21
|
+
- Claude CLI installed and configured (`claude` command available)
|
22
|
+
- Any MCP servers you plan to use (optional)
|
23
|
+
## Quick Start
|
24
|
+
1. Initialize a configuration:
|
25
|
+
```bash
|
26
|
+
claude-swarm init
|
27
|
+
```
|
28
|
+
2. Or create `claude-swarm.yml`:
|
29
|
+
```yaml
|
30
|
+
version: 1
|
31
|
+
swarm:
|
32
|
+
name: "My Dev Team"
|
33
|
+
main: lead
|
34
|
+
instances:
|
35
|
+
lead:
|
36
|
+
description: "Team lead coordinating development"
|
37
|
+
directory: .
|
38
|
+
model: opus
|
39
|
+
connections: [frontend, backend]
|
40
|
+
allowed_tools: [Read, Edit, Bash]
|
41
|
+
prompt: "You coordinate the team"
|
42
|
+
frontend:
|
43
|
+
description: "Frontend developer"
|
44
|
+
directory: ./frontend
|
45
|
+
model: sonnet
|
46
|
+
allowed_tools: [Read, Edit, Write, "Bash(npm:*)"]
|
47
|
+
```
|
48
|
+
3. Start the swarm:
|
49
|
+
```bash
|
50
|
+
claude-swarm
|
51
|
+
claude-swarm --vibe # Allow all tools (dangerous!)
|
52
|
+
```
|
53
|
+
## Key Concepts
|
54
|
+
### Swarm
|
55
|
+
A collection of Claude instances (agents) working together. One instance is designated as "main" - the entry point that coordinates others.
|
56
|
+
### Instance
|
57
|
+
An individual Claude Code agent with:
|
58
|
+
- **description** (required): Role and responsibilities
|
59
|
+
- **directory**: Working directory context
|
60
|
+
- **model**: Claude model (opus/sonnet/haiku)
|
61
|
+
- **connections**: Other instances it can delegate to
|
62
|
+
- **allowed_tools**: Tools this instance can use
|
63
|
+
- **disallowed_tools**: Explicitly denied tools (override allowed)
|
64
|
+
- **prompt**: Custom system prompt
|
65
|
+
- **vibe**: Skip permission checks for this instance
|
66
|
+
- **mcps**: Additional MCP servers
|
67
|
+
### MCP (Model Context Protocol)
|
68
|
+
Protocol enabling Claude to use external tools. claude-swarm uses MCP for:
|
69
|
+
- Inter-instance communication (task delegation)
|
70
|
+
- Permission management
|
71
|
+
- Additional tool integration
|
72
|
+
## Configuration Format
|
73
|
+
```yaml
|
74
|
+
version: 1
|
75
|
+
swarm:
|
76
|
+
name: "Swarm Name"
|
77
|
+
main: instance_key # Entry point instance
|
78
|
+
instances:
|
79
|
+
instance_name:
|
80
|
+
description: "Agent role description" # REQUIRED
|
81
|
+
directory: ~/path/to/dir # Working directory
|
82
|
+
model: opus # opus/sonnet/haiku
|
83
|
+
connections: [other1, other2] # Connected instances
|
84
|
+
prompt: "Custom system prompt" # Additional instructions
|
85
|
+
vibe: false # Skip permissions (default: false)
|
86
|
+
allowed_tools: # Tools this instance can use
|
87
|
+
- Read
|
88
|
+
- Edit
|
89
|
+
- Write
|
90
|
+
- Bash
|
91
|
+
- WebSearch
|
92
|
+
- WebFetch
|
93
|
+
disallowed_tools: # Explicitly deny patterns
|
94
|
+
- "Write(*.log)"
|
95
|
+
- "Bash(rm:*)"
|
96
|
+
mcps: # Additional MCP servers
|
97
|
+
- name: database
|
98
|
+
type: stdio
|
99
|
+
command: /path/to/mcp
|
100
|
+
args: ["--flag"]
|
101
|
+
env:
|
102
|
+
API_KEY: "value"
|
103
|
+
- name: api
|
104
|
+
type: sse
|
105
|
+
url: https://example.com/mcp
|
106
|
+
```
|
107
|
+
## Tool Patterns
|
108
|
+
Tools can be restricted using patterns:
|
109
|
+
- `Bash(npm:*)` - Only npm commands in Bash
|
110
|
+
- `Write(*.md)` - Only write markdown files
|
111
|
+
- `mcp__frontend__*` - All frontend MCP tools
|
112
|
+
- `Read` - Unrestricted Read tool
|
113
|
+
Disallowed tools always override allowed tools.
|
114
|
+
## Inter-Instance Communication
|
115
|
+
Instances communicate via the `task` tool exposed by connected instances:
|
116
|
+
### Task Tool
|
117
|
+
When instance A connects to instance B, A can use:
|
118
|
+
```
|
119
|
+
mcp__B__task
|
120
|
+
```
|
121
|
+
**Parameters:**
|
122
|
+
- `prompt` (required): The task or question for the agent
|
123
|
+
- `new_session` (optional): Start fresh session (default: false)
|
124
|
+
- `system_prompt` (optional): Override system prompt for this request
|
125
|
+
**Example Usage:**
|
126
|
+
```
|
127
|
+
Main instance: "Please analyze the frontend performance"
|
128
|
+
→ Uses mcp__frontend__task with prompt "Analyze performance bottlenecks"
|
129
|
+
→ Frontend instance executes with its tools and returns results
|
130
|
+
```
|
131
|
+
### Session Info Tool
|
132
|
+
```
|
133
|
+
mcp__B__session_info
|
134
|
+
```
|
135
|
+
Returns current Claude session ID and working directory.
|
136
|
+
### Reset Session Tool
|
137
|
+
```
|
138
|
+
mcp__B__reset_session
|
139
|
+
```
|
140
|
+
Resets the Claude session for a fresh start.
|
141
|
+
## Commands
|
142
|
+
### Start Swarm
|
143
|
+
```bash
|
144
|
+
# Default configuration
|
145
|
+
claude-swarm
|
146
|
+
# Custom configuration
|
147
|
+
claude-swarm --config team.yml
|
148
|
+
claude-swarm -c my-swarm.yml
|
149
|
+
# Skip all permissions (dangerous!)
|
150
|
+
claude-swarm --vibe
|
151
|
+
# Non-interactive mode with prompt
|
152
|
+
claude-swarm -p "Build a login feature"
|
153
|
+
claude-swarm --prompt "Fix the bug" --stream-logs
|
154
|
+
# Resume session
|
155
|
+
claude-swarm --session-id 20241225_120000
|
156
|
+
claude-swarm --session-id ~/.claude-swarm/sessions/project/20241225_120000
|
157
|
+
```
|
158
|
+
### List Sessions
|
159
|
+
```bash
|
160
|
+
# List recent sessions (default: 10)
|
161
|
+
claude-swarm list-sessions
|
162
|
+
# List more sessions
|
163
|
+
claude-swarm list-sessions --limit 20
|
164
|
+
# List for specific project
|
165
|
+
claude-swarm list-sessions --project myapp
|
166
|
+
```
|
167
|
+
### Other Commands
|
168
|
+
```bash
|
169
|
+
# Initialize starter config
|
170
|
+
claude-swarm init
|
171
|
+
# Show version
|
172
|
+
claude-swarm version
|
173
|
+
# Start permission MCP server (for testing)
|
174
|
+
claude-swarm tools-mcp --allowed-tools 'Read,Edit,mcp__*'
|
175
|
+
# Internal MCP serve command (used by swarm)
|
176
|
+
claude-swarm mcp-serve -n NAME -d DIR -m MODEL [options]
|
177
|
+
```
|
178
|
+
## Session Management
|
179
|
+
### Session Structure
|
180
|
+
Sessions are stored in `~/.claude-swarm/sessions/{project}/{timestamp}/`:
|
181
|
+
```
|
182
|
+
20241225_143022/
|
183
|
+
├── config.yml # Swarm configuration used
|
184
|
+
├── state/ # Instance states
|
185
|
+
│ ├── lead_abc123.json # Lead instance state
|
186
|
+
│ └── frontend_def456.json # Frontend instance state
|
187
|
+
├── lead.mcp.json # MCP configurations
|
188
|
+
├── frontend.mcp.json
|
189
|
+
├── session.log # Human-readable logs
|
190
|
+
├── session.log.json # JSONL format events
|
191
|
+
└── permissions.log # Permission decisions
|
192
|
+
```
|
193
|
+
### Session Files
|
194
|
+
- **config.yml**: Copy of swarm configuration
|
195
|
+
- **state/*.json**: Claude session IDs for each instance
|
196
|
+
- **session.log**: Request/response tracking
|
197
|
+
- **session.log.json**: All events in JSONL format
|
198
|
+
- **permissions.log**: Tool permission checks
|
199
|
+
### Restoring Sessions (Experimental)
|
200
|
+
```bash
|
201
|
+
claude-swarm --session-id 20241225_143022
|
202
|
+
```
|
203
|
+
**Limitations:**
|
204
|
+
- Main instance conversation context not fully restored
|
205
|
+
- Only session IDs preserved, not full state
|
206
|
+
- Connected instances restore more reliably
|
207
|
+
## Debugging
|
208
|
+
### Enable Debug Output
|
209
|
+
```bash
|
210
|
+
claude-swarm --debug
|
211
|
+
```
|
212
|
+
### Check Logs
|
213
|
+
```bash
|
214
|
+
# Session logs
|
215
|
+
cat ~/.claude-swarm/sessions/PROJECT/TIMESTAMP/session.log
|
216
|
+
cat ~/.claude-swarm/sessions/PROJECT/TIMESTAMP/permissions.log
|
217
|
+
# JSONL events
|
218
|
+
cat ~/.claude-swarm/sessions/PROJECT/TIMESTAMP/session.log.json
|
219
|
+
```
|
220
|
+
### Common Issues
|
221
|
+
**"Configuration file not found"**
|
222
|
+
- Ensure `claude-swarm.yml` exists
|
223
|
+
- Or use `--config path/to/config.yml`
|
224
|
+
**"Main instance not found"**
|
225
|
+
- Check `main:` references valid instance key
|
226
|
+
**"Circular dependency detected"**
|
227
|
+
- Remove circular connections between instances
|
228
|
+
**"Permission denied for tool X"**
|
229
|
+
- Check `allowed_tools` includes the tool
|
230
|
+
- Check `disallowed_tools` doesn't block it
|
231
|
+
- Use `--vibe` to skip permissions (dangerous)
|
232
|
+
**"MCP server failed to start"**
|
233
|
+
- Check the command/URL is correct
|
234
|
+
- Verify MCP server is installed
|
235
|
+
- Check logs for error details
|
236
|
+
## Common Patterns
|
237
|
+
### Full-Stack Team
|
238
|
+
```yaml
|
239
|
+
instances:
|
240
|
+
architect:
|
241
|
+
description: "System architect"
|
242
|
+
connections: [frontend_lead, backend_lead, devops]
|
243
|
+
frontend_lead:
|
244
|
+
description: "Frontend team lead"
|
245
|
+
connections: [ui_dev, ux_designer]
|
246
|
+
backend_lead:
|
247
|
+
description: "Backend team lead"
|
248
|
+
connections: [api_dev, db_admin]
|
249
|
+
```
|
250
|
+
### Investigation Team
|
251
|
+
```yaml
|
252
|
+
instances:
|
253
|
+
investigator:
|
254
|
+
description: "Lead investigator"
|
255
|
+
connections: [data_analyst, code_expert, test_runner]
|
256
|
+
data_analyst:
|
257
|
+
description: "Analyzes metrics and logs"
|
258
|
+
allowed_tools: ["Bash(grep:*, awk:*)", Read]
|
259
|
+
code_expert:
|
260
|
+
description: "Reviews code changes"
|
261
|
+
allowed_tools: [Read, Grep, Glob]
|
262
|
+
```
|
263
|
+
### Mixed Permissions
|
264
|
+
```yaml
|
265
|
+
instances:
|
266
|
+
trusted_lead:
|
267
|
+
description: "Trusted lead with full access"
|
268
|
+
vibe: true # Skip all permission checks
|
269
|
+
restricted_worker:
|
270
|
+
description: "Limited access worker"
|
271
|
+
allowed_tools: [Read] # Read-only access
|
272
|
+
normal_worker:
|
273
|
+
description: "Standard developer"
|
274
|
+
allowed_tools: [Read, Edit, Write]
|
275
|
+
```
|
276
|
+
## Complete Example
|
277
|
+
### Performance Investigation Swarm
|
278
|
+
```yaml
|
279
|
+
version: 1
|
280
|
+
swarm:
|
281
|
+
name: "Performance Investigation"
|
282
|
+
main: coordinator
|
283
|
+
instances:
|
284
|
+
coordinator:
|
285
|
+
description: "Coordinates performance investigation"
|
286
|
+
directory: ~/projects/webapp
|
287
|
+
model: opus
|
288
|
+
connections: [metrics_analyst, code_reviewer, fix_implementer]
|
289
|
+
allowed_tools: [Read]
|
290
|
+
prompt: |
|
291
|
+
You coordinate a performance investigation team.
|
292
|
+
1. Use metrics_analyst to identify when/where issues occur
|
293
|
+
2. Use code_reviewer to find root causes
|
294
|
+
3. Use fix_implementer to create solutions
|
295
|
+
|
296
|
+
metrics_analyst:
|
297
|
+
description: "Analyzes performance metrics"
|
298
|
+
directory: ~/projects/webapp/logs
|
299
|
+
model: sonnet
|
300
|
+
allowed_tools: [Read, "Bash(grep:*, awk:*, sort:*)"]
|
301
|
+
prompt: |
|
302
|
+
You analyze logs and metrics for performance issues.
|
303
|
+
Focus on response times, error rates, and patterns.
|
304
|
+
|
305
|
+
code_reviewer:
|
306
|
+
description: "Reviews code for performance issues"
|
307
|
+
directory: ~/projects/webapp/src
|
308
|
+
model: opus
|
309
|
+
allowed_tools: [Read, Grep, Glob]
|
310
|
+
prompt: |
|
311
|
+
You review code for performance bottlenecks.
|
312
|
+
Look for N+1 queries, missing indexes, inefficient algorithms.
|
313
|
+
|
314
|
+
fix_implementer:
|
315
|
+
description: "Implements performance fixes"
|
316
|
+
directory: ~/projects/webapp
|
317
|
+
model: opus
|
318
|
+
allowed_tools: [Read, Edit, Write, Bash]
|
319
|
+
prompt: |
|
320
|
+
You implement optimizations and fixes.
|
321
|
+
Always add tests and measure improvements.
|
322
|
+
```
|
323
|
+
### Usage Flow
|
324
|
+
1. **User**: "The checkout page is slow"
|
325
|
+
2. **Coordinator** → **metrics_analyst**: "Find checkout performance metrics"
|
326
|
+
3. **Metrics analyst** returns: "Latency spike at 2pm, 3x increase"
|
327
|
+
4. **Coordinator** → **code_reviewer**: "What changed around 2pm?"
|
328
|
+
5. **Code reviewer** returns: "HTTP client gem updated, removed connection pooling"
|
329
|
+
6. **Coordinator** → **fix_implementer**: "Add connection pooling configuration"
|
330
|
+
7. **Fix implementer**: Creates fix and tests
|
331
|
+
## How It Works
|
332
|
+
1. **Configuration Parsing**: Validates YAML and expands paths
|
333
|
+
2. **MCP Generation**: Creates MCP configs in `.claude-swarm/`
|
334
|
+
3. **Permission Setup**: Adds permission MCP server (unless vibe mode)
|
335
|
+
4. **Instance Launch**: Starts main instance with connections
|
336
|
+
5. **Task Delegation**: Main instance uses mcp__instance__task tools
|
337
|
+
6. **Session Tracking**: All activity logged to session directory
|
338
|
+
## Development
|
339
|
+
```bash
|
340
|
+
# Setup
|
341
|
+
bin/setup
|
342
|
+
# Run tests
|
343
|
+
rake test
|
344
|
+
# Lint code
|
345
|
+
rake rubocop -A
|
346
|
+
# Console
|
347
|
+
bin/console
|
348
|
+
# Install locally
|
349
|
+
bundle exec rake install
|
350
|
+
# Release to RubyGems
|
351
|
+
bundle exec rake release
|
352
|
+
```
|
353
|
+
## Architecture
|
354
|
+
- **CLI** (`cli.rb`): Thor-based commands
|
355
|
+
- **Configuration** (`configuration.rb`): YAML parser/validator
|
356
|
+
- **McpGenerator** (`mcp_generator.rb`): Creates MCP JSON configs
|
357
|
+
- **Orchestrator** (`orchestrator.rb`): Launches main instance
|
358
|
+
- **ClaudeCodeExecutor** (`claude_code_executor.rb`): Executes Claude
|
359
|
+
- **ClaudeMcpServer** (`claude_mcp_server.rb`): Inter-instance MCP
|
360
|
+
- **PermissionMcpServer** (`permission_mcp_server.rb`): Tool permissions
|
361
|
+
## Environment Variables
|
362
|
+
- `CLAUDE_SWARM_HOME`: Override session storage location (default: ~/.claude-swarm)
|
363
|
+
- `ANTHROPIC_MODEL`: Default Claude model if not specified
|
364
|
+
## Security Considerations
|
365
|
+
- Tool restrictions enforced at permission layer
|
366
|
+
- All permissions logged for audit
|
367
|
+
- Vibe mode bypasses ALL restrictions - use carefully
|
368
|
+
- Session files may contain sensitive data
|
369
|
+
- Each instance runs with its directory context
|
370
|
+
- MCP servers inherit instance permissions
|
371
|
+
## Limitations
|
372
|
+
- Tree hierarchy only (no circular dependencies)
|
373
|
+
- Session restoration is experimental
|
374
|
+
- Main instance context not fully preserved
|
375
|
+
- All paths expand relative to execution directory
|
376
|
+
- MCP servers must support required protocol
|
377
|
+
## Best Practices
|
378
|
+
1. **Clear Descriptions**: Help agents understand their roles
|
379
|
+
2. **Focused Tools**: Give each instance only needed tools
|
380
|
+
3. **Directory Context**: Place instances in relevant directories
|
381
|
+
4. **Prompt Engineering**: Use prompts to guide behavior
|
382
|
+
5. **Test Configurations**: Start simple, add complexity gradually
|
383
|
+
6. **Monitor Logs**: Check session logs for issues
|
384
|
+
7. **Use Vibe Sparingly**: Only for trusted operations
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: claude_swarm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paulo Arruda
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- !ruby/object:Gem::Version
|
25
25
|
version: '1.3'
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
|
-
name: fast-mcp
|
27
|
+
name: fast-mcp-annotations
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
30
|
- - ">="
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- ".ruby-version"
|
55
55
|
- CHANGELOG.md
|
56
56
|
- CLAUDE.md
|
57
|
+
- EXAMPLES.md
|
57
58
|
- LICENSE
|
58
59
|
- README.md
|
59
60
|
- RELEASING.md
|
@@ -79,6 +80,7 @@ files:
|
|
79
80
|
- lib/claude_swarm/session_path.rb
|
80
81
|
- lib/claude_swarm/task_tool.rb
|
81
82
|
- lib/claude_swarm/version.rb
|
83
|
+
- llms.txt
|
82
84
|
- sdk-docs.md
|
83
85
|
homepage: https://github.com/parruda/claude-swarm
|
84
86
|
licenses: []
|