I use OpenCode heavily, and the thing that kept biting me was continuity. Project
conventions, decisions made during a debugging session, preferences that were obvious
yesterday — all of it gone after a restart or a compaction.
The obvious fix is to write it all into flat context files, but that has its own failure
mode. My MEMORY.md sits at 309/310 words and my AGENTS.md at 699/700 — both pinned against
their limits. Once a file is full you stop recording what matters and start deleting or
relocating good rules to make room for new ones. Memory turns into a budget fight.
So I built opencode-agent-memory, which treats agent memory as scoped, sized, editable
blocks on disk instead of one flat document. It is a plugin that:
- Gives the agent memory blocks with global and per-project scope, each with a
description
telling it when the block is relevant, and an explicit limit so it cannot grow unbounded
- Exposes three tools the agent uses directly:
memory_list, memory_set, memory_replace
- Adds an optional append-only journal for observations, dead ends and decisions, with
journal_write / journal_search / journal_read
- Runs semantic search locally: entries are embedded with a local Transformers.js model
(paraphrase-multilingual-MiniLM-L12-v2, 384 dims), so nothing about your codebase or
notes leaves the machine
- Versions its embedding sidecars, so an incompatible stored dimension degrades to text
matching instead of failing the search
Install:
{
"plugin": ["@ghilteras/opencode-agent-memory@0.4.3"]
}
Requires OpenCode v1.0.115+.
Repository: https://github.com/Ghilteras/opencode-agent-memory
License: MIT
I'd be interested in feedback from other OpenCode users on what belongs in global versus
project memory, and how you'd want stale memories surfaced rather than silently applied.
AI disclosure: AI was mostly used to implement the project from my specifications. I
reviewed, tested, and deployed the result.