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

@specode/pi-last-model-effort

v1.0.1

Published

Remember the last thinking effort used by each model in Pi.

Readme

pi-last-model-effort

English

一个小型 Pi 扩展:按模型记住最近实际使用的 thinking / reasoning effort,并在切换回来时自动恢复。

为什么需要它

不同模型通常适合不同的推理档位。Pi 可以配置默认值,但在多个模型之间切换时,仍可能需要反复调整 thinking level。这个扩展会把每个模型最近实际使用的档位保存为轻量、跨会话的偏好。

功能

  • 按 provider/model 独立记忆 thinking effort。
  • 切换回某个模型时恢复其最近档位。
  • 在全新的 Pi 会话中恢复最近选择的模型。
  • pi -c、/resume、fork、clone 和 reload 保留目标会话自己的模型与 effort。
  • 尊重显式 --model、--provider 和 --thinking 命令行参数。
  • 尊重 enabledModels、--models 以及 scoped model 条目固定的 effort。
  • 通过 Pi 原生 setThinkingLevel() 恢复,因此不支持的档位会按照模型能力安全收敛。
  • 使用文件锁、按时间戳合并和原子替换,支持多个 Pi 进程并发运行。
  • 支持 TUI、RPC、JSON 和 print 模式。
  • 忽略带有 PI_SUBAGENT_CHILD=1 标记的 Pi 进程,避免子 Agent 的固定 effort 污染主会话偏好。

安装

从 npm 安装:

pi install npm:@specode/pi-last-model-effort

也可以不安装,只临时试用一次:

pi -e npm:@specode/pi-last-model-effort

也可以直接从 GitHub 安装:

pi install git:github.com/specode/pi-last-model-effort

安装后重启 Pi,无需额外配置。

行为

| 场景 | 行为 | | --- | --- | | 全新的 pi 会话或 /new | 恢复最近模型及其已记忆 effort | | 切换或循环选择模型 | 恢复目标模型最近使用的 effort | | pi -c、/resume、fork、clone、reload | 保留目标会话自己的模型和 effort | | 显式指定 CLI 模型或 effort | 命令行选择优先 | | scoped model 固定了 effort | scoped effort 优先 | | 模型不可用或缺少认证 | 保留 Pi 当前选择并显示警告 |

Pi 根据模型能力收敛后的实际档位,会成为该模型新的记忆值。

状态文件

状态独立于 Pi 设置和会话文件保存:

~/.pi/agent/state/last-model-effort.json

实际位置会跟随 Pi 配置的 agent 目录。可通过 PI_LAST_MODEL_EFFORT_STATE 覆盖完整文件路径,主要用于测试或隔离环境。

扩展不会修改 Pi 的 modelThinkingLevels 设置,也不会发起网络请求。

兼容性

扩展仅使用 Pi 的公开扩展 API,并已在 Pi 0.84.3 上验证。按照 Pi package 的建议,@earendil-works/pi-coding-agent 被声明为 peer dependency。

开发

运行测试:

npm test

验证 Pi 能够加载扩展:

npm run smoke

许可证

MIT