Package Exports
- opencode-mem
- opencode-mem/dist/plugin.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (opencode-mem) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
OpenCode Memory

A persistent memory system for AI coding agents that enables long-term context retention across sessions using local vector database technology.
Overview
OpenCode Memory provides AI coding agents with the ability to remember and recall information across conversations. It uses vector embeddings and SQLite for efficient storage and retrieval of contextual information.
Key Features
- Local Vector Database: SQLite-based storage with sqlite-vec extension
- Project Memory System: Persistent storage for project-specific knowledge
- User Profile System: Automatic learning of preferences, patterns, and workflows
- Unified Timeline: Browse memories and prompts together with linking support
- Web Interface: Full-featured UI for memory management and search
- Auto-Capture System: Intelligent prompt-based memory extraction
- Multi-Provider AI: Support for OpenAI, Anthropic, and OpenAI-compatible APIs
- Flexible Embedding Models: 12+ local models or OpenAI-compatible APIs
- Smart Deduplication: Prevents redundant memories using similarity detection
- Privacy Protection: Built-in content filtering for sensitive information
Installation
Add the plugin to your OpenCode configuration:
Location: ~/.config/opencode/opencode.json or opencode.jsonc
{
"plugins": [
"opencode-mem"
]
}OpenCode will automatically download and install the plugin on next startup.
macOS Users - IMPORTANT
macOS ships with Apple's SQLite which disables extension loading for security reasons. You must install and configure Homebrew SQLite:
Step 1: Install Homebrew SQLite
brew install sqliteStep 2: Find the library path
brew --prefix sqliteStep 3: Configure the path
Edit ~/.config/opencode/opencode-mem.jsonc and add:
{
"customSqlitePath": "/opt/homebrew/opt/sqlite/lib/libsqlite3.dylib"
}Common paths:
- Apple Silicon (M1/M2/M3):
/opt/homebrew/opt/sqlite/lib/libsqlite3.dylib - Intel Mac:
/usr/local/opt/sqlite/lib/libsqlite3.dylib
The plugin will auto-detect these paths if not configured, but manual configuration is recommended for reliability.
Install from Source
git clone https://github.com/tickernelz/opencode-mem.git
cd opencode-mem
bun install
bun run buildQuick Start
Basic Usage
// Add project memory
memory({ mode: "add", content: "Project uses microservices architecture" })
// Search memories
memory({ mode: "search", query: "architecture decisions" })
// View user profile
memory({ mode: "profile" })
// List recent memories
memory({ mode: "list", limit: 10 })Web Interface
Access at http://127.0.0.1:4747 to browse memories, view prompt-memory links, and manage your memory database.
Project Memory Timeline:

User Profile Viewer:

Configuration
Configuration file: ~/.config/opencode/opencode-mem.jsonc
{
"storagePath": "~/.opencode-mem/data",
"customSqlitePath": "/opt/homebrew/opt/sqlite/lib/libsqlite3.dylib",
"embeddingModel": "Xenova/nomic-embed-text-v1",
"webServerEnabled": true,
"webServerPort": 4747,
"autoCaptureEnabled": true,
"memoryProvider": "openai-chat",
"memoryModel": "gpt-4",
"memoryApiUrl": "https://api.openai.com/v1",
"memoryApiKey": "sk-...",
"userProfileAnalysisInterval": 10,
"maxMemories": 10
}See Configuration Guide for all options.
Breaking Changes (v2.3)
User-scoped memories completely removed:
- Removed:
scopeparameter from all memory operations - Removed:
maxProjectMemoriesconfig (usemaxMemoriesinstead) - Renamed:
userMemoryAnalysisInterval→userProfileAnalysisInterval - Renamed:
performUserMemoryLearning()→performUserProfileLearning() - Changed: All memories are now project-scoped by default
- Changed: User preferences managed exclusively through automatic profile system
Migration required:
// OLD
{
"userMemoryAnalysisInterval": 10,
"maxMemories": 5,
"maxProjectMemories": 10
}
// NEW
{
"userProfileAnalysisInterval": 10,
"maxMemories": 10
}Remove scope parameter from all memory() calls:
// OLD
memory({ mode: "add", content: "...", scope: "project" })
// NEW
memory({ mode: "add", content: "..." })Documentation
For detailed documentation, see the Wiki:
- Installation Guide
- Quick Start
- Configuration Guide
- User Profile System
- Memory Operations
- Auto-Capture System
- Web Interface
- API Reference
- Troubleshooting
Development
bun install
bun run dev
bun run build
bun run format
bun run typecheckLicense
MIT License - see LICENSE file for details
Acknowledgments
Inspired by opencode-supermemory
Links
- Repository: https://github.com/tickernelz/opencode-mem
- Wiki: https://github.com/tickernelz/opencode-mem/wiki
- Issues: https://github.com/tickernelz/opencode-mem/issues
- OpenCode Platform: https://opencode.ai