Convert Claude Code chat sessions to Markdown
Project description
cc2md
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 cc2md
Or with pip:
pip install cc2md
Or run directly from source:
git clone https://github.com/kcxain/cc2md.git
cd cc2md
pip install -e .
Usage
List sessions
cc2md --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)
cc2md 1 -o chat.md
# By UUID prefix
cc2md a1b2c3 -o chat.md
# By title substring
cc2md "auth middleware" -o chat.md
# Most recent session
cc2md --latest -o chat.md
Filter by project
cc2md --list --project myapp
cc2md --latest --project myapp -o chat.md
Export all sessions
cc2md --all --output-dir ./exports/
Scan a custom directory
By default the tool reads from ~/.claude/projects/. Use --dir to point it at any directory:
# Scan a custom projects directory (subdirs are treated as project dirs)
cc2md --dir /path/to/projects --list
# Scan a single project directory (directly contains *.jsonl session files)
cc2md --dir ./my-project-export --list
The directory type is auto-detected: if *.jsonl files are found directly inside it, it is treated as a project directory; otherwise its subdirectories are treated as project directories.
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 |
--dir |
Directory to scan instead of ~/.claude/projects/ |
--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 →
## Usersections - Assistant messages →
## Assistantsections 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 file and are linked via progress records in the main JSONL.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cc2md-0.1.0.tar.gz.
File metadata
- Download URL: cc2md-0.1.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3940d6b1e43299aa7a699e240d9ad7f7940eb2d22646dadd6938f9c1a4235188
|
|
| MD5 |
480480e6bd5764d409ffebdf15922bae
|
|
| BLAKE2b-256 |
77565403b57494ff87460225ca44db58d6c1b42f1afad21aa388473862400e4f
|
File details
Details for the file cc2md-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cc2md-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18339e4e8e1eda4e2763dffa98bf56aab8d2c3014b6635ce85348cc7d4955a7f
|
|
| MD5 |
506f24501326033da0429671634fb1e5
|
|
| BLAKE2b-256 |
41efb308e7d63f31020e5d7721571c3978d0c2d78d89901b0fe1fd6fe9870458
|