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

@monopi/analytics-extension

v0.6.1

Published

Pi extension for analytics tracking with SQLite persistence

Readme

@monopi/analytics-extension

Pi extension for analytics tracking with SQLite persistence.

Tracks your AI usage: which models you call, how many tokens you burn, what you spend, and stores it all in a local SQLite database so you can query trends over time.

Why use this?

The built-in usage tracker shows session-level costs. This extension goes further: it records every turn across every session for every project, giving you long-term visibility into your AI spend and usage patterns.

  • Answer questions like: "Did my token spend increase after switching to Sonnet 4?"
  • Spot trends: Are you using more tokens per turn over time?
  • Correlate with codebases: Which projects cost the most?

What it tracks

Each time you interact with pi, this extension silently records:

| Data point | Description | | ---------------- | -------------------------------------------- | | Session | Start time, end time, duration, project path | | Turn | Model, provider, input/output tokens, cost | | Codebase | Working directory (hashed for privacy) | | Model / Provider | Auto-inferred from model ID |

All data lives in a SQLite database at ~/.pi/agent/analytics.db.

Installation

pi install npm:@monopi/analytics-extension

Note: This package is opt-in. It is not installed by npx @monopi/monopi.

Usage

Terminal stats

# Quick terminal summary
/analytics

Shows session counts, total tokens, total cost, and recent activity.

Browser dashboard

# Open the full React dashboard
/analytics-dashboard

The dashboard provides charts and tables for:

  • Overview: total spend, sessions, tokens by period
  • Models: cost and token breakdown by model
  • Codebases: which projects drive the most usage
  • Insights: usage patterns across time

How it works

  • Hooks into session_start, turn_end, and session_end events
  • Auto-infers provider from model ID (e.g., claude-sonnet-4anthropic)
  • Uses @monopi/analytics-db for schema, migrations, and query helpers
  • Database at ~/.pi/agent/analytics.db using better-sqlite3 + Drizzle ORM

Dashboard

The companion browser dashboard (@monopi/analytics-dashboard) visualizes all data:

cd packages/monopi__analytics-dashboard
pnpm dev

It reads directly from the same SQLite database.

Related packages