Persistent memory for AI coding agents using Supermemory.
Your agent remembers what you tell it - across sessions, across projects.
- OpenCode - Plugin with hooks and tool integration
- Kimi CLI - Skill-based approach with CLI tool
OpenCode plugin for persistent memory.
bunx my-supermemory@latest installThen get your API key from console.supermemory.ai and set it:
export SUPERMEMORY_API_KEY="sm_..."Or let your agent do it - paste this into OpenCode:
Install my-supermemory by following https://raw.githubusercontent.com/dpolishuk/my-supermemory/main/README.md
Instructions for LLM Agents (click to expand)
If you're an LLM agent helping set up my-supermemory, follow these steps:
bunx my-supermemory@latest install --no-tuiThis will:
- Register the plugin in
~/.config/opencode/opencode.jsonc - Create the
/supermemory-initcommand
cat ~/.config/opencode/opencode.jsoncShould contain:
{
"plugin": ["my-supermemory"]
}If not, add it manually:
JSONC:
JSON:
{
"plugin": ["my-supermemory"]
}Ask the user to get their API key from console.supermemory.ai.
Then set it via environment variable:
export SUPERMEMORY_API_KEY="sm_..."Or create ~/.config/opencode/supermemory.jsonc:
{
"apiKey": "sm_..."
}Tell the user to restart OpenCode and run:
opencode -cThey should see supermemory in the tools list. If not, check:
- Is
SUPERMEMORY_API_KEYset? - Is the plugin in
opencode.jsonc? - Check logs:
tail ~/.my-supermemory.log
Run /supermemory-init to have the agent explore and memorize the codebase.
On first message, the agent receives (invisible to user):
- User profile (cross-project preferences)
- Project memories (all project knowledge)
- Relevant user memories (semantic search)
Example of what the agent sees:
[SUPERMEMORY]
User Profile:
- Prefers concise responses
- Expert in TypeScript
Project Knowledge:
- [100%] Uses Bun, not Node.js
- [100%] Build: bun run build
Relevant Memories:
- [82%] Build fails if .env.local missing
The agent uses this context automatically - no manual prompting needed.
Say "remember", "save this", "don't forget" etc. and the agent auto-saves to memory.
You: "Remember that this project uses bun"
Agent: [saves to project memory]
Add custom triggers via keywordPatterns config.
Run /supermemory-init to explore and memorize your codebase structure, patterns, and conventions.
When context hits 80% capacity:
- Triggers OpenCode's summarization
- Injects project memories into summary context
- Saves session summary as a memory
This preserves conversation context across compaction events.
API key is <private>sk-abc123</private>
Content in <private> tags is never stored.
The supermemory tool is available to the agent:
| Mode | Args | Description |
|---|---|---|
add |
content, type?, scope? |
Store memory |
search |
query, scope? |
Search memories |
profile |
query? |
View user profile |
list |
scope?, limit? |
List memories |
forget |
memoryId, scope? |
Delete memory |
Scopes: user (cross-project), project (default)
Types: project-config, architecture, error-solution, preference, learned-pattern, conversation
| Scope | Tag | Persists |
|---|---|---|
| User | opencode_user_{sha256(git email)} |
All projects |
| Project | opencode_project_{sha256(directory)} |
This project |
Create ~/.config/opencode/supermemory.jsonc:
{
// API key (can also use SUPERMEMORY_API_KEY env var)
"apiKey": "sm_...",
// Min similarity for memory retrieval (0-1)
"similarityThreshold": 0.6,
// Max memories injected per request
"maxMemories": 5,
// Max project memories listed
"maxProjectMemories": 10,
// Max profile facts injected
"maxProfileItems": 5,
// Include user profile in context
"injectProfile": true,
// Prefix for container tags
"containerTagPrefix": "opencode",
// Extra keyword patterns for memory detection (regex)
"keywordPatterns": ["log\\s+this", "write\\s+down"],
// Context usage ratio that triggers compaction (0-1)
"compactionThreshold": 0.80
}All fields optional. Env var SUPERMEMORY_API_KEY takes precedence over config file.
If you're using Oh My OpenCode, disable its built-in auto-compact hook to let supermemory handle context compaction:
Add to ~/.config/opencode/oh-my-opencode.json:
{
"disabled_hooks": ["anthropic-context-window-limit-recovery"]
}bun install
bun run build
bun run typecheckLocal install:
{
"plugin": ["file:///path/to/my-supermemory"]
}tail -f ~/.my-supermemory.logKimi CLI skill for persistent memory using Supermemory.
# 1. Install CLI tool
bun add -g kimi-supermemory
# 2. Set API key (get from console.supermemory.ai)
export SUPERMEMORY_API_KEY="sm_..."
# 3. Install skill
mkdir -p ~/.codex/skills/kimi-supermemory
curl -o ~/.codex/skills/kimi-supermemory/SKILL.md \
https://raw.githubusercontent.com/dpolishuk/my-supermemory/main/kimi-supermemory/SKILL.mdOr let your agent do it - paste this into Kimi CLI:
Install my-supermemory by following https://raw.githubusercontent.com/dpolishuk/my-supermemory/main/README.md
Click to expand agent installation instructions
If you're a Kimi CLI agent helping set up supermemory, run these commands:
# Step 1: Install CLI tool
bun add -g kimi-supermemory
# Step 2: Configure API key (ask user for key from console.supermemory.ai)
export SUPERMEMORY_API_KEY="sm_..."
# Step 3: Install skill file
mkdir -p ~/.codex/skills/kimi-supermemory
curl -o ~/.codex/skills/kimi-supermemory/SKILL.md \
https://raw.githubusercontent.com/dpolishuk/my-supermemory/main/kimi-supermemory/SKILL.md
# Step 4: Verify installation
kimi-supermemory help
kimi-supermemory add "Test memory from setup" --type project-config
kimi-supermemory listAfter installation, tell the user:
✅ my-supermemory is now installed! I'll automatically save memories when you say "remember", "don't forget", etc., and retrieve relevant context for our conversations.
Optional: Run kimi-supermemory init-codebase to memorize this project's structure.
Unlike OpenCode's plugin system with automatic hooks, kimi-supermemory uses a skill-based approach:
- SKILL.md - Contains instructions that teach the LLM when to save memories and how to use the CLI
- CLI Tool - The
kimi-supermemorycommand provides memory operations - LLM-Driven - The LLM reads the skill and decides when to save/retrieve memories
User: Remember that this project uses Bun instead of Node.js
LLM: [reads SKILL.md, sees "remember" trigger]
LLM: [executes] bunx kimi-supermemory@latest add "Uses Bun runtime
and package manager. Commands: bun install, bun run dev, bun test"
--type project-config
LLM: Got it! I've saved that this project uses Bun. I'll remember the
key commands: bun install, bun run dev, and bun test.
| Command | Description | Example |
|---|---|---|
add <content> |
Save a memory | kimi-supermemory add "Uses TypeScript" --type project-config |
search <query> |
Search memories | kimi-supermemory search "testing workflow" |
list |
List recent memories | kimi-supermemory list --scope project --limit 10 |
forget <id> |
Delete a memory | kimi-supermemory forget abc123 |
context |
Get formatted context | kimi-supermemory context |
init |
Interactive setup | kimi-supermemory init |
init-codebase |
Codebase initialization guide | kimi-supermemory init-codebase |
- project (default): Project-specific knowledge (build commands, architecture, conventions)
- user: Cross-project preferences (coding style, communication preferences)
project-config: Tech stack, commands, toolingarchitecture: Codebase structure, components, data flowerror-solution: Known issues and their fixespreference: Coding style preferenceslearned-pattern: Conventions specific to this codebaseconversation: Session summaries
At the start of each session, the LLM should fetch context:
kimi-supermemory contextThis returns formatted context including:
- User profile (cross-project preferences)
- Project knowledge (all project memories)
- Relevant user memories (semantic search based on session)
Example output:
[SUPERMEMORY]
User Profile:
- Prefers concise responses
- Expert in TypeScript
Project Knowledge:
- [100%] Uses Bun, not Node.js
- [100%] Build: bun run build
Relevant Memories:
- [82%] Build fails if .env.local missing
The skill teaches the LLM to detect trigger words:
- "remember", "memorize"
- "save this", "note this"
- "keep in mind", "don't forget"
- "learn this", "store this"
- "record this", "make a note"
- "take note", "jot down"
- "commit to memory"
- "remember that", "never forget"
- "always remember"
Custom patterns can be added via config.
API key is <private>sk-abc123</private>
Content in <private> tags is never stored.
Create ~/.config/kimi/supermemory.json:
{
"apiKey": "sm_...",
"similarityThreshold": 0.6,
"maxMemories": 5,
"maxProjectMemories": 10,
"keywordPatterns": ["log\\s+this", "write\\s+down"]
}All fields optional. Environment variable SUPERMEMORY_API_KEY takes precedence.
| Scope | Tag | Persists |
|---|---|---|
| User | kimi_user_{sha256(git email)} |
All projects |
| Project | kimi_project_{sha256(directory)} |
This project |
tail -f ~/.local/share/kimi-supermemory/log.txt| Feature | OpenCode | Kimi CLI |
|---|---|---|
| Installation | Plugin system | CLI tool + Skill file |
| Hooks | Automatic | LLM-driven via SKILL.md |
| Context Injection | Automatic | LLM fetches via command |
| Compaction | Automatic | Manual workflow |
| Tool Registration | Native | Bash command |
Both provide the same core memory capabilities!
MIT
{ "plugin": [ "my-supermemory" // ... other plugins ] }