Command Palette

Search for a command to run...

Назад к скиллам
скилл № 92324

pi-sessions

Find, list, and analyse pi agent sessions with DuckDB. Use when the user asks about past pi conversations, session history, costs, what pi did, reviewing a…

БесплатноЗапускает вложенные скрипты
juanibiapinaот juanibiapina★ 33 звезды на GitHub

Установить pi-sessions в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Pi Sessions

Pi stores conversation sessions as JSONL event streams. Each line is a JSON object with a type field. Query them with DuckDB.

Key structural fact: message fields are nested under a message struct — use message.role, message.content, message.usage. Bare role/content do not exist as top-level JSONL columns. Before writing any DuckDB query, read references/queries.md and adapt the closest example; do not improvise a schema.

Treat conversation inspection (what happened in one session) and cross-session analytics (counts, trends, costs) as separate branches. Start with the narrowest data that answers the request.

Scripts and reference queries live next to this file. Resolve paths relative to this skill directory.

File Location

~/.pi/agent/sessions/--<path>--/<timestamp>_<uuid>.jsonl

Directory names encode the working directory with / replaced by -.

Example: sessions for /Users/juan/workspace/juanibiapina/dotfiles live in:

~/.pi/agent/sessions/--Users-juan-workspace-juanibiapina-dotfiles--/

Filenames look like 2026-04-30T14-04-00-598Z_<uuid>.jsonl.

Finding Sessions

Start with dev pi recent. It reads a catalog of every session on this machine and prints JSON with each session's ID, title, first prompt, cwd, last activity, and transcript path, newest first. It answers in milliseconds, while scanning the raw transcripts reads gigabytes. Narrow it with --query <text> (title, first prompt, or cwd) and --limit <n>; dev pi recent --help describes the fields. Search the transcripts directly only for text the catalog lacks, such as later messages or a session ID, which is in the filename.

List all session directories (one per project):

ls ~/.pi/agent/sessions/

List sessions for a project (most recent last):

ls -t ~/.pi/agent/sessions/--<path>--/

Find sessions by date:

fd '^2026-03-18' ~/.pi/agent/sessions/

Find sessions containing specific text:

rg -l "search term" ~/.pi/agent/sessions/--<path>--/

Inspect a conversation

Use this branch when given a session file or asked what happened in a session.

1. Resolve one session

Use the supplied .jsonl path. If none is supplied, find it with dev pi recent using the project, time, or title from the request, or by its session ID in the filename (see Finding Sessions), then identify the chosen file before querying it.

Completion criterion: exactly one session file is selected, unless the request explicitly compares sessions.

2. Profile its contents

Count events by role and content type before extracting text. This reveals the amount of conversation, thinking, tool calls, and tool results without loading their payloads.

Use the profiling query in references/queries.md.

Completion criterion: the session's message and content composition is known.

3. Extract the text-only transcript

The default conversation projection is:

  • roles: user, assistant
  • content type: text
  • order: event timestamp, then content position

This selects conversational text while leaving tool calls, tool results, and thinking out of the transcript.

From this skill directory:

bash ./scripts/conversation-text.sh /absolute/path/to/session.jsonl \
  > /tmp/pi-conversation.csv

Read the complete output, in chunks when necessary. Preserve the transcript as evidence; summarize only after all extracted rows have been inspected.

Completion criterion: every text row in the selected conversation has been inspected, and the answer is grounded in those rows.

4. Broaden only for the question

If the transcript points to missing implementation or debugging evidence, query the relevant content explicitly — such as tool names, a specific tool result, or thinking blocks. Keep the text-only transcript as the primary narrative.

See references/queries.md for transcript variants, fragment search, cost, and tool queries. See references/schema.md when a content shape or event type is unclear.

Analyze sessions

Use this branch for counts, trends, project activity, time ranges, costs, or comparisons across sessions.

Create the bundled views in a DuckDB database:

duckdb pi_sessions.duckdb < ./scripts/create_views.sql

The views are:

  • pi_events — raw events with derived session_id and session_group
  • pi_messages — message events
  • pi_conversation — user/assistant text grouped into chronological message rows
  • pi_tool_calls — assistant tool calls

Run the relevant query from references/queries.md, narrowing by session, project, or time range as early as possible.

Completion criterion: the query covers the requested scope and the result has been checked for unexpected roles or content types.

JSONL record types

See references/schema.md for the full event

Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • references/queries.md
  • references/schema.md
  • scripts/conversation-text.sh
  • scripts/create_views.sql

FAQ

Что делает скилл pi-sessions?

Find, list, and analyse pi agent sessions with DuckDB. Use when the user asks about past pi conversations, session history, costs, what pi did, reviewing a session, summarizing or extracting conversation text, or debugging agent behaviour.

Как установить скилл pi-sessions?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл pi-sessions запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить pi-sessions с