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

@supierior/pi-rules

v0.1.0-beta.0

Published

Pi package for generating, injecting, and maintaining path-scoped project rules in .pi/rules.

Readme

@supierior/pi-rules

Pi package for creating and maintaining project-specific rules under .pi/rules/.

What it provides

  • init-advanced skill: bootstraps AGENTS.md and .pi/rules/**/*.md for a project.
  • hidden rules-maintainer skill: loaded with disable-model-invocation: true, so it is available to commands/background events but hidden from normal model skill discovery.
  • pi-rules extension: provides Pi commands, status tooling, and turn-scoped rule injection.

Commands

  • /pi-rules:init — invoke the init-advanced skill.
  • /pi-rules:maintain <changed-file> [more-files...] — manually run the hidden rules-maintainer skill in the background.
  • /pi-rules:status — inspect discovered AGENTS.md and .pi/rules files.
  • /pi-rules:context — show which rules were injected for the last turn.
  • /pi-rules:maintainer-status — show background maintainer PID, lock, and queue status.
  • /pi-rules:maintainer-log — show the tail of .pi/.pi-rules/maintainer.log.
  • /pi-rules:maintainer-kill — terminate a stuck maintainer process, clear its lock, and start the next queued batch if present.

Context injection behavior

The extension indexes .pi/rules/**/*.md and uses rule metadata to inject relevant context at the start of a turn.

Rules files should use:

---
kind: rules
paths:
  - 'src/path/**/*'
summary: One sentence routing summary.
triggers:
  - natural language task phrase
---

Inventory files should live beside rules as inventory.md and use kind: inventory. Inventories are discoverable and listed when relevant, but are not injected by default.

Current injection policy:

  • inject the most-specific matching child rule fully
  • include parent rules as summaries only
  • list sibling inventories as available
  • skip injection when the prompt does not look code-edit/code-navigation related

Background maintenance

The extension tracks successful built-in write and edit tool calls during a main-agent turn, plus common successful bash removals and renames. It also compares git status --porcelain at agent_start/agent_end to catch git-visible changed, deleted, and renamed files from shell commands. On agent_end, it starts a separate non-interactive Pi process with the hidden rules-maintainer skill and the detected path list.

Maintenance state is written under .pi/.pi-rules/:

  • queue.json — pending changed-file batches
  • maintainer.log — background process output
  • maintainer.lock — legacy lock state used for compatibility/stale-run recovery
  • active-runs.json — active maintainer run metadata used for non-overlapping concurrent batches

If a conflicting maintainer is already running, new batches are appended to queue.json instead of skipped. When an active maintainer exits, the extension starts queued batches whose protected rule scopes do not overlap.

If a maintainer gets stuck, use /pi-rules:maintainer-status, /pi-rules:maintainer-log, and /pi-rules:maintainer-kill.

The maintainer uses disable-model-invocation: true, so it is not exposed in the model's normal available-skills prompt. It should only run via /pi-rules:maintain, direct /skill:rules-maintainer, or extension background events.

Package structure

pi-rules/
├── package.json
├── tsup.config.ts           # builds dist/ package and Pi extension artifacts
├── dist/
│   ├── index.js             # CommonJS package entry
│   ├── index.mjs            # ESM package entry
│   ├── index.d.ts           # public declarations
│   └── extensions/
│       └── pi-rules.js    # bundled Pi extension entry loaded by Pi
├── extension-src/
│   └── pi-rules/          # domain-oriented extension implementation
│       ├── app/             # config and runtime state
│       ├── pi/              # Pi commands, events, tools, and UI adapters
│       ├── domain/          # foundational rule-context discovery/routing/injection
│       ├── features/        # operational workflows such as rule maintenance
│       └── shared/          # low-level utilities
├── skills/
│   ├── init-advanced/
│   │   ├── SKILL.md
│   │   └── assets/
│   └── rules-maintainer/
│       └── SKILL.md
└── scripts/
    └── scan_project.sh

Development

This package is currently published/tested as a beta prerelease. Build the bundled runtime before loading it locally with Pi:

pnpm install
pnpm build

Run focused maintainer parser/helper tests and dependency-boundary checks with:

pnpm test
pnpm lint:deps

Architectural boundaries are enforced with dependency-cruiser: shared cannot depend on higher layers, domain cannot depend on features or pi, and features cannot depend on pi.

Manual validation steps for maintainer removal/rename behavior are documented in docs/manual-validation-maintainer-removals.md.

Install locally while developing

From another project, after running pnpm build in this package:

pi install -l /absolute/path/to/packages/pi-rules

Or test temporarily:

pi -e /absolute/path/to/packages/pi-rules

When published as a beta npm package, install with:

pi install npm:@supierior/pi-rules@beta