Skip to main content

Convert Claude Code chat sessions to Markdown

Project description

claude-chat-to-md

Convert Claude Code chat sessions to clean, readable Markdown — including subagent conversations.

Claude Code persists full chat history as JSONL files under ~/.claude/projects/. This tool reads those files and produces well-formatted Markdown with proper headings, code blocks, and collapsible sections for tool results and subagent conversations.

Install

pipx install claude-chat-to-md

Or with pip:

pip install claude-chat-to-md

Or run directly from source:

git clone https://github.com/luckynick/claude-chat-to-md.git
cd claude-chat-to-md
pip install -e .

Usage

List sessions

claude-chat-to-md --list
#    Date                 ID           Title                                              Project
------------------------------------------------------------------------------------------------------------------------
1    2025-10-15 14:30     a1b2c3d4..   Refactor auth middleware                            dev/myapp
2    2025-10-14 09:15     e5f6a7b8..   Add user settings page                              dev/myapp
3    2025-10-13 16:45     c9d0e1f2..   Debug CI pipeline                                   dev/infra

Convert a session

# By index (from --list)
claude-chat-to-md 1 -o chat.md

# By UUID prefix
claude-chat-to-md a1b2c3 -o chat.md

# By title substring
claude-chat-to-md "auth middleware" -o chat.md

# Most recent session
claude-chat-to-md --latest -o chat.md

Filter by project

claude-chat-to-md --list --project myapp
claude-chat-to-md --latest --project myapp -o chat.md

Export all sessions

claude-chat-to-md --all --output-dir ./exports/

Options

Flag Description
--list, -l List all available sessions
--latest Convert the most recent session
--all Convert all sessions
--project, -p Filter sessions by project path substring
--output, -o Output file (default: stdout)
--output-dir, -d Output directory for --all mode
--no-subagents Exclude subagent conversations
--no-tool-results Exclude tool call results

Output format

  • User messages## User sections
  • Assistant messages## Assistant sections with text and tool calls
  • Tool results → collapsible <details> blocks
  • Subagent conversations → collapsible <details> blocks with full prompt/response
  • Code → fenced code blocks with language hints
  • Diffs → displayed as unified diff format
  • System tags (<ide_opened_file>, <system-reminder>) are stripped

How it works

Claude Code stores sessions at:

~/.claude/projects/<encoded-project-path>/<session-uuid>.jsonl

Each line is a JSON object: user messages, assistant messages (with tool_use blocks), tool_result responses, and metadata. Subagent conversations live in a subagents/ subdirectory alongside the main session.

Requirements

Python 3.10+ — no external dependencies.

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_chat_to_md-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

claude_chat_to_md-0.1.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file claude_chat_to_md-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for claude_chat_to_md-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ac5f25e4ea6730d5b386df9ccb8fee3ab950bee2f4316f36ffd98fddca1fdcc8
MD5 b6950194c9d50b0eca253b330de9dfaa
BLAKE2b-256 185c04e3b713ea25a8d0c5da16cae412a27c53991fe878bd7309644f7bebb60a

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_chat_to_md-0.1.0.tar.gz:

Publisher: publish.yml on luckynick/claude-chat-to-md

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_chat_to_md-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for claude_chat_to_md-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a1d9b46a967743b239f2e54edeb58994db4b19958e6a85c248039461499c629b
MD5 dc247d97ecf9a18aecddef9ecc7d8701
BLAKE2b-256 cb868e4614477495429ab2b64124730577d6759f8dbc7c4abc94582409dcd617

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_chat_to_md-0.1.0-py3-none-any.whl:

Publisher: publish.yml on luckynick/claude-chat-to-md

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