Beautiful analytics reports for your pi coding agent sessions.
pi-insights is a Pi extension that adds an /insights command. It scans your local Pi session history and generates a self-contained HTML dashboard with usage, model, project, session, and “rage” analytics.
- Overview — Activity calendar, sessions/tokens/cost per day, activity by hour, and top tools
- Models — Token distribution, per-model breakdown, thinking levels, and stop reasons
- Projects — Per-project sessions, messages, tokens, and cost with sortable bars
- Sessions — Searchable/filterable session table by project name or date
- Rage 🤬 — Profanity analytics: swear rate, filthiest model, peak hour, top words, and project breakdown
- Portable report — Single self-contained HTML file; no server required, works from
file://
If the embedded video does not render in your client, watch the demo video.
More screenshots:
pi install npm:@ygncode/pi-insightspi install git:github.com/ygncode/pi-insightspi -e npm:@ygncode/pi-insights
# or
pi -e git:github.com/ygncode/pi-insightsInside Pi, run:
/insights
The report opens automatically and is written to:
~/.pi/agent/insights-reports/pi-insights.html
Each run overwrites the same report file.
pi-insights reads local Pi session JSONL files from:
~/.pi/agent/sessions/
No data is uploaded by this extension. The generated report is local HTML.
This repo is a Pi package. package.json declares:
{
"keywords": ["pi-package"],
"pi": {
"extensions": ["./index.ts"]
}
}That allows users to install it with pi install from npm, GitHub, or a local path.
This package is prepared for the Pi package gallery:
- npm package name:
@ygncode/pi-insights - GitHub repo:
https://github.com/ygncode/pi-insights - Pi package keyword:
pi-package - Pi extension manifest:
pi.extensions = ["./index.ts"] - Gallery image:
assets/pi-insights-01-overview.png - Gallery video:
assets/demo.mp4
After publishing to npm, submit or list the package on https://pi.dev/packages using the npm package URL/name.
npm install
npm run build # build the React frontend into dist/
npm test # run all tests
npm run test:watch # watch mode
npm run test:coveragedist/ is intentionally included in the package so Pi can run the extension immediately after npm/git installation without requiring users to build the frontend.
index.ts — Extension entry point; registers the /insights command
lib/
parser.ts — Parses JSONL session files into ParsedSession objects
analytics.ts — Computes aggregate stats from parsed sessions
rage.ts — Profanity detection
types.ts — Shared TypeScript interfaces
src/
App.tsx — React frontend
utils.ts — Formatting helpers
components/
ContributionCalendar.tsx
tests/
lib/ — Unit tests for parser, analytics, rage
src/ — Unit tests for frontend utils
- React 19 + TypeScript 6 + Vite 8
- Recharts 3
- Vitest 4
MIT
