导出 claude code 的讨论记录
使用 claude-code-transcripts 可以便捷的导出 claude code 的讨论记录。

claude code 原始历史记录,你可以在你的全局 Claude 目录里找到它。
在 Mac 上,就是 ~/.claude/projects。 你会找到一个包含消息历史记录的文件夹,每个项目都有一个,但它不容易阅读。
Simon Willison 最近发布了一个很棒的工具,可以让你可视化这个历史记录。
claude-code-transcripts 安装
pip install claude-code-transcripts
claude-code-transcripts 使用说明:
This tool converts Claude Code session files into browseable multi-page HTML transcripts.
There are four commands available:
- local (default) - select from local Claude Code sessions stored in ~/.claude/projects
- web - select from web sessions via the Claude API
- json - convert a specific JSON or JSONL session file
- all - convert all local sessions to a browsable HTML archive
The quickest way to view a recent local session:
claude-code-transcripts
This shows an interactive picker to select a session, generates HTML, and opens it in your default browser.
Output options All commands support these options:
-o, --output DIRECTORY - output directory (default: writes to temp dir and opens browser)
-a, --output-auto - auto-name output subdirectory based on session ID or filename
--repo OWNER/NAME - GitHub repo for commit links (auto-detected from git push output if not specified)
--open - open the generated index.html in your default browser (default if no -o specified)
--gist - upload the generated HTML files to a GitHub Gist and output a preview URL
--json - include the original session file in the output directory