@desplega.ai/agent-swarm 1.2.0 → 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 (123) hide show
  1. package/.claude/settings.local.json +20 -1
  2. package/.dockerignore +3 -0
  3. package/.env.docker.example +22 -1
  4. package/.env.example +17 -0
  5. package/.github/workflows/docker-publish.yml +92 -0
  6. package/CONTRIBUTING.md +270 -0
  7. package/DEPLOYMENT.md +391 -0
  8. package/Dockerfile.worker +29 -1
  9. package/FAQ.md +19 -0
  10. package/LICENSE +21 -0
  11. package/MCP.md +249 -0
  12. package/README.md +105 -185
  13. package/assets/agent-swarm-logo-orange.png +0 -0
  14. package/assets/agent-swarm-logo.png +0 -0
  15. package/assets/agent-swarm.png +0 -0
  16. package/deploy/docker-push.ts +30 -0
  17. package/docker-compose.example.yml +137 -0
  18. package/docker-entrypoint.sh +223 -7
  19. package/package.json +13 -4
  20. package/{cc-plugin → plugin}/.claude-plugin/plugin.json +1 -1
  21. package/plugin/README.md +1 -0
  22. package/plugin/agents/.gitkeep +0 -0
  23. package/plugin/agents/codebase-analyzer.md +143 -0
  24. package/plugin/agents/codebase-locator.md +122 -0
  25. package/plugin/agents/codebase-pattern-finder.md +227 -0
  26. package/plugin/agents/web-search-researcher.md +109 -0
  27. package/plugin/commands/create-plan.md +415 -0
  28. package/plugin/commands/implement-plan.md +89 -0
  29. package/plugin/commands/research.md +200 -0
  30. package/plugin/commands/start-leader.md +101 -0
  31. package/plugin/commands/start-worker.md +56 -0
  32. package/plugin/commands/swarm-chat.md +78 -0
  33. package/plugin/commands/todos.md +66 -0
  34. package/plugin/commands/work-on-task.md +44 -0
  35. package/plugin/skills/.gitkeep +0 -0
  36. package/scripts/generate-mcp-docs.ts +415 -0
  37. package/slack-manifest.json +69 -0
  38. package/src/be/db.ts +1431 -25
  39. package/src/cli.tsx +135 -11
  40. package/src/commands/lead.ts +13 -0
  41. package/src/commands/runner.ts +255 -0
  42. package/src/commands/setup.tsx +5 -5
  43. package/src/commands/worker.ts +8 -220
  44. package/src/hooks/hook.ts +108 -14
  45. package/src/http.ts +361 -5
  46. package/src/prompts/base-prompt.ts +131 -0
  47. package/src/server.ts +56 -0
  48. package/src/slack/app.ts +73 -0
  49. package/src/slack/commands.ts +88 -0
  50. package/src/slack/handlers.ts +281 -0
  51. package/src/slack/index.ts +3 -0
  52. package/src/slack/responses.ts +175 -0
  53. package/src/slack/router.ts +170 -0
  54. package/src/slack/types.ts +20 -0
  55. package/src/slack/watcher.ts +119 -0
  56. package/src/tools/create-channel.ts +80 -0
  57. package/src/tools/get-tasks.ts +54 -21
  58. package/src/tools/join-swarm.ts +28 -4
  59. package/src/tools/list-channels.ts +37 -0
  60. package/src/tools/list-services.ts +110 -0
  61. package/src/tools/poll-task.ts +47 -3
  62. package/src/tools/post-message.ts +87 -0
  63. package/src/tools/read-messages.ts +192 -0
  64. package/src/tools/register-service.ts +118 -0
  65. package/src/tools/send-task.ts +80 -7
  66. package/src/tools/store-progress.ts +9 -3
  67. package/src/tools/task-action.ts +211 -0
  68. package/src/tools/unregister-service.ts +110 -0
  69. package/src/tools/update-profile.ts +105 -0
  70. package/src/tools/update-service-status.ts +118 -0
  71. package/src/types.ts +110 -3
  72. package/src/utils/pretty-print.ts +224 -0
  73. package/thoughts/shared/plans/.gitkeep +0 -0
  74. package/thoughts/shared/plans/2025-12-18-inverse-teleport.md +1142 -0
  75. package/thoughts/shared/plans/2025-12-18-slack-integration.md +1195 -0
  76. package/thoughts/shared/plans/2025-12-19-agent-log-streaming.md +732 -0
  77. package/thoughts/shared/plans/2025-12-19-role-based-swarm-plugin.md +361 -0
  78. package/thoughts/shared/plans/2025-12-20-mobile-responsive-ui.md +501 -0
  79. package/thoughts/shared/plans/2025-12-20-startup-team-swarm.md +560 -0
  80. package/thoughts/shared/research/.gitkeep +0 -0
  81. package/thoughts/shared/research/2025-12-18-slack-integration.md +442 -0
  82. package/thoughts/shared/research/2025-12-19-agent-log-streaming.md +339 -0
  83. package/thoughts/shared/research/2025-12-19-agent-secrets-cli-research.md +390 -0
  84. package/thoughts/shared/research/2025-12-21-gemini-cli-integration.md +376 -0
  85. package/thoughts/shared/research/2025-12-22-setup-experience-improvements.md +264 -0
  86. package/tsconfig.json +3 -1
  87. package/ui/bun.lock +692 -0
  88. package/ui/index.html +22 -0
  89. package/ui/package.json +32 -0
  90. package/ui/pnpm-lock.yaml +3034 -0
  91. package/ui/postcss.config.js +6 -0
  92. package/ui/public/logo.png +0 -0
  93. package/ui/src/App.tsx +43 -0
  94. package/ui/src/components/ActivityFeed.tsx +415 -0
  95. package/ui/src/components/AgentDetailPanel.tsx +534 -0
  96. package/ui/src/components/AgentsPanel.tsx +549 -0
  97. package/ui/src/components/ChatPanel.tsx +1820 -0
  98. package/ui/src/components/ConfigModal.tsx +232 -0
  99. package/ui/src/components/Dashboard.tsx +534 -0
  100. package/ui/src/components/Header.tsx +168 -0
  101. package/ui/src/components/ServicesPanel.tsx +612 -0
  102. package/ui/src/components/StatsBar.tsx +288 -0
  103. package/ui/src/components/StatusBadge.tsx +124 -0
  104. package/ui/src/components/TaskDetailPanel.tsx +807 -0
  105. package/ui/src/components/TasksPanel.tsx +575 -0
  106. package/ui/src/hooks/queries.ts +170 -0
  107. package/ui/src/index.css +235 -0
  108. package/ui/src/lib/api.ts +161 -0
  109. package/ui/src/lib/config.ts +35 -0
  110. package/ui/src/lib/theme.ts +214 -0
  111. package/ui/src/lib/utils.ts +48 -0
  112. package/ui/src/main.tsx +32 -0
  113. package/ui/src/types/api.ts +164 -0
  114. package/ui/src/vite-env.d.ts +1 -0
  115. package/ui/tailwind.config.js +35 -0
  116. package/ui/tsconfig.json +31 -0
  117. package/ui/vite.config.ts +22 -0
  118. package/cc-plugin/README.md +0 -49
  119. package/cc-plugin/commands/setup-leader.md +0 -73
  120. package/cc-plugin/commands/start-worker.md +0 -64
  121. package/docker-compose.worker.yml +0 -35
  122. package/example-req-meta.json +0 -24
  123. /package/{cc-plugin → plugin}/hooks/hooks.json +0 -0
@@ -0,0 +1,376 @@
1
+ ---
2
+ date: 2025-12-21T21:10:00-08:00
3
+ researcher: master lord
4
+ git_commit: fb757dbc76fc9f3c6f5859d4a96c28af4dc02af9
5
+ branch: main
6
+ repository: agent-swarm
7
+ topic: "Gemini CLI Integration Research"
8
+ tags: [research, codebase, gemini-cli, multi-cli, integration]
9
+ status: complete
10
+ last_updated: 2025-12-21
11
+ last_updated_by: master lord
12
+ ---
13
+
14
+ # Research: Gemini CLI Integration
15
+
16
+ **Date**: 2025-12-21T21:10:00-08:00
17
+ **Researcher**: master lord
18
+ **Git Commit**: fb757dbc76fc9f3c6f5859d4a96c28af4dc02af9
19
+ **Branch**: main
20
+ **Repository**: agent-swarm
21
+
22
+ ## Research Question
23
+
24
+ How can we integrate the agent-swarm codebase with other CLI tools, particularly Gemini CLI, to support Gemini 3 and other models alongside Claude?
25
+
26
+ ## Summary
27
+
28
+ The agent-swarm codebase has a clean separation between **CLI-agnostic** components (MCP server, tools, database) and **Claude-specific** components (CLI spawning, hooks, setup). Integration with Gemini CLI is feasible because:
29
+
30
+ 1. **MCP Server works as-is** - Gemini CLI fully supports MCP servers via the same protocol
31
+ 2. **Headless mode is similar** - Both CLIs support `--output-format stream-json` and prompt flags
32
+ 3. **Hooks exist in both** - Different event names but similar JSON stdin/stdout protocol
33
+ 4. **Authentication is straightforward** - Gemini uses API keys or service accounts, easy for containers
34
+
35
+ The main work involves creating an abstraction layer in the runner to support multiple CLI tools.
36
+
37
+ ## Detailed Findings
38
+
39
+ ### Current Architecture: CLI-Specific vs CLI-Agnostic Components
40
+
41
+ | Component | File | CLI Dependency | Notes |
42
+ |-----------|------|----------------|-------|
43
+ | MCP Server | `src/server.ts` | **CLI-agnostic** | Standard MCP SDK, works with any client |
44
+ | MCP Tools | `src/tools/*.ts` | **CLI-agnostic** | Pure MCP protocol |
45
+ | HTTP Transport | `src/http.ts` | **CLI-agnostic** | Standard MCP HTTP transport |
46
+ | STDIO Transport | `src/stdio.ts` | **CLI-agnostic** | Standard MCP STDIO transport |
47
+ | Database Layer | `src/be/db.ts` | **CLI-agnostic** | SQLite operations |
48
+ | Type Definitions | `src/types.ts` | **CLI-agnostic** | Data structures |
49
+ | CLI Spawner | `src/claude.ts` | **Claude-specific** | Hardcoded `claude` command |
50
+ | Agent Runner | `src/commands/runner.ts` | **Claude-specific** | Claude CLI flags |
51
+ | Hook Handler | `src/hooks/hook.ts` | **Claude-specific** | Claude Code hook protocol |
52
+ | Setup Command | `src/commands/setup.tsx` | **Claude-specific** | Creates `.claude/` config |
53
+ | Docker Files | `Dockerfile.worker` | **Claude-specific** | Installs Claude CLI |
54
+
55
+ ### Claude CLI Integration Points
56
+
57
+ **1. CLI Spawning (`src/claude.ts:9-80`)**
58
+ ```typescript
59
+ const CMD = ["claude"]; // Hardcoded CLI name
60
+ if (opts.headless) {
61
+ CMD.push("--verbose");
62
+ CMD.push("--output-format");
63
+ CMD.push("stream-json");
64
+ CMD.push("-p");
65
+ CMD.push(opts.msg);
66
+ }
67
+ ```
68
+
69
+ **2. Agent Runner (`src/commands/runner.ts:65-92`)**
70
+ ```typescript
71
+ const CMD = [
72
+ "claude",
73
+ "--verbose",
74
+ "--output-format", "stream-json",
75
+ "--dangerously-skip-permissions",
76
+ "--allow-dangerously-skip-permissions",
77
+ "--permission-mode", "bypassPermissions",
78
+ "-p", opts.prompt,
79
+ ];
80
+ if (opts.systemPrompt) {
81
+ CMD.push("--append-system-prompt", opts.systemPrompt);
82
+ }
83
+ ```
84
+
85
+ **3. Hook Events (`src/hooks/hook.ts`)**
86
+ - `SessionStart`
87
+ - `PreCompact`
88
+ - `PreToolUse`
89
+ - `PostToolUse`
90
+ - `UserPromptSubmit`
91
+ - `Stop`
92
+
93
+ ---
94
+
95
+ ## Authentication Comparison
96
+
97
+ ### Claude Code
98
+
99
+ | Method | Environment Variable | Notes |
100
+ |--------|---------------------|-------|
101
+ | OAuth Token | `CLAUDE_CODE_OAUTH_TOKEN` | Used in Docker workers |
102
+ | API Key | Not directly supported | Uses Anthropic account auth |
103
+
104
+ ### Gemini CLI
105
+
106
+ | Method | Environment Variables | Best For |
107
+ |--------|----------------------|----------|
108
+ | **API Key** | `GEMINI_API_KEY` | Simple automation, quick setup |
109
+ | **Service Account** | `GOOGLE_APPLICATION_CREDENTIALS` + `GOOGLE_CLOUD_PROJECT` + `GOOGLE_CLOUD_LOCATION` | Docker, CI/CD, containers |
110
+ | **ADC (gcloud)** | `GOOGLE_CLOUD_PROJECT` + `GOOGLE_CLOUD_LOCATION` | Local dev with gcloud installed |
111
+ | **OAuth** | Browser login, cached at `~/.gemini/` | Interactive local use |
112
+ | **Cloud API Key** | `GOOGLE_API_KEY` + `GOOGLE_CLOUD_PROJECT` | Vertex AI access |
113
+
114
+ ### Key Auth Behaviors
115
+
116
+ **Auto .env loading**: Gemini CLI automatically loads environment variables from:
117
+ 1. `.gemini/.env` in project directory (first found going up)
118
+ 2. `~/.gemini/.env`
119
+ 3. `~/.env`
120
+
121
+ This is similar to Bun's `.env` loading behavior.
122
+
123
+ **Headless auth**: For containers/automation, use either:
124
+ - `GEMINI_API_KEY` - Simplest, just set the API key
125
+ - Service account JSON file mounted + `GOOGLE_APPLICATION_CREDENTIALS` path
126
+
127
+ ### Docker Auth Mapping
128
+
129
+ | Current (Claude) | Gemini Equivalent |
130
+ |------------------|-------------------|
131
+ | `CLAUDE_CODE_OAUTH_TOKEN` env | `GEMINI_API_KEY` env |
132
+ | Token validation at startup | API key validation at startup |
133
+ | N/A | Service account JSON mount option |
134
+
135
+ For multi-CLI Docker support, the entrypoint would check:
136
+ ```bash
137
+ if [ "$CLI_TOOL" = "gemini" ]; then
138
+ if [ -z "$GEMINI_API_KEY" ] && [ -z "$GOOGLE_APPLICATION_CREDENTIALS" ]; then
139
+ echo "Error: GEMINI_API_KEY or GOOGLE_APPLICATION_CREDENTIALS required"
140
+ exit 1
141
+ fi
142
+ elif [ "$CLI_TOOL" = "claude" ]; then
143
+ if [ -z "$CLAUDE_CODE_OAUTH_TOKEN" ]; then
144
+ echo "Error: CLAUDE_CODE_OAUTH_TOKEN required"
145
+ exit 1
146
+ fi
147
+ fi
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Gemini CLI Feature Comparison
153
+
154
+ ### Headless Mode Flags
155
+
156
+ | Feature | Claude CLI | Gemini CLI |
157
+ |---------|------------|------------|
158
+ | Prompt flag | `-p <message>` | `--prompt <message>` |
159
+ | JSON output | `--output-format stream-json` | `--output-format stream-json` |
160
+ | Verbose mode | `--verbose` | N/A |
161
+ | Auto-approve | `--dangerously-skip-permissions` | `--yolo` |
162
+ | Model selection | N/A | `--model <name>` |
163
+ | Approval mode | `--permission-mode bypassPermissions` | `--approval-mode <mode>` |
164
+ | System prompt | `--append-system-prompt` | `GEMINI_SYSTEM_MD` env var |
165
+
166
+ ### MCP Server Configuration
167
+
168
+ **Claude Code (`.mcp.json`):**
169
+ ```json
170
+ {
171
+ "mcpServers": {
172
+ "agent-swarm": {
173
+ "command": "bunx",
174
+ "args": ["@desplega.ai/agent-swarm@latest", "mcp", "stdio"],
175
+ "env": { "API_KEY": "..." }
176
+ }
177
+ }
178
+ }
179
+ ```
180
+
181
+ **Gemini CLI (`settings.json`):**
182
+ ```json
183
+ {
184
+ "mcpServers": {
185
+ "agent-swarm": {
186
+ "command": "bunx",
187
+ "args": ["@desplega.ai/agent-swarm@latest", "mcp", "stdio"],
188
+ "env": { "API_KEY": "..." }
189
+ }
190
+ }
191
+ }
192
+ ```
193
+
194
+ Nearly identical! Both follow the MCP specification.
195
+
196
+ ### Hook Events Mapping
197
+
198
+ | Claude Code | Gemini CLI | Notes |
199
+ |-------------|------------|-------|
200
+ | `SessionStart` | `SessionStart` | Same |
201
+ | `Stop` | `SessionEnd` | Different name |
202
+ | `PreToolUse` | `BeforeTool` | Different name |
203
+ | `PostToolUse` | `AfterTool` | Different name |
204
+ | `UserPromptSubmit` | `BeforeAgent` | Similar concept |
205
+ | `PreCompact` | `PreCompress` | Different name |
206
+ | N/A | `BeforeModel` / `AfterModel` | Gemini-only |
207
+ | N/A | `BeforeToolSelection` | Gemini-only |
208
+ | N/A | `Notification` | Gemini-only |
209
+
210
+ ### Custom Commands
211
+
212
+ | Feature | Claude Code | Gemini CLI |
213
+ |---------|-------------|------------|
214
+ | Format | Markdown | TOML |
215
+ | Location | `.claude/commands/` | `.gemini/commands/` |
216
+ | Invocation | `/command-name` | `/command-name` |
217
+ | Arguments | Passed to prompt | `{{args}}` placeholder |
218
+ | Namespacing | Flat | Colon-separated (`/git:commit`) |
219
+
220
+ ---
221
+
222
+ ## Integration Architecture
223
+
224
+ ### Option 1: CLI Adapter Pattern
225
+
226
+ Create an abstraction layer that normalizes CLI differences:
227
+
228
+ ```typescript
229
+ // src/adapters/types.ts
230
+ interface CLIAdapter {
231
+ name: string;
232
+ command: string;
233
+ buildArgs(opts: RunOptions): string[];
234
+ parseOutput(line: string): ParsedOutput;
235
+ hookEventMap: Record<string, string>;
236
+ authEnvVars: string[];
237
+ }
238
+
239
+ // src/adapters/claude-adapter.ts
240
+ export const claudeAdapter: CLIAdapter = {
241
+ name: "claude",
242
+ command: "claude",
243
+ authEnvVars: ["CLAUDE_CODE_OAUTH_TOKEN"],
244
+ buildArgs: (opts) => [
245
+ "--verbose",
246
+ "--output-format", "stream-json",
247
+ "--dangerously-skip-permissions",
248
+ "--allow-dangerously-skip-permissions",
249
+ "--permission-mode", "bypassPermissions",
250
+ "-p", opts.prompt,
251
+ ...(opts.systemPrompt ? ["--append-system-prompt", opts.systemPrompt] : []),
252
+ ],
253
+ parseOutput: (line) => JSON.parse(line),
254
+ hookEventMap: {
255
+ SessionStart: "SessionStart",
256
+ Stop: "Stop",
257
+ PreToolUse: "PreToolUse",
258
+ PostToolUse: "PostToolUse",
259
+ },
260
+ };
261
+
262
+ // src/adapters/gemini-adapter.ts
263
+ export const geminiAdapter: CLIAdapter = {
264
+ name: "gemini",
265
+ command: "gemini",
266
+ authEnvVars: ["GEMINI_API_KEY", "GOOGLE_APPLICATION_CREDENTIALS"],
267
+ buildArgs: (opts) => [
268
+ "--output-format", "stream-json",
269
+ "--yolo",
270
+ "--prompt", opts.prompt,
271
+ ],
272
+ // System prompt handled via GEMINI_SYSTEM_MD env var
273
+ parseOutput: (line) => JSON.parse(line),
274
+ hookEventMap: {
275
+ SessionStart: "SessionStart",
276
+ Stop: "SessionEnd",
277
+ PreToolUse: "BeforeTool",
278
+ PostToolUse: "AfterTool",
279
+ },
280
+ };
281
+ ```
282
+
283
+ ### Option 2: Configuration-Driven
284
+
285
+ Add CLI tool configuration to environment/settings:
286
+
287
+ ```typescript
288
+ interface CLIConfig {
289
+ command: string;
290
+ headlessFlags: string[];
291
+ autoApproveFlag: string;
292
+ promptFlag: string;
293
+ systemPromptFlag?: string;
294
+ systemPromptEnv?: string;
295
+ outputFormatFlag: string[];
296
+ authEnvVars: string[];
297
+ }
298
+
299
+ const CLI_CONFIGS: Record<string, CLIConfig> = {
300
+ claude: {
301
+ command: "claude",
302
+ headlessFlags: ["--verbose"],
303
+ autoApproveFlag: "--dangerously-skip-permissions",
304
+ promptFlag: "-p",
305
+ systemPromptFlag: "--append-system-prompt",
306
+ outputFormatFlag: ["--output-format", "stream-json"],
307
+ authEnvVars: ["CLAUDE_CODE_OAUTH_TOKEN"],
308
+ },
309
+ gemini: {
310
+ command: "gemini",
311
+ headlessFlags: [],
312
+ autoApproveFlag: "--yolo",
313
+ promptFlag: "--prompt",
314
+ systemPromptEnv: "GEMINI_SYSTEM_MD",
315
+ outputFormatFlag: ["--output-format", "stream-json"],
316
+ authEnvVars: ["GEMINI_API_KEY", "GOOGLE_APPLICATION_CREDENTIALS"],
317
+ },
318
+ };
319
+ ```
320
+
321
+ ### Files Requiring Changes
322
+
323
+ | File | Change Required |
324
+ |------|-----------------|
325
+ | `src/claude.ts` | Rename to `src/cli-runner.ts`, add adapter support |
326
+ | `src/commands/runner.ts` | Use CLI adapter instead of hardcoded flags |
327
+ | `src/hooks/hook.ts` | Map hook events through adapter |
328
+ | `src/commands/setup.tsx` | Generate config for selected CLI |
329
+ | `Dockerfile.worker` | Add Gemini CLI installation option |
330
+ | `docker-entrypoint.sh` | Handle multiple auth mechanisms |
331
+ | `package.json` | Add `gemini` script variants |
332
+
333
+ ### What Works Without Changes
334
+
335
+ 1. **MCP Server** (`src/server.ts`) - Fully CLI-agnostic
336
+ 2. **All MCP Tools** (`src/tools/*.ts`) - Pure MCP protocol
337
+ 3. **Database Layer** (`src/be/db.ts`) - No CLI awareness
338
+ 4. **Type Definitions** (`src/types.ts`) - CLI-agnostic data structures
339
+ 5. **HTTP/STDIO Transports** - Standard MCP SDK
340
+
341
+ ---
342
+
343
+ ## Code References
344
+
345
+ - `src/claude.ts:9-80` - Claude CLI spawning wrapper
346
+ - `src/commands/runner.ts:65-192` - Agent runner with CLI flags
347
+ - `src/hooks/hook.ts:56-306` - Hook event handler
348
+ - `src/server.ts:42-96` - CLI-agnostic MCP server
349
+ - `src/commands/setup.tsx:56-76` - Claude-specific setup
350
+ - `Dockerfile.worker:76-98` - Claude CLI installation
351
+
352
+ ## Limitations
353
+
354
+ | Feature | Claude Code | Gemini CLI | Impact |
355
+ |---------|-------------|------------|--------|
356
+ | Plugin system | Full support | Extensions (different API) | Commands need porting |
357
+ | Agents | Supported | Not mentioned | May not work |
358
+ | Skills | Supported | Not mentioned | May not work |
359
+ | Context caching | Yes | Yes (token caching) | Works differently |
360
+ | Hooks | 6 events | 11 events | Need event mapping |
361
+
362
+ ## Related Research
363
+
364
+ - `thoughts/shared/research/2025-12-19-agent-log-streaming.md` - Claude CLI JSON streaming format
365
+
366
+ ## Open Questions
367
+
368
+ 1. **JSON streaming format** - Are Claude's and Gemini's stream-json outputs compatible? Both emit newline-delimited JSON but event structures may differ.
369
+
370
+ 2. **Tool name prefixing** - Both CLIs prefix MCP tools. Need to verify `mcp__agent-swarm__*` permission pattern works in Gemini.
371
+
372
+ 3. **Gemini Extensions vs Claude Plugins** - These are different systems. If we want to support Gemini extensions, that's a separate effort.
373
+
374
+ 4. **Model selection** - Gemini CLI supports model switching (`/model`). Should we expose this in agent config?
375
+
376
+ 5. **Quota differences** - Gemini has different quota/pricing. May affect swarm behavior with many agents.
@@ -0,0 +1,264 @@
1
+ ---
2
+ date: 2025-12-22T01:20:00-08:00
3
+ researcher: Claude Opus 4.5
4
+ git_commit: 4334e7c
5
+ branch: main
6
+ repository: agent-swarm
7
+ topic: "Setup Experience & Demo Ideas"
8
+ tags: [research, developer-experience, onboarding, demo]
9
+ status: complete
10
+ last_updated: 2025-12-22
11
+ last_updated_by: Claude Opus 4.5
12
+ ---
13
+
14
+ # Research: Setup Experience & Demo Ideas
15
+
16
+ **Date**: 2025-12-22T01:20:00-08:00
17
+ **Researcher**: Claude Opus 4.5
18
+ **Git Commit**: 4334e7c
19
+ **Branch**: main
20
+ **Repository**: agent-swarm
21
+
22
+ ## Research Question
23
+
24
+ How to make the project super easy to setup and run for someone that clones or wants to try it out locally or deploy it? What are ideas for a demo?
25
+
26
+ ## Summary
27
+
28
+ The project has solid infrastructure but the onboarding experience could be significantly improved. The main barriers are: (1) scattered documentation with no true "30-second quick start", (2) UI and server require separate setup, (3) Claude OAuth token requirement is a major barrier for new users, and (4) no simple demo to understand what the project does. Below are specific recommendations and demo ideas.
29
+
30
+ ## Current Project Structure
31
+
32
+ ```
33
+ agent-swarm/
34
+ ├── src/ # MCP Server + CLI
35
+ │ ├── http.ts # HTTP MCP server (main backend)
36
+ │ ├── stdio.ts # STDIO transport
37
+ │ ├── cli.tsx # CLI entry (setup, worker, lead, hook)
38
+ │ ├── commands/ # CLI command implementations
39
+ │ └── tools/ # MCP tool handlers
40
+ ├── ui/ # Separate Vite dashboard (MUI Joy + React)
41
+ │ ├── src/ # React components
42
+ │ └── package.json # Separate deps (uses pnpm)
43
+ ├── plugin/ # Claude Code plugin (not yet published)
44
+ ├── deploy/ # Deployment scripts (systemd, Docker)
45
+ ├── Dockerfile.worker # Worker container with full dev env
46
+ └── docker-compose.*.yml # Docker compose configs
47
+ ```
48
+
49
+ ## Current Setup Experience Gaps
50
+
51
+ ### 1. Prerequisites Not Prominent
52
+ - Bun is required but mentioned only in passing
53
+ - No clear version requirements
54
+ - Node.js 22 mentioned for Docker only
55
+
56
+ ### 2. No Unified Quick Start
57
+ Current README jumps straight to `bunx @desplega.ai/agent-swarm@latest setup` which:
58
+ - Assumes user has Bun installed
59
+ - Requires API token from cloud service
60
+ - Doesn't work for local development
61
+
62
+ ### 3. UI Requires Separate Setup
63
+ ```bash
64
+ # User must know to:
65
+ cd ui
66
+ pnpm install # Note: different package manager!
67
+ pnpm dev # Separate terminal
68
+ ```
69
+
70
+ ### 4. Missing "All-in-One" Development Script
71
+ No single command to start both server and UI with hot reload.
72
+
73
+ ### 5. Claude OAuth Token Barrier
74
+ Biggest friction: requires `CLAUDE_CODE_OAUTH_TOKEN` which is:
75
+ - Hard to obtain (undocumented process)
76
+ - Required even for basic testing
77
+ - Blocks casual exploration
78
+
79
+ ### 6. No Simple "See It Work" Demo
80
+ Users can't quickly see value without significant setup.
81
+
82
+ ## Improvement Recommendations
83
+
84
+ ### 1. Add Prerequisites Section (Top of README)
85
+
86
+ ```markdown
87
+ ## Prerequisites
88
+
89
+ - [Bun](https://bun.sh) v1.1+ (`curl -fsSL https://bun.sh/install | bash`)
90
+ - [Claude Code CLI](https://claude.ai/install.sh) (for running agents)
91
+ - Docker (optional, for containerized workers)
92
+ ```
93
+
94
+ ### 2. Add True Quick Start (Local Development)
95
+
96
+ ```markdown
97
+ ## Quick Start (Local Development)
98
+
99
+ # 1. Clone and install
100
+ git clone https://github.com/desplega-ai/agent-swarm.git
101
+ cd agent-swarm
102
+ bun install
103
+
104
+ # 2. Create .env file
105
+ cp .env.example .env
106
+ # Edit .env to set API_KEY=any-secret-you-want
107
+
108
+ # 3. Start the MCP server
109
+ bun run dev:http
110
+
111
+ # Server running at http://localhost:3013
112
+
113
+ # 4. (Optional) Start the dashboard
114
+ cd ui && pnpm install && pnpm dev
115
+ # Dashboard at http://localhost:5173
116
+ ```
117
+
118
+ ### 3. Add `dev:all` Script to package.json
119
+
120
+ ```json
121
+ "scripts": {
122
+ "dev:all": "bun run dev:http & (cd ui && pnpm dev)",
123
+ "dev:ui": "cd ui && pnpm dev"
124
+ }
125
+ ```
126
+
127
+ Or use a process manager approach:
128
+ ```bash
129
+ # Add to package.json scripts
130
+ "dev:all": "bun --hot src/http.ts & cd ui && pnpm dev"
131
+ ```
132
+
133
+ ### 4. Add MCP Inspector Demo Mode
134
+
135
+ For users who just want to see it work without Claude:
136
+
137
+ ```markdown
138
+ ## Try Without Claude
139
+
140
+ Test the MCP tools using the inspector:
141
+
142
+ bun run inspector:http
143
+
144
+ This opens a web UI where you can:
145
+ - Call `join-swarm` to register an agent
146
+ - Use `send-task` to create tasks
147
+ - See the full API without needing Claude
148
+ ```
149
+
150
+ ### 5. Create Demo Modes in CLI
151
+
152
+ Add simple demo commands that simulate swarm behavior:
153
+
154
+ ```bash
155
+ # Simulate a 3-agent swarm locally
156
+ bunx @desplega.ai/agent-swarm demo --agents 3
157
+
158
+ # This would:
159
+ # 1. Start local server
160
+ # 2. Register 3 fake agents
161
+ # 3. Create sample tasks
162
+ # 4. Show agents claiming and completing tasks
163
+ ```
164
+
165
+ ### 6. Add Screencast/GIF to README
166
+
167
+ A 30-second GIF showing:
168
+ 1. Dashboard with agents
169
+ 2. Tasks being assigned
170
+ 3. Real-time progress updates
171
+ 4. Agent messaging
172
+
173
+ ### 7. Environment File Consolidation
174
+
175
+ Create a single `.env.development.example`:
176
+ ```env
177
+ # Local Development Configuration
178
+ API_KEY=dev-secret-key
179
+ PORT=3013
180
+ SWARM_URL=localhost
181
+
182
+ # Only needed for actual Claude agents:
183
+ # CLAUDE_CODE_OAUTH_TOKEN=your-token
184
+ ```
185
+
186
+ ## Demo Ideas
187
+
188
+ ### Demo 1: Task Coordination Screencast (Simplest)
189
+ **Setup**: 1 lead + 2 workers
190
+ **Scenario**: Lead breaks down "Build a calculator" into tasks:
191
+ - Worker 1: Implement add/subtract
192
+ - Worker 2: Implement multiply/divide
193
+ - Both report progress, lead monitors
194
+
195
+ **Why it works**: Shows core value prop - parallel execution with coordination
196
+
197
+ ### Demo 2: Code Review Swarm (Practical)
198
+ **Setup**: 1 lead + 3 specialized workers
199
+ **Scenario**: Review a PR from multiple angles:
200
+ - Worker 1: Security review
201
+ - Worker 2: Performance review
202
+ - Worker 3: Test coverage review
203
+ - Lead synthesizes findings
204
+
205
+ **Why it works**: Immediately useful, shows specialization
206
+
207
+ ### Demo 3: Research Swarm (Impressive)
208
+ **Setup**: 1 lead + 3 researchers
209
+ **Scenario**: Research "Best practices for X" topic:
210
+ - Workers search different sources in parallel
211
+ - Post findings to shared channel
212
+ - Lead synthesizes into final report
213
+
214
+ **Why it works**: Shows messaging + parallel speedup
215
+
216
+ ### Demo 4: Service Registry Demo (Technical)
217
+ **Setup**: 2 workers with background services
218
+ **Scenario**:
219
+ - Worker 1: Starts an API server (PM2 + register-service)
220
+ - Worker 2: Discovers and calls Worker 1's API
221
+ - Shows cross-agent service communication
222
+
223
+ **Why it works**: Demonstrates unique capability
224
+
225
+ ### Demo 5: Interactive Dashboard Demo
226
+ **No Claude needed**
227
+ **Scenario**: Use the MCP Inspector to:
228
+ 1. Register 3 agents manually
229
+ 2. Create tasks in the pool
230
+ 3. Claim tasks as different agents
231
+ 4. Show dashboard updating in real-time
232
+
233
+ **Why it works**: Zero barrier to entry, visual
234
+
235
+ ## Recommended Demo Implementation Priority
236
+
237
+ 1. **Demo 5 (Dashboard Demo)** - Zero friction, can be a video on README
238
+ 2. **Demo 1 (Task Coordination)** - Core value, simple script
239
+ 3. **Demo 2 (Code Review)** - Practical application
240
+ 4. **Demo 3 (Research)** - Shows advanced features
241
+
242
+ ## Quick Wins
243
+
244
+ 1. Add `bun run dev:all` script
245
+ 2. Move Prerequisites to top of README
246
+ 3. Add "Try Without Claude" section
247
+ 4. Record 30-second GIF for README
248
+ 5. Create `.env.development.example` with comments
249
+
250
+ ## Related Files
251
+
252
+ - `README.md` - Main documentation
253
+ - `deploy/DEPLOY.md` - Server deployment docs
254
+ - `.env.example` - Server environment template
255
+ - `.env.docker.example` - Docker environment template
256
+ - `src/cli.tsx` - CLI entry point
257
+ - `ui/` - Dashboard application
258
+
259
+ ## Open Questions
260
+
261
+ 1. Can we publish a "demo mode" that doesn't require OAuth?
262
+ 2. Should UI be embedded in main server (single port)?
263
+ 3. Is there a way to provide temporary Claude tokens for demos?
264
+ 4. Should there be a hosted demo instance users can connect to?
package/tsconfig.json CHANGED
@@ -2,6 +2,7 @@
2
2
  "compilerOptions": {
3
3
  // Environment setup & latest features
4
4
  "lib": ["ESNext"],
5
+ "types": ["bun"],
5
6
  "target": "ESNext",
6
7
  "module": "Preserve",
7
8
  "moduleDetection": "force",
@@ -31,5 +32,6 @@
31
32
  "noUnusedLocals": false,
32
33
  "noUnusedParameters": false,
33
34
  "noPropertyAccessFromIndexSignature": false
34
- }
35
+ },
36
+ "exclude": ["ui", "node_modules"]
35
37
  }