# terminalworld/openrua architecture

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

- Interactive diagram: https://gitdiagram.com/terminalworld/openrua
- Repository: https://github.com/terminalworld/openrua

## Overview

OpenRUA lets coding agents operate real or simulated robots through ROS 2. The main workflow is: a user starts a task or shared session, OpenRUA resolves robot/agent/benchmark configuration, prepares a workspace and runtime, then the agent uses robot interfaces and execution feedback to continue. It also supports shared TUI/browser/CLI chat and recorded benchmark trials. The graph combines README-documented behavior with SOURCE INDEX references; unsampled internals are represented at their supported paths, and unverified wiring is omitted.

Main entry points: [`openrua/runner/main.py`](https://github.com/terminalworld/openrua/blob/main/openrua/runner/main.py) (Trial runner), [`openrua/config/loader.py`](https://github.com/terminalworld/openrua/blob/main/openrua/config/loader.py) (Config composition), [`openrua/robot/sim/bridge/main.py`](https://github.com/terminalworld/openrua/blob/main/openrua/robot/sim/bridge/main.py) (Simulation bridge), [`openrua/agents/registry.py`](https://github.com/terminalworld/openrua/blob/main/openrua/agents/registry.py) (Agent registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_configuration["Configuration"]
  node_config["Config composition<br/>[loader.py]"]
  node_schema["Config schema<br/>[schema.py]"]
  node_paths["Config paths<br/>[paths.py]"]
end

subgraph group_execution["Task execution"]
  node_agent_registry["Agent registry<br/>[registry.py]"]
  node_agent_contract["Agent contract<br/>[base.py]"]
  node_agent_plugin["Agent plugins"]
  node_workspace["Robot workspace<br/>[workspace.py]"]
  node_runner["Trial runner<br/>[main.py]"]
  node_trial["Trial execution<br/>[trial.py]"]
  node_recording["Trial recording<br/>[record.py]"]
  node_operator["Trial operators<br/>[operators.py]"]
end

subgraph group_robot["Robot interfaces"]
  node_robot_profile["Robot runtime<br/>[base.py]"]
  node_sim_client["Simulator lifecycle<br/>[client.py]"]
  node_bridge["Simulation bridge<br/>[main.py]"]
  node_bridge_plugins["Engine and environment plugins<br/>[plug.py]"]
  node_ros_control["ROS control ports<br/>[controllers.py]"]
end

subgraph group_sessions["Shared sessions"]
  node_session_service["Session service<br/>[http.py]"]
  node_session_core["Session execution<br/>[core.py]"]
  node_session_store[("Session state<br/>[store.py]")]
  node_session_client["Session API client<br/>[client.py]"]
end

subgraph group_interfaces["User interfaces"]
  node_cli["CLI commands"]
  node_tui["Terminal chat<br/>[app.mjs]"]
  node_tui_controller["Chat controller<br/>[controller.mjs]"]
  node_web["Browser interface<br/>[app.js]"]
end

node_user(("User"))
node_agent(("Coding agent"))
node_robot_actor(("Real or simulated robot"))

node_user -->|"starts task"| node_cli
node_cli -.->|"resolves settings"| node_config
node_config -->|"validates against"| node_schema
node_config -->|"locates files"| node_paths
node_runner -->|"loads configuration"| node_config
node_runner -->|"selects agent"| node_agent_registry
node_agent_registry -->|"composes agent"| node_agent_contract
node_agent_contract -->|"uses hooks"| node_agent_plugin
node_runner -->|"seeds workspace"| node_workspace
node_agent -->|"explores and edits"| node_workspace
node_agent -->|"issues ROS commands"| node_robot_actor
node_runner -->|"runs trials"| node_trial
node_runner -->|"selects operator"| node_operator
node_runner -->|"records artifacts"| node_recording
node_trial -.->|"operates robot"| node_robot_profile
node_robot_profile -->|"uses simulator lifecycle"| node_sim_client
node_sim_client -.->|"starts bridge"| node_bridge
node_bridge -->|"binds engine and loader"| node_bridge_plugins
node_bridge -.->|"creates control graph"| node_ros_control
node_ros_control -->|"sends control commands"| node_robot_actor
node_user -->|"chats through"| node_tui
node_user -->|"chats through"| node_web
node_tui -->|"delegates chat state"| node_tui_controller
node_tui_controller -.->|"requests session API"| node_session_client
node_session_client -->|"sends local HTTP requests"| node_session_service
node_session_service -.->|"dispatches session operations"| node_session_core
node_session_core -.->|"persists session state"| node_session_store
node_agent -->|"uses execution feedback"| node_robot_actor

click node_cli "https://github.com/terminalworld/openrua/tree/main/openrua/cli/commands"
click node_config "https://github.com/terminalworld/openrua/blob/main/openrua/config/loader.py"
click node_schema "https://github.com/terminalworld/openrua/blob/main/openrua/config/schema.py"
click node_paths "https://github.com/terminalworld/openrua/blob/main/openrua/config/paths.py"
click node_agent_registry "https://github.com/terminalworld/openrua/blob/main/openrua/agents/registry.py"
click node_agent_contract "https://github.com/terminalworld/openrua/blob/main/openrua/agents/base.py"
click node_agent_plugin "https://github.com/terminalworld/openrua/blob/main/openrua/plugins/agents/claude_conversation.py"
click node_workspace "https://github.com/terminalworld/openrua/blob/main/openrua/sandbox/workspace.py"
click node_runner "https://github.com/terminalworld/openrua/blob/main/openrua/runner/main.py"
click node_trial "https://github.com/terminalworld/openrua/blob/main/openrua/runner/trial.py"
click node_recording "https://github.com/terminalworld/openrua/blob/main/openrua/runner/record.py"
click node_operator "https://github.com/terminalworld/openrua/blob/main/openrua/runner/operators.py"
click node_robot_profile "https://github.com/terminalworld/openrua/blob/main/openrua/robot/base.py"
click node_sim_client "https://github.com/terminalworld/openrua/blob/main/openrua/robot/sim/client.py"
click node_bridge "https://github.com/terminalworld/openrua/blob/main/openrua/robot/sim/bridge/main.py"
click node_bridge_plugins "https://github.com/terminalworld/openrua/blob/main/openrua/robot/sim/bridge/plug.py"
click node_ros_control "https://github.com/terminalworld/openrua/blob/main/openrua/robot/sim/bridge/ros/controllers.py"
click node_session_service "https://github.com/terminalworld/openrua/blob/main/openrua/sessions/http.py"
click node_session_core "https://github.com/terminalworld/openrua/blob/main/openrua/sessions/core.py"
click node_session_store "https://github.com/terminalworld/openrua/blob/main/openrua/sessions/store.py"
click node_session_client "https://github.com/terminalworld/openrua/blob/main/openrua/sessions/client.py"
click node_tui "https://github.com/terminalworld/openrua/blob/main/ui/terminal/src/app.mjs"
click node_tui_controller "https://github.com/terminalworld/openrua/blob/main/ui/terminal/src/controller.mjs"
click node_web "https://github.com/terminalworld/openrua/blob/main/openrua/web/app.js"

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_config,node_schema,node_paths,node_user toneBlue
class node_agent_registry,node_agent_contract,node_agent_plugin,node_workspace,node_runner,node_trial,node_recording,node_operator toneAmber
class node_robot_profile,node_sim_client,node_bridge,node_bridge_plugins,node_ros_control toneMint
class node_session_service,node_session_core,node_session_store,node_session_client toneRose
class node_cli,node_tui,node_tui_controller,node_web,node_agent,node_robot_actor toneIndigo
```

## Components

### Configuration

- [Config composition](https://github.com/terminalworld/openrua/blob/main/openrua/config/loader.py): `openrua/config/loader.py`
- [Config schema](https://github.com/terminalworld/openrua/blob/main/openrua/config/schema.py): `openrua/config/schema.py`
- [Config paths](https://github.com/terminalworld/openrua/blob/main/openrua/config/paths.py): `openrua/config/paths.py`

### Task execution

- [Agent registry](https://github.com/terminalworld/openrua/blob/main/openrua/agents/registry.py): `openrua/agents/registry.py`
- [Agent contract](https://github.com/terminalworld/openrua/blob/main/openrua/agents/base.py): `openrua/agents/base.py`
- [Agent plugins](https://github.com/terminalworld/openrua/blob/main/openrua/plugins/agents/claude_conversation.py): `openrua/plugins/agents/claude_conversation.py`
- [Robot workspace](https://github.com/terminalworld/openrua/blob/main/openrua/sandbox/workspace.py): `openrua/sandbox/workspace.py`
- [Trial runner](https://github.com/terminalworld/openrua/blob/main/openrua/runner/main.py): `openrua/runner/main.py`
- [Trial execution](https://github.com/terminalworld/openrua/blob/main/openrua/runner/trial.py): `openrua/runner/trial.py`
- [Trial recording](https://github.com/terminalworld/openrua/blob/main/openrua/runner/record.py): `openrua/runner/record.py`
- [Trial operators](https://github.com/terminalworld/openrua/blob/main/openrua/runner/operators.py): `openrua/runner/operators.py`

### Robot interfaces

- [Robot runtime](https://github.com/terminalworld/openrua/blob/main/openrua/robot/base.py): `openrua/robot/base.py`
- [Simulator lifecycle](https://github.com/terminalworld/openrua/blob/main/openrua/robot/sim/client.py): `openrua/robot/sim/client.py`
- [Simulation bridge](https://github.com/terminalworld/openrua/blob/main/openrua/robot/sim/bridge/main.py): `openrua/robot/sim/bridge/main.py`
- [Engine and environment plugins](https://github.com/terminalworld/openrua/blob/main/openrua/robot/sim/bridge/plug.py): `openrua/robot/sim/bridge/plug.py`
- [ROS control ports](https://github.com/terminalworld/openrua/blob/main/openrua/robot/sim/bridge/ros/controllers.py): `openrua/robot/sim/bridge/ros/controllers.py`

### Shared sessions

- [Session service](https://github.com/terminalworld/openrua/blob/main/openrua/sessions/http.py): `openrua/sessions/http.py`
- [Session execution](https://github.com/terminalworld/openrua/blob/main/openrua/sessions/core.py): `openrua/sessions/core.py`
- [Session state](https://github.com/terminalworld/openrua/blob/main/openrua/sessions/store.py): `openrua/sessions/store.py`
- [Session API client](https://github.com/terminalworld/openrua/blob/main/openrua/sessions/client.py): `openrua/sessions/client.py`

### User interfaces

- [CLI commands](https://github.com/terminalworld/openrua/tree/main/openrua/cli/commands): `openrua/cli/commands`
- [Terminal chat](https://github.com/terminalworld/openrua/blob/main/ui/terminal/src/app.mjs): `ui/terminal/src/app.mjs`
- [Chat controller](https://github.com/terminalworld/openrua/blob/main/ui/terminal/src/controller.mjs): `ui/terminal/src/controller.mjs`
- [Browser interface](https://github.com/terminalworld/openrua/blob/main/openrua/web/app.js): `openrua/web/app.js`

### Other components

- **User**
- **Coding agent**
- **Real or simulated robot**

## Connections

- User → CLI commands: starts task
- CLI commands → Config composition: resolves settings
- Config composition → Config schema: validates against (evidence: `openrua/config/__init__.py`)
- Config composition → Config paths: locates files (evidence: `openrua/config/loader.py`)
- Trial runner → Config composition: loads configuration (evidence: `openrua/runner/main.py`)
- Trial runner → Agent registry: selects agent (evidence: `openrua/runner/main.py`)
- Agent registry → Agent contract: composes agent (evidence: `openrua/agents/registry.py`)
- Agent contract → Agent plugins: uses hooks (evidence: `openrua/plugins/agents/claude_code.py`)
- Trial runner → Robot workspace: seeds workspace (evidence: `openrua/runner/main.py`)
- Coding agent → Robot workspace: explores and edits
- Coding agent → Real or simulated robot: issues ROS commands
- Trial runner → Trial execution: runs trials (evidence: `openrua/runner/main.py`)
- Trial runner → Trial operators: selects operator (evidence: `openrua/runner/main.py`)
- Trial runner → Trial recording: records artifacts (evidence: `openrua/runner/main.py`)
- Trial execution → Robot runtime: operates robot
- Robot runtime → Simulator lifecycle: uses simulator lifecycle (evidence: `openrua/robot/sim/client.py`)
- Simulator lifecycle → Simulation bridge: starts bridge
- Simulation bridge → Engine and environment plugins: binds engine and loader (evidence: `openrua/robot/sim/bridge/main.py`)
- Simulation bridge → ROS control ports: creates control graph
- ROS control ports → Real or simulated robot: sends control commands
- User → Terminal chat: chats through
- User → Browser interface: chats through
- Terminal chat → Chat controller: delegates chat state (evidence: `ui/terminal/src/app.mjs`)
- Chat controller → Session API client: requests session API
- Session API client → Session service: sends local HTTP requests (evidence: `openrua/sessions/client.py`)
- Session service → Session execution: dispatches session operations
- Session execution → Session state: persists session state
- Coding agent → Real or simulated robot: uses execution feedback
