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-prompt-recorder

v1.6.0

Published

OpenCode plugin for recording user prompts. Automatically saves user messages to a local file system with organized directory structure.

Readme

opencode-prompt-recorder

一个用于记录用户提示词的 OpenCode 插件。自动将用户消息保存到本地文件系统,并按目录结构组织。

功能特性

  • ✨ 自动捕获聊天对话中的用户提示词
  • 📁 有组织的文件存储:.agent/prompts/yyyy/MM/dd/ 目录结构
  • 🏷️ 基于会话的组织:每个对话会话单独跟踪
  • 📝 丰富的元数据:包含时间戳、会话 ID 和提示词主题
  • 🔄 会话持久化:追加到现有文件以继续对话
  • 🛡️ 安全的文件名处理:清理文件名以防止文件系统错误

安装

npm install -g opencode-prompt-recorder
# 或
bun add -g opencode-prompt-recorder

使用方法

将插件添加到你的 opencode.json

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-prompt-recorder"],
}

工作原理

  1. 插件监听 OpenCode 消息事件(message.updatedmessage.part.updated
  2. 每次用户消息时,提取提示词文本和会话 ID
  3. 提示词保存到 .agent/prompts/ 目录,按日期组织
  4. 每个提示词保存为带有时间戳和会话信息的 markdown 文件

文件结构

插件创建有组织的目录结构:

.agent/
└── prompts/
    └── 2026/
        └── 03/
            └── 04/
                ├── 20260304-0943-ses_abc123-什么是AI.md
                ├── 20260304-1005-ses_def456-如何编程.md
                └── 20260304-1120-ses_ghi789-复制README.md

文件格式

每个提示词文件遵循以下格式:

============ 10:05 ============

什么是 AI?

============ 10:50 ============

如何编写 hello world 程序?

配置

无需额外配置。插件将自动:

  • 保存到项目根目录的 .agent/prompts/ 目录
  • 使用当前工作目录作为基础路径
  • 根据需要创建目录

会话管理

  • 每个唯一的 sessionId 获得自己的文件
  • 相同的会话 ID 追加到现有文件
  • 不同的会话 ID 创建新文件
  • 会话 ID 来自 message.part.updated 事件输入
  • 跨天合并:无论何时,只要 sessionId 相同,都会追加到同一文件(自动搜索所有日期目录)

使用场景

  • ✅ LLM 交互的审计跟踪
  • ✅ 训练数据收集和标注
  • ✅ 会话历史和对话回放
  • ✅ 质量保证和监控
  • ✅ 研发洞察

依赖要求

  • OpenCode v0.15.0 或更高版本
  • Node.js 或 Bun 运行时
  • 项目目录的文件系统写入权限

故障排除

提示词未被记录

  • 确保插件已列入 opencode.json 配置
  • 检查项目目录的写入权限
  • 验证 .agent/prompts/ 目录正在创建

文件名包含特殊字符

  • 插件会自动清理文件名,移除非法字符
  • 文件名截断至最多 50 个字符
  • 如果提示词过长,文件名只使用前 50 个字符

许可证

MIT