@desplega.ai/agent-swarm 1.2.1 → 1.9.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.
Files changed (119) hide show
  1. package/.claude/settings.local.json +20 -1
  2. package/.env.docker.example +22 -1
  3. package/.env.example +17 -0
  4. package/.github/workflows/docker-publish.yml +92 -0
  5. package/CONTRIBUTING.md +270 -0
  6. package/DEPLOYMENT.md +391 -0
  7. package/Dockerfile.worker +29 -1
  8. package/FAQ.md +19 -0
  9. package/LICENSE +21 -0
  10. package/MCP.md +249 -0
  11. package/README.md +103 -207
  12. package/assets/agent-swarm-logo-orange.png +0 -0
  13. package/assets/agent-swarm-logo.png +0 -0
  14. package/docker-compose.example.yml +137 -0
  15. package/docker-entrypoint.sh +223 -7
  16. package/package.json +8 -3
  17. package/{cc-plugin → plugin}/.claude-plugin/plugin.json +1 -1
  18. package/plugin/README.md +1 -0
  19. package/plugin/agents/.gitkeep +0 -0
  20. package/plugin/agents/codebase-analyzer.md +143 -0
  21. package/plugin/agents/codebase-locator.md +122 -0
  22. package/plugin/agents/codebase-pattern-finder.md +227 -0
  23. package/plugin/agents/web-search-researcher.md +109 -0
  24. package/plugin/commands/create-plan.md +415 -0
  25. package/plugin/commands/implement-plan.md +89 -0
  26. package/plugin/commands/research.md +200 -0
  27. package/plugin/commands/start-leader.md +101 -0
  28. package/plugin/commands/start-worker.md +56 -0
  29. package/plugin/commands/swarm-chat.md +78 -0
  30. package/plugin/commands/todos.md +66 -0
  31. package/plugin/commands/work-on-task.md +44 -0
  32. package/plugin/skills/.gitkeep +0 -0
  33. package/scripts/generate-mcp-docs.ts +415 -0
  34. package/slack-manifest.json +69 -0
  35. package/src/be/db.ts +1431 -25
  36. package/src/cli.tsx +135 -11
  37. package/src/commands/lead.ts +13 -0
  38. package/src/commands/runner.ts +255 -0
  39. package/src/commands/worker.ts +8 -220
  40. package/src/hooks/hook.ts +102 -14
  41. package/src/http.ts +361 -5
  42. package/src/prompts/base-prompt.ts +131 -0
  43. package/src/server.ts +56 -0
  44. package/src/slack/app.ts +73 -0
  45. package/src/slack/commands.ts +88 -0
  46. package/src/slack/handlers.ts +281 -0
  47. package/src/slack/index.ts +3 -0
  48. package/src/slack/responses.ts +175 -0
  49. package/src/slack/router.ts +170 -0
  50. package/src/slack/types.ts +20 -0
  51. package/src/slack/watcher.ts +119 -0
  52. package/src/tools/create-channel.ts +80 -0
  53. package/src/tools/get-tasks.ts +54 -21
  54. package/src/tools/join-swarm.ts +28 -4
  55. package/src/tools/list-channels.ts +37 -0
  56. package/src/tools/list-services.ts +110 -0
  57. package/src/tools/poll-task.ts +46 -3
  58. package/src/tools/post-message.ts +87 -0
  59. package/src/tools/read-messages.ts +192 -0
  60. package/src/tools/register-service.ts +118 -0
  61. package/src/tools/send-task.ts +80 -7
  62. package/src/tools/store-progress.ts +9 -3
  63. package/src/tools/task-action.ts +211 -0
  64. package/src/tools/unregister-service.ts +110 -0
  65. package/src/tools/update-profile.ts +105 -0
  66. package/src/tools/update-service-status.ts +118 -0
  67. package/src/types.ts +110 -3
  68. package/src/utils/pretty-print.ts +224 -0
  69. package/thoughts/shared/plans/.gitkeep +0 -0
  70. package/thoughts/shared/plans/2025-12-18-inverse-teleport.md +1142 -0
  71. package/thoughts/shared/plans/2025-12-18-slack-integration.md +1195 -0
  72. package/thoughts/shared/plans/2025-12-19-agent-log-streaming.md +732 -0
  73. package/thoughts/shared/plans/2025-12-19-role-based-swarm-plugin.md +361 -0
  74. package/thoughts/shared/plans/2025-12-20-mobile-responsive-ui.md +501 -0
  75. package/thoughts/shared/plans/2025-12-20-startup-team-swarm.md +560 -0
  76. package/thoughts/shared/research/.gitkeep +0 -0
  77. package/thoughts/shared/research/2025-12-18-slack-integration.md +442 -0
  78. package/thoughts/shared/research/2025-12-19-agent-log-streaming.md +339 -0
  79. package/thoughts/shared/research/2025-12-19-agent-secrets-cli-research.md +390 -0
  80. package/thoughts/shared/research/2025-12-21-gemini-cli-integration.md +376 -0
  81. package/thoughts/shared/research/2025-12-22-setup-experience-improvements.md +264 -0
  82. package/tsconfig.json +3 -1
  83. package/ui/bun.lock +692 -0
  84. package/ui/index.html +22 -0
  85. package/ui/package.json +32 -0
  86. package/ui/pnpm-lock.yaml +3034 -0
  87. package/ui/postcss.config.js +6 -0
  88. package/ui/public/logo.png +0 -0
  89. package/ui/src/App.tsx +43 -0
  90. package/ui/src/components/ActivityFeed.tsx +415 -0
  91. package/ui/src/components/AgentDetailPanel.tsx +534 -0
  92. package/ui/src/components/AgentsPanel.tsx +549 -0
  93. package/ui/src/components/ChatPanel.tsx +1820 -0
  94. package/ui/src/components/ConfigModal.tsx +232 -0
  95. package/ui/src/components/Dashboard.tsx +534 -0
  96. package/ui/src/components/Header.tsx +168 -0
  97. package/ui/src/components/ServicesPanel.tsx +612 -0
  98. package/ui/src/components/StatsBar.tsx +288 -0
  99. package/ui/src/components/StatusBadge.tsx +124 -0
  100. package/ui/src/components/TaskDetailPanel.tsx +807 -0
  101. package/ui/src/components/TasksPanel.tsx +575 -0
  102. package/ui/src/hooks/queries.ts +170 -0
  103. package/ui/src/index.css +235 -0
  104. package/ui/src/lib/api.ts +161 -0
  105. package/ui/src/lib/config.ts +35 -0
  106. package/ui/src/lib/theme.ts +214 -0
  107. package/ui/src/lib/utils.ts +48 -0
  108. package/ui/src/main.tsx +32 -0
  109. package/ui/src/types/api.ts +164 -0
  110. package/ui/src/vite-env.d.ts +1 -0
  111. package/ui/tailwind.config.js +35 -0
  112. package/ui/tsconfig.json +31 -0
  113. package/ui/vite.config.ts +22 -0
  114. package/cc-plugin/README.md +0 -49
  115. package/cc-plugin/commands/setup-leader.md +0 -73
  116. package/cc-plugin/commands/start-worker.md +0 -64
  117. package/docker-compose.worker.yml +0 -35
  118. package/example-req-meta.json +0 -24
  119. /package/{cc-plugin → plugin}/hooks/hooks.json +0 -0
package/MCP.md ADDED
@@ -0,0 +1,249 @@
1
+ # MCP Tools Reference
2
+
3
+ > Auto-generated from source. Do not edit manually.
4
+ > Run `bun run docs:mcp` to regenerate.
5
+
6
+ ## Table of Contents
7
+
8
+ - [Core Tools](#core-tools)
9
+ - [join-swarm](#join-swarm)
10
+ - [poll-task](#poll-task)
11
+ - [get-swarm](#get-swarm)
12
+ - [get-tasks](#get-tasks)
13
+ - [send-task](#send-task)
14
+ - [get-task-details](#get-task-details)
15
+ - [store-progress](#store-progress)
16
+ - [my-agent-info](#my-agent-info)
17
+ - [Task Pool Tools](#task-pool-tools)
18
+ - [task-action](#task-action)
19
+ - [Messaging Tools](#messaging-tools)
20
+ - [list-channels](#list-channels)
21
+ - [create-channel](#create-channel)
22
+ - [post-message](#post-message)
23
+ - [read-messages](#read-messages)
24
+ - [Profiles Tools](#profiles-tools)
25
+ - [update-profile](#update-profile)
26
+ - [Services Tools](#services-tools)
27
+ - [register-service](#register-service)
28
+ - [unregister-service](#unregister-service)
29
+ - [list-services](#list-services)
30
+ - [update-service-status](#update-service-status)
31
+
32
+ ---
33
+
34
+ ## Core Tools
35
+
36
+ *Always available tools for basic swarm operations.*
37
+
38
+ ### join-swarm
39
+
40
+ **Join the agent swarm**
41
+
42
+ Tool for an agent to join the swarm of agents with optional profile information.
43
+
44
+ | Parameter | Type | Required | Default | Description |
45
+ |-----------|------|----------|---------|-------------|
46
+ | `lead` | `boolean` | No | false | Whether this agent should be the lead. |
47
+ | `name` | `string` | Yes | - | The name of the agent joining the swarm. |
48
+ | `description` | `string` | No | - | Agent description. |
49
+
50
+ ### poll-task
51
+
52
+ **Poll for a task**
53
+
54
+ Poll for a new task assignment. Returns immediately if there are offered tasks awaiting accept/reject. Also returns count of unassigned tasks in the pool.
55
+
56
+ *No parameters*
57
+
58
+ ### get-swarm
59
+
60
+ **Get the agent swarm**
61
+
62
+ Returns a list of agents in the swarm without their tasks.
63
+
64
+ | Parameter | Type | Required | Default | Description |
65
+ |-----------|------|----------|---------|-------------|
66
+ | `a` | `string` | No | - | - |
67
+
68
+ ### get-tasks
69
+
70
+ **Get tasks**
71
+
72
+ Returns a list of tasks in the swarm with various filters. Sorted by priority (desc) then lastUpdatedAt (desc).
73
+
74
+ | Parameter | Type | Required | Default | Description |
75
+ |-----------|------|----------|---------|-------------|
76
+ | `mineOnly` | `boolean` | No | - | Only return tasks assigned to you. |
77
+ | `unassigned` | `boolean` | No | - | Only return unassigned tasks in the pool. |
78
+ | `readyOnly` | `boolean` | No | - | Only return tasks whose dependencies are met. |
79
+ | `taskType` | `string` | No | - | Filter by task type (e.g., 'bug', 'feature |
80
+ | `tags` | `array` | No | - | Filter by any matching tag. |
81
+ | `search` | `string` | No | - | Search in task description. |
82
+
83
+ ### send-task
84
+
85
+ **Send a task**
86
+
87
+ Sends a task to a specific agent, creates an unassigned task for the pool, or offers a task for acceptance.
88
+
89
+ | Parameter | Type | Required | Default | Description |
90
+ |-----------|------|----------|---------|-------------|
91
+ | `task` | `string` | Yes | - | The task description to send. |
92
+ | `dependsOn` | `array` | No | - | Task IDs this task depends on. |
93
+
94
+ ### get-task-details
95
+
96
+ **Get task details**
97
+
98
+ Returns detailed information about a specific task, including output, failure reason, and log history.
99
+
100
+ | Parameter | Type | Required | Default | Description |
101
+ |-----------|------|----------|---------|-------------|
102
+ | `taskId` | `uuid` | Yes | - | The ID of the task to get details for. |
103
+
104
+ ### store-progress
105
+
106
+ **Store task progress**
107
+
108
+ Stores the progress of a specific task. Can also mark task as completed or failed, which will set the agent back to idle.
109
+
110
+ | Parameter | Type | Required | Default | Description |
111
+ |-----------|------|----------|---------|-------------|
112
+ | `taskId` | `uuid` | Yes | - | The ID of the task to update progress for. |
113
+ | `progress` | `string` | No | - | The progress update to store. |
114
+ | `output` | `string` | No | - | The output of the task (used when completing). |
115
+
116
+ ### my-agent-info
117
+
118
+ **Get your agent info**
119
+
120
+ Returns your agent ID based on the X-Agent-ID header.
121
+
122
+ *No parameters*
123
+
124
+ ## Task Pool Tools
125
+
126
+ *Messaging*
127
+
128
+ ### task-action
129
+
130
+ **Task Pool Actions**
131
+
132
+ Perform task pool operations: create unassigned tasks, claim/release tasks from pool, accept/reject offered tasks.
133
+
134
+ | Parameter | Type | Required | Default | Description |
135
+ |-----------|------|----------|---------|-------------|
136
+ | `taskType` | `string` | No | - | Task type (e.g., 'bug', 'feature |
137
+ | `dependsOn` | `array` | No | - | Task IDs this task depends on. |
138
+
139
+ ## Messaging Tools
140
+
141
+ *Messaging*
142
+
143
+ ### list-channels
144
+
145
+ **List Channels**
146
+
147
+ Lists all available channels for cross-agent communication.
148
+
149
+ *No parameters*
150
+
151
+ ### create-channel
152
+
153
+ **Create Channel**
154
+
155
+ Creates a new channel for cross-agent communication.
156
+
157
+ | Parameter | Type | Required | Default | Description |
158
+ |-----------|------|----------|---------|-------------|
159
+ | `name` | `string` | Yes | - | Channel name (must be unique). |
160
+ | `description` | `string` | No | - | Channel description. |
161
+ | `participants` | `array` | No | - | Agent IDs for DM channels. |
162
+
163
+ ### post-message
164
+
165
+ **Post Message**
166
+
167
+ Posts a message to a channel for cross-agent communication.
168
+
169
+ | Parameter | Type | Required | Default | Description |
170
+ |-----------|------|----------|---------|-------------|
171
+ | `channel` | `string` | No | "general" | Channel name (default: 'general |
172
+ | `content` | `string` | Yes | - | Message content. |
173
+ | `replyTo` | `uuid` | No | - | Message ID to reply to (for threading). |
174
+
175
+ ### read-messages
176
+
177
+ **Read Messages**
178
+
179
+ Reads messages from a channel. If no channel is specified, returns unread messages from ALL channels. Supports filtering by unread, mentions, and time range. Automatically marks messages as read.
180
+
181
+ | Parameter | Type | Required | Default | Description |
182
+ |-----------|------|----------|---------|-------------|
183
+ | `since` | `unknown` | No | - | Only messages after this ISO timestamp. |
184
+ | `unreadOnly` | `boolean` | No | false | Only return unread messages. |
185
+
186
+ ## Profiles Tools
187
+
188
+ *Profiles*
189
+
190
+ ### update-profile
191
+
192
+ **Update Profile**
193
+
194
+ Updates the calling agent's profile information (description, role, capabilities).
195
+
196
+ | Parameter | Type | Required | Default | Description |
197
+ |-----------|------|----------|---------|-------------|
198
+ | `description` | `string` | No | - | Agent description. |
199
+
200
+ ## Services Tools
201
+
202
+ *Services*
203
+
204
+ ### register-service
205
+
206
+ **Register Service**
207
+
208
+ Register a background service (e.g., PM2 process) for discovery by other agents. The service URL is automatically derived from your agent ID (https://{AGENT_ID}.{SWARM_URL}). Each agent can only run one service on port 3000.
209
+
210
+ | Parameter | Type | Required | Default | Description |
211
+ |-----------|------|----------|---------|-------------|
212
+ | `script` | `string` | Yes | - | Path to the script to run (required for PM2 restart). |
213
+ | `description` | `string` | No | - | What this service does. |
214
+ | `cwd` | `string` | No | - | Working directory for the script. |
215
+ | `args` | `array` | No | - | Command line arguments for the script. |
216
+ | `metadata` | `object` | No | - | Additional metadata. |
217
+
218
+ ### unregister-service
219
+
220
+ **Unregister Service**
221
+
222
+ Remove a service from the registry. Use this after stopping a PM2 process. You can only unregister your own services.
223
+
224
+ | Parameter | Type | Required | Default | Description |
225
+ |-----------|------|----------|---------|-------------|
226
+ | `serviceId` | `uuid` | No | - | Service ID to unregister. |
227
+
228
+ ### list-services
229
+
230
+ **List Services**
231
+
232
+ Query services registered by agents in the swarm. Use this to discover services exposed by other agents.
233
+
234
+ | Parameter | Type | Required | Default | Description |
235
+ |-----------|------|----------|---------|-------------|
236
+ | `agentId` | `uuid` | No | - | Filter by specific agent ID. |
237
+ | `name` | `string` | No | - | Filter by service name (partial match). |
238
+
239
+ ### update-service-status
240
+
241
+ **Update Service Status**
242
+
243
+ Update the health status of a registered service. Use this after a service becomes healthy or needs to be marked as stopped/unhealthy.
244
+
245
+ | Parameter | Type | Required | Default | Description |
246
+ |-----------|------|----------|---------|-------------|
247
+ | `serviceId` | `uuid` | No | - | Service ID to update. |
248
+ | `name` | `string` | No | - | Service name to update (alternative to serviceId). |
249
+
package/README.md CHANGED
@@ -1,282 +1,178 @@
1
1
  # Agent Swarm MCP
2
2
 
3
+ <p align="center">
4
+ <img src="assets/agent-swarm.png" alt="Agent Swarm" width="800">
5
+ </p>
6
+
3
7
  > Agent orchestration layer MCP for Claude Code, Codex, Gemini CLI, and more!
4
8
 
5
- ## Overview
9
+ ## Table of Contents
6
10
 
7
- Agent Swarm MCP enables multi-agent coordination for AI coding assistants. It provides tools for agents to join a swarm, receive tasks, report progress, and coordinate with a lead agent.
11
+ - [What is Agent Swarm?](#what-is-agent-swarm)
12
+ - [Quick Start](#quick-start)
13
+ - [CLI Commands](#cli-commands)
14
+ - [Deployment](#deployment)
15
+ - [Documentation](#documentation)
16
+ - [License](#license)
8
17
 
9
- ## Quick Start
18
+ ---
10
19
 
11
- ### Setup (Recommended)
20
+ ## What is Agent Swarm?
12
21
 
13
- Run the setup command in your project directory:
22
+ Agent Swarm MCP enables multi-agent coordination for AI coding assistants. It provides:
14
23
 
15
- ```bash
16
- bunx @desplega.ai/agent-swarm@latest setup
17
- ```
24
+ - **Task Management** - Assign, track, and coordinate tasks across agents
25
+ - **Agent Communication** - Channel-based messaging between agents
26
+ - **Service Discovery** - Register and discover background services
27
+ - **Docker Workers** - Run isolated Claude workers in containers
28
+ - **Lead/Worker Pattern** - Coordinate work with a lead agent and multiple workers
18
29
 
19
- This will:
20
- - Create `.claude` directory and `settings.local.json` if needed
21
- - Create `.mcp.json` if needed
22
- - Add entries to `.gitignore`
23
- - Configure permissions and hooks
24
- - Prompt for your API token and Agent ID
25
-
26
- Options:
27
- - `--dry-run` - Preview changes without writing
28
- - `--restore` - Restore files from `.bak` backups
29
-
30
- ### Manual Installation
31
-
32
- Add to your `.mcp.json`:
33
-
34
- ```json
35
- {
36
- "mcpServers": {
37
- "agent-swarm": {
38
- "type": "http",
39
- "url": "https://agent-swarm-mcp.desplega.sh/mcp",
40
- "headers": {
41
- "Authorization": "Bearer <your-token>",
42
- "X-Agent-ID": "<your-agent-id>"
43
- }
44
- }
45
- }
46
- }
47
- ```
30
+ ---
48
31
 
49
- or for Claude Code, use:
32
+ ## Quick Start
50
33
 
51
- ```bash
52
- claude mcp add --transport http agent-swarm https://agent-swarm-mcp.desplega.sh/mcp --header "Authorization: Bearer <your-token>" --header "X-Agent-ID: <your-agent-id>"
53
- ```
34
+ The recommended setup: run the API locally, run a Docker worker, and connect Claude Code as the lead agent.
54
35
 
55
- Note: By default it will be installed locally (in ~/.claude.json) so add a `--scope project` to install in the current project's `.mcp.json` (recommended for better control).
36
+ ### Prerequisites
56
37
 
57
- For other tools, you can check this [generator page with most of commands](https://v0-mcp-commands.vercel.app/?type=http&name=agent-swarm&url=https%3A%2F%2Fagent-swarm-mcp.desplega.sh%2Fmcp&headers=Authorization%3DBearer+%3Ctoken%3E%2CX-Agent-ID%3D%3Cagent_uuid%3E).
38
+ - [Bun](https://bun.sh) (or Node.js 22+)
39
+ - [Docker](https://docker.com)
40
+ - [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code)
58
41
 
59
- ## CLI Commands
42
+ ### 1. Clone & Install
60
43
 
61
44
  ```bash
62
- # Run setup wizard
63
- bunx @desplega.ai/agent-swarm setup
64
-
65
- # Preview setup changes
66
- bunx @desplega.ai/agent-swarm setup --dry-run
67
-
68
- # Restore from backups
69
- bunx @desplega.ai/agent-swarm setup --restore
70
-
71
- # Start MCP HTTP server (for self-hosting)
72
- bunx @desplega.ai/agent-swarm mcp
73
- bunx @desplega.ai/agent-swarm mcp --port 8080 --key my-api-key
74
-
75
- # Run Claude CLI with swarm integration
76
- bunx @desplega.ai/agent-swarm claude
77
- bunx @desplega.ai/agent-swarm claude --headless -m "Hello"
78
-
79
- # Hook handler (called by Claude Code hooks)
80
- bunx @desplega.ai/agent-swarm hook
81
-
82
- # Show help
83
- bunx @desplega.ai/agent-swarm help
45
+ git clone https://github.com/desplega-ai/agent-swarm.git
46
+ cd agent-swarm
47
+ bun install
84
48
  ```
85
49
 
86
- ## Docker Worker
87
-
88
- Run Claude as a containerized worker agent in the swarm.
50
+ ### 2. Configure Environment
89
51
 
90
- ### Pull from Registry
52
+ **For the API server:**
91
53
 
92
54
  ```bash
93
- docker pull ghcr.io/desplega-ai/agent-swarm-worker:latest
55
+ cp .env.example .env
94
56
  ```
95
57
 
96
- ### Build Locally
97
-
98
- ```bash
99
- # Build the worker image
100
- docker build -f Dockerfile.worker -t agent-swarm-worker .
101
-
102
- # Or using npm script
103
- bun run docker:build:worker
104
- ```
58
+ Required in `.env`:
59
+ - `API_KEY` - Secret key for API authentication (can be left empty, e.g. for local-only setups)
105
60
 
106
- ### Run
61
+ **For Docker workers:**
107
62
 
108
63
  ```bash
109
- # Using pre-built image from GHCR
110
- docker run --rm -it \
111
- -e CLAUDE_CODE_OAUTH_TOKEN=your-token \
112
- -e API_KEY=your-api-key \
113
- -v ./logs:/logs \
114
- -v ./work:/workspace \
115
- ghcr.io/desplega-ai/agent-swarm-worker
116
-
117
- # Or using locally built image
118
- docker run --rm -it \
119
- -e CLAUDE_CODE_OAUTH_TOKEN=your-token \
120
- -e API_KEY=your-api-key \
121
- -v ./logs:/logs \
122
- -v ./work:/workspace \
123
- agent-swarm-worker
124
-
125
- # Using docker-compose
126
- docker-compose -f docker-compose.worker.yml up
127
-
128
- # Using npm script (requires .env.docker file)
129
- bun run docker:run:worker
64
+ cp .env.docker.example .env.docker
130
65
  ```
131
66
 
132
- ### Environment Variables (Docker)
67
+ Required in `.env.docker`:
68
+ - `API_KEY` - Same key as the API server
69
+ - `CLAUDE_CODE_OAUTH_TOKEN` - Run `claude setup-token` to get this
133
70
 
134
- | Variable | Required | Description |
135
- |----------|----------|-------------|
136
- | `CLAUDE_CODE_OAUTH_TOKEN` | Yes | OAuth token for Claude CLI |
137
- | `API_KEY` | Yes | API key for MCP server |
138
- | `AGENT_ID` | No | Agent UUID (assigned on join if not set) |
139
- | `MCP_BASE_URL` | No | MCP server URL (default: `http://host.docker.internal:3013`) |
140
- | `SESSION_ID` | No | Log folder name (auto-generated if not provided) |
141
- | `WORKER_YOLO` | No | Continue on errors (default: `false`) |
71
+ > See `.env.example` and `.env.docker.example` for additional optional variables.
142
72
 
143
- ### Architecture
73
+ ### 3. Start the API Server
144
74
 
145
- The Docker worker image is built using a multi-stage build:
146
-
147
- 1. **Builder stage**: Compiles `src/cli.tsx` into a standalone binary using Bun
148
- 2. **Runtime stage**: Ubuntu 24.04 with full development environment
75
+ ```bash
76
+ bun run start:http
77
+ ```
149
78
 
150
- **Pre-installed tools:**
151
- - **Languages**: Python 3, Node.js 22, Bun
152
- - **Build tools**: gcc, g++, make, cmake
153
- - **Utilities**: git, git-lfs, vim, nano, jq, curl, wget, ssh
154
- - **Sudo access**: Worker can install packages with `sudo apt-get install`
79
+ The MCP server runs at `http://localhost:3013`.
155
80
 
156
- **Volumes:**
157
- - `/workspace` - Working directory for cloning repos (mount `./work:/workspace` for persistence)
158
- - `/logs` - Session logs (mount `./logs:/logs` for persistence)
81
+ ### 4. Run a Docker Worker
159
82
 
160
- ### Publishing (Maintainers)
83
+ In a new terminal:
161
84
 
162
85
  ```bash
163
- # Requires gh CLI authenticated
164
- bun deploy/docker-push.ts
86
+ bun run docker:build:worker
87
+ mkdir -p ./logs ./work/shared ./work/worker-1
88
+ bun run docker:run:worker
165
89
  ```
166
90
 
167
- This builds, tags with version from package.json + `latest`, and pushes to GHCR.
168
-
169
- ## Environment Variables
170
-
171
- | Variable | Description | Default |
172
- |----------|-------------|---------|
173
- | `MCP_BASE_URL` | Base URL for the MCP server | `https://agent-swarm-mcp.desplega.sh` |
174
- | `PORT` | Port for self-hosted MCP server | `3013` |
175
- | `API_KEY` | API key for server authentication | - |
91
+ The worker joins the swarm and waits for tasks.
176
92
 
177
- ## Server Deployment
93
+ #### Note
178
94
 
179
- Deploy the MCP server to a Linux host with systemd.
95
+ We automatically build a Docker image for Claude Code workers: `ghcr.io/desplega-ai/agent-swarm-worker:latest`.
180
96
 
181
- ### Prerequisites
182
-
183
- - Linux with systemd
184
- - Bun installed (`curl -fsSL https://bun.sh/install | bash`)
97
+ ### 5. Connect Claude Code as Lead
185
98
 
186
- ### Install
99
+ In your project directory:
187
100
 
188
101
  ```bash
189
- git clone https://github.com/desplega-ai/agent-swarm.git
190
- cd agent-swarm
191
- sudo bun deploy/install.ts
102
+ bunx @desplega.ai/agent-swarm setup
192
103
  ```
193
104
 
194
- This will:
195
- - Copy files to `/opt/agent-swarm`
196
- - Create `.env` file (edit to set `API_KEY`)
197
- - Install systemd service with health checks every 30s
198
- - Start the service on port 3013
199
-
200
- ### Update
105
+ This configures Claude Code to connect to the swarm. Then start Claude Code normally and mention the following:
201
106
 
202
- After pulling new changes:
203
-
204
- ```bash
205
- git pull
206
- sudo bun deploy/update.ts
107
+ ```
108
+ Register yourself as the lead agent in the agent-swarm MCP.
207
109
  ```
208
110
 
209
- ### Management
111
+ This will be a one-time setup, to make sure you are registered as the lead agent in the swarm, using the provided API key and agent ID (optional).
210
112
 
211
- ```bash
212
- # Check status
213
- sudo systemctl status agent-swarm
113
+ #### Notes
214
114
 
215
- # View logs
216
- sudo journalctl -u agent-swarm -f
115
+ - The `setup` command will automatically back-up the updated files, in case you want to revert later (using `--restore`).
116
+ - Use `--dry-run` to preview changes without applying them.
217
117
 
218
- # Restart
219
- sudo systemctl restart agent-swarm
118
+ ---
220
119
 
221
- # Stop
222
- sudo systemctl stop agent-swarm
223
- ```
120
+ ## CLI Commands
224
121
 
225
- ## Development
122
+ > We will be publishing the package to npm as `@desplega.ai/agent-swarm` on each new tag bump of the [`package.json`](./package.json).
226
123
 
227
- Install dependencies:
228
124
 
229
- ```bash
230
- bun install
231
- ```
125
+ | Command | Description |
126
+ |---------|-------------|
127
+ | `setup` | Initialize agent-swarm in a project |
128
+ | `mcp` | Start the MCP HTTP server |
129
+ | `worker` | Run Claude as a worker agent |
130
+ | `lead` | Run Claude as a lead agent |
131
+ | `hook` | Handle Claude Code hook events |
132
+ | `help` | Show help message |
232
133
 
233
- Run the STDIO server:
134
+ ### Examples
234
135
 
235
136
  ```bash
236
- bun run start
237
- ```
137
+ # Setup wizard
138
+ bunx @desplega.ai/agent-swarm setup
238
139
 
239
- Run the HTTP server:
140
+ # Start MCP & API server on custom port
141
+ bunx @desplega.ai/agent-swarm mcp --port 8080 --key my-api-key
240
142
 
241
- ```bash
242
- bun run start:http
143
+ # Run worker with custom system prompt (not in docker!!! beware)
144
+ bunx @desplega.ai/agent-swarm worker --system-prompt "You are a Python specialist"
145
+
146
+ # Run lead agent in the background (without human-in-the-loop mode via MCP client)
147
+ bunx @desplega.ai/agent-swarm lead
243
148
  ```
244
149
 
245
- Run with hot reload:
150
+ ---
246
151
 
247
- ```bash
248
- bun run dev # STDIO
249
- bun run dev:http # HTTP
250
- ```
152
+ ## Deployment
251
153
 
252
- Run the MCP inspector:
154
+ For production deployments, see [`docker-compose.example.yml`](./docker-compose.example.yml) which sets up:
253
155
 
254
- ```bash
255
- bun run inspector # STDIO
256
- bun run inspector:http # HTTP
257
- ```
156
+ - API service (MCP HTTP server)
157
+ - Multiple worker agents
158
+ - Lead agent
159
+ - Shared volumes for logs and workspaces
258
160
 
259
- Run the CLI locally:
161
+ Full deployment options are documented in [DEPLOYMENT.md](./DEPLOYMENT.md).
260
162
 
261
- ```bash
262
- bun run cli setup
263
- bun run cli setup --dry-run
264
- bun run hook # Hook handler
265
- ```
163
+ ---
266
164
 
267
- ## MCP Tools
165
+ ## Documentation
268
166
 
269
- The server provides these tools for agent coordination:
167
+ | Document | Description |
168
+ |----------|-------------|
169
+ | [DEPLOYMENT.md](./DEPLOYMENT.md) | Docker, Docker Compose, systemd deployment |
170
+ | [CONTRIBUTING.md](./CONTRIBUTING.md) | Development setup, code quality, project structure |
171
+ | [MCP.md](./MCP.md) | MCP tools reference (auto-generated) |
172
+ | [FAQ.md](./FAQ.md) | Frequently asked questions |
270
173
 
271
- - `join-swarm` - Register an agent in the swarm
272
- - `poll-task` - Poll for assigned tasks (worker agents)
273
- - `send-task` - Assign a task to an agent (lead agent)
274
- - `get-swarm` - List all agents in the swarm
275
- - `get-tasks` - List tasks filtered by status
276
- - `get-task-details` - Get detailed info about a task
277
- - `store-progress` - Update task progress or mark complete/failed
278
- - `my-agent-info` - Get current agent's info
174
+ ---
279
175
 
280
176
  ## License
281
177
 
282
- MIT License, 2025-2026 (c) desplega.ai
178
+ [MIT License](./LICENSE) - 2025-2026 desplega.ai
Binary file