opencode-swarm-plugin 0.43.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.
- package/bin/cass.characterization.test.ts +422 -0
- package/bin/swarm.serve.test.ts +6 -4
- package/bin/swarm.test.ts +68 -0
- package/bin/swarm.ts +81 -8
- package/dist/compaction-prompt-scoring.js +139 -0
- package/dist/contributor-tools.d.ts +42 -0
- package/dist/contributor-tools.d.ts.map +1 -0
- package/dist/eval-capture.js +12811 -0
- package/dist/hive.d.ts.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7728 -62590
- package/dist/plugin.js +23833 -78695
- package/dist/sessions/agent-discovery.d.ts +59 -0
- package/dist/sessions/agent-discovery.d.ts.map +1 -0
- package/dist/sessions/index.d.ts +10 -0
- package/dist/sessions/index.d.ts.map +1 -0
- package/dist/swarm-orchestrate.d.ts.map +1 -1
- package/dist/swarm-prompts.d.ts.map +1 -1
- package/dist/swarm-review.d.ts.map +1 -1
- package/package.json +17 -5
- package/.changeset/swarm-insights-data-layer.md +0 -63
- package/.hive/analysis/eval-failure-analysis-2025-12-25.md +0 -331
- package/.hive/analysis/session-data-quality-audit.md +0 -320
- package/.hive/eval-results.json +0 -483
- package/.hive/issues.jsonl +0 -138
- package/.hive/memories.jsonl +0 -729
- package/.opencode/eval-history.jsonl +0 -327
- package/.turbo/turbo-build.log +0 -9
- package/CHANGELOG.md +0 -2255
- package/SCORER-ANALYSIS.md +0 -598
- package/docs/analysis/subagent-coordination-patterns.md +0 -902
- package/docs/analysis-socratic-planner-pattern.md +0 -504
- package/docs/planning/ADR-001-monorepo-structure.md +0 -171
- package/docs/planning/ADR-002-package-extraction.md +0 -393
- package/docs/planning/ADR-003-performance-improvements.md +0 -451
- package/docs/planning/ADR-004-message-queue-features.md +0 -187
- package/docs/planning/ADR-005-devtools-observability.md +0 -202
- package/docs/planning/ADR-007-swarm-enhancements-worktree-review.md +0 -168
- package/docs/planning/ADR-008-worker-handoff-protocol.md +0 -293
- package/docs/planning/ADR-009-oh-my-opencode-patterns.md +0 -353
- package/docs/planning/ROADMAP.md +0 -368
- package/docs/semantic-memory-cli-syntax.md +0 -123
- package/docs/swarm-mail-architecture.md +0 -1147
- package/docs/testing/context-recovery-test.md +0 -470
- package/evals/ARCHITECTURE.md +0 -1189
- package/evals/README.md +0 -768
- package/evals/compaction-prompt.eval.ts +0 -149
- package/evals/compaction-resumption.eval.ts +0 -289
- package/evals/coordinator-behavior.eval.ts +0 -307
- package/evals/coordinator-session.eval.ts +0 -154
- package/evals/evalite.config.ts.bak +0 -15
- package/evals/example.eval.ts +0 -31
- package/evals/fixtures/compaction-cases.ts +0 -350
- package/evals/fixtures/compaction-prompt-cases.ts +0 -311
- package/evals/fixtures/coordinator-sessions.ts +0 -328
- package/evals/fixtures/decomposition-cases.ts +0 -105
- package/evals/lib/compaction-loader.test.ts +0 -248
- package/evals/lib/compaction-loader.ts +0 -320
- package/evals/lib/data-loader.evalite-test.ts +0 -289
- package/evals/lib/data-loader.test.ts +0 -345
- package/evals/lib/data-loader.ts +0 -281
- package/evals/lib/llm.ts +0 -115
- package/evals/scorers/compaction-prompt-scorers.ts +0 -145
- package/evals/scorers/compaction-scorers.ts +0 -305
- package/evals/scorers/coordinator-discipline.evalite-test.ts +0 -539
- package/evals/scorers/coordinator-discipline.ts +0 -325
- package/evals/scorers/index.test.ts +0 -146
- package/evals/scorers/index.ts +0 -328
- package/evals/scorers/outcome-scorers.evalite-test.ts +0 -27
- package/evals/scorers/outcome-scorers.ts +0 -349
- package/evals/swarm-decomposition.eval.ts +0 -121
- package/examples/commands/swarm.md +0 -745
- package/examples/plugin-wrapper-template.ts +0 -2426
- package/examples/skills/hive-workflow/SKILL.md +0 -212
- package/examples/skills/skill-creator/SKILL.md +0 -223
- package/examples/skills/swarm-coordination/SKILL.md +0 -292
- package/global-skills/cli-builder/SKILL.md +0 -344
- package/global-skills/cli-builder/references/advanced-patterns.md +0 -244
- package/global-skills/learning-systems/SKILL.md +0 -644
- package/global-skills/skill-creator/LICENSE.txt +0 -202
- package/global-skills/skill-creator/SKILL.md +0 -352
- package/global-skills/skill-creator/references/output-patterns.md +0 -82
- package/global-skills/skill-creator/references/workflows.md +0 -28
- package/global-skills/swarm-coordination/SKILL.md +0 -995
- package/global-skills/swarm-coordination/references/coordinator-patterns.md +0 -235
- package/global-skills/swarm-coordination/references/strategies.md +0 -138
- package/global-skills/system-design/SKILL.md +0 -213
- package/global-skills/testing-patterns/SKILL.md +0 -430
- package/global-skills/testing-patterns/references/dependency-breaking-catalog.md +0 -586
- package/opencode-swarm-plugin-0.30.7.tgz +0 -0
- package/opencode-swarm-plugin-0.31.0.tgz +0 -0
- package/scripts/cleanup-test-memories.ts +0 -346
- package/scripts/init-skill.ts +0 -222
- package/scripts/migrate-unknown-sessions.ts +0 -349
- package/scripts/validate-skill.ts +0 -204
- package/src/agent-mail.ts +0 -1724
- package/src/anti-patterns.test.ts +0 -1167
- package/src/anti-patterns.ts +0 -448
- package/src/compaction-capture.integration.test.ts +0 -257
- package/src/compaction-hook.test.ts +0 -838
- package/src/compaction-hook.ts +0 -1204
- package/src/compaction-observability.integration.test.ts +0 -139
- package/src/compaction-observability.test.ts +0 -187
- package/src/compaction-observability.ts +0 -324
- package/src/compaction-prompt-scorers.test.ts +0 -475
- package/src/compaction-prompt-scoring.ts +0 -300
- package/src/dashboard.test.ts +0 -611
- package/src/dashboard.ts +0 -462
- package/src/error-enrichment.test.ts +0 -403
- package/src/error-enrichment.ts +0 -219
- package/src/eval-capture.test.ts +0 -1015
- package/src/eval-capture.ts +0 -929
- package/src/eval-gates.test.ts +0 -306
- package/src/eval-gates.ts +0 -218
- package/src/eval-history.test.ts +0 -508
- package/src/eval-history.ts +0 -214
- package/src/eval-learning.test.ts +0 -378
- package/src/eval-learning.ts +0 -360
- package/src/eval-runner.test.ts +0 -223
- package/src/eval-runner.ts +0 -402
- package/src/export-tools.test.ts +0 -476
- package/src/export-tools.ts +0 -257
- package/src/hive.integration.test.ts +0 -2241
- package/src/hive.ts +0 -1628
- package/src/index.ts +0 -935
- package/src/learning.integration.test.ts +0 -1815
- package/src/learning.ts +0 -1079
- package/src/logger.test.ts +0 -189
- package/src/logger.ts +0 -135
- package/src/mandate-promotion.test.ts +0 -473
- package/src/mandate-promotion.ts +0 -239
- package/src/mandate-storage.integration.test.ts +0 -601
- package/src/mandate-storage.test.ts +0 -578
- package/src/mandate-storage.ts +0 -794
- package/src/mandates.ts +0 -540
- package/src/memory-tools.test.ts +0 -195
- package/src/memory-tools.ts +0 -344
- package/src/memory.integration.test.ts +0 -334
- package/src/memory.test.ts +0 -158
- package/src/memory.ts +0 -527
- package/src/model-selection.test.ts +0 -188
- package/src/model-selection.ts +0 -68
- package/src/observability-tools.test.ts +0 -359
- package/src/observability-tools.ts +0 -871
- package/src/output-guardrails.test.ts +0 -438
- package/src/output-guardrails.ts +0 -381
- package/src/pattern-maturity.test.ts +0 -1160
- package/src/pattern-maturity.ts +0 -525
- package/src/planning-guardrails.test.ts +0 -491
- package/src/planning-guardrails.ts +0 -438
- package/src/plugin.ts +0 -23
- package/src/post-compaction-tracker.test.ts +0 -251
- package/src/post-compaction-tracker.ts +0 -237
- package/src/query-tools.test.ts +0 -636
- package/src/query-tools.ts +0 -324
- package/src/rate-limiter.integration.test.ts +0 -466
- package/src/rate-limiter.ts +0 -774
- package/src/replay-tools.test.ts +0 -496
- package/src/replay-tools.ts +0 -240
- package/src/repo-crawl.integration.test.ts +0 -441
- package/src/repo-crawl.ts +0 -610
- package/src/schemas/cell-events.test.ts +0 -347
- package/src/schemas/cell-events.ts +0 -807
- package/src/schemas/cell.ts +0 -257
- package/src/schemas/evaluation.ts +0 -166
- package/src/schemas/index.test.ts +0 -199
- package/src/schemas/index.ts +0 -286
- package/src/schemas/mandate.ts +0 -232
- package/src/schemas/swarm-context.ts +0 -115
- package/src/schemas/task.ts +0 -161
- package/src/schemas/worker-handoff.test.ts +0 -302
- package/src/schemas/worker-handoff.ts +0 -131
- package/src/skills.integration.test.ts +0 -1192
- package/src/skills.test.ts +0 -643
- package/src/skills.ts +0 -1549
- package/src/storage.integration.test.ts +0 -341
- package/src/storage.ts +0 -884
- package/src/structured.integration.test.ts +0 -817
- package/src/structured.test.ts +0 -1046
- package/src/structured.ts +0 -762
- package/src/swarm-decompose.test.ts +0 -188
- package/src/swarm-decompose.ts +0 -1302
- package/src/swarm-deferred.integration.test.ts +0 -157
- package/src/swarm-deferred.test.ts +0 -38
- package/src/swarm-insights.test.ts +0 -214
- package/src/swarm-insights.ts +0 -459
- package/src/swarm-mail.integration.test.ts +0 -970
- package/src/swarm-mail.ts +0 -739
- package/src/swarm-orchestrate.integration.test.ts +0 -282
- package/src/swarm-orchestrate.test.ts +0 -548
- package/src/swarm-orchestrate.ts +0 -3084
- package/src/swarm-prompts.test.ts +0 -1270
- package/src/swarm-prompts.ts +0 -2077
- package/src/swarm-research.integration.test.ts +0 -701
- package/src/swarm-research.test.ts +0 -698
- package/src/swarm-research.ts +0 -472
- package/src/swarm-review.integration.test.ts +0 -285
- package/src/swarm-review.test.ts +0 -879
- package/src/swarm-review.ts +0 -709
- package/src/swarm-strategies.ts +0 -407
- package/src/swarm-worktree.test.ts +0 -501
- package/src/swarm-worktree.ts +0 -575
- package/src/swarm.integration.test.ts +0 -2377
- package/src/swarm.ts +0 -38
- package/src/tool-adapter.integration.test.ts +0 -1221
- package/src/tool-availability.ts +0 -461
- package/tsconfig.json +0 -28
|
@@ -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
|
-
];
|
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test cases for compaction prompt quality evaluation
|
|
3
|
-
*
|
|
4
|
-
* Each case represents a continuation prompt that should be generated
|
|
5
|
-
* after context compaction. Tests validate that prompts have:
|
|
6
|
-
* - Real epic IDs (not placeholders)
|
|
7
|
-
* - Actionable tool calls with specific values
|
|
8
|
-
* - Strong coordinator identity
|
|
9
|
-
* - Explicit forbidden tools list
|
|
10
|
-
* - Correct first tool suggestion
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import type { CompactionPrompt } from "../../src/compaction-prompt-scoring.js";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Compaction prompt test case structure
|
|
17
|
-
*/
|
|
18
|
-
export interface CompactionPromptTestCase {
|
|
19
|
-
name: string;
|
|
20
|
-
description: string;
|
|
21
|
-
/**
|
|
22
|
-
* The generated continuation prompt
|
|
23
|
-
*/
|
|
24
|
-
prompt: CompactionPrompt;
|
|
25
|
-
/**
|
|
26
|
-
* Expected scoring outcomes
|
|
27
|
-
*/
|
|
28
|
-
expected: {
|
|
29
|
-
/**
|
|
30
|
-
* Should have real epic IDs (not placeholders)
|
|
31
|
-
*/
|
|
32
|
-
hasRealEpicId: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Should have actionable tool calls
|
|
35
|
-
*/
|
|
36
|
-
isActionable: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Should have strong coordinator identity
|
|
39
|
-
*/
|
|
40
|
-
hasCoordinatorIdentity: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Should list forbidden tools by name
|
|
43
|
-
*/
|
|
44
|
-
listsForbiddenTools: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* First suggested tool should be correct
|
|
47
|
-
*/
|
|
48
|
-
hasCorrectFirstTool: boolean;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export const compactionPromptCases: CompactionPromptTestCase[] = [
|
|
53
|
-
// ============================================================================
|
|
54
|
-
// PERFECT PROMPT: All criteria met
|
|
55
|
-
// ============================================================================
|
|
56
|
-
{
|
|
57
|
-
name: "Perfect coordinator resumption prompt",
|
|
58
|
-
description:
|
|
59
|
-
"Ideal continuation prompt with all quality criteria met: real IDs, actionable tools, strong identity, forbidden list, correct first tool",
|
|
60
|
-
prompt: {
|
|
61
|
-
content: `
|
|
62
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
63
|
-
│ 🐝 COORDINATOR RESUMPTION │
|
|
64
|
-
│ Context Compacted │
|
|
65
|
-
└─────────────────────────────────────────────────────────────┘
|
|
66
|
-
|
|
67
|
-
You are the COORDINATOR of swarm epic mjkweh2p4u5.
|
|
68
|
-
|
|
69
|
-
## IMMEDIATE ACTIONS (Do These FIRST)
|
|
70
|
-
|
|
71
|
-
1. swarm_status(epic_id="mjkweh2p4u5", project_key="/Users/joel/Code/myapp")
|
|
72
|
-
2. swarmmail_inbox(limit=5)
|
|
73
|
-
3. Review any completed work
|
|
74
|
-
|
|
75
|
-
## FORBIDDEN TOOLS (NEVER Use These)
|
|
76
|
-
|
|
77
|
-
Coordinators do NOT edit code directly. These tools are FORBIDDEN:
|
|
78
|
-
- edit
|
|
79
|
-
- write
|
|
80
|
-
- bash (for file modifications)
|
|
81
|
-
- swarmmail_reserve (only workers reserve)
|
|
82
|
-
- git commit (workers commit)
|
|
83
|
-
|
|
84
|
-
Use swarm_spawn_subtask to delegate work to workers.
|
|
85
|
-
|
|
86
|
-
## Your Role
|
|
87
|
-
|
|
88
|
-
You orchestrate. You do NOT implement. Spawn workers, monitor progress, unblock, ship.
|
|
89
|
-
|
|
90
|
-
ALWAYS spawn workers for file modifications.
|
|
91
|
-
NEVER edit files yourself.
|
|
92
|
-
NON-NEGOTIABLE: Check status and inbox before making decisions.
|
|
93
|
-
`,
|
|
94
|
-
},
|
|
95
|
-
expected: {
|
|
96
|
-
hasRealEpicId: true,
|
|
97
|
-
isActionable: true,
|
|
98
|
-
hasCoordinatorIdentity: true,
|
|
99
|
-
listsForbiddenTools: true,
|
|
100
|
-
hasCorrectFirstTool: true,
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
// ============================================================================
|
|
105
|
-
// BAD PROMPT: Placeholder epic ID
|
|
106
|
-
// ============================================================================
|
|
107
|
-
{
|
|
108
|
-
name: "Prompt with placeholder epic ID",
|
|
109
|
-
description:
|
|
110
|
-
"Contains placeholder <epic-id> instead of real ID - fails specificity check",
|
|
111
|
-
prompt: {
|
|
112
|
-
content: `
|
|
113
|
-
## Coordinator Resumption
|
|
114
|
-
|
|
115
|
-
You are coordinating epic <epic-id>.
|
|
116
|
-
|
|
117
|
-
Check the status with:
|
|
118
|
-
1. swarm_status(epic_id="<epic-id>", project_key="<path>")
|
|
119
|
-
2. swarmmail_inbox()
|
|
120
|
-
|
|
121
|
-
Continue orchestrating the swarm.
|
|
122
|
-
`,
|
|
123
|
-
},
|
|
124
|
-
expected: {
|
|
125
|
-
hasRealEpicId: false, // <epic-id> is a placeholder
|
|
126
|
-
isActionable: false, // Has placeholders in tool calls
|
|
127
|
-
hasCoordinatorIdentity: false, // No ASCII header or strong language
|
|
128
|
-
listsForbiddenTools: false, // Doesn't list forbidden tools
|
|
129
|
-
hasCorrectFirstTool: true, // First tool is swarm_status (correct)
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
// ============================================================================
|
|
134
|
-
// BAD PROMPT: Generic instructions, no actionable tools
|
|
135
|
-
// ============================================================================
|
|
136
|
-
{
|
|
137
|
-
name: "Generic instructions without specific tools",
|
|
138
|
-
description:
|
|
139
|
-
"Vague language like 'check status' without actual tool calls - fails actionability",
|
|
140
|
-
prompt: {
|
|
141
|
-
content: `
|
|
142
|
-
You were coordinating a swarm before compaction.
|
|
143
|
-
|
|
144
|
-
To resume:
|
|
145
|
-
- Check the status of workers
|
|
146
|
-
- Read your messages
|
|
147
|
-
- Continue where you left off
|
|
148
|
-
|
|
149
|
-
Remember, you're the coordinator. Keep the work moving forward.
|
|
150
|
-
`,
|
|
151
|
-
},
|
|
152
|
-
expected: {
|
|
153
|
-
hasRealEpicId: false, // No epic ID at all
|
|
154
|
-
isActionable: false, // No specific tool calls
|
|
155
|
-
hasCoordinatorIdentity: false, // No strong identity reinforcement
|
|
156
|
-
listsForbiddenTools: false, // No forbidden tools list
|
|
157
|
-
hasCorrectFirstTool: false, // No first tool specified
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
// ============================================================================
|
|
162
|
-
// BAD PROMPT: Weak coordinator identity
|
|
163
|
-
// ============================================================================
|
|
164
|
-
{
|
|
165
|
-
name: "Weak coordinator identity",
|
|
166
|
-
description:
|
|
167
|
-
"Has real ID and tools but lacks strong identity reinforcement - fails coordinator identity check",
|
|
168
|
-
prompt: {
|
|
169
|
-
content: `
|
|
170
|
-
## Swarm Resumption
|
|
171
|
-
|
|
172
|
-
Epic ID: mjkweh9x2a1
|
|
173
|
-
Project: /Users/joel/Code/myapp
|
|
174
|
-
|
|
175
|
-
You can check status with:
|
|
176
|
-
swarm_status(epic_id="mjkweh9x2a1", project_key="/Users/joel/Code/myapp")
|
|
177
|
-
|
|
178
|
-
And read messages:
|
|
179
|
-
swarmmail_inbox(limit=5)
|
|
180
|
-
|
|
181
|
-
Please continue coordinating.
|
|
182
|
-
`,
|
|
183
|
-
},
|
|
184
|
-
expected: {
|
|
185
|
-
hasRealEpicId: true, // Has real ID
|
|
186
|
-
isActionable: true, // Has specific tool calls
|
|
187
|
-
hasCoordinatorIdentity: false, // No ASCII header, no NEVER/ALWAYS/NON-NEGOTIABLE
|
|
188
|
-
listsForbiddenTools: false, // No forbidden tools list
|
|
189
|
-
hasCorrectFirstTool: true, // First tool is swarm_status
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
// ============================================================================
|
|
194
|
-
// BAD PROMPT: Missing forbidden tools list
|
|
195
|
-
// ============================================================================
|
|
196
|
-
{
|
|
197
|
-
name: "Missing forbidden tools list",
|
|
198
|
-
description:
|
|
199
|
-
"Good prompt but doesn't explicitly list forbidden tools - coordinators need this reminder",
|
|
200
|
-
prompt: {
|
|
201
|
-
content: `
|
|
202
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
203
|
-
│ 🐝 COORDINATOR RESUMPTION │
|
|
204
|
-
└─────────────────────────────────────────────────────────────┘
|
|
205
|
-
|
|
206
|
-
You are the COORDINATOR of epic mjkweh3k8p2.
|
|
207
|
-
|
|
208
|
-
## IMMEDIATE ACTIONS
|
|
209
|
-
|
|
210
|
-
1. swarm_status(epic_id="mjkweh3k8p2", project_key="/Users/joel/Code/myapp")
|
|
211
|
-
2. swarmmail_inbox(limit=5)
|
|
212
|
-
|
|
213
|
-
## Your Role
|
|
214
|
-
|
|
215
|
-
ALWAYS delegate to workers.
|
|
216
|
-
NEVER edit files directly.
|
|
217
|
-
|
|
218
|
-
Coordinators orchestrate, workers implement.
|
|
219
|
-
`,
|
|
220
|
-
},
|
|
221
|
-
expected: {
|
|
222
|
-
hasRealEpicId: true,
|
|
223
|
-
isActionable: true,
|
|
224
|
-
hasCoordinatorIdentity: true, // Has ASCII + NEVER/ALWAYS
|
|
225
|
-
listsForbiddenTools: false, // Doesn't list "edit", "write", "bash" by name
|
|
226
|
-
hasCorrectFirstTool: true,
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
|
|
230
|
-
// ============================================================================
|
|
231
|
-
// BAD PROMPT: Wrong first tool (edit instead of swarm_status)
|
|
232
|
-
// ============================================================================
|
|
233
|
-
{
|
|
234
|
-
name: "Wrong first tool suggestion",
|
|
235
|
-
description:
|
|
236
|
-
"Suggests edit/write as first action - coordinator discipline failure",
|
|
237
|
-
prompt: {
|
|
238
|
-
content: `
|
|
239
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
240
|
-
│ 🐝 COORDINATOR RESUMPTION │
|
|
241
|
-
└─────────────────────────────────────────────────────────────┘
|
|
242
|
-
|
|
243
|
-
You are the COORDINATOR of epic mjkweh7q9n4.
|
|
244
|
-
|
|
245
|
-
## IMMEDIATE ACTIONS
|
|
246
|
-
|
|
247
|
-
1. edit(filePath="/src/app.ts", oldString="...", newString="...")
|
|
248
|
-
2. swarm_status(epic_id="mjkweh7q9n4", project_key="/Users/joel/Code/myapp")
|
|
249
|
-
|
|
250
|
-
## FORBIDDEN TOOLS
|
|
251
|
-
- edit
|
|
252
|
-
- write
|
|
253
|
-
- bash (for file mods)
|
|
254
|
-
- swarmmail_reserve (only workers)
|
|
255
|
-
- git commit (workers only)
|
|
256
|
-
|
|
257
|
-
NEVER edit files yourself.
|
|
258
|
-
ALWAYS delegate to workers.
|
|
259
|
-
`,
|
|
260
|
-
},
|
|
261
|
-
expected: {
|
|
262
|
-
hasRealEpicId: true,
|
|
263
|
-
isActionable: true,
|
|
264
|
-
hasCoordinatorIdentity: true,
|
|
265
|
-
listsForbiddenTools: true,
|
|
266
|
-
hasCorrectFirstTool: false, // First tool is edit, should be swarm_status/inbox
|
|
267
|
-
},
|
|
268
|
-
},
|
|
269
|
-
|
|
270
|
-
// ============================================================================
|
|
271
|
-
// EDGE CASE: Multiple epics mentioned
|
|
272
|
-
// ============================================================================
|
|
273
|
-
{
|
|
274
|
-
name: "Multiple epic IDs in prompt",
|
|
275
|
-
description:
|
|
276
|
-
"Prompt references multiple epics - should still pass if at least one is real",
|
|
277
|
-
prompt: {
|
|
278
|
-
content: `
|
|
279
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
280
|
-
│ 🐝 COORDINATOR RESUMPTION │
|
|
281
|
-
└─────────────────────────────────────────────────────────────┘
|
|
282
|
-
|
|
283
|
-
You are coordinating epics:
|
|
284
|
-
- mjkweh5t2x8 (in progress)
|
|
285
|
-
- mjkweh6u3y9 (blocked)
|
|
286
|
-
|
|
287
|
-
## IMMEDIATE ACTIONS
|
|
288
|
-
|
|
289
|
-
1. swarm_status(epic_id="mjkweh5t2x8", project_key="/Users/joel/Code/myapp")
|
|
290
|
-
2. swarmmail_inbox(limit=5)
|
|
291
|
-
|
|
292
|
-
## FORBIDDEN TOOLS
|
|
293
|
-
- edit
|
|
294
|
-
- write
|
|
295
|
-
- bash
|
|
296
|
-
- swarmmail_reserve
|
|
297
|
-
- git commit
|
|
298
|
-
|
|
299
|
-
ALWAYS check status first.
|
|
300
|
-
NEVER edit files directly.
|
|
301
|
-
`,
|
|
302
|
-
},
|
|
303
|
-
expected: {
|
|
304
|
-
hasRealEpicId: true, // Has real IDs
|
|
305
|
-
isActionable: true,
|
|
306
|
-
hasCoordinatorIdentity: true,
|
|
307
|
-
listsForbiddenTools: true,
|
|
308
|
-
hasCorrectFirstTool: true,
|
|
309
|
-
},
|
|
310
|
-
},
|
|
311
|
-
];
|