🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

opencode-agent-memory

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opencode-agent-memory

Letta-style editable memory blocks for OpenCode.

Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
411
-14.55%
Maintainers
1
Weekly downloads
 
Created
Source

opencode-agent-memory

Letta-style editable memory blocks for OpenCode.

Experimental

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.

Features

  • Persistent memory - Information 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

Requirements

Installation

Add to your OpenCode config (~/.config/opencode/config.json):

{
  "plugin": ["opencode-agent-memory@0.1.0"]
}

Restart OpenCode and you're ready to go.

Pin to a specific version to ensure updates work correctly - OpenCode's lockfile won't re-resolve unpinned versions. To upgrade, change the version and restart.

Local Development

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

Usage

The plugin gives the agent 3 tools for managing memory:

ToolDescription
memory_listList available memory blocks (labels, descriptions, sizes)
memory_setCreate or update a memory block (full overwrite)
memory_replaceReplace a substring within a memory block

You interact with memory by editing the markdown files directly or asking the agent to update its memory.

Default Blocks

Three blocks are seeded on first run:

BlockScopePurpose
personaglobalHow the agent should behave and respond
humanglobalDetails about you (preferences, habits, constraints)
projectprojectCodebase-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.

Memory Locations

  • Global blocks: ~/.config/opencode/memory/*.md
  • Project blocks: .opencode/memory/*.md (auto-gitignored)

Block Format

Each block is a markdown file with YAML frontmatter:

FieldTypeDefaultDescription
labelstringfilenameUnique identifier for the block
descriptionstringgenericTells the agent how to use this block
limitinteger5000Maximum characters allowed
read_onlybooleanfalsePrevent 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.

Inspiration

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.

Contributing

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

License

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

Package last updated on 19 Dec 2025

Did you know?

Socket

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.

Install

Related posts