home / skills / mitsuhiko / agent-stuff / pi-share

pi-share skill

/skills/pi-share

This skill loads and decodes pi-share session transcripts to extract full conversations and summarize human actions for analysis.

npx playbooks add skill mitsuhiko/agent-stuff --skill pi-share

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
3.7 KB
---
name: pi-share
description: "Load and parse session transcripts from shittycodingagent.ai/buildwithpi.ai/buildwithpi.com (pi-share) URLs. Fetches gists, decodes embedded session data, and extracts conversation history."
---

# pi-share / buildwithpi Session Loader

Load and parse session transcripts from pi-share URLs (shittycodingagent.ai, buildwithpi.ai, buildwithpi.com).

## When to Use

**Loading sessions:** Use this skill when the user provides a URL like:
- `https://shittycodingagent.ai/session/?<gist_id>`
- `https://buildwithpi.ai/session/?<gist_id>`
- `https://buildwithpi.com/session/?<gist_id>`
- Or just a gist ID like `46aee35206aefe99257bc5d5e60c6121`

**Human summaries:** Use `--human-summary` when the user asks you to:
- Summarize what a human did in a pi/coding agent session
- Understand how a user interacted with an agent
- Analyze user behavior, steering patterns, or prompting style
- Get a human-centric view of a session (not what the agent did, but what the human did)

The human summary focuses on: initial goals, re-prompts, steering/corrections, interventions, and overall prompting style.

## How It Works

1. Session exports are stored as GitHub Gists
2. The URL contains a gist ID after the `?`
3. The gist contains a `session.html` file with base64-encoded session data
4. The helper script fetches and decodes this to extract the full conversation

## Usage

```bash
# Get full session data (default)
node ~/.pi/agent/skills/pi-share/fetch-session.mjs "<url-or-gist-id>"

# Get just the header
node ~/.pi/agent/skills/pi-share/fetch-session.mjs <gist-id> --header

# Get entries as JSON lines (one entry per line)
node ~/.pi/agent/skills/pi-share/fetch-session.mjs <gist-id> --entries

# Get the system prompt
node ~/.pi/agent/skills/pi-share/fetch-session.mjs <gist-id> --system

# Get tool definitions
node ~/.pi/agent/skills/pi-share/fetch-session.mjs <gist-id> --tools

# Get human-centric summary (what did the human do in this session?)
node ~/.pi/agent/skills/pi-share/fetch-session.mjs <gist-id> --human-summary
```

## Human Summary

The `--human-summary` flag generates a ~300 word summary focused on the human's experience:
- What was their initial goal?
- How often did they re-prompt or steer the agent?
- What kind of interventions did they make? (corrections, clarifications, frustration)
- How specific or vague were their instructions?

This uses claude-haiku-4-5 via `pi -p` to analyze the condensed session transcript.

## Session Data Structure

The decoded session contains:

```typescript
interface SessionData {
  header: {
    type: "session";
    version: number;
    id: string;           // Session UUID
    timestamp: string;    // ISO timestamp
    cwd: string;          // Working directory
  };
  entries: SessionEntry[];  // Conversation entries (JSON lines format)
  leafId: string | null;    // Current branch leaf
  systemPrompt?: string;    // System prompt text
  tools?: { name: string; description: string }[];
}
```

Entry types include:
- `message` - User/assistant/toolResult messages with content blocks
- `model_change` - Model switches  
- `thinking_level_change` - Thinking mode changes
- `compaction` - Context compaction events

Message content block types:
- `text` - Text content
- `toolCall` - Tool invocation with `toolName` and `args`
- `thinking` - Model thinking content
- `image` - Embedded images

## Example: Analyze a Session

```bash
# Pipe entries through jq to filter
node ~/.pi/agent/skills/pi-share/fetch-session.mjs "<url>" --entries | jq 'select(.type == "message" and .message.role == "user")'

# Count tool calls
node ~/.pi/agent/skills/pi-share/fetch-session.mjs "<url>" --entries | jq -s '[.[] | select(.type == "message") | .message.content[]? | select(.type == "toolCall")] | length'
```

Overview

This skill loads and parses session transcripts exported from pi-share URLs (shittycodingagent.ai / buildwithpi.ai / buildwithpi.com). It fetches the underlying GitHub Gist, decodes the embedded session HTML, and extracts the conversation history and metadata. Use it to inspect full sessions, get compact JSON entries, or produce human-focused summaries of the user’s behavior.

How this skill works

The script locates a gist ID in the provided URL or accepts a raw gist ID. It fetches the gist, finds the session.html file, and base64-decodes the embedded session payload. The decoded data is parsed into a SessionData structure with header, entries, system prompt, tools, and leafId. Flags let you output the header, entries (JSON lines), system prompt, tool list, or a human-centric summary.

When to use it

  • You have a pi-share/session URL or gist ID and need the full conversation transcript.
  • You want structured JSON entries for programmatic analysis or jq filtering.
  • You need the system prompt or tool definitions used in a session.
  • You want a human-centric summary focusing on what the user did and how they steered the agent.
  • You want to count tool calls, find user messages, or inspect model/thinking changes.

Best practices

  • Provide the full session URL or just the gist ID to avoid parsing errors.
  • Use --entries for machine processing and piping into jq or other tools.
  • Use --header to quickly see session metadata (timestamp, session id, cwd).
  • Run --human-summary when you need a concise, human-focused narrative of the user’s behavior.
  • Validate network access to GitHub API if gists are private or rate-limited.

Example use cases

  • Load a session and filter to user messages: fetch-session.mjs <id> --entries | jq 'select(.type=="message" and .message.role=="user")'
  • Generate a human-centric summary to understand how a user iterated on prompts: fetch-session.mjs <id> --human-summary
  • Extract system prompt and tools to reproduce the agent environment: fetch-session.mjs <id> --system --tools

FAQ

What input formats are accepted?

The script accepts full pi-share session URLs containing a gist ID or a raw gist ID string.

What does the human summary emphasize?

The human summary focuses on the user’s initial goal, reprompts and steering, corrections or interventions, and overall prompting style rather than the agent’s outputs.