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-ctx-budget

v0.1.0

Published

Context window budget display for pi — /ctx-budget command + toggleable footer

Readme

pi-ctx-budget

npm version License: MIT

Context window budget display for pi — track token usage across system prompts, skills, tools, and conversation with a /ctx-budget command and toggleable footer bar.

Features

  • Token estimation — estimates source token usage from system context, skills, and tool schemas
  • Runtime tracking — shows conversation token usage from live context data
  • Compact display — renders ASCII budget summary with percentage breakdown
  • Toggleable footer — optional persistent footer bar showing per-category token percentages
  • Persistent config — footer preference saved to ~/.pi/pi-ctx-budget.json
  • Environment overridesPI_CTX_BUDGET_FOOTER=1 to force-enable footer

Installation

For Humans

npm install -g pi-ctx-budget

For AI Agents

This is a pi extension package. Add it to your pi settings.json:

{
  "packages": [
    {
      "name": "pi-ctx-budget",
      "url": "https://github.com/buihongduc132/pi-ctx-budget.git"
    }
  ]
}

For pi git-sourced

Clone into your git-sourced extensions directory:

cd ~/.pi/agent/git/github.com/buihongduc132/
git clone https://github.com/buihongduc132/pi-ctx-budget.git

Then ensure settings.json includes the git-sourced path.

Usage

/ctx-budget command

| Command | Description | |---------|-------------| | /ctx-budget | Compact budget summary | | /ctx-budget all | Verbose per-item breakdown | | /ctx-budget --verbose | Same as all | | /ctx-budget detail | Same as all | | /ctx-budget footer | Show footer toggle status | | /ctx-budget footer on | Enable footer (persisted) | | /ctx-budget footer off | Disable footer (persisted) | | /ctx-budget footer <category> | Toggle a footer category |

Footer categories

The footer bar shows percentage of context window used per category:

  • Sys — System prompt (internal pi prompt + all context files)
  • A — AGENTS.md files
  • Sk — Skills
  • T — Extension + MCP tools

Example output

╭─ Context Budget ──────────────────────────────────────╮
│ System    12,450t  ██████████████░░░░░░░░░  8.3%     │
│ Skills     1,200t  ████░░░░░░░░░░░░░░░░░░░  0.8%     │
│ Tools      3,800t  █████░░░░░░░░░░░░░░░░░  2.5%     │
│ Conv       8,200t  ███████████░░░░░░░░░░░  5.5%     │
│ Free    134,350t  ░░░░░░░░░░░░░░░░░░░░  82.9%     │
│ Model: gpt-4o  Window: 150K                         │
╰──────────────────────────────────────────────────────╯

Development

npm install
npm run typecheck    # TypeScript type checking
npm test             # Run tests
npm run test:coverage # Tests with coverage
npm run smoke-test   # Quick smoke test
npm pack --dry-run   # Verify package contents

License

MIT © buihongduc132