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

@yasuhito/clearhead

v0.1.0

Published

A Pi extension that lets the LLM edit its own context to keep the next prompt lean.

Readme

Clearhead

A Pi extension that lets the LLM edit its own context to keep the next prompt lean.

When a conversation fills up with long documents, tool output, and intermediate work, run /clearhead. The same model decides what to keep and what to shorten. Accepted edits are used in subsequent requests while the original session history stays intact.

Install

Requires Node.js 22.19+ and Pi 0.99.2. Other Pi versions are not yet verified.

pi install npm:@yasuhito/clearhead

If Pi is already running, use /reload afterward, or start a new session.

Use

Work normally. When the conversation gets long, run:

/clearhead

You can specify what to keep:

/clearhead Keep decisions, constraints, file paths, and unfinished tasks.

No separate on/off step is needed. The command starts a normal model turn and asks the model to read its context and shorten it with the dedicated context_edit tool. You do not need to edit JSON or write a script yourself. Wait until Pi is idle before running it.

| Command | What it does | | --- | --- | | /clearhead [instructions] | Ask the model to shorten its context, optionally saying what to keep. | | /clearhead-status | Show whether edits are active and the latest acceptance, rejection, or reset. | | /clearhead-reset | Discard Clearhead edits and return to Pi's current normal input. |

The footer is hidden until you use Clearhead. clearhead ready means editing is active but no shortened context is applied; clearhead edited means accepted edits are applied. An edit can be staged before it is accepted: acceptance happens at the next model request. Check /clearhead-status for the outcome.

Reset restores content still present in Pi's current session context. It does not undo Pi's own compaction. You can use /clearhead again after a reset.

Compared with /compact

Pi's /compact summarizes its session context. /clearhead asks the current model to edit the conversation it will receive on subsequent requests, keeping the original session log. Use /clearhead when you want to try model-directed shortening; it does not replace or disable Pi's automatic compaction.

What to expect

  • Shortening is a model decision. It may leave the context unchanged if there is nothing safe to remove. There is no automatic schedule or guaranteed token saving; the editing turn itself also costs tokens.
  • Summaries can omit useful information, including user instructions. Review important answers and use reset if needed.
  • Edits live in memory. Reload, restart, resume, session changes, and successful Pi compaction discard them. Deleted information can reappear afterward.
  • Invalid edits fall back to Pi's normal input. This can be larger and exceed the model's context window; Clearhead has no overflow manager.
  • Tested on Linux with Pi 0.99.2. Remote tools may not be able to access the local context file; signed-history compatibility across model providers is not guaranteed.

Clearhead is an experimental, independent implementation inspired by Context Language Models. See editing contract and limitations for the protocol and verification for test evidence.

Develop locally

git clone https://github.com/yasuhito/clearhead.git
cd clearhead
npm ci --ignore-scripts
npm run check
pi --extension ./index.ts

License

MIT.