Get the FREE Ultimate OpenClaw Setup Guide →

extract-transcripts

npx machina-cli add skill aiskillstore/marketplace/extract-transcripts --openclaw
Files (1)
SKILL.md
3.6 KB

Extract Transcripts

Extracts readable markdown transcripts from Claude Code and Codex CLI session JSONL files.

Scripts

Claude Code Sessions

# Extract a single session
python3 ~/.claude/skills/extract-transcripts/extract_transcript.py <session.jsonl>

# With tool calls and thinking blocks
python3 ~/.claude/skills/extract-transcripts/extract_transcript.py <session.jsonl> --include-tools --include-thinking

# Extract all sessions from a directory
python3 ~/.claude/skills/extract-transcripts/extract_transcript.py <directory> --all

# Output to file
python3 ~/.claude/skills/extract-transcripts/extract_transcript.py <session.jsonl> -o output.md

# Summary only (quick overview)
python3 ~/.claude/skills/extract-transcripts/extract_transcript.py <session.jsonl> --summary

# Skip empty/warmup-only sessions
python3 ~/.claude/skills/extract-transcripts/extract_transcript.py <directory> --all --skip-empty

Options:

  • --include-tools: Include tool calls and results
  • --include-thinking: Include Claude's thinking blocks
  • --all: Process all .jsonl files in directory
  • -o, --output: Output file path (default: stdout)
  • --summary: Only output brief summary
  • --skip-empty: Skip empty and warmup-only sessions
  • --min-messages N: Minimum messages for --skip-empty (default: 2)

Codex CLI Sessions

# Extract a Codex session
python3 ~/.claude/skills/extract-transcripts/extract_codex_transcript.py <session.jsonl>

# Extract from Codex history file
python3 ~/.claude/skills/extract-transcripts/extract_codex_transcript.py ~/.codex/history.jsonl --history

Session File Locations

Claude Code

  • Sessions: ~/.claude/projects/<project-path>/<session-id>.jsonl

Codex CLI

  • Sessions: ~/.codex/sessions/<session_id>/rollout.jsonl
  • History: ~/.codex/history.jsonl

DuckDB-Based Transcript Index

For querying across many sessions, use the DuckDB-based indexer:

# Index all sessions (incremental - only new/changed files)
python3 ~/.claude/skills/extract-transcripts/transcript_index.py index

# Force full reindex
python3 ~/.claude/skills/extract-transcripts/transcript_index.py index --full

# Limit number of files to process
python3 ~/.claude/skills/extract-transcripts/transcript_index.py index --limit 10

# List recent sessions
python3 ~/.claude/skills/extract-transcripts/transcript_index.py recent
python3 ~/.claude/skills/extract-transcripts/transcript_index.py recent --limit 20
python3 ~/.claude/skills/extract-transcripts/transcript_index.py recent --project myapp
python3 ~/.claude/skills/extract-transcripts/transcript_index.py recent --since 7d

# Search across sessions
python3 ~/.claude/skills/extract-transcripts/transcript_index.py search "error handling"
python3 ~/.claude/skills/extract-transcripts/transcript_index.py search "query" --cwd ~/myproject

# Show a session transcript
python3 ~/.claude/skills/extract-transcripts/transcript_index.py show <file_path>
python3 ~/.claude/skills/extract-transcripts/transcript_index.py show <file_path> --summary

Requirements: DuckDB (pip install duckdb)

Database location: ~/.claude/transcript-index/sessions.duckdb

Output Format

Transcripts are formatted as markdown with:

  • Session metadata (date, duration, model, working directory, git branch)
  • User messages prefixed with ## User
  • Assistant responses prefixed with ## Assistant
  • Tool calls in code blocks (if --include-tools)
  • Thinking in blockquotes (if --include-thinking)
  • Tool usage summary for Codex sessions

Source

git clone https://github.com/aiskillstore/marketplace/blob/main/skills/0xbigboss/extract-transcripts/SKILL.mdView on GitHub

Overview

Extracts readable markdown transcripts from Claude Code and Codex CLI session JSONL files. It can output a single session, all sessions in a directory, or a quick summary, and supports including tool calls and thinking blocks to capture full context.

How This Skill Works

Transcripts are produced by parsing JSONL session records and formatting them as Markdown, including session metadata (date, duration, model, working directory, git branch), user messages, and assistant responses. Optional flags add tool calls and Claude thinking blocks, and a DuckDB-based indexer enables cross-session search and retrieval.

When to Use It

  • Export a single Claude Code session to a Markdown transcript for sharing with your team.
  • Process all sessions in a directory and generate a unified knowledge base.
  • Create a quick summary for executives using --summary.
  • Extract Codex CLI session history with extract_codex_transcript.py.
  • Index transcripts with the DuckDB-based indexer and perform a search (e.g., "error handling").

Quick Start

  1. Step 1: Identify a session file (e.g., <session.jsonl>) or a directory of sessions.
  2. Step 2: Run the extractor with desired flags, for example: python3 ~/.claude/skills/extract-transcripts/extract_transcript.py <session.jsonl> --include-tools --include-thinking
  3. Step 3: View the output (stdout or file via -o) and share or index as needed.

Best Practices

  • Use --include-tools and --include-thinking when you need full context of tool calls and internal reasoning.
  • For batch work, run with --all and enable --skip-empty to ignore short warmup sessions.
  • Redirect output with -o/--output to save transcripts as files instead of stdout.
  • Tune relevance with --min-messages N to exclude very short sessions (default 2).
  • Keep session paths and locations up to date by referencing Claude Code and Codex session layouts in the docs.

Example Use Cases

  • Export a Claude Code session to transcript.md for a teammate review.
  • Batch export all sessions in a project directory to build a project knowledge base.
  • Generate a quick, shareable summary of a long session for leadership briefings.
  • Extract a Codex CLI session history for archival in a documentation repo.
  • Index transcripts with the DuckDB indexer and run a search for a specific topic like 'setup guide'.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers