# aaadistance/reprolens architecture

> Architecture diagram of the GitHub repository aaadistance/reprolens, 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/aaadistance/reprolens
- Repository: https://github.com/aaadistance/reprolens

## Overview

ReproLens is an auditable research-paper reproduction agent. Users submit a paper, code repository, and optional data; the workflow extracts evidence-backed claims, plans and runs controlled experiments, diagnoses differences, optionally applies reviewed patches, verifies results with deterministic rules, and produces reports and evidence packages. The graph preserves the documented interfaces and major capabilities. Some subsystem links rely on README or SOURCE INDEX references because the corresponding implementation was not excerpted.

Main entry points: [`src/orchestrator/orchestrator.ts`](https://github.com/aaadistance/reprolens/blob/main/src/orchestrator/orchestrator.ts) (Workflow orchestrator), [`src/runtime.ts`](https://github.com/aaadistance/reprolens/blob/main/src/runtime.ts) (Runtime assembly), [`src/httpapi/server.ts`](https://github.com/aaadistance/reprolens/blob/main/src/httpapi/server.ts) (HTTP API), [`src/tools/report.ts`](https://github.com/aaadistance/reprolens/blob/main/src/tools/report.ts) (Report and evidence package)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["Command line<br/>[cli.ts]"]
  node_web["Web console<br/>[app.js]"]
  node_http["HTTP API<br/>[server.ts]"]
  node_tui["Terminal UI<br/>[index.tsx]"]
  node_desktop["Desktop shell<br/>[main.mjs]"]
end

subgraph group_coordination["Workflow coordination"]
  node_runtime["Runtime assembly<br/>[runtime.ts]"]
  node_orchestrator["Workflow orchestrator<br/>[orchestrator.ts]"]
  node_state["Workflow state machine<br/>[state.ts]"]
end

subgraph group_experiment["Experiment execution"]
  node_matrix["Experiment matrix<br/>[matrix.ts]"]
  node_queue["Run queue<br/>[job-queue.ts]"]
  node_runner["Runner selection<br/>[runner.ts]"]
  node_local["Local runner<br/>[local-runner.ts]"]
  node_docker["Docker runner<br/>[docker-runner.ts]"]
  node_ssh["SSH runner<br/>[ssh-runner.ts]"]
  node_codeagent["Code agent<br/>[code-agent.ts]"]
  node_commandagent["Command adapter<br/>[command.ts]"]
  node_patch["Patch safety and approval<br/>[patch.ts]"]
end

subgraph group_evidence["Evidence and analysis"]
  node_analyzer["Paper and claim analysis<br/>[analyzer.ts]"]
  node_structure["Paper structure extraction<br/>[structure.ts]"]
  node_heuristic["Heuristic analysis<br/>[heuristic.ts]"]
  node_openai["OpenAI-compatible analysis<br/>[openai.ts]"]
  node_attribution["Difference attribution<br/>[attribution.ts]"]
  node_verify["Rule-based verification<br/>[verify.ts]"]
  node_assessment["Evidence assessment<br/>[assessment.ts]"]
  node_conclusion["Reproduction conclusion<br/>[conclusion.ts]"]
  node_report["Report and evidence package<br/>[report.ts]"]
end

subgraph group_persistence["Project records"]
  node_store[("Project and event store<br/>[store.ts]")]
  node_sqlite[("SQLite storage<br/>[sqlite-store.ts]")]
  node_memory[("Memory storage<br/>[memory-store.ts]")]
end

node_cli -->|"starts"| node_runtime
node_runtime -->|"assembles"| node_orchestrator
node_http -->|"routes workflow"| node_orchestrator
node_web -->|"calls API"| node_http
node_tui -->|"uses API"| node_http
node_desktop -->|"starts local API"| node_http
node_orchestrator -->|"advances states"| node_state
node_orchestrator -->|"requests analysis"| node_analyzer
node_heuristic -->|"extracts claims"| node_structure
node_runtime -->|"selects analyzer"| node_heuristic
node_runtime -->|"selects analyzer"| node_openai
node_orchestrator -->|"expands plans"| node_matrix
node_orchestrator -->|"submits runs"| node_queue
node_orchestrator -->|"executes plans"| node_runner
node_runtime -->|"configures runner"| node_runner
node_runtime -->|"selects runner"| node_local
node_runtime -->|"selects runner"| node_docker
node_runtime -->|"selects runner"| node_ssh
node_orchestrator -->|"diagnoses differences"| node_attribution
node_orchestrator -->|"requests patch proposal"| node_codeagent
node_runtime -->|"configures adapter"| node_commandagent
node_commandagent -->|"implements interface"| node_codeagent
node_orchestrator -->|"validates patches"| node_patch
node_orchestrator -->|"checks run results"| node_verify
node_orchestrator -->|"maps verdict"| node_conclusion
node_orchestrator -->|"builds report"| node_report
node_report -->|"includes assessment"| node_assessment
node_report -->|"includes conclusion"| node_conclusion
node_orchestrator -->|"persists projects and events"| node_store
node_sqlite -->|"implements interface"| node_store
node_memory -->|"implements interface"| node_store

click node_cli "https://github.com/aaadistance/reprolens/blob/main/src/cli.ts"
click node_web "https://github.com/aaadistance/reprolens/blob/main/public/app.js"
click node_http "https://github.com/aaadistance/reprolens/blob/main/src/httpapi/server.ts"
click node_tui "https://github.com/aaadistance/reprolens/blob/main/src/tui/index.tsx"
click node_desktop "https://github.com/aaadistance/reprolens/blob/main/desktop/main.mjs"
click node_runtime "https://github.com/aaadistance/reprolens/blob/main/src/runtime.ts"
click node_orchestrator "https://github.com/aaadistance/reprolens/blob/main/src/orchestrator/orchestrator.ts"
click node_state "https://github.com/aaadistance/reprolens/blob/main/src/domain/state.ts"
click node_analyzer "https://github.com/aaadistance/reprolens/blob/main/src/agent/analyzer.ts"
click node_structure "https://github.com/aaadistance/reprolens/blob/main/src/tools/structure.ts"
click node_heuristic "https://github.com/aaadistance/reprolens/blob/main/src/agent/heuristic.ts"
click node_openai "https://github.com/aaadistance/reprolens/blob/main/src/agent/openai.ts"
click node_matrix "https://github.com/aaadistance/reprolens/blob/main/src/tools/matrix.ts"
click node_queue "https://github.com/aaadistance/reprolens/blob/main/src/tools/job-queue.ts"
click node_runner "https://github.com/aaadistance/reprolens/blob/main/src/tools/runner.ts"
click node_local "https://github.com/aaadistance/reprolens/blob/main/src/tools/local-runner.ts"
click node_docker "https://github.com/aaadistance/reprolens/blob/main/src/tools/docker-runner.ts"
click node_ssh "https://github.com/aaadistance/reprolens/blob/main/src/tools/ssh-runner.ts"
click node_attribution "https://github.com/aaadistance/reprolens/blob/main/src/tools/attribution.ts"
click node_codeagent "https://github.com/aaadistance/reprolens/blob/main/src/codeagent/code-agent.ts"
click node_commandagent "https://github.com/aaadistance/reprolens/blob/main/src/codeagent/command.ts"
click node_patch "https://github.com/aaadistance/reprolens/blob/main/src/tools/patch.ts"
click node_verify "https://github.com/aaadistance/reprolens/blob/main/src/tools/verify.ts"
click node_assessment "https://github.com/aaadistance/reprolens/blob/main/src/tools/assessment.ts"
click node_conclusion "https://github.com/aaadistance/reprolens/blob/main/src/tools/conclusion.ts"
click node_report "https://github.com/aaadistance/reprolens/blob/main/src/tools/report.ts"
click node_store "https://github.com/aaadistance/reprolens/blob/main/src/store/store.ts"
click node_sqlite "https://github.com/aaadistance/reprolens/blob/main/src/store/sqlite-store.ts"
click node_memory "https://github.com/aaadistance/reprolens/blob/main/src/store/memory-store.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_cli,node_web,node_http,node_tui,node_desktop toneBlue
class node_runtime,node_orchestrator,node_state toneAmber
class node_matrix,node_queue,node_runner,node_local,node_docker,node_ssh,node_codeagent,node_commandagent,node_patch toneMint
class node_analyzer,node_structure,node_heuristic,node_openai,node_attribution,node_verify,node_assessment,node_conclusion,node_report toneRose
class node_store,node_sqlite,node_memory toneIndigo
```

## Components

### User interfaces

- [Command line](https://github.com/aaadistance/reprolens/blob/main/src/cli.ts): `src/cli.ts`
- [Web console](https://github.com/aaadistance/reprolens/blob/main/public/app.js): `public/app.js`
- [HTTP API](https://github.com/aaadistance/reprolens/blob/main/src/httpapi/server.ts): `src/httpapi/server.ts`
- [Terminal UI](https://github.com/aaadistance/reprolens/blob/main/src/tui/index.tsx): `src/tui/index.tsx`
- [Desktop shell](https://github.com/aaadistance/reprolens/blob/main/desktop/main.mjs): `desktop/main.mjs`

### Workflow coordination

- [Runtime assembly](https://github.com/aaadistance/reprolens/blob/main/src/runtime.ts): `src/runtime.ts`
- [Workflow orchestrator](https://github.com/aaadistance/reprolens/blob/main/src/orchestrator/orchestrator.ts): `src/orchestrator/orchestrator.ts`
- [Workflow state machine](https://github.com/aaadistance/reprolens/blob/main/src/domain/state.ts): `src/domain/state.ts`

### Experiment execution

- [Experiment matrix](https://github.com/aaadistance/reprolens/blob/main/src/tools/matrix.ts): `src/tools/matrix.ts`
- [Run queue](https://github.com/aaadistance/reprolens/blob/main/src/tools/job-queue.ts): `src/tools/job-queue.ts`
- [Runner selection](https://github.com/aaadistance/reprolens/blob/main/src/tools/runner.ts): `src/tools/runner.ts`
- [Local runner](https://github.com/aaadistance/reprolens/blob/main/src/tools/local-runner.ts): `src/tools/local-runner.ts`
- [Docker runner](https://github.com/aaadistance/reprolens/blob/main/src/tools/docker-runner.ts): `src/tools/docker-runner.ts`
- [SSH runner](https://github.com/aaadistance/reprolens/blob/main/src/tools/ssh-runner.ts): `src/tools/ssh-runner.ts`
- [Code agent](https://github.com/aaadistance/reprolens/blob/main/src/codeagent/code-agent.ts): `src/codeagent/code-agent.ts`
- [Command adapter](https://github.com/aaadistance/reprolens/blob/main/src/codeagent/command.ts): `src/codeagent/command.ts`
- [Patch safety and approval](https://github.com/aaadistance/reprolens/blob/main/src/tools/patch.ts): `src/tools/patch.ts`

### Evidence and analysis

- [Paper and claim analysis](https://github.com/aaadistance/reprolens/blob/main/src/agent/analyzer.ts): `src/agent/analyzer.ts`
- [Paper structure extraction](https://github.com/aaadistance/reprolens/blob/main/src/tools/structure.ts): `src/tools/structure.ts`
- [Heuristic analysis](https://github.com/aaadistance/reprolens/blob/main/src/agent/heuristic.ts): `src/agent/heuristic.ts`
- [OpenAI-compatible analysis](https://github.com/aaadistance/reprolens/blob/main/src/agent/openai.ts): `src/agent/openai.ts`
- [Difference attribution](https://github.com/aaadistance/reprolens/blob/main/src/tools/attribution.ts): `src/tools/attribution.ts`
- [Rule-based verification](https://github.com/aaadistance/reprolens/blob/main/src/tools/verify.ts): `src/tools/verify.ts`
- [Evidence assessment](https://github.com/aaadistance/reprolens/blob/main/src/tools/assessment.ts): `src/tools/assessment.ts`
- [Reproduction conclusion](https://github.com/aaadistance/reprolens/blob/main/src/tools/conclusion.ts): `src/tools/conclusion.ts`
- [Report and evidence package](https://github.com/aaadistance/reprolens/blob/main/src/tools/report.ts): `src/tools/report.ts`

### Project records

- [Project and event store](https://github.com/aaadistance/reprolens/blob/main/src/store/store.ts): `src/store/store.ts`
- [SQLite storage](https://github.com/aaadistance/reprolens/blob/main/src/store/sqlite-store.ts): `src/store/sqlite-store.ts`
- [Memory storage](https://github.com/aaadistance/reprolens/blob/main/src/store/memory-store.ts): `src/store/memory-store.ts`

## Connections

- Command line → Runtime assembly: starts (evidence: `src/cli.ts`)
- Runtime assembly → Workflow orchestrator: assembles (evidence: `src/runtime.ts`)
- HTTP API → Workflow orchestrator: routes workflow (evidence: `src/httpapi/server.ts`)
- Web console → HTTP API: calls API (evidence: `README.md`)
- Terminal UI → HTTP API: uses API (evidence: `README.md`)
- Desktop shell → HTTP API: starts local API (evidence: `README.md`)
- Workflow orchestrator → Workflow state machine: advances states (evidence: `README.md`)
- Workflow orchestrator → Paper and claim analysis: requests analysis (evidence: `src/orchestrator/orchestrator.ts`)
- Heuristic analysis → Paper structure extraction: extracts claims (evidence: `src/agent/heuristic.ts`)
- Runtime assembly → Heuristic analysis: selects analyzer (evidence: `src/runtime.ts`)
- Runtime assembly → OpenAI-compatible analysis: selects analyzer (evidence: `src/runtime.ts`)
- Workflow orchestrator → Experiment matrix: expands plans (evidence: `src/orchestrator/orchestrator.ts`)
- Workflow orchestrator → Run queue: submits runs (evidence: `src/orchestrator/orchestrator.ts`)
- Workflow orchestrator → Runner selection: executes plans (evidence: `src/orchestrator/orchestrator.ts`)
- Runtime assembly → Runner selection: configures runner (evidence: `src/runtime.ts`)
- Runtime assembly → Local runner: selects runner (evidence: `src/runtime.ts`)
- Runtime assembly → Docker runner: selects runner (evidence: `src/runtime.ts`)
- Runtime assembly → SSH runner: selects runner (evidence: `src/runtime.ts`)
- Workflow orchestrator → Difference attribution: diagnoses differences (evidence: `src/orchestrator/orchestrator.ts`)
- Workflow orchestrator → Code agent: requests patch proposal (evidence: `src/orchestrator/orchestrator.ts`)
- Runtime assembly → Command adapter: configures adapter (evidence: `src/runtime.ts`)
- Command adapter → Code agent: implements interface (evidence: `src/codeagent/command.ts`)
- Workflow orchestrator → Patch safety and approval: validates patches (evidence: `src/orchestrator/orchestrator.ts`)
- Workflow orchestrator → Rule-based verification: checks run results (evidence: `src/orchestrator/orchestrator.ts`)
- Workflow orchestrator → Reproduction conclusion: maps verdict (evidence: `src/orchestrator/orchestrator.ts`)
- Workflow orchestrator → Report and evidence package: builds report (evidence: `src/orchestrator/orchestrator.ts`)
- Report and evidence package → Evidence assessment: includes assessment (evidence: `src/tools/report.ts`)
- Report and evidence package → Reproduction conclusion: includes conclusion (evidence: `src/tools/report.ts`)
- Workflow orchestrator → Project and event store: persists projects and events (evidence: `src/orchestrator/orchestrator.ts`)
- SQLite storage → Project and event store: implements interface (evidence: `src/store/sqlite-store.ts`)
- Memory storage → Project and event store: implements interface (evidence: `src/store/memory-store.ts`)
