npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

opencode-agent-memory

v0.2.0

Published

Letta-style editable memory blocks for OpenCode.

Downloads

2,944

Readme

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
  • Journal - Append-only entries with semantic search for capturing insights, decisions, and discoveries across sessions

Requirements

Installation

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": ["[email protected]"]
}

OpenCode fetches unpinned plugins from npm on each startup; pinned versions are cached and require a manual version bump to update.

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

Memory Tools

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.

Journal Tools

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.

Default Blocks

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.

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:

| 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.

Journal Configuration

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.

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.