opencode-swarm-plugin 0.44.0 → 0.44.1

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 (205) hide show
  1. package/bin/swarm.serve.test.ts +6 -4
  2. package/bin/swarm.ts +16 -10
  3. package/dist/compaction-prompt-scoring.js +139 -0
  4. package/dist/eval-capture.js +12811 -0
  5. package/dist/hive.d.ts.map +1 -1
  6. package/dist/index.js +7644 -62599
  7. package/dist/plugin.js +23766 -78721
  8. package/dist/swarm-orchestrate.d.ts.map +1 -1
  9. package/dist/swarm-prompts.d.ts.map +1 -1
  10. package/dist/swarm-review.d.ts.map +1 -1
  11. package/package.json +17 -5
  12. package/.changeset/swarm-insights-data-layer.md +0 -63
  13. package/.hive/analysis/eval-failure-analysis-2025-12-25.md +0 -331
  14. package/.hive/analysis/session-data-quality-audit.md +0 -320
  15. package/.hive/eval-results.json +0 -483
  16. package/.hive/issues.jsonl +0 -138
  17. package/.hive/memories.jsonl +0 -729
  18. package/.opencode/eval-history.jsonl +0 -327
  19. package/.turbo/turbo-build.log +0 -9
  20. package/CHANGELOG.md +0 -2286
  21. package/SCORER-ANALYSIS.md +0 -598
  22. package/docs/analysis/subagent-coordination-patterns.md +0 -902
  23. package/docs/analysis-socratic-planner-pattern.md +0 -504
  24. package/docs/planning/ADR-001-monorepo-structure.md +0 -171
  25. package/docs/planning/ADR-002-package-extraction.md +0 -393
  26. package/docs/planning/ADR-003-performance-improvements.md +0 -451
  27. package/docs/planning/ADR-004-message-queue-features.md +0 -187
  28. package/docs/planning/ADR-005-devtools-observability.md +0 -202
  29. package/docs/planning/ADR-007-swarm-enhancements-worktree-review.md +0 -168
  30. package/docs/planning/ADR-008-worker-handoff-protocol.md +0 -293
  31. package/docs/planning/ADR-009-oh-my-opencode-patterns.md +0 -353
  32. package/docs/planning/ADR-010-cass-inhousing.md +0 -1215
  33. package/docs/planning/ROADMAP.md +0 -368
  34. package/docs/semantic-memory-cli-syntax.md +0 -123
  35. package/docs/swarm-mail-architecture.md +0 -1147
  36. package/docs/testing/context-recovery-test.md +0 -470
  37. package/evals/ARCHITECTURE.md +0 -1189
  38. package/evals/README.md +0 -768
  39. package/evals/compaction-prompt.eval.ts +0 -149
  40. package/evals/compaction-resumption.eval.ts +0 -289
  41. package/evals/coordinator-behavior.eval.ts +0 -307
  42. package/evals/coordinator-session.eval.ts +0 -154
  43. package/evals/evalite.config.ts.bak +0 -15
  44. package/evals/example.eval.ts +0 -31
  45. package/evals/fixtures/cass-baseline.ts +0 -217
  46. package/evals/fixtures/compaction-cases.ts +0 -350
  47. package/evals/fixtures/compaction-prompt-cases.ts +0 -311
  48. package/evals/fixtures/coordinator-sessions.ts +0 -328
  49. package/evals/fixtures/decomposition-cases.ts +0 -105
  50. package/evals/lib/compaction-loader.test.ts +0 -248
  51. package/evals/lib/compaction-loader.ts +0 -320
  52. package/evals/lib/data-loader.evalite-test.ts +0 -289
  53. package/evals/lib/data-loader.test.ts +0 -345
  54. package/evals/lib/data-loader.ts +0 -281
  55. package/evals/lib/llm.ts +0 -115
  56. package/evals/scorers/compaction-prompt-scorers.ts +0 -145
  57. package/evals/scorers/compaction-scorers.ts +0 -305
  58. package/evals/scorers/coordinator-discipline.evalite-test.ts +0 -539
  59. package/evals/scorers/coordinator-discipline.ts +0 -325
  60. package/evals/scorers/index.test.ts +0 -146
  61. package/evals/scorers/index.ts +0 -328
  62. package/evals/scorers/outcome-scorers.evalite-test.ts +0 -27
  63. package/evals/scorers/outcome-scorers.ts +0 -349
  64. package/evals/swarm-decomposition.eval.ts +0 -121
  65. package/examples/commands/swarm.md +0 -745
  66. package/examples/plugin-wrapper-template.ts +0 -2515
  67. package/examples/skills/hive-workflow/SKILL.md +0 -212
  68. package/examples/skills/skill-creator/SKILL.md +0 -223
  69. package/examples/skills/swarm-coordination/SKILL.md +0 -292
  70. package/global-skills/cli-builder/SKILL.md +0 -344
  71. package/global-skills/cli-builder/references/advanced-patterns.md +0 -244
  72. package/global-skills/learning-systems/SKILL.md +0 -644
  73. package/global-skills/skill-creator/LICENSE.txt +0 -202
  74. package/global-skills/skill-creator/SKILL.md +0 -352
  75. package/global-skills/skill-creator/references/output-patterns.md +0 -82
  76. package/global-skills/skill-creator/references/workflows.md +0 -28
  77. package/global-skills/swarm-coordination/SKILL.md +0 -995
  78. package/global-skills/swarm-coordination/references/coordinator-patterns.md +0 -235
  79. package/global-skills/swarm-coordination/references/strategies.md +0 -138
  80. package/global-skills/system-design/SKILL.md +0 -213
  81. package/global-skills/testing-patterns/SKILL.md +0 -430
  82. package/global-skills/testing-patterns/references/dependency-breaking-catalog.md +0 -586
  83. package/opencode-swarm-plugin-0.30.7.tgz +0 -0
  84. package/opencode-swarm-plugin-0.31.0.tgz +0 -0
  85. package/scripts/cleanup-test-memories.ts +0 -346
  86. package/scripts/init-skill.ts +0 -222
  87. package/scripts/migrate-unknown-sessions.ts +0 -349
  88. package/scripts/validate-skill.ts +0 -204
  89. package/src/agent-mail.ts +0 -1724
  90. package/src/anti-patterns.test.ts +0 -1167
  91. package/src/anti-patterns.ts +0 -448
  92. package/src/compaction-capture.integration.test.ts +0 -257
  93. package/src/compaction-hook.test.ts +0 -838
  94. package/src/compaction-hook.ts +0 -1204
  95. package/src/compaction-observability.integration.test.ts +0 -139
  96. package/src/compaction-observability.test.ts +0 -187
  97. package/src/compaction-observability.ts +0 -324
  98. package/src/compaction-prompt-scorers.test.ts +0 -475
  99. package/src/compaction-prompt-scoring.ts +0 -300
  100. package/src/contributor-tools.test.ts +0 -133
  101. package/src/contributor-tools.ts +0 -201
  102. package/src/dashboard.test.ts +0 -611
  103. package/src/dashboard.ts +0 -462
  104. package/src/error-enrichment.test.ts +0 -403
  105. package/src/error-enrichment.ts +0 -219
  106. package/src/eval-capture.test.ts +0 -1015
  107. package/src/eval-capture.ts +0 -929
  108. package/src/eval-gates.test.ts +0 -306
  109. package/src/eval-gates.ts +0 -218
  110. package/src/eval-history.test.ts +0 -508
  111. package/src/eval-history.ts +0 -214
  112. package/src/eval-learning.test.ts +0 -378
  113. package/src/eval-learning.ts +0 -360
  114. package/src/eval-runner.test.ts +0 -223
  115. package/src/eval-runner.ts +0 -402
  116. package/src/export-tools.test.ts +0 -476
  117. package/src/export-tools.ts +0 -257
  118. package/src/hive.integration.test.ts +0 -2241
  119. package/src/hive.ts +0 -1628
  120. package/src/index.ts +0 -940
  121. package/src/learning.integration.test.ts +0 -1815
  122. package/src/learning.ts +0 -1079
  123. package/src/logger.test.ts +0 -189
  124. package/src/logger.ts +0 -135
  125. package/src/mandate-promotion.test.ts +0 -473
  126. package/src/mandate-promotion.ts +0 -239
  127. package/src/mandate-storage.integration.test.ts +0 -601
  128. package/src/mandate-storage.test.ts +0 -578
  129. package/src/mandate-storage.ts +0 -794
  130. package/src/mandates.ts +0 -540
  131. package/src/memory-tools.test.ts +0 -195
  132. package/src/memory-tools.ts +0 -344
  133. package/src/memory.integration.test.ts +0 -334
  134. package/src/memory.test.ts +0 -158
  135. package/src/memory.ts +0 -527
  136. package/src/model-selection.test.ts +0 -188
  137. package/src/model-selection.ts +0 -68
  138. package/src/observability-tools.test.ts +0 -359
  139. package/src/observability-tools.ts +0 -871
  140. package/src/output-guardrails.test.ts +0 -438
  141. package/src/output-guardrails.ts +0 -381
  142. package/src/pattern-maturity.test.ts +0 -1160
  143. package/src/pattern-maturity.ts +0 -525
  144. package/src/planning-guardrails.test.ts +0 -491
  145. package/src/planning-guardrails.ts +0 -438
  146. package/src/plugin.ts +0 -23
  147. package/src/post-compaction-tracker.test.ts +0 -251
  148. package/src/post-compaction-tracker.ts +0 -237
  149. package/src/query-tools.test.ts +0 -636
  150. package/src/query-tools.ts +0 -324
  151. package/src/rate-limiter.integration.test.ts +0 -466
  152. package/src/rate-limiter.ts +0 -774
  153. package/src/replay-tools.test.ts +0 -496
  154. package/src/replay-tools.ts +0 -240
  155. package/src/repo-crawl.integration.test.ts +0 -441
  156. package/src/repo-crawl.ts +0 -610
  157. package/src/schemas/cell-events.test.ts +0 -347
  158. package/src/schemas/cell-events.ts +0 -807
  159. package/src/schemas/cell.ts +0 -257
  160. package/src/schemas/evaluation.ts +0 -166
  161. package/src/schemas/index.test.ts +0 -199
  162. package/src/schemas/index.ts +0 -286
  163. package/src/schemas/mandate.ts +0 -232
  164. package/src/schemas/swarm-context.ts +0 -115
  165. package/src/schemas/task.ts +0 -161
  166. package/src/schemas/worker-handoff.test.ts +0 -302
  167. package/src/schemas/worker-handoff.ts +0 -131
  168. package/src/sessions/agent-discovery.test.ts +0 -137
  169. package/src/sessions/agent-discovery.ts +0 -112
  170. package/src/sessions/index.ts +0 -15
  171. package/src/skills.integration.test.ts +0 -1192
  172. package/src/skills.test.ts +0 -643
  173. package/src/skills.ts +0 -1549
  174. package/src/storage.integration.test.ts +0 -341
  175. package/src/storage.ts +0 -884
  176. package/src/structured.integration.test.ts +0 -817
  177. package/src/structured.test.ts +0 -1046
  178. package/src/structured.ts +0 -762
  179. package/src/swarm-decompose.test.ts +0 -188
  180. package/src/swarm-decompose.ts +0 -1302
  181. package/src/swarm-deferred.integration.test.ts +0 -157
  182. package/src/swarm-deferred.test.ts +0 -38
  183. package/src/swarm-insights.test.ts +0 -214
  184. package/src/swarm-insights.ts +0 -459
  185. package/src/swarm-mail.integration.test.ts +0 -970
  186. package/src/swarm-mail.ts +0 -739
  187. package/src/swarm-orchestrate.integration.test.ts +0 -282
  188. package/src/swarm-orchestrate.test.ts +0 -548
  189. package/src/swarm-orchestrate.ts +0 -3084
  190. package/src/swarm-prompts.test.ts +0 -1270
  191. package/src/swarm-prompts.ts +0 -2077
  192. package/src/swarm-research.integration.test.ts +0 -701
  193. package/src/swarm-research.test.ts +0 -698
  194. package/src/swarm-research.ts +0 -472
  195. package/src/swarm-review.integration.test.ts +0 -285
  196. package/src/swarm-review.test.ts +0 -879
  197. package/src/swarm-review.ts +0 -709
  198. package/src/swarm-strategies.ts +0 -407
  199. package/src/swarm-worktree.test.ts +0 -501
  200. package/src/swarm-worktree.ts +0 -575
  201. package/src/swarm.integration.test.ts +0 -2377
  202. package/src/swarm.ts +0 -38
  203. package/src/tool-adapter.integration.test.ts +0 -1221
  204. package/src/tool-availability.ts +0 -461
  205. package/tsconfig.json +0 -28
@@ -1,217 +0,0 @@
1
- /**
2
- * CASS Baseline Response Fixtures
3
- *
4
- * These fixtures capture the ACTUAL behavior of the CASS binary tools.
5
- * DO NOT modify to match desired behavior - these document what the binary DOES.
6
- *
7
- * Purpose: Characterization tests for ADR-010 (CASS inhousing).
8
- * These ensure our inhouse implementation matches the binary's behavior.
9
- */
10
-
11
- /**
12
- * cass stats --json
13
- * Captured: 2025-12-25
14
- */
15
- export const cassStatsBaseline = {
16
- by_agent: [
17
- {
18
- agent: "claude_code",
19
- count: 137,
20
- },
21
- {
22
- agent: "cursor",
23
- count: 23,
24
- },
25
- {
26
- agent: "codex",
27
- count: 2,
28
- },
29
- ],
30
- conversations: 162,
31
- date_range: {
32
- newest: "2025-12-08T04:20:36.526+00:00",
33
- oldest: "2025-07-14T01:14:44.997+00:00",
34
- },
35
- db_path:
36
- "/Users/joel/Library/Application Support/com.coding-agent-search.coding-agent-search/agent_search.db",
37
- messages: 4213,
38
- top_workspaces: [
39
- {
40
- count: 28,
41
- workspace:
42
- "/Users/joel/Code/vercel/academy-vectr-workflow-course-content/external/workflow-builder-starter",
43
- },
44
- {
45
- count: 22,
46
- workspace: "/Users/joel/Code/vercel/slack-agents-course",
47
- },
48
- ],
49
- } as const;
50
-
51
- /**
52
- * cass search "swarm" --limit 2 --json
53
- * Captured: 2025-12-25
54
- */
55
- export const cassSearchBaseline = {
56
- count: 2,
57
- cursor: null,
58
- hits: [
59
- {
60
- agent: "claude_code",
61
- content:
62
- 'Fixed. The `plugins` key is invalid - OpenCode auto-loads plugins from directories instead.\n\n**Changes:**\n1. ✅ Removed invalid `plugins` array from `opencode.jsonc`\n2. ✅ Created `~/.config/opencode/plugin/` directory\n3. ✅ Symlinked your swarm plugin → `~/.config/opencode/plugin/swarm.js`\n\nThe plugin will now auto-load on startup. Restart OpenCode to pick it up.\n\nSources:\n- [OpenCode Plugins Documentation](https://opencode.ai/docs/plugins/)\n- [OpenCode Config Documentation](https://opencode.ai/docs/config/)',
63
- created_at: 1765161767083,
64
- line_number: 9,
65
- match_type: "exact",
66
- score: 15.536974906921387,
67
- snippet:
68
- "Symlinked your swarm plugin → `~/.config/opencode/plugin/swarm.js`\n\nThe plugin will now auto-load on startup. Restart OpenCode to pick it up.\n\nSources:\n- [OpenC…",
69
- source_path:
70
- "/Users/joel/.claude/projects/-Users-joel--config-opencode/ccd64ac6-bca7-40e5-9150-cea58c3788ae.jsonl",
71
- title:
72
- "@opencode.jsonc has an invalid plugins key https://opencode.ai/docs/plugins/ https://opencode.ai/doc",
73
- workspace: "/Users/joel/.config/opencode",
74
- },
75
- {
76
- agent: "claude_code",
77
- content:
78
- "I'm ready to help you explore the codebase and design implementation plans. I'm in **READ-ONLY mode** - I can explore files, understand architecture, and create detailed plans, but I cannot and will not modify any files.\n\nI have access to the beads issue tracker (`bd` commands) and can see your current working directory is `/Users/joel/.config/opencode`.\n\n**Current git status shows:**\n- Modified: `.beads/issues.jsonl`, `AGENTS.md`, `command/swarm.md`, `opencode.jsonc`\n- Untracked: `command/swarm-collect.md`, `command/swarm-status.md`, `plugin/`\n\n**What would you like me to explore and plan?**\n\nCommon scenarios I can help with:\n- Designing new command implementations\n- Planning plugin architecture\n- Exploring existing patterns for feature additions\n- Creating implementation strategies for beads issues\n\nLet me know what you need, and I'll dive into the codebase, understand the current architecture, and provide a detailed implementation plan.",
79
- created_at: 1765161814722,
80
- line_number: 1,
81
- match_type: "exact",
82
- score: 14.522254943847656,
83
- snippet:
84
- ".md`, `command/swarm.md`, `opencode.jsonc`\n- Untracked: `command/swarm-collect.md`, `command/swarm-status.md`, `plugin/`\n\n**What would you like me to explore an…",
85
- source_path:
86
- "/Users/joel/.claude/projects/-Users-joel--config-opencode/agent-ee2a73ee.jsonl",
87
- title: "opencode",
88
- workspace: "/Users/joel/.config/opencode",
89
- },
90
- ],
91
- hits_clamped: false,
92
- limit: 2,
93
- max_tokens: null,
94
- offset: 0,
95
- query: "swarm",
96
- request_id: null,
97
- total_matches: 2,
98
- } as const;
99
-
100
- /**
101
- * cass health (human-readable output)
102
- * Captured: 2025-12-25
103
- */
104
- export const cassHealthHumanBaseline = `✓ Healthy (3ms)
105
- Note: index stale (older than 300s)`;
106
-
107
- /**
108
- * cass stats (human-readable output)
109
- * Captured: 2025-12-25
110
- */
111
- export const cassStatsHumanBaseline = `CASS Index Statistics
112
- =====================
113
- Database: /Users/joel/Library/Application Support/com.coding-agent-search.coding-agent-search/agent_search.db
114
-
115
- Totals:
116
- Conversations: 162
117
- Messages: 4213
118
-
119
- By Agent:
120
- claude_code: 137
121
- cursor: 23
122
- codex: 2
123
-
124
- Top Workspaces:
125
- /Users/joel/Code/vercel/academy-vectr-workflow-course-content/external/workflow-builder-starter: 28
126
- /Users/joel/Code/vercel/slack-agents-course: 22
127
- /Users/joel/Code/vercel/academy-vectr-workflow-course-content: 22
128
- /Users/joel/Code/vercel/academy-content: 13
129
- /Users/joel/Code/joelhooks/trt-buddy: 13
130
- /Users/joel/Code/vercel/front: 11
131
- /Users/joel/.config/opencode: 9
132
- /Users/joel: 6
133
- /Users/joel/Code/badass-courses/course-builder/apps/ai-hero: 5
134
- /Users/joel/Code/vercel/front/apps/vercel-academy: 4
135
-
136
- Date Range: 2025-07-14 to 2025-12-08`;
137
-
138
- /**
139
- * cass view <file> -n <line>
140
- * Captured: 2025-12-25
141
- *
142
- * Format: File path header, line indicator with context window, separator, content with line numbers
143
- */
144
- export const cassViewBaseline = `File: /Users/joel/.config/swarm-tools/sessions/ses_19yz2iaMpHxY1ddvVq2voC.jsonl
145
- Line: 1 (context: 5)
146
- ----------------------------------------
147
- > 1 | {"session_id":"ses_19yz2iaMpHxY1ddvVq2voC","epic_id":"cell-f2p61v-mjko4d89zdt","timestamp":"2025-12-24T23:51:52.896Z","event_type":"OUTCOME","outcome_type":"subtask_success","payload":{"bead_id":"cell-f2p61v-mjko4d89zdt","duration_ms":0,"files_touched":[],"verification_passed":false,"verification_skipped":true}}
148
- ----------------------------------------`;
149
-
150
- /**
151
- * Error responses (captured from actual failures)
152
- */
153
- export const cassErrorBaseline = {
154
- fileNotFound: {
155
- error: {
156
- code: 3,
157
- hint: null,
158
- kind: "file-not-found",
159
- message:
160
- "File not found: /Users/joel/.config/swarm-tools/sessions/ses_fRrFb7WrNr9K89JBCKd6GV.jsonl",
161
- retryable: false,
162
- },
163
- },
164
- invalidArgument: {
165
- error: {
166
- code: 2,
167
- hint: {
168
- common_mistakes: [
169
- {
170
- correct: "cass robot-docs",
171
- wrong: "cass --robot-docs",
172
- },
173
- {
174
- correct: "cass robot-docs commands",
175
- wrong: "cass --robot-docs=commands",
176
- },
177
- {
178
- correct: "cass robot-docs",
179
- wrong: "cass robot-docs --robot",
180
- },
181
- ],
182
- error:
183
- "error: unexpected argument '--robot' found\\n\\nUsage: cass stats [OPTIONS]\\n\\nFor more information, try '--help'.\\n",
184
- examples: [
185
- "cass robot-docs commands",
186
- "cass robot-docs schemas",
187
- "cass robot-docs examples",
188
- "cass --robot-help",
189
- ],
190
- flag_syntax: {
191
- correct: ["--limit 5", "--robot", "--json"],
192
- incorrect: ["-limit 5", "limit=5", "--Limit"],
193
- },
194
- hints: [
195
- "For get robot-mode documentation, try: cass --robot-help",
196
- ],
197
- kind: "argument_parsing",
198
- status: "error",
199
- },
200
- kind: "usage",
201
- message: "Could not parse arguments",
202
- retryable: false,
203
- },
204
- },
205
- } as const;
206
-
207
- /**
208
- * Schema definitions extracted from actual responses
209
- */
210
- export type CassStatsResponse = typeof cassStatsBaseline;
211
- export type CassSearchResponse = typeof cassSearchBaseline;
212
- export type CassSearchHit = CassSearchResponse["hits"][number];
213
- export type CassAgentStats = CassStatsResponse["by_agent"][number];
214
- export type CassWorkspaceStats = CassStatsResponse["top_workspaces"][number];
215
- export type CassError =
216
- | typeof cassErrorBaseline.fileNotFound
217
- | typeof cassErrorBaseline.invalidArgument;
@@ -1,350 +0,0 @@
1
- /**
2
- * Test cases for compaction hook coordinator resumption
3
- *
4
- * Each case simulates a different swarm state and verifies that
5
- * the compaction hook injects the correct context for resumption.
6
- */
7
-
8
- import type { Cell } from "swarm-mail";
9
-
10
- /**
11
- * Compaction test case structure
12
- */
13
- export interface CompactionTestCase {
14
- name: string;
15
- description: string;
16
- /**
17
- * Simulated hive state (cells to create)
18
- */
19
- hiveCells: Array<Omit<Cell, "created_at" | "updated_at" | "closed_at">>;
20
- /**
21
- * Simulated swarm-mail state
22
- */
23
- swarmMailState: {
24
- agents: number;
25
- reservations: number;
26
- messages: number;
27
- };
28
- /**
29
- * Expected detection confidence
30
- */
31
- expected: {
32
- confidence: "high" | "medium" | "low" | "none";
33
- contextInjected: boolean;
34
- contextType: "full" | "fallback" | "none";
35
- /**
36
- * Patterns that MUST appear in injected context (if injected)
37
- */
38
- mustContain?: string[];
39
- /**
40
- * Patterns that MUST NOT appear
41
- */
42
- mustNotContain?: string[];
43
- };
44
- }
45
-
46
- export const compactionCases: CompactionTestCase[] = [
47
- // ============================================================================
48
- // HIGH CONFIDENCE: Active swarm with in_progress epic
49
- // ============================================================================
50
- {
51
- name: "Active swarm with in_progress epic",
52
- description:
53
- "Compaction happens mid-swarm with an active epic and subtasks. Should inject full context with specific epic ID.",
54
- hiveCells: [
55
- {
56
- id: "test-project-lf2p4u-epic123",
57
- project_key: "/test/project",
58
- type: "epic",
59
- status: "in_progress",
60
- title: "Add user authentication",
61
- description: "Implement OAuth with NextAuth.js",
62
- priority: 2,
63
- parent_id: null,
64
- assignee: "coordinator",
65
- closed_reason: null,
66
- deleted_at: null,
67
- deleted_by: null,
68
- delete_reason: null,
69
- created_by: "coordinator",
70
- },
71
- {
72
- id: "test-project-lf2p4u-epic123.1",
73
- project_key: "/test/project",
74
- type: "task",
75
- status: "closed",
76
- title: "OAuth provider config",
77
- description: "Configure GitHub OAuth provider",
78
- priority: 2,
79
- parent_id: "test-project-lf2p4u-epic123",
80
- assignee: "BlueLake",
81
- closed_reason: "Done: configured GitHub provider",
82
- deleted_at: null,
83
- deleted_by: null,
84
- delete_reason: null,
85
- created_by: "coordinator",
86
- },
87
- {
88
- id: "test-project-lf2p4u-epic123.2",
89
- project_key: "/test/project",
90
- type: "task",
91
- status: "in_progress",
92
- title: "Auth middleware",
93
- description: "Create middleware for protecting routes",
94
- priority: 2,
95
- parent_id: "test-project-lf2p4u-epic123",
96
- assignee: "RedMountain",
97
- closed_reason: null,
98
- deleted_at: null,
99
- deleted_by: null,
100
- delete_reason: null,
101
- created_by: "coordinator",
102
- },
103
- {
104
- id: "test-project-lf2p4u-epic123.3",
105
- project_key: "/test/project",
106
- type: "task",
107
- status: "open",
108
- title: "Session management",
109
- description: "Implement session persistence with Redis",
110
- priority: 2,
111
- parent_id: "test-project-lf2p4u-epic123",
112
- assignee: null,
113
- closed_reason: null,
114
- deleted_at: null,
115
- deleted_by: null,
116
- delete_reason: null,
117
- created_by: "coordinator",
118
- },
119
- ],
120
- swarmMailState: {
121
- agents: 2,
122
- reservations: 1,
123
- messages: 5,
124
- },
125
- expected: {
126
- confidence: "high",
127
- contextInjected: true,
128
- contextType: "full",
129
- mustContain: [
130
- "SWARM ACTIVE",
131
- "COORDINATOR",
132
- "swarm_status",
133
- "swarmmail_inbox",
134
- "Keep Cooking",
135
- ],
136
- mustNotContain: [
137
- "bd-xxx", // Should NOT contain placeholder IDs
138
- "Check Your Context", // Should NOT be fallback detection
139
- ],
140
- },
141
- },
142
-
143
- // ============================================================================
144
- // MEDIUM CONFIDENCE: Multiple epics, need to identify active one
145
- // ============================================================================
146
- {
147
- name: "Multiple epics with one in_progress",
148
- description:
149
- "Multiple epics exist, but only one is in_progress. Should detect and inject context for the active one.",
150
- hiveCells: [
151
- {
152
- id: "test-project-lf2p4u-epic100",
153
- project_key: "/test/project",
154
- type: "epic",
155
- status: "closed",
156
- title: "Refactor auth system",
157
- description: "Old completed epic",
158
- priority: 2,
159
- parent_id: null,
160
- assignee: null,
161
- closed_reason: "Done",
162
- deleted_at: null,
163
- deleted_by: null,
164
- delete_reason: null,
165
- created_by: "coordinator",
166
- },
167
- {
168
- id: "test-project-lf2p4u-epic200",
169
- project_key: "/test/project",
170
- type: "epic",
171
- status: "in_progress",
172
- title: "Add rate limiting",
173
- description: "Implement Redis-based rate limiting",
174
- priority: 2,
175
- parent_id: null,
176
- assignee: "coordinator",
177
- closed_reason: null,
178
- deleted_at: null,
179
- deleted_by: null,
180
- delete_reason: null,
181
- created_by: "coordinator",
182
- },
183
- {
184
- id: "test-project-lf2p4u-epic200.1",
185
- project_key: "/test/project",
186
- type: "task",
187
- status: "open",
188
- title: "Rate limit middleware",
189
- description: "Create Express middleware",
190
- priority: 2,
191
- parent_id: "test-project-lf2p4u-epic200",
192
- assignee: null,
193
- closed_reason: null,
194
- deleted_at: null,
195
- deleted_by: null,
196
- delete_reason: null,
197
- created_by: "coordinator",
198
- },
199
- {
200
- id: "test-project-lf2p4u-epic300",
201
- project_key: "/test/project",
202
- type: "epic",
203
- status: "open",
204
- title: "Future epic",
205
- description: "Not started yet",
206
- priority: 1,
207
- parent_id: null,
208
- assignee: null,
209
- closed_reason: null,
210
- deleted_at: null,
211
- deleted_by: null,
212
- delete_reason: null,
213
- created_by: "coordinator",
214
- },
215
- ],
216
- swarmMailState: {
217
- agents: 1,
218
- reservations: 0,
219
- messages: 2,
220
- },
221
- expected: {
222
- confidence: "medium",
223
- contextInjected: true,
224
- contextType: "full",
225
- mustContain: ["SWARM ACTIVE", "COORDINATOR"],
226
- mustNotContain: ["bd-xxx"],
227
- },
228
- },
229
-
230
- // ============================================================================
231
- // LOW CONFIDENCE: Cells exist but no active work
232
- // ============================================================================
233
- {
234
- name: "Cells exist but no active swarm",
235
- description:
236
- "Hive has some cells but no in_progress work. Should inject fallback detection prompt.",
237
- hiveCells: [
238
- {
239
- id: "test-project-lf2p4u-task001",
240
- project_key: "/test/project",
241
- type: "task",
242
- status: "open",
243
- title: "Fix typo in README",
244
- description: null,
245
- priority: 0,
246
- parent_id: null,
247
- assignee: null,
248
- closed_reason: null,
249
- deleted_at: null,
250
- deleted_by: null,
251
- delete_reason: null,
252
- created_by: null,
253
- },
254
- ],
255
- swarmMailState: {
256
- agents: 0,
257
- reservations: 0,
258
- messages: 0,
259
- },
260
- expected: {
261
- confidence: "low",
262
- contextInjected: true,
263
- contextType: "fallback",
264
- mustContain: [
265
- "Swarm Detection",
266
- "Check Your Context",
267
- "swarm_decompose",
268
- "swarmmail_init",
269
- ],
270
- mustNotContain: ["SWARM ACTIVE", "COORDINATOR"],
271
- },
272
- },
273
-
274
- // ============================================================================
275
- // NONE: Empty hive, no swarm activity
276
- // ============================================================================
277
- {
278
- name: "Empty hive - no swarm activity",
279
- description:
280
- "No cells, no swarm-mail activity. Should NOT inject any context.",
281
- hiveCells: [],
282
- swarmMailState: {
283
- agents: 0,
284
- reservations: 0,
285
- messages: 0,
286
- },
287
- expected: {
288
- confidence: "none",
289
- contextInjected: false,
290
- contextType: "none",
291
- mustContain: [],
292
- mustNotContain: ["SWARM", "COORDINATOR", "swarm_status"],
293
- },
294
- },
295
-
296
- // ============================================================================
297
- // EDGE CASE: Blocked epic (should still detect as active swarm)
298
- // ============================================================================
299
- {
300
- name: "Blocked epic with subtasks",
301
- description:
302
- "Epic is blocked but has in_progress subtasks. Should detect as active swarm.",
303
- hiveCells: [
304
- {
305
- id: "test-project-lf2p4u-epic400",
306
- project_key: "/test/project",
307
- type: "epic",
308
- status: "blocked",
309
- title: "Migration to TypeScript",
310
- description: "Full codebase migration",
311
- priority: 3,
312
- parent_id: null,
313
- assignee: "coordinator",
314
- closed_reason: null,
315
- deleted_at: null,
316
- deleted_by: null,
317
- delete_reason: null,
318
- created_by: "coordinator",
319
- },
320
- {
321
- id: "test-project-lf2p4u-epic400.1",
322
- project_key: "/test/project",
323
- type: "task",
324
- status: "in_progress",
325
- title: "Migrate utils",
326
- description: "Convert utils to TypeScript",
327
- priority: 2,
328
- parent_id: "test-project-lf2p4u-epic400",
329
- assignee: "GreenValley",
330
- closed_reason: null,
331
- deleted_at: null,
332
- deleted_by: null,
333
- delete_reason: null,
334
- created_by: "coordinator",
335
- },
336
- ],
337
- swarmMailState: {
338
- agents: 1,
339
- reservations: 1,
340
- messages: 3,
341
- },
342
- expected: {
343
- confidence: "high",
344
- contextInjected: true,
345
- contextType: "full",
346
- mustContain: ["SWARM ACTIVE", "COORDINATOR"],
347
- mustNotContain: ["bd-xxx"],
348
- },
349
- },
350
- ];