@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
@@ -0,0 +1,361 @@
1
+ # Role-Based Agent Swarm Plugin Implementation Plan
2
+
3
+ ## Overview
4
+
5
+ Extend the agent-swarm plugin to support specialized worker and lead roles (Developer, Tester, PM, Reviewer, Marketer for workers; Founder, CEO, PM for leads) with role-specific commands, agents, and system prompts.
6
+
7
+ ## Current State Analysis
8
+
9
+ - **Commands**: 2 generic commands (`setup-leader.md`, `start-worker.md`)
10
+ - **Agents**: Empty directory (`.gitkeep` only)
11
+ - **Copying**: All files in `cc-plugin/commands/` and `cc-plugin/agents/` are copied to container
12
+ - **Roles**: Only `lead` and `worker` via `AGENT_ROLE` env var
13
+
14
+ ### Key Discoveries:
15
+ - Docker entrypoint: `docker-entrypoint.sh` creates `.mcp.json` dynamically
16
+ - Dockerfile.worker copies `cc-plugin/commands/*` to `/home/worker/.claude/commands/`
17
+ - Runner uses `defaultPrompt` from config: `src/commands/worker.ts:8`, `src/commands/lead.ts:8`
18
+ - System prompts passed via `--append-system-prompt` flag: `src/commands/runner.ts:56-58`
19
+
20
+ ## Desired End State
21
+
22
+ 1. Role-organized directory structure under `cc-plugin/`
23
+ 2. New env var `WORKER_TYPE` / `LEAD_TYPE` to select role-specific content
24
+ 3. Docker entrypoint selects appropriate commands/agents based on role type
25
+ 4. System prompt templates in `prompts/` directory
26
+ 5. Entry point command uses role-specific command (e.g., `/developer-worker` instead of `/start-worker`)
27
+ 6. Base plugin agents (codebase-analyzer, codebase-locator, etc.) available to all roles
28
+
29
+ ### Verification:
30
+ - Build container with `WORKER_TYPE=tester` and verify only tester commands/agents are active
31
+ - Run `/developer-worker` command and confirm it uses correct system prompt
32
+ - All roles have access to base plugin agents
33
+
34
+ ## What We're NOT Doing
35
+
36
+ - **Changing lead/worker hierarchy** - Keep existing `AGENT_ROLE` distinction
37
+ - **Multi-plugin architecture** - All roles stay in agent-swarm plugin
38
+ - **Runtime role switching** - Role is set at container start, not changeable
39
+ - **Complex role inheritance** - Each role is independent, no inheritance chain
40
+
41
+ ## Implementation Approach
42
+
43
+ Directory-based role organization with Docker entrypoint selecting content at startup based on environment variables. Commands trigger role-specific behavior, agents provide specialized capabilities.
44
+
45
+ ---
46
+
47
+ ## Phase 1: Directory Structure and Common Commands
48
+
49
+ ### Overview
50
+ Reorganize `cc-plugin/` with role-based subdirectories.
51
+
52
+ ### Changes Required:
53
+
54
+ #### 1. Create directory structure
55
+
56
+ ```
57
+ cc-plugin/
58
+ ├── commands/
59
+ │ ├── common/ # Shared by all roles
60
+ │ │ ├── setup-leader.md # (move existing)
61
+ │ │ └── start-worker.md # (move existing)
62
+ │ ├── lead/
63
+ │ │ ├── founder/
64
+ │ │ │ └── founder-lead.md
65
+ │ │ ├── ceo/
66
+ │ │ │ └── ceo-lead.md
67
+ │ │ └── pm/
68
+ │ │ └── pm-lead.md
69
+ │ └── worker/
70
+ │ ├── developer/
71
+ │ │ └── developer-worker.md
72
+ │ ├── tester/
73
+ │ │ └── tester-worker.md
74
+ │ ├── reviewer/
75
+ │ │ └── reviewer-worker.md
76
+ │ ├── pm/
77
+ │ │ └── pm-worker.md
78
+ │ └── marketer/
79
+ │ └── marketer-worker.md
80
+ ├── agents/
81
+ │ ├── common/
82
+ │ │ └── task-reporter.md
83
+ │ ├── developer/
84
+ │ │ ├── code-implementer.md
85
+ │ │ └── refactorer.md
86
+ │ ├── tester/
87
+ │ │ ├── test-generator.md
88
+ │ │ └── test-runner.md
89
+ │ ├── reviewer/
90
+ │ │ └── code-reviewer.md
91
+ │ ├── pm/
92
+ │ │ └── task-planner.md
93
+ │ └── marketer/
94
+ │ └── content-creator.md
95
+ ├── prompts/
96
+ │ ├── lead/
97
+ │ │ ├── founder.txt
98
+ │ │ ├── ceo.txt
99
+ │ │ └── pm.txt
100
+ │ └── worker/
101
+ │ ├── developer.txt
102
+ │ ├── tester.txt
103
+ │ ├── reviewer.txt
104
+ │ ├── pm.txt
105
+ │ └── marketer.txt
106
+ └── hooks/
107
+ └── hooks.json
108
+ ```
109
+
110
+ ### Success Criteria:
111
+
112
+ #### Automated Verification:
113
+ - [ ] `ls cc-plugin/commands/common/` shows `setup-leader.md`, `start-worker.md`
114
+ - [ ] `ls cc-plugin/commands/worker/*/` shows role subdirectories
115
+
116
+ #### Manual Verification:
117
+ - [ ] Directory structure matches specification
118
+
119
+ ---
120
+
121
+ ## Phase 2: Create Role-Specific Commands
122
+
123
+ ### Overview
124
+ Create specialized commands for each worker and lead type.
125
+
126
+ ### Changes Required:
127
+
128
+ #### Worker Commands:
129
+
130
+ **`commands/worker/developer/developer-worker.md`**
131
+ - Focus on code implementation
132
+ - Uses `code-implementer` and `refactorer` agents
133
+ - Extends base `start-worker` behavior
134
+
135
+ **`commands/worker/tester/tester-worker.md`**
136
+ - Focus on test writing and QA
137
+ - Uses `test-generator` and `test-runner` agents
138
+
139
+ **`commands/worker/reviewer/reviewer-worker.md`**
140
+ - Focus on code review patterns
141
+ - Uses `code-reviewer` agent
142
+
143
+ **`commands/worker/pm/pm-worker.md`**
144
+ - Focus on task breakdown
145
+ - Uses `task-planner` agent
146
+
147
+ **`commands/worker/marketer/marketer-worker.md`**
148
+ - Focus on content creation
149
+ - Uses `content-creator` agent
150
+
151
+ #### Lead Commands:
152
+
153
+ **`commands/lead/founder/founder-lead.md`**
154
+ - Strategic vision, high-level direction
155
+
156
+ **`commands/lead/ceo/ceo-lead.md`**
157
+ - Execution focus, multi-stream coordination
158
+
159
+ **`commands/lead/pm/pm-lead.md`**
160
+ - Sprint planning, backlog management
161
+
162
+ ### Success Criteria:
163
+
164
+ #### Automated Verification:
165
+ - [ ] All command files exist
166
+ - [ ] Each has valid YAML frontmatter
167
+
168
+ ---
169
+
170
+ ## Phase 3: Create Role-Specific Agents
171
+
172
+ ### Overview
173
+ Create specialized agents for each role.
174
+
175
+ ### Changes Required:
176
+
177
+ | Agent | Role | Purpose |
178
+ |-------|------|---------|
179
+ | `task-reporter.md` | common | Reports progress to lead |
180
+ | `code-implementer.md` | developer | Implements features |
181
+ | `refactorer.md` | developer | Refactors code |
182
+ | `test-generator.md` | tester | Generates test cases |
183
+ | `test-runner.md` | tester | Runs and validates tests |
184
+ | `code-reviewer.md` | reviewer | Reviews code changes |
185
+ | `task-planner.md` | pm | Breaks down tasks |
186
+ | `content-creator.md` | marketer | Creates content |
187
+
188
+ ### Success Criteria:
189
+
190
+ #### Automated Verification:
191
+ - [ ] All agent files exist with valid frontmatter
192
+
193
+ ---
194
+
195
+ ## Phase 4: System Prompt Templates
196
+
197
+ ### Overview
198
+ Create role-specific system prompts.
199
+
200
+ ### Format:
201
+ Plain text files appended via `--append-system-prompt`
202
+
203
+ ### Contents per prompt:
204
+ - Role identity and focus
205
+ - Key responsibilities
206
+ - Communication style
207
+ - Quality standards
208
+
209
+ ### Success Criteria:
210
+
211
+ #### Automated Verification:
212
+ - [ ] All prompt files exist in `prompts/lead/` and `prompts/worker/`
213
+
214
+ ---
215
+
216
+ ## Phase 5: Update Docker Configuration
217
+
218
+ ### Changes Required:
219
+
220
+ #### 1. Dockerfile.worker
221
+ **File**: `Dockerfile.worker`
222
+
223
+ Add environment variables:
224
+ ```dockerfile
225
+ ENV WORKER_TYPE=developer
226
+ ENV LEAD_TYPE=founder
227
+ ```
228
+
229
+ Update COPY commands:
230
+ ```dockerfile
231
+ # Copy all plugin content (entrypoint selects what's active)
232
+ COPY --chown=worker:worker cc-plugin/commands/ /home/worker/.claude/plugin-commands/
233
+ COPY --chown=worker:worker cc-plugin/agents/ /home/worker/.claude/plugin-agents/
234
+ COPY --chown=worker:worker cc-plugin/prompts/ /home/worker/.claude/prompts/
235
+
236
+ # Copy base plugin agents
237
+ COPY --chown=worker:worker work/ai-toolbox/cc-plugin/base/agents/ /home/worker/.claude/base-agents/
238
+ ```
239
+
240
+ #### 2. docker-entrypoint.sh
241
+ **File**: `docker-entrypoint.sh`
242
+
243
+ Add role selection logic:
244
+ ```bash
245
+ WORKER_TYPE="${WORKER_TYPE:-developer}"
246
+ LEAD_TYPE="${LEAD_TYPE:-founder}"
247
+
248
+ # Copy common content
249
+ cp -r /home/worker/.claude/plugin-commands/common/* /home/worker/.claude/commands/ 2>/dev/null || true
250
+ cp -r /home/worker/.claude/plugin-agents/common/* /home/worker/.claude/agents/ 2>/dev/null || true
251
+
252
+ # Copy base plugin agents
253
+ cp -r /home/worker/.claude/base-agents/* /home/worker/.claude/agents/ 2>/dev/null || true
254
+
255
+ # Copy role-specific content
256
+ if [ "$AGENT_ROLE" = "lead" ]; then
257
+ cp -r /home/worker/.claude/plugin-commands/lead/${LEAD_TYPE}/* /home/worker/.claude/commands/ 2>/dev/null || true
258
+ SYSTEM_PROMPT_FILE="/home/worker/.claude/prompts/lead/${LEAD_TYPE}.txt"
259
+ else
260
+ cp -r /home/worker/.claude/plugin-commands/worker/${WORKER_TYPE}/* /home/worker/.claude/commands/ 2>/dev/null || true
261
+ cp -r /home/worker/.claude/plugin-agents/${WORKER_TYPE}/* /home/worker/.claude/agents/ 2>/dev/null || true
262
+ SYSTEM_PROMPT_FILE="/home/worker/.claude/prompts/worker/${WORKER_TYPE}.txt"
263
+ fi
264
+
265
+ # Auto-set system prompt
266
+ if [ -z "$WORKER_SYSTEM_PROMPT" ] && [ -z "$WORKER_SYSTEM_PROMPT_FILE" ] && [ -f "$SYSTEM_PROMPT_FILE" ]; then
267
+ export WORKER_SYSTEM_PROMPT_FILE="$SYSTEM_PROMPT_FILE"
268
+ fi
269
+ ```
270
+
271
+ ### Success Criteria:
272
+
273
+ #### Automated Verification:
274
+ - [ ] `docker build -f Dockerfile.worker .` succeeds
275
+ - [ ] Container starts with `WORKER_TYPE=tester`
276
+
277
+ #### Manual Verification:
278
+ - [ ] Correct commands/agents copied based on role
279
+
280
+ ---
281
+
282
+ ## Phase 6: Update Runner Commands
283
+
284
+ ### Changes Required:
285
+
286
+ #### 1. src/commands/worker.ts
287
+
288
+ ```typescript
289
+ const workerConfig: RunnerConfig = {
290
+ role: "worker",
291
+ defaultPrompt: `/${process.env.WORKER_TYPE || 'developer'}-worker Start your assigned tasks!`,
292
+ // ... rest unchanged
293
+ };
294
+ ```
295
+
296
+ #### 2. src/commands/lead.ts
297
+
298
+ ```typescript
299
+ const leadConfig: RunnerConfig = {
300
+ role: "lead",
301
+ defaultPrompt: `/${process.env.LEAD_TYPE || 'founder'}-lead Setup and coordinate the swarm!`,
302
+ // ... rest unchanged
303
+ };
304
+ ```
305
+
306
+ ### Success Criteria:
307
+
308
+ #### Automated Verification:
309
+ - [ ] `bun run tsc` passes
310
+ - [ ] Runner uses dynamic command
311
+
312
+ ---
313
+
314
+ ## Testing Strategy
315
+
316
+ ### Unit Tests:
317
+ - Verify environment variable parsing
318
+ - Verify command path construction
319
+
320
+ ### Integration Tests:
321
+ - Build container with each WORKER_TYPE
322
+ - Verify correct files in `/home/worker/.claude/commands/`
323
+
324
+ ### Manual Testing Steps:
325
+ 1. `docker build -f Dockerfile.worker -t test-worker .`
326
+ 2. `docker run -e WORKER_TYPE=tester -it test-worker ls /home/worker/.claude/commands/`
327
+ 3. Verify only tester + common commands present
328
+
329
+ ---
330
+
331
+ ## Environment Variables Summary
332
+
333
+ | Variable | Default | Description |
334
+ |----------|---------|-------------|
335
+ | `AGENT_ROLE` | `worker` | Lead or worker |
336
+ | `WORKER_TYPE` | `developer` | Worker specialization |
337
+ | `LEAD_TYPE` | `founder` | Lead specialization |
338
+
339
+ **Available worker types**: `developer`, `tester`, `reviewer`, `pm`, `marketer`
340
+ **Available lead types**: `founder`, `ceo`, `pm`
341
+
342
+ ---
343
+
344
+ ## Base Plugin Agents
345
+
346
+ All roles have access to base plugin agents:
347
+ - `codebase-analyzer.md`
348
+ - `codebase-locator.md`
349
+ - `codebase-pattern-finder.md`
350
+ - `web-search-researcher.md`
351
+
352
+ Source: `work/ai-toolbox/cc-plugin/base/agents/`
353
+
354
+ ---
355
+
356
+ ## References
357
+
358
+ - Docker config: `Dockerfile.worker`, `docker-entrypoint.sh`
359
+ - Runner config: `src/commands/worker.ts:5-11`, `src/commands/lead.ts:5-11`
360
+ - Existing commands: `cc-plugin/commands/setup-leader.md`, `cc-plugin/commands/start-worker.md`
361
+ - Base plugin: `work/ai-toolbox/cc-plugin/base/`