Skip to main content

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.

Metadata

Release files for claude-chat-to-md 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for claude-chat-to-md 0.1.0
File Size Uploaded
claude_chat_to_md-0.1.0.tar.gz 8.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for claude-chat-to-md 0.1.0
File Interpreter ABI Platform
claude_chat_to_md-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.0 kB

Release files / claude_chat_to_md-0.1.0.tar.gz

Download URL claude_chat_to_md-0.1.0.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ac5f25e4ea6730d5b386df9ccb8fee3ab950bee2f4316f36ffd98fddca1fdcc8
BLAKE2b-256 checksum
How to use checksums
185c04e3b713ea25a8d0c5da16cae412a27c53991fe878bd7309644f7bebb60a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.

Transparency log

Release files / claude_chat_to_md-0.1.0-py3-none-any.whl

Download URL claude_chat_to_md-0.1.0-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a1d9b46a967743b239f2e54edeb58994db4b19958e6a85c248039461499c629b
BLAKE2b-256 checksum
How to use checksums
cb868e4614477495429ab2b64124730577d6759f8dbc7c4abc94582409dcd617
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page