Skip to content

opencode-swarm-plugin@0.45.0

Choose a tag to compare

@github-actions github-actions released this 28 Dec 00:40
· 268 commits to main since this release
4e719f2

Minor Changes

  • f9fd732 Thanks @joelhooks! - ## Swarm Signature Detection: Events as Source of Truth

    "Applications that use event sourcing need to take the log of events and transform it into
    application state that is suitable for showing to a user."
    — Martin Kleppmann, Designing Data-Intensive Applications

                        SESSION EVENTS                    HIVE (projection)
                        ═══════════════                   ═════════════════
    
        ┌─────────────────────────────────┐              ┌─────────────────┐
        │ hive_create_epic(...)           │──────────────│ epic: open      │
        │ swarm_spawn_subtask(bd-123.1)   │              │ bd-123.1: open  │
        │ swarm_spawn_subtask(bd-123.2)   │              │ bd-123.2: open  │
        │ swarm_complete(bd-123.1)        │──────────────│ bd-123.1: closed│
        │ swarm_complete(bd-123.2)        │──────────────│ bd-123.2: closed│
        │ hive_close(epic)                │──────────────│ epic: closed    │
        └─────────────────────────────────┘              └─────────────────┘
                  ↑                                               ↑
             SOURCE OF TRUTH                              STALE PROJECTION
             (immutable log)                              (all cells closed)
    
        ┌──────────────────────────────────────────────────────────────────┐
        │  COMPACTION TRIGGERS HERE                                        │
        │  ════════════════════════                                        │
        │                                                                  │
        │  Old approach: Query hive → "0 open epics" → "No cells found"   │
        │  New approach: Fold events → "Epic with 2 subtasks, completed"  │
        └──────────────────────────────────────────────────────────────────┘
    

    The Problem:

    Compaction was detecting swarms (106 high-confidence tool calls) but finding no active epics.
    Why? By the time compaction triggers, all cells are already closed in hive. The LLM was
    generating useless continuation prompts because it queried the stale projection instead of
    projecting from the event log.

    The Fix:

    New swarm-signature.ts module with deterministic, algorithmic swarm detection:

    // A SWARM is defined by this event sequence (no heuristics):
    // 1. hive_create_epic(epic_title, subtasks[]) → epic_id
    // 2. swarm_spawn_subtask(bead_id, epic_id, ...) → prompt (at least one)
    
    // Pure fold over events produces ground truth state
    const projection = projectSwarmState(sessionEvents);
    
    // projection.epics: Map<epicId, { title, subtaskIds, status }>
    // projection.subtasks: Map<subtaskId, { epicId, status, agent, files }>
    // projection.spawned: Set<subtaskId>  // Actually spawned to workers
    // projection.completed: Set<subtaskId>  // Finished via swarm_complete

    Key Functions:

    Function Purpose
    projectSwarmState() Fold over events → SwarmProjection
    hasSwarmSignature() Quick check: epic + spawn present?
    isSwarmActive() Any pending work?
    getSwarmSummary() Human-readable status for prompts

    Integration:

    scanSessionMessages() now returns projection alongside tool call stats. The compaction
    hook uses projection as PRIMARY source, hive_query as fallback. Logs show source: "projection"
    vs source: "hive_query" for debugging.

    Why This Matters:

    Coordinators waking up after compaction now get accurate state:

    • "Epic 'Add Auth' with 3/5 subtasks complete, 2 pending"
    • Instead of: "No cells found"

    The session event log is the source of truth. Hive is just a convenient projection that
    can become stale. Now we project from events when it matters.

Patch Changes

  • #86 156386a Thanks @sm0ol! - ## 🐝 Fix Missing Plugin Wrapper Template in Published Package

    Fixed swarm setup failing with "Could not read plugin template" by adding missing directories to npm publish files.

    Problem: The examples/ and global-skills/ directories weren't included in package.json files array, causing them to be excluded from npm publish. When users ran swarm setup, it couldn't find the plugin wrapper template and fell back to a minimal version.

    Solution: Added examples and global-skills to the files array in package.json so they're included in published packages.

    What changed:

    • examples/plugin-wrapper-template.ts now available in installed packages
    • global-skills/ directory properly included for bundled skills
    • swarm setup can read full template instead of falling back

    Before: "Could not read plugin template from [path], using minimal wrapper"
    After: Full plugin wrapper with all tools and proper OpenCode integration

    No breaking changes - existing minimal wrappers continue working.

  • fb4b2d5 Thanks @joelhooks! - ## 🔍 hive_cells Now Returns All Matches for Partial IDs

    "Tune and test your metadata by comparing it with the tone, coverage, and trends of your searchers' common queries."
    — Search Analytics for Your Site

    Previously, hive_cells({ id: "mjonid" }) would throw an "Ambiguous ID" error when multiple cells matched. This was hostile UX for a query tool — users expect to see all matches, not be forced to guess more characters.

         ┌──────────────────────────────────────┐
         │  BEFORE: "Ambiguous ID" error 💀     │
         │                                      │
         │  > hive_cells({ id: "mjonid" })      │
         │  Error: multiple cells match         │
         │                                      │
         ├──────────────────────────────────────┤
         │  AFTER: Returns all matches 🎯       │
         │                                      │
         │  > hive_cells({ id: "mjonid" })      │
         │  [                                   │
         │    { id: "...-mjonidihuyq", ... },   │
         │    { id: "...-mjonidimchs", ... },   │
         │    { id: "...-mjonidioq28", ... },   │
         │    ...13 cells total                 │
         │  ]                                   │
         └──────────────────────────────────────┘
    

    What changed:

    • Added findCellsByPartialId() — returns Cell[] instead of throwing
    • hive_cells now uses this for partial ID lookups
    • resolvePartialId() still throws for tools that need exactly one cell (hive_update, hive_close, etc.)

    Why it matters:

    • Query tools should return results, not errors
    • Partial ID search is now actually useful for exploration
    • Consistent with how grep and other search tools behave
  • ef21ee0 Thanks @joelhooks! - ## 🐝 Memory System Polish: The Hive Remembers

    "Our approach draws inspiration from the Zettelkasten method, a sophisticated
    knowledge management system that creates interconnected information networks
    through atomic notes and flexible linking."

    — A-MEM: Agentic Memory for LLM Agents

                        .-.
                       (o o)  "Should I ADD, UPDATE, or NOOP?"
                       | O |
                       /   \        ___
                      /     \    .-'   '-.
            _____    /       \  /  .-=-.  \    _____
           /     \  |  ^   ^  ||  /     \  |  /     \
          | () () | |  (o o)  || | () () | | | () () |
           \_____/  |    <    ||  \_____/  |  \_____/
              |      \  ===  /  \    |    /      |
             _|_      '-----'    '--|--'       _|_
            /   \                   |         /   \
           | mem |<----related---->|mem|<--->| mem |
            \___/                   |         \___/
                                supersedes
                                    |
                                 ___|___
                                /       \
                               | mem-old |
                                \_______/
                                    †
    

    What Changed

    swarm-mail:

    • README overhaul - Documented Wave 1-3 memory features with code examples
    • Test fixes - test.skip() → test.skipIf(!hasWorkingLLM) for graceful CI/local behavior
    • Replaced outdated pgvector references with libSQL vec extension

    opencode-swarm-plugin:

    • ADR: Memory System Eval Strategy - 3-tier approach (heuristics/integration/LLM-as-judge)
    • smart-operations.eval.ts - Evalite test suite for ADD/UPDATE/DELETE/NOOP decisions
    • Fixtures covering 8 test scenarios (exact match, refinement, contradiction, new info)
    • LLM-as-judge scorer with graceful degradation

    The Philosophy

    "As the system processes more memories over time, it develops increasingly
    sophisticated knowledge structures, discovering higher-order patterns and
    concepts across multiple memories."

    — A-MEM

    The memory system isn't just storage—it's a living knowledge graph that evolves.

    Run the Eval

    bun run eval:smart-operations
  • Updated dependencies [fb4b2d5, ca12bd6, ef21ee0]:

    • swarm-mail@1.6.1