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-token-tracker

v0.1.3

Published

Pi extension that tracks token usage across all sessions including taskplane workers and merge agents. Writes per-call token records to usage.jsonl and provides a token-report command.

Readme

pi-token-tracker

Pi extension that tracks per-call token usage across all sessions, including taskplane lane workers and merge agents.

How it works

  • message_end hook: Writes one JSONL line per assistant response to ~/.pi/token-logs/usage.jsonl
  • token-report command: Scans usage.jsonl + taskplane runtime exit summaries and prints a hierarchical vendor/model breakdown

Recorded Fields

Each JSONL record contains:

| Field | Description | |-------|-------------| | date, time | ISO date/timestamp | | provider, model | Model identifier (e.g., anthropic, claude-sonnet-4) | | inputTokens | Input token count | | outputTokens | Output token count | | cacheReadTokens | Cache read tokens (if supported) | | cacheWriteTokens | Cache write tokens (if supported) | | totalTokens | Sum of all token counts | | cost | Estimated cost in USD | | ttftMs | Time to First Token (ms) — from HTTP response headers to first streaming token | | tps | Tokens Per Second — output tokens / streaming duration |

Installation

# Clone and install
git clone https://github.com/skyscribe-yf/pi-token-tracker.git
cd pi-token-tracker
npm link

# Add to pi settings
# Edit ~/.pi/agent/settings.json and add "npm:pi-token-tracker" to the "packages" array:
# {
#   "packages": [
#     "npm:pi-token-tracker",
#     ...
#   ]
# }

Why a pi package?

Taskplane lane workers and merge agents run with --no-extensions, which prevents auto-discovery of user extensions from the working directory. However, taskplane's loadPiSettingsPackages mechanism automatically forwards pi packages (from settings.json) to worker processes as explicit -e flags.

By installing this extension as a pi package, it gets loaded in:

  • Main pi sessions ✓
  • Taskplane lane workers ✓
  • Taskplane merge agents ✓

Safety in RPC mode

The extension is safe to load in headless RPC worker processes:

  • session_start hook uses try-catch to handle missing UI
  • token-report command uses try-catch for notify in UI-less contexts

License

MIT