Skip to content

Add Claude data-export importer (parity with ChatGPT import)#6

Open
thoscut wants to merge 1 commit into
max-ng:mainfrom
thoscut:claude/claude-export-import-f4wopy
Open

Add Claude data-export importer (parity with ChatGPT import)#6
thoscut wants to merge 1 commit into
max-ng:mainfrom
thoscut:claude/claude-export-import-f4wopy

Conversation

@thoscut

@thoscut thoscut commented Jul 17, 2026

Copy link
Copy Markdown

Adds an importer for Claude data exports (the ZIP downloaded from claude.ai → Settings → Privacy → "Export data"), mirroring the existing ChatGPT export import end to end.

  • New src/claude-export.ts: preflight + resumable import job + dedup ledger for Claude's format — single conversations.json array, flat linear chat_messages (human/assistant, ISO timestamps), rich content blocks (text/thinking/tool_use/tool_result/voice_note, token_budget skipped), and text-only attachments via extracted_content. Also imports design_chats/*.json through the same pipeline via a normalized thread model; projects/ metadata is counted but not turned into sessions.
  • New src/export-archive.ts: shared zip/folder reader, media sniffing and small helpers factored out of chatgpt-export.ts so both importers reuse the same battle-tested archive reader instead of duplicating it.
  • Register the new import-only 'claude-export' source across types, config, session titles and transfer-import bookkeeping.
  • Server API: /api/claude-export/import/{preflight,status,start}; source filter + display label.
  • Electron file picker (main + preload) and full web UI: import card, JS handlers, source color/badge/filter, and en/zh-CN/ja strings.
  • scripts/claude-import-smoke.js (+ npm run smoke:claude-import) covering parsing, block mapping, attachments, and re-run dedup.

Verified end to end against a real 319-conversation export (312 non-empty threads imported, correct roles/blocks/timestamps, re-run dedups all) and via the smoke test.

Claude-Session: https://claude.ai/code/session_01CNrWLKk3T8wC2KbwDFJtnB

Adds an importer for Claude data exports (the ZIP downloaded from
claude.ai → Settings → Privacy → "Export data"), mirroring the existing
ChatGPT export import end to end.

- New src/claude-export.ts: preflight + resumable import job + dedup
  ledger for Claude's format — single conversations.json array, flat
  linear chat_messages (human/assistant, ISO timestamps), rich content
  blocks (text/thinking/tool_use/tool_result/voice_note, token_budget
  skipped), and text-only attachments via extracted_content. Also imports
  design_chats/*.json through the same pipeline via a normalized thread
  model; projects/ metadata is counted but not turned into sessions.
- New src/export-archive.ts: shared zip/folder reader, media sniffing and
  small helpers factored out of chatgpt-export.ts so both importers reuse
  the same battle-tested archive reader instead of duplicating it.
- Register the new import-only 'claude-export' source across types,
  config, session titles and transfer-import bookkeeping.
- Server API: /api/claude-export/import/{preflight,status,start}; source
  filter + display label.
- Electron file picker (main + preload) and full web UI: import card, JS
  handlers, source color/badge/filter, and en/zh-CN/ja strings.
- scripts/claude-import-smoke.js (+ npm run smoke:claude-import) covering
  parsing, block mapping, attachments, and re-run dedup.

Verified end to end against a real 319-conversation export (312 non-empty
threads imported, correct roles/blocks/timestamps, re-run dedups all) and
via the smoke test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CNrWLKk3T8wC2KbwDFJtnB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants