freshcrate
Skin:/
Home > Databases > opencode-mem

opencode-mem

OpenCode plugin that gives coding agents persistent memory using local vector database

Why this rank:Strong adoptionRecent releaseHealthy release cadence

Description

OpenCode plugin that gives coding agents persistent memory using local vector database

README

OpenCode Memory

npm version npm downloads license

OpenCode Memory Banner

A persistent memory system for AI coding agents that enables long-term context retention across sessions using local vector database technology.

Visual Overview

Project Memory Timeline:

Project Memory Timeline

User Profile Viewer:

User Profile Viewer

Core Features

Local vector database with SQLite + USearch-first vector indexing and ExactScan fallback, persistent project memories, automatic user profile learning, unified memory-prompt timeline, full-featured web UI, intelligent prompt-based memory extraction, multi-provider AI support (OpenAI, Anthropic), 12+ local embedding models, smart deduplication, and built-in privacy protection.

Prerequisites

This plugin uses USearch for preferred in-memory vector indexing with automatic ExactScan fallback. No custom SQLite build or browser runtime shim is required.

Recommended runtime:

  • Bun
  • Standard OpenCode plugin environment

Notes:

  • If USearch is unavailable or fails at runtime, the plugin automatically falls back to exact vector scanning.
  • SQLite remains the source of truth; search indexes are rebuilt from SQLite data when needed.

Getting Started

Add to your OpenCode configuration at ~/.config/opencode/opencode.json:

{
  "plugin": ["opencode-mem"],
}

The plugin downloads automatically on next startup.

Usage Examples

memory({ mode: "add", content: "Project uses microservices architecture" });
memory({ mode: "search", query: "architecture decisions" });
memory({ mode: "search", query: "architecture decisions", scope: "all-projects" });
memory({ mode: "profile" });
memory({ mode: "list", limit: 10 });

Access the web interface at http://127.0.0.1:4747 for visual memory browsing and management.

Configuration Essentials

Configure at ~/.config/opencode/opencode-mem.jsonc:

{
  "storagePath": "~/.opencode-mem/data",
  "userEmailOverride": "user@example.com",
  "userNameOverride": "John Doe",
  "embeddingModel": "Xenova/nomic-embed-text-v1",
  "memory": {
    "defaultScope": "project",
  },
  "webServerEnabled": true,
  "webServerPort": 4747,

  "autoCaptureEnabled": true,
  "autoCaptureLanguage": "auto",

  "opencodeProvider": "anthropic",
  "opencodeModel": "claude-haiku-4-5-20251001",

  "showAutoCaptureToasts": true,
  "showUserProfileToasts": true,
  "showErrorToasts": true,

  "userProfileAnalysisInterval": 10,
  "maxMemories": 10,

  "compaction": {
    "enabled": true,
    "memoryLimit": 10,
  },
  "chatMessage": {
    "enabled": true,
    "maxMemories": 3,
    "excludeCurrentSession": true,
    "maxAgeDays": undefined,
    "injectOn": "first",
  },
}

Memory Scope

  • scope: "project": query only the current project. This is the default.
  • scope: "all-projects": query search / list across all project shards.
  • memory.defaultScope sets the default query scope when no explicit scope is provided.

Auto-Capture AI Provider

Recommended: Use opencode's built-in providers (no separate API key needed):

"opencodeProvider": "anthropic",
"opencodeModel": "claude-haiku-4-5-20251001",

This leverages your existing opencode authentication (OAuth or API key). Works with Claude Pro/Max plans via OAuth - no individual API keys required.

Supported providers: anthropic, openai

Fallback: Manual API configuration (if not using opencodeProvider):

"memoryProvider": "openai-chat",
"memoryModel": "gpt-4o-mini",
"memoryApiUrl": "https://api.openai.com/v1",
"memoryApiKey": "sk-...",

API Key Formats:

"memoryApiKey": "sk-..."
"memoryApiKey": "file://~/.config/opencode/api-key.txt"
"memoryApiKey": "env://OPENAI_API_KEY"

Full documentation available in this README.

Development & Contribution

Build and test locally:

bun install
bun run build
bun run typecheck
bun run format

This project is actively seeking contributions to become the definitive memory plugin for AI coding agents. Whether you are fixing bugs, adding features, improving documentation, or expanding embedding model support, your contributions are critical. The codebase is well-structured and ready for enhancement. If you hit a blocker or have improvement ideas, submit a pull request - we review and merge contributions quickly.

License & Links

MIT License - see LICENSE file

Inspired by opencode-supermemory

Release History

VersionChangesUrgencyDate
v2.15.0<!-- Release notes generated using configuration in .github/release.yml at v2.15.0 --> ## What's Changed ### Other Changes * fix(runtime): support Node plugin loader (bun:sqlite + Bun.serve fallbacks) by @leiverkus in https://github.com/tickernelz/opencode-mem/pull/121 * feat(i18n): add Arabic localization support by @eyadcsdev in https://github.com/tickernelz/opencode-mem/pull/118 * fix: prevent data loss on memory update when embedding API is unreachable by @High-cla in https://github.com/ticHigh6/5/2026
v2.14.3## Fixed - Fix OpenCode plugin loading on strict ESM runtimes by importing `package.json` with `with { type: "json" }`. - Add a regression guard that verifies the built `dist/plugin.js` keeps the JSON import attribute. ## Verification - `bun run build` - `bun test tests/plugin-loader-contract.test.ts` - `bun test` - `bun run typecheck` - `bun run format:check` - `git diff --check` Fixes #112 <!-- Release notes generated using configuration in .github/release.yml at v2.14.3 --> **Full ChanHigh5/18/2026
v2.14.2<!-- Release notes generated using configuration in .github/release.yml at v2.14.2 --> **Full Changelog**: https://github.com/tickernelz/opencode-mem/compare/v2.14.1...v2.14.2High5/12/2026
v2.14.0## v2.14.0 ### Highlights - Fix Web UI/read API hangs by avoiding embedding warmup on read-only SQLite paths. - Harden local embedding initialization by forcing ONNX WASM threading to `1` in Node/Bun runtimes. - Refactor auto-capture/profile structured-output generation to use OpenCode v2 `session.prompt` instead of manually reading `auth.json` and calling provider APIs directly. - Unlock any provider already configured in OpenCode for memory extraction, including GitHub Copilot, Claude OAuth,High5/9/2026
v2.13.0<!-- Release notes generated using configuration in .github/release.yml at v2.13.0 --> ## What's Changed ### Other Changes * fix(plugin): restore OpenCode 1.3 loader compatibility by @NaNomicon in https://github.com/tickernelz/opencode-mem/pull/81 ## New Contributors * @NaNomicon made their first contribution in https://github.com/tickernelz/opencode-mem/pull/81 **Full Changelog**: https://github.com/tickernelz/opencode-mem/compare/v2.12.1...v2.13.0High4/3/2026
v2.12.1<!-- Release notes generated using configuration in .github/release.yml at v2.12.1 --> ## What's Changed ### Other Changes * feat(config): add project-scoped config resolution via .opencode/ directory by @perebusquets in https://github.com/tickernelz/opencode-mem/pull/65 * feat(web): add select page action by @tony027wh in https://github.com/tickernelz/opencode-mem/pull/72 ## New Contributors * @tony027wh made their first contribution in https://github.com/tickernelz/opencode-mem/pull/72 **FuMedium3/31/2026
v2.12.0<!-- Release notes generated using configuration in .github/release.yml at v2.12.0 --> ## What's Changed ### Other Changes * feat: add option to use opencode's internal providers by @perebusquets in https://github.com/tickernelz/opencode-mem/pull/63 ## New Contributors * @perebusquets made their first contribution in https://github.com/tickernelz/opencode-mem/pull/63 **Full Changelog**: https://github.com/tickernelz/opencode-mem/compare/v2.11.12...v2.12.0Low3/17/2026
v2.11.12<!-- Release notes generated using configuration in .github/release.yml at v2.11.12 --> **Full Changelog**: https://github.com/tickernelz/opencode-mem/compare/v2.11.11...v2.11.12Low3/13/2026
v2.11.11<!-- Release notes generated using configuration in .github/release.yml at v2.11.11 --> ## What's Changed ### Other Changes * feat: add memoryExtraParams for custom API request body parameters by @itsahedge in https://github.com/tickernelz/opencode-mem/pull/57 ## New Contributors * @itsahedge made their first contribution in https://github.com/tickernelz/opencode-mem/pull/57 **Full Changelog**: https://github.com/tickernelz/opencode-mem/compare/v2.11.10...v2.11.11Low3/12/2026
v2.11.10<!-- Release notes generated using configuration in .github/release.yml at v2.11.10 --> **Full Changelog**: https://github.com/tickernelz/opencode-mem/compare/v2.11.9...v2.11.10Low3/11/2026
v2.11.9<!-- Release notes generated using configuration in .github/release.yml at v2.11.9 --> **Full Changelog**: https://github.com/tickernelz/opencode-mem/compare/v2.11.8...v2.11.9Low3/11/2026
v2.11.8<!-- Release notes generated using configuration in .github/release.yml at v2.11.8 --> **Full Changelog**: https://github.com/tickernelz/opencode-mem/compare/v2.11.7...v2.11.8Low3/11/2026
v2.11.7<!-- Release notes generated using configuration in .github/release.yml at v2.11.7 --> ## What's Changed ### Other Changes * fix: resolve symlinks in git-common-dir for worktree support by @newbeelee048 in https://github.com/tickernelz/opencode-mem/pull/52 ## New Contributors * @newbeelee048 made their first contribution in https://github.com/tickernelz/opencode-mem/pull/52 **Full Changelog**: https://github.com/tickernelz/opencode-mem/compare/v2.11.6...v2.11.7Low3/4/2026
v2.11.6<!-- Release notes generated using configuration in .github/release.yml at v2.11.6 --> ## What's Changed ### Other Changes * fix: correct hnswlib-wasm API, add i18n & tests by @kui123456789 in https://github.com/tickernelz/opencode-mem/pull/48 * fix: use in-memory HNSW with auto-rebuild & add i18n.js web server route by @kui123456789 in https://github.com/tickernelz/opencode-mem/pull/49 **Full Changelog**: https://github.com/tickernelz/opencode-mem/compare/v2.11.4...v2.11.6Low3/2/2026
v2.11.4<!-- Release notes generated using configuration in .github/release.yml at v2.11.4 --> ## What's Changed ### Other Changes * feat: replace hnswlib-node with hnswlib-wasm for cross-platform compatibility by @kui123456789 in https://github.com/tickernelz/opencode-mem/pull/47 **Full Changelog**: https://github.com/tickernelz/opencode-mem/compare/v2.11.3...v2.11.4Low2/28/2026
v2.11.3<!-- Release notes generated using configuration in .github/release.yml at v2.11.3 --> **Full Changelog**: https://github.com/tickernelz/opencode-mem/compare/v2.11.2...v2.11.3Low2/20/2026
v2.11.2<!-- Release notes generated using configuration in .github/release.yml at v2.11.2 --> **Full Changelog**: https://github.com/tickernelz/opencode-mem/compare/v2.11.1...v2.11.2Low2/20/2026
v2.11.1<!-- Release notes generated using configuration in .github/release.yml at v2.11.1 --> **Full Changelog**: https://github.com/tickernelz/opencode-mem/compare/v2.11.0...v2.11.1Low2/20/2026
v2.11.0<!-- Release notes generated using configuration in .github/release.yml at v2.11.0 --> **Full Changelog**: https://github.com/tickernelz/opencode-mem/compare/v2.10.0...v2.11.0Low2/20/2026
v2.10.0<!-- Release notes generated using configuration in .github/release.yml at v2.10.0 --> **Full Changelog**: https://github.com/tickernelz/opencode-mem/compare/v2.9.2...v2.10.0Low2/20/2026
v2.9.0<!-- Release notes generated using configuration in .github/release.yml at v2.9.0 --> **Full Changelog**: https://github.com/tickernelz/opencode-mem/compare/v2.8.9...v2.9.0Low2/20/2026

Dependencies & License Audit

Loading dependencies...

Similar Packages

mem9Enable AI agents to retain memory across sessions using persistent storage designed for continuous context retention.main@2026-06-05
openclaw-engramLocal-first memory plugin for OpenClaw AI agents. LLM-powered extraction, plain markdown storage, hybrid search via QMD. Gives agents persistent long-term memory across conversations.v9.3.613
remnicLocal-first memory plugin for OpenClaw AI agents. LLM-powered extraction, plain markdown storage, hybrid search via QMD. Gives agents persistent long-term memory across conversations.v9.3.613
modelenceModelence is a full-stack framework for building production web apps with a built-in database, authentication and monitoring. Modelence is opinionated and AI agent-first, which means it's optimized fomodelence@0.19.0
HelixTransform Claude into a local AI assistant for Mac that controls apps, manages tasks, and remembers context across sessions.main@2026-06-04

More in Databases

orbitOne API for 20+ LLM providers, your databases, and your files — self-hosted, open-source AI gateway with RAG, voice, and guardrails.
ai-real-estate-assistantAdvanced AI Real Estate Assistant using RAG, LLMs, and Python. Features market analysis, property valuation, and intelligent search.
alibabacloud-adb20211201Alibaba Cloud adb (20211201) SDK Library for Python
milvusMilvus is a high-performance, cloud-native vector database built for scalable vector ANN search