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-context-guard-jev

v0.3.4

Published

Pi extension that removes tool output the agent no longer needs from its context. The Jev classifier keeps the needed lines verbatim; stale small outputs, unrelated old exchanges and old screenshots become one-line notes. Everything can be recalled.

Readme

pi-context-guard-jev

npm license Pi ≥ 1.0.3

Tool calls, their outputs and old off-topic conversation make up over 80% of the messages your Pi agent re-sends with every request (1,138 real sessions). This extension trims what the work no longer needs (old tool output, exchanges about earlier tasks, screenshots, long arguments): an estimated 25% fewer context tokens, for 1.6¢ per session.

pi install npm:pi-context-guard-jev

Needs an OpenRouter key (OPENROUTER_API_KEY or /login); the footer then shows 🛡 0 saved. Judged tool output is sent to OpenRouter → TypeSafe (what exactly).

Context per request in 127 real sessions of 200+ requests: with the guard 260k tokens at request 200, estimated 361k without it (−28%)

How it works

  1. When a run ends, and at checkpoints in long runs, Jev (a small, fast classifier by TypeSafe) judges each old tool output against the question, the answer and the ongoing work.
  2. Lines still needed stay verbatim; the rest becomes a one-line note. Unrelated old exchanges and screenshots older than 3 turns become notes too; long arguments of old tool calls (written files, heredocs) keep only their first and last lines (not on Claude Haiku, which misreads them). Edits that are not expected to pay back their prompt-cache rewrite are skipped.
  3. Every note ends with recall({"entryId":"…"}), so the model can fetch the original.
[context-guard] Distilled the output of bash `rg -n -i compact dist docs`: kept 141 of 431 lines (15.1k of 50.4k chars); the rest was judged not needed for the answer. Full output: recall({"entryId":"1704787f"}).

Measured on real work

Three weeks (October 2026) of one heavy user's everyday Pi sessions: Claude and GPT, main sessions and subagents. "Without the guard" = the same sessions with the edits undone (an estimate, not an A/B test).

| | Context sent | Est. bill¹ | Sessions | |---|---|---|---| | All | −25% (10.8 billion tokens) | −5.8% | 1,138 | | Claude (Anthropic) | −26% | −6.1% | 512 | | GPT (OpenAI Codex) | −22% | −5.1% | 625 | | Under 50 requests | −16% | +1.7% | 580 | | 50–199 requests | −22% | −1.1% | 365 | | 200+ requests | −26% | −7.1% | 193 | | Subagents (any length) | −28% | −10% | 865 |

Estimated main-model bill by session length: under 50 requests +1.7%, 50–199 requests −1.1%, 200+ requests −7.1%

| | | |---|---| | Where the money went | $3,175 cheaper context − $2,210 prompt-cache rewrites − $18 Jev = $948 net on $15,459 spend | | Items edited | 60,005: 24.6k large outputs distilled, 31.5k small outputs and 566 exchanges omitted, 3.3k screenshots removed | | Model fetched a removed item back | 2.8% (1.2–4.0% by type) |

¹ Estimated at each request's own token prices, net of cache rewrites and Jev. The rows are three splits of the same sessions. The data predates 0.3.4, which skips run-end edits that do not pay off. Raw aggregates · method and limits.

Use

Nothing to call. /guard shows each decision, /guard off turns it off, /tree to a point before an edit undoes it. Footer: 🛡 −4.2k · 3 = about 4.2k tokens kept out of context right now, by 3 edits.

Settings live in ~/.pi/agent/context-guard.json, e.g. { "excludeTools": ["edit", "write", "bash"] } (all keys).

Trade-offs

| | | |---|---| | Third party | Each pass sends your prompt, the answer or progress notes, short excerpts of earlier messages, tool arguments and the outputs being judged to OpenRouter → TypeSafe. Never sent: images, outputs under 400 chars, excluded tools (edit, write by default) | | Lossy | A removed line can be needed later. The note says what is missing and the model can recall it (it did for 2.8% of removed items) | | Short sessions | Under 50 requests: less context, but the cache rewrite costs more than it saves (+1.7% bill) | | Latency | 0.5–2 s per pass, 8 s at most |

More

Settings · Results · Threshold replay · Design · MIT license