Skip to main content

claude2md

Convert Claude.ai or Claude Code chat exports to Markdown format.

claude2md converts chats exported from Claude.ai or Claude Code to Markdown format. This lets you efficiently show entire chats to other models or instances until you struggle to remember which transcript of a chat full of transcripts of chats full of transcripts of chats is the right one (aka slopception).

For Claude.ai chats, claude-backup can fetch a local copy of your chats for claude2md. Give claude2md a chat's ID, name, or URL and it finds the chat in what claude-backup saved.

Features

You can filter the exports to any subset of user, assistant, and thinking blocks. For context management I've found it's often helpful to only export user messages, though obviously for the strongest "continuity" between an exported chat transcript and its consumer you want all context from the prior chat.

Text attachments are inlined and other uploads linked; --embed inlines everything, --no-embed nothing.

You can branch conversations on Claude.ai (and to a lesser extent in Claude Code), and claude2md can export any branch. You can list the branches of a chat and their IDs with claude2md --branches, export a specific branch with claude2md --branch ID, or dump every branch at once with claude2md --all-branches (each line gets tagged with the IDs of the branches that contain it).

We don't support "Claude Code on the Web" yet, though ostensibly if you "teleport" a Web session to a local Claude Code instance, you can export the history as normal from there.

Install

The blazing fast and memory safe way:

$ uvx claude2md --help  # installed on demand

The traditional way:

$ pip install claude2md
$ claude2md --help

The bleeding-edge way:

$ git clone https://github.com/twilligon/claude2md
$ cd claude2md
$ python3 -m venv venv; . venv/bin/activate  # you probably want a venv
$ pip install -e .
$ claude2md --help

Usage

$ claude2md --help
usage: claude2md [-h] [-v] [-e] [-E] [-L] [-B | -b ID | -A] [-n] [-N] [-u]
                 [-a] [-t] [-T]
                 [chat]

Convert Claude.ai or Claude Code chats to Markdown

positional arguments:
  chat                chat JSON, UUID, name, or URL (default: stdin)

options:
  -h, --help          show this help message and exit
  -v, --version       show program's version number and exit
  -e, --embed         embed media as data URLs
  -E, --no-embed      link text attachments like media
  -L, --lossy         make do without what's missing or unsupported

branches:
  -B, --branches      list all branches
  -b, --branch ID     use a specific non-default branch
  -A, --all-branches  show messages from all branches

filters:
  -n, --name          always show chat name (or "Untitled")
  -N, --no-name       never show chat name
  -u, --user          show user messages
  -a, --assistant     show assistant messages
  -t, --thinking      show thinking blocks
  -T, --timestamps    show timestamps

claude2code writes the chat as a Claude Code session and prints the session's ID, so claude --resume "$(claude2code 'Chat name')" carries on with the chat in Claude Code. PDF pages the chat read are rendered with pdftoppm.

$ claude2code --help
usage: claude2code [-h] [-v] [-s PROMPT] [-L] [-B | -b ID] [chat]

Import a Claude.ai chat as a Claude Code session

positional arguments:
  chat                 chat JSON, UUID, name, or URL (default: stdin)

options:
  -h, --help           show this help message and exit
  -v, --version        show program's version number and exit
  -s, --system PROMPT  use a custom system prompt
  -L, --lossy          make do without what's missing or unsupported

branches:
  -B, --branches       list all branches
  -b, --branch ID      use a specific non-default branch

Examples

Claude.ai

$ claude2md -uat c6a33008 | head -n20
# Python packaging complexity

> why is python packaging such a clusterfuck? ultrathink

<thinking>
The user is asking about Python packaging and why it's so complicated/messy. They've also said "ultrathink" which I interpret as wanting a very thorough, deep analysis.

This is a great question that many Python developers have strong feelings about. Let me think through the historical and technical reasons why Python packaging became so complex.

Key issues to cover:
1. Historical evolution - how we got here
2. Multiple competing tools and standards
3. The various problems each tool tries to solve
4. Why there's no single "right" way
5. The current state and attempts to fix things

Let me structure this thoughtfully and comprehensively since they asked for "ultrathink."
</thinking>

Python packaging *is* notoriously complex, and there are deep historical and technical reasons for this. Let me break down why it became such a mess:

Claude Code

$ claude2md ~/.claude/projects/-home-claude-claude2md/0c8de429-fb29-4096-925e-6d81a0437f09.jsonl | head -n3
> rename --leaves and --leaf to --branches and --branch. no need to change how we refer to this stuff internally, only user facing matters. in @claude2md/__init__.py . ultrathink

I'll help you rename the command-line arguments from `--leaves`/`--leaf` to `--branches`/`--branch` in the user-facing interface. Let me start by creating a todo list for this task.

License

claude2md is dedicated to the public domain where possible via CC0-1.0.

Metadata

Release files for claude2md 0.7.1

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

Source distribution (sdist)

Source distribution for claude2md 0.7.1
File Size Uploaded Provenance Actions
claude2md-0.7.1.tar.gz 31.0 kB With provenance Details for claude2md-0.7.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for claude2md 0.7.1
File Interpreter ABI Platform Actions
claude2md-0.7.1-py3-none-any.whl Python 3 none any Details for claude2md-0.7.1-py3-none-any.whl

Total release size: 63.2 kB

Release files / claude2md-0.7.1.tar.gz

Download URL claude2md-0.7.1.tar.gz
Size 31.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e2bea548c2423a0223307190d9ef4871bc32b86669a12356d14c6261b14c319a
BLAKE2b-256 checksum
How to use checksums
ec9eaa9bc3734f50cd85f3bc4b4d5158367de93f2152a1e2522e796a49043cd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 19, 2026.

Transparency log

Release files / claude2md-0.7.1-py3-none-any.whl

Download URL claude2md-0.7.1-py3-none-any.whl
Size 32.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f4e918fed24e2a97c2c939668bc5968b4f9d0e6a19e2d4679d018461d1e4730
BLAKE2b-256 checksum
How to use checksums
e891497dc9307bf1b73ced1d2b296181c0efb7872f8ef28db9ca5c3fca1c32c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 19, 2026.

Transparency log

Security for claude2md 0.7.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for claude2md-0.7.1.tar.gz

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 Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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