Skip to main content

Export Claude Code conversations from ~/.claude/projects. Extract, search, and backup Claude chat history to markdown files.

Project description

Claude Conversation Extractor - Export Claude Code Conversations to Markdown | Save Chat History

๐Ÿš€ The ONLY tool to export Claude Code conversations. Extract Claude chat history from ~/.claude/projects, search through logs, and backup your AI programming sessions.

๐ŸŽฎ Two Ways to Use

  • claude-start - Interactive UI with ASCII art logo, real-time search, and menu-driven interface (recommended)
  • claude-extract - Plain CLI for command-line operations and scripting

Python 3.8+ License: MIT PyPI version Downloads GitHub stars Export Claude Code Claude Code Logs

Export Claude Code conversations with the #1 extraction tool. Claude Code stores chats in ~/.claude/projects as JSONL files with no export button - this tool solves that.

๐Ÿ”ฅ What users search for: Export Claude conversations | Claude Code logs location | Backup Claude sessions | Claude JSONL to Markdown

๐Ÿ“ธ How to Export Claude Code Conversations - Demo

Export Claude Code conversations demo - Claude Conversation Extractor in action

๐ŸŽฏ Can't Export Claude Code Conversations? We Solved It.

Claude Code has no export button. Your conversations are trapped in ~/.claude/projects/ as undocumented JSONL files. You need:

  • โŒ Export Claude Code conversations before they're deleted
  • โŒ Search Claude Code chat history to find that solution from last week
  • โŒ Backup Claude Code logs for documentation or sharing
  • โŒ Convert Claude JSONL to Markdown for readable archives

โœ… Claude Conversation Extractor: The First Export Tool for Claude Code

This is the ONLY tool that exports Claude Code conversations:

  • โœ… Finds Claude Code logs automatically in ~/.claude/projects
  • โœ… Extracts Claude conversations to clean Markdown files
  • โœ… Searches Claude chat history with real-time results
  • โœ… Backs up all Claude sessions with one command
  • โœ… Works on Windows, macOS, Linux - wherever Claude Code runs

โœจ Features for Claude Code Users

  • ๐Ÿ” Real-Time Search: Search Claude conversations as you type - no flags needed
  • ๐Ÿ“ Claude JSONL to Markdown: Clean export without terminal artifacts
  • โšก Find Any Chat: Search by content, date, or conversation name
  • ๐Ÿ“ฆ Bulk Export: Extract all Claude Code conversations at once
  • ๐ŸŽฏ Zero Config: Just run claude-extract - we find everything automatically
  • ๐Ÿš€ No Dependencies: Pure Python - no external packages required
  • ๐Ÿ–ฅ๏ธ Cross-Platform: Export Claude Code logs on any OS
  • ๐Ÿ“Š 97% Test Coverage: Reliable extraction you can trust

๐Ÿ“ฆ Install Claude Conversation Extractor

Quick Install (Recommended)

# Using pipx (solves Python environment issues)
pipx install claude-conversation-extractor

# OR using pip
pip install claude-conversation-extractor

Platform-Specific Setup

macOS
# Install pipx first
brew install pipx
pipx ensurepath

# Then install the extractor
pipx install claude-conversation-extractor
Windows
# Install pipx
py -m pip install --user pipx
py -m pipx ensurepath
# Restart terminal, then:

# Install the extractor
pipx install claude-conversation-extractor
Linux
# Ubuntu/Debian
sudo apt install pipx
pipx ensurepath

# Install the extractor
pipx install claude-conversation-extractor

๐Ÿš€ How to Export Claude Code Conversations

Quick Start - Export Claude Conversations

# Run the interactive UI with ASCII art logo and real-time search
claude-start

# Run the standard CLI interface
claude-extract

# Search for specific content directly
claude-search "API integration"

# Note: claude-logs also works for backward compatibility

That's it! The tool will:

  1. Find your Claude Code conversations in ~/.claude/projects
  2. Show an interactive menu to search or export
  3. Convert Claude JSONL files to readable Markdown, JSON, or HTML

Export Claude Code Logs - All Methods

# Interactive mode with UI - easiest way to export Claude conversations
claude-start

# CLI mode - command-line interface
claude-extract

# List all Claude Code conversations
claude-extract --list

# Export specific Claude chats by number
claude-extract --extract 1,3,5

# Export recent Claude Code sessions
claude-extract --recent 5

# Backup all Claude conversations at once
claude-extract --all

# Save Claude logs to custom location
claude-extract --output ~/my-claude-backups

๐Ÿ“„ Export Formats - NEW in v1.1.1!

Export conversations in multiple formats:

# Export as JSON for programmatic processing
claude-extract --format json --extract 1

# Export as HTML with beautiful formatting
claude-extract --format html --all

# Include tool use, MCP responses, and system messages
claude-extract --detailed --extract 1

# Combine options for complete exports
claude-extract --format html --detailed --recent 5

Supported Formats:

  • Markdown (default) - Clean, readable text format
  • JSON - Structured data for analysis and processing
  • HTML - Beautiful web-viewable format with syntax highlighting

Detailed Mode (--detailed): Includes complete conversation transcript with:

  • Tool use invocations and parameters
  • MCP server responses
  • System messages and errors
  • Terminal command outputs
  • All metadata from the conversation

๐Ÿ” Search Claude Code Chat History

Search across all your Claude conversations:

# Method 1: Direct search command
claude-search                    # Prompts for search term
claude-search "zig build"        # Search for specific term
claude-search "error handling"   # Multi-word search

# Method 2: From interactive menu
claude-extract
# Select "Search conversations" for real-time search

Search features:

  • Fast full-text search across all conversations
  • Case-insensitive by default
  • Finds exact matches, partial matches, and patterns
  • Shows match previews and conversation context
  • Option to extract matching sessions directly

๐Ÿ“ Where Are Claude Code Logs Stored?

Claude Code Default Locations:

  • macOS/Linux: ~/.claude/projects/*/chat_*.jsonl
  • Windows: %USERPROFILE%\.claude\projects\*\chat_*.jsonl
  • Format: Undocumented JSONL with base64 encoded content

Exported Claude Conversation Locations:

~/Desktop/Claude logs/claude-conversation-2025-06-09-abc123.md
โ”œโ”€โ”€ Metadata (session ID, timestamp)
โ”œโ”€โ”€ User messages with ๐Ÿ‘ค prefix
โ”œโ”€โ”€ Claude responses with ๐Ÿค– prefix
โ””โ”€โ”€ Clean Markdown formatting

โ“ Frequently Asked Questions

How do I export Claude Code conversations?

Install with pipx install claude-conversation-extractor then run claude-extract. The tool automatically finds all conversations in ~/.claude/projects.

How do I export the detailed transcript with tool use?

Use the --detailed flag to include tool invocations, MCP responses, terminal outputs, and system messages:

claude-extract --detailed --format html --extract 1

This gives you the complete conversation as seen in Claude's Ctrl+R view.

Where does Claude Code store conversations?

Claude Code saves all chats in ~/.claude/projects/ as JSONL files. There's no built-in export feature - that's why this tool exists.

Can I search my Claude Code history?

Yes! Run claude-search or select "Search conversations" from the menu. Type anything and see results instantly.

How to backup all Claude Code sessions?

Run claude-extract --all to export every conversation at once, or use the interactive menu option "Export all conversations".

Does this work with Claude.ai (web version)?

No, this tool specifically exports Claude Code (desktop app) conversations. Claude.ai has its own export feature in settings.

Can I convert Claude JSONL to other formats?

Yes! Version 1.1.1 supports multiple export formats:

  • Markdown - Default clean text format
  • JSON - Structured data with timestamps and metadata
  • HTML - Beautiful web-viewable format with modern styling Use --format json or --format html when extracting.

Is this tool official?

No, this is an independent open-source tool. It reads the local Claude Code files on your computer - no API or internet required.

๐Ÿ“Š Why This is the Best Claude Code Export Tool

Feature Claude Conversation Extractor Manual Copy Claude.ai Export
Works with Claude Code โœ… Full support โœ… Tedious โŒ Different product
Bulk export โœ… All conversations โŒ One at a time โŒ N/A
Search capability โœ… Real-time search โŒ None โŒ N/A
Clean formatting โœ… Perfect Markdown โŒ Terminal artifacts โŒ N/A
Zero configuration โœ… Auto-detects โŒ Manual process โŒ N/A
Cross-platform โœ… Win/Mac/Linux โœ… Manual works โŒ N/A

๐Ÿ”ง Technical Details

How Claude Conversation Extractor Works

  1. Locates Claude Code logs: Scans ~/.claude/projects for JSONL files
  2. Parses undocumented format: Handles Claude's internal data structure
  3. Extracts conversations: Preserves user inputs and Claude responses
  4. Converts to Markdown: Clean format without terminal escape codes
  5. Enables search: Indexes content for instant searching

Requirements

  • Python 3.8+ (works with 3.9, 3.10, 3.11, 3.12)
  • Claude Code installed with existing conversations
  • No external dependencies for core features

Optional: Advanced Search with spaCy

# For semantic search capabilities
pip install spacy
python -m spacy download en_core_web_sm

๐Ÿค Contributing

Help make the best Claude Code export tool even better! See CONTRIBUTING.md.

Development Setup

# Clone the repo
git clone https://github.com/ZeroSumQuant/claude-conversation-extractor.git
cd claude-conversation-extractor

# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install dev dependencies
pip install -r requirements-dev.txt

# Run tests
pytest

๐Ÿ› Troubleshooting Claude Export Issues

Can't find Claude Code conversations?

  • Ensure Claude Code has been used at least once
  • Check ~/.claude/projects/ exists and has .jsonl files
  • Verify read permissions on the directory
  • Try ls -la ~/.claude/projects/ to see if files exist

"No Claude sessions found" error

  • Claude Code must be installed and used before exporting
  • Check the correct user directory is being scanned
  • Ensure you're running the tool as the same user who uses Claude Code

Installation issues?

See INSTALL.md for:

  • Fixing "externally managed environment" errors
  • PATH configuration help
  • Platform-specific troubleshooting

๐Ÿ”’ Privacy & Security

  • โœ… 100% Local: Never sends your Claude conversations anywhere
  • โœ… No Internet: Works completely offline
  • โœ… No Tracking: Zero telemetry or analytics
  • โœ… Open Source: Audit the code yourself
  • โœ… Read-Only: Never modifies your Claude Code files

๐Ÿ“ˆ Roadmap for Claude Code Export Tool

โœ… Completed in v1.1.1

  • Export Claude Code conversations to Markdown
  • Real-time search for Claude chat history
  • Bulk export all Claude sessions
  • Export to JSON format with metadata
  • Export to HTML with beautiful formatting
  • Detailed transcript mode with tool use/MCP responses
  • Direct search command (claude-search)

๐Ÿšง Planned Features

  • Export to PDF format
  • Automated daily backups of Claude conversations
  • Integration with Obsidian, Notion, Roam
  • Watch mode for auto-export of new conversations
  • Filter by date range (--after, --before flags)
  • Export statistics and analytics dashboard

โš–๏ธ Legal Disclaimer

This tool accesses Claude Code conversation data stored locally in ~/.claude/projects on your computer. You are accessing your own data. This is an independent project not affiliated with Anthropic. Use responsibly and in accordance with Claude's terms of service.

๐Ÿ“œ License

MIT License - see LICENSE for details.

๐Ÿ™ Support the Project

If this tool helps you export Claude Code conversations:

  • โญ Star this repo to help others find it
  • ๐Ÿ› Report issues if you find bugs
  • ๐Ÿ’ก Suggest features you'd like to see
  • ๐Ÿ“ฃ Share with other Claude Code users

Keywords: export claude code conversations, claude conversation extractor, claude code export tool, backup claude code logs, save claude chat history, claude jsonl to markdown, ~/.claude/projects, extract claude sessions, claude code no export button, where are claude code logs stored, claude terminal logs, anthropic claude code export

Note: This is an independent tool for exporting Claude Code conversations. Not affiliated with Anthropic.

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

claude_conversation_extractor-1.1.2.tar.gz (64.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_conversation_extractor-1.1.2-py3-none-any.whl (33.3 kB view details)

Uploaded Python 3

File details

Details for the file claude_conversation_extractor-1.1.2.tar.gz.

File metadata

File hashes

Hashes for claude_conversation_extractor-1.1.2.tar.gz
Algorithm Hash digest
SHA256 ac20aa648edf4f255f147ffb020b8dc46dbc8147076bf438cb69babe81e735af
MD5 1125520c78ab0e69751d5d381952371a
BLAKE2b-256 511624a606357a769224be5849241ad03441aa831174387e448b8ca2f49e47b5

See more details on using hashes here.

File details

Details for the file claude_conversation_extractor-1.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for claude_conversation_extractor-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 757cc4bb59d7eaf79c1716293ed17b804ebb42e51f03bea979cfe1fbd175a049
MD5 000c9456975fd159c3dfeeef7a60af92
BLAKE2b-256 00f1c71ab5d148ffd322f7243cd824d8b5a75334d999802fccc08c8f7fb8c158

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page