Metadata-Version: 2.4
Name: claude-export
Version: 0.1.0
Summary: Convert Anthropic Claude exports into an organized local knowledge base.
Author: claude-export contributors
License-Expression: MIT
License-File: LICENSE
Keywords: anthropic,claude,export,knowledge-base,markdown
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Text Processing :: Markup :: Markdown
Classifier: Topic :: Utilities
Requires-Python: >=3.12
Requires-Dist: orjson>=3.10
Requires-Dist: pydantic>=2.7
Requires-Dist: rich>=13.7
Requires-Dist: typer>=0.12
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Description-Content-Type: text/markdown

# claude-export

Anthropic Claude exports can be difficult to browse. `claude-export` is a CLI tool that converts a raw Claude export (either a ZIP file or a folder) into a fully organized local knowledge base.

It handles conversation splitting, beautiful markdown generation, code block extraction, Claude Projects parsing, artifact recovery, and comprehensive stats generation.

## Installation

Ensure you have Python 3.12 or newer installed.

Clone this repository and install it in editable mode:

```bash
git clone https://github.com/yourusername/claude-export.git
cd claude-export
pip install -e .
```

## CLI Usage

The primary command is `all`, which generates the complete output structure.

```bash
# Process a ZIP file
claude-export all path/to/export.zip

# Process an extracted folder
claude-export all path/to/export_folder

# Specify a custom output directory (default is ./output)
claude-export all path/to/export.zip --output ./my_knowledge_base
```

### Modular Commands

Each feature of `claude-export` can also be run independently if you only need specific data:

- `claude-export split <path>` - Splits `conversations.json` into individual JSON files.
- `claude-export markdown <path>` - Generates beautiful, readable Markdown files for each conversation.
- `claude-export projects <path>` - Extracts Claude Projects and organizes related conversations.
- `claude-export artifacts <path>` - Recovers large assistant outputs (like React components, SVG code, etc.).
- `claude-export code <path>` - Extracts every fenced code block, sorted by language, with smart deduplication.
- `claude-export search <path>` - Generates a unified `search.json` index.
- `claude-export stats <path>` - Generates a `stats.json` with comprehensive usage metrics.

## Directory Layout

The `all` command produces the following organized structure in the output directory:

```text
output/
    conversations/        # One JSON file per conversation
    markdown/             # Beautiful, readable Markdown versions of conversations
    projects/             # Folders for each Claude Project, with associated conversations
    artifacts/            # Recovered <antArtifact> outputs
    code/                 # Extracted code blocks categorized by language (e.g., code/python/)
    index.json            # Basic list of all conversations
    search.json           # Unified search index
    stats.json            # Statistics about your usage
    manifest.json         # A manifest of all files generated during the export
```

## Features

- **Conversation Splitter:** Splits the monolithic `conversations.json` into individual, safely named JSON files.
- **Markdown Export:** Renders complete conversations with metadata (UUID, Created/Updated times, Message count), keeping formatting intact.
- **Code Extraction:** Extracts fenced code blocks, attempts to read filenames from comments, and prevents duplicate files using SHA256 hashes.
- **Artifact Recovery:** Recovers `<antArtifact>` contents and saves them individually.
- **Projects Integration:** Reads project JSON structures and groups conversations inside their respective project directories.
- **Cross-Platform:** Works seamlessly across Linux, macOS, and Windows, using memory-efficient parsing for large files where practical.

## Limitations

- Tool use and tool results are preserved as formatted JSON or text within the Markdown files, but complex interactive elements cannot be perfectly reproduced locally.
- Claude's export formats can change over time. If a new schema is introduced, `claude-export` attempts to gracefully extract as much data as possible using Pydantic's `extra="allow"` behavior, but some new features might not be fully mapped.
- Exporting extremely massive ZIP files directly into memory might be resource-intensive, though `orjson` is used for high-performance parsing.

## License

MIT License
