# darkonlikescoffee/ai-archive architecture

> Architecture diagram of the GitHub repository darkonlikescoffee/ai-archive, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/darkonlikescoffee/ai-archive
- Repository: https://github.com/darkonlikescoffee/ai-archive

## Overview

AI Conversation Archive syncs Claude conversations into a portable GitHub repository of Markdown conversations and assets, with a web reader for search and browsing. The extension workflow fetches the active Claude conversation branch and attachments, normalizes them, then commits changed Markdown, assets, and the navigation index in one GitHub sync. The web app connects to GitHub, searches the index, and opens conversations and image assets. The graph reflects sampled calls and README-documented storage behavior; some extension message-handler wiring is unsampled.

Main entry points: [`extension/content.js`](https://github.com/darkonlikescoffee/ai-archive/blob/master/extension/content.js) (Claude collector), [`extension/background.js`](https://github.com/darkonlikescoffee/ai-archive/blob/master/extension/background.js) (Sync coordinator), [`extension/popup.js`](https://github.com/darkonlikescoffee/ai-archive/blob/master/extension/popup.js) (Sync popup), [`web/src/main.jsx`](https://github.com/darkonlikescoffee/ai-archive/blob/master/web/src/main.jsx) (Archive dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_extension["Browser extension sync"]
  node_popup["Sync popup<br/>[popup.js]"]
  node_collector["Claude collector<br/>[content.js]"]
  node_settings["Extension settings<br/>[popup.js]"]
  node_chrome_store[("Extension storage")]
end

subgraph group_archive["Archive generation"]
  node_background["Sync coordinator<br/>[background.js]"]
  node_branch["Active branch selection<br/>[content.js]"]
  node_attachments["Attachment collection<br/>[content.js]"]
  node_markdown["Markdown and asset writer<br/>[background.js]"]
  node_index["Search index<br/>[README.md]"]
  node_archivefiles["Markdown archive<br/>[README.md]"]
end

subgraph group_web["Web archive reader"]
  node_webapp["Archive dashboard<br/>[main.jsx]"]
  node_github_client["GitHub reader<br/>[github.js]"]
  node_reader["Conversation and asset reader<br/>[main.jsx]"]
end

subgraph group_integrations["External services"]
  node_claude["Claude.ai"]
  node_github[("GitHub repository")]
end

node_user(("Archive user"))

node_user -->|"starts sync"| node_popup
node_popup -->|"saves settings"| node_settings
node_settings -->|"writes settings"| node_chrome_store
node_popup -->|"requests sync"| node_collector
node_collector -->|"fetches conversations"| node_claude
node_collector -->|"selects lineage"| node_branch
node_collector -->|"collects files"| node_attachments
node_collector -.->|"hands off normalized data"| node_background
node_background -->|"prepares sync files"| node_markdown
node_background -->|"uploads and commits"| node_github
node_markdown -->|"writes conversations"| node_archivefiles
node_markdown -->|"updates navigation cache"| node_index
node_archivefiles -->|"stored in repository"| node_github
node_index -->|"stored in repository"| node_github
node_background -->|"reports progress"| node_popup
node_user -->|"opens archive"| node_webapp
node_webapp -->|"loads and opens entries"| node_github_client
node_github_client -->|"reads repository contents"| node_github
node_webapp -->|"renders conversations"| node_reader
node_reader -->|"loads conversation and assets"| node_github_client
node_github -.->|"provides archive data"| node_webapp

click node_popup "https://github.com/darkonlikescoffee/ai-archive/blob/master/extension/popup.js"
click node_collector "https://github.com/darkonlikescoffee/ai-archive/blob/master/extension/content.js"
click node_background "https://github.com/darkonlikescoffee/ai-archive/blob/master/extension/background.js"
click node_branch "https://github.com/darkonlikescoffee/ai-archive/blob/master/extension/content.js"
click node_attachments "https://github.com/darkonlikescoffee/ai-archive/blob/master/extension/content.js"
click node_markdown "https://github.com/darkonlikescoffee/ai-archive/blob/master/extension/background.js"
click node_index "https://github.com/darkonlikescoffee/ai-archive/blob/master/README.md"
click node_archivefiles "https://github.com/darkonlikescoffee/ai-archive/blob/master/README.md"
click node_settings "https://github.com/darkonlikescoffee/ai-archive/blob/master/extension/popup.js"
click node_webapp "https://github.com/darkonlikescoffee/ai-archive/blob/master/web/src/main.jsx"
click node_github_client "https://github.com/darkonlikescoffee/ai-archive/blob/master/web/src/github.js"
click node_reader "https://github.com/darkonlikescoffee/ai-archive/blob/master/web/src/main.jsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_popup,node_collector,node_settings,node_chrome_store,node_user toneBlue
class node_background,node_branch,node_attachments,node_markdown,node_index,node_archivefiles toneAmber
class node_webapp,node_github_client,node_reader toneMint
class node_claude,node_github toneRose
```

## Components

### Browser extension sync

- [Sync popup](https://github.com/darkonlikescoffee/ai-archive/blob/master/extension/popup.js): `extension/popup.js`
- [Claude collector](https://github.com/darkonlikescoffee/ai-archive/blob/master/extension/content.js): `extension/content.js`
- [Extension settings](https://github.com/darkonlikescoffee/ai-archive/blob/master/extension/popup.js): `extension/popup.js`
- **Extension storage**

### Archive generation

- [Sync coordinator](https://github.com/darkonlikescoffee/ai-archive/blob/master/extension/background.js): `extension/background.js`
- [Active branch selection](https://github.com/darkonlikescoffee/ai-archive/blob/master/extension/content.js): `extension/content.js`
- [Attachment collection](https://github.com/darkonlikescoffee/ai-archive/blob/master/extension/content.js): `extension/content.js`
- [Markdown and asset writer](https://github.com/darkonlikescoffee/ai-archive/blob/master/extension/background.js): `extension/background.js`
- [Search index](https://github.com/darkonlikescoffee/ai-archive/blob/master/README.md): `README.md`
- [Markdown archive](https://github.com/darkonlikescoffee/ai-archive/blob/master/README.md): `README.md`

### Web archive reader

- [Archive dashboard](https://github.com/darkonlikescoffee/ai-archive/blob/master/web/src/main.jsx): `web/src/main.jsx`
- [GitHub reader](https://github.com/darkonlikescoffee/ai-archive/blob/master/web/src/github.js): `web/src/github.js`
- [Conversation and asset reader](https://github.com/darkonlikescoffee/ai-archive/blob/master/web/src/main.jsx): `web/src/main.jsx`

### External services

- **Claude.ai**
- **GitHub repository**

### Other components

- **Archive user**

## Connections

- Archive user → Sync popup: starts sync (evidence: `extension/popup.js`)
- Sync popup → Extension settings: saves settings (evidence: `extension/popup.js`)
- Extension settings → Extension storage: writes settings (evidence: `extension/popup.js`)
- Sync popup → Claude collector: requests sync (evidence: `extension/popup.js`)
- Claude collector → Claude.ai: fetches conversations (evidence: `extension/content.js`)
- Claude collector → Active branch selection: selects lineage (evidence: `extension/content.js`)
- Claude collector → Attachment collection: collects files (evidence: `extension/content.js`)
- Claude collector → Sync coordinator: hands off normalized data
- Sync coordinator → Markdown and asset writer: prepares sync files (evidence: `extension/background.js`)
- Sync coordinator → GitHub repository: uploads and commits (evidence: `extension/background.js`)
- Markdown and asset writer → Markdown archive: writes conversations (evidence: `README.md`)
- Markdown and asset writer → Search index: updates navigation cache (evidence: `extension/background.js`)
- Markdown archive → GitHub repository: stored in repository (evidence: `README.md`)
- Search index → GitHub repository: stored in repository (evidence: `README.md`)
- Sync coordinator → Sync popup: reports progress (evidence: `extension/background.js`)
- Archive user → Archive dashboard: opens archive (evidence: `web/src/main.jsx`)
- Archive dashboard → GitHub reader: loads and opens entries (evidence: `web/src/main.jsx`)
- GitHub reader → GitHub repository: reads repository contents (evidence: `web/src/github.js`)
- Archive dashboard → Conversation and asset reader: renders conversations (evidence: `web/src/main.jsx`)
- Conversation and asset reader → GitHub reader: loads conversation and assets (evidence: `web/src/main.jsx`)
- GitHub repository → Archive dashboard: provides archive data
