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

@taimoorchatha/pi-context-footer

v0.1.0

Published

pi coding-agent extension: turn-by-turn context-usage readout in the footer (bar, %, tokens, delta, last event).

Readme

@taimoorchatha/pi-context-footer

A pi coding-agent extension. Replaces pi's footer with a turn-by-turn context-usage readout:

████░░░░░░ 42.3% 84k/200k +1.2k  assistant: response (320 out)
^bar        ^pct  ^tokens ^delta  ^last event
  • Updates after every user message, assistant message, and tool call.
  • Bar color: green → yellow at 65% → red at 85%.
  • Real token counts come from the provider (ctx.getContextUsage()) after each assistant turn. Between turns, deltas are ~4-chars-per-token estimates reconciled against the real value on the next assistant reply. Estimated rows are marked with a leading ~.
  • Default shows only the most recent event. /context-footer <N> expands to the last N turns on separate lines (capped at 20).

Install

pi install npm:@taimoorchatha/pi-context-footer

Or drop the source file directly into ~/.pi/agent/extensions/ (global) or .pi/extensions/ in a project:

curl -o ~/.pi/agent/extensions/context-footer.ts \
  https://raw.githubusercontent.com/taimoorchatha/pi-extensions/main/packages/context-footer/src/index.ts

No compilation — pi loads TS directly via jiti. /reload or start a new session and it activates.

Commands

/context-footer           toggle on/off
/context-footer <N>       show last N turns on separate lines (0 = hide, max 20)
/context-footer on | off  explicit

What counts against the context window?

Everything sent to the LLM per turn:

  1. System prompt — pi's baseline instructions + tool descriptions + any AGENTS.md + loaded skills. Usually 5–15k tokens on its own before the conversation starts.
  2. Tool resultsread on large files, bash output on builds/tests/logs. Usually the dominant contributor in coding sessions.
  3. Assistant responses — including the hidden reasoning tokens on thinking-capable models.
  4. Tool calls — the arguments the model sent.
  5. Your prompts — typically the smallest slice.

That's why the bar can jump 5–10% after a single large file read while a short typed prompt barely moves the needle. The delta column reflects all of it.

Design notes

Learned from rebuilding this after an earlier attempt crashed pi hard:

  • No pi.sendMessage() calls, ever. The old design injected a "marker" message after each turn and tried to hide those markers from the LLM with an on("context") filter. The filter checked the wrong field, so every marker leaked into the model's view of the conversation, looking like a new short user turn — the model kept replying briefly and its own reply triggered another marker, producing a tight reply loop. This extension is pure footer. It never touches the LLM's message list.
  • Only documented ThemeColor keys. theme.fg() throws on unknown keys, and because it's called from inside the TUI's render loop the throw can kill pi outright (terminal stays stuck in alt-screen + raw mode). Uses only text, accent, muted, dim, success, warning, error.
  • Defensive try/catch in every lifecycle handler and inside the footer's render(). If anything unexpected throws, the footer silently degrades to ctx ? instead of taking pi down.

License

MIT — see LICENSE.