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

@zenspc/pi-preferred-thinking

v0.2.1

Published

Model-specific thinking level preferences for Pi

Readme

@zenspc/pi-preferred-thinking

Model-specific thinking level preferences for the Pi coding agent.

Pi's built-in defaultThinkingLevel is global. This extension lets each model keep its own preferred level. Invalid or missing values are ignored.

Install

pi install npm:@zenspc/pi-preferred-thinking

Local development:

pi -e ./packages/pi-preferred-thinking
pi install ./packages/pi-preferred-thinking

Config

$PI_CODING_AGENT_DIR/extensions/preferred-thinking.json
# default:
~/.pi/agent/extensions/preferred-thinking.json

Example:

{
  "anthropic/claude-opus-4-6": "high",
  "openai/gpt-5.2": "medium",
  "google/gemini-2.5-pro": "low"
}

Keys are provider/id. Valid levels: off, minimal, low, medium, high, xhigh, max.

Rules:

  • Missing models are left alone (current/session level stays).
  • Invalid levels and malformed keys are dropped on load.
  • Malformed or missing files act like an empty map.

When preferences apply

Applied when:

  • You switch models via /model, model picker, or Ctrl+P (model_select sources set / cycle).
  • A new session starts (session_start reasons startup / new) and no CLI thinking override is present.

Not applied when:

  • Resuming, forking, or reloading a session (session history wins).
  • Startup used --thinking <level> or --model provider/id:<level>.
  • The model has no mapping, or the mapping is invalid.

Notes:

  • Pi still clamps levels to what the active model supports.
  • pi.setThinkingLevel() also updates Pi's global default thinking level (same as Shift+Tab).
  • Explicit scoped provider/model:thinking values used with --models are overwritten by a preferred mapping when you cycle to that model.

Commands

/preferred-thinking              show available subcommands (same as help)
/preferred-thinking help
/preferred-thinking show
/preferred-thinking list
/preferred-thinking set <level>
/preferred-thinking clear
/preferred-thinking reload
  • Bare /preferred-thinking and help list subcommands, levels, and the config path.
  • Tab-completes subcommands; after set, completes thinking levels.
  • show prints preferred + live level for the current model.
  • set saves the preference for the current model and applies it immediately.
  • clear removes the stored mapping only; the live thinking level is unchanged.
  • reload re-reads the JSON file from disk.

Security notes

This extension only reads and writes a local preference JSON file under the Pi agent directory. It does not make network calls, run shell commands, or handle credentials.

Untrusted config is treated as hostile input:

  • File size is capped (100_000 bytes).
  • Entry count and key length are capped.
  • Levels are allowlisted.
  • Dangerous object keys (__proto__, constructor, prototype) are rejected.
  • Parsed maps use a null prototype; lookups use own-property checks.
  • Load uses lstat and accepts only a regular file (symlinks are ignored).
  • Save writes atomically (temp file + rename), mode 0o600, and refuses to overwrite non-regular paths.
  • Failed saves leave the live thinking level unchanged and report an error.

Like all Pi extensions, it runs with full local permissions of the Pi process.

Source

extensions/preferred-thinking.ts
extensions/preferred-thinking-helpers.ts