agarwalvishal/claude-chat-exporter
One-click, privacy-first exporter for Claude.ai chats — clean Markdown with artifacts and attachments, ready for Obsidian and RAG.
Claude Chat Exporter – What it Is
A tiny, open‑source browser script that lets you download any conversation you have on Claude.ai as a clean Markdown file. It runs completely in your browser (no server), pulls the raw markdown Claude generated directly from Claude’s private API, and saves the result locally.
Why It Exists
- The web UI only shows a small window of a long chat and relies on fragile CSS selectors for copy‑buttons.
- Exporting via the UI can miss artifacts, files, charts, or attachments.
- For knowledge‑base tools like Obsidian or Retrieval‑Augmented Generation (RAG) pipelines you need a well‑structured, metadata‑rich markdown document.
Core Features
| Feature | What You Get |
|---|---|
| One‑click bookmarklet | Drag a button to your bookmarks bar, open a Claude chat, click it → a .md file downloads automatically. |
| Perfect markdown fidelity | Reads Claude’s source markdown from the API – no HTML conversion, so tables, math, code, etc. are byte‑perfect. |
| Full element support | Tables, LaTeX math, code blocks, nested lists, links, headings, artifacts, created files, charts/diagrams (as fenced code), and all attachments. |
| Obsidian‑ & RAG‑ready output | YAML front‑matter (title, source, model, exported) plus a top‑level # Human / # Claude heading for each turn – ideal for note‑taking or chunking for retrieval. |
| Timestamps | Per‑message timestamps from Claude’s API. |
| Smart filenames | Uses the conversation title from the API (fallback claude_conversation.md). |
| Privacy‑first | No backend, no tracking; the only network request is the single authenticated call to Claude’s own API. |
| Robust to UI changes | Works off a stable data contract rather than CSS selectors. |
How It Works (in a nutshell)
- Fetch – Calls
GET /api/organizations/{orgId}/chat_conversations/{conversationId}(same‑origin, using your session cookie). The response contains the conversation title, model, and every message. - Order – Reconstructs the current branch of the conversation tree by walking from the
current_leaf_message_uuidup throughparent_message_uuidlinks, then reversing the list. - Extract – Iterates each message’s
contentblocks in order, emitting rawtextblocks and rendering specialtool_useblocks (artifacts,create_file,visualizewidgets) as labelled fenced code. - Build Markdown – Prepends YAML front‑matter, adds a
# Human — …/# Claude — …header for each turn, inserts timestamps, and places attachments (images embedded, text files block‑quoted, other docs linked). - Download – Triggers a browser download of the assembled
.mdfile.
Using It
- Bookmarklet – Visit the install page, drag the “📥 Claude Export” button to your bookmarks bar, open a Claude chat, click the bookmark. The script updates itself automatically.
- Console mode – Copy the
claude-chat-exporter.jssource, paste it into the browser dev console on a Claude conversation page, and press Enter. The script shows a tiny status box and then downloads the file.
Privacy & Security
- Runs entirely client‑side; nothing is sent to the author’s servers.
- The only network request is the authenticated GET to Claude’s own backend (the same request the web UI already makes).
- No data is stored after the download; the bookmarklet’s update check only fetches public script files.
Limitations
- Works only on the Claude web UI while you are logged in.
- Depends on Claude’s undocumented internal API – a breaking change would require a script update.
- Does not export binary attachment data (images/PDFs are linked, not bundled) and skips some tool calls (web search, bash, etc.).
- Requires JavaScript enabled in the browser.
Who Might Use It
- Researchers or developers who want a reproducible record of their Claude sessions.
- Knowledge‑base builders using Obsidian, Notion, or similar tools.
- Anyone building a RAG pipeline that needs clean, timestamped markdown with metadata.
The project is MIT‑licensed and maintained by the author; sponsorship helps keep it up‑to‑date with Claude’s evolving API.
Related
- Project
- Project
- Project
- Project
- Project