npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@guyghost/swarm-dao-opencode-adapter

v0.1.4

Published

Swarm DAO governance adapter for OpenCode — multi-agent deliberation, quality gates, and structured decision-making

Readme

@guyghost/swarm-dao-opencode-adapter

Swarm DAO governance adapter for OpenCode — bring multi-agent deliberation, quality gates, and structured decision-making to your coding workflow.

Overview

This adapter bridges the Swarm DAO core governance engine to the OpenCode platform via the @opencode-ai/plugin API. It registers 16 DAO tools that OpenCode agents can invoke directly, enabling structured proposal creation, multi-agent deliberation, quality control gates, and execution tracking — all from within the OpenCode environment.

Swarm DAO implements a 4-layer governance model:

| Layer | Purpose | Tools | |-------|---------|-------| | L1 Governance | Decide what enters the roadmap | dao_setup, dao_propose, dao_propose_amendment | | L2 Intelligence | Produce analysis and recommendations | dao_record_outputs, dao_roundtable | | L3 Delivery | Convert decisions into execution | dao_execute, dao_plan, dao_artefacts, dao_dry_run, dao_rollback | | L4 Control | Reduce risk before publication | dao_control, dao_audit, dao_dashboard | | Utility | Inspect DAO state | dao_help, dao_list, dao_agents |

Installation

Prerequisites

Install the package

bun add @guyghost/swarm-dao-opencode-adapter

Register in your OpenCode config

Add the plugin to your opencode.json (or opencode.jsonc):

{
  "plugin": [
    ["@guyghost/swarm-dao-opencode-adapter", {}]
  ]
}

Or register it without options:

{
  "plugin": [
    "@guyghost/swarm-dao-opencode-adapter"
  ]
}

The plugin initializes automatically when OpenCode starts. DAO state is persisted in a .dao/ directory within your project root.

Usage

1. Initialize the DAO

> dao_setup
> dao_help

Creates the DAO with 7 default product agents:

| Agent | Weight | Role | |-------|--------|------| | Product Strategist | 3 | Vision, objectives, hypotheses | | Research Agent | 2 | Market, competition, user signals | | Solution Architect | 3 | Technical options, tradeoffs | | Critic / Risk Agent | 3 | Risk scoring, objections, guardrails | | Prioritization Agent | 2 | Impact/cost/risk scoring, roadmap fit | | Spec Writer | 1 | PRD, user stories, acceptance criteria | | Delivery Agent | 1 | Implementation plan, tasks, CI/CD |

2. Create a Proposal

> dao_propose title="Add dark mode" type="product-feature" description="Implement dark theme for the application"

Supported proposal types:

| Type | Description | |------|-------------| | product-feature | New user-facing feature | | technical-change | Refactoring, architecture, tooling | | security-change | Security-related modifications | | governance-change | DAO configuration or agent changes | | bug-fix | Bug fix with impact analysis | | experiment | Time-boxed experiment with success criteria |

Optional fields for richer proposals:

  • context — Additional context for reviewers
  • problemStatement — What problem does this solve?
  • acceptanceCriteria — List of acceptance criteria
  • successMetrics — How to measure success
  • rollbackConditions — When to rollback
  • affectedPaths — File paths authorized for editing

3. Deliberate (Record Agent Outputs)

OpenCode doesn't support automatic agent spawning. Use dao_record_outputs to submit outputs collected manually from sub-agents:

> dao_record_outputs proposalId=1 outputs='[
  { "agentId": "product-strategist", "content": "High impact...", "durationMs": 1200, "error": null },
  { "agentId": "critic", "content": "VOTE: FOR — Low risk...", "durationMs": 800, "error": null }
]'

Agents can cast votes by including VOTE: FOR|AGAINST in their output text. The system tallies votes, calculates composite scores, and generates a synthesis automatically.

4. Run Quality Control

> dao_control proposalId=1

Runs quality gates: risk assessment, scope validation, and readiness checks. Proposals must pass all gates before execution.

5. Preview (Dry Run)

> dao_dry_run proposalId=1

Previews the execution plan without applying changes.

6. Execute

> dao_execute proposalId=1

Executes an approved proposal. Requires the proposal to have passed through approved or controlled status.

7. Review and Monitor

> dao_list              # List all proposals
> dao_agents            # List registered agents
> dao_plan proposalId=1 # View delivery plan
> dao_artefacts proposalId=1  # View auto-generated artefacts
> dao_dashboard         # Full governance dashboard
> dao_audit             # Full audit trail
> dao_audit proposalId=1      # Proposal-specific audit trail

8. Round Table

> dao_roundtable

Asks every agent to suggest a proposal idea. Because OpenCode doesn't support automatic agent spawning, the round table uses the host adapter's dispatch mechanism. Any successfully parsed suggestions are automatically promoted to proposals.

9. Rollback

> dao_rollback proposalId=1

Reverts a proposal execution to its pre-execution snapshot (if available).

10. Amendments

> dao_propose_amendment title="Increase critic weight" description="Give the critic more influence" amendmentType="agent-update" agentId="critic" agentChanges='{"weight": 5}'

Supported amendment types:

| Type | Required Fields | |------|----------------| | agent-update | agentId, agentChanges (JSON) | | agent-add | newAgentId, newAgentName, newAgentRole, newAgentWeight | | agent-remove | agentId | | config-update | configChanges (JSON) | | quorum-update | quorumChanges (JSON) | | gate-update | addGates, removeGates |

Configuration

Per-project configuration in .dao/config.json:

{
  "mode": "suggest",
  "criticalPaths": [
    "src/auth/**",
    "src/payment/**",
    ".env*"
  ],
  "agentOverrides": {
    "researcher": { "enabled": false },
    "critic": { "weight": 5 }
  }
}

Modes:

  • opt-in (default) — Tools available but never auto-invoked
  • suggest — Nudges assistant to consider DAO proposal for trigger keywords
  • enforce — Blocks edits on critical paths without approved proposal

Architecture

┌─────────────────────────────────────────────────────────────┐
│                      OpenCode Host                           │
│  ┌───────────────────────────────────────────────────────┐  │
│  │              @opencode-ai/plugin API                   │  │
│  │   PluginInput → Plugin → Hooks { tool, ... }          │  │
│  └───────────────────────────┬───────────────────────────┘  │
│                              │                               │
│  ┌───────────────────────────┴───────────────────────────┐  │
│  │        OpenCode Adapter (this package)                 │  │
│  │   OpenCodeDAO plugin • 15 tools • HostAdapter impl     │  │
│  └───────────────────────────┬───────────────────────────┘  │
│                              │                               │
│  ┌───────────────────────────┴───────────────────────────┐  │
│  │             @guyghost/swarm-dao-core                   │  │
│  │  ┌──────────┐ ┌────────────┐ ┌──────────┐ ┌────────┐ │  │
│  │  │Governance│ │Intelligence│ │ Delivery │ │Control │ │  │
│  │  │  (L1)    │ │   (L2)     │ │  (L3)    │ │ (L4)   │ │  │
│  │  └──────────┘ └────────────┘ └──────────┘ └────────┘ │  │
│  └───────────────────────────────────────────────────────┘  │
│                              │                               │
│  ┌───────────────────────────┴───────────────────────────┐  │
│  │              Persistence (.dao/ local files)           │  │
│  └───────────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────┘

Tool Reference

| Tool | Description | |------|-------------| | dao_setup | Initialize the DAO with 7 default product agents | | dao_help | Show onboarding and recommended workflow | | dao_propose | Create a new governance proposal | | dao_record_outputs | Record sub-agent outputs and finalize deliberation | | dao_control | Run quality control gates on an approved proposal | | dao_execute | Execute an approved or controlled proposal | | dao_list | List all DAO proposals | | dao_agents | List all registered DAO agents | | dao_plan | View the delivery plan for a proposal | | dao_artefacts | View auto-generated artefacts (ADR, PRD, test plan, etc.) | | dao_dry_run | Preview execution without applying changes | | dao_rollback | Revert a proposal execution to pre-execution state | | dao_dashboard | View the governance outcome dashboard with health score | | dao_roundtable | Ask every agent to suggest a proposal idea | | dao_audit | View the full audit trail or per-proposal trail | | dao_propose_amendment | Propose a change to DAO agents, config, or gates |

Proposal Lifecycle

open ──► deliberating ──► approved ──► controlled ──► executed
                       ╲              ╲              ╲
                     rejected       rejected        failed

Limitations

  • No automatic agent spawning — OpenCode doesn't provide an API for spawning sub-agents. Use dao_record_outputs to manually submit outputs from sub-agent conversations.
  • Single-process — All deliberation happens within the OpenCode plugin process. For large-scale parallel agent work, consider the CLI.

Related Packages

| Package | Description | |---------|-------------| | @guyghost/swarm-dao-core | Pure business logic (~3000 lines) | | @guyghost/swarm-dao-opencode-adapter | Bridge to OpenCode (this package) | | @guyghost/swarm-dao-cli | Standalone CLI (swarm-dao) |

License

MIT