Convert Claude Code or Codex chat sessions to Markdown
Project description
cc2md
Convert Claude Code or Codex chat sessions to Markdown.
Install
pip install cc2md
Quick Start
# Extract the most recent session
cc2md --latest -o log
# Extract the most recent Codex session
cc2md --agent codex --latest -o log
If the session spawned subagents, output is a directory:
log/
index.md # main conversation, with links to subagents
reduce-min-host-层实现-a46d2ef.md
reduce-min-device-层实现-a95f57b.md
...
Otherwise, a single log.md is written.
Agent Selection
Use --agent to choose which session format to read:
cc2md --agent claude --latest -o log
cc2md --agent codex --latest -o log
claudereads Claude Code session logscodexreads Codex rollout logs
The default is claude.
Output Format
cc2md tries to keep the transcript easy to scan without losing tool detail:
- Sessions without subagents export as a single Markdown file
- Sessions with subagents export as a directory
- The main conversation is written to
index.md - Each subagent conversation is written to its own Markdown file
index.mdlinks to subagent files at the point where the subagent was spawned
Tool rendering rules:
- Tool calls remain expanded in the transcript
- Tool results are wrapped in
<details>blocks so long outputs stay collapsible - Code-editing operations are rendered inline instead of being collapsed
- Code-editing operations are shown with
diffblocks when the source log contains structured edit data
Code-editing rendering currently covers operations such as:
WriteAddEditMultiEditapply_patchDelete/DeleteFile
Example result layout:
**Tool: exec_command**
```bash
git status --short
```
<details><summary>Result: exec_command</summary>
**Result: exec_command**
```
M README.md
```
</details>
Example edit layout:
**Tool: apply_patch**
Applying patch
```diff
*** Begin Patch
*** Update File: README.md
@@
-old line
+new line
*** End Patch
```
**Result: apply_patch**
```
Success. Updated the following files:
M README.md
```
Usage
cc2md --list # list all sessions
cc2md --latest -o log # most recent session
cc2md --agent codex --latest -o log # most recent Codex session
cc2md 1 -o log # by index from --list
cc2md a1b2c3 -o log # by UUID prefix
cc2md "auth middleware" -o log # by title substring
cc2md --all -d ./exports/ # export everything
cc2md --latest -p myapp -o log # filter by project
Options
| Flag | Description |
|---|---|
--list, -l |
List available sessions |
--latest |
Most recent session |
--all |
Convert all sessions |
--agent |
Source backend: claude or codex |
--project, -p |
Filter by project path substring |
--dir |
Scan a custom directory instead of the default source directory |
--output, -o |
Output path |
--output-dir, -d |
Output directory for --all |
--no-subagents |
Exclude subagent conversations |
--no-tool-results |
Exclude tool call results |
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.3.0.tar.gz.
File metadata
- Download URL: cc2md-0.3.0.tar.gz
- Upload date:
- Size: 21.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efc7bbdd50719f697dc42714a5403b5b4473186f5fd409b670a12eaa363506ad
|
|
| MD5 |
9ca586160c8a2e7bcd0088b93f5f0f5a
|
|
| BLAKE2b-256 |
3ded893909e0b1fff4aa52c4d59c45d6776e184b9c099595cd33f08cca9db572
|
File details
Details for the file cc2md-0.3.0-py3-none-any.whl.
File metadata
- Download URL: cc2md-0.3.0-py3-none-any.whl
- Upload date:
- Size: 24.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79d3d56f8d94b25031e045821b2c06017af95cabfd811a4c96f0f424cd05778e
|
|
| MD5 |
c9b8a248c1f16a45c564b7a7040e34c4
|
|
| BLAKE2b-256 |
f0c7ab8404880f8e334c806ebb457e7cb5598cb6a1b27a3e673c9c61b9acd8ad
|