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

opencode-brainbox

v0.1.0

Published

Brainbox as opencode's native memory backend: graph recall with confidence grades and evidence tags, WakeBrief injection at session start, and a digest filed at session end for server-side dreaming.

Readme

opencode-brainbox

Brainbox as opencode's native memory backend.

A Tier-2 memory integration — not just an on-demand tool, but a plugin that:

  1. exposes brainbox_recall / brainbox_store / brainbox_get tools the model can call,
  2. auto-injects a WakeBrief into the system prompt at session start (recalled context, before turn 1), and
  3. files a digest at session end for Brainbox's server-side dream cycle.

Ported from openclaw-brainbox onto opencode's @opencode-ai/plugin hook surface. Same transport client, same never-throws + cooldown contract.

Install

From a local checkout, reference it in ~/.config/opencode/opencode.jsonc:

{
  "plugin": [
    ["file:///Users/you/opencode-brainbox/index.js", { "baseUrl": "https://brainbox-mcp.thexi.dev" }]
  ]
}

(Non-secret options only — the API key comes from the environment, never the config file.)

Auth — never put the key in plaintext config

The bbk_ tenant key is read from BRAINBOX_BBK (or BRAINBOX_KEY). On macOS, keep it in the Keychain and export it at launch:

# one-time: store the key (service name matches the openclaw plugin's convention)
security add-generic-password -a "$USER" -s brainbox-api-key -w 'bbk_...' -U

# per shell / wrapper, before running opencode:
export BRAINBOX_BBK="$(security find-generic-password -s brainbox-api-key -w)"
opencode run -m openrouter/z-ai/glm-5.2 "…"

Hooks used (@opencode-ai/plugin)

| Behaviour | Hook | | --- | --- | | recall / store / get tools | tool | | WakeBrief injection at session start | experimental.chat.system.transform | | open session + capture user text | chat.message | | digest + continuous-encoder turn sync | experimental.text.complete | | carry recalled context across compaction | experimental.session.compacting | | file digest on explicit session end | event (session.deleted) | | best-effort close on teardown | dispose |

Note on session end: opencode has no explicit "session ended" hook. For headless opencode run (one-shot), dispose fires on process exit — an exact, clean end. For the long-lived TUI, the digest is filed on session.deleted and on dispose. Server-side lazy-close + TTL sweep means a missed end degrades, never corrupts.

Transport

  • brainbox_recall → REST POST /ask (salience-ranked recall, confidence grades, evidence tags, honest abstention).
  • brainbox_store / brainbox_get and the session tools → the worker's /mcp door (hand-rolled JSON-RPC streamable-HTTP client, no SDK).

All tools never throw: on any backend failure they return { disabled: true, unavailable: true, error } and open a cooldown window (default 60s) so a dead backend costs one timeout, not one per turn.

Memory-free runs

Set BRAINBOX_RECALL=off to disable the read paths (recall tool + WakeBrief injection) for a run; writes still flow. For a fully memory-free run, simply don't load the plugin. This switch carries no mode semantics — it's plain ergonomics.

Config options

| key | default | | | --- | --- | --- | | baseUrl | https://brainbox-mcp.thexi.dev | | | apiKey | — | prefer ${BRAINBOX_BBK} env; a literal bbk_… is accepted | | requestTimeoutMs | 8000 | per-request timeout | | failureCooldownMs | 60000 | backoff after a backend failure | | sessionChoreography | true | set false for tools-only (no WakeBrief / digest) | | turnSync | true | continuous-encoder per-turn ingest |