1.2 KiB
1.2 KiB
/insights
A pi extension that analyzes your recent pi session history and generates an
interactive HTML usage report — like Claude Code's /insights.
Usage
/insights # analyze the last 30 days
/insights 7 # analyze the last 7 days
The report opens in your browser and is saved to:
~/.pi/agent/usage-data/report.html
How it works
analyze.pywalks~/.pi/agent/sessions/*/*.jsonland computes deterministic stats (sessions, prompts, tool calls, tokens, cost, per-project breakdown, activity by hour/weekday/day, longest/costliest sessions). No LLM, no tokens.- The command feeds those stats to the model, which writes a qualitative
narrative (summary, highlights, friction patterns, suggestions) by calling the
write_insights_reporttool. render.pycombines the stats + narrative into a self-contained HTML report and opens it.
Intermediate files (stats.json, narrative.json) are also written to
~/.pi/agent/usage-data/ for inspection.
Files
index.ts— extension entry point (command + tool)analyze.py— deterministic session analytics → JSONrender.py— stats + narrative JSON → HTML report