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

@gordonb/pi-archive

v0.1.0

Published

SQLite searchable archive of every conversation with Pi agent

Downloads

52

Readme

pi-archive

Minimum viable personal agent: save every message to a SQLite DB.

A Pi coding agent extension that creates a searchable SQLite archive of every Pi session ever. Every message (user, assistant, tool results, bash executions) is saved locally and indexed for full-text search.

The agent can search its own history via the search_archive tool, and you can search manually with the /archive command.

Install

pi package add @gordonb/pi-archive

How it works

Pi stores sessions as JSONL files on disk. This extension syncs those files into a SQLite database at .pi/archive.db in your project directory.

  • On session start: all past session files for the project are synced into the database.
  • After each agent turn: the current session file is incrementally synced.
  • On shutdown: the database connection is closed cleanly.

Sync is idempotent — re-syncing the same file is a no-op. Appended entries are picked up incrementally by comparing file sizes.

What's stored

Every JSONL entry is parsed into structured columns:

| Column | Description | | -------------- | --------------------------------------------------------------- | | role | user, assistant, toolResult, bashExecution, custom, … | | tool_name | Tool name for tool result entries | | model | Model ID (e.g. claude-sonnet-4-5) | | provider | Provider (e.g. anthropic) | | text_content | Extracted searchable text | | raw_json | Full original JSONL line |

The tree structure of conversations is preserved via parent_id, so you can walk branches. Session metadata (cwd, timestamps, parent session for forks) is tracked in a separate sessions table.

Text content is indexed using SQLite FTS5 for fast full-text search.

Usage

/archive command

Search your archive or view stats from the Pi prompt:

/archive authentication JWT
/archive stats

search_archive tool

The agent can search past conversations automatically. It's guided to use the tool when you reference past work. You can also ask it directly:

Search our past conversations for when we discussed the database schema.

The tool accepts FTS5 query syntax:

  • Phrase search: "REST API"
  • Boolean: authentication AND JWT
  • Prefix: Graph*
  • Negation: REST NOT GraphQL

Results are ordered by timestamp (newest first) and include highlighted snippets.

Direct SQL

The database is just a SQLite file. You can query it directly:

sqlite3 .pi/archive.db "SELECT text_content FROM entries WHERE role = 'user' ORDER BY timestamp DESC LIMIT 10"

Development

Requires Node.js 22+ (uses node:sqlite).

npm install
npm test

License

MIT