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

@ssk_dev/pi-docs-slim

v0.4.2

Published

Keep Pi's built-in documentation guidance out of the system prompt unless you ask for it with /pi. Fork of pi-slim, updated for Pi 0.87.1+ (tested on 1.4).

Readme

@ssk_dev/pi-docs-slim

看看我的完整 Pi 配置

English

一个 Pi 扩展,把 Pi 默认附带的文档说明从系统提示词里去掉。真要问 Pi 本身的问题时,用 /pi 提问,这一次会把文档说明带回来。

本项目 fork 自 Rob Zolkos 的 robzolkos/pi-slim。思路和 /pi 命令都来自原版,fork 主要是为了让它能在新版 Pi 上正常工作。

安装

pi install npm:@ssk_dev/pi-docs-slim

如果装过原版 pi-slim,先卸载。两个扩展都会注册 /pi 命令。

需要 Pi 0.87.1 或更新版本(已在 0.87.1、1.2.0、1.3.0、1.4.0 和 1.5.0 上测试,并在 Pi-Bolt 上做过端到端验证)。

使用

  • 普通请求:模型看不到 Pi 的文档说明。
  • /pi <关于 Pi 的问题>:文档说明改放在这条消息的开头,不再进系统提示词;工具调用的轮次同样带着它;文档说明真正放进请求后,transcript 里这条消息和回复之间会出现一行 📖 pi-docs 标记,指出是哪次运行带了它;下一条普通请求恢复清理。
  • 你自己写的 <docs>、项目指令和代码示例不动;保存下来的用户消息、助手回答和工具输出一律不改(/pi 只在发出的请求里加文档说明)。

安装或更新后执行 /reload,发一条普通消息,再看看 /context。

为什么要 fork

原版 0.2.1 靠替换系统提示词里的一段字符串来去掉文档说明。Pi 0.87.1 开始,系统提示词改成按结构化的 section 拼出来,并保存成 system 消息,这种替换就不起作用了,文档说明照样会发给模型(见 pi-slim#3)。

这个 fork 改了这些:

  • 在新的结构化提示词里去掉文档说明。 不让 Pi 把 docs section 重新填回来,每条请求发出前都会把文档说明去掉。保存下来的 system 消息里会留一个很短的 <!-- pi-slim:omit --> 标记:Pi 每次请求都拿 transcript 里的 section 做 diff,如果这里清空,它就会给每条请求追加一条空的 system 消息。
  • 旧历史也清理。 之前 /pi 留下的文档说明,在后面的普通请求里会被去掉。
  • 跟着 Pi 的措辞走。 Pi 不同版本的文档说明写法不一样(Pi 1.5 改了措辞,Pi-Bolt 这类构建还会加自己的行),所以扩展不写死这段文字:每次运行时读出当前 Pi 实际生成的原文,只删和它完全一致的 <docs> 块。1.5 之前的旧措辞仍然认得,用来清理旧会话。
  • /context 与加载顺序无关。 不管 pi-context-view 排在本扩展之前还是之后,它都不会显示 Pi 文档说明,也不会把提示词误标成 forced(省略标记见“限制”)。
  • /pi 更可靠。 “保留文档”的许可只绑定到 /pi 发出的那一次请求;就算这次请求被拦截,也不会漏到你的下一条消息。
  • /pi 不再打断 prompt cache。 多数 provider 把系统提示词放在请求最开头,以前把文档说明塞回系统提示词,就得让 provider 把整个会话重新算一遍缓存:一次 /pi 连着丢两次(/pi 那次,加上后面第一条把文档关掉的普通请求)。现在每条请求的系统提示词完全一致,/pi 之前的缓存前缀都保得住。新增的只有 /pi 这一轮本身:约 500 token 的文档说明,以及下一条普通请求不再带说明,要把这一轮重新算一次。
  • 提示词不会被冻结。 其他扩展后来加的工具和规则照样生效。
  • 加了离线集成测试。 用真实的 Pi 会话加离线模型 provider 跑,不调用模型服务。

没有新增运行时依赖。

测试

npm test

测试需要装好 Pi 0.87.1 以上版本和 pi-context-view 0.6.0 或 0.8.0。默认找全局的 Pi 和 ~/.pi/agent/npm/node_modules/pi-context-view;装在别处的话,指向包的根目录:

PI_CODING_AGENT_DIR=/path/to/pi-coding-agent PI_CONTEXT_VIEW_DIR=/path/to/pi-context-view npm test

设置 PI_SLIM_ENTRY 可以拿这套测试去跑别的实现。

要对真实的 Pi 可执行文件做端到端检查(比如措辞和 npm 版不同的构建),运行 node tests/host-e2e.mjs <pi 的路径>。它会用临时的 agent 目录和假的模型服务,以 RPC 模式启动这个程序,依次发一条普通消息、一条 /pi 消息、再一条普通消息,检查模型服务实际收到的内容;另外还会测一遍“更早加载的扩展强制指定提示词”的情况。它不会动你的设置,也不调用任何模型服务。

限制

  • 不改写旧的会话文件。/context 的 Usage 视图在下一条普通请求后就是干净的。Initial 视图是第一次请求时的快照,要重新加载才会更新;如果第一次请求用的是 /pi,里面有文档说明是正常的。
  • /pi 运行期间,/context 会把文档说明显示成那条消息的内容(约 500 token)。它只加在请求里:保存下来的会话仍是你原样输入的问题,后面的请求也不会带上它。
  • 📖 pi-docs 标记是会话里的一条 CustomEntry:Pi 不会把 custom entry 放进模型上下文,所以它不占 prompt token,/context 也不会统计它,重新加载后仍然在。它在这次运行的消息保存之后才写入,所以从那条消息 fork 或用 /tree 回退时不会带上它,压缩时的切分位置也和没有它时一样。token 数只是粗略估算;排在本扩展之后、还会改请求的扩展仍可能改变实际发出的内容。
  • 保存下来的会话会在 docs section 里留一个约 20 字符的省略标记,这样 Pi 每次请求的 section diff 才能稳定。标记在每条请求发出前都会去掉,不会发给模型,但 /context 可能把它算进去(约 5 token):pi-context-view 0.6.0 读的是保存的 transcript,0.8.0 排在本扩展之前加载时,会在清理之前截取请求。这是 pi-context-view 对排在它后面的处理器的既定行为(见它的 capture 文档),不需要调整加载顺序。
  • 模型自己用工具去读 Pi 文档,读到的内容会保留。
  • 清理逻辑依赖 Pi 0.87.1 的事件顺序,升级 Pi 后要重跑测试。如果别的扩展在最后一步上下文处理之后又塞回文档说明,这里清不掉。

许可证

MIT。原作品版权归 pi-slim contributors(Rob Zolkos)所有,见 LICENSE。