# chadha-sridi/arxivhub architecture

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

- Interactive diagram: https://gitdiagram.com/chadha-sridi/arxivhub
- Repository: https://github.com/chadha-sridi/arxivhub

## Overview

ArxivHub is a multi-user research-paper workspace and conversational RAG assistant. Users add arXiv papers, browse paper details and notes, then ask questions; the chat workflow summarizes history, analyzes and scopes research queries, retrieves and grades paper chunks, audits for gaps, optionally searches Tavily, and generates a grounded answer. The graph orchestrates these stages, while ingestion maintains paper metadata and Qdrant vectors. README documents workflow capabilities beyond the sampled implementation; edges for those stages cite the README, and unsampled details are not inferred.

Main entry points: [`src/graph.py`](https://github.com/chadha-sridi/arxivhub/blob/main/src/graph.py) (RAG workflow router), [`src/app.py`](https://github.com/chadha-sridi/arxivhub/blob/main/src/app.py) (Gradio workspace), [`src/rag/generation.py`](https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/generation.py) (Research answer), [`src/ingestion/paperingestion.py`](https://github.com/chadha-sridi/arxivhub/blob/main/src/ingestion/paperingestion.py) (ArXiv ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Research workspace"]
  node_app["Gradio workspace<br/>[app.py]"]
  node_paper_ui["Paper views and notes<br/>[utils.py]"]
end

subgraph group_ingestion["Paper ingestion"]
  node_ingest["ArXiv ingestion<br/>[paperingestion.py]"]
  node_metadata["Paper metadata<br/>[paperingestion.py]"]
end

subgraph group_rag["Research assistant"]
  node_graph["RAG workflow router<br/>[graph.py]"]
  node_summary["Conversation summary"]
  node_analysis["Query analysis<br/>[query_analysis.py]"]
  node_scoping["Paper scoping<br/>[scoping.py]"]
  node_retrieval["Adaptive retrieval<br/>[retrieval.py]"]
  node_grading["Document grading"]
  node_audit["Knowledge audit"]
  node_websearch["Tavily search<br/>[tavily_search.py]"]
  node_generation["Research answer<br/>[generation.py]"]
  node_casual["Casual response"]
end

subgraph group_platform["Runtime and state"]
  node_vectorstore[("Qdrant vectors<br/>[config.py]")]
  node_config["Model and service config<br/>[config.py]"]
  node_schemas["Workflow state<br/>[schemas.py]"]
  node_prompts["Prompt templates<br/>[prompts.py]"]
end

node_researcher(("Researcher"))
node_arxiv["arXiv service"]
node_tavily["Tavily service"]

node_researcher -->|"uses"| node_app
node_app -->|"streams chat"| node_graph
node_app -->|"gets vector store"| node_config
node_app -->|"binds paper actions"| node_paper_ui
node_app -->|"loads inventory"| node_metadata
node_paper_ui -->|"submits papers"| node_ingest
node_paper_ui -->|"saves notes"| node_metadata
node_ingest -->|"loads papers"| node_arxiv
node_ingest -->|"upserts chunks"| node_vectorstore
node_ingest -->|"updates inventory"| node_metadata
node_config -->|"configures client"| node_vectorstore
node_graph -->|"runs first"| node_summary
node_graph -->|"routes query"| node_analysis
node_graph -->|"routes research"| node_scoping
node_graph -->|"routes scoped query"| node_retrieval
node_graph -->|"routes documents"| node_grading
node_graph -->|"audits context"| node_audit
node_graph -->|"routes gaps"| node_websearch
node_graph -->|"routes answer"| node_generation
node_graph -->|"routes casual"| node_casual
node_summary -->|"provides history"| node_analysis
node_analysis -->|"provides query hints"| node_scoping
node_scoping -->|"selects papers"| node_retrieval
node_retrieval -->|"searches chunks"| node_vectorstore
node_retrieval -->|"passes documents"| node_grading
node_grading -->|"passes graded context"| node_audit
node_audit -->|"requests missing context"| node_websearch
node_websearch -->|"searches web"| node_tavily
node_websearch -->|"adds search results"| node_generation
node_audit -->|"routes sufficient context"| node_generation
node_generation -->|"returns answer"| node_researcher
node_casual -->|"returns reply"| node_researcher
node_analysis -->|"uses templates"| node_prompts
node_generation -->|"uses templates"| node_prompts
node_app -->|"creates runtime context"| node_schemas
node_graph -->|"uses workflow state"| node_schemas
node_config -->|"configures client"| node_tavily

click node_app "https://github.com/chadha-sridi/arxivhub/blob/main/src/app.py"
click node_paper_ui "https://github.com/chadha-sridi/arxivhub/blob/main/src/ui/utils.py"
click node_ingest "https://github.com/chadha-sridi/arxivhub/blob/main/src/ingestion/paperingestion.py"
click node_metadata "https://github.com/chadha-sridi/arxivhub/blob/main/src/ingestion/paperingestion.py"
click node_vectorstore "https://github.com/chadha-sridi/arxivhub/blob/main/src/config.py"
click node_config "https://github.com/chadha-sridi/arxivhub/blob/main/src/config.py"
click node_schemas "https://github.com/chadha-sridi/arxivhub/blob/main/src/core/schemas.py"
click node_graph "https://github.com/chadha-sridi/arxivhub/blob/main/src/graph.py"
click node_summary "https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/conversation_summary.py"
click node_analysis "https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/query_analysis.py"
click node_scoping "https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/scoping.py"
click node_retrieval "https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/retrieval.py"
click node_grading "https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/document_grading.py"
click node_audit "https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/knowledge_auditing.py"
click node_websearch "https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/tavily_search.py"
click node_generation "https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/generation.py"
click node_casual "https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/casual_generation.py"
click node_prompts "https://github.com/chadha-sridi/arxivhub/blob/main/src/core/prompts.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_paper_ui toneBlue
class node_ingest,node_metadata toneAmber
class node_graph,node_summary,node_analysis,node_scoping,node_retrieval,node_grading,node_audit,node_websearch,node_generation,node_casual toneMint
class node_vectorstore,node_config,node_schemas,node_prompts toneRose
class node_researcher,node_arxiv,node_tavily toneIndigo
```

## Components

### Research workspace

- [Gradio workspace](https://github.com/chadha-sridi/arxivhub/blob/main/src/app.py): `src/app.py`
- [Paper views and notes](https://github.com/chadha-sridi/arxivhub/blob/main/src/ui/utils.py): `src/ui/utils.py`

### Paper ingestion

- [ArXiv ingestion](https://github.com/chadha-sridi/arxivhub/blob/main/src/ingestion/paperingestion.py): `src/ingestion/paperingestion.py`
- [Paper metadata](https://github.com/chadha-sridi/arxivhub/blob/main/src/ingestion/paperingestion.py): `src/ingestion/paperingestion.py`

### Research assistant

- [RAG workflow router](https://github.com/chadha-sridi/arxivhub/blob/main/src/graph.py): `src/graph.py`
- [Conversation summary](https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/conversation_summary.py): `src/rag/conversation_summary.py`
- [Query analysis](https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/query_analysis.py): `src/rag/query_analysis.py`
- [Paper scoping](https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/scoping.py): `src/rag/scoping.py`
- [Adaptive retrieval](https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/retrieval.py): `src/rag/retrieval.py`
- [Document grading](https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/document_grading.py): `src/rag/document_grading.py`
- [Knowledge audit](https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/knowledge_auditing.py): `src/rag/knowledge_auditing.py`
- [Tavily search](https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/tavily_search.py): `src/rag/tavily_search.py`
- [Research answer](https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/generation.py): `src/rag/generation.py`
- [Casual response](https://github.com/chadha-sridi/arxivhub/blob/main/src/rag/casual_generation.py): `src/rag/casual_generation.py`

### Runtime and state

- [Qdrant vectors](https://github.com/chadha-sridi/arxivhub/blob/main/src/config.py): `src/config.py`
- [Model and service config](https://github.com/chadha-sridi/arxivhub/blob/main/src/config.py): `src/config.py`
- [Workflow state](https://github.com/chadha-sridi/arxivhub/blob/main/src/core/schemas.py): `src/core/schemas.py`
- [Prompt templates](https://github.com/chadha-sridi/arxivhub/blob/main/src/core/prompts.py): `src/core/prompts.py`

### Other components

- **Researcher**
- **arXiv service**
- **Tavily service**

## Connections

- Researcher → Gradio workspace: uses (evidence: `README.md`)
- Gradio workspace → RAG workflow router: streams chat (evidence: `src/app.py`)
- Gradio workspace → Model and service config: gets vector store (evidence: `src/app.py`)
- Gradio workspace → Paper views and notes: binds paper actions (evidence: `src/app.py`)
- Gradio workspace → Paper metadata: loads inventory (evidence: `src/app.py`)
- Paper views and notes → ArXiv ingestion: submits papers (evidence: `src/ui/utils.py`)
- Paper views and notes → Paper metadata: saves notes (evidence: `src/ui/utils.py`)
- ArXiv ingestion → arXiv service: loads papers (evidence: `src/ingestion/paperingestion.py`)
- ArXiv ingestion → Qdrant vectors: upserts chunks (evidence: `src/ingestion/paperingestion.py`)
- ArXiv ingestion → Paper metadata: updates inventory (evidence: `src/ingestion/paperingestion.py`)
- Model and service config → Qdrant vectors: configures client (evidence: `src/config.py`)
- RAG workflow router → Conversation summary: runs first (evidence: `src/graph.py`)
- RAG workflow router → Query analysis: routes query (evidence: `src/graph.py`)
- RAG workflow router → Paper scoping: routes research (evidence: `src/graph.py`)
- RAG workflow router → Adaptive retrieval: routes scoped query (evidence: `src/graph.py`)
- RAG workflow router → Document grading: routes documents (evidence: `src/graph.py`)
- RAG workflow router → Knowledge audit: audits context (evidence: `src/graph.py`)
- RAG workflow router → Tavily search: routes gaps (evidence: `src/graph.py`)
- RAG workflow router → Research answer: routes answer (evidence: `src/graph.py`)
- RAG workflow router → Casual response: routes casual (evidence: `src/graph.py`)
- Conversation summary → Query analysis: provides history (evidence: `README.md`)
- Query analysis → Paper scoping: provides query hints (evidence: `README.md`)
- Paper scoping → Adaptive retrieval: selects papers (evidence: `README.md`)
- Adaptive retrieval → Qdrant vectors: searches chunks (evidence: `src/rag/retrieval.py`)
- Adaptive retrieval → Document grading: passes documents (evidence: `README.md`)
- Document grading → Knowledge audit: passes graded context (evidence: `README.md`)
- Knowledge audit → Tavily search: requests missing context
- Tavily search → Tavily service: searches web (evidence: `src/rag/tavily_search.py`)
- Tavily search → Research answer: adds search results (evidence: `src/rag/tavily_search.py`)
- Knowledge audit → Research answer: routes sufficient context
- Research answer → Researcher: returns answer
- Casual response → Researcher: returns reply
- Query analysis → Prompt templates: uses templates (evidence: `src/rag/query_analysis.py`)
- Research answer → Prompt templates: uses templates (evidence: `src/rag/generation.py`)
- Gradio workspace → Workflow state: creates runtime context (evidence: `src/app.py`)
- RAG workflow router → Workflow state: uses workflow state (evidence: `src/graph.py`)
- Model and service config → Tavily service: configures client (evidence: `src/config.py`)
