Skip to content

Repository files navigation

Chat Archive

A local Chrome extension that saves the currently open ChatGPT conversation to an Obsidian vault.

The default destination inside the configured vault is:

Automation/chatgpt/

The export stays on your computer. The extension talks to a local Native Messaging helper; it does not run an HTTP server and does not send conversations to another service.

Long conversations are transferred to the helper in chunks, avoiding Chrome's per-message Native Messaging size limit. The installer records the current absolute Node path because Chrome does not inherit the terminal's shell environment. Full ChatGPT conversations are requested directly from the signed-in ChatGPT tab. If that request fails, the extension clearly labels the export as rendered-page and records the reason instead of silently presenting it as complete.

Full diagnostics are appended to:

~/Library/Application Support/Chat Archive/diagnostic.log

Authentication tokens are never written to the log or Markdown export.

Privacy and security model

  • ChatGPT session tokens are read from the signed-in browser tab and used in memory only to request the current conversation.
  • Exported conversations are written by the native helper to the configured Obsidian vault destination.
  • The native helper rejects absolute destination paths and paths that escape the configured vault.
  • Diagnostic logs include conversation IDs, save method, message counts, relative paths, and fallback errors. They do not include message bodies or authentication tokens.
  • The extension uses ChatGPT web endpoints that may change without notice.

Layout experiments

Generate several full-size Obsidian layout prototypes from an exported chat:

./scripts/generate-layout-lab.mjs "/path/to/exported-chat.md" "/path/to/vault"

The generated lab compares several one-file transcript layouts: sticky role headings, foldable headings, dense screenplay, prompt index first, HTML details blocks, and structural variants where user prompts and assistant answers use visibly different markup.

For the optional lab styling, copy assets/obsidian/chat-layout-lab.css into your vault's .obsidian/snippets/ directory and enable the chat-layout-lab CSS snippet in Obsidian.

Install

  1. Install the local helper:

    cd /path/to/chat-archive
    ./scripts/install-native-host.sh
  2. Open chrome://extensions.

  3. Enable Developer mode.

  4. Click Load unpacked.

  5. Choose:

    /path/to/chat-archive/extension
    
  6. Reload any already-open ChatGPT tab once.

To install into another vault:

./scripts/install-native-host.sh "/absolute/path/to/vault"

The destination inside the vault defaults to Automation/chatgpt and can be overridden with CHAT_ARCHIVE_DESTINATION.

The extension ID should be:

hdmjkmgnnmddncfcagjogmmjhjnjedki

Use

Open a saved conversation at https://chatgpt.com/c/..., then use any of:

  • the Export menu inside ChatGPT;
  • the extension icon;
  • ⌥⇧S.

The ChatGPT sidebar is also enhanced locally:

  • each exported or explicitly refreshed chat gets a small badge containing only the number of your messages in the active branch;
  • today's chats remain unlabelled;
  • complete chronological history lists receive quiet boundaries such as Yesterday, 2 days ago, or an exact date; pinned and partially cached lists do not;
  • hovering the badge shows the exact activity date and time;
  • conversation data is downloaded only when you choose Export or explicitly choose Refresh sidebar counts from the in-page Export menu (also available as Refresh counts in the extension popup);
  • the resulting count and activity date are cached locally and reused by the sidebar;
  • counts cached by earlier extension versions are retained locally during upgrade;
  • ordinary ChatGPT page loads and sidebar scrolling trigger no background conversation requests;
  • Refresh counts processes the conversations currently listed in the sidebar, two requests at a time.

The first export creates a Markdown file. Later exports of the same conversation update the generated conversation block in that file.

Text written after the generated block, including the default ## Notes section, is preserved.

The Export → HTML action writes a standalone companion .html file next to the Markdown note in Automation/chatgpt/. If a matching .md already exists, the HTML export reuses the same basename. Later HTML exports update that existing .html file.

Clicking a save/export notification reveals the generated file in Finder.

Each conversation is rendered as a single Markdown note with a prompt-first layout:

  • a compact prompt map links to only your messages;
  • every message has a stable numbered heading;
  • your messages are wrapped as note-style blockquotes;
  • ChatGPT answers stay as plain Markdown prose;
  • a bundled CSS snippet makes the two roles visually distinct while keeping the file lightweight.

The installer copies and enables the chat-archive.css snippet automatically. Restart Obsidian or reload its window after the first installation.

Export format

---
title: "Conversation title"
source: chatgpt
source_url: "https://chatgpt.com/c/..."
conversation_id: "..."
exported_at: "..."
tags:
  - ai-chat
  - chatgpt
cssclasses:
  - chat-archive-user-notes
---

# Conversation title

<!-- chat-archive:start -->

## Your prompt map

- [[#🟣 001 · You|001 · Earlier question preview]]

---

## Conversation

### 🟣 001 · You

> Earlier message…

---

### 🟢 002 · ChatGPT

Recent answer…

<!-- chat-archive:end -->

## Notes

HTML export

The HTML export is standalone: CSS is embedded in the file and no external service is required to open it. It uses the same prompt-first structure as the Markdown export:

  • prompt map at the top;
  • your messages as note-style blocks;
  • ChatGPT answers as plain document text;
  • original ChatGPT conversation link in the header.

Current boundaries

  • ChatGPT is enabled now.
  • Claude and Gemini adapters can be added under extension/sites/.
  • Text, headings, lists, links, tables, blockquotes, and code blocks are exported.
  • Images are represented by their current page URL; they are not downloaded.
  • Canvas and interactive artifacts are not archived yet.
  • The exporter saves the active conversation branch.
  • For long ChatGPT conversations, it reads the full branch from ChatGPT's conversation data. Visible-page extraction remains a fallback if that data is unavailable.

About

Private Chrome extension for archiving ChatGPT conversations to Obsidian

Resources

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages