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-model-assign

v0.1.0

Published

Pi extension that auto-assigns an executor model per task and exposes an advisor tool for high-leverage guidance.

Readme

pi-model-assign

npm version

pi-model-assign is a pi extension that automatically chooses an executor model for each user task and gives that executor an advisor tool for occasional high-intelligence guidance.

It is inspired by Anthropic's advisor strategy: a cheaper/faster executor runs the task end-to-end, while a stronger advisor model is consulted only when the executor needs help with architecture, uncertainty, repeated failures, security/correctness risk, or hard reasoning.

Install

From npm:

npm install pi-model-assign
# or
bun add pi-model-assign

@mariozechner/pi-ai and @mariozechner/pi-coding-agent are peer dependencies — pi installs them as part of its runtime.

Use as a pi extension

For a quick test, point pi at the installed entry:

pi -e ./node_modules/pi-model-assign/dist/index.js

For auto-discovery, symlink it into the global pi extensions directory:

mkdir -p ~/.pi/agent/extensions
ln -s "$PWD/node_modules/pi-model-assign" ~/.pi/agent/extensions/pi-model-assign
pi

Then use /reload after editing the config.

Develop locally

git clone <this repo>
cd pi-model-assign
bun install
bun run build      # bundles to dist/ and emits .d.ts
bun test           # runs bun's test runner (add *.test.ts files as needed)
bun run typecheck  # tsc --noEmit

For local extension testing without building:

pi -e ./index.ts

Configuration

The extension loads config from these locations, later entries overriding earlier entries:

<extension>/pi-model-assign.json
~/.pi/agent/pi-model-assign.json
<project>/pi-model-assign.json
<project>/.pi/pi-model-assign.json

The first slot resolves to the directory of the loaded extension file (i.e. node_modules/pi-model-assign/dist/ when installed from npm, or the repo root during local dev). The global and project-local files override it.

Start from the example shipped with the package:

cp node_modules/pi-model-assign/pi-model-assign.config.example.json ~/.pi/agent/pi-model-assign.json

Edit model IDs/providers to match your pi setup. The default example uses placeholder choices based on your requested setup:

  • openai/gpt-5.5 for reasoning
  • anthropic/claude-sonnet-4-6 for coding
  • blablador/fast-model for fast/cheap tasks
  • anthropic/claude-opus-4-6 as advisor/review model

If a configured model is not available or lacks an API key, pi will warn and keep the current model.

Commands

/autoassign status
/autoassign on
/autoassign off
/autoassign reload
/autoassign dry-run <prompt>

/assign status
/assign <name>        # sticky manual route
/assign once <name>   # next prompt only
/assign auto          # clear manual route

/advisor status
/advisor on
/advisor off
/advisor ask <question>

Examples:

/autoassign dry-run refactor the auth flow for SSO
/assign once reasoning
/advisor ask Is this migration plan safe?

How it works

  1. On before_agent_start, the extension classifies the user prompt using configured rules.
  2. It applies the selected route with pi.setModel() and pi.setThinkingLevel().
  3. It appends route/advisor guidance to the system prompt for that turn.
  4. It registers an advisor tool that the executor can call when it needs stronger guidance.
  5. The advisor call uses complete() with the configured advisor model and a curated recent conversation/tool context.

The advisor does not call tools or edit files. It returns guidance for the executor to use.

Rule format

Rules are evaluated by descending priority.

{
  "name": "deep-reasoning",
  "route": "reasoning",
  "priority": 80,
  "ifPromptMatches": ["architecture", "design", "/\\bprove\\b/i"],
  "ifPromptNotMatches": ["quick"],
  "ifAnyFileExists": ["package.json", "Cargo.toml"],
  "ifAllFilesExist": ["package.json", "tsconfig.json"],
  "minContextPercent": 75
}

Pattern strings are case-insensitive substring matches unless written as JavaScript-style regex strings such as /\\bsecurity\\b/i.

File existence fields:

  • ifAnyFileExists — at least one of the listed paths must exist relative to cwd (OR semantics). Renamed from the deprecated ifFilesExist.
  • ifAllFilesExist — every listed path must exist relative to cwd (AND semantics).
  • ifFilesExist — deprecated alias for ifAnyFileExists; still supported for backwards compatibility.

Route format

{
  "provider": "anthropic",
  "model": "claude-sonnet-4-6",
  "thinkingLevel": "medium",
  "tools": ["read", "bash", "edit", "write"],
  "advisor": false,
  "instructions": "Extra system prompt instructions for this route."
}
  • provider + model: selected via ctx.modelRegistry.find().
  • thinkingLevel: one of off, minimal, low, medium, high, xhigh.
  • tools: optional active tool set for this route. Omit or leave empty to allow all tools.
  • advisor: false: disables the advisor tool and guidance for that route. Omit the field to keep the advisor enabled.
  • instructions: appended to the system prompt for that route.

Notes

  • The extension avoids switching repeatedly inside a task. It chooses the executor at user-turn start; the executor can call advisor during the task.
  • /assign <name> creates a sticky manual override until /assign auto.
  • /assign once <name> affects only the next user prompt.
  • Advisor calls are budgeted by advisor.maxUsesPerTurn. Both /advisor ask commands and executor tool calls share the same per-turn budget — the remaining count is shown after each /advisor ask response.