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-context-breakup

v1.0.0

Published

Break down your pi context window into categories — system prompt, rules, tools, MCP, skills, user context, and messages

Readme

pi-context-breakup

A Pi extension that breaks down your context window into categories and shows exactly what's consuming your tokens.

Features

  • 7 categories of context breakdown:

    • System Prompt — Pi's base instructions
    • Rules — Guidelines and behavioral rules
    • Tool Set Output — Non-MCP tool descriptions
    • MCP — MCP server tools taking up space
    • Skills — Loaded agent skills
    • User ContextAGENTS.md / context files
    • User Input — Conversation history
  • Tabular display with token counts, percentages, and visual progress bars

  • Overlay UI — appears on top of your chat without clearing the screen

  • Print mode fallback — works in -p / --print mode too

Installation

Via npm (recommended)

pi install npm:pi-context-breakup

Project-local

git clone https://github.com/imran-vz/pi-context-breakup.git
cd pi-context-breakup
npm install
npm run dev:link

Temporary test

pi -e ./extensions/pi-context-breakup.ts

Usage

Once installed, type in Pi's editor:

/context-breakup

An overlay will appear showing:

┌──────────────────────────────────────────────────────────┐
│                📊 Context Window Breakdown                │
├──────────────────────────────────────────────────────────┤
│ Category           Tokens      %     Bar                 │
│ ──────────────────────────────────────────────────────── │
│ System Prompt        2843   42.3%  [██████░░░░░░░░]      │
│ Rules                 412    6.1%  [█░░░░░░░░░░░░░]      │
│ Tool Set Output      1521   22.6%  [███░░░░░░░░░░░]      │
│ MCP                   890   13.2%  [██░░░░░░░░░░░░]      │
│ Skills                320    4.8%  [█░░░░░░░░░░░░░]      │
│ User Context          180    2.7%  [░░░░░░░░░░░░░░]      │
│ User Input            560    8.3%  [█░░░░░░░░░░░░░]      │
│ ──────────────────────────────────────────────────────── │
│ System Prompt        2843   42.3%                          │
│ Messages              560    8.3%                          │
│ Total / Window     6726 / 200000  (3.4%)                 │
├──────────────────────────────────────────────────────────┤
│         Press Enter or Esc to close                      │
└──────────────────────────────────────────────────────────┘

Press Enter or Escape to dismiss.

How It Works

The extension hooks into Pi's lifecycle events:

  • before_agent_start — captures the structured system prompt options (tools, guidelines, skills, context files)
  • context — captures the conversation messages

It then reconstructs each section of the system prompt exactly as Pi builds it, estimates tokens using Pi's own chars/4 heuristic, and renders the breakdown.

Customization

MCP tools are detected heuristically by name (containing mcp or starting with dokploy_mcp). If you use a different MCP prefix, edit the filter in extensions/pi-context-breakup.ts:

const mcpVisibleTools = visibleTools.filter(
  (name) =>
    name.toLowerCase().includes("mcp") ||
    name.toLowerCase().startsWith("your-prefix-here"),
);

Development

See DEVELOPMENT.md for local development, testing, and publishing instructions.

License

MIT