Pi Session JSONL
Treat a session as an evidence tree, not a flat transcript. Use the bundled TypeScript CLI to create a compact index, query narrow evidence, and open exact records only when needed.
Resolve the script
Use the absolute path to this skill directory from the read call that loaded SKILL.md:
node --experimental-strip-types <skill-dir>/scripts/pi-session-index.ts --help
Never copy the whole raw JSONL into model context.
Workflow
- For a quick active-branch check, run
overview.
- For a large, branching, or unfinished session, run
index with --scope all.
- Use
search to locate user requests, tool calls, failures, paths, validation markers, compactions, and summaries.
- Use
show with an entry ID, JSONL line, or tool-call ID to inspect exact evidence.
- Read generated Markdown chunks only for the semantic phases needed by the answer.
SCRIPT=<skill-dir>/scripts/pi-session-index.ts
SESSION=/absolute/path/session.jsonl
INDEX=/tmp/pi-session-index
node --experimental-strip-types "$SCRIPT" overview "$SESSION"
node --experimental-strip-types "$SCRIPT" index "$SESSION" --out-dir "$INDEX" --scope all
node --experimental-strip-types "$SCRIPT" search "$INDEX" --query 'FAIL|BUILD FAILED|errorCode' --regex --limit 30
node --experimental-strip-types "$SCRIPT" search "$INDEX" --tool bash --failed-only --limit 30
node --experimental-strip-types "$SCRIPT" search "$INDEX" --path 'src/auth.ts' --limit 30
node --experimental-strip-types "$SCRIPT" show "$INDEX" --tool-call call_123 --raw
index writes overview.json, index.jsonl, timeline.jsonl, manifest.json, and chunks/*.md. The CLI reports when an index is stale relative to its source JSONL.
Query guidance
- Prefer literal
--query; add --regex only for a real pattern.
- Narrow with
--kind, --role, --tool, --path, or --failed-only before increasing --limit.
- Use
--scope active for the inferred/current path and --scope all when abandoned branches matter.
- Use
--leaf <entry-id> when the intended branch is known. Otherwise, active-leaf selection is explicitly marked as inferred.
show --raw is the source-of-truth check after search results point to decisive lines.
Evidence rules
- Link
assistant.toolCall.id to toolResult.toolCallId; parentage is not the tool link.
toolResult.isError=false only means the wrapper did not throw. Inspect embedded exit codes, FAIL, compile errors, and validation markers.
- Treat compaction and branch summaries as navigation aids until corroborated by mutation and validation evidence.
- Separate deterministic
write/edit evidence from bash mutation candidates.
- Distinguish verified complete, implemented but unverified, attempted, claimed, and unresolved work.
- State when the final user turn has no complete assistant answer or when production/device verification was not performed.
See references/pi-session-format.md for format and index semantics.
1---2name: pi-session-jsonl3description: Indexes, searches, inspects, and audits raw Pi coding-agent session JSONL files, including branches, compactions, tool-call/result links, failures, file activity, and unanswered turns. Use when summarizing, recovering, debugging, handing off, or locating exact evidence in `~/.pi/agent/sessions/**/*.jsonl` or another Pi session trace.4---56# Pi Session JSONL78Treat a session as an evidence tree, not a flat transcript. Use the bundled TypeScript CLI to create a compact index, query narrow evidence, and open exact records only when needed.910## Resolve the script1112Use the absolute path to this skill directory from the `read` call that loaded `SKILL.md`:1314```bash15node --experimental-strip-types <skill-dir>/scripts/pi-session-index.ts --help16```1718Never copy the whole raw JSONL into model context.1920## Workflow21221. For a quick active-branch check, run `overview`.232. For a large, branching, or unfinished session, run `index` with `--scope all`.243. Use `search` to locate user requests, tool calls, failures, paths, validation markers, compactions, and summaries.254. Use `show` with an entry ID, JSONL line, or tool-call ID to inspect exact evidence.265. Read generated Markdown chunks only for the semantic phases needed by the answer.2728```bash29SCRIPT=<skill-dir>/scripts/pi-session-index.ts30SESSION=/absolute/path/session.jsonl31INDEX=/tmp/pi-session-index3233node --experimental-strip-types "$SCRIPT" overview "$SESSION"34node --experimental-strip-types "$SCRIPT" index "$SESSION" --out-dir "$INDEX" --scope all35node --experimental-strip-types "$SCRIPT" search "$INDEX" --query 'FAIL|BUILD FAILED|errorCode' --regex --limit 3036node --experimental-strip-types "$SCRIPT" search "$INDEX" --tool bash --failed-only --limit 3037node --experimental-strip-types "$SCRIPT" search "$INDEX" --path 'src/auth.ts' --limit 3038node --experimental-strip-types "$SCRIPT" show "$INDEX" --tool-call call_123 --raw39```4041`index` writes `overview.json`, `index.jsonl`, `timeline.jsonl`, `manifest.json`, and `chunks/*.md`. The CLI reports when an index is stale relative to its source JSONL.4243## Query guidance4445- Prefer literal `--query`; add `--regex` only for a real pattern.46- Narrow with `--kind`, `--role`, `--tool`, `--path`, or `--failed-only` before increasing `--limit`.47- Use `--scope active` for the inferred/current path and `--scope all` when abandoned branches matter.48- Use `--leaf <entry-id>` when the intended branch is known. Otherwise, active-leaf selection is explicitly marked as inferred.49- `show --raw` is the source-of-truth check after search results point to decisive lines.5051## Evidence rules5253- Link `assistant.toolCall.id` to `toolResult.toolCallId`; parentage is not the tool link.54- `toolResult.isError=false` only means the wrapper did not throw. Inspect embedded exit codes, `FAIL`, compile errors, and validation markers.55- Treat compaction and branch summaries as navigation aids until corroborated by mutation and validation evidence.56- Separate deterministic `write`/`edit` evidence from bash mutation candidates.57- Distinguish verified complete, implemented but unverified, attempted, claimed, and unresolved work.58- State when the final user turn has no complete assistant answer or when production/device verification was not performed.5960See [references/pi-session-format.md](references/pi-session-format.md) for format and index semantics.