OpenCode Plugin
Persistent memory for OpenCode. Automatically injects relevant context at session start and provides tools for memory management.
Installation
Section titled “Installation”bunx @momomemory/opencode-momo installOr with automatic confirmation:
bunx @momomemory/opencode-momo install --yesThis registers the plugin in ~/.config/opencode/opencode.jsonc and creates command files.
Configuration
Section titled “Configuration”Environment Variables (Recommended)
Section titled “Environment Variables (Recommended)”export MOMO_OPENCODE_BASE_URL="http://localhost:3000"export MOMO_OPENCODE_API_KEY="your-api-key"Optional overrides:
export MOMO_OPENCODE_CONTAINER_TAG_USER="my-user-tag"export MOMO_OPENCODE_CONTAINER_TAG_PROJECT="my-project-tag"Config File
Section titled “Config File”Create ~/.config/opencode/momo.jsonc:
{ "opencode": { "baseUrl": "http://localhost:3000", "apiKey": "your-api-key", "containerTagUser": "", "containerTagProject": "" }}Or use the CLI:
opencode-momo configure --base-url http://localhost:3000 --api-key YOUR_KEYProject-Local Config
Section titled “Project-Local Config”Create .momo.jsonc in your project root:
{ "opencode": { "baseUrl": "http://localhost:3000", "containerTagProject": "my-stable-project-tag" }}Config Precedence
Section titled “Config Precedence”- Environment variables (
MOMO_OPENCODE_*) - Project-local
.momo.jsonc - Global
~/.config/opencode/momo.jsonc - Built-in defaults
Features
Section titled “Features”Context Injection
Section titled “Context Injection”Momo automatically injects context into the first message of every session:
- User Profile — Computed narrative of preferences and known facts
- User Memories — Recent personal context across all projects
- Project Memories — Knowledge specific to the current codebase
Memory Tools
Section titled “Memory Tools”| Mode | Description |
|---|---|
help | Show usage information |
add | Store a new memory |
search | Hybrid search across memories |
profile | View computed user profile |
list | List recent memories |
forget | Remove a memory by ID |
Example usage:
momo({ mode: "add", content: "User prefers dark mode", scope: "user", memoryType: "preference" })momo({ mode: "search", query: "database schema", limit: 5 })momo({ mode: "forget", memoryId: "mem_abc123" })Ingestion Tools
Section titled “Ingestion Tools”| Tool | Purpose |
|---|---|
momo_ingest | Ingest text, URLs, or files into the document pipeline |
momo_ocr | OCR image files and extract text |
momo_transcribe | Transcribe audio/video files |
Example usage:
momo_ingest({ input: "https://example.com/docs", inputType: "url", scope: "project" })momo_ocr({ filePath: "/path/to/image.png", extractMemories: true })momo_transcribe({ filePath: "/path/to/audio.mp3", scope: "user" })Slash Commands
Section titled “Slash Commands”| Command | Purpose |
|---|---|
/momo-init | Initialize codebase memory — guides the agent to explore and store project knowledge |
/momo-configure | Shows configuration help |
Memory Scoping
Section titled “Memory Scoping”| Scope | Description | Container Tag |
|---|---|---|
user | Personal facts across all projects | opencode-user-{hash(username)} |
project | Codebase-specific knowledge | ocp-{slug(projectName)}-{hash(directory)} |
Privacy
Section titled “Privacy”Wrap content in <private> tags to prevent storage:
<private>This will not be stored in memory</private>Troubleshooting
Section titled “Troubleshooting”Plugin not appearing in tools list:
- Check
~/.config/opencode/opencode.jsonccontains the plugin - Verify
MOMO_OPENCODE_API_KEYis set (or server has auth disabled) - Restart OpenCode
Configuration not loading:
- Verify config file syntax (JSONC with comments is supported)
- Check that you’re using
MOMO_OPENCODE_*env vars, not genericMOMO_* - Run
opencode-momo configureto reset configuration
Context not injecting:
- Ensure the Momo server is accessible at your configured
baseUrl - Check that memories exist for the current container tag (both user and project scopes)
- Check plugin logs for memory injection errors