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

@clementprevot/pi-session-search

v0.1.2

Published

Pi extension that fuzzy-searches all past session transcripts and resumes the one you pick

Readme

@clementprevot/pi-session-search

A Pi extension that gives you fuzzy full-text search over every past pi session: user prompts, assistant answers, compaction and branch summaries, across all your projects. /search opens a picker that can resume the session you pick, or jump straight to the matched round inside its branching tree, and the agent gets a search_sessions tool so "which session did we discuss X in?" is one call instead of grepping raw JSONL.

Install

pi install npm:@clementprevot/pi-session-search

Updates ship with pi update --extensions. The extension applies to your next session (quit and relaunch or issue a /reload command).

How it works

The extension keeps an incremental index (byte offsets, append-only docs file) in ~/.pi/agent/session-search/. It scans at session start and after every agent turn, so the picker is always current. Only the useful text of each conversation round is indexed: the user prompt and the final assistant answer, plus compaction and branch summaries. Thinking, tool calls, tool results and image blobs are skipped, which keeps the index tiny next to the raw files.

Matching is fuzzy: per token, an exact match beats a prefix match, then a substring, then a subsequence. Queries are accent-insensitive and all query tokens must match. Results are ranked per session, with the best snippet shown.

In the picker:

  • type to search, enter to resume the selected session
  • alt+j jumps to the matched round inside the session's branching tree
  • alt+p toggles a preview of the matched text
  • tab toggles scope between the current directory and all sessions
  • alt+r toggles extra index roots on or off
  • ctrl+s toggles between relevance and date sorting

/search --deep <topic> re-ranks the top candidates by spawning a headless pi subprocess locally (it can take up to 3 minutes) and lets you pick from its top 5, each with a one-line justification.

When the picked session file lives in the archive (from @clementprevot/pi-session-archive), it is restored to the live sessions tree first, then resumed.

The agent-facing search_sessions tool answers "where did we talk about X?" and returns the top matching sessions with snippets and their file paths; it only reports, it never switches sessions.

Configuration

Optional file at ~/.pi/agent/extensions/session-search.json:

{
  "extraRoots": ["/absolute/path", { "path": "/absolute/path", "label": "backups" }],
  "indexIntermediate": true
}
  • extraRoots: more directories of pi session files to index, alongside the live sessions tree. Each entry is an absolute path, or an object with a path and a display label. @clementprevot/pi-session-archive path is automatically included.
  • indexIntermediate: whether assistant text from tool-call rounds is indexed (default true).

Omit the file for defaults.

Privacy

Everything is local. The index and the searches run entirely on your machine; session content never leaves it. The only subprocess is a local headless pi run for --deep.

One thing to know: the index duplicates session text into ~/.pi/agent/session-search/, so it is one more local file that holds whatever your sessions contain. It never leaves the machine, but it is a second copy of potentially sensitive conversation content, protected by the same file permissions as the rest of your pi directory.

Local development

npm install
npm test
npm run typecheck

To try the extension in a live session without installing it:

pi -e /path/to/this/repo

License

MIT