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-skill-deduper

v0.1.4

Published

OpenCode plugin that elides older duplicate skill content before model requests

Readme

OpenCode Skill Deduper

npm version npm downloads License: MPL-2.0

Latest in v0.1.4 | v0.1.4 最近更新

  • Atomically records notified elisions so the same skill block is only logged and toasted once across plugin reloads or concurrent plugin instances | 原子记录已提示的压缩记录,插件重载或并发插件实例下同一个 skill 块也只记录和提示一次
  • Keeps file logs and TUI notifier quiet unless a newly elided skill part appears | 只有出现新的已压缩 skill 片段时才写文件日志并显示 TUI notifier
  • Continues avoiding terminal/stdout output from console.*, client.app.log, and session-message paths | 继续避免 console.*client.app.log 和 session 消息路径产生终端/stdout 输出

中文 | English


中文

OpenCode 中自动压缩重复加载的 skill 正文。同一个 skill 多次进入上下文时,插件会在发送模型请求前保留最新完整副本,并把更早的重复副本替换成短提示,减少长会话里的上下文浪费。

它只作用于 OpenCode 的 experimental.chat.messages.transform 请求转换阶段:不会改写本地 session 历史,也不会删除最新的 skill 指令。

功能一览

  • 保留最新副本 — 每个 skill 只保留最新一次完整内容
  • 压缩旧副本 — 旧的重复 skill 正文会被替换成短占位文本
  • 兼容原生 OpenCode — 支持 <skill_content name="..."> 形式的 skill 输出
  • 兼容 OmO / Oh My OpenCode — 支持 ## Skill: ... 形式的 skill 输出
  • 兼容 slash 注入 — 当 <skill-instruction> 内容中包含 skill 路径时,也能识别对应 skill 名
  • 可观察记录 — 真的压缩内容时写入文件日志并通过 TUI notifier 显示摘要;不会写入 stdout、不会调用 OpenCode app log,也不会追加 session 消息

安装

选项 A:让 LLM 帮你安装

把下面这段话丢给任意 LLM(OpenCode / Claude Code / Cursor 等):

请先查看 opencode-skill-deduper 最新 GitHub Release 正文里的“升级方式”,然后严格执行其中带明确版本号的安装/升级命令。默认应使用带 `-g/--global` 的全局命令来更新你平时实际在用的 OpenCode 实例;只有你明确想改当前项目目录下的 `.opencode` 时,才省略 `-g`。不要手动编辑 OpenCode 配置,也不要使用裸包名或 latest。参考说明:https://github.com/jiwangyihao/opencode-skill-deduper/releases/latest

选项 B:手动安装

  1. 先查看最新 GitHub Release## 升级方式 小节。

  2. 执行其中带明确版本号的全局命令。例如当前版本是:

    opencode plugin [email protected] --force -g
  3. 如果你是刻意只想改当前项目目录下的 .opencode,才使用不带 -g 的局部命令;否则默认不要省略 -g

  4. 如果升级后看起来仍然没有变化,先清理 OpenCode 插件缓存,再重新执行同一条带版本号命令。

    rm -rf ~/.cache/opencode/packages/opencode-skill-deduper@*
  5. 如果 OpenCode 已在运行,重启后再验证

步骤指引

  1. 先读取本仓库最新 GitHub Release 正文,提取其中 ## 升级方式 给出的带明确版本号命令。

  2. 直接执行那条命令。默认应使用带 -g/--global 的全局命令来更新用户平时实际在用的 OpenCode 实例;如果用户明确只想改当前项目目录下的 .opencode,才省略 -g。例如当前版本:

    opencode plugin [email protected] --force -g
  3. 不要手动编辑 OpenCode 配置来安装或升级这个插件,也不要使用裸包名或 latest

  4. 如果执行后版本看起来仍然没更新,先清理 OpenCode 插件缓存,再重新执行同一条带版本号命令:

    rm -rf ~/.cache/opencode/packages/opencode-skill-deduper@*
  5. 如果 OpenCode 已在运行,重启后再验证。

验证

加载同一个长 skill 两次后,文件日志中应出现类似记录:

~/.config/opencode/logs/skill-deduper/daily/YYYY-MM-DD.log
2026-05-05T00:00:00.000Z INFO  skill-deduper: elided duplicate skill content | {"elided":1,"savedChars":4099,"skills":[{"name":"using-superpowers","elided":1,"savedChars":4099}]}

同时,TUI notifier 会显示一条不进入 session 消息历史的通知,文本类似:

[skill-deduper] Elided duplicate skill content before this request.

Elided blocks: 1
Saved characters: 4099
Skills:
- using-superpowers: 1 elided, 4099 chars saved

说明:最新 OpenCode 当前不会总是主动刷新已缓存的 npm 插件。安装或升级时优先以最新 GitHub Release 正文里的 ## 升级方式 为准;默认应走带 -g 的全局命令,只有明确想改当前项目 .opencode 时才省略 -g


使用方式

安装后无需额外命令。插件会在 OpenCode 发起模型请求前检查消息内容:

Message 1: full using-superpowers skill content
Message 2: full using-superpowers skill content

转换后:

Message 1: [skill-deduper] Skill using-superpowers was reloaded later; older copy elided (... chars).
Message 2: full using-superpowers skill content

最新副本仍保持完整,所以模型仍能看到当前有效的 skill 指令。

适合谁使用

  • 经常在同一个 OpenCode 会话里重复加载 Superpowers、OmO skills 或其他长 skill 的用户
  • 经常使用 slash command、原生 skill 工具或多代理工作流的用户
  • 希望减少重复 skill 正文挤占上下文窗口的用户

注意事项

  • 插件只识别以明确 skill 标记或 skill 路径开头的内容,不会压缩任意重复文本。
  • 用户粘贴的对话转录或任务说明即使包含 slash command、## Skill: 等字样,也会按普通用户内容保留。
  • 插件只影响发往模型的请求,不改写 OpenCode 存储的 session 历史。
  • OpenCode 的 experimental.chat.messages.transform hook 仍是实验接口,后续 OpenCode 版本可能调整插件 API。

English

Automatically elide repeated skill bodies in OpenCode. When the same skill appears more than once in the request context, this plugin keeps the newest full copy and replaces older copies with a compact marker before the model request is sent.

It only runs in OpenCode's experimental.chat.messages.transform phase. It does not rewrite stored session history and does not remove the newest skill instructions.

What You Get

  • Newest copy kept — each skill keeps its latest full body
  • Older copies elided — repeated earlier skill bodies become compact placeholders
  • Native OpenCode support — recognizes <skill_content name="..."> skill output
  • OmO / Oh My OpenCode support — recognizes ## Skill: ... skill output
  • Slash-injected support — recognizes <skill-instruction> blocks when the skill path exposes the skill name
  • Observable records — writes elided duplicate counts and saved characters to a file log and shows a TUI notifier summary without using stdout, OpenCode app log, or appended session messages

Installation

Option A: Let an LLM do it

Paste this into any LLM agent (OpenCode, Claude Code, Cursor, etc.):

First read the latest GitHub Release for opencode-skill-deduper and execute the exact versioned install/upgrade command from its "Upgrade / 升级方式" section. By default, use the global command with `-g/--global` so you update the OpenCode instances you actually run; omit `-g` only if you intentionally want to change the current project's `.opencode`. Do not manually edit the OpenCode config, and do not use a bare package name or latest. Reference: https://github.com/jiwangyihao/opencode-skill-deduper/releases/latest

Option B: Manual setup

  1. Read the latest GitHub Release and look for the ## Upgrade section.

  2. Run the exact versioned global command from that section. For the current version, the command is:

    opencode plugin [email protected] --force -g
  3. Only omit -g if you intentionally want to update the current project's .opencode instead of the global OpenCode config.

  4. If an upgrade still looks stale, clear the OpenCode plugin cache and rerun the same versioned command:

    rm -rf ~/.cache/opencode/packages/opencode-skill-deduper@*
  5. If OpenCode is already running, restart it before verification.

Step-by-Step Instructions

  1. Read the latest GitHub Release body for this repository and extract the exact versioned command from ## Upgrade / 升级方式.

  2. Execute that command directly. By default, use the global command with -g/--global; only omit -g if you intentionally want to update the current project's .opencode. For the current version:

    opencode plugin [email protected] --force -g
  3. Do not install or upgrade this plugin by hand-editing the OpenCode config, and do not use a bare package name or latest.

  4. If the installed version still does not change, clear the OpenCode plugin cache and rerun the same versioned command:

    rm -rf ~/.cache/opencode/packages/opencode-skill-deduper@*
  5. If OpenCode is already running, restart it before verification.

Verification

After loading the same long skill twice, the file log should include a record similar to:

~/.config/opencode/logs/skill-deduper/daily/YYYY-MM-DD.log
2026-05-05T00:00:00.000Z INFO  skill-deduper: elided duplicate skill content | {"elided":1,"savedChars":4099,"skills":[{"name":"using-superpowers","elided":1,"savedChars":4099}]}

The TUI notifier also shows a notification that does not enter session message history, similar to:

[skill-deduper] Elided duplicate skill content before this request.

Elided blocks: 1
Saved characters: 4099
Skills:
- using-superpowers: 1 elided, 4099 chars saved

Note: Current OpenCode does not always refresh cached npm plugins automatically. Prefer the exact versioned command from the latest GitHub Release. By default, that command should include -g; without -g, you are only changing the current project's .opencode.


Usage

No extra command is required after installation. The plugin checks outgoing OpenCode model requests:

Message 1: full using-superpowers skill content
Message 2: full using-superpowers skill content

After transform:

Message 1: [skill-deduper] Skill using-superpowers was reloaded later; older copy elided (... chars).
Message 2: full using-superpowers skill content

The newest copy remains intact, so the model still receives the current skill instructions.

Who Should Use This

  • Users who repeatedly load Superpowers, OmO skills, or other long skills in one OpenCode session
  • Users who rely on slash commands, native skill calls, or multi-agent workflows
  • Users who want to reduce duplicated skill text in the request context

Notes

  • The plugin only detects content that starts with recognizable skill markers or skill directory paths.
  • It does not deduplicate arbitrary repeated prose.
  • User-pasted transcripts or task prompts stay intact even when they mention slash commands, ## Skill:, or similar skill-looking text.
  • It only affects outgoing model requests, not stored OpenCode session history.
  • OpenCode's experimental.chat.messages.transform hook is experimental, so future OpenCode versions may change the plugin API.

License

MPL-2.0 License. See LICENSE for details.