# ivory-26/research-graph architecture

> Architecture diagram of the GitHub repository ivory-26/research-graph, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ivory-26/research-graph
- Repository: https://github.com/ivory-26/research-graph

## Overview

ResearchGraph is a research workspace that converts paper claims into evidence-linked graph relationships and auditable experiments. The principal flow is source ingestion, claim/edge extraction, experiment planning, human approval, isolated execution, deterministic evaluation, and streamed results in the workspace UI. The graph also preserves cross-source retrieval, strategy controls, authentication, and persistent pipeline state. README documents these capabilities; source excerpts are partial, so some internal stage-to-stage links are documented relationships rather than verified call chains.

Main entry points: [`src/routes/index.tsx`](https://github.com/ivory-26/research-graph/blob/main/src/routes/index.tsx) (Workspace UI), [`src/db/client.ts`](https://github.com/ivory-26/research-graph/blob/main/src/db/client.ts) (Neon Postgres), [`src/server/pipeline.ts`](https://github.com/ivory-26/research-graph/blob/main/src/server/pipeline.ts) (Experiment Pipeline), [`src/routes/api/graph.ts`](https://github.com/ivory-26/research-graph/blob/main/src/routes/api/graph.ts) (Graph API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Research Workspace"]
  node_workspace_ui["Workspace UI<br/>[index.tsx]"]
  node_research_canvas["Research Canvas<br/>[ResearchCanvas.tsx]"]
  node_evidence_panels["Research Panels"]
  node_graph_client["Graph Client<br/>[graphClient.ts]"]
  node_pipeline_client["Pipeline Client<br/>[pipelineClient.ts]"]
  node_fixture_workspace["Demo Workspace<br/>[demoWorkspace.ts]"]
end

subgraph group_evidence["Evidence and Graph"]
  node_ingestion["Source Ingestion"]
  node_extract_pipeline["Claim and Edge Extraction<br/>[pipeline.ts]"]
  node_retrieval["Cross-source Retrieval<br/>[retrieval.ts]"]
  node_graph_api["Graph API<br/>[graph.ts]"]
  node_graph_evidence["Evidence Projection<br/>[graph-evidence.ts]"]
end

subgraph group_experiments["Experiment Pipeline"]
  node_experiment_pipeline["Experiment Pipeline<br/>[pipeline.ts]"]
  node_planner["Experiment Planner<br/>[planner.ts]"]
  node_approval["Approval Gates"]
  node_runner["Sandbox Runner<br/>[runner.ts]"]
  node_evaluation["Deterministic Evaluation<br/>[evaluate.ts]"]
  node_delivery["Pipeline Delivery<br/>[handlers.ts]"]
end

subgraph group_platform["Identity and Persistence"]
  node_auth["Authentication and Workspace Guard<br/>[auth.server.ts]"]
  node_pipeline_db["Pipeline State<br/>[pipeline.ts]"]
  node_database[("Neon Postgres<br/>[client.ts]")]
  node_schema["Workspace Schema<br/>[schema.ts]"]
  node_event_contracts["Pipeline Event Contracts<br/>[events.ts]"]
end

node_researcher(("Researcher"))

node_researcher -->|"uses workspace"| node_workspace_ui
node_workspace_ui -->|"loads graph"| node_graph_client
node_workspace_ui -->|"streams pipeline"| node_pipeline_client
node_workspace_ui -->|"falls back to"| node_fixture_workspace
node_workspace_ui -->|"renders canvas"| node_research_canvas
node_workspace_ui -->|"renders panels"| node_evidence_panels
node_graph_client -->|"requests graph"| node_graph_api
node_graph_api -->|"checks membership"| node_auth
node_graph_api -->|"projects evidence"| node_graph_evidence
node_graph_api -->|"reads graph data"| node_database
node_researcher -->|"submits sources"| node_ingestion
node_ingestion -->|"provides source chunks"| node_extract_pipeline
node_extract_pipeline -->|"retrieves candidates"| node_retrieval
node_ingestion -->|"stores chunks"| node_database
node_extract_pipeline -->|"persists graph"| node_database
node_researcher -->|"starts experiment"| node_experiment_pipeline
node_experiment_pipeline -->|"plans reproduction"| node_planner
node_experiment_pipeline -->|"opens approval gate"| node_approval
node_researcher -->|"approves plan"| node_approval
node_experiment_pipeline -->|"executes approved plan"| node_runner
node_runner -->|"returns run result"| node_evaluation
node_experiment_pipeline -->|"streams pipeline events"| node_delivery
node_delivery -->|"emits typed events"| node_event_contracts
node_pipeline_client -->|"subscribes to stream"| node_delivery
node_pipeline_client -->|"submits decision"| node_approval
node_pipeline_db -->|"persists pipeline state"| node_database
node_database -->|"uses schema"| node_schema
node_approval -->|"records gate state"| node_pipeline_db
node_auth -.->|"verifies workspace access"| node_database

click node_workspace_ui "https://github.com/ivory-26/research-graph/blob/main/src/routes/index.tsx"
click node_research_canvas "https://github.com/ivory-26/research-graph/blob/main/src/components/canvas/ResearchCanvas.tsx"
click node_evidence_panels "https://github.com/ivory-26/research-graph/tree/main/src/components/panels"
click node_graph_client "https://github.com/ivory-26/research-graph/blob/main/src/utils/graphClient.ts"
click node_pipeline_client "https://github.com/ivory-26/research-graph/blob/main/src/utils/pipelineClient.ts"
click node_fixture_workspace "https://github.com/ivory-26/research-graph/blob/main/src/data/demoWorkspace.ts"
click node_ingestion "https://github.com/ivory-26/research-graph/tree/main/src/server/ingest"
click node_extract_pipeline "https://github.com/ivory-26/research-graph/blob/main/src/server/extract/pipeline.ts"
click node_retrieval "https://github.com/ivory-26/research-graph/blob/main/src/server/retrieval.ts"
click node_graph_api "https://github.com/ivory-26/research-graph/blob/main/src/routes/api/graph.ts"
click node_graph_evidence "https://github.com/ivory-26/research-graph/blob/main/src/server/graph-evidence.ts"
click node_experiment_pipeline "https://github.com/ivory-26/research-graph/blob/main/src/server/pipeline.ts"
click node_planner "https://github.com/ivory-26/research-graph/blob/main/src/server/planner.ts"
click node_approval "https://github.com/ivory-26/research-graph/blob/main/src/db/pipeline-approval.ts"
click node_runner "https://github.com/ivory-26/research-graph/blob/main/src/server/runner.ts"
click node_evaluation "https://github.com/ivory-26/research-graph/blob/main/src/server/evaluate.ts"
click node_delivery "https://github.com/ivory-26/research-graph/blob/main/src/server/pipeline-delivery/handlers.ts"
click node_auth "https://github.com/ivory-26/research-graph/blob/main/src/server/auth.server.ts"
click node_pipeline_db "https://github.com/ivory-26/research-graph/blob/main/src/db/pipeline.ts"
click node_database "https://github.com/ivory-26/research-graph/blob/main/src/db/client.ts"
click node_schema "https://github.com/ivory-26/research-graph/blob/main/src/db/schema.ts"
click node_event_contracts "https://github.com/ivory-26/research-graph/blob/main/src/shared/events.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_workspace_ui,node_research_canvas,node_evidence_panels,node_graph_client,node_pipeline_client,node_fixture_workspace toneBlue
class node_ingestion,node_extract_pipeline,node_retrieval,node_graph_api,node_graph_evidence toneAmber
class node_experiment_pipeline,node_planner,node_approval,node_runner,node_evaluation,node_delivery toneMint
class node_auth,node_pipeline_db,node_database,node_schema,node_event_contracts toneRose
class node_researcher toneIndigo
```

## Components

### Research Workspace

- [Workspace UI](https://github.com/ivory-26/research-graph/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Research Canvas](https://github.com/ivory-26/research-graph/blob/main/src/components/canvas/ResearchCanvas.tsx): `src/components/canvas/ResearchCanvas.tsx`
- [Research Panels](https://github.com/ivory-26/research-graph/tree/main/src/components/panels): `src/components/panels`
- [Graph Client](https://github.com/ivory-26/research-graph/blob/main/src/utils/graphClient.ts): `src/utils/graphClient.ts`
- [Pipeline Client](https://github.com/ivory-26/research-graph/blob/main/src/utils/pipelineClient.ts): `src/utils/pipelineClient.ts`
- [Demo Workspace](https://github.com/ivory-26/research-graph/blob/main/src/data/demoWorkspace.ts): `src/data/demoWorkspace.ts`

### Evidence and Graph

- [Source Ingestion](https://github.com/ivory-26/research-graph/tree/main/src/server/ingest): `src/server/ingest`
- [Claim and Edge Extraction](https://github.com/ivory-26/research-graph/blob/main/src/server/extract/pipeline.ts): `src/server/extract/pipeline.ts`
- [Cross-source Retrieval](https://github.com/ivory-26/research-graph/blob/main/src/server/retrieval.ts): `src/server/retrieval.ts`
- [Graph API](https://github.com/ivory-26/research-graph/blob/main/src/routes/api/graph.ts): `src/routes/api/graph.ts`
- [Evidence Projection](https://github.com/ivory-26/research-graph/blob/main/src/server/graph-evidence.ts): `src/server/graph-evidence.ts`

### Experiment Pipeline

- [Experiment Pipeline](https://github.com/ivory-26/research-graph/blob/main/src/server/pipeline.ts): `src/server/pipeline.ts`
- [Experiment Planner](https://github.com/ivory-26/research-graph/blob/main/src/server/planner.ts): `src/server/planner.ts`
- [Approval Gates](https://github.com/ivory-26/research-graph/blob/main/src/db/pipeline-approval.ts): `src/db/pipeline-approval.ts`
- [Sandbox Runner](https://github.com/ivory-26/research-graph/blob/main/src/server/runner.ts): `src/server/runner.ts`
- [Deterministic Evaluation](https://github.com/ivory-26/research-graph/blob/main/src/server/evaluate.ts): `src/server/evaluate.ts`
- [Pipeline Delivery](https://github.com/ivory-26/research-graph/blob/main/src/server/pipeline-delivery/handlers.ts): `src/server/pipeline-delivery/handlers.ts`

### Identity and Persistence

- [Authentication and Workspace Guard](https://github.com/ivory-26/research-graph/blob/main/src/server/auth.server.ts): `src/server/auth.server.ts`
- [Pipeline State](https://github.com/ivory-26/research-graph/blob/main/src/db/pipeline.ts): `src/db/pipeline.ts`
- [Neon Postgres](https://github.com/ivory-26/research-graph/blob/main/src/db/client.ts): `src/db/client.ts`
- [Workspace Schema](https://github.com/ivory-26/research-graph/blob/main/src/db/schema.ts): `src/db/schema.ts`
- [Pipeline Event Contracts](https://github.com/ivory-26/research-graph/blob/main/src/shared/events.ts): `src/shared/events.ts`

### Other components

- **Researcher**

## Connections

- Researcher → Workspace UI: uses workspace (evidence: `README.md`)
- Workspace UI → Graph Client: loads graph (evidence: `src/routes/index.tsx`)
- Workspace UI → Pipeline Client: streams pipeline (evidence: `src/routes/index.tsx`)
- Workspace UI → Demo Workspace: falls back to (evidence: `README.md`)
- Workspace UI → Research Canvas: renders canvas (evidence: `src/routes/index.tsx`)
- Workspace UI → Research Panels: renders panels (evidence: `src/routes/index.tsx`)
- Graph Client → Graph API: requests graph (evidence: `README.md`)
- Graph API → Authentication and Workspace Guard: checks membership (evidence: `src/routes/api/graph.ts`)
- Graph API → Evidence Projection: projects evidence (evidence: `src/routes/api/graph.ts`)
- Graph API → Neon Postgres: reads graph data (evidence: `src/routes/api/graph.ts`)
- Researcher → Source Ingestion: submits sources (evidence: `README.md`)
- Source Ingestion → Claim and Edge Extraction: provides source chunks (evidence: `src/server/extract/pipeline.ts`)
- Claim and Edge Extraction → Cross-source Retrieval: retrieves candidates (evidence: `src/server/extract/pipeline.ts`)
- Source Ingestion → Neon Postgres: stores chunks (evidence: `src/server/ingest/store.ts`)
- Claim and Edge Extraction → Neon Postgres: persists graph (evidence: `src/server/extract/pipeline.ts`)
- Researcher → Experiment Pipeline: starts experiment (evidence: `README.md`)
- Experiment Pipeline → Experiment Planner: plans reproduction (evidence: `README.md`)
- Experiment Pipeline → Approval Gates: opens approval gate (evidence: `README.md`)
- Researcher → Approval Gates: approves plan (evidence: `README.md`)
- Experiment Pipeline → Sandbox Runner: executes approved plan (evidence: `README.md`)
- Sandbox Runner → Deterministic Evaluation: returns run result (evidence: `README.md`)
- Experiment Pipeline → Pipeline Delivery: streams pipeline events (evidence: `README.md`)
- Pipeline Delivery → Pipeline Event Contracts: emits typed events (evidence: `src/server/pipeline-delivery/handlers.ts`)
- Pipeline Client → Pipeline Delivery: subscribes to stream (evidence: `README.md`)
- Pipeline Client → Approval Gates: submits decision (evidence: `README.md`)
- Pipeline State → Neon Postgres: persists pipeline state (evidence: `src/db/pipeline.ts`)
- Neon Postgres → Workspace Schema: uses schema (evidence: `src/db/client.ts`)
- Approval Gates → Pipeline State: records gate state (evidence: `src/db/pipeline-approval.ts`)
- Authentication and Workspace Guard → Neon Postgres: verifies workspace access (evidence: `README.md`)
