Convert Claude Code session files (JSON or JSONL) to clean, mobile-friendly HTML pages with pagination.
Example transcript produced using this tool.
Read A new way to extract detailed transcripts from Claude Code for background on this project.
Warning
The web commands for both listing Claude Code for web sessions and converting those to a transcript are both broken right now due to changes to the unofficial and undocumented APIs that these commands were using. See issue #77 for details.
Install this tool using uv:
uv tool install claude-code-transcriptsOr run it without installing:
uvx claude-code-transcripts --helpThis tool converts Claude Code session files into browseable multi-page HTML transcripts.
There are seven commands available:
local(default) - select from recent local Claude Code or Cowork sessionscode- shortcut forlocal --source codecowork- shortcut forlocal --source coworkproject- select a single project and convert all its sessions to an archiveweb- select from web sessions via the Claude APIjson- convert a specific JSON or JSONL session fileall- convert all local sessions to a browsable HTML archive
The quickest way to view a recent local session:
claude-code-transcriptsThis shows an interactive picker to select a session, generates HTML, and opens it in your default browser.
All commands support these options:
-o, --output DIRECTORY- output directory (default: writes to temp dir and opens browser)-a, --output-auto- auto-name output subdirectory based on session ID or filename--repo OWNER/NAME- GitHub repo for commit links (auto-detected if not specified). Forwebcommand, also filters the session list.--open- open the generatedindex.htmlin your default browser (default if no-ospecified)--gist- upload the generated HTML files to a GitHub Gist and output a preview URL--json- include the original session file in the output directory
The generated output includes:
index.html- an index page with a timeline of prompts and commitspage-001.html,page-002.html, etc. - paginated transcript pages
Local Claude Code sessions are stored as JSONL files in ~/.claude/projects. Run with no arguments to select from recent sessions:
claude-code-transcripts
# or explicitly:
claude-code-transcripts localBy default the picker shows sessions from both Claude Code and Claude Cowork. Use --source to restrict to one:
claude-code-transcripts local --source code # Code sessions only
claude-code-transcripts local --source cowork # Cowork sessions only
# or use the shortcut commands:
claude-code-transcripts code
claude-code-transcripts coworkUse --limit to control how many sessions are shown (default: 10):
claude-code-transcripts local --limit 20Select a project and convert all of its sessions to a browsable HTML archive:
claude-code-transcripts projectThis presents an interactive picker listing all your projects with their session counts. After you select one, it generates the same archive structure as the all command but for only that project.
Options:
-s, --source- source:code(default Code path),cowork, or a path to a projects directory-o, --output DIRECTORY- output directory (default:./claude-archive)--open- open the generated project index in your browser--json- include the original session files in the output directory
Import sessions directly from the Claude API:
# Interactive session picker
claude-code-transcripts web
# Import a specific session by ID
claude-code-transcripts web SESSION_ID
# Import and publish to gist
claude-code-transcripts web SESSION_ID --gistThe session picker displays sessions grouped by their associated GitHub repository:
simonw/datasette 2025-01-15T10:30:00 Fix the bug in query parser
simonw/llm 2025-01-14T09:00:00 Add streaming support
(no repo) 2025-01-13T14:22:00 General coding session
Use --repo to filter the session list to a specific repository:
claude-code-transcripts web --repo simonw/datasetteOn macOS, API credentials are automatically retrieved from your keychain (requires being logged into Claude Code). On other platforms, provide --token and --org-uuid manually.
Use the --gist option to automatically upload your transcript to a GitHub Gist and get a shareable preview URL:
claude-code-transcripts --gist
claude-code-transcripts web --gist
claude-code-transcripts json session.json --gistThis will output something like:
Gist: https://gist.github.com/username/abc123def456
Preview: https://gisthost.github.io/?abc123def456/index.html
Files: /var/folders/.../session-id
The preview URL uses gisthost.github.io to render your HTML gist. The tool automatically injects JavaScript to fix relative links when served through gisthost.
Combine with -o to keep a local copy:
claude-code-transcripts json session.json -o ./my-transcript --gistRequirements: The --gist option requires the GitHub CLI (gh) to be installed and authenticated (gh auth login).
Use -a/--output-auto to automatically create a subdirectory named after the session:
# Creates ./session_ABC123/ subdirectory
claude-code-transcripts web SESSION_ABC123 -a
# Creates ./transcripts/session_ABC123/ subdirectory
claude-code-transcripts web SESSION_ABC123 -o ./transcripts -aUse the --json option to include the original session file in the output directory:
claude-code-transcripts json session.json -o ./my-transcript --jsonThis will output:
JSON: ./my-transcript/session_ABC.json (245.3 KB)
This is useful for archiving the source data alongside the HTML output.
Convert a specific session file directly:
claude-code-transcripts json session.json -o output-directory/
claude-code-transcripts json session.jsonl --openThis works with both JSONL files in the ~/.claude/projects/ folder and JSON session files extracted from Claude Code for web.
The json command can take a URL to a JSON or JSONL file as an alternative to a path on disk.
Convert all your local Claude Code sessions to a browsable HTML archive:
claude-code-transcripts allThis creates a directory structure with:
- A master index listing all projects
- Per-project pages listing sessions
- Individual session transcripts
Options:
-s, --source- source:code(default Code path),cowork, or a path to a projects directory. Omit to include both Code and Cowork.-o, --output DIRECTORY- output directory (default:./claude-archive)--include-agents- include agent session files (excluded by default)--dry-run- show what would be converted without creating files--open- open the generated archive in your default browser-q, --quiet- suppress all output except errors
Examples:
# Preview what would be converted
claude-code-transcripts all --dry-run
# Convert all sessions and open in browser
claude-code-transcripts all --open
# Convert to a specific directory
claude-code-transcripts all -o ./my-archive
# Include agent sessions
claude-code-transcripts all --include-agentsTo contribute to this tool, first checkout the code. You can run the tests using uv run:
cd claude-code-transcripts
uv run pytestTo run tests with code coverage:
uv run pytest --cov=claude_code_transcripts --cov-report=term-missingAnd run your local development copy of the tool like this:
uv run claude-code-transcripts --help