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-memory-plugin

v0.5.0

Published

Persistent cross-session memory plugin for OpenCode

Readme

opencode-memory-plugin

Persistent cross-session memory plugin for OpenCode, designed as a port of claude-mem to OpenCode according to the DAQ in this repository.

Current Scope

  • Local persistence in SQLite with FTS5 index
  • Hybrid-ready architecture for FTS5 + sqlite-vec
  • Crash-safe pending queue for tool outputs
  • Async AI compression pipeline (in-process)
  • Session summaries with structured fields (requested/investigated/learned/completed/next steps)
  • Global persona memory (cross-project user preferences)
  • Git worktree detection with multi-project memory queries
  • Prior session continuity ("Where You Left Off" context block)
  • Token economics display (compression savings in context header)
  • Retrieval tools: memory_search, memory_timeline, memory_get
  • Write tool: memory_add (explicit agent-controlled persistence)
  • Delete tool: memory_forget (with preview + confirmation token)
  • Persona tools: memory_persona_get, memory_persona_update, memory_persona_patch, memory_persona_clear
  • System context injection via experimental.chat.system.transform

Install

bun add opencode-memory-plugin

Add in opencode.json:

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

Optional Memory Config

You can provide plugin-specific config files in any of these paths:

  • ~/.config/opencode/memory/config.json
  • ~/.config/opencode/memory/config.jsonc
  • .opencode/memory.json
  • .opencode/memory.jsonc
  • opencode-memory.json
  • opencode-memory.jsonc

Or set OPENCODE_MEMORY_CONFIG=/absolute/path/to/config.json.

Example:

{
  "dbPath": "~/.config/opencode/memory/memory.db",
  "indexSize": 50,
  "sampleSize": 5,
  "maxPendingRetries": 3,
  "compressionModel": null,
  "maxRawContentSize": 50000,
  "privacyStrip": true,
  "enableSemanticSearch": true,
  "embeddingModel": "Xenova/all-MiniLM-L6-v2",
  "embeddingDimensions": 384,
  "semanticSearchMaxResults": 8,
  "semanticContextMaxResults": 3,
  "semanticMinScore": 0.55,
  "hybridSearchAlpha": 0.65,
  "compressionBatchSize": 10,
  "retentionDays": 90,
  "logLevel": "info"
}

Semantic search is enabled by default. The plugin keeps FTS5 as the lexical base and uses local-only embeddings (@huggingface/transformers) plus sqlite-vec as the preferred semantic layer. If native vector loading is unavailable in the current Bun runtime, the plugin falls back to semantic reranking in JavaScript over persisted embeddings while preserving the same public behavior.

Persona Memory

The plugin maintains a global user persona that persists across all projects. It learns automatically from conversations and is injected into every session's context.

| Tool | Description | |------|-------------| | memory_persona_get | View the current persona | | memory_persona_update | Replace the persona content | | memory_persona_patch | Append new facts to the persona | | memory_persona_clear | Clear the persona memory |

The persona is automatically learned from user messages (every 3 turns) and injected as <persona_context> before project memory in the system prompt.

Development

bun install
bun run typecheck
bun test
bun run build

Notes

  • This package targets OpenCode plugin APIs currently exposed by @opencode-ai/[email protected].
  • The architecture DAQ in docs/DAQ-opencode-memory-plugin.md is the source of truth for the hybrid rollout.