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

@vkundapur/context-inspector

v0.1.1

Published

Pi coding agent extension: session context map and inspector. See a visual breakdown of context usage — prompts, tools, messages, token estimates — via the /context command.

Readme

Context Inspector

A context map and session inspector for the Pi coding agent. Adds the /context command — a TUI dashboard that shows a visual breakdown of what's consuming your session context.

Context Inspector preview

What it shows

The inspector is a read-only context usage snapshot of the current Pi session. It groups the current state into sections:

  • Overview — cwd, session file, session id, model, thinking level, context usage estimates
  • System prompt & resources — custom prompt, appended prompt, context files, skills, tool snippets, fallback prompt
  • Slash commands — registered commands
  • Tool registry & active tools — all tools and which ones are active
  • Session branch (raw entries) — the session branch history
  • Resolved model context — the final message list after session resolution
  • Request preview — a compact summary of the request that would be sent

Usage view

At the top, the inspector shows estimated context usage:

  • a usage bar
  • a colored 10×10 usage grid
  • a category legend
  • Reserved blocks at the end when compaction reserves tokens

The category colors are just visual helpers. They do not change behavior.

Installation

Install globally (available in all Pi sessions):

npm install -g @vkundapur/context-inspector

Or project-local (available only in the current project):

npm install @vkundapur/context-inspector

Then run /reload in Pi or restart Pi to load the extension.

How it works

  1. Cache prompt info

    • On before_agent_start, the extension stores the latest system prompt and prompt options.
  2. Build a snapshot

    • buildSnapshot() gathers everything into one immutable object.
    • This keeps the UI stable while you move around inside it.
  3. Estimate usage

    • estimateUsageCategories() approximates token usage from prompt resources, resolved messages, and compaction settings.
    • These numbers are estimates, not exact accounting.
  4. Render lines

    • buildInspectorLines() turns the snapshot into plain text lines.
    • styleInspectorLines() adds the border and colors.
  5. Interact

    • Arrow keys move between sections/items.
    • Enter or → expands a section.
    • ← or Esc collapses.
    • e exports the snapshot to .pi/context-snapshot.json.
    • q closes the inspector.

Linting

npm run lint
npm run lint:watch
npm run check

Notes

  • The inspector only opens in an interactive UI session.
  • It refuses to open while the current turn is still running.
  • Export is also only available from an idle interactive session.