Skip to main content

Convert Claude Code session files to HTML transcripts

Project description

claude-code-transcripts

PyPI Changelog Tests License

Convert Claude Code session files (JSON or JSONL) to clean, mobile-friendly HTML pages with pagination.

Example transcript produced using this tool.

Installation

Install this tool using uv:

uv tool install claude-code-transcripts

Or run it without installing:

uvx claude-code-transcripts --help

Usage

This tool converts Claude Code session files into browseable multi-page HTML transcripts.

There are three commands available:

  • local (default) - select from local Claude Code sessions stored in ~/.claude/projects
  • web - select from web sessions via the Claude API
  • json - convert a specific JSON or JSONL session file

The quickest way to view a recent local session:

claude-code-transcripts

This shows an interactive picker to select a session, generates HTML, and opens it in your default browser.

Output options

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 from git push output if not specified)
  • --open - open the generated index.html in your default browser (default if no -o specified)
  • --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 commits
  • page-001.html, page-002.html, etc. - paginated transcript pages

Local sessions

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 local

Use --limit to control how many sessions are shown (default: 10):

claude-code-transcripts local --limit 20

Web sessions

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 --gist

On macOS, API credentials are automatically retrieved from your keychain (requires being logged into Claude Code). On other platforms, provide --token and --org-uuid manually.

JSON/JSONL files

Convert a specific session file directly:

claude-code-transcripts json session.json -o output-directory/
claude-code-transcripts json session.jsonl --open

When using Claude Code for web you can export your session as a session.json file using the teleport command.

Auto-naming output directories

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 -a

Publishing to GitHub Gist

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 --gist

This will output something like:

Gist: https://gist.github.com/username/abc123def456
Preview: https://gistpreview.github.io/?abc123def456/index.html
Files: /var/folders/.../session-id

The preview URL uses gistpreview.github.io to render your HTML gist. The tool automatically injects JavaScript to fix relative links when served through gistpreview.

Combine with -o to keep a local copy:

claude-code-transcripts json session.json -o ./my-transcript --gist

Requirements: The --gist option requires the GitHub CLI (gh) to be installed and authenticated (gh auth login).

Including the source file

Use the --json option to include the original session file in the output directory:

claude-code-transcripts json session.json -o ./my-transcript --json

This will output:

JSON: ./my-transcript/session_ABC.json (245.3 KB)

This is useful for archiving the source data alongside the HTML output.

Development

To contribute to this tool, first checkout the code. You can run the tests using uv run:

cd claude-code-transcripts
uv run pytest

And run your local development copy of the tool like this:

uv run claude-code-transcripts --help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_code_transcripts-0.3.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_code_transcripts-0.3-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file claude_code_transcripts-0.3.tar.gz.

File metadata

  • Download URL: claude_code_transcripts-0.3.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for claude_code_transcripts-0.3.tar.gz
Algorithm Hash digest
SHA256 24861ed5ea34fcee6608b8b00a7492ec5ea32f56aeeda19a68d6a6fcae6bea21
MD5 1204dc7fffa8fb8a1046edd99ef00188
BLAKE2b-256 78ea14e48487f1502202c43bb1d49ba480b16fe8bf52ee99e7683b1c27ff5151

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_code_transcripts-0.3.tar.gz:

Publisher: publish.yml on simonw/claude-code-transcripts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file claude_code_transcripts-0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for claude_code_transcripts-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0899f878bb78355373428e4f5dbe040aeddbceb96be4336039b777d7574c16ba
MD5 f242676f4175e38f5f639c0a69e58a6b
BLAKE2b-256 08134cd5af6fa352ce697fbcd05d67a379502b6bddec10cdbb8702cbf0673f73

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_code_transcripts-0.3-py3-none-any.whl:

Publisher: publish.yml on simonw/claude-code-transcripts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page