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.
Files changed (208) hide show
  1. package/bin/cass.characterization.test.ts +422 -0
  2. package/bin/swarm.serve.test.ts +6 -4
  3. package/bin/swarm.test.ts +68 -0
  4. package/bin/swarm.ts +81 -8
  5. package/dist/compaction-prompt-scoring.js +139 -0
  6. package/dist/contributor-tools.d.ts +42 -0
  7. package/dist/contributor-tools.d.ts.map +1 -0
  8. package/dist/eval-capture.js +12811 -0
  9. package/dist/hive.d.ts.map +1 -1
  10. package/dist/index.d.ts +12 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +7728 -62590
  13. package/dist/plugin.js +23833 -78695
  14. package/dist/sessions/agent-discovery.d.ts +59 -0
  15. package/dist/sessions/agent-discovery.d.ts.map +1 -0
  16. package/dist/sessions/index.d.ts +10 -0
  17. package/dist/sessions/index.d.ts.map +1 -0
  18. package/dist/swarm-orchestrate.d.ts.map +1 -1
  19. package/dist/swarm-prompts.d.ts.map +1 -1
  20. package/dist/swarm-review.d.ts.map +1 -1
  21. package/package.json +17 -5
  22. package/.changeset/swarm-insights-data-layer.md +0 -63
  23. package/.hive/analysis/eval-failure-analysis-2025-12-25.md +0 -331
  24. package/.hive/analysis/session-data-quality-audit.md +0 -320
  25. package/.hive/eval-results.json +0 -483
  26. package/.hive/issues.jsonl +0 -138
  27. package/.hive/memories.jsonl +0 -729
  28. package/.opencode/eval-history.jsonl +0 -327
  29. package/.turbo/turbo-build.log +0 -9
  30. package/CHANGELOG.md +0 -2255
  31. package/SCORER-ANALYSIS.md +0 -598
  32. package/docs/analysis/subagent-coordination-patterns.md +0 -902
  33. package/docs/analysis-socratic-planner-pattern.md +0 -504
  34. package/docs/planning/ADR-001-monorepo-structure.md +0 -171
  35. package/docs/planning/ADR-002-package-extraction.md +0 -393
  36. package/docs/planning/ADR-003-performance-improvements.md +0 -451
  37. package/docs/planning/ADR-004-message-queue-features.md +0 -187
  38. package/docs/planning/ADR-005-devtools-observability.md +0 -202
  39. package/docs/planning/ADR-007-swarm-enhancements-worktree-review.md +0 -168
  40. package/docs/planning/ADR-008-worker-handoff-protocol.md +0 -293
  41. package/docs/planning/ADR-009-oh-my-opencode-patterns.md +0 -353
  42. package/docs/planning/ROADMAP.md +0 -368
  43. package/docs/semantic-memory-cli-syntax.md +0 -123
  44. package/docs/swarm-mail-architecture.md +0 -1147
  45. package/docs/testing/context-recovery-test.md +0 -470
  46. package/evals/ARCHITECTURE.md +0 -1189
  47. package/evals/README.md +0 -768
  48. package/evals/compaction-prompt.eval.ts +0 -149
  49. package/evals/compaction-resumption.eval.ts +0 -289
  50. package/evals/coordinator-behavior.eval.ts +0 -307
  51. package/evals/coordinator-session.eval.ts +0 -154
  52. package/evals/evalite.config.ts.bak +0 -15
  53. package/evals/example.eval.ts +0 -31
  54. package/evals/fixtures/compaction-cases.ts +0 -350
  55. package/evals/fixtures/compaction-prompt-cases.ts +0 -311
  56. package/evals/fixtures/coordinator-sessions.ts +0 -328
  57. package/evals/fixtures/decomposition-cases.ts +0 -105
  58. package/evals/lib/compaction-loader.test.ts +0 -248
  59. package/evals/lib/compaction-loader.ts +0 -320
  60. package/evals/lib/data-loader.evalite-test.ts +0 -289
  61. package/evals/lib/data-loader.test.ts +0 -345
  62. package/evals/lib/data-loader.ts +0 -281
  63. package/evals/lib/llm.ts +0 -115
  64. package/evals/scorers/compaction-prompt-scorers.ts +0 -145
  65. package/evals/scorers/compaction-scorers.ts +0 -305
  66. package/evals/scorers/coordinator-discipline.evalite-test.ts +0 -539
  67. package/evals/scorers/coordinator-discipline.ts +0 -325
  68. package/evals/scorers/index.test.ts +0 -146
  69. package/evals/scorers/index.ts +0 -328
  70. package/evals/scorers/outcome-scorers.evalite-test.ts +0 -27
  71. package/evals/scorers/outcome-scorers.ts +0 -349
  72. package/evals/swarm-decomposition.eval.ts +0 -121
  73. package/examples/commands/swarm.md +0 -745
  74. package/examples/plugin-wrapper-template.ts +0 -2426
  75. package/examples/skills/hive-workflow/SKILL.md +0 -212
  76. package/examples/skills/skill-creator/SKILL.md +0 -223
  77. package/examples/skills/swarm-coordination/SKILL.md +0 -292
  78. package/global-skills/cli-builder/SKILL.md +0 -344
  79. package/global-skills/cli-builder/references/advanced-patterns.md +0 -244
  80. package/global-skills/learning-systems/SKILL.md +0 -644
  81. package/global-skills/skill-creator/LICENSE.txt +0 -202
  82. package/global-skills/skill-creator/SKILL.md +0 -352
  83. package/global-skills/skill-creator/references/output-patterns.md +0 -82
  84. package/global-skills/skill-creator/references/workflows.md +0 -28
  85. package/global-skills/swarm-coordination/SKILL.md +0 -995
  86. package/global-skills/swarm-coordination/references/coordinator-patterns.md +0 -235
  87. package/global-skills/swarm-coordination/references/strategies.md +0 -138
  88. package/global-skills/system-design/SKILL.md +0 -213
  89. package/global-skills/testing-patterns/SKILL.md +0 -430
  90. package/global-skills/testing-patterns/references/dependency-breaking-catalog.md +0 -586
  91. package/opencode-swarm-plugin-0.30.7.tgz +0 -0
  92. package/opencode-swarm-plugin-0.31.0.tgz +0 -0
  93. package/scripts/cleanup-test-memories.ts +0 -346
  94. package/scripts/init-skill.ts +0 -222
  95. package/scripts/migrate-unknown-sessions.ts +0 -349
  96. package/scripts/validate-skill.ts +0 -204
  97. package/src/agent-mail.ts +0 -1724
  98. package/src/anti-patterns.test.ts +0 -1167
  99. package/src/anti-patterns.ts +0 -448
  100. package/src/compaction-capture.integration.test.ts +0 -257
  101. package/src/compaction-hook.test.ts +0 -838
  102. package/src/compaction-hook.ts +0 -1204
  103. package/src/compaction-observability.integration.test.ts +0 -139
  104. package/src/compaction-observability.test.ts +0 -187
  105. package/src/compaction-observability.ts +0 -324
  106. package/src/compaction-prompt-scorers.test.ts +0 -475
  107. package/src/compaction-prompt-scoring.ts +0 -300
  108. package/src/dashboard.test.ts +0 -611
  109. package/src/dashboard.ts +0 -462
  110. package/src/error-enrichment.test.ts +0 -403
  111. package/src/error-enrichment.ts +0 -219
  112. package/src/eval-capture.test.ts +0 -1015
  113. package/src/eval-capture.ts +0 -929
  114. package/src/eval-gates.test.ts +0 -306
  115. package/src/eval-gates.ts +0 -218
  116. package/src/eval-history.test.ts +0 -508
  117. package/src/eval-history.ts +0 -214
  118. package/src/eval-learning.test.ts +0 -378
  119. package/src/eval-learning.ts +0 -360
  120. package/src/eval-runner.test.ts +0 -223
  121. package/src/eval-runner.ts +0 -402
  122. package/src/export-tools.test.ts +0 -476
  123. package/src/export-tools.ts +0 -257
  124. package/src/hive.integration.test.ts +0 -2241
  125. package/src/hive.ts +0 -1628
  126. package/src/index.ts +0 -935
  127. package/src/learning.integration.test.ts +0 -1815
  128. package/src/learning.ts +0 -1079
  129. package/src/logger.test.ts +0 -189
  130. package/src/logger.ts +0 -135
  131. package/src/mandate-promotion.test.ts +0 -473
  132. package/src/mandate-promotion.ts +0 -239
  133. package/src/mandate-storage.integration.test.ts +0 -601
  134. package/src/mandate-storage.test.ts +0 -578
  135. package/src/mandate-storage.ts +0 -794
  136. package/src/mandates.ts +0 -540
  137. package/src/memory-tools.test.ts +0 -195
  138. package/src/memory-tools.ts +0 -344
  139. package/src/memory.integration.test.ts +0 -334
  140. package/src/memory.test.ts +0 -158
  141. package/src/memory.ts +0 -527
  142. package/src/model-selection.test.ts +0 -188
  143. package/src/model-selection.ts +0 -68
  144. package/src/observability-tools.test.ts +0 -359
  145. package/src/observability-tools.ts +0 -871
  146. package/src/output-guardrails.test.ts +0 -438
  147. package/src/output-guardrails.ts +0 -381
  148. package/src/pattern-maturity.test.ts +0 -1160
  149. package/src/pattern-maturity.ts +0 -525
  150. package/src/planning-guardrails.test.ts +0 -491
  151. package/src/planning-guardrails.ts +0 -438
  152. package/src/plugin.ts +0 -23
  153. package/src/post-compaction-tracker.test.ts +0 -251
  154. package/src/post-compaction-tracker.ts +0 -237
  155. package/src/query-tools.test.ts +0 -636
  156. package/src/query-tools.ts +0 -324
  157. package/src/rate-limiter.integration.test.ts +0 -466
  158. package/src/rate-limiter.ts +0 -774
  159. package/src/replay-tools.test.ts +0 -496
  160. package/src/replay-tools.ts +0 -240
  161. package/src/repo-crawl.integration.test.ts +0 -441
  162. package/src/repo-crawl.ts +0 -610
  163. package/src/schemas/cell-events.test.ts +0 -347
  164. package/src/schemas/cell-events.ts +0 -807
  165. package/src/schemas/cell.ts +0 -257
  166. package/src/schemas/evaluation.ts +0 -166
  167. package/src/schemas/index.test.ts +0 -199
  168. package/src/schemas/index.ts +0 -286
  169. package/src/schemas/mandate.ts +0 -232
  170. package/src/schemas/swarm-context.ts +0 -115
  171. package/src/schemas/task.ts +0 -161
  172. package/src/schemas/worker-handoff.test.ts +0 -302
  173. package/src/schemas/worker-handoff.ts +0 -131
  174. package/src/skills.integration.test.ts +0 -1192
  175. package/src/skills.test.ts +0 -643
  176. package/src/skills.ts +0 -1549
  177. package/src/storage.integration.test.ts +0 -341
  178. package/src/storage.ts +0 -884
  179. package/src/structured.integration.test.ts +0 -817
  180. package/src/structured.test.ts +0 -1046
  181. package/src/structured.ts +0 -762
  182. package/src/swarm-decompose.test.ts +0 -188
  183. package/src/swarm-decompose.ts +0 -1302
  184. package/src/swarm-deferred.integration.test.ts +0 -157
  185. package/src/swarm-deferred.test.ts +0 -38
  186. package/src/swarm-insights.test.ts +0 -214
  187. package/src/swarm-insights.ts +0 -459
  188. package/src/swarm-mail.integration.test.ts +0 -970
  189. package/src/swarm-mail.ts +0 -739
  190. package/src/swarm-orchestrate.integration.test.ts +0 -282
  191. package/src/swarm-orchestrate.test.ts +0 -548
  192. package/src/swarm-orchestrate.ts +0 -3084
  193. package/src/swarm-prompts.test.ts +0 -1270
  194. package/src/swarm-prompts.ts +0 -2077
  195. package/src/swarm-research.integration.test.ts +0 -701
  196. package/src/swarm-research.test.ts +0 -698
  197. package/src/swarm-research.ts +0 -472
  198. package/src/swarm-review.integration.test.ts +0 -285
  199. package/src/swarm-review.test.ts +0 -879
  200. package/src/swarm-review.ts +0 -709
  201. package/src/swarm-strategies.ts +0 -407
  202. package/src/swarm-worktree.test.ts +0 -501
  203. package/src/swarm-worktree.ts +0 -575
  204. package/src/swarm.integration.test.ts +0 -2377
  205. package/src/swarm.ts +0 -38
  206. package/src/tool-adapter.integration.test.ts +0 -1221
  207. package/src/tool-availability.ts +0 -461
  208. package/tsconfig.json +0 -28
@@ -1,470 +0,0 @@
1
- # Context Recovery Manual Test Scenario
2
-
3
- ## Overview
4
-
5
- This test scenario verifies that the swarm coordination system can survive context death and recover from checkpoints. It proves that work-in-progress state is preserved across session boundaries, enabling agents to resume work after catastrophic context loss.
6
-
7
- **What this tests:**
8
- - Automatic checkpoint creation at progress milestones (25%, 50%, 75%)
9
- - State persistence to swarm-mail event store
10
- - Recovery mechanism that restores agent state
11
- - Continuity of work across session boundaries
12
-
13
- **Success criteria:**
14
- - Agent can resume work from exact state before context loss
15
- - All file modifications are tracked
16
- - Progress percentage is preserved
17
- - Coordinator context and directives are restored
18
-
19
- ---
20
-
21
- ## Prerequisites
22
-
23
- ### Required Setup
24
- 1. **Project with swarm-mail initialized**
25
- ```bash
26
- cd /path/to/your/project
27
- # Ensure swarm-mail database exists
28
- ```
29
-
30
- 2. **OpenCode Swarm Plugin installed**
31
- ```bash
32
- npm install opencode-swarm-plugin
33
- # or
34
- bun add opencode-swarm-plugin
35
- ```
36
-
37
- 3. **Test bead structure**
38
- - Epic bead with at least one subtask
39
- - Example:
40
- ```bash
41
- hive_create_epic(
42
- epic_title: "Test Context Recovery",
43
- subtasks: [
44
- { title: "Modify test files", files: ["test/file1.ts", "test/file2.ts"] }
45
- ]
46
- )
47
- ```
48
-
49
- 4. **Two terminal windows/sessions**
50
- - Session A: For initial work (will be killed)
51
- - Session B: For recovery
52
-
53
- ---
54
-
55
- ## Test Procedure
56
-
57
- ### Phase 1: Start Initial Work Session
58
-
59
- **Session A - Terminal 1**
60
-
61
- 1. **Initialize swarm mail**
62
- ```typescript
63
- swarmmail_init(
64
- project_path: "/absolute/path/to/project",
65
- task_description: "bd-123.1: Test context recovery feature"
66
- )
67
- ```
68
-
69
- **Expected result:**
70
- ```json
71
- {
72
- "success": true,
73
- "data": {
74
- "agent_name": "BlueLake", // Random agent name
75
- "project_key": "/absolute/path/to/project"
76
- }
77
- }
78
- ```
79
-
80
- **Verify:**
81
- - ✅ Agent name assigned (e.g., "BlueLake")
82
- - ✅ Project key matches your path
83
-
84
- 2. **Reserve files for work**
85
- ```typescript
86
- swarmmail_reserve(
87
- paths: ["test/file1.ts", "test/file2.ts"],
88
- reason: "bd-123.1: Context recovery test",
89
- ttl_seconds: 3600
90
- )
91
- ```
92
-
93
- **Expected result:**
94
- ```json
95
- {
96
- "success": true,
97
- "data": {
98
- "reservation_ids": [1, 2],
99
- "agent_name": "BlueLake",
100
- "expires_at": 1234567890
101
- }
102
- }
103
- ```
104
-
105
- **Verify:**
106
- - ✅ Reservation IDs returned
107
- - ✅ Files locked to this agent
108
-
109
- 3. **Make some file modifications**
110
- ```bash
111
- # Modify test/file1.ts
112
- echo "// First change" >> test/file1.ts
113
- ```
114
-
115
- **Expected result:**
116
- - File modified on disk
117
-
118
- **Verify:**
119
- - ✅ File contains new content
120
-
121
- 4. **Report 50% progress (triggers auto-checkpoint)**
122
- ```typescript
123
- swarm_progress(
124
- project_key: "/absolute/path/to/project",
125
- agent_name: "BlueLake",
126
- bead_id: "bd-123.1",
127
- status: "in_progress",
128
- progress_percent: 50,
129
- message: "Completed first file modification",
130
- files_touched: ["test/file1.ts"]
131
- )
132
- ```
133
-
134
- **Expected result:**
135
- ```json
136
- {
137
- "success": true,
138
- "data": {
139
- "checkpoint_created": true,
140
- "message": "Progress reported and checkpoint saved"
141
- }
142
- }
143
- ```
144
-
145
- **Verify:**
146
- - ✅ Checkpoint creation confirmed
147
- - ✅ Progress percentage is 50
148
- - ✅ Files touched recorded
149
-
150
- 5. **Verify checkpoint was created in swarm-mail**
151
- ```typescript
152
- // Query the event store directly (if you have access)
153
- // Or check via beads metadata
154
- hive_query(status: "in_progress")
155
- ```
156
-
157
- **Expected result:**
158
- - Bead shows 50% progress
159
- - Checkpoint event exists in event store
160
-
161
- **Verify:**
162
- - ✅ Checkpoint event type: "swarm_checkpoint_created"
163
- - ✅ Recovery data includes: epic_id, bead_id, files, progress_percent, files_modified
164
-
165
- ---
166
-
167
- ### Phase 2: Simulate Context Death
168
-
169
- **Session A - Terminal 1**
170
-
171
- 6. **Kill the session abruptly**
172
- ```bash
173
- # Press Ctrl+C or kill the terminal
174
- # DO NOT gracefully close - simulate crash
175
- ```
176
-
177
- **Expected result:**
178
- - Session terminates immediately
179
- - No cleanup runs
180
-
181
- **Verify:**
182
- - ✅ Session ended ungracefully
183
- - ✅ Agent did NOT release reservations
184
- - ✅ Work state is "frozen" in event store
185
-
186
- ---
187
-
188
- ### Phase 3: Recover State in New Session
189
-
190
- **Session B - Terminal 2**
191
-
192
- 7. **Start fresh session (simulate new agent)**
193
- ```typescript
194
- swarmmail_init(
195
- project_path: "/absolute/path/to/project",
196
- task_description: "Recovering from context death"
197
- )
198
- ```
199
-
200
- **Expected result:**
201
- ```json
202
- {
203
- "success": true,
204
- "data": {
205
- "agent_name": "CrimsonPeak", // DIFFERENT agent name
206
- "project_key": "/absolute/path/to/project"
207
- }
208
- }
209
- ```
210
-
211
- **Verify:**
212
- - ✅ New agent name (different from Session A)
213
- - ✅ Fresh session started
214
-
215
- 8. **Attempt recovery**
216
- ```typescript
217
- swarm_recover(
218
- project_key: "/absolute/path/to/project",
219
- bead_id: "bd-123.1"
220
- )
221
- ```
222
-
223
- **Expected result:**
224
- ```json
225
- {
226
- "success": true,
227
- "data": {
228
- "recovered": true,
229
- "checkpoint": {
230
- "epic_id": "bd-123",
231
- "bead_id": "bd-123.1",
232
- "strategy": "file-based",
233
- "files": ["test/file1.ts", "test/file2.ts"],
234
- "recovery": {
235
- "last_checkpoint": 1234567890,
236
- "files_modified": ["test/file1.ts"],
237
- "progress_percent": 50,
238
- "last_message": "Completed first file modification"
239
- },
240
- "directives": {
241
- "shared_context": "Test context recovery feature",
242
- "coordinator_notes": "Resume from 50% completion"
243
- }
244
- },
245
- "message": "State recovered from checkpoint at 50%"
246
- }
247
- }
248
- ```
249
-
250
- **Verify:**
251
- - ✅ Recovery successful
252
- - ✅ Progress is 50% (matches last checkpoint)
253
- - ✅ Files modified list is correct
254
- - ✅ Last message preserved
255
- - ✅ Strategy and directives restored
256
-
257
- 9. **Verify file reservations were transferred**
258
- ```typescript
259
- // Check inbox for reservation status
260
- swarmmail_inbox(limit: 5)
261
- ```
262
-
263
- **Expected result:**
264
- - Reservations still exist (orphaned from BlueLake)
265
- - OR recovery automatically transferred ownership to CrimsonPeak
266
-
267
- **Verify:**
268
- - ✅ Files are either still reserved or available for new reservation
269
- - ✅ No reservation conflicts
270
-
271
- 10. **Resume work with recovered state**
272
- ```bash
273
- # Modify test/file2.ts (continue where Session A left off)
274
- echo "// Second change" >> test/file2.ts
275
- ```
276
-
277
- **Expected result:**
278
- - File modified successfully
279
-
280
- **Verify:**
281
- - ✅ Agent can continue work
282
- - ✅ File modifications build on previous state
283
-
284
- 11. **Report completion**
285
- ```typescript
286
- swarm_complete(
287
- project_key: "/absolute/path/to/project",
288
- agent_name: "CrimsonPeak",
289
- bead_id: "bd-123.1",
290
- summary: "Completed context recovery test - survived session death",
291
- files_touched: ["test/file1.ts", "test/file2.ts"]
292
- )
293
- ```
294
-
295
- **Expected result:**
296
- ```json
297
- {
298
- "success": true,
299
- "data": {
300
- "bead_closed": true,
301
- "reservations_released": true,
302
- "ubs_scan_passed": true
303
- }
304
- }
305
- ```
306
-
307
- **Verify:**
308
- - ✅ Bead marked complete
309
- - ✅ Reservations released
310
- - ✅ All files touched recorded (both sessions combined)
311
-
312
- ---
313
-
314
- ## Verification Checklist
315
-
316
- ### Checkpoint Creation
317
- - [ ] Auto-checkpoint triggered at 50% progress
318
- - [ ] Checkpoint includes epic_id, bead_id, strategy
319
- - [ ] Files list preserved
320
- - [ ] Progress percentage stored
321
- - [ ] Files modified list accurate
322
- - [ ] Last message captured
323
-
324
- ### Recovery Mechanism
325
- - [ ] New session can query checkpoint by bead_id
326
- - [ ] All checkpoint data restored correctly
327
- - [ ] Directives and context preserved
328
- - [ ] Recovery returns actionable state object
329
-
330
- ### State Continuity
331
- - [ ] Work can resume from exact checkpoint state
332
- - [ ] File modifications from Session A are visible
333
- - [ ] Progress percentage matches last checkpoint (50%)
334
- - [ ] Completion acknowledges full file list (both sessions)
335
-
336
- ### Edge Cases
337
- - [ ] Recovery fails gracefully if no checkpoint exists
338
- - [ ] Recovery handles multiple checkpoints (returns latest)
339
- - [ ] Orphaned reservations don't block recovery
340
- - [ ] Recovery works across different agent names
341
-
342
- ---
343
-
344
- ## Expected Failure Modes (Negative Testing)
345
-
346
- ### Test 1: Recovery with No Checkpoint
347
- ```typescript
348
- swarm_recover(
349
- project_key: "/path/to/project",
350
- bead_id: "bd-999.1" // Non-existent bead
351
- )
352
- ```
353
-
354
- **Expected result:**
355
- ```json
356
- {
357
- "success": false,
358
- "error": "No checkpoint found for bead bd-999.1"
359
- }
360
- ```
361
-
362
- ### Test 2: Recovery Before Any Progress
363
- ```typescript
364
- // Create bead but never report progress
365
- swarm_recover(
366
- project_key: "/path/to/project",
367
- bead_id: "bd-123.2"
368
- )
369
- ```
370
-
371
- **Expected result:**
372
- ```json
373
- {
374
- "success": false,
375
- "error": "No checkpoint found - agent never reported progress"
376
- }
377
- ```
378
-
379
- ### Test 3: Manual Checkpoint Creation
380
- ```typescript
381
- // Agent can force checkpoint at any time
382
- swarm_checkpoint(
383
- project_key: "/path/to/project",
384
- bead_id: "bd-123.1",
385
- checkpoint_data: {
386
- progress_percent: 33,
387
- files_modified: ["test/file1.ts"],
388
- message: "Manual checkpoint before risky operation"
389
- }
390
- )
391
- ```
392
-
393
- **Expected result:**
394
- ```json
395
- {
396
- "success": true,
397
- "data": {
398
- "checkpoint_id": 42,
399
- "message": "Manual checkpoint created"
400
- }
401
- }
402
- ```
403
-
404
- ---
405
-
406
- ## Troubleshooting
407
-
408
- ### Issue: Recovery returns empty checkpoint
409
- **Cause:** Checkpoint event not committed to event store
410
- **Fix:** Verify `swarm_progress` was called with `progress_percent >= 25`
411
-
412
- ### Issue: Files modified in Session A not visible in Session B
413
- **Cause:** File changes not committed to git or filesystem
414
- **Fix:** Ensure file writes are flushed before killing session
415
-
416
- ### Issue: Reservation conflicts after recovery
417
- **Cause:** Orphaned reservations from dead agent
418
- **Fix:** Implement TTL-based reservation expiry or manual release by project_key
419
-
420
- ### Issue: Multiple checkpoints confuse recovery
421
- **Cause:** Recovery not selecting latest checkpoint
422
- **Fix:** Verify recovery queries `ORDER BY timestamp DESC LIMIT 1`
423
-
424
- ---
425
-
426
- ## Advanced Scenarios
427
-
428
- ### Scenario A: Coordinator Death
429
- 1. Coordinator spawns 5 worker agents
430
- 2. Coordinator dies at 60% overall completion
431
- 3. New coordinator recovers state for all workers
432
- 4. Workers continue reporting to new coordinator
433
-
434
- ### Scenario B: Cascading Recovery
435
- 1. Worker A checkpoints at 50%
436
- 2. Worker A dies
437
- 3. Worker B recovers Worker A's state
438
- 4. Worker B checkpoints at 75%
439
- 5. Worker B dies
440
- 6. Worker C recovers Worker B's state (which includes Worker A's progress)
441
-
442
- ### Scenario C: Partial File Reservation
443
- 1. Agent reserves 10 files
444
- 2. Modifies 3 files
445
- 3. Dies at 30%
446
- 4. Recovery agent only needs to work on remaining 7 files
447
-
448
- ---
449
-
450
- ## Success Metrics
451
-
452
- | Metric | Target | Actual |
453
- |--------|--------|--------|
454
- | Recovery accuracy | 100% state match | _____ |
455
- | Time to recover | < 5 seconds | _____ |
456
- | Data loss | 0 bytes | _____ |
457
- | Checkpoint overhead | < 100ms per checkpoint | _____ |
458
- | Storage per checkpoint | < 10KB | _____ |
459
-
460
- ---
461
-
462
- ## Conclusion
463
-
464
- This manual test proves that:
465
- 1. ✅ Agents can survive catastrophic context loss
466
- 2. ✅ Work state is preserved in event-sourced storage
467
- 3. ✅ Recovery is deterministic and accurate
468
- 4. ✅ Multi-session workflows are possible
469
-
470
- **Sign-off:** If all verification checkboxes are marked and success metrics met, the context recovery feature is production-ready.