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-glossary

v0.1.0

Published

Pi extension that lazy-loads glossary definitions into the system prompt when prompts mention matching terms

Readme

pi-glossary

A pi extension that lazy-loads glossary definitions into the system prompt when the user's prompt mentions matching terms.

Why

This lets you keep a shared project vocabulary in one place without bloating every turn's prompt. Definitions are only injected when the current prompt references a matching glossary handle.

More about it in this blog post

How It Works

  1. On session start, the extension loads ~/.pi/agent/glossary.json and .pi/glossary.json from the current project.
  2. Project entries override global entries when they use the same term.
  3. Before an agent starts, it scans the user's prompt for matching glossary terms, aliases, or explicit regex patterns.
  4. If terms match, only terms not already loaded in the current session are injected into the system prompt.
  5. Loaded glossary handles stay visible for the rest of the session in the footer status as Glossary: term, term.

What It Does

  • Loads glossary entries from a project-scoped .pi/glossary.json
  • Matches canonical terms and optional aliases out of the box
  • Supports custom regex triggers per entry
  • Validates glossary entries and shows actionable errors
  • Reloads glossary configuration without restarting pi
  • Shows loaded glossary handles in the footer status for the whole session
  • Avoids re-injecting glossary entries that were already loaded earlier in the session

Installation

pi install git:github.com/ruliana/pi-glossary

To remove:

pi remove git:github.com/ruliana/pi-glossary

After installing or updating the extension, run:

/reload

Project Configuration

Create ~/.pi/agent/glossary.json for global terms and/or .pi/glossary.json inside a project for project-specific terms:

[
  {
    "term": "explore-plan-execute-review",
    "aliases": ["EPER"],
    "definition": "Spawn a team of subagents to explore, plan, execute, and review a task end to end."
  },
  {
    "term": "finance-safe",
    "pattern": "(?:^|[^\\w])finance-safe(?:$|[^\\w])",
    "definition": "Use the conservative workflow: explicit assumptions, no destructive actions, and a reviewer pass before execution."
  }
]

When the same term exists in both files, the project entry wins.

Glossary Entry Fields

| Field | Required | Description | |-------|----------|-------------| | term | Yes | Canonical glossary handle | | definition | Yes | Definition injected when the entry matches | | aliases | No | Additional plain-text aliases | | pattern | No | Explicit regex trigger; overrides the default matcher | | flags | No | Regex flags, defaults to iu | | enabled | No | Set to false to disable an entry | | source | No | Descriptive provenance string included in injected context |

Validation

Each enabled entry must have:

  • a non-empty term
  • a non-empty definition
  • a valid regex pattern if pattern is provided

If validation fails, /glossary and /glossary reload show an actionable error that identifies the bad entry.

Matching Behavior

If pattern is omitted, the extension builds a case-insensitive, boundary-aware matcher from term plus aliases.

That means these work well out of the box:

  • single terms like tophat
  • dashed handles like explore-plan-execute-review
  • multi-word phrases like railway topic

Use pattern when you want total control over matching.

Commands

| Command | Description | |---------|-------------| | /glossary | Show whether the glossary is loaded | | /glossary reload | Reload ~/.pi/agent/glossary.json and .pi/glossary.json without restarting pi |

Any other form, such as /glossary something, shows a usage hint instead of doing a partial lookup.

Notes

  • The extension is user-scoped, and glossary data can be global (~/.pi/agent/glossary.json) or project-scoped (.pi/glossary.json).
  • Nothing is injected when the prompt does not mention a glossary handle.
  • Once a term is loaded in a session, mentioning it again does not inject it again.
  • If you edit the extension itself, run /reload.
  • If you edit either glossary file, run /glossary reload.

License

MIT