https://github.com/ygncode/pi-insights
Beautiful analytics reports for pi coding-agent sessions
https://github.com/ygncode/pi-insights
analytics coding-agent pi-extension pi-package
Last synced: 7 days ago
JSON representation
Beautiful analytics reports for pi coding-agent sessions
- Host: GitHub
- URL: https://github.com/ygncode/pi-insights
- Owner: ygncode
- License: mit
- Created: 2026-05-17T07:51:52.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-05-17T08:43:33.000Z (about 2 months ago)
- Last Synced: 2026-05-17T10:41:48.269Z (about 2 months ago)
- Topics: analytics, coding-agent, pi-extension, pi-package
- Language: TypeScript
- Size: 26.7 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pi-insights
Beautiful analytics reports for your [pi coding agent](https://pi.dev) 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.
## Features
- **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://`
## Preview
If the embedded video does not render in your client, [watch the demo video](https://raw.githubusercontent.com/ygncode/pi-insights/main/assets/demo.mp4).

More screenshots:
- [Models](assets/pi-insights-02-models.png)
- [Projects](assets/pi-insights-03-projects.png)
- [Sessions](assets/pi-insights-04-sessions.png)
- [Rage analytics](assets/pi-insights-05-rage.png)
## Install
### From npm
```bash
pi install npm:@ygncode/pi-insights
```
### From GitHub
```bash
pi install git:github.com/ygncode/pi-insights
```
### Try without installing
```bash
pi -e npm:@ygncode/pi-insights
# or
pi -e git:github.com/ygncode/pi-insights
```
## Usage
Inside Pi, run:
```text
/insights
```
The report opens automatically and is written to:
```text
~/.pi/agent/insights-reports/pi-insights.html
```
Each run overwrites the same report file.
## What gets analyzed?
`pi-insights` reads local Pi session JSONL files from:
```text
~/.pi/agent/sessions/
```
No data is uploaded by this extension. The generated report is local HTML.
## Package metadata
This repo is a Pi package. `package.json` declares:
```json
{
"keywords": ["pi-package"],
"pi": {
"extensions": ["./index.ts"]
}
}
```
That allows users to install it with `pi install` from npm, GitHub, or a local path.
## pi.dev package gallery
This package is prepared for the [Pi package gallery](https://pi.dev/packages):
- 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 using the npm package URL/name.
## Development
```bash
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:coverage
```
`dist/` is intentionally included in the package so Pi can run the extension immediately after npm/git installation without requiring users to build the frontend.
## Architecture
```text
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
```
## Tech stack
- React 19 + TypeScript 6 + Vite 8
- Recharts 3
- Vitest 4
## License
MIT