pi-sessions-turbo
Feature-complete, performance-optimized local Pi session search backed by a Rust SQLite/FTS5 index.
Package details
Install pi-sessions-turbo from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-sessions-turbo- Package
pi-sessions-turbo- Version
0.1.0- Published
- Aug 4, 2026
- Downloads
- 176/mo · 11/wk
- Author
- patlux
- License
- MIT
- Types
- extension
- Size
- 31.1 KB
- Dependencies
- 1 dependency · 1 peer
Pi manifest JSON
{
"extensions": [
"./extension/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
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/**/*.jsonlinto 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:
PI_SESSIONS_BINPI_LOCAL_SESSION_SEARCH_BIN(legacy env var)~/.local/bin/pi-sessions./target/debug/pi-sessions./target/release/pi-sessions./result/bin/pi-sessionscargo run --manifest-path ./Cargo.toml -- ...pi-sessionsfromPATH
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-brifindspsm-bridge) - multi-word queries use
allby default, sonix direnvmeans both words - results are grouped by session, with relative time, best matching snippet, and hit count
Escswitches to Normal mode;i/aswitches back to InsertTab,h/l, orCtrl-Wchanges focus between results and contextj/kor↑/↓moves the focused panegg/GorHome/Endjumps 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-Uscrolls by a page;Ctrl-E/Ctrl-Yby one line PgUp/PgDnalso scrolls contextEnter/oopens the selected session withpi --session <session-file>/clears the current query and starts a fresh search in Insert modeCtrl-Wdeletes the previous query word in Insert mode;Delete/Ctrl-Uclears itycopies the selected session path withpbcopyqorCtrl-Cquits?orF1opens 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.