Skip to content

Repository files navigation

claude-archiver

Archive Claude.ai conversations to local org-mode files and replace raw Claude URLs in your notes with proper Org id: links.

What it does

  1. archiver.py — Syncs all your Claude chats (plain + project) to ~/org/claude_exports/ as .org files, including thinking blocks, artifacts, attachments, and deep-research citations. Reads from your live Claude.ai session via Playwright — no API keys needed.

  2. claude-archiver.el — Emacs command that finds raw https://claude.ai/chat/<id> URLs across your org-directory and replaces them with [[id:<id>][<title>]] links that resolve to the archived chat files.

Setup

Python archiver

# Install uv if you haven't
curl -LsSf https://astral.sh/uv/install.sh | sh

# Run (symlink run.sh to ~/bin/claude-archiver for convenience)
./run.sh ~/org/claude_exports

Requirements:

  • Playwriter Chrome extension installed and enabled on your Claude.ai tab
  • playwriter CLI on PATH (npm i -g playwriter)
  • pandoc on PATH (for markdown → org conversion)

Emacs link replacement

;; In your Emacs config:
(load-file "/path/to/claude-archiver.el")

;; Required: archived chat files must be in org-id-extra-files
(setq org-id-track-globally t)
(setq org-id-extra-files
      (directory-files-recursively "~/org/claude_exports" "\\.org\\'"))

;; Keep exports dir out of org-agenda-files

Then run M-x claude-archiver-replace-links. First invocation previews; second invocation applies.

Link replacement workflow

  1. M-x claude-archiver-replace-links → select your exports directory
  2. Preview buffer shows each raw Claude URL with its proposed [[id:...][Title]] replacement
  3. RET jumps to source, n/p navigate entries
  4. Run M-x claude-archiver-replace-links again to apply all resolved replacements
  5. If any source buffer is modified, you'll be prompted before editing

Replacements use id: links backed by the :ID: property that archiver.py already writes in each chat file's top heading. No new GUIDs are generated.

URLs inside source blocks, example blocks, comments, drawers, existing bracket links, and inline code/verbatim are not touched.

Output structure

claude_exports/
  manifest.json
  chats/
    My Chat/
      My Chat.org
      attachments/
      artifacts/
  projects/
    My Project/
      instructions.txt
      memory.org
      docs/
      files/
      chats/
        Project Chat/
          Project Chat.org

Each .org chat file has a top-level heading with :ID:, :URL:, and :ARCHIVED: properties, followed by ** Human / ** Claude subtrees with timestamps.

Incremental sync

Re-running the archiver only fetches chats whose current_leaf_message_uuid has changed since the last run. Project instructions, memory, docs, and files are synced by content hash.

Repository structure

archiver.py              — Python orchestrator
claude-archiver.el       — Emacs link replacement
regenerable-api/
  api_client.js           — JS helpers injected into Claude.ai (GENERATED — see .opencode/skills/)
pyproject.toml
run.sh

About

Archive Claude chats and artifacts via Playwriter

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages