joshuadavidthomas/opencode-agent-memory
Memory blocks for OpenCode, inspired by Letta.
What it solves
It provides AI agents in OpenCode with persistent, self-editable long-term memory. This prevents the agent from forgetting critical information across different sessions or when the conversation history is compacted, allowing it to maintain a consistent persona and remember project-specific conventions.
How it works
The plugin implements a system of "memory blocks" and a "journal" stored as markdown files on disk.
- Memory Blocks: These are scoped files (global or project-specific) containing metadata and content. The agent is given a set of tools (
memory_list,memory_get,memory_set,memory_replace) to read and update these blocks autonomously. To maintain prompt cache stability, memory is snapshotted at the start of a session and refreshed only after context compaction. - Journal: An opt-in, append-only log where the agent can record insights and decisions. It uses local embeddings (
all-MiniLM-L6-v2) to enable semantic search across entries without sending data off-machine.
Who it’s for
Developers using OpenCode who want their AI coding assistants to remember user preferences, architectural decisions, and learned patterns across multiple sessions and projects.
Highlights
- Self-Editing: Agents can actively manage their own memory using dedicated tools.
- Scoped Memory: Supports both global memory (across all projects) and project-specific memory.
- Cache-Friendly: Uses snapshots to avoid repeatedly invalidating the provider's prompt cache.
- Local Semantic Search: The journal allows the agent to retrieve past insights using local embeddings.
- Budget Management: Includes a
memory_oversizedtool to help the agent identify and compact blocks that exceed their character limits.
Related
- Project
- Project
- Project
- Project
- Project