> For the complete documentation index, see [llms.txt](https://robodex.gitbook.io/robodex-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://robodex.gitbook.io/robodex-docs/pipeline/canonical-ir.md).

# Canonical IR

The canonical robot representation lives in:

```
packages/pipeline/ir/design_ir.py
```

It defines frozen dataclasses for robot bodies.

## Main types

| Type            | Purpose                                          |
| --------------- | ------------------------------------------------ |
| `RobotDesignIR` | Complete robot design                            |
| `LinkIR`        | Link/body segment                                |
| `JointIR`       | Connection and motion relationship between links |
| `Geometry`      | Link geometry description                        |
| `SensorSlot`    | Sensor mount point and metadata                  |
| `ActuatorSlot`  | Actuator assignment and metadata                 |

## Why IR exists

The product candidate is optimized for display. The grammar HITL payload is optimized for review. The canonical IR is optimized for deterministic downstream robotics work.

The IR is the shape that compilers and benchmark harnesses should prefer.

## Validation

The IR validates important structural references, including:

* joint parent links,
* joint child links,
* sensor mount links,
* actuator targets.

Invalid references should be caught close to the IR rather than surfacing later as confusing MJCF or simulation failures.

## Relationship to generated body programs

`RobotDesignProgram` and `ComponentProgram` are upstream body-generation representations. They can be materialized into `RobotDesignIR` by research strategies and materializers.

The product route currently also adapts generated HITL data into flat candidates. That product candidate path is separate from full IR materialization.

## When to change IR

Change IR only when downstream robotics behavior needs it:

* a new joint type,
* a new geometry type,
* new actuator or sensor semantics,
* additional physical properties needed by compilers or simulation,
* stronger validation requirements.

IR changes are architecture-sensitive and should update the handoff document and tests.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://robodex.gitbook.io/robodex-docs/pipeline/canonical-ir.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
