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-auto-classifier

v2.0.0

Published

Pi extension that classifies every final assistant reply against markdown output rules and asks the model to rewrite violations. Install rules from the catalog with /classifier-install.

Downloads

1,519

Readme

pi-auto-classifier

A pi extension that checks every final assistant reply against markdown output rules, and every tool call against markdown tool rules. It hides the draft while the model streams, withholds replies that violate the rules, and asks the model to rewrite them. It keeps asking for rewrites until the reply passes. Classifier errors fail open.

No rules load by default. Install rules from the catalog with /classifier-install, or write your own.

Install

pi install npm:pi-auto-classifier

Or add a local checkout to ~/.pi/agent/settings.json:

{
  "extensions": ["/path/to/pi-auto-classifier/src/index.ts"]
}

Usage

  • /classifier-install — pick a rule from the catalog in this repo and install it to ~/.pi/agent/output-rules/. Uninstall by deleting the file.
  • /classifier — open the toggle menu: the first row turns the whole classifier on/off, each other row turns one rule on/off. Esc closes it.
  • The status bar shows the current state and the number of active rules
  • Toggles last for the session. Press s in the menu to save them to ~/.pi/agent/auto-classifier.json, so new sessions start with the same rules off.
  • A withheld reply leaves one muted line in the chat: Withheld by classifier. rule: <rules>. Press the expand key (ctrl+o by default) to read the reasons.

Rules

Rules are markdown files — plain prose the classifier model can judge against. All .md files in these directories load:

| Location | Scope | | --- | --- | | ~/.pi/agent/output-rules/ | output rules, all projects | | <project>/.pi/output-rules/ | output rules, per project | | ~/.pi/agent/tool-rules/ | tool rules, all projects | | <project>/.pi/tool-rules/ | tool rules, per project |

A rule that fails only once

Some rules are a matter of degree, so the model and the judge can disagree forever. Optional YAML frontmatter caps a rule at one failure per user turn:

---
once: Make your reply much shorter, like a TLDR, remove trivia and all unnecessary details
---

# TLDR
...

The first violation asks for a rewrite and sends the once text as the reason, instead of whatever the judge wrote. Later violations of that rule are dropped for the rest of the turn, so the reply ships when no other rule fails. The next user message re-arms the rule. Write once: with no text to cap the rule but keep the judge's own reason. The catalog's TLDR rule uses this.

Tool rules

When tool rules exist, the classifier judges every tool call before it runs. A violation blocks the call and sends the violation text back to the model as an instruction, so the model changes course without asking you.

No tool rules are bundled. Write your own, for example a rule that blocks git switch and git checkout -b and orders the agent to use a worktree.

Tool rules cost one classifier call per tool call, so keep the rule set small.

The user overrides a rule

A block runs a second check. The classifier reads your last message. It passes the call when you asked for that action yourself, so "switch branch" performs the switch even under a rule that blocks branch switches.

A rule can refuse the override with one line:

Block this action even when the user asks for it.

Configuration

Classifier model, resolved in this order:

  1. PI_AUTO_CLASSIFIER_MODEL env var
  2. <project>/.pi/auto-classifier.json{ "model": "..." }
  3. ~/.pi/agent/auto-classifier.json{ "model": "..." }
  4. Default: anthropic/claude-haiku-4-5

Set PI_AUTO_CLASSIFIER_DEBUG=/path/to/log to log classifier verdicts and errors.

Contributing a rule

The catalog is the rules/ directory in this repo. /classifier-install lists it live from GitHub, so a merged rule is available to everyone immediately, without a package release. See CONTRIBUTING.md.

Development

Code lives in src/: index.ts (the extension), test.ts (unit tests), dev.ts (local dev runner), no-comments.ts (lint script). See CONTRIBUTING.md.