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

@ocodista/pi-token-bloat

v0.1.6

Published

Pi extension that estimates model-facing context footprint by resource.

Downloads

891

Readme

TokenBloat

TokenBloat is a Pi extension that estimates the LLM context footprint of loaded Pi resources.

It focuses on what can actually reach the model, not extension source size. Extension implementation code, slash-command handlers, and UI code are not counted unless an extension registers an active tool whose metadata is sent to the model.

TokenBloat demo

What it counts

  • System prompt: approximate tokens for Pi's assembled system prompt when available.
  • Last provider payload: approximate tokens for the last serialized provider request when available. This includes conversation history, so it is broader than startup resource cost.
  • Context files: AGENTS.md, CLAUDE.md, and other context files that Pi includes in the system prompt when available.
  • Skills: only the skill catalog that Pi inserts into the system prompt: skill name and description. Full SKILL.md files are loaded on demand and are shown as source size only.
  • Prompts: full template size. Prompt templates are slash-command expansions, so these tokens enter model context only when invoked.
  • Extensions: only active extension tool schemas/descriptions. Extension source, commands, shortcuts, and UI are not sent to the model.

Token counts are approximate (chars / 4), but the counted inputs now match Pi's context behavior much more closely than raw file-size totals.

Features

  • Adds a compact startup summary above the editor.
  • Shows actual-ish system prompt size when Pi exposes it.
  • Separates always-in-context resource metadata from on-demand prompt/skill content.
  • Provides /token-bloat for an interactive chart.
  • Defaults to an All chart across context files, skills, prompts, and extensions.
  • Keeps per-group charts for focused inspection.

Install

Install from npm:

pi install npm:@ocodista/pi-token-bloat

Install from GitHub:

pi install git:github.com/ocodista/pi-token-bloat

Try it without installing:

pi -e git:github.com/ocodista/pi-token-bloat

Use

Start Pi after installing the package. TokenBloat briefly shows the startup summary above the editor. After /reload, it shows the summary again.

Open the detailed view:

/token-bloat

Configure the startup summary:

/token-bloat:settings

In the chart:

  • Use and to move.
  • Use , , or Tab to switch charts.
  • Use number keys to jump to a chart.
  • Press Enter or Esc to close.

Accuracy notes

TokenBloat is an estimator, not a billing-grade tokenizer.

The most important behavior change is that extension files are no longer treated as prompt context. For example, a command-only or UI-only extension should show 0 extension tokens, because Pi loads it into the Node runtime rather than sending its source to the model.

Prompt templates are shown by full template size even though they are on-demand. This helps identify large prompts before you invoke them.

Extension token cost appears only when the extension registers active tools, because tool names, descriptions, and schemas are part of the model-facing tool interface.

Development

Run a local copy directly:

pi -e ./index.ts

Check the npm package contents:

npm run pack:dry-run

Run TypeScript locally after installing dev dependencies:

npm install
npm run typecheck

Security

Pi extensions run with your system permissions. Review packages before installing them.