@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.
- package/.claude/settings.local.json +20 -1
- package/.env.docker.example +22 -1
- package/.env.example +17 -0
- package/.github/workflows/docker-publish.yml +92 -0
- package/CONTRIBUTING.md +270 -0
- package/DEPLOYMENT.md +391 -0
- package/Dockerfile.worker +29 -1
- package/FAQ.md +19 -0
- package/LICENSE +21 -0
- package/MCP.md +249 -0
- package/README.md +103 -207
- package/assets/agent-swarm-logo-orange.png +0 -0
- package/assets/agent-swarm-logo.png +0 -0
- package/docker-compose.example.yml +137 -0
- package/docker-entrypoint.sh +223 -7
- package/package.json +8 -3
- package/{cc-plugin → plugin}/.claude-plugin/plugin.json +1 -1
- package/plugin/README.md +1 -0
- package/plugin/agents/.gitkeep +0 -0
- package/plugin/agents/codebase-analyzer.md +143 -0
- package/plugin/agents/codebase-locator.md +122 -0
- package/plugin/agents/codebase-pattern-finder.md +227 -0
- package/plugin/agents/web-search-researcher.md +109 -0
- package/plugin/commands/create-plan.md +415 -0
- package/plugin/commands/implement-plan.md +89 -0
- package/plugin/commands/research.md +200 -0
- package/plugin/commands/start-leader.md +101 -0
- package/plugin/commands/start-worker.md +56 -0
- package/plugin/commands/swarm-chat.md +78 -0
- package/plugin/commands/todos.md +66 -0
- package/plugin/commands/work-on-task.md +44 -0
- package/plugin/skills/.gitkeep +0 -0
- package/scripts/generate-mcp-docs.ts +415 -0
- package/slack-manifest.json +69 -0
- package/src/be/db.ts +1431 -25
- package/src/cli.tsx +135 -11
- package/src/commands/lead.ts +13 -0
- package/src/commands/runner.ts +255 -0
- package/src/commands/worker.ts +8 -220
- package/src/hooks/hook.ts +102 -14
- package/src/http.ts +361 -5
- package/src/prompts/base-prompt.ts +131 -0
- package/src/server.ts +56 -0
- package/src/slack/app.ts +73 -0
- package/src/slack/commands.ts +88 -0
- package/src/slack/handlers.ts +281 -0
- package/src/slack/index.ts +3 -0
- package/src/slack/responses.ts +175 -0
- package/src/slack/router.ts +170 -0
- package/src/slack/types.ts +20 -0
- package/src/slack/watcher.ts +119 -0
- package/src/tools/create-channel.ts +80 -0
- package/src/tools/get-tasks.ts +54 -21
- package/src/tools/join-swarm.ts +28 -4
- package/src/tools/list-channels.ts +37 -0
- package/src/tools/list-services.ts +110 -0
- package/src/tools/poll-task.ts +46 -3
- package/src/tools/post-message.ts +87 -0
- package/src/tools/read-messages.ts +192 -0
- package/src/tools/register-service.ts +118 -0
- package/src/tools/send-task.ts +80 -7
- package/src/tools/store-progress.ts +9 -3
- package/src/tools/task-action.ts +211 -0
- package/src/tools/unregister-service.ts +110 -0
- package/src/tools/update-profile.ts +105 -0
- package/src/tools/update-service-status.ts +118 -0
- package/src/types.ts +110 -3
- package/src/utils/pretty-print.ts +224 -0
- package/thoughts/shared/plans/.gitkeep +0 -0
- package/thoughts/shared/plans/2025-12-18-inverse-teleport.md +1142 -0
- package/thoughts/shared/plans/2025-12-18-slack-integration.md +1195 -0
- package/thoughts/shared/plans/2025-12-19-agent-log-streaming.md +732 -0
- package/thoughts/shared/plans/2025-12-19-role-based-swarm-plugin.md +361 -0
- package/thoughts/shared/plans/2025-12-20-mobile-responsive-ui.md +501 -0
- package/thoughts/shared/plans/2025-12-20-startup-team-swarm.md +560 -0
- package/thoughts/shared/research/.gitkeep +0 -0
- package/thoughts/shared/research/2025-12-18-slack-integration.md +442 -0
- package/thoughts/shared/research/2025-12-19-agent-log-streaming.md +339 -0
- package/thoughts/shared/research/2025-12-19-agent-secrets-cli-research.md +390 -0
- package/thoughts/shared/research/2025-12-21-gemini-cli-integration.md +376 -0
- package/thoughts/shared/research/2025-12-22-setup-experience-improvements.md +264 -0
- package/tsconfig.json +3 -1
- package/ui/bun.lock +692 -0
- package/ui/index.html +22 -0
- package/ui/package.json +32 -0
- package/ui/pnpm-lock.yaml +3034 -0
- package/ui/postcss.config.js +6 -0
- package/ui/public/logo.png +0 -0
- package/ui/src/App.tsx +43 -0
- package/ui/src/components/ActivityFeed.tsx +415 -0
- package/ui/src/components/AgentDetailPanel.tsx +534 -0
- package/ui/src/components/AgentsPanel.tsx +549 -0
- package/ui/src/components/ChatPanel.tsx +1820 -0
- package/ui/src/components/ConfigModal.tsx +232 -0
- package/ui/src/components/Dashboard.tsx +534 -0
- package/ui/src/components/Header.tsx +168 -0
- package/ui/src/components/ServicesPanel.tsx +612 -0
- package/ui/src/components/StatsBar.tsx +288 -0
- package/ui/src/components/StatusBadge.tsx +124 -0
- package/ui/src/components/TaskDetailPanel.tsx +807 -0
- package/ui/src/components/TasksPanel.tsx +575 -0
- package/ui/src/hooks/queries.ts +170 -0
- package/ui/src/index.css +235 -0
- package/ui/src/lib/api.ts +161 -0
- package/ui/src/lib/config.ts +35 -0
- package/ui/src/lib/theme.ts +214 -0
- package/ui/src/lib/utils.ts +48 -0
- package/ui/src/main.tsx +32 -0
- package/ui/src/types/api.ts +164 -0
- package/ui/src/vite-env.d.ts +1 -0
- package/ui/tailwind.config.js +35 -0
- package/ui/tsconfig.json +31 -0
- package/ui/vite.config.ts +22 -0
- package/cc-plugin/README.md +0 -49
- package/cc-plugin/commands/setup-leader.md +0 -73
- package/cc-plugin/commands/start-worker.md +0 -64
- package/docker-compose.worker.yml +0 -35
- package/example-req-meta.json +0 -24
- /package/{cc-plugin → plugin}/hooks/hooks.json +0 -0
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
# Startup Team Swarm Implementation Plan
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Extend the agent-swarm to operate like a flat startup team with specialized worker agents (Dev Team + Security + Research), smart task routing based on capabilities, a human "board" for strategic oversight, and lightweight optional processes.
|
|
6
|
+
|
|
7
|
+
## Current State Analysis
|
|
8
|
+
|
|
9
|
+
- **Commands**: 2 generic commands (`start-leader.md`, `start-worker.md`)
|
|
10
|
+
- **Agents**: Empty directory (`.gitkeep` only)
|
|
11
|
+
- **Skills**: Empty directory (`.gitkeep` only)
|
|
12
|
+
- **Roles**: Workers can declare `role`, `capabilities[]`, `description` but nothing enforces routing
|
|
13
|
+
- **Tasks**: Support `taskType`, `tags[]`, `priority`, `dependsOn[]`
|
|
14
|
+
|
|
15
|
+
### Key Discoveries:
|
|
16
|
+
- Worker config: `src/commands/worker.ts:5-11`
|
|
17
|
+
- Lead config: `src/commands/lead.ts:5-11`
|
|
18
|
+
- Base prompt with role-specific instructions: `src/prompts/base-prompt.ts`
|
|
19
|
+
- Task assignment tool: `src/tools/send-task.ts`
|
|
20
|
+
- Database schema: `src/be/db.ts`
|
|
21
|
+
- Tool registration: `src/server.ts`
|
|
22
|
+
|
|
23
|
+
## Desired End State
|
|
24
|
+
|
|
25
|
+
1. Specialized worker templates in `plugin/agents/` for 8 roles
|
|
26
|
+
2. `suggest-assignment` tool for smart task-to-agent routing
|
|
27
|
+
3. Goals/milestones system for human board oversight (non-blocking)
|
|
28
|
+
4. Optional `request-review`/`submit-review` workflow
|
|
29
|
+
5. Reusable skills in `plugin/skills/`
|
|
30
|
+
|
|
31
|
+
### Verification:
|
|
32
|
+
- Workers join with role-specific capabilities from templates
|
|
33
|
+
- Lead uses `suggest-assignment` before `send-task`
|
|
34
|
+
- Human can create goals, review milestones via UI and #board channel
|
|
35
|
+
- Code review is opt-in, not required
|
|
36
|
+
|
|
37
|
+
## What We're NOT Doing
|
|
38
|
+
|
|
39
|
+
- **Multi-level hierarchy** - Keeping flat Lead + workers structure
|
|
40
|
+
- **Mandatory processes** - Code review stays optional
|
|
41
|
+
- **Blocking approvals** - Human board is strategic, doesn't block work
|
|
42
|
+
- **Role enforcement** - Workers can still join with any capabilities
|
|
43
|
+
|
|
44
|
+
## Implementation Approach
|
|
45
|
+
|
|
46
|
+
Add specialized agent templates, smart routing tool, goals/milestones database tables, board UI panel, and optional review workflow. Phases build incrementally - Phase 1 requires zero code changes.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Phase 1: Agent Specialization Templates
|
|
51
|
+
|
|
52
|
+
### Overview
|
|
53
|
+
Create YAML templates in `plugin/agents/` defining specialized worker profiles.
|
|
54
|
+
|
|
55
|
+
### Changes Required:
|
|
56
|
+
|
|
57
|
+
#### 1. Create agent template files
|
|
58
|
+
|
|
59
|
+
**`plugin/agents/frontend-engineer.yaml`**
|
|
60
|
+
```yaml
|
|
61
|
+
name: "Frontend Engineer"
|
|
62
|
+
role: "frontend"
|
|
63
|
+
capabilities:
|
|
64
|
+
- typescript
|
|
65
|
+
- react
|
|
66
|
+
- css
|
|
67
|
+
- html
|
|
68
|
+
- tailwind
|
|
69
|
+
- ui-ux
|
|
70
|
+
- accessibility
|
|
71
|
+
taskTypes:
|
|
72
|
+
- frontend
|
|
73
|
+
- ui
|
|
74
|
+
- styling
|
|
75
|
+
- component
|
|
76
|
+
description: |
|
|
77
|
+
Frontend specialist focused on React/TypeScript UI development.
|
|
78
|
+
Handles component creation, styling, accessibility, and user experience.
|
|
79
|
+
systemPromptAddition: |
|
|
80
|
+
You are a frontend engineer. Your expertise includes:
|
|
81
|
+
- React component architecture and hooks
|
|
82
|
+
- TypeScript for type-safe frontend code
|
|
83
|
+
- CSS/Tailwind for styling
|
|
84
|
+
- Accessibility (a11y) best practices
|
|
85
|
+
- Performance optimization (lazy loading, memoization)
|
|
86
|
+
|
|
87
|
+
When receiving tasks, prioritize UI/UX quality and responsive design.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Create similar files for:
|
|
91
|
+
- `backend-engineer.yaml` - API, database, server (bun, sql, graphql)
|
|
92
|
+
- `devops-engineer.yaml` - Docker, CI/CD, deployment, automation
|
|
93
|
+
- `qa-engineer.yaml` - Testing, bun-test, e2e, quality-assurance
|
|
94
|
+
- `code-reviewer.yaml` - Code review, security, best-practices
|
|
95
|
+
- `security-auditor.yaml` - Vulnerability assessment, auth, encryption
|
|
96
|
+
- `researcher.yaml` - Research, documentation, web-search, context7
|
|
97
|
+
- `analyst.yaml` - Analysis, planning, estimation, metrics
|
|
98
|
+
|
|
99
|
+
#### 2. Update start-worker.md
|
|
100
|
+
|
|
101
|
+
**File**: `plugin/commands/start-worker.md`
|
|
102
|
+
|
|
103
|
+
Add section for template-based registration:
|
|
104
|
+
```markdown
|
|
105
|
+
## Specialized Worker Setup
|
|
106
|
+
|
|
107
|
+
If your user specified a specialization, check `plugin/agents/` for the template:
|
|
108
|
+
- `frontend` - Frontend Engineer
|
|
109
|
+
- `backend` - Backend Engineer
|
|
110
|
+
- `devops` - DevOps Engineer
|
|
111
|
+
- `qa` - QA Engineer
|
|
112
|
+
- `reviewer` - Code Reviewer
|
|
113
|
+
- `security` - Security Auditor
|
|
114
|
+
- `researcher` - Researcher
|
|
115
|
+
- `analyst` - Technical Analyst
|
|
116
|
+
|
|
117
|
+
Use the matching role and capabilities from the template when calling `join-swarm`.
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Success Criteria:
|
|
121
|
+
|
|
122
|
+
#### Automated Verification:
|
|
123
|
+
- [ ] `ls plugin/agents/*.yaml` shows 8 template files
|
|
124
|
+
- [ ] Each template has `name`, `role`, `capabilities`, `taskTypes`, `description`, `systemPromptAddition`
|
|
125
|
+
|
|
126
|
+
#### Manual Verification:
|
|
127
|
+
- [ ] Worker joins with capabilities from template
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Phase 2: Smart Task Routing
|
|
132
|
+
|
|
133
|
+
### Overview
|
|
134
|
+
Add `suggest-assignment` tool for lead to match tasks to workers by capability.
|
|
135
|
+
|
|
136
|
+
### Changes Required:
|
|
137
|
+
|
|
138
|
+
#### 1. Create suggest-assignment tool
|
|
139
|
+
|
|
140
|
+
**File**: `src/tools/suggest-assignment.ts`
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
144
|
+
import * as z from "zod";
|
|
145
|
+
import { getAllAgents, getTasksByAgentId } from "@/be/db";
|
|
146
|
+
import { createToolRegistrar } from "@/tools/utils";
|
|
147
|
+
|
|
148
|
+
export const registerSuggestAssignmentTool = (server: McpServer) => {
|
|
149
|
+
createToolRegistrar(server)(
|
|
150
|
+
"suggest-assignment",
|
|
151
|
+
{
|
|
152
|
+
title: "Suggest Task Assignment",
|
|
153
|
+
description: "Suggests best agent(s) for a task based on capabilities and availability.",
|
|
154
|
+
inputSchema: z.object({
|
|
155
|
+
taskDescription: z.string().describe("The task to be assigned"),
|
|
156
|
+
taskType: z.string().optional().describe("Task type (frontend, backend, etc.)"),
|
|
157
|
+
tags: z.array(z.string()).optional().describe("Task tags"),
|
|
158
|
+
requiredCapabilities: z.array(z.string()).optional().describe("Required capabilities"),
|
|
159
|
+
}),
|
|
160
|
+
outputSchema: z.object({
|
|
161
|
+
suggestions: z.array(z.object({
|
|
162
|
+
agentId: z.string(),
|
|
163
|
+
agentName: z.string(),
|
|
164
|
+
role: z.string().optional(),
|
|
165
|
+
matchScore: z.number(),
|
|
166
|
+
matchReasons: z.array(z.string()),
|
|
167
|
+
availability: z.enum(["idle", "busy", "offline"]),
|
|
168
|
+
pendingTaskCount: z.number(),
|
|
169
|
+
recommendation: z.enum(["strong", "good", "possible", "not-recommended"]),
|
|
170
|
+
})),
|
|
171
|
+
}),
|
|
172
|
+
},
|
|
173
|
+
async (input, requestInfo, _meta) => {
|
|
174
|
+
const agents = getAllAgents().filter(a => !a.isLead);
|
|
175
|
+
const suggestions = [];
|
|
176
|
+
|
|
177
|
+
for (const agent of agents) {
|
|
178
|
+
const pendingTasks = getTasksByAgentId(agent.id)
|
|
179
|
+
.filter(t => ["pending", "in_progress"].includes(t.status));
|
|
180
|
+
|
|
181
|
+
let score = 0;
|
|
182
|
+
const reasons: string[] = [];
|
|
183
|
+
|
|
184
|
+
// Capability matching (+10 per match)
|
|
185
|
+
if (input.requiredCapabilities) {
|
|
186
|
+
const matched = input.requiredCapabilities.filter(c =>
|
|
187
|
+
agent.capabilities?.includes(c)
|
|
188
|
+
);
|
|
189
|
+
if (matched.length > 0) {
|
|
190
|
+
score += matched.length * 10;
|
|
191
|
+
reasons.push(`Matches: ${matched.join(", ")}`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Role matching (+20)
|
|
196
|
+
if (input.taskType && agent.role) {
|
|
197
|
+
const roleMap: Record<string, string[]> = {
|
|
198
|
+
frontend: ["frontend", "ui", "component"],
|
|
199
|
+
backend: ["backend", "api", "database"],
|
|
200
|
+
qa: ["testing", "qa", "bug"],
|
|
201
|
+
devops: ["devops", "deployment", "infrastructure"],
|
|
202
|
+
reviewer: ["review", "security-review"],
|
|
203
|
+
security: ["security", "audit", "vulnerability"],
|
|
204
|
+
researcher: ["research", "documentation"],
|
|
205
|
+
analyst: ["analysis", "planning"],
|
|
206
|
+
};
|
|
207
|
+
if (roleMap[agent.role]?.includes(input.taskType)) {
|
|
208
|
+
score += 20;
|
|
209
|
+
reasons.push(`Role "${agent.role}" matches task type`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Availability (+15 if idle)
|
|
214
|
+
if (agent.status === "idle") {
|
|
215
|
+
score += 15;
|
|
216
|
+
reasons.push("Agent is idle");
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Workload penalty (-10 if >3 tasks)
|
|
220
|
+
if (pendingTasks.length > 3) {
|
|
221
|
+
score -= 10;
|
|
222
|
+
reasons.push(`High workload (${pendingTasks.length} tasks)`);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const recommendation =
|
|
226
|
+
score >= 30 ? "strong" :
|
|
227
|
+
score >= 15 ? "good" :
|
|
228
|
+
score > 0 ? "possible" : "not-recommended";
|
|
229
|
+
|
|
230
|
+
suggestions.push({
|
|
231
|
+
agentId: agent.id,
|
|
232
|
+
agentName: agent.name,
|
|
233
|
+
role: agent.role,
|
|
234
|
+
matchScore: score,
|
|
235
|
+
matchReasons: reasons,
|
|
236
|
+
availability: agent.status,
|
|
237
|
+
pendingTaskCount: pendingTasks.length,
|
|
238
|
+
recommendation,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
suggestions.sort((a, b) => b.matchScore - a.matchScore);
|
|
243
|
+
|
|
244
|
+
return {
|
|
245
|
+
content: [{ type: "text", text: JSON.stringify(suggestions, null, 2) }],
|
|
246
|
+
structuredContent: { suggestions },
|
|
247
|
+
};
|
|
248
|
+
},
|
|
249
|
+
);
|
|
250
|
+
};
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
#### 2. Register tool in server
|
|
254
|
+
|
|
255
|
+
**File**: `src/server.ts`
|
|
256
|
+
|
|
257
|
+
Add import and registration:
|
|
258
|
+
```typescript
|
|
259
|
+
import { registerSuggestAssignmentTool } from "@/tools/suggest-assignment";
|
|
260
|
+
|
|
261
|
+
// In registration section:
|
|
262
|
+
registerSuggestAssignmentTool(server);
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
#### 3. Update lead prompt
|
|
266
|
+
|
|
267
|
+
**File**: `plugin/commands/start-leader.md`
|
|
268
|
+
|
|
269
|
+
Add routing guidance:
|
|
270
|
+
```markdown
|
|
271
|
+
## Smart Task Routing
|
|
272
|
+
|
|
273
|
+
Before assigning tasks, use `suggest-assignment` to find the best worker:
|
|
274
|
+
|
|
275
|
+
1. Identify task type and required capabilities
|
|
276
|
+
2. Call `suggest-assignment` with this info
|
|
277
|
+
3. Assign to "strong" or "good" matches
|
|
278
|
+
4. If no good matches, create unassigned task for pool
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Success Criteria:
|
|
282
|
+
|
|
283
|
+
#### Automated Verification:
|
|
284
|
+
- [ ] `bun run tsc` passes
|
|
285
|
+
- [ ] `suggest-assignment` tool registered in server
|
|
286
|
+
|
|
287
|
+
#### Manual Verification:
|
|
288
|
+
- [ ] Lead receives ranked suggestions when routing tasks
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Phase 3: Human Board Interface
|
|
293
|
+
|
|
294
|
+
### Overview
|
|
295
|
+
Add goals/milestones system for strategic human oversight.
|
|
296
|
+
|
|
297
|
+
### Changes Required:
|
|
298
|
+
|
|
299
|
+
#### 1. Add database tables
|
|
300
|
+
|
|
301
|
+
**File**: `src/be/db.ts`
|
|
302
|
+
|
|
303
|
+
Add to `initDb()`:
|
|
304
|
+
```typescript
|
|
305
|
+
db.run(`
|
|
306
|
+
CREATE TABLE IF NOT EXISTS goals (
|
|
307
|
+
id TEXT PRIMARY KEY,
|
|
308
|
+
title TEXT NOT NULL,
|
|
309
|
+
description TEXT,
|
|
310
|
+
status TEXT NOT NULL DEFAULT 'active' CHECK(status IN ('active', 'completed', 'cancelled')),
|
|
311
|
+
priority INTEGER DEFAULT 50,
|
|
312
|
+
createdAt TEXT NOT NULL,
|
|
313
|
+
completedAt TEXT
|
|
314
|
+
);
|
|
315
|
+
|
|
316
|
+
CREATE TABLE IF NOT EXISTS milestones (
|
|
317
|
+
id TEXT PRIMARY KEY,
|
|
318
|
+
goalId TEXT NOT NULL,
|
|
319
|
+
title TEXT NOT NULL,
|
|
320
|
+
description TEXT,
|
|
321
|
+
status TEXT NOT NULL DEFAULT 'pending' CHECK(status IN ('pending', 'in_review', 'approved', 'rejected')),
|
|
322
|
+
reviewNotes TEXT,
|
|
323
|
+
createdAt TEXT NOT NULL,
|
|
324
|
+
submittedAt TEXT,
|
|
325
|
+
reviewedAt TEXT,
|
|
326
|
+
FOREIGN KEY (goalId) REFERENCES goals(id) ON DELETE CASCADE
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
CREATE TABLE IF NOT EXISTS goal_tasks (
|
|
330
|
+
goalId TEXT NOT NULL,
|
|
331
|
+
taskId TEXT NOT NULL,
|
|
332
|
+
PRIMARY KEY (goalId, taskId),
|
|
333
|
+
FOREIGN KEY (goalId) REFERENCES goals(id) ON DELETE CASCADE,
|
|
334
|
+
FOREIGN KEY (taskId) REFERENCES agent_tasks(id) ON DELETE CASCADE
|
|
335
|
+
);
|
|
336
|
+
`);
|
|
337
|
+
|
|
338
|
+
// Seed #board channel
|
|
339
|
+
db.run(`
|
|
340
|
+
INSERT OR IGNORE INTO channels (id, name, description, type, createdAt)
|
|
341
|
+
VALUES ('00000000-0000-4000-8000-000000000002', 'board',
|
|
342
|
+
'Strategic board for human direction and milestone approvals', 'public',
|
|
343
|
+
strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
|
|
344
|
+
`);
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
#### 2. Add types
|
|
348
|
+
|
|
349
|
+
**File**: `src/types.ts`
|
|
350
|
+
|
|
351
|
+
```typescript
|
|
352
|
+
export const GoalStatusSchema = z.enum(["active", "completed", "cancelled"]);
|
|
353
|
+
export const MilestoneStatusSchema = z.enum(["pending", "in_review", "approved", "rejected"]);
|
|
354
|
+
|
|
355
|
+
export const GoalSchema = z.object({
|
|
356
|
+
id: z.uuid(),
|
|
357
|
+
title: z.string().min(1),
|
|
358
|
+
description: z.string().optional(),
|
|
359
|
+
status: GoalStatusSchema,
|
|
360
|
+
priority: z.number().int().min(0).max(100).default(50),
|
|
361
|
+
createdAt: z.iso.datetime(),
|
|
362
|
+
completedAt: z.iso.datetime().optional(),
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
export const MilestoneSchema = z.object({
|
|
366
|
+
id: z.uuid(),
|
|
367
|
+
goalId: z.uuid(),
|
|
368
|
+
title: z.string().min(1),
|
|
369
|
+
description: z.string().optional(),
|
|
370
|
+
status: MilestoneStatusSchema,
|
|
371
|
+
reviewNotes: z.string().optional(),
|
|
372
|
+
createdAt: z.iso.datetime(),
|
|
373
|
+
submittedAt: z.iso.datetime().optional(),
|
|
374
|
+
reviewedAt: z.iso.datetime().optional(),
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
export type Goal = z.infer<typeof GoalSchema>;
|
|
378
|
+
export type Milestone = z.infer<typeof MilestoneSchema>;
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
#### 3. Create board tools
|
|
382
|
+
|
|
383
|
+
| File | Tool | Purpose |
|
|
384
|
+
|------|------|---------|
|
|
385
|
+
| `src/tools/create-goal.ts` | `create-goal` | Create strategic goals |
|
|
386
|
+
| `src/tools/get-goals.ts` | `get-goals` | List goals with status |
|
|
387
|
+
| `src/tools/submit-milestone.ts` | `submit-milestone` | Agent submits milestone for review |
|
|
388
|
+
| `src/tools/review-milestone.ts` | `review-milestone` | Human approves/rejects |
|
|
389
|
+
| `src/tools/link-task-to-goal.ts` | `link-task-to-goal` | Associate tasks with goals |
|
|
390
|
+
|
|
391
|
+
#### 4. Create UI component
|
|
392
|
+
|
|
393
|
+
**File**: `ui/src/components/BoardPanel.tsx`
|
|
394
|
+
|
|
395
|
+
Features:
|
|
396
|
+
- List of active goals with progress
|
|
397
|
+
- Pending milestones awaiting review
|
|
398
|
+
- Quick approve/reject actions
|
|
399
|
+
- Create new goal form
|
|
400
|
+
|
|
401
|
+
#### 5. Add tab to Dashboard
|
|
402
|
+
|
|
403
|
+
**File**: `ui/src/components/Dashboard.tsx`
|
|
404
|
+
|
|
405
|
+
Add BOARD tab next to existing tabs.
|
|
406
|
+
|
|
407
|
+
### Success Criteria:
|
|
408
|
+
|
|
409
|
+
#### Automated Verification:
|
|
410
|
+
- [ ] `bun run tsc` passes
|
|
411
|
+
- [ ] Goals/milestones tables exist after db init
|
|
412
|
+
- [ ] Board tools registered
|
|
413
|
+
|
|
414
|
+
#### Manual Verification:
|
|
415
|
+
- [ ] Human can create goals in UI
|
|
416
|
+
- [ ] Agents can submit milestones
|
|
417
|
+
- [ ] Human can approve/reject in UI
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
## Phase 4: Optional Code Review Workflow
|
|
422
|
+
|
|
423
|
+
### Overview
|
|
424
|
+
Add request-based code review (opt-in, not mandatory).
|
|
425
|
+
|
|
426
|
+
### Changes Required:
|
|
427
|
+
|
|
428
|
+
#### 1. Create request-review tool
|
|
429
|
+
|
|
430
|
+
**File**: `src/tools/request-review.ts`
|
|
431
|
+
|
|
432
|
+
```typescript
|
|
433
|
+
export const registerRequestReviewTool = (server: McpServer) => {
|
|
434
|
+
createToolRegistrar(server)(
|
|
435
|
+
"request-review",
|
|
436
|
+
{
|
|
437
|
+
title: "Request Code Review",
|
|
438
|
+
description: "Request a code review. Creates a review task in the pool.",
|
|
439
|
+
inputSchema: z.object({
|
|
440
|
+
description: z.string().describe("What to review and focus areas"),
|
|
441
|
+
files: z.array(z.string()).optional().describe("Files to review"),
|
|
442
|
+
urgency: z.enum(["low", "normal", "high"]).default("normal"),
|
|
443
|
+
originalTaskId: z.uuid().optional().describe("Link to original task"),
|
|
444
|
+
}),
|
|
445
|
+
outputSchema: z.object({
|
|
446
|
+
success: z.boolean(),
|
|
447
|
+
reviewTaskId: z.string().optional(),
|
|
448
|
+
message: z.string(),
|
|
449
|
+
}),
|
|
450
|
+
},
|
|
451
|
+
async (input, requestInfo, _meta) => {
|
|
452
|
+
// Create review task with taskType="review"
|
|
453
|
+
// Set priority based on urgency
|
|
454
|
+
// Tag with files
|
|
455
|
+
},
|
|
456
|
+
);
|
|
457
|
+
};
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
#### 2. Create submit-review tool
|
|
461
|
+
|
|
462
|
+
**File**: `src/tools/submit-review.ts`
|
|
463
|
+
|
|
464
|
+
Accepts verdict (approved/changes-requested/blocked), summary, and structured issues.
|
|
465
|
+
|
|
466
|
+
### Success Criteria:
|
|
467
|
+
|
|
468
|
+
#### Automated Verification:
|
|
469
|
+
- [ ] `bun run tsc` passes
|
|
470
|
+
- [ ] Review tools registered
|
|
471
|
+
|
|
472
|
+
#### Manual Verification:
|
|
473
|
+
- [ ] Agent can request review
|
|
474
|
+
- [ ] Reviewer can submit findings
|
|
475
|
+
|
|
476
|
+
---
|
|
477
|
+
|
|
478
|
+
## Phase 5: Skill Library
|
|
479
|
+
|
|
480
|
+
### Overview
|
|
481
|
+
Create reusable markdown skills in `plugin/skills/`.
|
|
482
|
+
|
|
483
|
+
### Changes Required:
|
|
484
|
+
|
|
485
|
+
| Skill | Description |
|
|
486
|
+
|-------|-------------|
|
|
487
|
+
| `git-operations.md` | Safe commit workflow, branch naming, PR creation |
|
|
488
|
+
| `bun-development.md` | Bun-first patterns (Bun.serve, bun:sqlite, bun test) |
|
|
489
|
+
| `service-registry.md` | PM2 + service registration workflow |
|
|
490
|
+
| `task-management.md` | Task lifecycle best practices |
|
|
491
|
+
| `code-review-checklist.md` | Security, quality, performance checklist |
|
|
492
|
+
|
|
493
|
+
### Success Criteria:
|
|
494
|
+
|
|
495
|
+
#### Automated Verification:
|
|
496
|
+
- [ ] `ls plugin/skills/*.md` shows 5 skill files
|
|
497
|
+
|
|
498
|
+
---
|
|
499
|
+
|
|
500
|
+
## Testing Strategy
|
|
501
|
+
|
|
502
|
+
### Unit Tests:
|
|
503
|
+
- `suggest-assignment` returns ranked suggestions
|
|
504
|
+
- Goals/milestones CRUD operations work
|
|
505
|
+
- Review tools create/complete tasks correctly
|
|
506
|
+
|
|
507
|
+
### Integration Tests:
|
|
508
|
+
- Worker joins with template capabilities
|
|
509
|
+
- Lead routes task to correct specialist
|
|
510
|
+
- Milestone approval workflow end-to-end
|
|
511
|
+
|
|
512
|
+
### Manual Testing Steps:
|
|
513
|
+
1. Start swarm with 2+ specialized workers
|
|
514
|
+
2. Lead receives task, uses `suggest-assignment`
|
|
515
|
+
3. Verify correct worker is suggested
|
|
516
|
+
4. Human creates goal, links tasks
|
|
517
|
+
5. Agent submits milestone, human approves
|
|
518
|
+
|
|
519
|
+
---
|
|
520
|
+
|
|
521
|
+
## Files Summary
|
|
522
|
+
|
|
523
|
+
### New Files (22)
|
|
524
|
+
|
|
525
|
+
**Agent Templates (8)**: `plugin/agents/*.yaml`
|
|
526
|
+
**Tools (8)**:
|
|
527
|
+
- `src/tools/suggest-assignment.ts`
|
|
528
|
+
- `src/tools/create-goal.ts`
|
|
529
|
+
- `src/tools/get-goals.ts`
|
|
530
|
+
- `src/tools/submit-milestone.ts`
|
|
531
|
+
- `src/tools/review-milestone.ts`
|
|
532
|
+
- `src/tools/link-task-to-goal.ts`
|
|
533
|
+
- `src/tools/request-review.ts`
|
|
534
|
+
- `src/tools/submit-review.ts`
|
|
535
|
+
|
|
536
|
+
**UI (1)**: `ui/src/components/BoardPanel.tsx`
|
|
537
|
+
**Skills (5)**: `plugin/skills/*.md`
|
|
538
|
+
|
|
539
|
+
### Modified Files (5)
|
|
540
|
+
|
|
541
|
+
| File | Changes |
|
|
542
|
+
|------|---------|
|
|
543
|
+
| `src/be/db.ts` | Add goals/milestones tables, seed #board |
|
|
544
|
+
| `src/types.ts` | Add Goal, Milestone types |
|
|
545
|
+
| `src/server.ts` | Register new tools |
|
|
546
|
+
| `plugin/commands/start-worker.md` | Add template references |
|
|
547
|
+
| `plugin/commands/start-leader.md` | Add routing guidance |
|
|
548
|
+
| `ui/src/components/Dashboard.tsx` | Add BOARD tab |
|
|
549
|
+
|
|
550
|
+
---
|
|
551
|
+
|
|
552
|
+
## References
|
|
553
|
+
|
|
554
|
+
- Worker config: `src/commands/worker.ts:5-11`
|
|
555
|
+
- Lead config: `src/commands/lead.ts:5-11`
|
|
556
|
+
- Base prompt: `src/prompts/base-prompt.ts`
|
|
557
|
+
- Task tools pattern: `src/tools/send-task.ts`
|
|
558
|
+
- Database schema: `src/be/db.ts`
|
|
559
|
+
- Tool registration: `src/server.ts`
|
|
560
|
+
- UI Dashboard: `ui/src/components/Dashboard.tsx`
|
|
File without changes
|