Skip to content

About

Chrome extension that exports ChatGPT, Claude and Gemini conversations with every attached file into one self-contained ZIP — locally, no server.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

ThreadVault — AI Chat Exporter

A Chrome extension (Manifest V3) that exports whole AI conversations — ChatGPT, Claude and Gemini — together with every file that was attached to them, into a single self-contained ZIP archive.

No account, no server, no telemetry. The extension talks only to the site you already have open, in the tab you point it at, using your existing session.

threadvault-chatgpt-20261127-1412.zip
├─ index.html                     browsable index of every conversation
├─ README.txt
├─ CONTINUE_PROMPT.md             ready-to-paste prompt for the next assistant
├─ export.json                    machine-readable manifest
└─ conversations/
   ├─ 01-refactor-a-payments-service/
   │  ├─ conversation.md          front matter + full transcript
   │  ├─ conversation.html        standalone, no assets required
   │  ├─ conversation.json        structured transcript
   │  ├─ documents/               documents written in the chat, as text
   │  └─ attachments/
   │     ├─ schema.pdf            the original file
   │     └─ image-1.png
   └─ 02-second-thread/…

Install (unpacked)

  1. Open chrome://extensions.
  2. Turn on Developer mode.
  3. Load unpacked → select this folder.
  4. Pin the icon. Clicking it opens the side panel.

Requires Chrome 116 or newer. The manifest carries a fixed key, so the extension ID (hjmjignfkimbkndenbdbjgkblplekbgg) is identical on every machine and folder — reloading never creates a second copy next to the old one. If your Chromium build has no side panel API (older Chrome, some forks, automated/headless builds), clicking the icon opens the same panel in a tab instead — nothing else changes.

Use

  1. Open the site and sign in: chatgpt.com, claude.ai or gemini.google.com.
  2. Click the ThreadVault icon → the side panel opens on the right.
  3. The panel lists your conversations. Pick one, several, or Select all; filter by text or date.
  4. Choose formats and whether to pull attachments.
  5. Export → one ZIP lands in your Downloads folder.

Every archive also carries CONTINUE_PROMPT.md: an English prompt you can paste into a new chat so another assistant knows what the archive is, which conversations it holds, and how to pick the work up where it stopped — without inventing anything that is missing.

Progress, per-file downloads and any per-conversation warnings are shown in the panel. Nothing is written to disk until the whole package is assembled, so a failed run leaves no half archive.

What is exported

Piece Detail
Transcript Every message of the active branch, in order, with role and timestamp
Markdown YAML front matter (source, conversation_id, model, created, counts) + headings per message
HTML One file, embedded CSS, light/dark aware, print friendly, no scripts, no external assets
JSON Normalised schema threadvault.conversation/1 with stats and attachment metadata
Code & tables Preserved as fenced blocks and pipe tables
Attachments Original bytes, plus the text the host app extracted from a document (embedded in Markdown and JSON)
Images Uploaded and generated images stored next to the transcript
Office documents The original file and its text as Markdown: Word headings, lists, bold and tables; Excel sheets as tables; PowerPoint slides
File types Verified from the bytes, not the label — a .docx served behind an image placeholder is saved as .docx
Documents written in chat Sources written as cat > report.md <<'EOF' blocks are rebuilt and stored under documents/ as real text
Continuation prompt CONTINUE_PROMPT.md at the archive root: what the archive is, the conversation table, and the task for the next assistant
ChatGPT-generated files Files the assistant created (sandbox:/mnt/data/…) are not in the API payload; they are recovered from the page's download cards, including rich "canvas" chips that only resolve their URL on click

Files above 20 MB are skipped and listed under "Export notes" in the Markdown, rather than silently dropped.

Documents are read directly from their ZIP container: .docx, .xlsx and .pptx become Markdown (headings, lists, tables, slides), plain-text formats are embedded as-is, and PDFs are kept as the original file only. Extraction is best effort — a corrupted document is kept as a file and the reason is written into the export notes.

How each site is read

Site Primary path Fallback
ChatGPT Session token → /backend-api/conversations + /backend-api/conversation/{id}, files via /backend-api/files/{id}/download page DOM
Claude /api/organizations → chat_conversations (+ render_all_tools) page DOM
Gemini page DOM, with automatic scroll-to-top to load virtualised history; bulk runs harvest each chat in a temporary background tab —

Three independent adapters sit behind one interface, so a site change breaks one adapter instead of the whole extension. When an API call fails the panel says so and falls back to the rendered page.

Continuing in another chat

  1. Unzip the archive somewhere local.
  2. Start a new chat and attach CONTINUE_PROMPT.md (or paste its text).
  3. Ask the model to read the archive folder. It is told to use the transcripts as the source of truth, to keep earlier decisions, and to flag anything the archive only holds as an image.

Permissions

Permission Why
tabs Read the active tab's URL to decide which adapter applies, and open temporary tabs when harvesting Gemini chats
scripting Inject the collector into the tab you are exporting from; nothing runs on page load
downloads Save the finished ZIP
storage Remember the page size preference
host_permissions (chatgpt.com, claude.ai, gemini.google.com, oaiusercontent.com, googleusercontent.com) Call the site's own conversation endpoints and download the files you attached

No permission is requested for any other site, and no request is made to any third-party service.

Privacy

Everything happens on your machine. The extension reads conversations you can already see in your own session, stores nothing remotely, and never sends data off-device. The only network requests are to the site you are exporting from and the file hosts it uses for your attachments.

Limits worth knowing

  • The exported transcript follows the currently selected branch of a conversation (for ChatGPT), i.e. what the site itself would show you.
  • Gemini has no documented conversation API; its adapter reads the rendered page, so very long chats take a moment while history is scrolled in. Google often changes this markup — if it breaks, the DOM selectors in src/adapters/gemini.js are the one place to fix.
  • Long screenshots delivered as slices (name-1.png, name-2.png, …) are stitched back into a single tall image, so the archive holds one file per screenshot. Toggle: Merge page slices.
  • Contact sheets (a document rendered as a grid of page cards) are detected by row/column variance — a gutter is flat, a page is not — so it works on white and on grey backgrounds, and re-laid into a single column: one tall PNG where the pages follow each other instead of a 4-wide grid.
  • The manifest reports the files actually written (attachmentFiles) and how many slices were merged into a stitched image (mergedSlices).
  • Documents written in the conversation (cat > report.md <<'EOF' …) are saved under documents/ as real text, so the readable source survives even when only preview images exist.
  • Attachments parked on hidden tool messages are re-homed onto the visible answer instead of being dropped.
  • If the transcript was not rendered in the tab you exported from, ChatGPT conversations are re-opened in a controlled background tab, given time to render, scrolled and harvested again.
  • Some file cards have no link at all until you click them. Capture a download in the panel arms a 60-second listener: click the card in the chat and ThreadVault cancels the browser download, fetches the real file and saves it with its proper name.
  • When a conversation references files that could not be resolved, the archive gets a small _debug/api-probe.json (structure only: node ids, roles, attachment names, file ids) so the problem can be diagnosed without access to your account.
  • ChatGPT's own generated files exist only as sandbox: links in the API. Chips that resolve their download only on click are clicked by the extension: the browser download is cancelled and the resolved URL is fetched instead, so the file still lands in the archive. The extension scrolls the transcript and reads the rendered download cards to fetch them; anything the page does not render is listed by name under "Export notes" instead of disappearing.
  • Attachments are capped at 20 MB each. Keep the side panel open during an export; closing it cancels the run (the archive is only written at the end).
  • Save as dialog is optional (off by default) — bulk exports go straight to Downloads.
  • The side panel is detected at runtime; when the API is missing the panel opens in its own tab, so the extension never fails to open.

Development

Plain JavaScript, no build step, no dependencies.

src/
  background.js            service worker: side panel wiring, cross-origin byte fetches
  core/util.js             helpers, Markdown↔HTML, DOM→Markdown
  core/model.js            canonical conversation model
  core/exporters.js        Markdown / HTML / JSON / index / README generators
  core/zip.js              ZIP writer (store + CRC32, UTF-8 names)
  core/transfer.js         content script → service worker byte bridge
  adapters/chatgpt.js      API + DOM adapter
  adapters/claude.js       API + DOM adapter
  adapters/gemini.js       DOM adapter + history loader
  content/collector.js     injected on demand, handles LIST / EXPORT / PING
  sidepanel/               panel UI

Tests

npm test              # 101 checks: ZIP round-trip (also validated with unzip + python zipfile),
                      # exporters, adapter payload mapping, document parsing, XSS escaping
python3 test/e2e.py   # 95 checks in real Chrome: loads the actual extension, mocks
                      # chatgpt.com / claude.ai / gemini.google.com, drives the panel UI,
                      # downloads attachments through the service worker and validates the ZIP

Set `TV_CHROME=/path/to/chrome` if the browser is not auto-detected.

The e2e suite serves Gemini over TLS on 127.0.0.1:443 (self-signed, --ignore-certificate-errors) because tabs opened by the extension bypass request interception — that is the only honest way to test the background-tab harvester.

Privacy, in one line

No account, no server, no analytics: the extension reads conversations your own browser session can already see and writes one local ZIP. See PRIVACY.md.

License

MIT © Mustafa Ali Şirin

About

Chrome extension that exports ChatGPT, Claude and Gemini conversations with every attached file into one self-contained ZIP — locally, no server.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages