How ros-claw/rosclaw works
1. What this repository is
ROSClaw is a Python 3.11+ runtime infrastructure for embodied agents, not a single robotics app. The repo is organized around a controlled execution loop for physical AI: define the robot body, route capabilities, validate actions in a sandbox, execute through a runtime adapter, then record and learn from the result.
2. Top-level control plane
The entry points are the CLI (src/rosclaw/cli.py, src/rosclaw/__main__.py) and the firstboot/dashboard tooling. These bootstrap the workspace, validate the installation, and connect the user to the rest of the runtime. The bin/rosclaw script and scripts/ folder support local installs, CI, and smoke tests.
3. Core runtime backbone
src/rosclaw/core/ provides the generic infrastructure: runtime lifecycle, async utilities, typed events, and the central EventBus. This is the main internal communication boundary; higher-level modules publish and subscribe to events rather than coupling directly.
4. Body and embodiment layer
src/rosclaw/body/, src/rosclaw/eurdf/, src/rosclaw/e_urdf/, and src/rosclaw/eurdf_zoo/ model the robot and its capabilities. This layer compiles and validates embodiment descriptions, safety constraints, references, ROS introspection, and fleet compatibility. The e-urdf-zoo/ directory contains concrete robot profiles and simulation assets for bodies like UR5e, Unitree G1/Go2, Fetch, Franka, and drones.
5. Capability routing and providers
src/rosclaw/provider/ is the policy boundary between intent and action. Providers expose capabilities, apply schema and action guards, and route requests into supported runtimes (python_runtime, http_runtime, ros2_runtime). Built-ins include skill, critic, VLM, and DeepSeek adapters. The key architectural rule is that model output does not directly command hardware; it must pass the provider/guard pipeline first.
6. Sandbox and execution boundary
src/rosclaw/sandbox/ and src/rosclaw/firewall/ enforce the action gate. The sandbox wraps execution, publishes events, and routes through a firewall that can allow, modify, block, or require confirmation. This is where unsafe actions are intercepted before they reach real or simulated hardware.
7. Physical execution adapters
src/rosclaw/mcp_drivers/, src/rosclaw/connectors/ros/, src/rosclaw/runtime/, and src/rosclaw/mcp/ bridge ROSClaw to actual execution environments. They include ROS 2 transport/bridge support, mock transport, serial drivers, MuJoCo and ManiSkill adapters, ROS discovery/normalization, and MCP server tooling. This is the boundary to ROS graphs, simulators, and hardware-facing services.
8. Observation, sensing, and readiness
src/rosclaw/sense/ collects telemetry and evaluates robot state. It includes collectors for ROS2, DDS, file replay, and mock sources; estimators for health, fatigue, readiness, envelope, and risk; and adapters that feed context into other subsystems. This layer turns raw robot/runtime signals into decision-ready status.
9. Practice, memory, and knowledge
src/rosclaw/practice/, src/rosclaw/memory/, and src/rosclaw/know/ form the learning and evidence plane. Practice records episodes and timelines, Memory provides persistence/search over experience traces, and Know stores structured task cards, embodiment cards, verifier cards, and evidence graphs. Together they preserve what happened and why it mattered.
10. How / recovery and intervention
src/rosclaw/how/ implements runtime intervention and recovery loops. It uses evidence, rules, and safety routing to propose repairs when execution goes wrong. This is the “self-healing” layer: it does not execute blindly, but reacts to failures using recorded traces and policy.
11. Auto, Darwin, and skill evolution
src/rosclaw/auto/ is the experimentation and patch-evolution system: diagnosis, hypothesis/proposal, patch validation, runners, promotion/rollback, and reporting. src/rosclaw/darwin/ provides evaluation scenarios, metrics, and plugin integration for benchmark-style validation. These subsystems decide whether a change is a champion, a dead end, or needs rollback.
12. Asset registry and onboarding
src/rosclaw/hub/ is the asset hub client/server logic for publishing, resolving, verifying, and installing versioned assets such as skills, providers, hardware MCP servers, digital twins, and cognitive wikis. src/rosclaw/mcp/onboarding/ handles installation and merge of MCP configuration into user workspaces. The tests/fixtures/fake_registry/ and tests/fixtures/hub_assets/ directories show the registry-first design.
13. User-facing products
src/rosclaw/dashboard/ serves operational views and first-boot UX. src/rosclaw/firstboot/ guides initial setup, telemetry, and workspace configuration. These are the human/operator surfaces over the runtime, not the core control loop itself.
14. Supporting libraries and experiments
src/rosclaw/skill_manager/, src/rosclaw/swarm/, src/rosclaw/control/, src/rosclaw/data/, and src/rosclaw/sdk_to_mcp/ are secondary modules for skill execution, multi-agent coordination, control primitives, buffering, and SDK-to-MCP compilation. They support the main runtime rather than defining it.
15. What to diagram as the main flow
The primary architecture diagram should show: intent enters via CLI/agent/MCP, body context is resolved, a provider selects a capability, the sandbox/firewall validates it, a runtime/driver executes it, Practice logs the trace, Sense reads state, Memory/Know retain evidence, How/Auto may intervene or improve, and Hub/Registry manage versioned assets and deployments.
Main entry points: provider Provider · sandbox Sandbox · body Body · hub Hub
Components 28
Control plane
Entry points, bootstrapping, and operator surfaces.
- CLI · Main command-line entry for ROSClaw.
src/rosclaw/cli.py - Module main · Python module entrypoint.
src/rosclaw/__main__.py - First boot · Initial workspace setup, telemetry, and onboarding.
src/rosclaw/firstboot - Dashboard · Operational and first-boot user interface.
src/rosclaw/dashboard
Core runtime
Shared runtime backbone and event infrastructure.
- Core runtime · Lifecycle, async utilities, events, and runtime primitives.
src/rosclaw/core - Event bus · Central pub/sub boundary for runtime coordination.
src/rosclaw/core/event_bus.py
Embodiment
Robot body models, embodiment compilation, and capability definitions.
- Body · Robot body registry, compatibility, and safety metadata.
src/rosclaw/body - EURDF · Embodiment description loading and registry support.
src/rosclaw/eurdf - E-URDF · Parser for extended robot descriptions.
src/rosclaw/e_urdf - Profile zoo · Concrete robot profiles and simulation assets.
src/rosclaw/eurdf_zoo
Intent to action
Capability routing, guards, sandboxing, and execution adapters.
- Provider · Intent routing boundary with guards and runtime adapters.
src/rosclaw/provider - Provider runtimes · Python, HTTP, and ROS 2 runtime targets.
src/rosclaw/provider/runtimes - Guard pipeline · Schema and action guards before capability execution.
src/rosclaw/provider/guard - Sandbox · Execution wrapper that mediates unsafe actions.
src/rosclaw/sandbox - Firewall · Allows, modifies, blocks, or confirms actions.
src/rosclaw/firewall - Drivers · ROS 2, serial, MuJoCo, and ManiSkill bridges.
src/rosclaw/mcp_drivers - ROS connector · ROS discovery, normalization, compiler, and transport integration.
src/rosclaw/connectors/ros - MCP · MCP server, schemas, tools, and adapters.
src/rosclaw/mcp
Telemetry and learning
Sensing, practice logs, memory, knowledge, and recovery.
- Sense · Collectors, estimators, and runtime health evaluation.
src/rosclaw/sense - Practice · Episode recording and timeline persistence.
src/rosclaw/practice - Memory · Persistent search and retrieval over experience traces.
src/rosclaw/memory - Know · Structured task, embodiment, verifier, and evidence knowledge.
src/rosclaw/know - How · Intervention and self-healing logic based on evidence and rules.
src/rosclaw/how
Evolution
Auto-improvement, validation, and benchmark systems.
Distribution
Asset registry, onboarding, and packaging flows.
- Hub · Versioned asset publishing, resolving, verification, and install.
src/rosclaw/hub - Onboarding · Workspace merge and MCP configuration onboarding.
src/rosclaw/mcp/onboarding - Forge · Packaging utilities for compiled bundles.
src/rosclaw/forge
Connections 32
- CLI → First boot: bootstraps · CLI launches setup and workspace initialization.
- CLI → Dashboard: opens · CLI connects operators to the dashboard surface.
- Module main → CLI: dispatches · Module entrypoint forwards to the CLI.
- Core runtime → Event bus: hosts · Core runtime provides the event bus and lifecycle primitives.
- Body → EURDF: loads · Body layer resolves embodiment definitions through EURDF.
- Body → E-URDF: parses · Body tooling consumes extended URDF descriptions.
- Body → Profile zoo: profiles · Robot profiles and assets feed the body registry.
- Provider → Guard pipeline: filters · Capability requests must pass guard checks.
- Provider → Provider runtimes: routes to · Validated requests are dispatched to runtimes.
- Provider → Body: uses context · Capability selection depends on embodiment context.
- Sandbox → Firewall: enforces · Sandbox execution is mediated by firewall policy.
- Sandbox → Provider: invokes · Sandboxed actions originate from provider-selected capabilities.
- Sandbox → Event bus: publishes · Sandbox emits execution events into the core bus.
- Drivers → ROS connector: bridges · Drivers bridge runtime execution to ROS environments and simulators.
- Drivers → Sandbox: executes under · Hardware and simulator actions run within the sandbox boundary.
- ROS connector → Provider: supplies caps · ROS discovery and manifests feed capability exposure.
- ROS connector → Body: normalizes · ROS graph information informs body and capability mapping.
- MCP → Provider: exposes · MCP surfaces capabilities to external clients.
- MCP → Sandbox: wraps · MCP tools route through the safety boundary.
- Sense → Event bus: subscribes · Telemetry and estimators consume runtime events.
- Practice → Sense: records from · Practice captures episodes from sensed state and events.
- Practice → Memory: writes traces · Episodes are persisted for later retrieval.
- Memory → Know: feeds · Stored traces inform structured knowledge artifacts.
- Know → How: provides evidence · Knowledge artifacts support recovery and intervention.
- How → Sandbox: intervenes · Recovery logic can redirect or constrain execution.
- Auto → How: improves · Auto systems use failures and interventions to drive patch evolution.
- Auto → Darwin: evaluates · Benchmarks and scenarios validate candidate changes.
- Auto → Hub: publishes · Promoted assets are distributed through the hub.
- Hub → Onboarding: installs · Registry assets are merged into user workspaces.
- Forge → Hub: packages for · Bundling supports hub-distributed assets.
- Dashboard → Sense: shows state · Operator views present health and readiness signals.
- First boot → Hub: configures · Initial setup prepares registry and asset access.