opencode-swarm-plugin 0.21.0 → 0.22.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/.beads/issues.jsonl +13 -2
- package/README.md +316 -51
- package/dist/index.js +287 -150
- package/dist/plugin.js +272 -144
- package/docs/semantic-memory-cli-syntax.md +123 -0
- package/docs/swarm-mail-architecture.md +1147 -0
- package/package.json +1 -1
- package/scripts/cleanup-test-memories.ts +346 -0
- package/src/learning.integration.test.ts +19 -4
- package/src/storage.ts +117 -5
- package/src/swarm-orchestrate.ts +392 -239
- package/src/swarm.integration.test.ts +124 -0
- package/vitest.integration.config.ts +6 -0
- package/vitest.integration.setup.ts +48 -0
package/.beads/issues.jsonl
CHANGED
|
@@ -389,7 +389,7 @@
|
|
|
389
389
|
{"id":"opencode-swarm-plugin-637l","title":"Limit test bead 1","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-08T08:21:27.263293-08:00","updated_at":"2025-12-08T08:21:29.957087-08:00","closed_at":"2025-12-08T08:21:29.957087-08:00"}
|
|
390
390
|
{"id":"opencode-swarm-plugin-64f","title":"Bead to start","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-07T19:39:10.34101-08:00","updated_at":"2025-12-07T19:39:12.089113-08:00","closed_at":"2025-12-07T19:39:12.089113-08:00"}
|
|
391
391
|
{"id":"opencode-swarm-plugin-64sb","title":"Thread link test bead","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-08T07:49:11.252017-08:00","updated_at":"2025-12-08T07:49:12.801335-08:00","closed_at":"2025-12-08T07:49:12.801335-08:00"}
|
|
392
|
-
{"id":"opencode-swarm-plugin-66ni8","title":"README rewrite with full repo context","description":"## Context Captured\n\n### Repo Structure (74k lines total)\n```\nsrc/\n├── index.ts # Plugin entry, exports all tools\n├── plugin.ts # Plugin loader (23 lines)\n├── swarm.ts # Swarm tools aggregator (35 lines)\n│\n├── # SWARM COORDINATION (5k lines)\n├── swarm-orchestrate.ts # 2298 lines - swarm_status, swarm_progress, swarm_complete, swarm_checkpoint, swarm_recover\n├── swarm-decompose.ts # 912 lines - swarm_decompose, swarm_validate_decomposition\n├── swarm-prompts.ts # 828 lines - swarm_spawn_subtask, swarm_subtask_prompt\n├── swarm-strategies.ts # 407 lines - swarm_select_strategy (file/feature/risk/research)\n│\n├── # BEADS (git-backed issues)\n├── beads.ts # beads_create, beads_create_epic, beads_query, beads_update, beads_close, beads_start, beads_ready, beads_sync\n│\n├── # SWARM MAIL (agent coordination)\n├── swarm-mail.ts # 739 lines - swarmmail_init, swarmmail_send, swarmmail_inbox, swarmmail_reserve, swarmmail_release\n├── agent-mail.ts # DEPRECATED MCP-based version\n│\n├── # SKILLS (knowledge packages)\n├── skills.ts # 1533 lines - skills_list, skills_use, skills_read, skills_create, skills_init, skills_update, skills_delete\n│\n├── # STRUCTURED OUTPUT\n├── structured.ts # 755 lines - structured_extract_json, structured_validate, structured_parse_*\n│\n├── # LEARNING SYSTEM\n├── learning.ts # Confidence decay, implicit feedback scoring\n├── pattern-maturity.ts # candidate → established → proven lifecycle\n├── anti-patterns.ts # Auto-inversion of failing patterns\n├── eval-capture.ts # Outcome capture for evals\n│\n├── # STORAGE \u0026 STREAMS (event sourcing)\n├── streams/\n│ ├── index.ts # PGLite database management\n│ ├── store.ts # Append-only event log\n│ ├── events.ts # 15+ event types (agent_registered, message_sent, file_reserved, swarm_checkpointed, etc.)\n│ ├── projections.ts # Materialized views (agents, messages, reservations, eval_records)\n│ ├── migrations.ts # Schema migrations v1-v4\n│ ├── effect/ # Durable primitives (DurableCursor, DurableDeferred, DurableLock, DurableMailbox, ask pattern)\n│ └── debug.ts # Debugging utilities\n│\n├── # OTHER\n├── storage.ts # File-based storage utilities\n├── rate-limiter.ts # Redis/SQLite rate limiting\n├── repo-crawl.ts # GitHub repo analysis tools\n├── output-guardrails.ts # MCP output validation\n├── mandates.ts # Mandate system (deprecated?)\n└── schemas/ # Zod schemas for all data types\n\nglobal-skills/ # Bundled skills\n├── cli-builder/\n├── learning-systems/\n├── skill-creator/\n├── swarm-coordination/\n├── system-design/\n└── testing-patterns/\n\nevals/ # Evalite integration\n├── swarm-decomposition.eval.ts\n├── lib/data-loader.ts # PGLite eval data loader\n└── scorers/ # Outcome-based scorers\n```\n\n### Tool Groups\n- **Swarm**: 12 tools (init, select_strategy, plan_prompt, decompose, validate_decomposition, spawn_subtask, status, progress, complete, record_outcome, checkpoint, recover)\n- **Beads**: 9 tools (create, create_epic, query, update, close, start, ready, sync, link_thread)\n- **Swarm Mail**: 8 tools (init, send, inbox, read_message, reserve, release, ack, health)\n- **Skills**: 7 tools (list, use, read, create, init, update, delete)\n- **Structured**: 5 tools (extract_json, validate, parse_evaluation, parse_decomposition, parse_bead_tree)\n\n### Key Concepts to Explain\n1. **Swarm flow**: task → decomposition → beads → file reservations → parallel agents → learning\n2. **Checkpoint/recovery**: survives context compaction (NEW)\n3. **Learning loop**: outcomes → confidence decay → pattern maturity → anti-pattern inversion\n4. **Event sourcing**: append-only log → materialized views → crash recovery\n5. **Skills**: reusable knowledge packages with references\n\n### v0.21.0 Changelog\n- Swarm recovery context (swarm_checkpoint, swarm_recover, auto-checkpoint at 25/50/75%)\n- Eval data capture (DecompositionGeneratedEvent, SubtaskOutcomeEvent, eval_records table)\n- Outcome-based scorers (fileOverlap, scopeAccuracy, timeBalance, successRate, humanAcceptance)\n- PGLite data loader for Evalite\n- JSONB parsing fix in store.ts/projections.ts","status":"
|
|
392
|
+
{"id":"opencode-swarm-plugin-66ni8","title":"README rewrite with full repo context","description":"## Context Captured\n\n### Repo Structure (74k lines total)\n```\nsrc/\n├── index.ts # Plugin entry, exports all tools\n├── plugin.ts # Plugin loader (23 lines)\n├── swarm.ts # Swarm tools aggregator (35 lines)\n│\n├── # SWARM COORDINATION (5k lines)\n├── swarm-orchestrate.ts # 2298 lines - swarm_status, swarm_progress, swarm_complete, swarm_checkpoint, swarm_recover\n├── swarm-decompose.ts # 912 lines - swarm_decompose, swarm_validate_decomposition\n├── swarm-prompts.ts # 828 lines - swarm_spawn_subtask, swarm_subtask_prompt\n├── swarm-strategies.ts # 407 lines - swarm_select_strategy (file/feature/risk/research)\n│\n├── # BEADS (git-backed issues)\n├── beads.ts # beads_create, beads_create_epic, beads_query, beads_update, beads_close, beads_start, beads_ready, beads_sync\n│\n├── # SWARM MAIL (agent coordination)\n├── swarm-mail.ts # 739 lines - swarmmail_init, swarmmail_send, swarmmail_inbox, swarmmail_reserve, swarmmail_release\n├── agent-mail.ts # DEPRECATED MCP-based version\n│\n├── # SKILLS (knowledge packages)\n├── skills.ts # 1533 lines - skills_list, skills_use, skills_read, skills_create, skills_init, skills_update, skills_delete\n│\n├── # STRUCTURED OUTPUT\n├── structured.ts # 755 lines - structured_extract_json, structured_validate, structured_parse_*\n│\n├── # LEARNING SYSTEM\n├── learning.ts # Confidence decay, implicit feedback scoring\n├── pattern-maturity.ts # candidate → established → proven lifecycle\n├── anti-patterns.ts # Auto-inversion of failing patterns\n├── eval-capture.ts # Outcome capture for evals\n│\n├── # STORAGE \u0026 STREAMS (event sourcing)\n├── streams/\n│ ├── index.ts # PGLite database management\n│ ├── store.ts # Append-only event log\n│ ├── events.ts # 15+ event types (agent_registered, message_sent, file_reserved, swarm_checkpointed, etc.)\n│ ├── projections.ts # Materialized views (agents, messages, reservations, eval_records)\n│ ├── migrations.ts # Schema migrations v1-v4\n│ ├── effect/ # Durable primitives (DurableCursor, DurableDeferred, DurableLock, DurableMailbox, ask pattern)\n│ └── debug.ts # Debugging utilities\n│\n├── # OTHER\n├── storage.ts # File-based storage utilities\n├── rate-limiter.ts # Redis/SQLite rate limiting\n├── repo-crawl.ts # GitHub repo analysis tools\n├── output-guardrails.ts # MCP output validation\n├── mandates.ts # Mandate system (deprecated?)\n└── schemas/ # Zod schemas for all data types\n\nglobal-skills/ # Bundled skills\n├── cli-builder/\n├── learning-systems/\n├── skill-creator/\n├── swarm-coordination/\n├── system-design/\n└── testing-patterns/\n\nevals/ # Evalite integration\n├── swarm-decomposition.eval.ts\n├── lib/data-loader.ts # PGLite eval data loader\n└── scorers/ # Outcome-based scorers\n```\n\n### Tool Groups\n- **Swarm**: 12 tools (init, select_strategy, plan_prompt, decompose, validate_decomposition, spawn_subtask, status, progress, complete, record_outcome, checkpoint, recover)\n- **Beads**: 9 tools (create, create_epic, query, update, close, start, ready, sync, link_thread)\n- **Swarm Mail**: 8 tools (init, send, inbox, read_message, reserve, release, ack, health)\n- **Skills**: 7 tools (list, use, read, create, init, update, delete)\n- **Structured**: 5 tools (extract_json, validate, parse_evaluation, parse_decomposition, parse_bead_tree)\n\n### Key Concepts to Explain\n1. **Swarm flow**: task → decomposition → beads → file reservations → parallel agents → learning\n2. **Checkpoint/recovery**: survives context compaction (NEW)\n3. **Learning loop**: outcomes → confidence decay → pattern maturity → anti-pattern inversion\n4. **Event sourcing**: append-only log → materialized views → crash recovery\n5. **Skills**: reusable knowledge packages with references\n\n### v0.21.0 Changelog\n- Swarm recovery context (swarm_checkpoint, swarm_recover, auto-checkpoint at 25/50/75%)\n- Eval data capture (DecompositionGeneratedEvent, SubtaskOutcomeEvent, eval_records table)\n- Outcome-based scorers (fileOverlap, scopeAccuracy, timeBalance, successRate, humanAcceptance)\n- PGLite data loader for Evalite\n- JSONB parsing fix in store.ts/projections.ts","status":"closed","priority":1,"issue_type":"task","created_at":"2025-12-14T13:40:47.478855-08:00","updated_at":"2025-12-14T14:29:15.955044-08:00","closed_at":"2025-12-14T14:29:15.955044-08:00"}
|
|
393
393
|
{"id":"opencode-swarm-plugin-679z","title":"Integration test epic","description":"Testing epic creation","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-12-08T08:11:40.133137-08:00","updated_at":"2025-12-08T08:11:42.182946-08:00","closed_at":"2025-12-08T08:11:42.182946-08:00"}
|
|
394
394
|
{"id":"opencode-swarm-plugin-679z.1","title":"Subtask 1","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-08T08:11:40.165666-08:00","updated_at":"2025-12-08T08:11:42.205856-08:00","closed_at":"2025-12-08T08:11:42.205856-08:00","dependencies":[{"issue_id":"opencode-swarm-plugin-679z.1","depends_on_id":"opencode-swarm-plugin-679z","type":"parent-child","created_at":"2025-12-08T08:11:40.165959-08:00","created_by":"daemon"}]}
|
|
395
395
|
{"id":"opencode-swarm-plugin-679z.2","title":"Subtask 2","description":"","status":"closed","priority":3,"issue_type":"task","created_at":"2025-12-08T08:11:40.198674-08:00","updated_at":"2025-12-08T08:11:42.232434-08:00","closed_at":"2025-12-08T08:11:42.232434-08:00","dependencies":[{"issue_id":"opencode-swarm-plugin-679z.2","depends_on_id":"opencode-swarm-plugin-679z","type":"parent-child","created_at":"2025-12-08T08:11:40.198981-08:00","created_by":"daemon"}]}
|
|
@@ -492,6 +492,12 @@
|
|
|
492
492
|
{"id":"opencode-swarm-plugin-7vk.5","title":"Write swarm integration tests + update package.json","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-07T19:24:38.92166-08:00","updated_at":"2025-12-07T19:32:59.349281-08:00","closed_at":"2025-12-07T19:32:59.349281-08:00","dependencies":[{"issue_id":"opencode-swarm-plugin-7vk.5","depends_on_id":"opencode-swarm-plugin-7vk","type":"parent-child","created_at":"2025-12-07T19:24:38.921953-08:00","created_by":"daemon"}]}
|
|
493
493
|
{"id":"opencode-swarm-plugin-7w99","title":"Limit test bead 3","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-08T08:56:55.644213-08:00","updated_at":"2025-12-08T08:56:58.099234-08:00","closed_at":"2025-12-08T08:56:58.099234-08:00"}
|
|
494
494
|
{"id":"opencode-swarm-plugin-7we","title":"Query test bead","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-07T19:36:06.436638-08:00","updated_at":"2025-12-07T19:36:08.567688-08:00","closed_at":"2025-12-07T19:36:08.567688-08:00"}
|
|
495
|
+
{"id":"opencode-swarm-plugin-7x3pk","title":"Improve semantic memory usage patterns","description":"Fix test pollution, add auto-capture hooks, update agent prompts, and define clear memory triggers for proactive learning storage. FORCE agents to use semantic-memory and swarm mail at every opportunity.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-12-14T14:34:04.14035-08:00","updated_at":"2025-12-14T14:47:53.151758-08:00","closed_at":"2025-12-14T14:47:53.151758-08:00"}
|
|
496
|
+
{"id":"opencode-swarm-plugin-7x3pk.1","title":"Add test isolation + monitoring/logging for memory operations","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-14T14:34:04.20286-08:00","updated_at":"2025-12-14T14:47:47.479252-08:00","closed_at":"2025-12-14T14:47:47.479252-08:00","dependencies":[{"issue_id":"opencode-swarm-plugin-7x3pk.1","depends_on_id":"opencode-swarm-plugin-7x3pk","type":"parent-child","created_at":"2025-12-14T14:34:04.204815-08:00","created_by":"daemon"}]}
|
|
497
|
+
{"id":"opencode-swarm-plugin-7x3pk.2","title":"Update all integration tests to use isolated collections","description":"✅ Completed: Updated all integration tests to use isolated collections.\n\n**Changes:**\n- learning.integration.test.ts: Added unique collection names with timestamps, added afterEach cleanup\n\n**Verified:**\n- storage.integration.test.ts: Already using isolated collections ✓\n- swarm-mail.integration.test.ts: Already using unique db paths ✓\n- All streams/* tests: Already using unique temp paths ✓\n- rate-limiter.integration.test.ts: Already using unique temp dirs ✓\n\n**Pattern documented in semantic-memory for future reference**","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-14T14:34:04.259594-08:00","updated_at":"2025-12-14T14:47:48.373226-08:00","closed_at":"2025-12-14T14:47:48.373226-08:00","dependencies":[{"issue_id":"opencode-swarm-plugin-7x3pk.2","depends_on_id":"opencode-swarm-plugin-7x3pk","type":"parent-child","created_at":"2025-12-14T14:34:04.260752-08:00","created_by":"daemon"}]}
|
|
498
|
+
{"id":"opencode-swarm-plugin-7x3pk.3","title":"Add automatic memory capture hook in swarm_complete","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-14T14:34:04.319433-08:00","updated_at":"2025-12-14T14:47:49.36759-08:00","closed_at":"2025-12-14T14:47:49.36759-08:00","dependencies":[{"issue_id":"opencode-swarm-plugin-7x3pk.3","depends_on_id":"opencode-swarm-plugin-7x3pk","type":"parent-child","created_at":"2025-12-14T14:34:04.320428-08:00","created_by":"daemon"}]}
|
|
499
|
+
{"id":"opencode-swarm-plugin-7x3pk.4","title":"Define MANDATORY memory triggers and swarm mail usage in AGENTS.md","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-14T14:34:04.379325-08:00","updated_at":"2025-12-14T14:47:50.635175-08:00","closed_at":"2025-12-14T14:47:50.635175-08:00","dependencies":[{"issue_id":"opencode-swarm-plugin-7x3pk.4","depends_on_id":"opencode-swarm-plugin-7x3pk","type":"parent-child","created_at":"2025-12-14T14:34:04.380061-08:00","created_by":"daemon"}]}
|
|
500
|
+
{"id":"opencode-swarm-plugin-7x3pk.5","title":"Audit and clean existing test pollution, document learnings","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-14T14:34:04.439992-08:00","updated_at":"2025-12-14T14:47:52.035028-08:00","closed_at":"2025-12-14T14:47:52.035028-08:00","dependencies":[{"issue_id":"opencode-swarm-plugin-7x3pk.5","depends_on_id":"opencode-swarm-plugin-7x3pk","type":"parent-child","created_at":"2025-12-14T14:34:04.440785-08:00","created_by":"daemon"}]}
|
|
495
501
|
{"id":"opencode-swarm-plugin-7ydd","title":"Thread link test bead","description":"[thread:test-thread-456]","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-08T08:22:18.267166-08:00","updated_at":"2025-12-08T08:22:19.958356-08:00","closed_at":"2025-12-08T08:22:19.958356-08:00"}
|
|
496
502
|
{"id":"opencode-swarm-plugin-7yl8","title":"Query test bead","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-07T19:39:28.959766-08:00","updated_at":"2025-12-07T19:39:31.156979-08:00","closed_at":"2025-12-07T19:39:31.156979-08:00"}
|
|
497
503
|
{"id":"opencode-swarm-plugin-7zvz","title":"Thread link test bead","description":"[thread:test-thread-123]","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-08T11:11:09.755947-08:00","updated_at":"2025-12-08T11:11:11.55818-08:00","closed_at":"2025-12-08T11:11:11.55818-08:00"}
|
|
@@ -700,6 +706,10 @@
|
|
|
700
706
|
{"id":"opencode-swarm-plugin-avh","title":"Single subtask epic","description":"","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-12-07T19:34:53.500492-08:00","updated_at":"2025-12-07T19:34:55.104672-08:00","closed_at":"2025-12-07T19:34:55.104672-08:00"}
|
|
701
707
|
{"id":"opencode-swarm-plugin-aw1tc","title":"Thread link test bead","description":"[thread:test-thread-456]","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-10T09:06:08.228561-08:00","updated_at":"2025-12-10T09:06:10.878323-08:00","closed_at":"2025-12-10T09:06:10.878323-08:00"}
|
|
702
708
|
{"id":"opencode-swarm-plugin-ay6d","title":"Query test bead","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-08T08:14:28.622853-08:00","updated_at":"2025-12-08T08:14:31.015202-08:00","closed_at":"2025-12-08T08:14:31.015202-08:00"}
|
|
709
|
+
{"id":"opencode-swarm-plugin-b0tzg","title":"Fix README + Swarm Mail docs + swarm_complete error handling","description":"1) Update README to reference Agent Mail in inspiration section but clarify our implementation is Swarm Mail with diagrams, 2) Fix swarm_complete silent failures - push errors to swarm mail for coordinator visibility, 3) Document Swarm Mail architecture based on closed PRs","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-12-14T14:41:44.17609-08:00","updated_at":"2025-12-14T14:47:46.049959-08:00","closed_at":"2025-12-14T14:47:46.049959-08:00"}
|
|
710
|
+
{"id":"opencode-swarm-plugin-b0tzg.1","title":"Update README - Agent Mail inspiration vs Swarm Mail implementation","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-14T14:41:44.244997-08:00","updated_at":"2025-12-14T14:47:42.88356-08:00","closed_at":"2025-12-14T14:47:42.88356-08:00","dependencies":[{"issue_id":"opencode-swarm-plugin-b0tzg.1","depends_on_id":"opencode-swarm-plugin-b0tzg","type":"parent-child","created_at":"2025-12-14T14:41:44.246047-08:00","created_by":"daemon"}]}
|
|
711
|
+
{"id":"opencode-swarm-plugin-b0tzg.2","title":"Add error handling to swarm_complete - push failures to swarm mail","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-12-14T14:41:44.302057-08:00","updated_at":"2025-12-14T14:47:43.984532-08:00","closed_at":"2025-12-14T14:47:43.984532-08:00","dependencies":[{"issue_id":"opencode-swarm-plugin-b0tzg.2","depends_on_id":"opencode-swarm-plugin-b0tzg","type":"parent-child","created_at":"2025-12-14T14:41:44.304468-08:00","created_by":"daemon"}]}
|
|
712
|
+
{"id":"opencode-swarm-plugin-b0tzg.3","title":"Document Swarm Mail architecture with diagrams from closed PRs","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-14T14:41:44.364356-08:00","updated_at":"2025-12-14T14:47:45.050125-08:00","closed_at":"2025-12-14T14:47:45.050125-08:00","dependencies":[{"issue_id":"opencode-swarm-plugin-b0tzg.3","depends_on_id":"opencode-swarm-plugin-b0tzg","type":"parent-child","created_at":"2025-12-14T14:41:44.365969-08:00","created_by":"daemon"}]}
|
|
703
713
|
{"id":"opencode-swarm-plugin-b0ydv","title":"Create TDD skill with lore from prime knowledge","description":"Created .opencode/skills/tdd/SKILL.md with RED-GREEN-REFACTOR workflow and lore from Kent Beck, Michael Feathers, Martin Fowler, and Ousterhout's counterpoint.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-12-13T09:12:37.165045-08:00","updated_at":"2025-12-13T09:12:40.904565-08:00","closed_at":"2025-12-13T09:12:40.904565-08:00"}
|
|
704
714
|
{"id":"opencode-swarm-plugin-b1hf","title":"Thread link test bead","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-08T11:11:40.14326-08:00","updated_at":"2025-12-08T11:11:41.771573-08:00","closed_at":"2025-12-08T11:11:41.771573-08:00"}
|
|
705
715
|
{"id":"opencode-swarm-plugin-b1wpc","title":"swarm.ts:1620-1670 - runUbsScan doesn't validate JSON structure","description":"swarm.ts:1620-1670 - runUbsScan parses JSON but doesn't validate with schema. If UBS changes output format, could return malformed data or throw cryptic errors. Suggested fix: Define Zod schema for UBS output and validate.","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-12-10T09:06:33.466723-08:00","updated_at":"2025-12-10T11:56:17.052815-08:00","closed_at":"2025-12-10T11:56:17.052815-08:00"}
|
|
@@ -804,7 +814,7 @@
|
|
|
804
814
|
{"id":"opencode-swarm-plugin-coufp","title":"Query test bead","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-14T13:58:50.06641-08:00","updated_at":"2025-12-14T13:58:54.936028-08:00","closed_at":"2025-12-14T13:58:54.936028-08:00"}
|
|
805
815
|
{"id":"opencode-swarm-plugin-cppl","title":"Update test bead","description":"Updated description","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-08T09:09:31.130656-08:00","updated_at":"2025-12-08T09:09:33.351067-08:00","closed_at":"2025-12-08T09:09:33.351067-08:00"}
|
|
806
816
|
{"id":"opencode-swarm-plugin-crcm","title":"Limit test bead 0","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-08T08:23:17.504179-08:00","updated_at":"2025-12-08T08:23:19.920645-08:00","closed_at":"2025-12-08T08:23:19.920645-08:00"}
|
|
807
|
-
{"id":"opencode-swarm-plugin-cs3wl","title":"Cut release v0.21.0","description":"## Changes for v0.21.0\n\n**Fixed:**\n- Migration tests updated for 4 migrations (was hardcoded to 2)\n- All 230 tests passing\n\n**Features (from bead opencode-swarm-plugin-66ni8):**\n- Swarm recovery context (swarm_checkpoint, swarm_recover, auto-checkpoint at 25/50/75%)\n- Eval data capture (DecompositionGeneratedEvent, SubtaskOutcomeEvent, eval_records table)\n- Outcome-based scorers (fileOverlap, scopeAccuracy, timeBalance, successRate, humanAcceptance)\n- PGLite data loader for Evalite\n- JSONB parsing fix in store.ts/projections.ts\n\n**Steps:**\n1. Commit test fixes\n2. Update package.json version to 0.21.0\n3. Build\n4. Git tag\n5. Push\n6. Publish to npm","status":"
|
|
817
|
+
{"id":"opencode-swarm-plugin-cs3wl","title":"Cut release v0.21.0","description":"## Changes for v0.21.0\n\n**Fixed:**\n- Migration tests updated for 4 migrations (was hardcoded to 2)\n- All 230 tests passing\n\n**Features (from bead opencode-swarm-plugin-66ni8):**\n- Swarm recovery context (swarm_checkpoint, swarm_recover, auto-checkpoint at 25/50/75%)\n- Eval data capture (DecompositionGeneratedEvent, SubtaskOutcomeEvent, eval_records table)\n- Outcome-based scorers (fileOverlap, scopeAccuracy, timeBalance, successRate, humanAcceptance)\n- PGLite data loader for Evalite\n- JSONB parsing fix in store.ts/projections.ts\n\n**Steps:**\n1. Commit test fixes\n2. Update package.json version to 0.21.0\n3. Build\n4. Git tag\n5. Push\n6. Publish to npm","status":"closed","priority":0,"issue_type":"task","created_at":"2025-12-14T14:21:48.794294-08:00","updated_at":"2025-12-14T14:22:50.902471-08:00","closed_at":"2025-12-14T14:22:50.902471-08:00"}
|
|
808
818
|
{"id":"opencode-swarm-plugin-csdh","title":"Ordered subtasks epic","description":"","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-12-08T08:25:10.806508-08:00","updated_at":"2025-12-08T08:25:12.779477-08:00","closed_at":"2025-12-08T08:25:12.779477-08:00"}
|
|
809
819
|
{"id":"opencode-swarm-plugin-csdh.1","title":"First","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-08T08:25:10.846377-08:00","updated_at":"2025-12-08T08:25:12.806068-08:00","closed_at":"2025-12-08T08:25:12.806068-08:00","dependencies":[{"issue_id":"opencode-swarm-plugin-csdh.1","depends_on_id":"opencode-swarm-plugin-csdh","type":"parent-child","created_at":"2025-12-08T08:25:10.846682-08:00","created_by":"daemon"}]}
|
|
810
820
|
{"id":"opencode-swarm-plugin-csdh.2","title":"Second","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-08T08:25:10.881406-08:00","updated_at":"2025-12-08T08:25:12.834953-08:00","closed_at":"2025-12-08T08:25:12.834953-08:00","dependencies":[{"issue_id":"opencode-swarm-plugin-csdh.2","depends_on_id":"opencode-swarm-plugin-csdh","type":"parent-child","created_at":"2025-12-08T08:25:10.881733-08:00","created_by":"daemon"}]}
|
|
@@ -1671,6 +1681,7 @@
|
|
|
1671
1681
|
{"id":"opencode-swarm-plugin-r92p","title":"Limit test bead 4","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-07T19:56:42.769539-08:00","updated_at":"2025-12-07T19:56:44.896509-08:00","closed_at":"2025-12-07T19:56:44.896509-08:00"}
|
|
1672
1682
|
{"id":"opencode-swarm-plugin-r98c","title":"Update test bead","description":"Blocked on dependency","status":"closed","priority":1,"issue_type":"task","created_at":"2025-12-08T08:14:29.141593-08:00","updated_at":"2025-12-08T08:14:31.283727-08:00","closed_at":"2025-12-08T08:14:31.283727-08:00"}
|
|
1673
1683
|
{"id":"opencode-swarm-plugin-ra7e8","title":"Thread link test bead","description":"Important context here\n\n[thread:test-thread-789]","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-08T11:12:42.787654-08:00","updated_at":"2025-12-08T11:12:44.360438-08:00","closed_at":"2025-12-08T11:12:44.360438-08:00"}
|
|
1684
|
+
{"id":"opencode-swarm-plugin-rbaud","title":"Inline Swarm Mail architecture into README","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-14T14:48:15.768044-08:00","updated_at":"2025-12-14T14:49:13.602901-08:00","closed_at":"2025-12-14T14:49:13.602901-08:00"}
|
|
1674
1685
|
{"id":"opencode-swarm-plugin-rbi7","title":"Query test bead","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-08T11:10:52.974317-08:00","updated_at":"2025-12-08T11:10:55.610719-08:00","closed_at":"2025-12-08T11:10:55.610719-08:00"}
|
|
1675
1686
|
{"id":"opencode-swarm-plugin-rcin","title":"High priority ready bead","description":"","status":"closed","priority":0,"issue_type":"task","created_at":"2025-12-08T07:49:10.311118-08:00","updated_at":"2025-12-08T07:49:12.327386-08:00","closed_at":"2025-12-08T07:49:12.327386-08:00"}
|
|
1676
1687
|
{"id":"opencode-swarm-plugin-rclb","title":"Bead to close","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-08T11:11:08.938269-08:00","updated_at":"2025-12-08T11:11:08.963749-08:00","closed_at":"2025-12-08T11:11:08.963749-08:00"}
|
package/README.md
CHANGED
|
@@ -18,9 +18,24 @@
|
|
|
18
18
|
bzzzz...
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## The Problem
|
|
22
22
|
|
|
23
|
-
You
|
|
23
|
+
You're working with an AI coding agent. You ask it to "add OAuth authentication." It starts writing code. Five minutes later, you realize it's going down the wrong path. Or it's touching files it shouldn't. Or it's making changes that conflict with what you just did in another session.
|
|
24
|
+
|
|
25
|
+
**The fundamental issue:** AI agents are single-threaded, context-limited, and have no memory of what worked before.
|
|
26
|
+
|
|
27
|
+
## The Solution
|
|
28
|
+
|
|
29
|
+
What if the agent could:
|
|
30
|
+
|
|
31
|
+
- **Break the task into pieces** that can be worked on simultaneously
|
|
32
|
+
- **Spawn parallel workers** that don't step on each other
|
|
33
|
+
- **Remember what worked** and avoid patterns that failed
|
|
34
|
+
- **Survive context compaction** without losing progress
|
|
35
|
+
|
|
36
|
+
That's what Swarm does.
|
|
37
|
+
|
|
38
|
+
## How It Works
|
|
24
39
|
|
|
25
40
|
```
|
|
26
41
|
"Add OAuth"
|
|
@@ -28,62 +43,85 @@ You give it a task. It breaks it into pieces. It spawns agents to work on each p
|
|
|
28
43
|
▼
|
|
29
44
|
┌────────────────────────┐
|
|
30
45
|
│ COORDINATOR │
|
|
31
|
-
│
|
|
46
|
+
│ │
|
|
47
|
+
│ 1. Query CASS: │
|
|
48
|
+
│ "How did we solve │
|
|
49
|
+
│ this before?" │
|
|
50
|
+
│ │
|
|
51
|
+
│ 2. Pick strategy: │
|
|
52
|
+
│ file-based? │
|
|
53
|
+
│ feature-based? │
|
|
54
|
+
│ risk-based? │
|
|
55
|
+
│ │
|
|
56
|
+
│ 3. Break into pieces │
|
|
32
57
|
└────────────────────────┘
|
|
33
58
|
│
|
|
34
59
|
┌─────────────────────┼─────────────────────┐
|
|
35
60
|
▼ ▼ ▼
|
|
36
61
|
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
37
62
|
│ Worker A │ │ Worker B │ │ Worker C │
|
|
63
|
+
│ │ │ │ │ │
|
|
38
64
|
│ auth/oauth │ │ auth/session│ │ auth/tests │
|
|
39
65
|
│ 🔒 files │ │ 🔒 files │ │ 🔒 files │
|
|
66
|
+
│ │ │ │ │ │
|
|
67
|
+
│ "I need │──────►│ "Got it, │ │ "Running │
|
|
68
|
+
│ session │ │ here's the │ │ tests..." │
|
|
69
|
+
│ types" │ │ interface" │ │ │
|
|
40
70
|
└─────────────┘ └─────────────┘ └─────────────┘
|
|
71
|
+
│ │ │
|
|
41
72
|
│ │ │
|
|
42
73
|
└─────────────────────┼─────────────────────┘
|
|
74
|
+
│
|
|
43
75
|
▼
|
|
44
|
-
|
|
76
|
+
┌────────────────────────┐
|
|
77
|
+
│ LEARNING SYSTEM │
|
|
78
|
+
│ │
|
|
79
|
+
│ "File-based split │
|
|
80
|
+
│ worked well for │
|
|
81
|
+
│ auth - 3 workers, │
|
|
82
|
+
│ 15 min, 0 conflicts" │
|
|
83
|
+
│ │
|
|
84
|
+
│ Next time: use this │
|
|
85
|
+
│ pattern again │
|
|
86
|
+
└────────────────────────┘
|
|
45
87
|
```
|
|
46
88
|
|
|
47
|
-
The
|
|
89
|
+
### The Flow
|
|
48
90
|
|
|
49
|
-
|
|
91
|
+
1. **You give it a task**: `/swarm "Add OAuth authentication"`
|
|
50
92
|
|
|
51
|
-
|
|
52
|
-
npm install -g opencode-swarm-plugin@latest
|
|
53
|
-
swarm setup
|
|
54
|
-
```
|
|
93
|
+
2. **It queries history**: "Have we done something like this before?" (via CASS - cross-agent session search)
|
|
55
94
|
|
|
56
|
-
|
|
95
|
+
3. **It picks a strategy**:
|
|
96
|
+
- **File-based**: "Split by directory structure" (good for refactoring)
|
|
97
|
+
- **Feature-based**: "Split by vertical slices" (good for new features)
|
|
98
|
+
- **Risk-based**: "Tests first, then implementation" (good for bug fixes)
|
|
99
|
+
- **Research-based**: "Explore before committing" (good for unknowns)
|
|
57
100
|
|
|
58
|
-
|
|
59
|
-
/swarm "Add user authentication with OAuth"
|
|
60
|
-
```
|
|
101
|
+
4. **It breaks the work into beads** (git-backed issues):
|
|
61
102
|
|
|
62
|
-
|
|
103
|
+
```
|
|
104
|
+
Epic: Add OAuth
|
|
105
|
+
├─ Bead 1: OAuth provider integration (src/auth/oauth.ts)
|
|
106
|
+
├─ Bead 2: Session management (src/auth/session.ts)
|
|
107
|
+
└─ Bead 3: Integration tests (tests/auth/)
|
|
108
|
+
```
|
|
63
109
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
│ "add feature" ──────► FEATURE-BASED │
|
|
74
|
-
│ "implement X" Vertical slices (data→logic→UI) │
|
|
75
|
-
│ "build new" Keep related components together │
|
|
76
|
-
│ │
|
|
77
|
-
│ "fix bug" ──────► RISK-BASED │
|
|
78
|
-
│ "security issue" Tests FIRST │
|
|
79
|
-
│ "critical" Isolate risky changes │
|
|
80
|
-
│ │
|
|
81
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
82
|
-
```
|
|
110
|
+
5. **It spawns parallel workers**:
|
|
111
|
+
- Each worker reserves its files (no conflicts)
|
|
112
|
+
- Workers coordinate via Swarm Mail (actor-model messaging)
|
|
113
|
+
- Progress is checkpointed at 25%, 50%, 75%
|
|
114
|
+
|
|
115
|
+
6. **It learns from the outcome**:
|
|
116
|
+
- Fast + success = good signal
|
|
117
|
+
- Slow + errors = bad signal
|
|
118
|
+
- Patterns that fail >60% of the time get auto-inverted
|
|
83
119
|
|
|
84
|
-
## What
|
|
120
|
+
## What Makes It Different
|
|
85
121
|
|
|
86
|
-
|
|
122
|
+
### It Survives Context Death
|
|
123
|
+
|
|
124
|
+
OpenCode compacts context when it gets too long. Swarms used to die when this happened. Not anymore.
|
|
87
125
|
|
|
88
126
|
```
|
|
89
127
|
Session 1 Context Session 2
|
|
@@ -97,11 +135,31 @@ Swarms used to die when OpenCode compacted context. Not anymore.
|
|
|
97
135
|
└─────────────────┘ └─────────────────┘
|
|
98
136
|
```
|
|
99
137
|
|
|
100
|
-
|
|
138
|
+
**Checkpoints capture:**
|
|
139
|
+
|
|
140
|
+
- Which subtasks are done/in-progress/pending
|
|
141
|
+
- File reservations (who owns what)
|
|
142
|
+
- Shared context for workers
|
|
143
|
+
- Progress percentage
|
|
144
|
+
|
|
145
|
+
**Recovery restores:**
|
|
146
|
+
|
|
147
|
+
- Swarm state from last checkpoint
|
|
148
|
+
- File locks (prevents conflicts)
|
|
149
|
+
- Worker context (what they were doing)
|
|
150
|
+
|
|
151
|
+
All stored in PGLite (embedded Postgres) - no external servers, survives across sessions.
|
|
152
|
+
|
|
153
|
+
### It Learns From Outcomes
|
|
101
154
|
|
|
102
|
-
|
|
155
|
+
Every swarm completion records:
|
|
103
156
|
|
|
104
|
-
|
|
157
|
+
- Duration (how long did it take?)
|
|
158
|
+
- Errors (how many retries?)
|
|
159
|
+
- Files touched (did scope match prediction?)
|
|
160
|
+
- Success (did tests pass? were changes accepted?)
|
|
161
|
+
|
|
162
|
+
This feeds back into the decomposition strategy:
|
|
105
163
|
|
|
106
164
|
```
|
|
107
165
|
┌─────────────────────────────────┐
|
|
@@ -126,18 +184,188 @@ The plugin tracks outcomes and adjusts over time:
|
|
|
126
184
|
unless patterns are revalidated
|
|
127
185
|
```
|
|
128
186
|
|
|
129
|
-
|
|
187
|
+
**Pattern maturity lifecycle:**
|
|
188
|
+
|
|
189
|
+
- `candidate` → new pattern, low confidence
|
|
190
|
+
- `established` → validated 3+ times
|
|
191
|
+
- `proven` → 10+ successes (gets 1.5x weight in future decompositions)
|
|
192
|
+
- `deprecated` → >60% failure rate (auto-inverted to anti-pattern)
|
|
193
|
+
|
|
194
|
+
**Confidence decay:** Patterns fade over 90 days unless revalidated. Prevents stale knowledge from dominating.
|
|
195
|
+
|
|
196
|
+
### Swarm Mail: Actor-Model Coordination
|
|
197
|
+
|
|
198
|
+
Workers don't just run in parallel - they coordinate via **Swarm Mail**, an event-sourced actor model built on local-first primitives.
|
|
199
|
+
|
|
200
|
+
**What makes Swarm Mail different from traditional agent messaging:**
|
|
201
|
+
|
|
202
|
+
- **Actor model over durable streams** - DurableMailbox, DurableLock, DurableDeferred (inspired by Electric SQL patterns)
|
|
203
|
+
- **Local-first with PGlite** - embedded Postgres, no external servers, survives across sessions
|
|
204
|
+
- **Event-sourced coordination** - append-only log, materialized views, full audit trail
|
|
205
|
+
- **Context-safe by design** - hard caps on inbox (max 5 messages), thread summarization, body-on-demand
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
209
|
+
│ SWARM MAIL │
|
|
210
|
+
│ │
|
|
211
|
+
│ Worker A: "I need the SessionUser type" │
|
|
212
|
+
│ ↓ │
|
|
213
|
+
│ Worker B: "Here's the interface:" │
|
|
214
|
+
│ interface SessionUser { │
|
|
215
|
+
│ id: string │
|
|
216
|
+
│ email: string │
|
|
217
|
+
│ roles: string[] │
|
|
218
|
+
│ } │
|
|
219
|
+
│ ↓ │
|
|
220
|
+
│ Worker A: "Got it, implementing OAuth flow now" │
|
|
221
|
+
│ │
|
|
222
|
+
└──────────────────────────────────────────────────────────────┘
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**File reservations** prevent conflicts:
|
|
226
|
+
|
|
227
|
+
- Worker A reserves `src/auth/oauth.ts` (exclusive via DurableLock)
|
|
228
|
+
- Worker B tries to reserve it → blocked
|
|
229
|
+
- Worker B waits or works on something else
|
|
230
|
+
|
|
231
|
+
**Inbox limits** prevent context bloat:
|
|
232
|
+
|
|
233
|
+
- Max 5 messages per fetch (headers only)
|
|
234
|
+
- Read individual message bodies on demand
|
|
235
|
+
- Thread summarization for long conversations
|
|
236
|
+
|
|
237
|
+
All coordination state survives context compaction and session restarts.
|
|
238
|
+
|
|
239
|
+
#### Architecture: 3-Tier Stack
|
|
240
|
+
|
|
241
|
+
Swarm Mail is built on **Durable Streams primitives** (inspired by Kyle Matthews' [Electric SQL patterns](https://x.com/kylemathews/status/1999896667030700098)):
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
245
|
+
│ SWARM MAIL STACK │
|
|
246
|
+
├─────────────────────────────────────────────────────────────┤
|
|
247
|
+
│ │
|
|
248
|
+
│ TIER 3: COORDINATION │
|
|
249
|
+
│ ┌───────────────────────────────────────────────────────┐ │
|
|
250
|
+
│ │ ask<Req, Res>() - Request/Response (RPC-style) │ │
|
|
251
|
+
│ └───────────────────────────────────────────────────────┘ │
|
|
252
|
+
│ │ │
|
|
253
|
+
│ TIER 2: PATTERNS ▼ │
|
|
254
|
+
│ ┌─────────────────┐ ┌─────────────────┐ │
|
|
255
|
+
│ │ DurableMailbox │ │ DurableLock │ │
|
|
256
|
+
│ │ Actor Inbox │ │ File Mutex │ │
|
|
257
|
+
│ └─────────────────┘ └─────────────────┘ │
|
|
258
|
+
│ │ │ │
|
|
259
|
+
│ TIER 1: PRIMITIVES ▼ │
|
|
260
|
+
│ ┌─────────────────┐ ┌─────────────────┐ │
|
|
261
|
+
│ │ DurableCursor │ │ DurableDeferred │ │
|
|
262
|
+
│ │ Checkpointed │ │ Distributed │ │
|
|
263
|
+
│ │ Reader │ │ Promise │ │
|
|
264
|
+
│ └─────────────────┘ └─────────────────┘ │
|
|
265
|
+
│ │ │
|
|
266
|
+
│ STORAGE ▼ │
|
|
267
|
+
│ ┌───────────────────────────────────────────────────────┐ │
|
|
268
|
+
│ │ PGLite (Embedded Postgres) + Migrations │ │
|
|
269
|
+
│ └───────────────────────────────────────────────────────┘ │
|
|
270
|
+
│ │
|
|
271
|
+
└─────────────────────────────────────────────────────────────┘
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
**Tier 1 - Primitives:**
|
|
275
|
+
|
|
276
|
+
- **DurableCursor** - Positioned event stream consumption with checkpointing (exactly-once)
|
|
277
|
+
- **DurableDeferred** - URL-addressable distributed promises for async coordination
|
|
278
|
+
- **DurableLock** - CAS-based mutual exclusion for file reservations (TTL + retry/backoff)
|
|
279
|
+
|
|
280
|
+
**Tier 2 - Patterns:**
|
|
281
|
+
|
|
282
|
+
- **DurableMailbox** - Actor inbox with typed envelopes (sender, replyTo, payload)
|
|
283
|
+
- File reservation protocol built on DurableLock
|
|
284
|
+
|
|
285
|
+
**Tier 3 - Coordination:**
|
|
286
|
+
|
|
287
|
+
- **ask()** pattern - Synchronous-style RPC over async streams (creates DurableDeferred, appends to mailbox, returns promise)
|
|
288
|
+
|
|
289
|
+
#### Message Flow Example
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
Agent A Event Stream Agent B
|
|
293
|
+
│ │ │
|
|
294
|
+
│ ask("get SessionUser") │ │
|
|
295
|
+
├───────────────────────────>│ │
|
|
296
|
+
│ (creates deferred) │ │
|
|
297
|
+
│ │ consume event │
|
|
298
|
+
│ ├────────────────────────>│
|
|
299
|
+
│ │ │
|
|
300
|
+
│ │ reply to deferred │
|
|
301
|
+
│ │<────────────────────────┤
|
|
302
|
+
│ await deferred.value │ │
|
|
303
|
+
│<───────────────────────────┤ │
|
|
304
|
+
│ │ │
|
|
305
|
+
│ SessionUser interface │ │
|
|
306
|
+
│ │ │
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
**Why this matters:**
|
|
310
|
+
|
|
311
|
+
- No external servers (Redis, Kafka, NATS) - just PGlite
|
|
312
|
+
- Full audit trail - every message is an event
|
|
313
|
+
- Resumable - cursors checkpoint position, survive crashes
|
|
314
|
+
- Type-safe - Effect-TS with full inference
|
|
315
|
+
|
|
316
|
+
> **Architecture deep-dive:** See [Swarm Mail Architecture](docs/swarm-mail-architecture.md) for complete implementation details, database schemas, and Effect-TS patterns.
|
|
317
|
+
|
|
318
|
+
### It Has Skills
|
|
130
319
|
|
|
131
320
|
Skills are knowledge packages agents can load. Teach once, use everywhere.
|
|
132
321
|
|
|
322
|
+
```typescript
|
|
323
|
+
skills_use((name = "testing-patterns")); // Load Feathers seams + Beck's 4 rules
|
|
324
|
+
skills_use((name = "swarm-coordination")); // Load swarm workflow patterns
|
|
133
325
|
```
|
|
134
|
-
|
|
135
|
-
|
|
326
|
+
|
|
327
|
+
**Bundled skills:**
|
|
328
|
+
|
|
329
|
+
- `testing-patterns` - 25 dependency-breaking techniques, characterization tests
|
|
330
|
+
- `swarm-coordination` - Multi-agent decomposition, file reservations
|
|
331
|
+
- `cli-builder` - Argument parsing, help text, subcommands
|
|
332
|
+
- `system-design` - Architecture decisions, module boundaries
|
|
333
|
+
- `learning-systems` - Confidence decay, pattern maturity
|
|
334
|
+
|
|
335
|
+
**Create your own:**
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
swarm init # Creates .opencode/skills/ in project
|
|
136
339
|
```
|
|
137
340
|
|
|
138
|
-
|
|
341
|
+
Skills can include:
|
|
342
|
+
|
|
343
|
+
- Step-by-step workflows
|
|
344
|
+
- Code examples
|
|
345
|
+
- Reference documentation
|
|
346
|
+
- Executable scripts
|
|
139
347
|
|
|
140
|
-
|
|
348
|
+
## Install
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
npm install -g opencode-swarm-plugin@latest
|
|
352
|
+
swarm setup
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
## Usage
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
/swarm "Add user authentication with OAuth"
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
The coordinator will:
|
|
362
|
+
|
|
363
|
+
1. Query CASS for similar past tasks
|
|
364
|
+
2. Select decomposition strategy
|
|
365
|
+
3. Break into subtasks (beads)
|
|
366
|
+
4. Spawn parallel workers
|
|
367
|
+
5. Track progress with checkpoints
|
|
368
|
+
6. Record outcome for learning
|
|
141
369
|
|
|
142
370
|
## Architecture
|
|
143
371
|
|
|
@@ -151,29 +379,64 @@ Everything runs in-process. No external servers.
|
|
|
151
379
|
▼
|
|
152
380
|
┌─────────────────────────────────────────────────────────────────┐
|
|
153
381
|
│ DECOMPOSITION strategy selection, subtask creation │
|
|
382
|
+
│ (queries CASS, semantic memory) │
|
|
154
383
|
└─────────────────────────────────────────────────────────────────┘
|
|
155
384
|
│
|
|
156
385
|
▼
|
|
157
386
|
┌─────────────────────────────────────────────────────────────────┐
|
|
158
387
|
│ BEADS git-backed issues for each subtask │
|
|
388
|
+
│ (atomic epic + subtasks creation) │
|
|
159
389
|
└─────────────────────────────────────────────────────────────────┘
|
|
160
390
|
│
|
|
161
391
|
▼
|
|
162
392
|
┌─────────────────────────────────────────────────────────────────┐
|
|
163
|
-
│ SWARM MAIL
|
|
393
|
+
│ SWARM MAIL actor-model coordination (local-first) │
|
|
394
|
+
│ (DurableMailbox, DurableLock, PGlite) │
|
|
164
395
|
└─────────────────────────────────────────────────────────────────┘
|
|
165
396
|
│
|
|
166
397
|
▼
|
|
167
398
|
┌─────────────────────────────────────────────────────────────────┐
|
|
168
399
|
│ PGLITE embedded postgres, event-sourced state │
|
|
400
|
+
│ (append-only log, materialized views) │
|
|
169
401
|
└─────────────────────────────────────────────────────────────────┘
|
|
170
402
|
│
|
|
171
403
|
▼
|
|
172
404
|
┌─────────────────────────────────────────────────────────────────┐
|
|
173
405
|
│ LEARNING outcomes feed back into decomposition │
|
|
406
|
+
│ (confidence decay, pattern maturity) │
|
|
174
407
|
└─────────────────────────────────────────────────────────────────┘
|
|
175
408
|
```
|
|
176
409
|
|
|
410
|
+
### Event Sourcing
|
|
411
|
+
|
|
412
|
+
All state is stored as an append-only event log:
|
|
413
|
+
|
|
414
|
+
```
|
|
415
|
+
Event Log (PGLite)
|
|
416
|
+
├─ agent_registered → Agent joins swarm
|
|
417
|
+
├─ message_sent → Agent-to-agent communication
|
|
418
|
+
├─ file_reserved → Exclusive file lock acquired
|
|
419
|
+
├─ file_released → Lock released
|
|
420
|
+
├─ swarm_checkpointed → Progress snapshot saved
|
|
421
|
+
├─ decomposition_generated → Task broken into subtasks
|
|
422
|
+
└─ subtask_outcome → Worker completion result
|
|
423
|
+
|
|
424
|
+
Materialized Views (derived from events)
|
|
425
|
+
├─ agents → Active agents per project
|
|
426
|
+
├─ messages → Agent inbox/outbox
|
|
427
|
+
├─ file_reservations → Current file locks
|
|
428
|
+
└─ eval_records → Outcome data for learning
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
**Why event sourcing?**
|
|
432
|
+
|
|
433
|
+
- **Audit trail** - full history of what happened
|
|
434
|
+
- **Replay** - reconstruct state from events
|
|
435
|
+
- **Debugging** - see exactly what went wrong
|
|
436
|
+
- **Learning** - analyze outcomes over time
|
|
437
|
+
|
|
438
|
+
See the [Swarm Mail Architecture](docs/swarm-mail-architecture.md) section above for details on the durable primitives (DurableCursor, DurableDeferred, DurableLock, DurableMailbox) and how they enable exactly-once processing, request/response patterns, and actor coordination.
|
|
439
|
+
|
|
177
440
|
## Dependencies
|
|
178
441
|
|
|
179
442
|
| Required | Optional |
|
|
@@ -186,7 +449,7 @@ Run `swarm doctor` to check status.
|
|
|
186
449
|
|
|
187
450
|
## CLI
|
|
188
451
|
|
|
189
|
-
```
|
|
452
|
+
```bash
|
|
190
453
|
swarm setup # Install and configure
|
|
191
454
|
swarm doctor # Check dependencies
|
|
192
455
|
swarm init # Initialize beads in project
|
|
@@ -197,17 +460,19 @@ swarm config # Show config file paths
|
|
|
197
460
|
|
|
198
461
|
```bash
|
|
199
462
|
bun install
|
|
200
|
-
bun test
|
|
463
|
+
bun test # Unit tests (230 tests)
|
|
464
|
+
bun run test:integration # Integration tests
|
|
201
465
|
bun run build
|
|
202
466
|
```
|
|
203
467
|
|
|
204
468
|
## Credits
|
|
205
469
|
|
|
206
|
-
|
|
470
|
+
**Inspiration & Core Ideas:**
|
|
207
471
|
|
|
208
|
-
- [MCP Agent Mail](https://github.com/Dicklesworthstone/mcp_agent_mail) - multi-agent coordination
|
|
209
|
-
- [Superpowers](https://github.com/obra/superpowers) - verification patterns
|
|
210
|
-
- [Electric SQL](https://electric-sql.com) - durable streams and event sourcing
|
|
472
|
+
- [MCP Agent Mail](https://github.com/Dicklesworthstone/mcp_agent_mail) - **THE INSPIRATION** for multi-agent coordination. Swarm Mail is our implementation built on actor-model primitives (DurableMailbox, DurableLock) with local-first PGlite and event sourcing.
|
|
473
|
+
- [Superpowers](https://github.com/obra/superpowers) - verification patterns, Socratic planning, skill architecture
|
|
474
|
+
- [Electric SQL](https://electric-sql.com) - durable streams and event sourcing patterns that power Swarm Mail
|
|
475
|
+
- [Evalite](https://evalite.dev) - outcome-based evaluation framework for learning systems
|
|
211
476
|
|
|
212
477
|
## License
|
|
213
478
|
|