Agent Memory
Agent Memory
Agent Memory brings Letta-style editable memory blocks to OpenCode. Inspired by Letta (formerly MemGPT), the plugin gives the agent persistent, self-editable memory blocks — shared markdown files on disk that every OpenCode session can read and write.
Think of it as AGENTS.md with a harness: adds structure (scoped blocks with metadata and size limits), dedicated tools for memory operations, and prompting that encourages the agent to actively maintain its own memory.
Key Features
| Feature | Description |
|---|---|
| Persistent memory | Survives across sessions and context compaction |
| Shared across sessions | Global blocks shared across all projects; project blocks shared across sessions in that codebase |
| Self-editing | The agent can read and modify its own memory with dedicated tools |
| System prompt injection | Memory blocks appear in the system prompt, always in-context |
| Journal | Append-only entries with semantic search for capturing insights and decisions |
Installation
Add to ~/.config/opencode/opencode.json:
{
"plugin": ["opencode-agent-memory"]
}
Pin to a specific version:
{
"plugin": ["opencode-agent-memory@0.2.0"]
}
Memory Blocks
Default blocks seeded on first run:
| Block | Scope | Purpose |
|---|---|---|
persona | global | How the agent should behave and respond |
human | global | Details about you (preferences, habits, constraints) |
project | project | Codebase-specific knowledge (commands, architecture, conventions) |
Memory file locations:
- Global blocks:
~/.config/opencode/memory/*.md - Project blocks:
.opencode/memory/*.md(auto-gitignored)
Journal
Enable the journal for semantic search across sessions:
{
"journal": {
"enabled": true,
"tags": [
{ "name": "perf", "description": "Performance optimization work" },
{ "name": "debugging", "description": "Debugging sessions and findings" }
]
}
}
Journal config goes in ~/.config/opencode/agent-memory.json.
Semantic search uses local embeddings (all-MiniLM-L6-v2) — no data leaves your machine.
Tools
Memory Tools
| Tool | Description |
|---|---|
memory_list | List available memory blocks (labels, descriptions, sizes) |
memory_set | Create or update a memory block (full overwrite) |
memory_replace | Replace a substring within a memory block |
Journal Tools (when journal is enabled)
| Tool | Description |
|---|---|
journal_write | Write a new journal entry with title, body, and optional tags |
journal_search | Search entries semantically, filter by project or tags |
journal_read | Read a specific journal entry by ID |
Links
- GitHub Repository — Source code and issues
- Awesome OpenCode — Browse more plugins