Skip to main content
This integration requires the Supermemory Pro plan. Upgrade here.
OpenCode-Supermemory is an OpenCode plugin that gives your AI persistent memory across sessions. Your agent remembers what you worked on — across sessions, across projects.
Prefer to keep everything on your machine? This plugin works with self-hosted Supermemory — run npx supermemory local, then export SUPERMEMORY_API_URL="http://localhost:6767" and use the API key printed on first boot.

Get Your API Key

Create a Supermemory API key from the API Keys page, then add it to your shell profile so it persists across sessions:

Install the Plugin

For LLM agents (non-interactive):
Ensure your ~/.config/opencode/opencode.jsonc contains:

How It Works

Once installed, the plugin runs automatically:
  • Context Injection — On session start, relevant memories are fetched and injected into the agent’s context. This includes user preferences, project knowledge, and past interactions.
  • Keyword Detection — Phrases like “remember” or “save this” trigger automatic storage.
  • Smart Compaction — At 80% context capacity, sessions are summarized and saved as memories.
  • Privacy Protection — Content within <private> tags never persists.

Memory Scopes

ScopeDescription
userMemories that persist across all projects
projectMemories isolated to the current project (default)

Memory Types

TypeDescription
project-configProject configuration and setup details
architectureCodebase structure and design patterns
error-solutionProblems encountered and their fixes
preferenceUser preferences and coding style
learned-patternPatterns discovered during sessions
conversationImportant conversation context

Commands

/supermemory-init

Explore and index your codebase structure into memory:

Tools

The agent has access to a supermemory tool with these modes:
ModeParametersFunction
addcontent, type?, scope?Store information
searchquery, scope?Find relevant memories
profilequery?View user preferences
listscope?, limit?Display stored items
forgetmemoryId, scope?Remove memory

Configuration

Create ~/.config/opencode/supermemory.jsonc:

Logging

View plugin activity:

Next Steps

GitHub Repository

Source code, issues, and detailed README.

Claude Code Plugin

Memory plugin for Claude Code.