@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,415 @@
1
+ ---
2
+ description: Create detailed implementation plans through interactive research and iteration
3
+ ---
4
+
5
+ # Implementation Plan
6
+
7
+ You are tasked with creating detailed implementation plans through an interactive, iterative process. You should be skeptical, thorough, and work collaboratively with the user to produce high-quality technical specifications.
8
+
9
+ ## Initial Response
10
+
11
+ When this command is invoked:
12
+
13
+ 1. **Check if parameters were provided**:
14
+ - If a file path was provided as a parameter, skip the default message
15
+ - Immediately read any provided files FULLY
16
+ - Begin the research process
17
+
18
+ 2. **If no parameters provided**, respond with:
19
+ ```
20
+ I'll help you create a detailed implementation plan. Let me start by understanding what we're building.
21
+
22
+ Please provide:
23
+ 1. The task description
24
+ 2. Any relevant context, constraints, or specific requirements
25
+ 3. Links to related research or previous implementations
26
+
27
+ I'll analyze this information and work with you to create a comprehensive plan.
28
+ ```
29
+
30
+ Then wait for the user's input.
31
+
32
+ ## Process Steps
33
+
34
+ ### Step 1: Context Gathering & Initial Analysis
35
+
36
+ 1. **Read all mentioned files immediately and FULLY**:
37
+ - Research documents
38
+ - Related implementation plans
39
+ - Any JSON/data files mentioned
40
+ - **IMPORTANT**: Use the Read tool WITHOUT limit/offset parameters to read entire files
41
+ - **CRITICAL**: DO NOT spawn sub-tasks before reading these files yourself in the main context
42
+ - **NEVER** read files partially - if a file is mentioned, read it completely
43
+
44
+ 2. **Spawn initial research tasks to gather context**:
45
+ Before asking the user any questions, use specialized agents to research in parallel:
46
+
47
+ - Use the **codebase-locator** agent to find all files related to the task
48
+ - Use the **codebase-analyzer** agent to understand how the current implementation works
49
+ - If relevant, use the **thoughts-locator** agent to find any existing thoughts documents about this feature
50
+
51
+ These agents will:
52
+ - Find relevant source files, configs, and tests
53
+ - Identify the specific directories to focus on (e.g., if backend or be is mentioned, they'll focus on be/)
54
+ - Trace data flow and key functions
55
+ - Return detailed explanations with file:line references
56
+
57
+ 3. **Read all files identified by research tasks**:
58
+ - After research tasks complete, read ALL files they identified as relevant
59
+ - Read them FULLY into the main context
60
+ - This ensures you have complete understanding before proceeding
61
+
62
+ 4. **Analyze and verify understanding**:
63
+ - Identify any discrepancies or misunderstandings
64
+ - Note assumptions that need verification
65
+ - Determine true scope based on codebase reality
66
+
67
+ 5. **Present informed understanding and focused questions**:
68
+ ```
69
+ Based on the research of the codebase, I understand we need to [accurate summary].
70
+
71
+ I've found that:
72
+ - [Current implementation detail with file:line reference]
73
+ - [Relevant pattern or constraint discovered]
74
+ - [Potential complexity or edge case identified]
75
+
76
+ Questions that my research couldn't answer:
77
+ - [Specific technical question that requires human judgment]
78
+ - [Business logic clarification]
79
+ - [Design preference that affects implementation]
80
+ ```
81
+
82
+ Only ask questions that you genuinely cannot answer through code investigation.
83
+
84
+ ### Step 2: Research & Discovery
85
+
86
+ After getting initial clarifications:
87
+
88
+ 1. **If the user corrects any misunderstanding**:
89
+ - DO NOT just accept the correction
90
+ - Spawn new research tasks to verify the correct information
91
+ - Read the specific files/directories they mention
92
+ - Only proceed once you've verified the facts yourself
93
+
94
+ 2. **Create a research todo list** using TodoWrite to track exploration tasks
95
+
96
+ 3. **Spawn parallel sub-tasks for comprehensive research**:
97
+ - Create multiple Task agents to research different aspects concurrently
98
+ - Use the right agent for each type of research:
99
+
100
+ **For deeper investigation:**
101
+ - **codebase-locator** - To find more specific files (e.g., "find all files that handle [specific component]")
102
+ - **codebase-analyzer** - To understand implementation details (e.g., "analyze how [system] works")
103
+ - **codebase-pattern-finder** - To find similar features we can model after
104
+
105
+ Each agent knows how to:
106
+ - Find the right files and code patterns
107
+ - Identify conventions and patterns to follow
108
+ - Look for integration points and dependencies
109
+ - Return specific file:line references
110
+ - Find tests and examples
111
+
112
+ 3. **Wait for ALL sub-tasks to complete** before proceeding
113
+
114
+ 4. **Present findings and design options**:
115
+ ```
116
+ Based on my research, here's what I found:
117
+
118
+ **Current State:**
119
+ - [Key discovery about existing code]
120
+ - [Pattern or convention to follow]
121
+
122
+ **Design Options:**
123
+ 1. [Option A] - [pros/cons]
124
+ 2. [Option B] - [pros/cons]
125
+
126
+ **Open Questions:**
127
+ - [Technical uncertainty]
128
+ - [Design decision needed]
129
+
130
+ Which approach aligns best with your vision?
131
+ ```
132
+
133
+ ### Step 3: Plan Structure Development
134
+
135
+ Once aligned on approach:
136
+
137
+ 1. **Create initial plan outline**:
138
+ ```
139
+ Here's my proposed plan structure:
140
+
141
+ ## Overview
142
+ [1-2 sentence summary]
143
+
144
+ ## Implementation Phases:
145
+ 1. [Phase name] - [what it accomplishes]
146
+ 2. [Phase name] - [what it accomplishes]
147
+ 3. [Phase name] - [what it accomplishes]
148
+
149
+ Does this phasing make sense? Should I adjust the order or granularity?
150
+ ```
151
+
152
+ 2. **Get feedback on structure** before writing details
153
+
154
+ ### Step 4: Detailed Plan Writing
155
+
156
+ After structure approval:
157
+
158
+ 1. **Write the plan** to `/workspace/shared/thoughts/shared/plans/YYYY-MM-DD-description.md`
159
+ - Format: `YYYY-MM-DD-description.md` where:
160
+ - YYYY-MM-DD is today's date
161
+ - description is a brief kebab-case description
162
+ - Example: `2025-01-08-improve-error-handling.md`
163
+ - Use your agent ID in the path if its an internal plan: `/workspace/shared/thoughts/{yourAgentId}/plans/YYYY-MM-DD-description.md`
164
+ 2. **Use this template structure**:
165
+
166
+ ````markdown
167
+ # [Feature/Task Name] Implementation Plan
168
+
169
+ ## Overview
170
+
171
+ [Brief description of what we're implementing and why]
172
+
173
+ ## Current State Analysis
174
+
175
+ [What exists now, what's missing, key constraints discovered]
176
+
177
+ ## Desired End State
178
+
179
+ [A Specification of the desired end state after this plan is complete, and how to verify it]
180
+
181
+ ### Key Discoveries:
182
+ - [Important finding with file:line reference]
183
+ - [Pattern to follow]
184
+ - [Constraint to work within]
185
+
186
+ ## What We're NOT Doing
187
+
188
+ [Explicitly list out-of-scope items to prevent scope creep]
189
+
190
+ ## Implementation Approach
191
+
192
+ [High-level strategy and reasoning]
193
+
194
+ ## Phase 1: [Descriptive Name]
195
+
196
+ ### Overview
197
+ [What this phase accomplishes]
198
+
199
+ ### Changes Required:
200
+
201
+ #### 1. [Component/File Group]
202
+ **File**: `path/to/file.ext`
203
+ **Changes**: [Summary of changes]
204
+
205
+ ```[language]
206
+ // Specific code to add/modify
207
+ ```
208
+
209
+ ### Success Criteria:
210
+
211
+ #### Automated Verification:
212
+ - [ ] Migration applies cleanly: `make migrate`
213
+ - [ ] Unit tests pass: `make test-component`
214
+ - [ ] Type checking passes: `npm run typecheck`
215
+ - [ ] Linting passes: `make lint`
216
+ - [ ] Integration tests pass: `make test-integration`
217
+
218
+ #### Manual Verification:
219
+ - [ ] Feature works as expected when tested via UI
220
+ - [ ] Performance is acceptable under load
221
+ - [ ] Edge case handling verified manually
222
+ - [ ] No regressions in related features
223
+
224
+ **Implementation Note**: After completing this phase and all automated verification passes, pause here for manual confirmation from the human that the manual testing was successful before proceeding to the next phase.
225
+
226
+ ---
227
+
228
+ ## Phase 2: [Descriptive Name]
229
+
230
+ [Similar structure with both automated and manual success criteria...]
231
+
232
+ ---
233
+
234
+ ## Testing Strategy
235
+
236
+ ### Unit Tests:
237
+ - [What to test]
238
+ - [Key edge cases]
239
+
240
+ ### Integration Tests:
241
+ - [End-to-end scenarios]
242
+
243
+ ### Manual Testing Steps:
244
+ 1. [Specific step to verify feature]
245
+ 2. [Another verification step]
246
+ 3. [Edge case to test manually]
247
+
248
+ ## Performance Considerations
249
+
250
+ [Any performance implications or optimizations needed]
251
+
252
+ ## Migration Notes
253
+
254
+ [If applicable, how to handle existing data/systems]
255
+
256
+ ## References
257
+
258
+ - Related research: `/workspace/shared/thoughts/{shared|agentId}/research/[relevant].md`
259
+ - Similar implementation: `[file:line]`
260
+ ````
261
+
262
+ ### Step 5: Sync and Review
263
+
264
+ 1. **Sync the thoughts directory**:
265
+ - Run `humanlayer thoughts sync` to sync the newly created plan
266
+ - This ensures the plan is properly indexed and available
267
+
268
+ 2. **Present the draft plan location to the lead, or just proceed**:
269
+ ```
270
+ I've created the initial implementation plan at:
271
+ `/workspace/shared/thoughts/shared/plans/YYYY-MM-DD-ENG-XXXX-description.md`
272
+
273
+ Please review it and let me know:
274
+ - Are the phases properly scoped?
275
+ - Are the success criteria specific enough?
276
+ - Any technical details that need adjustment?
277
+ - Missing edge cases or considerations?
278
+ ```
279
+
280
+ 3. **Iterate based on feedback** - be ready to:
281
+ - Add missing phases
282
+ - Adjust technical approach
283
+ - Clarify success criteria (both automated and manual)
284
+ - Add/remove scope items
285
+ - After making changes, run `humanlayer thoughts sync` again
286
+
287
+ 4. **Continue refining** until the user is satisfied
288
+
289
+ ## Important Guidelines
290
+
291
+ 1. **Be Skeptical**:
292
+ - Question vague requirements
293
+ - Identify potential issues early
294
+ - Ask "why" and "what about"
295
+ - Don't assume - verify with code
296
+
297
+ 2. **Be Interactive**:
298
+ - Don't write the full plan in one shot
299
+ - Get buy-in at each major step
300
+ - Allow course corrections
301
+ - Work collaboratively
302
+
303
+ 3. **Be Thorough**:
304
+ - Read all context files COMPLETELY before planning
305
+ - Research actual code patterns using parallel sub-tasks
306
+ - Include specific file paths and line numbers
307
+ - Write measurable success criteria with clear automated vs manual distinction
308
+ - automated steps should use `make` whenever possible - for example `make -C humanlayer-wui check` instead of `cd humanlayer-wui && bun run fmt`
309
+
310
+ 4. **Be Practical**:
311
+ - Focus on incremental, testable changes
312
+ - Consider migration and rollback
313
+ - Think about edge cases
314
+ - Include "what we're NOT doing"
315
+
316
+ 5. **Track Progress**:
317
+ - Use TodoWrite to track planning tasks
318
+ - Update todos as you complete research
319
+ - Mark planning tasks complete when done
320
+
321
+ 6. **No Open Questions in Final Plan**:
322
+ - If you encounter open questions during planning, STOP
323
+ - Research or ask for clarification immediately
324
+ - Do NOT write the plan with unresolved questions
325
+ - The implementation plan must be complete and actionable
326
+ - Every decision must be made before finalizing the plan
327
+
328
+ ## Success Criteria Guidelines
329
+
330
+ **Always separate success criteria into two categories:**
331
+
332
+ 1. **Automated Verification** (can be run by execution agents):
333
+ - Commands that can be run: `make test`, `npm run lint`, etc.
334
+ - Specific files that should exist
335
+ - Code compilation/type checking
336
+ - Automated test suites
337
+
338
+ 2. **Manual Verification** (requires human testing):
339
+ - UI/UX functionality
340
+ - Performance under real conditions
341
+ - Edge cases that are hard to automate
342
+ - User acceptance criteria
343
+
344
+ **Format example:**
345
+ ```markdown
346
+ ### Success Criteria:
347
+
348
+ #### Automated Verification:
349
+ - [ ] Database migration runs successfully: `make migrate`
350
+ - [ ] All unit tests pass: `go test ./...`
351
+ - [ ] No linting errors: `golangci-lint run`
352
+ - [ ] API endpoint returns 200: `curl localhost:8080/api/new-endpoint`
353
+
354
+ #### Manual Verification:
355
+ - [ ] New feature appears correctly in the UI
356
+ - [ ] Performance is acceptable with 1000+ items
357
+ - [ ] Error messages are user-friendly
358
+ - [ ] Feature works correctly on mobile devices
359
+ ```
360
+
361
+ ## Common Patterns
362
+
363
+ ### For Database Changes:
364
+ - Start with schema/migration
365
+ - Add store methods
366
+ - Update business logic
367
+ - Expose via API
368
+ - Update clients
369
+
370
+ ### For New Features:
371
+ - Research existing patterns first
372
+ - Start with data model
373
+ - Build backend logic
374
+ - Add API endpoints
375
+ - Implement UI last
376
+
377
+ ### For Refactoring:
378
+ - Document current behavior
379
+ - Plan incremental changes
380
+ - Maintain backwards compatibility
381
+ - Include migration strategy
382
+
383
+ ## Sub-task Spawning Best Practices
384
+
385
+ When spawning research sub-tasks:
386
+
387
+ 1. **Spawn multiple tasks in parallel** for efficiency
388
+ 2. **Each task should be focused** on a specific area
389
+ 3. **Provide detailed instructions** including:
390
+ - Exactly what to search for
391
+ - Which directories to focus on
392
+ - What information to extract
393
+ - Expected output format
394
+ 4. **Be EXTREMELY specific about directories**:
395
+ - Never use generic terms like "UI" when you mean "WUI"
396
+ - Include the full path context in your prompts
397
+ 5. **Specify read-only tools** to use
398
+ 6. **Request specific file:line references** in responses
399
+ 7. **Wait for all tasks to complete** before synthesizing
400
+ 8. **Verify sub-task results**:
401
+ - If a sub-task returns unexpected results, spawn follow-up tasks
402
+ - Cross-check findings against the actual codebase
403
+ - Don't accept results that seem incorrect
404
+
405
+ Example of spawning multiple tasks:
406
+ ```python
407
+ # Spawn these tasks concurrently:
408
+ tasks = [
409
+ Task("Research database schema", db_research_prompt),
410
+ Task("Find API patterns", api_research_prompt),
411
+ Task("Investigate UI components", ui_research_prompt),
412
+ Task("Check test patterns", test_research_prompt)
413
+ ]
414
+ ```
415
+
@@ -0,0 +1,89 @@
1
+ ---
2
+ description: Implement technical plans a predefined plan file
3
+ model: inherit
4
+ argument-hint: [plan_path]
5
+ ---
6
+
7
+ # Implement Plan
8
+
9
+ You are tasked with implementing an approved technical plan provided in a plan file. If the user did not provide a plan respond in the following way:
10
+
11
+ ```
12
+ I need a plan file to proceed. Please provide the path to the plan you would like me to implement.
13
+ ```
14
+
15
+ ## Getting Started
16
+
17
+ When given a plan path:
18
+ - Read the plan completely and check for any existing checkmarks (- [x])
19
+ - **Read files fully** - never use limit/offset parameters, you need complete context
20
+ - Think deeply about how the pieces fit together
21
+ - Create a todo list to track your progress
22
+ - Start implementing if you understand what needs to be done
23
+
24
+ If no plan path provided, ask for one.
25
+
26
+ ## Implementation Philosophy
27
+
28
+ Plans are carefully designed, but reality can be messy. Your job is to:
29
+ - Follow the plan's intent while adapting to what you find
30
+ - Implement each phase fully before moving to the next
31
+ - Verify your work makes sense in the broader codebase context
32
+ - Update checkboxes in the plan as you complete sections
33
+
34
+ When things don't match the plan exactly, think about why and communicate clearly. The plan is your guide, but your judgment matters too.
35
+
36
+ If you encounter a mismatch:
37
+ - STOP and think deeply about why the plan can't be followed
38
+ - Present the issue clearly:
39
+ ```
40
+ Issue in Phase [N]:
41
+ Expected: [what the plan says]
42
+ Found: [actual situation]
43
+ Why this matters: [explanation]
44
+
45
+ How should I proceed?
46
+ ```
47
+
48
+ ## Verification Approach
49
+
50
+ After implementing a phase:
51
+ - Run the success criteria checks (usually `make format` covers everything, there are folder nested `Makefile`s, check those too)
52
+ - Fix any issues before proceeding
53
+ - Update your progress in both the plan and your todos
54
+ - Check off completed items in the plan file itself using Edit
55
+ - **Pause for human verification**: After completing all automated verification for a phase, pause and inform the human that the phase is ready for manual testing. Use this format:
56
+ ```
57
+ Phase [N] Complete - Ready for Manual Verification
58
+
59
+ Automated verification passed:
60
+ - [List automated checks that passed]
61
+
62
+ Please perform the manual verification steps listed in the plan:
63
+ - [List manual verification items from the plan]
64
+
65
+ Let me know when manual testing is complete so I can proceed to Phase [N+1].
66
+ ```
67
+
68
+ If instructed to execute multiple phases consecutively, skip the pause until the last phase. Otherwise, assume you are just doing one phase.
69
+
70
+ do not check off items in the manual testing steps until confirmed by the user.
71
+
72
+
73
+ ## If You Get Stuck
74
+
75
+ When something isn't working as expected:
76
+ - First, make sure you've read and understood all the relevant code
77
+ - Consider if the codebase has evolved since the plan was written
78
+ - Present the mismatch clearly and ask for guidance
79
+
80
+ Use sub-tasks sparingly - mainly for targeted debugging or exploring unfamiliar territory.
81
+
82
+ ## Resuming Work
83
+
84
+ If the plan has existing checkmarks:
85
+ - Trust that completed work is done
86
+ - Pick up from the first unchecked item
87
+ - Verify previous work only if something seems off
88
+
89
+ Remember: You're implementing a solution, not just checking boxes. Keep the end goal in mind and maintain forward momentum.
@@ -0,0 +1,200 @@
1
+ ---
2
+ description: Document codebase as-is with thoughts directory for historical context
3
+ argument-hint: [query]
4
+ allowed-tools: Read, Grep, Glob
5
+ ---
6
+
7
+ # Research Codebase
8
+
9
+ You are tasked with conducting comprehensive research across the codebase to answer user questions by spawning parallel sub-agents and synthesizing their findings.
10
+
11
+ ## CRITICAL: YOUR ONLY JOB IS TO DOCUMENT AND EXPLAIN THE CODEBASE AS IT EXISTS TODAY
12
+ - DO NOT suggest improvements or changes unless the user explicitly asks for them
13
+ - DO NOT perform root cause analysis unless the user explicitly asks for them
14
+ - DO NOT propose future enhancements unless the user explicitly asks for them
15
+ - DO NOT critique the implementation or identify problems
16
+ - DO NOT recommend refactoring, optimization, or architectural changes
17
+ - ONLY describe what exists, where it exists, how it works, and how components interact
18
+ - You are creating a technical map/documentation of the existing system
19
+
20
+ ## Initial Setup:
21
+
22
+ When this command is invoked, respond with:
23
+
24
+ ```
25
+ I'm ready to research the codebase. Please provide your research question or area of interest, and I'll analyze it thoroughly by exploring relevant components and connections.
26
+ ```
27
+
28
+ Then wait for the user's research query, if not already provided.
29
+
30
+ ## Steps to follow after receiving the research query:
31
+
32
+ ### Before starting
33
+
34
+ Perform a quick analysis of the query the user provided, and ensure that you understand what is the goal of the research. If anything is unclear, ask the user for clarification before proceeding.
35
+
36
+ You may provide an initial response like:
37
+
38
+ ```
39
+ Thank you for your research question: "[user's question]". To ensure I fully understand your needs, could you please clarify [specific aspect needing clarification]? This will help me focus my research effectively.
40
+ ```
41
+
42
+ ### Steps
43
+
44
+ 1. **Read any directly mentioned files first:**
45
+ - If the user mentions specific files (tickets, docs, JSON), read them FULLY first
46
+ - **IMPORTANT**: Use the Read tool WITHOUT limit/offset parameters to read entire files
47
+ - **CRITICAL**: Read these files yourself in the main context before spawning any sub-tasks
48
+ - This ensures you have full context before decomposing the research
49
+
50
+ 2. **Analyze and decompose the research question:**
51
+ - Break down the user's query into composable research areas
52
+ - Take time to ultrathink about the underlying patterns, connections, and architectural implications the user might be seeking
53
+ - Identify specific components, patterns, or concepts to investigate
54
+ - Create a research plan using TodoWrite to track all subtasks
55
+ - Consider which directories, files, or architectural patterns are relevant
56
+ - Make sure to use applicable skills based on <available_skills>
57
+
58
+ 3. **Spawn parallel sub-agent tasks for comprehensive research:**
59
+ - Create multiple Task agents to research different aspects concurrently
60
+ - We now have specialized agents that know how to do specific research tasks:
61
+
62
+ **For codebase research:**
63
+ - Use the **codebase-locator** agent to find WHERE files and components live
64
+ - Use the **codebase-analyzer** agent to understand HOW specific code works (without critiquing it)
65
+ - Use the **codebase-pattern-finder** agent to find examples of existing patterns (without evaluating them)
66
+
67
+ **IMPORTANT**: All agents are documentarians, not critics. They will describe what exists without suggesting improvements or identifying issues.
68
+
69
+ **For web research (only if user explicitly asks):**
70
+ - Use the **web-search-researcher** agent for external documentation and resources
71
+ - IF you use web-research agents, instruct them to return LINKS with their findings, and please INCLUDE those links in your final report
72
+
73
+ The key is to use these agents intelligently:
74
+ - Start with locator agents to find what exists
75
+ - Then use analyzer agents on the most promising findings to document how they work
76
+ - Run multiple agents in parallel when they're searching for different things
77
+ - Each agent knows its job - just tell it what you're looking for
78
+ - Don't write detailed prompts about HOW to search - the agents already know
79
+ - Remind agents they are documenting, not evaluating or improving
80
+
81
+ 4. **Wait for all sub-agents to complete and synthesize findings:**
82
+ - IMPORTANT: Wait for ALL sub-agent tasks to complete before proceeding
83
+ - Compile all sub-agent results (both codebase and thoughts findings)
84
+ - Prioritize live codebase findings as primary source of truth
85
+ - Use /workspace/shared/thoughts/ findings as supplementary historical context
86
+ - Connect findings across different components
87
+ - Include specific file paths and line numbers for reference
88
+ - Verify all /workspace/shared/thoughts/ paths are correct (e.g., /workspace/shared/thoughts/<yourAgentId>/ not /workspace/shared/thoughts/shared/ for personal files)
89
+ - Highlight patterns, connections, and architectural decisions
90
+ - Answer the user's specific questions with concrete evidence
91
+
92
+ 5. **Generate research document:**
93
+ - Use the metadata gathered in step 4
94
+ - Structure the document with YAML frontmatter followed by content:
95
+ ```markdown
96
+ ---
97
+ date: [Current date and time with timezone in ISO format]
98
+ researcher: [Researcher name from thoughts status]
99
+ git_commit: [Current commit hash]
100
+ branch: [Current branch name]
101
+ repository: [Repository name]
102
+ topic: "[User's Question/Topic]"
103
+ tags: [research, codebase, relevant-component-names]
104
+ status: complete
105
+ last_updated: [Current date in YYYY-MM-DD format]
106
+ last_updated_by: [Researcher name]
107
+ ---
108
+
109
+ # Research: [User's Question/Topic]
110
+
111
+ **Date**: [Current date and time with timezone from step 4]
112
+ **Researcher**: [Researcher name from thoughts status]
113
+ **Git Commit**: [Current commit hash from step 4]
114
+ **Branch**: [Current branch name from step 4]
115
+ **Repository**: [Repository name]
116
+
117
+ ## Research Question
118
+ [Original user query]
119
+
120
+ ## Summary
121
+ [High-level documentation of what was found, answering the user's question by describing what exists]
122
+
123
+ ## Detailed Findings
124
+
125
+ ### [Component/Area 1]
126
+ - Description of what exists ([file.ext:line](link))
127
+ - How it connects to other components
128
+ - Current implementation details (without evaluation)
129
+
130
+ ### [Component/Area 2]
131
+ ...
132
+
133
+ ## Code References
134
+ - `path/to/file.py:123` - Description of what's there
135
+ - `another/file.ts:45-67` - Description of the code block
136
+
137
+ ## Architecture Documentation
138
+ [Current patterns, conventions, and design implementations found in the codebase]
139
+
140
+ ## Historical Context (from /workspace/shared/thoughts/)
141
+ [Relevant insights from /workspace/shared/thoughts/ directory with references]
142
+ - `/workspace/shared/thoughts/shared/something.md` - Historical decision about X
143
+ - `/workspace/shared/thoughts/local/notes.md` - Past exploration of Y
144
+ Note: Paths exclude "searchable/" even if found there
145
+
146
+ ## Related Research
147
+ [Links to other research documents in /workspace/shared/thoughts/shared/research/]
148
+
149
+ ## Open Questions
150
+ [Any areas that need further investigation]
151
+ ```
152
+
153
+ 7. **Add GitHub permalinks (if applicable):**
154
+ - Check if on main branch or if commit is pushed: `git branch --show-current` and `git status`
155
+ - If on main/master or pushed, generate GitHub permalinks:
156
+ - Get repo info: `gh repo view --json owner,name`
157
+ - Create permalinks: `https://github.com/{owner}/{repo}/blob/{commit}/{file}#L{line}`
158
+ - Replace local file references with permalinks in the document
159
+
160
+ 8. **Sync and present findings:**
161
+ - Present a concise summary of findings to the user
162
+ - Include key file references for easy navigation
163
+ - Ask if they have follow-up questions or need clarification
164
+
165
+ 9. **Handle follow-up questions:**
166
+ - If the user has follow-up questions, append to the same research document
167
+ - Update the frontmatter fields `last_updated` and `last_updated_by` to reflect the update
168
+ - Add `last_updated_note: "Added follow-up research for [brief description]"` to frontmatter
169
+ - Add a new section: `## Follow-up Research [timestamp]`
170
+ - Spawn new sub-agents as needed for additional investigation
171
+ - Continue updating the document and syncing
172
+
173
+ ## Important notes:
174
+ - Always use parallel Task agents to maximize efficiency and minimize context usage
175
+ - Always run fresh codebase research - never rely solely on existing research documents
176
+ - The /workspace/shared/thoughts/ directory provides historical context to supplement live findings
177
+ - Focus on finding concrete file paths and line numbers for developer reference
178
+ - Research documents should be self-contained with all necessary context
179
+ - Each sub-agent prompt should be specific and focused on read-only documentation operations
180
+ - Document cross-component connections and how systems interact
181
+ - Include temporal context (when the research was conducted)
182
+ - Link to GitHub when possible for permanent references
183
+ - Keep the main agent focused on synthesis, not deep file reading
184
+ - Have sub-agents document examples and usage patterns as they exist
185
+ - Explore all of /workspace/shared/thoughts/ directory, not just research subdirectory
186
+ - **CRITICAL**: You and all sub-agents are documentarians, not evaluators
187
+ - **REMEMBER**: Document what IS, not what SHOULD BE
188
+ - **NO RECOMMENDATIONS**: Only describe the current state of the codebase
189
+ - **File reading**: Always read mentioned files FULLY (no limit/offset) before spawning sub-tasks
190
+ - **Critical ordering**: Follow the numbered steps exactly
191
+ - ALWAYS read mentioned files first before spawning sub-tasks (step 1)
192
+ - ALWAYS wait for all sub-agents to complete before synthesizing (step 4)
193
+ - ALWAYS gather metadata before writing the document (step 5 before step 6)
194
+ - NEVER write the research document with placeholder values
195
+ - **Frontmatter consistency**:
196
+ - Always include frontmatter at the beginning of research documents
197
+ - Keep frontmatter fields consistent across all research documents
198
+ - Update frontmatter when adding follow-up research
199
+ - Use snake_case for multi-word field names (e.g., `last_updated`, `git_commit`)
200
+ - Tags should be relevant to the research topic and components studied