# google-research/rrsi architecture

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

- Interactive diagram: https://gitdiagram.com/google-research/rrsi
- Repository: https://github.com/google-research/rrsi
- Video tour (about a minute): https://gitdiagram.com/google-research/rrsi/video

## Overview

RRSI evolves agent harnesses through a repeated propose–screen–evaluate–select loop, with domain adapters connecting that shared search to coding, document-work, and engineering-design benchmarks. Accepted candidates become git-backed incumbents; evaluation and edit history provide evidence for later rounds. The README documents the search stages and all three instances; sampled source additionally confirms selected adapter, workspace-runner, and gateway behavior, so unsampled domain wiring is shown only where documented.

Main entry points: [`rrsi/loop.py`](https://github.com/google-research/rrsi/blob/main/rrsi/loop.py) (Round loop), [`rrsi/evaluate.py`](https://github.com/google-research/rrsi/blob/main/rrsi/evaluate.py) (Score and cost), [`domains/workspace/workspace_driver.py`](https://github.com/google-research/rrsi/blob/main/domains/workspace/workspace_driver.py) (Workspace agent), [`rrsi/analyst.py`](https://github.com/google-research/rrsi/blob/main/rrsi/analyst.py) (Harness analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Search orchestration"]
  node_cli["Command interface<br/>[rrsi.py]"]
  node_driver["Run driver<br/>[driver.py]"]
  node_loop["Round loop<br/>[loop.py]"]
end

subgraph group_search["Search method"]
  node_analysis["Harness analysis<br/>[analyst.py]"]
  node_digester["Trace digester<br/>[digester.py]"]
  node_proposal["Candidate proposer<br/>[propose.py]"]
  node_critic["Leakage critic<br/>[critic.py]"]
  node_selection["Candidate selection<br/>[selection.py]"]
  node_evaluation["Score and cost<br/>[evaluate.py]"]
end

subgraph group_instances["Benchmark instances"]
  node_coding["Terminal benchmark<br/>[adapter.py]"]
  node_codingrunner["Harbor runner<br/>[run_eval.sh]"]
  node_workspace["Document-work benchmark<br/>[adapter.py]"]
  node_workspacerunner["Workspace agent"]
  node_workspacegateway["Workspace tools<br/>[gateway.py]"]
  node_engineering["Engineering benchmark<br/>[adapter.py]"]
  node_enggateway["Engineering tools<br/>[gateway.py]"]
  node_ood["Held-out evaluations"]
end

subgraph group_state["Search state"]
  node_gitops["Worktree operations<br/>[gitops.py]"]
  node_history["Edit history<br/>[history.py]"]
  node_frontier["Run frontier<br/>[loop.py]"]
end

node_operator(("Search operator"))
node_model(("LLM service"))
node_benchmarks(("Benchmark tasks"))

node_operator -->|"invokes"| node_cli
node_cli -->|"dispatches"| node_driver
node_driver -->|"runs rounds"| node_loop
node_loop -->|"analyzes incumbent"| node_analysis
node_analysis -->|"dispatches traces"| node_digester
node_analysis -->|"requests analysis"| node_model
node_loop -->|"drafts candidates"| node_proposal
node_proposal -->|"requests edits"| node_model
node_loop -->|"screens candidates"| node_critic
node_critic -->|"requests review"| node_model
node_loop -->|"measures candidates"| node_evaluation
node_evaluation -->|"provides scores"| node_selection
node_loop -->|"selects winner"| node_selection
node_loop -->|"manages worktrees"| node_gitops
node_loop -->|"records edits"| node_history
node_loop -->|"updates incumbent"| node_frontier
node_evaluation -->|"evaluates via"| node_coding
node_coding -->|"runs trials"| node_codingrunner
node_codingrunner -->|"loads tasks"| node_benchmarks
node_evaluation -->|"evaluates via"| node_workspace
node_workspace -->|"produces runs"| node_workspacerunner
node_workspacerunner -->|"uses tools"| node_workspacegateway
node_workspacerunner -->|"loads tasks"| node_benchmarks
node_evaluation -->|"evaluates via"| node_engineering
node_engineering -->|"scores tasks"| node_benchmarks
node_workspacerunner -->|"requests agent responses"| node_model
node_enggateway -->|"accesses task workspace"| node_benchmarks
node_ood -.->|"evaluates held-out sets"| node_benchmarks

click node_cli "https://github.com/google-research/rrsi/blob/main/rrsi.py"
click node_driver "https://github.com/google-research/rrsi/blob/main/rrsi/driver.py"
click node_loop "https://github.com/google-research/rrsi/blob/main/rrsi/loop.py"
click node_analysis "https://github.com/google-research/rrsi/blob/main/rrsi/analyst.py"
click node_digester "https://github.com/google-research/rrsi/blob/main/rrsi/digester.py"
click node_proposal "https://github.com/google-research/rrsi/blob/main/rrsi/propose.py"
click node_critic "https://github.com/google-research/rrsi/blob/main/rrsi/critic.py"
click node_selection "https://github.com/google-research/rrsi/blob/main/rrsi/selection.py"
click node_evaluation "https://github.com/google-research/rrsi/blob/main/rrsi/evaluate.py"
click node_gitops "https://github.com/google-research/rrsi/blob/main/rrsi/gitops.py"
click node_history "https://github.com/google-research/rrsi/blob/main/rrsi/history.py"
click node_frontier "https://github.com/google-research/rrsi/blob/main/rrsi/loop.py"
click node_coding "https://github.com/google-research/rrsi/blob/main/domains/coding/adapter.py"
click node_codingrunner "https://github.com/google-research/rrsi/blob/main/domains/coding/scripts/run_eval.sh"
click node_workspace "https://github.com/google-research/rrsi/blob/main/domains/workspace/adapter.py"
click node_workspacerunner "https://github.com/google-research/rrsi/blob/main/domains/workspace/workspace_driver.py"
click node_workspacegateway "https://github.com/google-research/rrsi/blob/main/domains/workspace/mcp_gateway/gateway.py"
click node_engineering "https://github.com/google-research/rrsi/blob/main/domains/eng/adapter.py"
click node_enggateway "https://github.com/google-research/rrsi/blob/main/domains/eng/mcp_gateway/gateway.py"
click node_ood "https://github.com/google-research/rrsi/tree/main/domains/workspace/ood"

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_driver,node_loop toneBlue
class node_analysis,node_digester,node_proposal,node_critic,node_selection,node_evaluation toneAmber
class node_coding,node_codingrunner,node_workspace,node_workspacerunner,node_workspacegateway,node_engineering,node_enggateway,node_ood toneMint
class node_gitops,node_history,node_frontier,node_benchmarks toneRose
class node_operator,node_model toneIndigo
```

## Components

### Search orchestration

- [Command interface](https://github.com/google-research/rrsi/blob/main/rrsi.py): `rrsi.py`
- [Run driver](https://github.com/google-research/rrsi/blob/main/rrsi/driver.py): `rrsi/driver.py`
- [Round loop](https://github.com/google-research/rrsi/blob/main/rrsi/loop.py): `rrsi/loop.py`

### Search method

- [Harness analysis](https://github.com/google-research/rrsi/blob/main/rrsi/analyst.py): `rrsi/analyst.py`
- [Trace digester](https://github.com/google-research/rrsi/blob/main/rrsi/digester.py): `rrsi/digester.py`
- [Candidate proposer](https://github.com/google-research/rrsi/blob/main/rrsi/propose.py): `rrsi/propose.py`
- [Leakage critic](https://github.com/google-research/rrsi/blob/main/rrsi/critic.py): `rrsi/critic.py`
- [Candidate selection](https://github.com/google-research/rrsi/blob/main/rrsi/selection.py): `rrsi/selection.py`
- [Score and cost](https://github.com/google-research/rrsi/blob/main/rrsi/evaluate.py): `rrsi/evaluate.py`

### Benchmark instances

- [Terminal benchmark](https://github.com/google-research/rrsi/blob/main/domains/coding/adapter.py): `domains/coding/adapter.py`
- [Harbor runner](https://github.com/google-research/rrsi/blob/main/domains/coding/scripts/run_eval.sh): `domains/coding/scripts/run_eval.sh`
- [Document-work benchmark](https://github.com/google-research/rrsi/blob/main/domains/workspace/adapter.py): `domains/workspace/adapter.py`
- [Workspace agent](https://github.com/google-research/rrsi/blob/main/domains/workspace/workspace_driver.py): `domains/workspace/workspace_driver.py`
- [Workspace tools](https://github.com/google-research/rrsi/blob/main/domains/workspace/mcp_gateway/gateway.py): `domains/workspace/mcp_gateway/gateway.py`
- [Engineering benchmark](https://github.com/google-research/rrsi/blob/main/domains/eng/adapter.py): `domains/eng/adapter.py`
- [Engineering tools](https://github.com/google-research/rrsi/blob/main/domains/eng/mcp_gateway/gateway.py): `domains/eng/mcp_gateway/gateway.py`
- [Held-out evaluations](https://github.com/google-research/rrsi/tree/main/domains/workspace/ood): `domains/workspace/ood`

### Search state

- [Worktree operations](https://github.com/google-research/rrsi/blob/main/rrsi/gitops.py): `rrsi/gitops.py`
- [Edit history](https://github.com/google-research/rrsi/blob/main/rrsi/history.py): `rrsi/history.py`
- [Run frontier](https://github.com/google-research/rrsi/blob/main/rrsi/loop.py): `rrsi/loop.py`

### Other components

- **Search operator**
- **LLM service**
- **Benchmark tasks**

## Connections

- Search operator → Command interface: invokes
- Command interface → Run driver: dispatches
- Run driver → Round loop: runs rounds
- Round loop → Harness analysis: analyzes incumbent
- Harness analysis → Trace digester: dispatches traces
- Harness analysis → LLM service: requests analysis
- Round loop → Candidate proposer: drafts candidates
- Candidate proposer → LLM service: requests edits
- Round loop → Leakage critic: screens candidates
- Leakage critic → LLM service: requests review
- Round loop → Score and cost: measures candidates
- Score and cost → Candidate selection: provides scores
- Round loop → Candidate selection: selects winner
- Round loop → Worktree operations: manages worktrees
- Round loop → Edit history: records edits
- Round loop → Run frontier: updates incumbent
- Score and cost → Terminal benchmark: evaluates via
- Terminal benchmark → Harbor runner: runs trials
- Harbor runner → Benchmark tasks: loads tasks
- Score and cost → Document-work benchmark: evaluates via
- Document-work benchmark → Workspace agent: produces runs
- Workspace agent → Workspace tools: uses tools
- Workspace agent → Benchmark tasks: loads tasks
- Score and cost → Engineering benchmark: evaluates via
- Engineering benchmark → Benchmark tasks: scores tasks
- Workspace agent → LLM service: requests agent responses
- Engineering tools → Benchmark tasks: accesses task workspace
- Held-out evaluations → Benchmark tasks: evaluates held-out sets
