# oriacgz/distill architecture

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

- Interactive diagram: https://gitdiagram.com/oriacgz/distill
- Repository: https://github.com/oriacgz/distill

## Overview

Distill is a local-first Chrome side-panel extension for extracting, selecting, exporting, and compacting conversations from Claude, ChatGPT, Gemini, and Copilot. The graph follows the documented user workflow and sampled calls; several capabilities are represented at their documented module paths where their source was not sampled.

Main entry points: [`packages/chrome/src/panel/panel.ts`](https://github.com/oriacgz/distill/blob/main/packages/chrome/src/panel/panel.ts) (Side panel), [`packages/chrome/src/content/content.ts`](https://github.com/oriacgz/distill/blob/main/packages/chrome/src/content/content.ts) (Content entry), [`packages/core/src/irs/engine.ts`](https://github.com/oriacgz/distill/blob/main/packages/core/src/irs/engine.ts) (IRS engine), [`packages/chrome/src/pdf/pdf.ts`](https://github.com/oriacgz/distill/blob/main/packages/chrome/src/pdf/pdf.ts) (Encrypted PDF transport)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Conversation capture"]
  node_content_entry["Content entry<br/>[content.ts]"]
  node_platform_adapters["Platform adapters"]
  node_dom_parser["DOM parsing<br/>[dom.ts]"]
  node_lazyload["History loading<br/>[lazyload.ts]"]
  node_fab["Floating controls<br/>[fab.ts]"]
end

subgraph group_panel["Panel workflow"]
  node_panel["Side panel<br/>[panel.ts]"]
  node_selection["Selection state<br/>[store.ts]"]
  node_batch["Batch export<br/>[batch.ts]"]
  node_analytics["Token analytics<br/>[analyticsView.ts]"]
  node_settings["Settings"]
end

subgraph group_exports["Export and storage"]
  node_export_suite["Format exporters"]
  node_download["Download and copy<br/>[download.ts]"]
  node_history[("Local history<br/>[history.ts]")]
  node_history_view["History interface<br/>[historyView.ts]"]
  node_pdf_payload["PDF payload<br/>[pdf-payload.ts]"]
end

subgraph group_compaction["IRS compaction"]
  node_irs_worker["Compaction worker<br/>[irs.worker.ts]"]
  node_irs_engine["IRS engine<br/>[engine.ts]"]
  node_irs_extract["Knowledge extraction<br/>[aku.ts]"]
  node_irs_compile["Conflict compiler<br/>[state.ts]"]
  node_irs_budget["Budget fitting<br/>[budget.ts]"]
end

subgraph group_integrations["Browser integrations"]
  node_service_worker["Extension service worker<br/>[service-worker.ts]"]
  node_pdf_transport["Encrypted PDF transport<br/>[pdf.ts]"]
end

node_user(("User"))
node_ai_pages["AI chat pages"]
node_pdf_service["Configured PDF service"]

node_user -->|"uses"| node_ai_pages
node_ai_pages -->|"hosts"| node_content_entry
node_panel -->|"requests conversation"| node_content_entry
node_content_entry -->|"selects parser"| node_platform_adapters
node_content_entry -->|"loads history"| node_lazyload
node_content_entry -->|"parses conversation"| node_dom_parser
node_content_entry -->|"returns conversation"| node_panel
node_user -->|"uses controls"| node_fab
node_fab -->|"requests panel"| node_service_worker
node_service_worker -->|"opens panel"| node_panel
node_panel -->|"updates selection"| node_selection
node_selection -->|"provides state"| node_panel
node_panel -->|"formats conversation"| node_export_suite
node_panel -->|"downloads or copies"| node_download
node_panel -->|"starts batch"| node_batch
node_batch -->|"requests tab data"| node_content_entry
node_panel -->|"records exports"| node_history
node_history_view -->|"reads history"| node_history
node_panel -->|"opens history"| node_history_view
node_panel -->|"shows estimates"| node_analytics
node_panel -->|"configures exports"| node_settings
node_panel -->|"starts compaction"| node_irs_worker
node_irs_worker -->|"runs engine"| node_irs_engine
node_irs_engine -->|"extracts knowledge"| node_irs_extract
node_irs_engine -->|"compiles conflicts"| node_irs_compile
node_irs_engine -->|"fits token budget"| node_irs_budget
node_irs_worker -->|"reports result"| node_panel
node_panel -.->|"builds PDF document"| node_pdf_payload
node_panel -.->|"requests PDF"| node_pdf_transport
node_pdf_transport -.->|"sends encrypted request"| node_pdf_service
node_pdf_service -.->|"returns PDF bytes"| node_pdf_transport
node_pdf_transport -.->|"provides PDF bytes"| node_download

click node_content_entry "https://github.com/oriacgz/distill/blob/main/packages/chrome/src/content/content.ts"
click node_platform_adapters "https://github.com/oriacgz/distill/tree/main/packages/chrome/src/content"
click node_dom_parser "https://github.com/oriacgz/distill/blob/main/packages/chrome/src/content/dom.ts"
click node_lazyload "https://github.com/oriacgz/distill/blob/main/packages/chrome/src/content/lazyload.ts"
click node_fab "https://github.com/oriacgz/distill/blob/main/packages/chrome/src/content/fab.ts"
click node_service_worker "https://github.com/oriacgz/distill/blob/main/packages/chrome/src/background/service-worker.ts"
click node_panel "https://github.com/oriacgz/distill/blob/main/packages/chrome/src/panel/panel.ts"
click node_selection "https://github.com/oriacgz/distill/blob/main/packages/chrome/src/panel/store.ts"
click node_batch "https://github.com/oriacgz/distill/blob/main/packages/chrome/src/panel/batch.ts"
click node_analytics "https://github.com/oriacgz/distill/blob/main/packages/chrome/src/panel/analyticsView.ts"
click node_settings "https://github.com/oriacgz/distill/blob/main/packages/chrome/src/panel/bindings-settings.ts"
click node_export_suite "https://github.com/oriacgz/distill/tree/main/packages/core/src/export"
click node_download "https://github.com/oriacgz/distill/blob/main/packages/chrome/src/panel/download.ts"
click node_history "https://github.com/oriacgz/distill/blob/main/packages/chrome/src/panel/history.ts"
click node_history_view "https://github.com/oriacgz/distill/blob/main/packages/chrome/src/panel/historyView.ts"
click node_pdf_payload "https://github.com/oriacgz/distill/blob/main/packages/core/src/export/pdf-payload.ts"
click node_pdf_transport "https://github.com/oriacgz/distill/blob/main/packages/chrome/src/pdf/pdf.ts"
click node_irs_worker "https://github.com/oriacgz/distill/blob/main/packages/chrome/src/workers/irs.worker.ts"
click node_irs_engine "https://github.com/oriacgz/distill/blob/main/packages/core/src/irs/engine.ts"
click node_irs_extract "https://github.com/oriacgz/distill/blob/main/packages/core/src/irs/aku.ts"
click node_irs_compile "https://github.com/oriacgz/distill/blob/main/packages/core/src/irs/state.ts"
click node_irs_budget "https://github.com/oriacgz/distill/blob/main/packages/core/src/irs/budget.ts"

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_content_entry,node_platform_adapters,node_dom_parser,node_lazyload,node_fab,node_user toneBlue
class node_panel,node_selection,node_batch,node_analytics,node_settings toneAmber
class node_export_suite,node_download,node_history,node_history_view,node_pdf_payload toneMint
class node_irs_worker,node_irs_engine,node_irs_extract,node_irs_compile,node_irs_budget toneRose
class node_service_worker,node_pdf_transport,node_ai_pages,node_pdf_service toneIndigo
```

## Components

### Conversation capture

- [Content entry](https://github.com/oriacgz/distill/blob/main/packages/chrome/src/content/content.ts): `packages/chrome/src/content/content.ts`
- [Platform adapters](https://github.com/oriacgz/distill/tree/main/packages/chrome/src/content): `packages/chrome/src/content`
- [DOM parsing](https://github.com/oriacgz/distill/blob/main/packages/chrome/src/content/dom.ts): `packages/chrome/src/content/dom.ts`
- [History loading](https://github.com/oriacgz/distill/blob/main/packages/chrome/src/content/lazyload.ts): `packages/chrome/src/content/lazyload.ts`
- [Floating controls](https://github.com/oriacgz/distill/blob/main/packages/chrome/src/content/fab.ts): `packages/chrome/src/content/fab.ts`

### Panel workflow

- [Side panel](https://github.com/oriacgz/distill/blob/main/packages/chrome/src/panel/panel.ts): `packages/chrome/src/panel/panel.ts`
- [Selection state](https://github.com/oriacgz/distill/blob/main/packages/chrome/src/panel/store.ts): `packages/chrome/src/panel/store.ts`
- [Batch export](https://github.com/oriacgz/distill/blob/main/packages/chrome/src/panel/batch.ts): `packages/chrome/src/panel/batch.ts`
- [Token analytics](https://github.com/oriacgz/distill/blob/main/packages/chrome/src/panel/analyticsView.ts): `packages/chrome/src/panel/analyticsView.ts`
- [Settings](https://github.com/oriacgz/distill/blob/main/packages/chrome/src/panel/bindings-settings.ts): `packages/chrome/src/panel/bindings-settings.ts`

### Export and storage

- [Format exporters](https://github.com/oriacgz/distill/tree/main/packages/core/src/export): `packages/core/src/export`
- [Download and copy](https://github.com/oriacgz/distill/blob/main/packages/chrome/src/panel/download.ts): `packages/chrome/src/panel/download.ts`
- [Local history](https://github.com/oriacgz/distill/blob/main/packages/chrome/src/panel/history.ts): `packages/chrome/src/panel/history.ts`
- [History interface](https://github.com/oriacgz/distill/blob/main/packages/chrome/src/panel/historyView.ts): `packages/chrome/src/panel/historyView.ts`
- [PDF payload](https://github.com/oriacgz/distill/blob/main/packages/core/src/export/pdf-payload.ts): `packages/core/src/export/pdf-payload.ts`

### IRS compaction

- [Compaction worker](https://github.com/oriacgz/distill/blob/main/packages/chrome/src/workers/irs.worker.ts): `packages/chrome/src/workers/irs.worker.ts`
- [IRS engine](https://github.com/oriacgz/distill/blob/main/packages/core/src/irs/engine.ts): `packages/core/src/irs/engine.ts`
- [Knowledge extraction](https://github.com/oriacgz/distill/blob/main/packages/core/src/irs/aku.ts): `packages/core/src/irs/aku.ts`
- [Conflict compiler](https://github.com/oriacgz/distill/blob/main/packages/core/src/irs/state.ts): `packages/core/src/irs/state.ts`
- [Budget fitting](https://github.com/oriacgz/distill/blob/main/packages/core/src/irs/budget.ts): `packages/core/src/irs/budget.ts`

### Browser integrations

- [Extension service worker](https://github.com/oriacgz/distill/blob/main/packages/chrome/src/background/service-worker.ts): `packages/chrome/src/background/service-worker.ts`
- [Encrypted PDF transport](https://github.com/oriacgz/distill/blob/main/packages/chrome/src/pdf/pdf.ts): `packages/chrome/src/pdf/pdf.ts`

### Other components

- **User**
- **AI chat pages**
- **Configured PDF service**

## Connections

- User → AI chat pages: uses
- AI chat pages → Content entry: hosts
- Side panel → Content entry: requests conversation
- Content entry → Platform adapters: selects parser
- Content entry → History loading: loads history
- Content entry → DOM parsing: parses conversation
- Content entry → Side panel: returns conversation
- User → Floating controls: uses controls
- Floating controls → Extension service worker: requests panel
- Extension service worker → Side panel: opens panel
- Side panel → Selection state: updates selection
- Selection state → Side panel: provides state
- Side panel → Format exporters: formats conversation
- Side panel → Download and copy: downloads or copies
- Side panel → Batch export: starts batch
- Batch export → Content entry: requests tab data
- Side panel → Local history: records exports
- History interface → Local history: reads history
- Side panel → History interface: opens history
- Side panel → Token analytics: shows estimates
- Side panel → Settings: configures exports
- Side panel → Compaction worker: starts compaction
- Compaction worker → IRS engine: runs engine
- IRS engine → Knowledge extraction: extracts knowledge
- IRS engine → Conflict compiler: compiles conflicts
- IRS engine → Budget fitting: fits token budget
- Compaction worker → Side panel: reports result
- Side panel → PDF payload: builds PDF document
- Side panel → Encrypted PDF transport: requests PDF
- Encrypted PDF transport → Configured PDF service: sends encrypted request
- Configured PDF service → Encrypted PDF transport: returns PDF bytes
- Encrypted PDF transport → Download and copy: provides PDF bytes
