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-sessions-turbo

v0.1.0

Published

Feature-complete, performance-optimized local Pi session search backed by a Rust SQLite/FTS5 index.

Readme

pi-sessions-turbo

Feature-complete, performance-optimized local Pi session search without Pi Session Manager, psm-bridge, or a localhost server.

The turbo distribution preserves the complete search and context tool surface while reducing peak memory and subprocess overhead. The project contains both pieces needed for a publishable Pi package:

  • a Rust CLI that indexes ~/.pi/agent/sessions/**/*.jsonl into SQLite/FTS5
  • a TypeScript Pi extension that registers session_search, session_context, session_recall, and /session-search-status

How it works

Pi tool call
  -> extension/index.ts
  -> extension/runner.ts
  -> pi-sessions Rust CLI
  -> ~/.pi/agent/sessions/pi-sessions.sqlite
  -> ~/.pi/agent/sessions/**/*.jsonl

No daemon. No HTTP port. No Pi Session Manager.app.

Install for Pi

Install the Pi extension from npm:

pi install npm:pi-sessions-turbo

The extension requires the separate native pi-sessions binary. Build it reproducibly with Nix or Cargo and place it on PATH, or set PI_SESSIONS_BIN:

nix build github:patlux/pi-sessions
install -m 0755 result/bin/pi-sessions ~/.local/bin/pi-sessions

The extension resolves the Rust binary in this order:

  1. PI_SESSIONS_BIN
  2. PI_LOCAL_SESSION_SEARCH_BIN (legacy env var)
  3. ~/.local/bin/pi-sessions
  4. ./target/debug/pi-sessions
  5. ./target/release/pi-sessions
  6. ./result/bin/pi-sessions
  7. cargo run --manifest-path ./Cargo.toml -- ...
  8. pi-sessions from PATH

For best startup speed, install/build the binary first:

cargo build --release
# or
nix build .#

Terminal UI

Run the full-screen TUI:

pi-sessions
# or explicitly
pi-sessions tui

The TUI works like a small search app with Vim-style modes:

  • starts in Insert mode; type to search immediately
  • incomplete last words match by prefix (psm-bri finds psm-bridge)
  • multi-word queries use all by default, so nix direnv means both words
  • results are grouped by session, with relative time, best matching snippet, and hit count
  • Esc switches to Normal mode; i / a switches back to Insert
  • Tab, h / l, or Ctrl-W changes focus between results and context
  • j / k or ↑ / ↓ moves the focused pane
  • gg / G or Home / End jumps to the start/end of the focused pane
  • the right pane follows the selected session and shows surrounding dialogue
  • in context focus, Ctrl-D / Ctrl-U scrolls by a page; Ctrl-E / Ctrl-Y by one line
  • PgUp / PgDn also scrolls context
  • Enter / o opens the selected session with pi --session <session-file>
  • / clears the current query and starts a fresh search in Insert mode
  • Ctrl-W deletes the previous query word in Insert mode; Delete / Ctrl-U clears it
  • y copies the selected session path with pbcopy
  • q or Ctrl-C quits
  • ? or F1 opens help

Useful flags:

pi-sessions tui --sort newest --page-size 20 --before 4 --after 4
pi-sessions tui --project-path "$PWD"
pi-sessions tui --path-glob '*/infra/*'
pi-sessions tui --match-mode any
pi-sessions tui --match-mode phrase

Development shell

This repo includes a Nix flake dev shell and direnv config.

git clone https://github.com/patlux/pi-sessions.git
cd pi-sessions
direnv allow
npm install
make check
npm run check

Without direnv:

nix develop

The shell provides Rust, Cargo, rustfmt, clippy, rust-analyzer, cargo-watch, Node.js/npm, SQLite, jq, git, nil, and nixfmt.

Interactive REPL

A simple line-oriented REPL is still available:

pi-sessions interactive

Inside the REPL:

pi-sessions [...]> psm-bridge     # search
pi-sessions [...]> 1              # open context for result 1
pi-sessions [...]> /role user     # filter by role
pi-sessions [...]> /mode phrase   # phrase search
pi-sessions [...]> /sort newest   # sort newest first
pi-sessions [...]> /limit 20      # show more hits
pi-sessions [...]> /glob '*/infra/*'
pi-sessions [...]> /help
pi-sessions [...]> /quit

Useful flags:

pi-sessions interactive --sort newest --page-size 12 --before 4 --after 4
pi-sessions interactive --project-path "$PWD"
pi-sessions interactive --path-glob '*/infra/*'

CLI

pi-sessions index --force --prune
pi-sessions search --query "psm-bridge" --page-size 3
pi-sessions recall --query "psm-bridge" --max-results 3 --before 2 --after 2
pi-sessions context --session <uuid-or-prefix-or-jsonl-path>
pi-sessions stats
pi-sessions prune

Defaults:

  • sessions dir: ~/.pi/agent/sessions
  • DB: ~/.pi/agent/sessions/pi-sessions.sqlite

Development

Rust checks:

make check

TypeScript extension check:

npm ci
npm run check

Nix build:

nix build .#

Scope

Indexed content is intentionally limited to user/assistant text. Tool calls, tool results, thinking blocks, and image/snapshot blocks are skipped.