# chengyue-lu/research-agent-workbench architecture

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

- Interactive diagram: https://gitdiagram.com/chengyue-lu/research-agent-workbench
- Repository: https://github.com/chengyue-lu/research-agent-workbench

## Overview

RWB is a human-governed research collaboration workbench: it captures bounded research intent in versioned file contracts, resolves methods and capabilities, supports replaceable execution, and preserves artifacts and traces for deterministic review. The documented principal workflow runs from task definition through method resolution and bounded execution to artifact validation and a human decision, with revision or continuation returning to task definition. The graph also includes capability management, handoff, and evaluation. Source excerpts and the README support the main relationships; unsampled subsystems are represented at directory level where their exact implementation path is not established.

Main entry points: [`src/research_workbench/execution`](https://github.com/chengyue-lu/research-agent-workbench/tree/main/src/research_workbench/execution) (Bounded execution), [`src/research_workbench/artifacts`](https://github.com/chengyue-lu/research-agent-workbench/tree/main/src/research_workbench/artifacts) (Research artifacts), [`src/research_workbench/tasks/models.py`](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/tasks/models.py) (Task contracts), [`src/research_workbench/validation/documents.py`](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/validation/documents.py) (Document validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_contracts["Research contracts"]
  node_task["Task contracts<br/>[models.py]"]
  node_protocol["Method and authority<br/>[authority.py]"]
  node_handoff["Handoff transfer"]
end

subgraph group_planning["Planning and capabilities"]
  node_capability["Capability catalog<br/>[catalog.py]"]
  node_resolver["Task resolver<br/>[resolver.py]"]
  node_supply["Capability supply<br/>[supply.py]"]
end

subgraph group_runtime["Execution and evidence"]
  node_execution["Bounded execution"]
  node_model_session["Model session<br/>[session.py]"]
  node_codex["Codex adapter<br/>[codex.py]"]
  node_trace["Execution trace<br/>[trace.py]"]
  node_artifacts["Research artifacts"]
  node_integrity["Reference integrity<br/>[integrity.py]"]
end

subgraph group_assurance["Validation and review"]
  node_validation["Document validation<br/>[documents.py]"]
  node_schemas["Schema catalog<br/>[schemas.py]"]
  node_validation_host["Validation runner<br/>[validation_host.py]"]
  node_promotion["Artifact promotion<br/>[promotion.py]"]
  node_research_gate["Research state gate<br/>[gate.py]"]
  node_evaluation["Skill evaluation"]
end

node_researcher(("Researcher"))
node_cli["Workbench commands<br/>[cli.py]"]
node_file_store[("Project files")]

node_researcher -->|"defines scope"| node_task
node_task -->|"resolves method"| node_protocol
node_task -->|"selects capabilities"| node_resolver
node_capability -->|"supplies catalog"| node_resolver
node_resolver -->|"checks supply"| node_supply
node_protocol -->|"bounds execution"| node_execution
node_execution -.->|"uses session"| node_model_session
node_execution -->|"adapts runtime"| node_codex
node_execution -->|"records events"| node_trace
node_execution -->|"produces artifacts"| node_artifacts
node_artifacts -->|"checks references"| node_integrity
node_artifacts -->|"validates structure"| node_validation
node_validation -->|"checks schemas"| node_schemas
node_validation_host -->|"checks report"| node_schemas
node_validation_host -->|"enables promotion"| node_promotion
node_artifacts -->|"submits evidence"| node_validation_host
node_validation -.->|"informs review"| node_research_gate
node_researcher -->|"reviews findings"| node_research_gate
node_research_gate -->|"revises task"| node_task
node_researcher -.->|"records handoff"| node_handoff
node_evaluation -->|"evaluates skills"| node_capability
node_cli -->|"loads contracts"| node_task
node_cli -->|"runs checks"| node_validation
node_cli -->|"reads and writes"| node_file_store
node_trace -->|"persists trace"| node_file_store
node_artifacts -->|"stores evidence"| node_file_store

click node_cli "https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/cli.py"
click node_task "https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/tasks/models.py"
click node_protocol "https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/protocol/authority.py"
click node_handoff "https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/context/handoff_transfer.py"
click node_capability "https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/capability/catalog.py"
click node_resolver "https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/capability/resolver.py"
click node_supply "https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/capability/supply.py"
click node_execution "https://github.com/chengyue-lu/research-agent-workbench/tree/main/src/research_workbench/execution"
click node_model_session "https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/adapters/models/session.py"
click node_codex "https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/adapters/codex.py"
click node_trace "https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/observability/trace.py"
click node_artifacts "https://github.com/chengyue-lu/research-agent-workbench/tree/main/src/research_workbench/artifacts"
click node_integrity "https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/artifacts/integrity.py"
click node_validation "https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/validation/documents.py"
click node_schemas "https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/validation/schemas.py"
click node_validation_host "https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/artifacts/validation_host.py"
click node_promotion "https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/artifacts/promotion.py"
click node_research_gate "https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/research_state/gate.py"
click node_evaluation "https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/evaluation/skill_evaluation.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_task,node_protocol,node_handoff toneBlue
class node_capability,node_resolver,node_supply,node_file_store toneAmber
class node_execution,node_model_session,node_codex,node_trace,node_artifacts,node_integrity toneMint
class node_validation,node_schemas,node_validation_host,node_promotion,node_research_gate,node_evaluation toneRose
class node_researcher toneIndigo
class node_cli toneTeal
```

## Components

### Research contracts

- [Task contracts](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/tasks/models.py): `src/research_workbench/tasks/models.py`
- [Method and authority](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/protocol/authority.py): `src/research_workbench/protocol/authority.py`
- [Handoff transfer](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/context/handoff_transfer.py): `src/research_workbench/context/handoff_transfer.py`

### Planning and capabilities

- [Capability catalog](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/capability/catalog.py): `src/research_workbench/capability/catalog.py`
- [Task resolver](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/capability/resolver.py): `src/research_workbench/capability/resolver.py`
- [Capability supply](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/capability/supply.py): `src/research_workbench/capability/supply.py`

### Execution and evidence

- [Bounded execution](https://github.com/chengyue-lu/research-agent-workbench/tree/main/src/research_workbench/execution): `src/research_workbench/execution`
- [Model session](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/adapters/models/session.py): `src/research_workbench/adapters/models/session.py`
- [Codex adapter](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/adapters/codex.py): `src/research_workbench/adapters/codex.py`
- [Execution trace](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/observability/trace.py): `src/research_workbench/observability/trace.py`
- [Research artifacts](https://github.com/chengyue-lu/research-agent-workbench/tree/main/src/research_workbench/artifacts): `src/research_workbench/artifacts`
- [Reference integrity](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/artifacts/integrity.py): `src/research_workbench/artifacts/integrity.py`

### Validation and review

- [Document validation](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/validation/documents.py): `src/research_workbench/validation/documents.py`
- [Schema catalog](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/validation/schemas.py): `src/research_workbench/validation/schemas.py`
- [Validation runner](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/artifacts/validation_host.py): `src/research_workbench/artifacts/validation_host.py`
- [Artifact promotion](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/artifacts/promotion.py): `src/research_workbench/artifacts/promotion.py`
- [Research state gate](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/research_state/gate.py): `src/research_workbench/research_state/gate.py`
- [Skill evaluation](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/evaluation/skill_evaluation.py): `src/research_workbench/evaluation/skill_evaluation.py`

### Other components

- **Researcher**
- [Workbench commands](https://github.com/chengyue-lu/research-agent-workbench/blob/main/src/research_workbench/cli.py): `src/research_workbench/cli.py`
- **Project files**

## Connections

- Researcher → Task contracts: defines scope
- Task contracts → Method and authority: resolves method
- Task contracts → Task resolver: selects capabilities (evidence: `src/research_workbench/capability/resolver.py`)
- Capability catalog → Task resolver: supplies catalog (evidence: `src/research_workbench/capability/resolver.py`)
- Task resolver → Capability supply: checks supply (evidence: `src/research_workbench/capability/supply.py`)
- Method and authority → Bounded execution: bounds execution
- Bounded execution → Model session: uses session
- Bounded execution → Codex adapter: adapts runtime (evidence: `src/research_workbench/adapters/codex.py`)
- Bounded execution → Execution trace: records events
- Bounded execution → Research artifacts: produces artifacts (evidence: `src/research_workbench/execution/runtime_bundle.py`)
- Research artifacts → Reference integrity: checks references (evidence: `src/research_workbench/artifacts/integrity.py`)
- Research artifacts → Document validation: validates structure (evidence: `src/research_workbench/validation/documents.py`)
- Document validation → Schema catalog: checks schemas (evidence: `src/research_workbench/validation/schemas.py`)
- Validation runner → Schema catalog: checks report (evidence: `src/research_workbench/artifacts/validation_host.py`)
- Validation runner → Artifact promotion: enables promotion (evidence: `src/research_workbench/artifacts/promotion.py`)
- Research artifacts → Validation runner: submits evidence (evidence: `src/research_workbench/artifacts/promotion.py`)
- Document validation → Research state gate: informs review (evidence: `src/research_workbench/research_state/gate.py`)
- Researcher → Research state gate: reviews findings
- Research state gate → Task contracts: revises task
- Researcher → Handoff transfer: records handoff
- Skill evaluation → Capability catalog: evaluates skills (evidence: `src/research_workbench/evaluation/skill_evaluation.py`)
- Workbench commands → Task contracts: loads contracts (evidence: `src/research_workbench/cli.py`)
- Workbench commands → Document validation: runs checks (evidence: `src/research_workbench/cli.py`)
- Workbench commands → Project files: reads and writes
- Execution trace → Project files: persists trace
- Research artifacts → Project files: stores evidence
