# omdeepchakrabarty/revenant architecture

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

- Interactive diagram: https://gitdiagram.com/omdeepchakrabarty/revenant
- Repository: https://github.com/omdeepchakrabarty/revenant

## Overview

Xanadu Resurrection is a browser-based archive and AI-answer proofing prototype. A user imports or edits sources, asks a question, and receives a streamed answer whose claims are checked against version-pinned source spans; the proof and reader expose supported, ghost, and outdated claims. The browser owns the append-only archive and citation-drift tracking, while a stateless FastAPI service retrieves linked spans and verifies generated claims. The README documents the major capabilities; source excerpts confirm key calls, but some internal frontend behavior is unsampled.

Main entry points: [`frontend/src/App.tsx`](https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/App.tsx) (Workspace shell), [`frontend/src/xanadu.ts`](https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/xanadu.ts) (Append-only store), [`backend/provenance.py`](https://github.com/omdeepchakrabarty/revenant/blob/main/backend/provenance.py) (Answer generation), [`frontend/src/ReaderAndProof.tsx`](https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/ReaderAndProof.tsx) (Claim proof pane)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Browser workspace"]
  node_app["Workspace shell<br/>[App.tsx]"]
  node_import_ui["Import controls<br/>[App.tsx]"]
  node_graph_view["Link graph<br/>[GraphView.tsx]"]
end

subgraph group_archive["Archive and spans"]
  node_store[("Append-only store<br/>[xanadu.ts]")]
  node_importer["Document import<br/>[xanadu.ts]"]
  node_span_links["Span links<br/>[xanadu.ts]"]
  node_graph_data["Graph model<br/>[xanadu.ts]"]
  node_drift["Citation drift<br/>[xanadu.ts]"]
  node_sse_client["SSE client<br/>[xanadu.ts]"]
end

subgraph group_service["Answer service"]
  node_api["Ask API<br/>[app.py]"]
  node_retrieval["Span retrieval<br/>[xanadu.py]"]
  node_answer_engine["Answer generation<br/>[provenance.py]"]
  node_claim_check["Claim verifier<br/>[provenance.py]"]
end

subgraph group_proof_ui["Reading and proof"]
  node_reader["Version reader<br/>[ReaderAndProof.tsx]"]
  node_proof["Claim proof pane<br/>[ReaderAndProof.tsx]"]
  node_bridges["Span bridges<br/>[ReaderAndProof.tsx]"]
end

node_user(("Archive user"))
node_gemini["Gemini API"]
node_browser_storage[("Browser localStorage")]

node_user -->|"uses"| node_app
node_app -->|"loads and updates"| node_store
node_store -->|"persists archive"| node_browser_storage
node_app -->|"opens"| node_import_ui
node_import_ui -->|"imports files"| node_importer
node_importer -->|"creates links"| node_span_links
node_app -->|"renders"| node_reader
node_app -->|"renders"| node_proof
node_app -->|"builds graph"| node_graph_data
node_app -->|"renders"| node_graph_view
node_graph_view -->|"visualizes"| node_graph_data
node_app -->|"refreshes staleness"| node_drift
node_reader -->|"reads versions"| node_store
node_proof -->|"reads cited sources"| node_store
node_proof -->|"anchors claims"| node_bridges
node_user -->|"asks question"| node_app
node_app -->|"requests answer"| node_sse_client
node_sse_client -->|"streams request"| node_api
node_api -->|"dispatches"| node_answer_engine
node_answer_engine -->|"retrieves spans"| node_retrieval
node_answer_engine -->|"requests answer"| node_gemini
node_answer_engine -->|"checks claims"| node_claim_check
node_claim_check -->|"validates cited spans"| node_retrieval
node_sse_client -->|"returns events"| node_app
node_app -->|"saves answer"| node_store
node_app -->|"shows verdict"| node_proof
node_app -->|"passes hop events"| node_graph_view

click node_app "https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/App.tsx"
click node_import_ui "https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/App.tsx"
click node_graph_view "https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/GraphView.tsx"
click node_store "https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/xanadu.ts"
click node_importer "https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/xanadu.ts"
click node_span_links "https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/xanadu.ts"
click node_graph_data "https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/xanadu.ts"
click node_drift "https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/xanadu.ts"
click node_sse_client "https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/xanadu.ts"
click node_reader "https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/ReaderAndProof.tsx"
click node_proof "https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/ReaderAndProof.tsx"
click node_bridges "https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/ReaderAndProof.tsx"
click node_api "https://github.com/omdeepchakrabarty/revenant/blob/main/backend/app.py"
click node_retrieval "https://github.com/omdeepchakrabarty/revenant/blob/main/backend/xanadu.py"
click node_answer_engine "https://github.com/omdeepchakrabarty/revenant/blob/main/backend/provenance.py"
click node_claim_check "https://github.com/omdeepchakrabarty/revenant/blob/main/backend/provenance.py"

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_app,node_import_ui,node_graph_view,node_user toneBlue
class node_store,node_importer,node_span_links,node_graph_data,node_drift,node_sse_client,node_browser_storage toneAmber
class node_api,node_retrieval,node_answer_engine,node_claim_check,node_gemini toneMint
class node_reader,node_proof,node_bridges toneRose
```

## Components

### Browser workspace

- [Workspace shell](https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Import controls](https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Link graph](https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/GraphView.tsx): `frontend/src/GraphView.tsx`

### Archive and spans

- [Append-only store](https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/xanadu.ts): `frontend/src/xanadu.ts`
- [Document import](https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/xanadu.ts): `frontend/src/xanadu.ts`
- [Span links](https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/xanadu.ts): `frontend/src/xanadu.ts`
- [Graph model](https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/xanadu.ts): `frontend/src/xanadu.ts`
- [Citation drift](https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/xanadu.ts): `frontend/src/xanadu.ts`
- [SSE client](https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/xanadu.ts): `frontend/src/xanadu.ts`

### Answer service

- [Ask API](https://github.com/omdeepchakrabarty/revenant/blob/main/backend/app.py): `backend/app.py`
- [Span retrieval](https://github.com/omdeepchakrabarty/revenant/blob/main/backend/xanadu.py): `backend/xanadu.py`
- [Answer generation](https://github.com/omdeepchakrabarty/revenant/blob/main/backend/provenance.py): `backend/provenance.py`
- [Claim verifier](https://github.com/omdeepchakrabarty/revenant/blob/main/backend/provenance.py): `backend/provenance.py`

### Reading and proof

- [Version reader](https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/ReaderAndProof.tsx): `frontend/src/ReaderAndProof.tsx`
- [Claim proof pane](https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/ReaderAndProof.tsx): `frontend/src/ReaderAndProof.tsx`
- [Span bridges](https://github.com/omdeepchakrabarty/revenant/blob/main/frontend/src/ReaderAndProof.tsx): `frontend/src/ReaderAndProof.tsx`

### Other components

- **Archive user**
- **Gemini API**
- **Browser localStorage**

## Connections

- Archive user → Workspace shell: uses (evidence: `README.md`)
- Workspace shell → Append-only store: loads and updates (evidence: `frontend/src/App.tsx`)
- Append-only store → Browser localStorage: persists archive (evidence: `README.md`)
- Workspace shell → Import controls: opens (evidence: `frontend/src/App.tsx`)
- Import controls → Document import: imports files (evidence: `frontend/src/App.tsx`)
- Document import → Span links: creates links (evidence: `README.md`)
- Workspace shell → Version reader: renders (evidence: `frontend/src/App.tsx`)
- Workspace shell → Claim proof pane: renders (evidence: `frontend/src/App.tsx`)
- Workspace shell → Graph model: builds graph (evidence: `README.md`)
- Workspace shell → Link graph: renders (evidence: `README.md`)
- Link graph → Graph model: visualizes (evidence: `README.md`)
- Workspace shell → Citation drift: refreshes staleness (evidence: `frontend/src/App.tsx`)
- Version reader → Append-only store: reads versions (evidence: `frontend/src/ReaderAndProof.tsx`)
- Claim proof pane → Append-only store: reads cited sources (evidence: `frontend/src/ReaderAndProof.tsx`)
- Claim proof pane → Span bridges: anchors claims (evidence: `README.md`)
- Archive user → Workspace shell: asks question (evidence: `README.md`)
- Workspace shell → SSE client: requests answer (evidence: `frontend/src/App.tsx`)
- SSE client → Ask API: streams request (evidence: `README.md`)
- Ask API → Answer generation: dispatches (evidence: `backend/app.py`)
- Answer generation → Span retrieval: retrieves spans (evidence: `backend/provenance.py`)
- Answer generation → Gemini API: requests answer (evidence: `backend/provenance.py`)
- Answer generation → Claim verifier: checks claims (evidence: `README.md`)
- Claim verifier → Span retrieval: validates cited spans (evidence: `README.md`)
- SSE client → Workspace shell: returns events (evidence: `README.md`)
- Workspace shell → Append-only store: saves answer (evidence: `frontend/src/App.tsx`)
- Workspace shell → Claim proof pane: shows verdict (evidence: `README.md`)
- Workspace shell → Link graph: passes hop events (evidence: `README.md`)
