| name | session-analyzer |
| description | Analyze pi session transcripts to discover patterns that could become AGENTS.md rules, skills, or prompt templates. Mines your usage history for automation opportunities. |
Session Analyzer
Extracts and analyzes your pi session transcripts to find recurring patterns that could be automated.
Usage
{baseDir}/analyze.js
{baseDir}/analyze.js /path/to/project
{baseDir}/analyze.js --pattern orders-app
{baseDir}/analyze.js --analyze
{baseDir}/analyze.js --pattern orders-app --analyze
{baseDir}/analyze.js --output ./my-analysis --analyze
What It Does
- Extract: Reads all session files for the given working directory from
~/.pi/agent/sessions/
- Use
--pattern to match multiple directories (e.g., worktrees, feature branches)
- Split: Chunks transcripts into ~100k char files (fits in context window)
- Analyze (optional): Spawns pi subagents to identify:
- AGENTS.md patterns: Coding style rules, conventions you repeat
- Skill patterns: Multi-step workflows you do often
- Prompt templates: Reusable prompts for common tasks
Output
Without --analyze:
session-transcripts/
โโโ session-transcripts-000.txt
โโโ session-transcripts-001.txt
โโโ ...
With --analyze:
session-transcripts/
โโโ session-transcripts-000.txt
โโโ session-transcripts-000.summary.txt # Pattern analysis
โโโ session-transcripts-001.txt
โโโ session-transcripts-001.summary.txt
โโโ FINAL-SUMMARY.txt # Aggregated findings
Setup
Install dependencies (run once):
cd {baseDir}
npm install
When to Use
- After working on a project for a while, to discover what rules/skills would help
- Periodically to find new automation opportunities
- When you notice you keep giving similar instructions
Adapted from badlogic/pi-mono gist