Skip to content

Repository files navigation

multi-ai-session-data-extractor

tests Python 3.12+ License: MIT

Capture, preserve, and explore your own sessions across AI platforms (ChatGPT, Claude.ai, Gemini, NotebookLM, Qwen, DeepSeek, Perplexity, Grok, Kimi) plus command-line tools (Claude Code, Codex, Gemini CLI, Antigravity CLI). Data is preserved locally in canonical format (parquet), even if you delete it from the server.

The repository contains the code, documentation, and DVC pointers; personal data, browser profiles, and private operating notes stay outside Git. This makes it possible to rebuild a working machine without publishing the archive itself.

This tool is for personal use, with your own accounts. It uses the platforms' internal APIs authenticated with cookies from your own login (access you already have). It is not a tool for scraping data from other users or for bypassing terms of use — and should not be used that way.

Streamlit dashboard showing all sources with status, total counts, and cross-platform views

The problem

AI platforms have limited official exports, often broken, with no guarantee of retention. You have no way of knowing whether an old conversation will be accessible 6 months from now, or whether a new feature will disappear taking data with it.

This project solves that by capturing everything locally:

  • Conversations, projects, knowledge files, artifacts (canvas, deep research reports, slide decks)
  • Generated images (DALL-E, Nano Banana), user uploads, mind maps
  • Voice messages (transcripts), thinking blocks (reasoning), tool calls
  • Chats deleted on the server — preserved in the local cumulative archive and in the published canonical base

Output in parquet (unified schema across all 13 sources), ready for analysis in pandas/DuckDB/Quarto/whatever you prefer.

Current status

All 13 sources have implemented capture/copy, consolidation where applicable, canonical parsing, and descriptive visualization (Quarto):

Source Type Coverage
ChatGPT web branches, voice, DALL-E, projects, custom GPT
Claude.ai web thinking, tool use+MCP, project_docs with inline content
Perplexity web threads + pages + spaces + 9 artifact types
Qwen web 8 chat types (search, research, dalle, etc.), projects
DeepSeek web R1 reasoning (thinking in ~31% of msgs), token usage
Gemini web multi-account (2 Google accounts), 8 models
NotebookLM web 2 active accounts plus a separate legacy archive; 9 output types (audio, video, slide deck, etc.)
Grok web conversations, workspaces, tool events, assets, scheduled tasks
Kimi web chats, installed skills, tool events, signed asset downloads
Claude Code CLI local sessions (~/.claude/projects/), subagents
Codex CLI local sessions (~/.codex/sessions/), exact latency per tool call
Gemini CLI CLI local sessions (~/.gemini/tmp/)
Antigravity CLI CLI local trajectories (~/.gemini/antigravity-cli/brain/)

The automated test suite covers extractors, reconcilers, parsers, the canonical schema, dashboard, and unification. Known limitations and gaps are documented in extractor engineering's known limitations.

Quickstart

Prerequisites: Python ≥3.12, macOS or Linux. Windows not tested.

git clone <repo>
cd multi-ai-session-data-extractor
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
playwright install chromium

Login (once per platform — opens a browser, you log in manually, close):

python scripts/chatgpt-login.py

Sync web data (capture + consolidation), then parse it:

python scripts/chatgpt-sync.py
python scripts/chatgpt-parse.py

Result:

  • data/raw/ChatGPT/ — raw capture (cumulative, keeps binaries)
  • data/merged/ChatGPT/ — consolidated version (also keeps conversations deleted from the server)
  • data/processed/ChatGPT/*.parquet — canonical format for analysis

ChatGPT platform drill-down — capture status, content metrics, monthly creation chart, models, projects, knowledge files, and reconcile history

Repeat the 2 commands for other web platforms (claude-login.py, gemini-sync.py, etc.). CLI sources are copied and parsed by their respective *-sync.py commands. Details in docs/SETUP.md.

If you are restoring an existing personal archive rather than starting a new one, first restore your private DVC configuration and run dvc pull. The DVC runbook explains that recovery path and the data retention policy.

How it works

extractor → reconciler → parser → unify
   raw    →  merged    → processed (per-source) → unified (cross-source)
  1. Extractor downloads via the platform's internal API (authenticated with your cookie).
  2. Reconciler consolidates what you just captured with what you already had — preserving records that disappeared from the server.
  3. Parser converts the raw JSON into parquet with a unified schema: Conversation, Message, ToolEvent, Branch (and a few auxiliaries per platform — ProjectDoc, NotebookLMOutput, etc.).
  4. Unify consolidates the parquets from the 13 sources into a single data/unified/ with 13 parquet files (4 canonical + 9 auxiliaries), ready for cross-platform analysis.

Full schema in src/schema/models.py. Capture and parser terminology is in the extractor engineering glossary.

Capture: visible browser or background

Login is always with a visible window (once per platform — you need to log in manually). Capture after that varies:

Platform Capture
Claude.ai, Gemini, NotebookLM, Qwen, DeepSeek, Grok, Kimi No visible window
ChatGPT, Perplexity Visible window (Cloudflare detects scraping without a window)

If you run Claude.ai/Gemini/NotebookLM/Qwen/DeepSeek/Grok/Kimi and see a window open during capture: something is wrong (likely an expired cookie). For ChatGPT/Perplexity: expected behavior.

Commands per platform

Each web platform has 2-4 scripts in scripts/. Pattern:

python scripts/<plat>-login.py    # once — manual login in the browser
python scripts/<plat>-sync.py     # capture + consolidation
python scripts/<plat>-parse.py    # merged -> canonical parquet

Common web-sync flags (availability varies by source):

  • --full — force full recapture (skips the incremental path)
  • --no-binaries — skip asset downloads (images, slide decks, etc.)
  • --no-reconcile — skip consolidation (capture only)
  • --dry-run — show what would happen without executing

Full list of commands per platform: docs/operations/pipeline.md.

Dashboard

Local Streamlit visualization — cross-platform totals, per-platform status, links to the descriptive documents:

PYTHONPATH=. .venv/bin/streamlit run dashboard.py

Opens at http://localhost:8501. Read-only over what sync produced — does not write or edit.

Details in docs/operations/dashboard.md.

Descriptive documents (Quarto)

Platform and cross-platform profiles cover data schema, coverage, distributions, and examples. They share templates to avoid duplication.

QUARTO_PYTHON="$(pwd)/.venv/bin/python" quarto render notebooks/chatgpt.qmd
QUARTO_PYTHON="$(pwd)/.venv/bin/python" quarto render notebooks/00-overview.qmd

Cross-platform Quarto data profile — cumulative growth chart by platform and activity heatmap (hour × day) consolidating all sources

To view the generated HTMLs locally:

./scripts/serve-qmds.sh open

Tests

PYTHONPATH=. .venv/bin/pytest                    # everything
PYTHONPATH=. .venv/bin/pytest tests/parsers/     # parsers only

Documentation

Principles

  1. Capture once, never downgrade. Once something is captured, it stays local. Reruns only fetch new items.
  2. Preservation above all. Conversations/files deleted on the server remain local with the is_preserved_missing=True flag.
  3. The canonical schema is the boundary. Parsers deliver parquet in a unified schema; analysis consumes parquet. No platform particularities leak into the analysis stage.
  4. Fall back safely in suspicious cases. If a discovery listing drops materially versus known history, the extractor must not trust it blindly; the applicable platform guardrail preserves or refetches known records.

License

MIT — see LICENSE.

Contributing

Issues and PRs welcome. Details in docs/CONTRIBUTING.md. The technical guide for a new platform is adding-a-platform.md.

About

A local-first archive for capturing, preserving, and exploring your own AI interactions across chats and CLI sessions over time — keeping your history accessible when platforms change or content disappears.

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages