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

@xqli02/openmem

v0.1.0

Published

Cross-session persistent memory plugin for OpenCode with 3-layer progressive disclosure

Downloads

45

Readme

openmem

npm version

OpenCode 跨会话持久记忆插件。通过 3 层渐进披露机制减少新会话的 token 开销,不依赖任何 LLM 或外部 API,记忆数据完全本地存储。

功能特性

  • 跨会话记忆持久化(SQLite + FTS5 全文搜索)
  • 3 层渐进披露:Index 自动注入 → Timeline 按需查询 → Detail 按需查询
  • 自动从 Write、Edit、Bash 工具调用中捕获记忆
  • 6 个 MCP 工具供手动管理记忆
  • 纯规则提取,无 LLM 调用,无外部 API 依赖
  • 子 Agent 会话自动跳过注入(避免递归)

安装

npm install openmem

在项目的 opencode.json 中添加:

{
  "plugins": ["openmem"]
}

工作原理

openmem 采用 3 层渐进披露架构,在 token 开销与记忆完整性之间取得平衡:

新会话启动
  └─ 第1层: Index (~500 tok) ──自动注入──▶ 系统提示词
       │   话题列表 + 近期摘要,每次会话自动可见
       └─ 第2层: Timeline ──按需调用──▶ memory_timeline
            │   指定话题的时序观察列表
            └─ 第3层: Detail ──按需调用──▶ memory_detail
                    单条记忆的完整内容

第 1 层 — Index(自动注入)

每次新会话自动向系统提示词注入约 500 token 的记忆索引,包含活跃话题列表和近期观察摘要。无需任何操作,开箱即用。

第 2 层 — Timeline(按需)

使用 memory_timeline 工具查看某个话题下按时间排序的观察列表,适合快速回顾某个功能模块的演变历史。

第 3 层 — Detail(按需)

使用 memory_detail 工具获取单条记忆的完整内容,适合查阅某次决策的详细上下文。

MCP 工具

| 工具 | 说明 | |------|------| | memory_save | 手动保存记忆观察(指定类型、话题、标题、内容) | | memory_search | 关键词全文搜索所有记忆 | | memory_timeline | 查看指定话题的时序记忆列表 | | memory_detail | 获取指定 ID 记忆的完整内容 | | memory_forget | 删除指定 ID 的记忆 | | memory_stats | 查看统计信息(总条数、话题数、存储大小) |

记忆类型

memory_save 支持以下 6 种记忆类型:

| 类型 | 说明 | 重要度 | |------|------|--------| | error_fix | 错误修复记录 | 8 | | architecture | 架构决策 | 7 | | decision | 技术决策 | 6 | | discovery | 新发现 | 5 | | preference | 偏好设置 | 4 | | context | 上下文信息 | 3 |

默认配置

当前版本使用以下默认配置,无需额外设置:

  • Token 预算:500 tokens(约 2000 字符)
  • 最大话题数:20
  • 自动捕获工具:Write、Edit、Bash、apply_patch
  • 单条记忆最大长度:2000 字符
  • 标题最大长度:100 字符

与 working-memory 的关系

| 插件 | 作用范围 | 存储方式 | |------|----------|----------| | opencode-working-memory | 当前会话内的短期记忆 | 内存 | | openmem | 跨会话的长期记忆 | SQLite |

两者定位互补,可同时使用。openmem 专注于在会话之间保留重要的决策、发现和错误修复记录。

数据存储

记忆数据存储在本地 SQLite 数据库:

{项目目录}/.opencode/openmem.db

数据完全保存在本机,不上传到任何外部服务。

License

MIT