
Security News
Ruby's Bundler 4.0.18 Extends Cooldown to bundle lock and bundle cache
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.
opencode-agent-memory
Advanced tools
Letta-style editable memory blocks for OpenCode.
This plugin is experimental. The core idea - giving the agent persistent, self-editable memory blocks - is adapted from Letta. Specifially, the plugin follows Letta's shared memory blocks pattern - the markdown files on disk are shared state that every OpenCode session can read and write.
Think of it as AGENTS.md with a harness. OpenCode supports rules via AGENTS.md and custom instruction files - this plugin is similar in spirit, but 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. The content is similar; the scaffolding around it is what's different.
For background on the memory concept, see Letta's docs on memory and memory blocks.
Add to your OpenCode config (~/.config/opencode/opencode.json):
{
"plugin": ["opencode-agent-memory"]
}
Restart OpenCode and you're ready to go.
Optionally, pin to a specific version for stability:
{
"plugin": ["opencode-agent-memory@0.2.0"]
}
OpenCode fetches unpinned plugins from npm on each startup; pinned versions are cached and require a manual version bump to update.
If you want to customize or contribute:
git clone https://github.com/joshuadavidthomas/opencode-agent-memory ~/.config/opencode/opencode-agent-memory
mkdir -p ~/.config/opencode/plugin
ln -sf ~/.config/opencode/opencode-agent-memory/src/plugin.ts ~/.config/opencode/plugin/memory.ts
The plugin gives the agent 3 tools for managing memory:
| 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 |
You interact with memory by editing the markdown files directly or asking the agent to update its memory.
When the journal is enabled, the agent gets 3 additional tools:
| 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, with pagination |
journal_read | Read a specific journal entry by ID |
Journal entries are append-only markdown files with YAML frontmatter, stored in ~/.config/opencode/journal/. Each entry records which project, model, provider, agent, and session it was written from. Semantic search uses local embeddings (all-MiniLM-L6-v2) - no data leaves your machine.
Three blocks are 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) |
These are just starting points. Create whatever blocks make sense for your workflow - debugging-notes, api-preferences, learned-patterns, etc.
~/.config/opencode/memory/*.md.opencode/memory/*.md (auto-gitignored)Each block is a markdown file with YAML frontmatter:
| Field | Type | Default | Description |
|---|---|---|---|
label | string | filename | Unique identifier for the block |
description | string | generic | Tells the agent how to use this block |
limit | integer | 5000 | Maximum characters allowed |
read_only | boolean | false | Prevent agent from modifying |
All fields have defaults for graceful degradation, but description is essential - without it, the agent gets a generic fallback and won't know how to use the block effectively. See Letta's docs on the importance of the description field.
The journal is opt-in. Enable it in ~/.config/opencode/agent-memory.json:
{
"journal": {
"enabled": true
}
}
You can optionally suggest tags to guide the agent's classification:
{
"journal": {
"enabled": true,
"tags": [
{ "name": "perf", "description": "Performance optimization work" },
{ "name": "debugging", "description": "Debugging sessions and findings" }
]
}
}
Tags are free-form strings - the agent can use any tag, not just the suggested ones. Suggested tags appear in the system prompt to provide guidance.
The memory architecture and philosophical framing are adapted from Letta (formerly MemGPT), a framework for building LLM agents with editable long-term memory.
Also worth exploring: private-journal-mcp by Jesse Vincent, which gives Claude a private journaling capability to process feelings and thoughts. His blog post about it explores similar territory around AI self-reflection and persistent inner experience.
Contributions are welcome! Here's how to set up for development:
git clone https://github.com/joshuadavidthomas/opencode-agent-memory
cd opencode-agent-memory
bun install
Then symlink the plugin to your OpenCode config:
mkdir -p ~/.config/opencode/plugin
ln -sf "$(pwd)/src/plugin.ts" ~/.config/opencode/plugin/memory.ts
opencode-agent-memory is licensed under the MIT license. See the LICENSE file for more information.
opencode-agent-memory is not built by, or affiliated with, the OpenCode team.
OpenCode is ©2025 Anomaly.
FAQs
Letta-style editable memory blocks for OpenCode.
The npm package opencode-agent-memory receives a total of 421 weekly downloads. As such, opencode-agent-memory popularity was classified as not popular.
We found that opencode-agent-memory demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.