# stanford-tml/homebody architecture

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

## Overview

HomeBody supports two related workflows: an operator starts live REAL2SIM exploration, whose recordings are reconstructed into reusable scenes; in SIM, a task is presented to a model, which selects registered skills that observe and act through a robot backend. Skills cover navigation and pick/place, while backends provide simulation or G1 control. The graph preserves these documented capabilities and the sampled runtime layers. Some REAL2SIM internals and real-robot runtime paths were not excerpted, so uncertain connections are omitted.

Main entry points: [`src/homebody/skills/pick.py`](https://github.com/stanford-tml/homebody/blob/main/src/homebody/skills/pick.py) (Pick skill), [`src/homebody/session/session.py`](https://github.com/stanford-tml/homebody/blob/main/src/homebody/session/session.py) (Task session), [`src/homebody/skills/contract.py`](https://github.com/stanford-tml/homebody/blob/main/src/homebody/skills/contract.py) (Skill lifecycle), [`src/homebody/skills/place.py`](https://github.com/stanford-tml/homebody/blob/main/src/homebody/skills/place.py) (Place skill)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Task interaction"]
  node_console["Task console<br/>[console.py]"]
  node_session["Task session<br/>[session.py]"]
  node_model["Model provider<br/>[provider.py]"]
end

subgraph group_skills["Skills and motion"]
  node_skillrunner["Skill lifecycle<br/>[contract.py]"]
  node_navigation["Navigation skill<br/>[navigate.py]"]
  node_pick["Pick skill<br/>[pick.py]"]
  node_place["Place skill<br/>[place.py]"]
  node_carry["Carry tracking<br/>[carry.py]"]
  node_armmotion["Arm motion<br/>[arm.py]"]
  node_helpers["Geometry and collision<br/>[geometry.py]"]
end

subgraph group_robot["Robot runtime"]
  node_observations["Robot observations<br/>[observations.py]"]
  node_mujoco["MuJoCo backend<br/>[mujoco.py]"]
  node_controller["Simulation controller<br/>[controller.py]"]
  node_g1["G1 backend<br/>[body_host.py]"]
  node_scene["Reusable scene<br/>[scene.py]"]
end

subgraph group_real2sim["REAL2SIM"]
  node_exploreconsole["Exploration console<br/>[app.py]"]
  node_planner["Exploration planner<br/>[planner.py]"]
  node_exploresettings["Exploration settings<br/>[settings.py]"]
  node_capture["Exploration capture<br/>[capture_package.py]"]
  node_reconstruct["Scene reconstruction<br/>[cli.py]"]
end

node_operator(("Operator"))
node_g1robot["Unitree G1"]
node_vlmservice["Model service"]

node_operator -->|"submits task"| node_console
node_console -->|"starts session"| node_session
node_session -->|"requests decision"| node_model
node_model -.->|"queries model"| node_vlmservice
node_session -->|"runs skills"| node_skillrunner
node_skillrunner -.->|"dispatches"| node_navigation
node_skillrunner -.->|"dispatches"| node_pick
node_skillrunner -.->|"dispatches"| node_place
node_pick -->|"requests approach"| node_navigation
node_pick -->|"registers hold"| node_carry
node_place -->|"checks carry"| node_carry
node_pick -->|"moves arm"| node_armmotion
node_place -->|"moves arm"| node_armmotion
node_pick -->|"plans grasp"| node_helpers
node_place -->|"checks clearance"| node_helpers
node_session -->|"publishes frames"| node_observations
node_mujoco -->|"fills measurements"| node_observations
node_mujoco -->|"uses controller"| node_controller
node_controller -.->|"controls in simulation"| node_g1
node_g1 -.->|"controls robot"| node_g1robot
node_operator -->|"starts exploration"| node_exploreconsole
node_exploreconsole -->|"plans exploration"| node_planner
node_exploreconsole -->|"loads settings"| node_exploresettings
node_exploreconsole -->|"records run"| node_capture
node_capture -->|"provides recording"| node_reconstruct
node_reconstruct -->|"produces scene"| node_scene
node_scene -->|"loads scene"| node_mujoco

click node_console "https://github.com/stanford-tml/homebody/blob/main/src/homebody/ui/console.py"
click node_session "https://github.com/stanford-tml/homebody/blob/main/src/homebody/session/session.py"
click node_model "https://github.com/stanford-tml/homebody/blob/main/src/homebody/vlm/provider.py"
click node_observations "https://github.com/stanford-tml/homebody/blob/main/src/homebody/primitives/observations.py"
click node_skillrunner "https://github.com/stanford-tml/homebody/blob/main/src/homebody/skills/contract.py"
click node_navigation "https://github.com/stanford-tml/homebody/blob/main/src/homebody/skills/navigate.py"
click node_pick "https://github.com/stanford-tml/homebody/blob/main/src/homebody/skills/pick.py"
click node_place "https://github.com/stanford-tml/homebody/blob/main/src/homebody/skills/place.py"
click node_carry "https://github.com/stanford-tml/homebody/blob/main/src/homebody/motion/carry.py"
click node_armmotion "https://github.com/stanford-tml/homebody/blob/main/src/homebody/motion/arm.py"
click node_helpers "https://github.com/stanford-tml/homebody/blob/main/src/homebody/helpers/geometry.py"
click node_mujoco "https://github.com/stanford-tml/homebody/blob/main/src/homebody/backends/mujoco.py"
click node_controller "https://github.com/stanford-tml/homebody/blob/main/src/homebody/backends/controller.py"
click node_g1 "https://github.com/stanford-tml/homebody/blob/main/src/homebody/backends/g1/body_host.py"
click node_exploreconsole "https://github.com/stanford-tml/homebody/blob/main/src/homebody/real2sim/exploration/app.py"
click node_planner "https://github.com/stanford-tml/homebody/blob/main/src/homebody/real2sim/exploration/planner.py"
click node_exploresettings "https://github.com/stanford-tml/homebody/blob/main/src/homebody/real2sim/exploration/settings.py"
click node_capture "https://github.com/stanford-tml/homebody/blob/main/src/homebody/capture_package.py"
click node_reconstruct "https://github.com/stanford-tml/homebody/blob/main/src/homebody/real2sim/cli.py"
click node_scene "https://github.com/stanford-tml/homebody/blob/main/src/homebody/backends/scene.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_console,node_session,node_model toneBlue
class node_skillrunner,node_navigation,node_pick,node_place,node_carry,node_armmotion,node_helpers toneAmber
class node_observations,node_mujoco,node_controller,node_g1,node_scene toneMint
class node_exploreconsole,node_planner,node_exploresettings,node_capture,node_reconstruct toneRose
class node_operator,node_g1robot,node_vlmservice toneIndigo
```

## Components

### Task interaction

- [Task console](https://github.com/stanford-tml/homebody/blob/main/src/homebody/ui/console.py): `src/homebody/ui/console.py`
- [Task session](https://github.com/stanford-tml/homebody/blob/main/src/homebody/session/session.py): `src/homebody/session/session.py`
- [Model provider](https://github.com/stanford-tml/homebody/blob/main/src/homebody/vlm/provider.py): `src/homebody/vlm/provider.py`

### Skills and motion

- [Skill lifecycle](https://github.com/stanford-tml/homebody/blob/main/src/homebody/skills/contract.py): `src/homebody/skills/contract.py`
- [Navigation skill](https://github.com/stanford-tml/homebody/blob/main/src/homebody/skills/navigate.py): `src/homebody/skills/navigate.py`
- [Pick skill](https://github.com/stanford-tml/homebody/blob/main/src/homebody/skills/pick.py): `src/homebody/skills/pick.py`
- [Place skill](https://github.com/stanford-tml/homebody/blob/main/src/homebody/skills/place.py): `src/homebody/skills/place.py`
- [Carry tracking](https://github.com/stanford-tml/homebody/blob/main/src/homebody/motion/carry.py): `src/homebody/motion/carry.py`
- [Arm motion](https://github.com/stanford-tml/homebody/blob/main/src/homebody/motion/arm.py): `src/homebody/motion/arm.py`
- [Geometry and collision](https://github.com/stanford-tml/homebody/blob/main/src/homebody/helpers/geometry.py): `src/homebody/helpers/geometry.py`

### Robot runtime

- [Robot observations](https://github.com/stanford-tml/homebody/blob/main/src/homebody/primitives/observations.py): `src/homebody/primitives/observations.py`
- [MuJoCo backend](https://github.com/stanford-tml/homebody/blob/main/src/homebody/backends/mujoco.py): `src/homebody/backends/mujoco.py`
- [Simulation controller](https://github.com/stanford-tml/homebody/blob/main/src/homebody/backends/controller.py): `src/homebody/backends/controller.py`
- [G1 backend](https://github.com/stanford-tml/homebody/blob/main/src/homebody/backends/g1/body_host.py): `src/homebody/backends/g1/body_host.py`
- [Reusable scene](https://github.com/stanford-tml/homebody/blob/main/src/homebody/backends/scene.py): `src/homebody/backends/scene.py`

### REAL2SIM

- [Exploration console](https://github.com/stanford-tml/homebody/blob/main/src/homebody/real2sim/exploration/app.py): `src/homebody/real2sim/exploration/app.py`
- [Exploration planner](https://github.com/stanford-tml/homebody/blob/main/src/homebody/real2sim/exploration/planner.py): `src/homebody/real2sim/exploration/planner.py`
- [Exploration settings](https://github.com/stanford-tml/homebody/blob/main/src/homebody/real2sim/exploration/settings.py): `src/homebody/real2sim/exploration/settings.py`
- [Exploration capture](https://github.com/stanford-tml/homebody/blob/main/src/homebody/capture_package.py): `src/homebody/capture_package.py`
- [Scene reconstruction](https://github.com/stanford-tml/homebody/blob/main/src/homebody/real2sim/cli.py): `src/homebody/real2sim/cli.py`

### Other components

- **Operator**
- **Unitree G1**
- **Model service**

## Connections

- Operator → Task console: submits task (evidence: `README.md`)
- Task console → Task session: starts session (evidence: `README.md`)
- Task session → Model provider: requests decision (evidence: `src/homebody/session/session.py`)
- Model provider → Model service: queries model (evidence: `README.md`)
- Task session → Skill lifecycle: runs skills (evidence: `src/homebody/session/session.py`)
- Skill lifecycle → Navigation skill: dispatches (evidence: `src/homebody/skills/navigate.py`)
- Skill lifecycle → Pick skill: dispatches (evidence: `src/homebody/skills/pick.py`)
- Skill lifecycle → Place skill: dispatches (evidence: `src/homebody/skills/place.py`)
- Pick skill → Navigation skill: requests approach (evidence: `src/homebody/skills/pick.py`)
- Pick skill → Carry tracking: registers hold (evidence: `src/homebody/motion/carry.py`)
- Place skill → Carry tracking: checks carry (evidence: `src/homebody/skills/place.py`)
- Pick skill → Arm motion: moves arm (evidence: `src/homebody/skills/pick.py`)
- Place skill → Arm motion: moves arm (evidence: `src/homebody/skills/place.py`)
- Pick skill → Geometry and collision: plans grasp (evidence: `src/homebody/skills/pick.py`)
- Place skill → Geometry and collision: checks clearance (evidence: `src/homebody/skills/place.py`)
- Task session → Robot observations: publishes frames (evidence: `src/homebody/session/session.py`)
- MuJoCo backend → Robot observations: fills measurements (evidence: `src/homebody/backends/mujoco.py`)
- MuJoCo backend → Simulation controller: uses controller (evidence: `src/homebody/backends/mujoco.py`)
- Simulation controller → G1 backend: controls in simulation
- G1 backend → Unitree G1: controls robot
- Operator → Exploration console: starts exploration (evidence: `README.md`)
- Exploration console → Exploration planner: plans exploration (evidence: `src/homebody/real2sim/exploration/app.py`)
- Exploration console → Exploration settings: loads settings (evidence: `src/homebody/real2sim/exploration/app.py`)
- Exploration console → Exploration capture: records run (evidence: `README.md`)
- Exploration capture → Scene reconstruction: provides recording (evidence: `README.md`)
- Scene reconstruction → Reusable scene: produces scene (evidence: `README.md`)
- Reusable scene → MuJoCo backend: loads scene (evidence: `src/homebody/backends/scene.py`)
