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

@davidorex/pi-behavior-monitors

v0.4.1

Published

Behavior monitors for pi that watch agent activity and steer corrections

Downloads

628

Readme

pi-behavior-monitors

Behavior monitors for pi that watch agent activity, classify against pattern libraries, steer corrections, and write structured findings to JSON files.

Monitors are JSON files (.monitor.json) with typed blocks: classify (LLM side-channel), patterns (JSON library), actions (steer + write to JSON), and scope (main/subagent/workflow targeting).

Install

pi install npm:@davidorex/pi-behavior-monitors

Or install all three extensions at once: pi install npm:@davidorex/pi-project-workflows

On first run, if no monitors exist in your project, example monitors are seeded into .pi/monitors/. Edit or delete them to customize.

Bundled Example Monitors

  • fragility — detects when the agent leaves broken state behind (errors it noticed but didn't fix, TODO comments instead of solutions, empty catch blocks). Writes findings to .workflow/gaps.json.
  • hedge — detects when the agent deviates from what the user actually said (rephrasing questions, assuming intent, deflecting with counter-questions)
  • work-quality — on-demand audit of work quality (trial-and-error, not reading before editing, fixing symptoms instead of root causes). Invoked via /work-quality. Writes findings to .workflow/gaps.json.

File Structure

Each monitor is a triad of JSON files:

.pi/monitors/
├── fragility.monitor.json       # Definition (classify + patterns + actions + scope)
├── fragility.patterns.json      # Known patterns (grows automatically)
└── fragility.instructions.json  # User corrections (optional)

Writing Your Own

Create a .monitor.json file in .pi/monitors/ conforming to schemas/monitor.schema.json. Ask the LLM to read the pi-behavior-monitors skill for the full schema and examples.

Commands

| Command | Description | |---------|-------------| | /monitors | List all monitors, scope, and state | | /<name> | Show monitor patterns and instructions | | /<name> <text> | Add an instruction to calibrate the monitor |

How It Works

  1. A monitor fires on a configured event (e.g., after each assistant message)
  2. It checks scope (main context, subagent, workflow) and activation conditions
  3. It collects relevant conversation context (tool results, assistant text, etc.)
  4. A side-channel LLM call classifies the context against the JSON pattern library
  5. Based on the verdict, the monitor executes actions:
    • steer: inject a correction message into the conversation (main scope only)
    • write: append structured findings to a JSON file (any scope)
    • learn: add new patterns to the library automatically
  6. Downstream workflows can consume the JSON findings (e.g., gaps.json → verify step → gate)

Schemas

  • schemas/monitor.schema.json — monitor definition format
  • schemas/monitor-pattern.schema.json — pattern library entry format

Development

Part of the pi-project-workflows monorepo. All three packages (pi-project, pi-workflows, pi-behavior-monitors) are versioned in lockstep at 0.2.0.

npm run build compiles TypeScript to dist/ via tsc. The package ships dist/, not src/. Tests use vitest run (npm test).