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

@fimars/mem9-oc2

v0.2.1

Published

OpenCode V2 memory plugin — cloud-persistent AI agent memory with hybrid vector + keyword search via mem9

Readme

mem9 · OpenCode 2 Plugin

Persistent, cloud-backed AI agent memory for OpenCode 2. A V2 port of the mem9 OpenCode plugin, published as @fimars/mem9-oc2.

Origin

The original mem9 plugin for OpenCode V1 lives in the upstream mem9 repository under opencode-plugin/. It used the V1 plugin API (@opencode-ai/[email protected]) with server hooks (chat.message, experimental.chat.*, experimental.session.compacting) and a V1 TUI entrypoint (/mem9-setup).

OpenCode V2 broke the plugin API on purpose, so the plugin was migrated here:

  • one module (Plugin.define({ id, setup })) that adapts to the runtime context — the background server (recall, auto-ingest, tools) and the TUI (/mem9-setup);
  • recall via session.hook("context"), ingest via the session.idle / session.compaction.started events;
  • tools exposed directly to the model (codemode: false) with JSON Schema output;
  • a promise-based TUI setup flow.

Install

Give this to your OpenCode assistant (or run it yourself):

Install the mem9 OpenCode 2 memory plugin: add @fimars/mem9-oc2 to the plugins array in ~/.config/opencode/opencode.json, restart opencode2, then run /mem9-setup in the TUI to connect a mem9 API key.

Or manually:

opencode2 plugin add @fimars/mem9-oc2   # or add to ~/.config/opencode/opencode.json
opencode2                               # restart, then run /mem9-setup

/mem9-setup walks you through creating or pasting a mem9 API key and saving it to ~/.mem9/.credentials.json.

Project overrides (optional)

Add <project>/.opencode/mem9.json to override the profile, debug flag, or timeouts per repository:

{
  "schemaVersion": 1,
  "profileId": "default",
  "debug": false,
  "defaultTimeoutMs": 8000,
  "searchTimeoutMs": 15000
}

What it does

Server: recalls relevant memories before each turn and injects a <relevant-memories> block into the system prompt; registers memory_store, memory_search, memory_get, memory_update, memory_delete; ingests transcripts in the background on session.idle and session.compaction.started.

TUI: registers the /mem9-setup slash command.

Data & config locations

  • Credentials: $MEM9_HOME/.credentials.json (default ~/.mem9)
  • Global config: ~/.config/opencode/mem9.json
  • Project override: <project>/.opencode/mem9.json
  • Debug logs: ~/.local/share/opencode/plugins/mem9/log/YYYY-MM-DD.jsonl

Env overrides at runtime: MEM9_API_KEY, MEM9_API_URL, MEM9_DEBUG, MEM9_HOME, MEM9_TENANT_ID (legacy alias for the API key).

Differences from the V1 plugin

  • V2 plugin API (@opencode-ai/plugin@next).
  • Single module serves server and TUI; setup branches on context capabilities.
  • Tools are direct provider tools (codemode: false) with JSON Schema output.
  • No V2 equivalent for experimental.session.compacting; ingest now triggers from the session.compaction.started event and the compaction hint is not injected.
  • Ingest transcripts come from the context hook instead of a client.session.messages() fetch.

Development

pnpm install
pnpm run typecheck   # tsc --noEmit
pnpm run test        # tsc -p tsconfig.test.json && node --test dist-test/tests

The repo-root opencode.json registers ./src/index.ts as a local plugin, so you can develop and test in this directory with opencode2 directly.