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-tokf

v0.1.0

Published

pi extension that wraps commands through tokf for compressed output.

Readme

pi-tokf

npm version License: MIT

pi extension that wraps bash commands through tokf — reducing LLM context consumption by 60–90%.

Zero config. Main agent and all subagents. Just install and every bash tool call is automatically compressed.

How It Works

The extension hooks into pi's tool_call event pipeline. Every time the agent (or any subagent) runs a bash command:

  1. The extension calls tokf rewrite "<command>" as a subprocess
  2. If tokf returns a rewritten command, it replaces the original in the event payload with tokf run --no-mask-exit-code <rewritten>
  3. If tokf is missing, times out, or returns nothing, the command passes through unmodified

This mirrors the approach used in tokf's Claude Code hook, adapted for pi's event system.

Example — running 207 tests:

# Without tokf
> bash("cd gateway && mix test")
warning: undefined module attribute @kill_timeout...
...
Running ExUnit with seed: 188487, max_cases: 32
..........................................................................
Finished in 0.4 seconds
207 tests, 0 failures

# With tokf (rewrites to: tokf run --no-mask-exit-code cd gateway && mix test)
✓ All tests passed

Install

# Global (user settings)
pi install npm:pi-tokf

# Project-local (shared via .pi/settings.json)
pi install -l npm:pi-tokf

# Try without installing (current run only)
pi -e npm:pi-tokf

# From git
pi install git:github.com/AlexParamonov/pi-tokf

Requirements

  • tokf installed and on PATH
  • Node.js >= 14

Notes

  • Exit codes are preserved (--no-mask-exit-code) so failures are never masked
  • tokf is resolved from PATH — no hardcoded paths
  • Falls back to original command on any error (never blocks execution)

Debugging

When tokf fails (missing, timeout, error), the extension logs to stderr via console.error(). To see these logs, run pi with:

PI_VERBOSE=1 pi

This surfaces messages like:

  • [pi-tokf] rewrite failed: spawn tokf ENOENT — tokf is not installed
  • [pi-tokf] rewrite timed out after 3000ms — slow tokf rewrite

Development

git clone https://github.com/AlexParamonov/pi-tokf.git
cd pi-tokf
npm install
npm run typecheck       # TypeScript validation

To test the extension locally without publishing:

pi -e ./extensions/index.ts

Or register it in a project's .pi/settings.json:

{
  "extensions": ["./extensions/index.ts"]
}