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

@weave_protocol/adapter-opencode

v0.3.0

Published

Weave Protocol plugin for OpenCode - enforces WARD.md policies on every tool call via tool.execute.before

Readme

🛡️ @weave_protocol/adapter-opencode

Enforce WARD.md in OpenCode with a plugin. Every tool call is checked against your policy before it runs, whichever model you're using: Claude, GPT, Gemini, DeepSeek, Kimi, Qwen or a local one.

npm

The same WARD.md you use with Claude Code, Antigravity, Microsoft Agent Framework, Gemini CLI and Codex CLI.

🆕 What's new

0.3.0: session and spend limits. WARD.md's limits are now enforced per session, keyed on the OpenCode sessionID:

  • Behavioral Limits: maxToolCalls, maxRuntimeSeconds and maxExternalServices;
  • spending_limits: caps: tool calls, and per-tool call counts and USD amounts over a run, hour, day, week or month.

The counts live in a small local ledger (~/.weave/ledger, or $WEAVE_LEDGER_DIR) because every hook call is a new process. Ward 0.3.6's payment guard also asks before any call that moves money: payment tools, and wallet or Stripe CLIs in shell commands.

Quick start

Add the plugin to OpenCode's config, either by hand:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["@weave_protocol/adapter-opencode"]
}

or with the CLI, which edits ~/.config/opencode/opencode.json for you:

npx -p @weave_protocol/adapter-opencode weave-ward-opencode init

Restart OpenCode; it installs the plugin on startup. Add a WARD.md to your project (npx @weave_protocol/ward init), or a global one at ~/.config/opencode/WARD.md.

The command is weave-ward-opencode, not weave-opencode. The weave-opencode npm name belongs to W&B Weave's opencode integration, which is a different product.

What it checks

The plugin runs in OpenCode's tool.execute.before hook and uses Ward's shared evaluator (evaluateToolCall), so the rules match the other adapters exactly:

| Tool | Checked | |---|---| | bash | shell_exec, plus every URL and every absolute or ~ path in the command (relative paths resolve against workdir) | | read, write, edit | filePath (read or write) | | glob, grep | path (list or read) | | webfetch | url | | apply_patch | the files in its patchText (*** Add/Update File and *** Move to are writes, *** Delete File is a delete); patch content is never treated as a target | | todowrite, question | the task_planning capability | | MCP tools (<server>_<tool>) and custom tools | by name, plus every path- and URL-named argument |

A blocked call throws, and the agent sees WARD: <reason> as the tool error. A call that needs approval is blocked with a reason saying so.

Policy loading:

  • WARD.md is re-read on every call, so edits take effect without restarting OpenCode.
  • An invalid WARD.md blocks every call, so a typo can't silently switch enforcement off.
  • No WARD.md anywhere means no enforcement.

WARD.md is looked up in this order:

  1. $WEAVE_WARD_PATH
  2. <project>/WARD.md
  3. <project>/.opencode/WARD.md
  4. <project>/.weave/WARD.md
  5. ~/.config/opencode/WARD.md

Commands

weave-ward-opencode init       # add the plugin to ~/.config/opencode/opencode.json
weave-ward-opencode disable    # remove it
weave-ward-opencode status
weave-ward-opencode test read --input='{"filePath":"secrets/key"}'   # dry run

init backs up opencode.json and edits it atomically, leaving your other plugins and settings alone. It won't rewrite an opencode.jsonc file (it has comments); it tells you what to add instead.

For plugin authors

The package's main entry default-exports only the plugin, { id: "weave-ward", server }, as OpenCode's loader requires. The helpers are at @weave_protocol/adapter-opencode/lib.

Dashboard

Set WEAVE_DASHBOARD_URL (and WEAVE_API_KEY) where you run the agent, and each decision is reported to a local Weave API dashboard (0.2.0+). Only the decision and the tool name are sent, never command or argument contents. Reporting never changes a decision and gives up after 250 ms.

Verified

Built against OpenCode's plugin docs, plus the plugin loader and tool schemas in OpenCode v1.19.5. 12 fixture tests.

Live-checked in OpenCode 1.19.5 (on Gemini 3.5 Flash-Lite), loaded as a local plugin:

  • a read of secrets/key was blocked, and the model received WARD: Denied by filesystem rule …;
  • a write of TODO.md outside the allowed folder was blocked, and no file was created;
  • allowed glob and read calls went through.

🕸️ Part of Weave Protocol

One WARD.md policy for every agent you run, locally or at scale, plus the tools around it.

| Package | What it does | |---|---| | Ward | The WARD.md policy standard and the tool-call evaluator every adapter shares | | Mund | Scans content for prompt injection, secrets, PII and exfiltration | | Hord | Encrypted vaults, PII tokenization, sandboxes, capability tokens, attestations | | Dōmere | Audit threads, compliance checkpoints, GDPR and CCPA records, anchoring | | Witan | Multi-agent consensus and spending caps | | Hundredmen | MCP proxy that enforces WARD.md on tool calls | | Tollere | Supply-chain checks: typosquats, CVEs, suspicious version diffs | | Browser | WARD.md and injection scanning for Playwright browser agents | | Adapters | WARD.md in Claude Code, Antigravity, MSAF, Gemini CLI, Codex, OpenCode and Cursor | | Adversary · AgentSecBench | Red-team engine and locked benchmark | | API · CLI · LangChain | REST API and dashboard, setup CLI, LangChain.js integration | | full | Every defensive package in one install | | Yoxallismus | Post-quantum hybrid cipher (experimental beta) |


License

Apache-2.0