opencode-swarm-plugin 0.23.5 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +34 -0
- package/README.md +155 -3
- package/bin/swarm.ts +497 -187
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +668 -91
- package/dist/plugin.js +596 -91
- package/dist/schemas/bead-events.d.ts +698 -0
- package/dist/schemas/bead-events.d.ts.map +1 -0
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/skills.d.ts.map +1 -1
- package/dist/swarm-decompose.d.ts +74 -0
- package/dist/swarm-decompose.d.ts.map +1 -1
- package/dist/swarm-orchestrate.d.ts.map +1 -1
- package/dist/swarm-prompts.d.ts +1 -1
- package/dist/swarm-prompts.d.ts.map +1 -1
- package/dist/swarm.d.ts +27 -0
- package/dist/swarm.d.ts.map +1 -1
- package/docs/testing/context-recovery-test.md +470 -0
- package/examples/commands/swarm.md +92 -20
- package/global-skills/swarm-coordination/SKILL.md +380 -10
- package/package.json +2 -2
- package/src/schemas/bead-events.test.ts +341 -0
- package/src/schemas/bead-events.ts +583 -0
- package/src/schemas/index.ts +51 -0
- package/src/skills.ts +10 -3
- package/src/swarm-decompose.ts +337 -0
- package/src/swarm-orchestrate.ts +72 -55
- package/src/swarm-prompts.ts +144 -42
- package/src/swarm.integration.test.ts +581 -31
package/src/swarm-prompts.ts
CHANGED
|
@@ -273,13 +273,11 @@ Only modify these files. Need others? Message the coordinator.
|
|
|
273
273
|
|
|
274
274
|
{error_context}
|
|
275
275
|
|
|
276
|
-
## [MANDATORY
|
|
276
|
+
## [MANDATORY SURVIVAL CHECKLIST]
|
|
277
277
|
|
|
278
|
-
**CRITICAL:
|
|
278
|
+
**CRITICAL: Follow this checklist IN ORDER. Each step builds on the previous.**
|
|
279
279
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
### Step 1: Initialize (REQUIRED - DO THIS FIRST)
|
|
280
|
+
### Step 1: Initialize Coordination (REQUIRED - DO THIS FIRST)
|
|
283
281
|
\`\`\`
|
|
284
282
|
swarmmail_init(project_path="{project_path}", task_description="{bead_id}: {subtask_title}")
|
|
285
283
|
\`\`\`
|
|
@@ -292,26 +290,124 @@ swarmmail_init(project_path="{project_path}", task_description="{bead_id}: {subt
|
|
|
292
290
|
|
|
293
291
|
**If you skip this step, your work will not be tracked and swarm_complete will fail.**
|
|
294
292
|
|
|
295
|
-
|
|
293
|
+
### Step 2: Query Past Learnings (BEFORE starting work)
|
|
294
|
+
\`\`\`
|
|
295
|
+
semantic-memory_find(query="<keywords from your task>", limit=5)
|
|
296
|
+
\`\`\`
|
|
296
297
|
|
|
297
|
-
|
|
298
|
+
**Check if past agents solved similar problems.** Search for:
|
|
299
|
+
- Error messages if debugging
|
|
300
|
+
- Domain concepts (e.g., "authentication", "caching")
|
|
301
|
+
- Technology stack (e.g., "Next.js", "React")
|
|
302
|
+
- Patterns (e.g., "event sourcing", "validation")
|
|
298
303
|
|
|
299
|
-
|
|
304
|
+
**Past learnings save time and prevent repeating mistakes.**
|
|
305
|
+
|
|
306
|
+
### Step 3: Load Relevant Skills (if available)
|
|
300
307
|
\`\`\`
|
|
301
|
-
|
|
302
|
-
|
|
308
|
+
skills_list() # See what skills exist
|
|
309
|
+
skills_use(name="<relevant-skill>", context="<your task>") # Load skill
|
|
303
310
|
\`\`\`
|
|
304
311
|
|
|
305
|
-
|
|
312
|
+
**Common skill triggers:**
|
|
313
|
+
- Writing tests? → \`skills_use(name="testing-patterns")\`
|
|
314
|
+
- Breaking dependencies? → \`skills_use(name="testing-patterns")\`
|
|
315
|
+
- Multi-agent coordination? → \`skills_use(name="swarm-coordination")\`
|
|
316
|
+
- Building a CLI? → \`skills_use(name="cli-builder")\`
|
|
317
|
+
|
|
318
|
+
### Step 4: Reserve Your Files (YOU reserve, not coordinator)
|
|
306
319
|
\`\`\`
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
320
|
+
swarmmail_reserve(
|
|
321
|
+
paths=[{file_list}],
|
|
322
|
+
reason="{bead_id}: {subtask_title}",
|
|
323
|
+
exclusive=true
|
|
324
|
+
)
|
|
325
|
+
\`\`\`
|
|
326
|
+
|
|
327
|
+
**Workers reserve their own files.** This prevents edit conflicts with other agents.
|
|
328
|
+
|
|
329
|
+
### Step 5: Do the Work
|
|
330
|
+
- Read your assigned files
|
|
331
|
+
- Implement changes
|
|
332
|
+
- Verify (typecheck if applicable)
|
|
333
|
+
|
|
334
|
+
### Step 6: Report Progress at Milestones
|
|
335
|
+
\`\`\`
|
|
336
|
+
swarm_progress(
|
|
337
|
+
project_key="{project_path}",
|
|
338
|
+
agent_name="<your-agent-name>",
|
|
339
|
+
bead_id="{bead_id}",
|
|
340
|
+
status="in_progress",
|
|
341
|
+
progress_percent=25, # or 50, 75
|
|
342
|
+
message="<what you just completed>"
|
|
312
343
|
)
|
|
313
344
|
\`\`\`
|
|
314
345
|
|
|
346
|
+
**Report at 25%, 50%, 75% completion.** This:
|
|
347
|
+
- Triggers auto-checkpoint (saves context)
|
|
348
|
+
- Keeps coordinator informed
|
|
349
|
+
- Prevents silent failures
|
|
350
|
+
|
|
351
|
+
### Step 7: Manual Checkpoint BEFORE Risky Operations
|
|
352
|
+
\`\`\`
|
|
353
|
+
swarm_checkpoint(
|
|
354
|
+
project_key="{project_path}",
|
|
355
|
+
agent_name="<your-agent-name>",
|
|
356
|
+
bead_id="{bead_id}"
|
|
357
|
+
)
|
|
358
|
+
\`\`\`
|
|
359
|
+
|
|
360
|
+
**Call BEFORE:**
|
|
361
|
+
- Large refactors
|
|
362
|
+
- File deletions
|
|
363
|
+
- Breaking API changes
|
|
364
|
+
- Anything that might fail catastrophically
|
|
365
|
+
|
|
366
|
+
**Checkpoints preserve context so you can recover if things go wrong.**
|
|
367
|
+
|
|
368
|
+
### Step 8: Store Learnings (if you discovered something)
|
|
369
|
+
\`\`\`
|
|
370
|
+
semantic-memory_store(
|
|
371
|
+
information="<what you learned, WHY it matters, how to apply it>",
|
|
372
|
+
metadata="<tags: domain, tech-stack, pattern-type>"
|
|
373
|
+
)
|
|
374
|
+
\`\`\`
|
|
375
|
+
|
|
376
|
+
**Store:**
|
|
377
|
+
- Tricky bugs you solved (root cause + solution)
|
|
378
|
+
- Project-specific patterns or domain rules
|
|
379
|
+
- Tool/library gotchas and workarounds
|
|
380
|
+
- Failed approaches (anti-patterns to avoid)
|
|
381
|
+
|
|
382
|
+
**Don't store generic knowledge.** Store the WHY, not just the WHAT.
|
|
383
|
+
|
|
384
|
+
### Step 9: Complete (REQUIRED - releases reservations)
|
|
385
|
+
\`\`\`
|
|
386
|
+
swarm_complete(
|
|
387
|
+
project_key="{project_path}",
|
|
388
|
+
agent_name="<your-agent-name>",
|
|
389
|
+
bead_id="{bead_id}",
|
|
390
|
+
summary="<what you accomplished>",
|
|
391
|
+
files_touched=["list", "of", "files"]
|
|
392
|
+
)
|
|
393
|
+
\`\`\`
|
|
394
|
+
|
|
395
|
+
**This automatically:**
|
|
396
|
+
- Runs UBS bug scan
|
|
397
|
+
- Releases file reservations
|
|
398
|
+
- Records learning signals
|
|
399
|
+
- Notifies coordinator
|
|
400
|
+
|
|
401
|
+
**DO NOT manually close the bead with beads_close.** Use swarm_complete.
|
|
402
|
+
|
|
403
|
+
## [SWARM MAIL COMMUNICATION]
|
|
404
|
+
|
|
405
|
+
### Check Inbox Regularly
|
|
406
|
+
\`\`\`
|
|
407
|
+
swarmmail_inbox() # Check for coordinator messages
|
|
408
|
+
swarmmail_read_message(message_id=N) # Read specific message
|
|
409
|
+
\`\`\`
|
|
410
|
+
|
|
315
411
|
### When Blocked
|
|
316
412
|
\`\`\`
|
|
317
413
|
swarmmail_send(
|
|
@@ -324,42 +420,48 @@ swarmmail_send(
|
|
|
324
420
|
beads_update(id="{bead_id}", status="blocked")
|
|
325
421
|
\`\`\`
|
|
326
422
|
|
|
327
|
-
###
|
|
423
|
+
### Report Issues to Other Agents
|
|
424
|
+
\`\`\`
|
|
425
|
+
swarmmail_send(
|
|
426
|
+
to=["OtherAgent", "coordinator"],
|
|
427
|
+
subject="Issue in {bead_id}",
|
|
428
|
+
body="<describe problem, don't fix their code>",
|
|
429
|
+
thread_id="{epic_id}"
|
|
430
|
+
)
|
|
431
|
+
\`\`\`
|
|
432
|
+
|
|
433
|
+
### Manual Release (if needed)
|
|
328
434
|
\`\`\`
|
|
329
|
-
swarmmail_release() #
|
|
435
|
+
swarmmail_release() # Manually release reservations
|
|
330
436
|
\`\`\`
|
|
331
437
|
|
|
438
|
+
**Note:** \`swarm_complete\` automatically releases reservations. Only use manual release if aborting work.
|
|
439
|
+
|
|
332
440
|
## [OTHER TOOLS]
|
|
333
441
|
### Beads
|
|
334
442
|
- beads_update(id, status) - Mark blocked if stuck
|
|
335
443
|
- beads_create(title, type) - Log new bugs found
|
|
336
444
|
|
|
337
|
-
### Skills
|
|
445
|
+
### Skills
|
|
338
446
|
- skills_list() - Discover available skills
|
|
339
447
|
- skills_use(name) - Activate skill for specialized guidance
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
6. **swarm_complete** - Mark done, release reservations
|
|
358
|
-
|
|
359
|
-
**CRITICAL REQUIREMENTS:**
|
|
360
|
-
- Step 1 (swarmmail_init) is NON-NEGOTIABLE - do it before anything else
|
|
361
|
-
- Never work silently - send progress updates via swarmmail_send every significant milestone
|
|
362
|
-
- If you complete without initializing, swarm_complete will detect this and warn/fail
|
|
448
|
+
- skills_create(name) - Create new skill (if you found a reusable pattern)
|
|
449
|
+
|
|
450
|
+
## [CRITICAL REQUIREMENTS]
|
|
451
|
+
|
|
452
|
+
**NON-NEGOTIABLE:**
|
|
453
|
+
1. Step 1 (swarmmail_init) MUST be first - do it before anything else
|
|
454
|
+
2. Step 2 (semantic-memory_find) MUST happen before starting work
|
|
455
|
+
3. Step 4 (swarmmail_reserve) - YOU reserve files, not coordinator
|
|
456
|
+
4. Step 6 (swarm_progress) - Report at milestones, don't work silently
|
|
457
|
+
5. Step 9 (swarm_complete) - Use this to close, NOT beads_close
|
|
458
|
+
|
|
459
|
+
**If you skip these steps:**
|
|
460
|
+
- Your work won't be tracked (swarm_complete will fail)
|
|
461
|
+
- You'll waste time repeating solved problems (no semantic memory query)
|
|
462
|
+
- Edit conflicts with other agents (no file reservation)
|
|
463
|
+
- Lost work if you crash (no checkpoints)
|
|
464
|
+
- Future agents repeat your mistakes (no learnings stored)
|
|
363
465
|
|
|
364
466
|
Begin now.`;
|
|
365
467
|
|