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

pi-switch-model

v0.1.0

Published

Free-form, LLM-driven model switching for Pi — resolve a free-text model reference and switch mid-conversation, no approval loop, no auto-restore

Readme

Switch Model for Pi

A single switch_model tool for pi that lets the active model switch itself mid-conversation, on request, in plain language — "implement this with 5.6 sol", "switch to fable" — with no approval loop and no automatic restore. You stay on whatever model you switch to until you (or the model) call it again.

This is deliberately simpler than role-locked workflows like pi-duo's executor/reviewer setup (derived from jnsahaj/trio): there's no phase state machine, no tool-locking, no session bookkeeping. It's one tool that resolves a free-text model reference and calls pi.setModel().

Human-driven switching is already covered by pi core's built-in /model command; this package only adds the LLM-facing half.

Install

pi install npm:pi-switch-model

For local development against this checkout instead of the published package:

pi -e /path/to/pi-extensions/switch-model

Usage

Just ask, mid-conversation:

switch to 5.6 sol and implement this

The active model calls switch_model({ query: "5.6 sol" }), which resolves the query against your configured/authenticated models and switches. The rest of the conversation — history, working tree, tools — is untouched; only the model changes, and it stays changed.

Resolution

  • Exact provider/id always wins outright.
  • Otherwise the query is fuzzy-matched against every available model's provider/id and display name.
  • One strong match → switches immediately.
  • No match → fails with a ModelNotFoundError-style message listing the closest suggestions (capped at 8) so the calling model can retry with an exact id.
  • Multiple matches → fails listing the tied candidates so the calling model can pick precisely.

This retry-on-error contract is the whole safety net: the tool never guesses on your behalf, and a wrong first guess self-corrects in one retry because the error itself carries the real list of available models.

Develop

npm run typecheck   # tsc --noEmit
npm test             # node --test test/core.test.ts

All resolution and formatting logic lives in src/core.ts and is pure (no ExtensionContext, no host imports) — that's the tested seam. src/index.ts is thin wiring: it maps the model registry into ModelSummarys, calls resolveModel, and turns a failure into a thrown Error so the host reports it back to the calling model as a tool error.