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-cache-insight

v1.1.0

Published

Cache-prefix break analysis for pi: session summary, turn-distribution chart, and a miss-analysis view that detects when the cacheable prefix (system prompt + tools + messages) was rewritten — with per-miss cost, cache leverage, and context occupancy.

Readme

pi-cache-insight

Cache-prefix break analysis for the pi coding agent.

Pi's request context is a three-part prefix — system prompt + tool definitions

  • messages — and providers cache it as a prefix. New information (searches, file reads, conversation) is always appended at the end, so the prefix stays cacheable. A cache is only truly broken when something rewrites the prefix: a tool-set change, a context-file edit, an extension injection.

This extension detects exactly that signal and nothing else.

Features

  • /cache — a panel rendered in the editor slot (same mechanism as /model), with three views:
    • Session summary — active-branch vs whole-tree totals, context-window occupancy, hit-rate tier coloring (≥95% green / 80–95% yellow / <80% red), delta row when the session tree has side branches
    • Turn distribution — horizontal log-scale bar chart of turns per hit-rate bucket (0–50 / 50–80 / 80–90 / 90–95 / 95–98 / >98)
    • Miss analysis — every turn where the cacheable prefix was broken, judged by the miss ratio against the cached prefix length (10% × √(100k / prefix) threshold, clamped 2–30%), with the likely cause (model switch / thinking change / after compact / prefix shrank / context rebuilt / idle gap; tags co-occur — a restart creates both an idle gap and a rebuilt prefix, and the stronger signal is never hidden), the estimated extra cost of each miss, session waste total, and cache leverage. Idle expiry uses the TTL applicable to the model's protocol (5 min explicit for anthropic-messages, 10 min heuristic for implicit prefix caches); /cache export writes the cause tags into each row's notes column
  • /cache export — writes the same stats as CSV to the OS temp dir (never litters your project)

Install

pi install npm:pi-cache-insight

Then /reload.

Usage

| Key | Action | |---|---| | Tab | cycle views | | j / k | scroll | | q | close |

Why not a hit-rate threshold?

In a long session the hit rate stays high (95%+) even when the prefix is broken — 5% of a 500k prefix is as significant as 10% of a 100k prefix. The miss ratio (re-billed prefix tokens ÷ previous prompt) is the only meaningful indicator, so it scales with the cached length. Appended information never triggers it.

Commands

  • /cache — open the panel (defaults to the per-message table)
  • /cache graph — open on the turn-distribution chart
  • /cache export — export stats CSV to the OS temp dir