# xdei-group/aerialclaw architecture

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

- Interactive diagram: https://gitdiagram.com/xdei-group/aerialclaw
- Repository: https://github.com/xdei-group/aerialclaw

## Overview

1. **Overall shape**
   AerialClaw is a drone autonomy stack centered on an LLM-driven decision loop. The architecture is split into a control plane in Python, a web monitoring/operator UI in React, and a hardware/simulation adapter layer that lets the same agent run against mock, PX4/Gazebo, or AirSim backends.

2. **Primary entry points**
   `server.py` is the main service entry point and exposes the system over REST plus WebSocket. The web UI connects to that service for live telemetry, commands, mode switching, and status updates. `config.py` and `.env` hold runtime configuration such as LLM provider choice and simulation settings.

3. **Cognitive core**
   The `brain/` package is the autonomous reasoning layer. `agent_loop.py` runs the closed-loop perceive → plan → act cycle, `planner_agent.py` builds task plans using LLM + memory context, and `chat_mode.py` supports conversational interaction when the operator is not running fully autonomous tasks.

4. **Skill execution layer**
   The `skills/` package is the action substrate. It is organized as a two-layer skill model: hard skills for atomic actions, and soft skills for higher-level strategies. Hard skills cover flight control, perception, status queries, and general-purpose utilities; soft skills live as Markdown strategy documents and are loaded/composed at runtime via the registry/loader/dynamic generation path.

5. **Perception pipeline**
   `perception/` provides both passive and active sensing. The passive side continuously fuses camera/LiDAR/sensor data into ongoing situational summaries, while `vlm_analyzer.py` performs on-demand visual analysis through an external VLM/LLM. `gz_camera.py` bridges simulation camera feeds, and `prompts.py` contains the prompt templates that shape semantic perception output.

6. **Memory and identity**
   `memory/` is a multi-layer persistence subsystem: episodic memory for task history, skill memory for execution stats, world model for environment knowledge, vector store for semantic retrieval, and shared memory for cross-device reuse. `reflection_engine.py` and `skill_evolution.py` support post-task learning and skill refinement. The `robot_profile/` Markdown files (`SOUL`, `BODY`, `MEMORY`, `SKILLS`, `WORLD_MAP`) are the agent’s persistent identity/state documents and are read/written as part of long-term adaptation.

7. **Hardware abstraction boundary**
   `adapters/` isolates the autonomy stack from the physical or simulated vehicle. `sim_adapter.py` defines the common interface, while `adapter_manager.py` selects the concrete backend: `mock_adapter.py` for no-hardware runs, `px4_adapter.py` for PX4 SITL, `airsim_adapter.py`/`airsim_physics.py`/`airsim_rpc.py` for AirSim, and `mavsdk_adapter.py` for MAVSDK-based control. This is the key boundary that makes the same brain/skills layer portable across environments.

8. **Data flow from task to actuation**
   A user task enters through the server/UI, is interpreted by the planner agent, enriched with memory and current perception, then decomposed into skills. Skills call the selected adapter, which sends commands to either the simulator or the real vehicle. Sensor data and execution results flow back through the adapter into perception, memory, and the UI, closing the loop.

9. **Safety and execution constraints**
   The system is designed around a safety envelope rather than raw command execution. The readme describes command filtering, sandboxed computation, approval boundaries, and flight envelope checks, especially for utilities like Python execution, HTTP access, and file I/O. This makes the boundary between “LLM decides” and “vehicle executes” explicit.

10. **Web monitoring/operator console**
   The `ui/` app is a separate React/Vite frontend for observability and control. It renders live camera views, LiDAR, robot/sensor panels, logs, skill state, map view, and AI panels, and supports switching between manual and autonomous modes. The UI is therefore not just a dashboard; it is the human override and supervision layer.

11. **Configuration and deployment**
   `config/` contains simulation and safety parameters plus camera placement definitions. `scripts/` automates PX4 setup and simulation startup. The repository also includes Gazebo world/model assets under `sim/`, which are the environment side of the hardware abstraction boundary.

12. **External services and runtimes**
   The stack depends on Python 3.10+ for the agent/service runtime and Node.js for the UI build. Runtime behavior depends materially on external LLM/VLM providers such as OpenAI-compatible APIs, and on simulator ecosystems such as PX4, Gazebo, and AirSim. Those services are not peripheral: they are part of the main execution path for planning, perception, and vehicle control.

13. **Diagramming takeaway**
   If you draw the architecture, the central box should be the Python autonomy service with four major internal subsystems: brain, skills, perception, and memory. Around it sit the adapter layer to PX4/AirSim/mock backends, the React UI as the operator console, and the robot-profile Markdown documents as persistent identity/state artifacts. The key flow is bidirectional: operator/task input in, perception/memory/context into the LLM, skill execution out to the adapter, and telemetry/reflection back into memory and UI.

Main entry points: [`memory/memory_manager.py`](https://github.com/xdei-group/aerialclaw/blob/main/memory/memory_manager.py) (Memory), [`adapters/adapter_manager.py`](https://github.com/xdei-group/aerialclaw/blob/main/adapters/adapter_manager.py) (Adapter manager), [`perception/passive_perception.py`](https://github.com/xdei-group/aerialclaw/blob/main/perception/passive_perception.py) (Perception), [`ui/src/App.jsx`](https://github.com/xdei-group/aerialclaw/blob/main/ui/src/App.jsx) (UI app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_python["Python autonomy"]
  node_server["Server<br/>api/ws entry<br/>[server.py]"]
  node_agent_loop(("Agent loop<br/>closed-loop control<br/>[agent_loop.py]"))
  node_planner_agent["Planner<br/>llm planning<br/>[planner_agent.py]"]
  node_chat_mode["Chat mode<br/>operator dialogue<br/>[chat_mode.py]"]
  node_skills_core["Skills<br/>action substrate<br/>[registry.py]"]
  node_motor_skills["Motor skills<br/>hard skills<br/>[motor_skills.py]"]
  node_perception_skills["Perception skills<br/>hard skills"]
  node_cognitive_skills["Cognitive skills<br/>hard skills"]
  node_skill_docs["Soft docs<br/>soft skills"]
  node_skill_loader["Skill loader<br/>registry/loading<br/>[skill_loader.py]"]
  node_perception(("Perception<br/>sensor fusion"))
  node_vlm_analyzer["VLM analyzer<br/>on-demand vision<br/>[vlm_analyzer.py]"]
  node_memory[("Memory<br/>persistence<br/>[memory_manager.py]")]
  node_reflection_engine["Reflection<br/>learning"]
  node_skill_evolution["Skill evolution<br/>adaptation<br/>[skill_evolution.py]"]
  node_runtime["Runtime<br/>orchestration<br/>[agent_runtime.py]"]
end

subgraph group_grp_adapters["Vehicle adapters"]
  node_adapter_manager["Adapter manager<br/>backend selection<br/>[adapter_manager.py]"]
  node_sim_adapter["Sim adapter<br/>adapter interface<br/>[sim_adapter.py]"]
  node_mock_adapter["Mock adapter<br/>backend<br/>[mock_adapter.py]"]
  node_px4_adapter["PX4 adapter<br/>backend<br/>[px4_adapter.py]"]
  node_airsim_adapter["AirSim adapter<br/>backend<br/>[airsim_adapter.py]"]
  node_mavsdk_adapter["MAVSDK adapter<br/>backend<br/>[mavsdk_adapter.py]"]
end

subgraph group_grp_ui["Operator UI"]
  node_ui_app["UI app<br/>react frontend<br/>[App.jsx]"]
  node_ui_panels["UI panels<br/>dashboard modules"]
  node_use_socket["Socket hook<br/>realtime client<br/>[useSocket.js]"]
end

subgraph group_grp_state["Persistent state"]
  node_robot_profile["Robot profile<br/>identity docs"]
end

subgraph group_grp_sim["Simulation assets"]
  node_sim_worlds["Sim worlds<br/>simulation assets<br/>[urban_rescue.sdf]"]
  node_sim_models["Sim models<br/>simulation assets<br/>[model.sdf]"]
  node_sim_config["Sim config<br/>runtime config<br/>[sim_config.yaml]"]
end

node_server -->|"starts"| node_agent_loop
node_server -->|"serves"| node_ui_app
node_ui_app -->|"connects"| node_use_socket
node_agent_loop -->|"plans"| node_planner_agent
node_agent_loop -->|"reads"| node_perception
node_agent_loop -->|"executes"| node_skills_core
node_planner_agent -->|"retrieves"| node_memory
node_planner_agent -->|"contexts"| node_perception
node_chat_mode -->|"references"| node_memory
node_skills_core -->|"loads"| node_skill_loader
node_skill_loader -->|"composes"| node_skill_docs
node_skills_core -->|"dispatches"| node_motor_skills
node_skills_core -->|"dispatches"| node_perception_skills
node_skills_core -->|"dispatches"| node_cognitive_skills
node_motor_skills -->|"commands"| node_adapter_manager
node_perception_skills -->|"queries"| node_perception
node_perception -->|"spawns"| node_vlm_analyzer
node_perception -->|"stores"| node_memory
node_reflection_engine -->|"updates"| node_memory
node_skill_evolution -->|"learns from"| node_memory
node_runtime -->|"orchestrates"| node_agent_loop
node_runtime -->|"binds"| node_adapter_manager
node_adapter_manager -->|"abstracts"| node_sim_adapter
node_adapter_manager -->|"selects"| node_mock_adapter
node_adapter_manager -->|"selects"| node_px4_adapter
node_adapter_manager -->|"selects"| node_airsim_adapter
node_adapter_manager -->|"selects"| node_mavsdk_adapter
node_ui_app -->|"controls"| node_server
node_ui_panels -->|"renders"| node_ui_app
node_server -->|"persists"| node_memory
node_memory -->|"syncs"| node_robot_profile
node_sim_adapter -->|"runs on"| node_sim_worlds
node_sim_adapter -->|"uses"| node_sim_models
node_sim_adapter -->|"configures"| node_sim_config
node_perception -->|"publishes"| node_ui_app
node_memory -->|"feeds"| node_ui_app

click node_server "https://github.com/xdei-group/aerialclaw/blob/main/server.py"
click node_agent_loop "https://github.com/xdei-group/aerialclaw/blob/main/brain/agent_loop.py"
click node_planner_agent "https://github.com/xdei-group/aerialclaw/blob/main/brain/planner_agent.py"
click node_chat_mode "https://github.com/xdei-group/aerialclaw/blob/main/brain/chat_mode.py"
click node_skills_core "https://github.com/xdei-group/aerialclaw/blob/main/skills/registry.py"
click node_motor_skills "https://github.com/xdei-group/aerialclaw/blob/main/skills/motor_skills.py"
click node_perception_skills "https://github.com/xdei-group/aerialclaw/blob/main/skills/perception_skills.py"
click node_cognitive_skills "https://github.com/xdei-group/aerialclaw/blob/main/skills/cognitive_skills.py"
click node_skill_docs "https://github.com/xdei-group/aerialclaw/tree/main/skills/soft_docs"
click node_skill_loader "https://github.com/xdei-group/aerialclaw/blob/main/skills/skill_loader.py"
click node_perception "https://github.com/xdei-group/aerialclaw/blob/main/perception/passive_perception.py"
click node_vlm_analyzer "https://github.com/xdei-group/aerialclaw/blob/main/perception/vlm_analyzer.py"
click node_memory "https://github.com/xdei-group/aerialclaw/blob/main/memory/memory_manager.py"
click node_reflection_engine "https://github.com/xdei-group/aerialclaw/blob/main/memory/reflection_engine.py"
click node_skill_evolution "https://github.com/xdei-group/aerialclaw/blob/main/memory/skill_evolution.py"
click node_runtime "https://github.com/xdei-group/aerialclaw/blob/main/runtime/agent_runtime.py"
click node_adapter_manager "https://github.com/xdei-group/aerialclaw/blob/main/adapters/adapter_manager.py"
click node_sim_adapter "https://github.com/xdei-group/aerialclaw/blob/main/adapters/sim_adapter.py"
click node_mock_adapter "https://github.com/xdei-group/aerialclaw/blob/main/adapters/mock_adapter.py"
click node_px4_adapter "https://github.com/xdei-group/aerialclaw/blob/main/adapters/px4_adapter.py"
click node_airsim_adapter "https://github.com/xdei-group/aerialclaw/blob/main/adapters/airsim_adapter.py"
click node_mavsdk_adapter "https://github.com/xdei-group/aerialclaw/blob/main/adapters/mavsdk_adapter.py"
click node_ui_app "https://github.com/xdei-group/aerialclaw/blob/main/ui/src/App.jsx"
click node_ui_panels "https://github.com/xdei-group/aerialclaw/tree/main/ui/src/components"
click node_use_socket "https://github.com/xdei-group/aerialclaw/blob/main/ui/src/hooks/useSocket.js"
click node_robot_profile "https://github.com/xdei-group/aerialclaw/tree/main/robot_profile"
click node_sim_worlds "https://github.com/xdei-group/aerialclaw/blob/main/sim/worlds/urban_rescue.sdf"
click node_sim_models "https://github.com/xdei-group/aerialclaw/blob/main/sim/models/x500_lidar_2d_cam/model.sdf"
click node_sim_config "https://github.com/xdei-group/aerialclaw/blob/main/config/sim_config.yaml"

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_server,node_agent_loop,node_planner_agent,node_chat_mode,node_skills_core,node_motor_skills,node_perception_skills,node_cognitive_skills,node_skill_docs,node_skill_loader,node_perception,node_vlm_analyzer,node_memory,node_reflection_engine,node_skill_evolution,node_runtime toneBlue
class node_adapter_manager,node_sim_adapter,node_mock_adapter,node_px4_adapter,node_airsim_adapter,node_mavsdk_adapter toneAmber
class node_ui_app,node_ui_panels,node_use_socket toneMint
class node_robot_profile toneRose
class node_sim_worlds,node_sim_models,node_sim_config toneIndigo
```

## Components

### Python autonomy

Core service, cognition, perception, memory, skills, and runtime orchestration.

- [Server](https://github.com/xdei-group/aerialclaw/blob/main/server.py): api/ws entry · Main Python service exposing REST and WebSocket interfaces. · `server.py`
- [Agent loop](https://github.com/xdei-group/aerialclaw/blob/main/brain/agent_loop.py): closed-loop control · Runs the perceive-plan-act cycle for autonomous operation. · `brain/agent_loop.py`
- [Planner](https://github.com/xdei-group/aerialclaw/blob/main/brain/planner_agent.py): llm planning · Builds task plans using LLM context plus memory and perception. · `brain/planner_agent.py`
- [Chat mode](https://github.com/xdei-group/aerialclaw/blob/main/brain/chat_mode.py): operator dialogue · Supports conversational interaction outside fully autonomous tasks. · `brain/chat_mode.py`
- [Skills](https://github.com/xdei-group/aerialclaw/blob/main/skills/registry.py): action substrate · Skill registry and execution layer for atomic actions and strategies. · `skills/registry.py`
- [Motor skills](https://github.com/xdei-group/aerialclaw/blob/main/skills/motor_skills.py): hard skills · Flight and actuation-oriented skills such as takeoff, land, hover, and navigation. · `skills/motor_skills.py`
- [Perception skills](https://github.com/xdei-group/aerialclaw/blob/main/skills/perception_skills.py): hard skills · Skills that query sensors, fuse observations, and update situational context. · `skills/perception_skills.py`
- [Cognitive skills](https://github.com/xdei-group/aerialclaw/blob/main/skills/cognitive_skills.py): hard skills · Higher-level operator interaction, reporting, and reasoning utilities. · `skills/cognitive_skills.py`
- [Soft docs](https://github.com/xdei-group/aerialclaw/tree/main/skills/soft_docs): soft skills · Markdown strategy documents loaded and composed at runtime. · `skills/soft_docs`
- [Skill loader](https://github.com/xdei-group/aerialclaw/blob/main/skills/skill_loader.py): registry/loading · Loads, registers, and dynamically generates skills and documents. · `skills/skill_loader.py`
- [Perception](https://github.com/xdei-group/aerialclaw/blob/main/perception/passive_perception.py): sensor fusion · Passive and active sensing pipeline for situational understanding. · `perception/passive_perception.py`
- [VLM analyzer](https://github.com/xdei-group/aerialclaw/blob/main/perception/vlm_analyzer.py): on-demand vision · Uses external VLM/LLM services for visual analysis tasks. · `perception/vlm_analyzer.py`
- [Memory](https://github.com/xdei-group/aerialclaw/blob/main/memory/memory_manager.py): persistence · Manages episodic, skill, shared, vector, and world-model state. · `memory/memory_manager.py`
- [Reflection](https://github.com/xdei-group/aerialclaw/blob/main/memory/reflection_engine.py): learning · Post-task reflection and adaptation for future behavior. · `memory/reflection_engine.py`
- [Skill evolution](https://github.com/xdei-group/aerialclaw/blob/main/memory/skill_evolution.py): adaptation · Refines skills based on execution history and feedback. · `memory/skill_evolution.py`
- [Runtime](https://github.com/xdei-group/aerialclaw/blob/main/runtime/agent_runtime.py): orchestration · Execution wrapper that coordinates agent lifecycle and task execution. · `runtime/agent_runtime.py`

### Vehicle adapters

Hardware and simulator boundary layer for mock, PX4, MAVSDK, and AirSim.

- [Adapter manager](https://github.com/xdei-group/aerialclaw/blob/main/adapters/adapter_manager.py): backend selection · Chooses the concrete vehicle backend for a run. · `adapters/adapter_manager.py`
- [Sim adapter](https://github.com/xdei-group/aerialclaw/blob/main/adapters/sim_adapter.py): adapter interface · Common interface for vehicle control and telemetry across backends. · `adapters/sim_adapter.py`
- [Mock adapter](https://github.com/xdei-group/aerialclaw/blob/main/adapters/mock_adapter.py): backend · No-hardware backend for local or development runs. · `adapters/mock_adapter.py`
- [PX4 adapter](https://github.com/xdei-group/aerialclaw/blob/main/adapters/px4_adapter.py): backend · PX4 SITL backend for simulated flight control. · `adapters/px4_adapter.py`
- [AirSim adapter](https://github.com/xdei-group/aerialclaw/blob/main/adapters/airsim_adapter.py): backend · AirSim control backend for simulation and telemetry. · `adapters/airsim_adapter.py`
- [MAVSDK adapter](https://github.com/xdei-group/aerialclaw/blob/main/adapters/mavsdk_adapter.py): backend · MAVSDK-based control path for vehicle command execution. · `adapters/mavsdk_adapter.py`

### Operator UI

React frontend for monitoring, control, and supervision.

- [UI app](https://github.com/xdei-group/aerialclaw/blob/main/ui/src/App.jsx): react frontend · Operator console for telemetry, mode switching, logs, and maps. · `ui/src/App.jsx`
- [UI panels](https://github.com/xdei-group/aerialclaw/tree/main/ui/src/components): dashboard modules · Camera, sensor, robot, skill, map, and AI monitoring panels. · `ui/src/components`
- [Socket hook](https://github.com/xdei-group/aerialclaw/blob/main/ui/src/hooks/useSocket.js): realtime client · WebSocket client hook for live server updates. · `ui/src/hooks/useSocket.js`

### Persistent state

Markdown profiles and long-term memory artifacts used across runs.

- [Robot profile](https://github.com/xdei-group/aerialclaw/tree/main/robot_profile): identity docs · Persistent markdown documents for soul, body, memory, skills, and world map. · `robot_profile`

### Simulation assets

Gazebo worlds, models, and launch/config assets for simulated runs.

- [Sim worlds](https://github.com/xdei-group/aerialclaw/blob/main/sim/worlds/urban_rescue.sdf): simulation assets · Gazebo models and worlds used by the simulation backends. · `sim/worlds/urban_rescue.sdf`
- [Sim models](https://github.com/xdei-group/aerialclaw/blob/main/sim/models/x500_lidar_2d_cam/model.sdf): simulation assets · Vehicle and environment models for the simulated drone platform. · `sim/models/x500_lidar_2d_cam/model.sdf`
- [Sim config](https://github.com/xdei-group/aerialclaw/blob/main/config/sim_config.yaml): runtime config · Simulation and camera placement configuration assets. · `config/sim_config.yaml`

## Connections

- Server → Agent loop: starts · Server invokes the autonomous control loop.
- Server → UI app: serves · Backend exposes data and control endpoints consumed by the UI.
- UI app → Socket hook: connects · Frontend subscribes to live telemetry and status updates.
- Agent loop → Planner: plans · Loop asks the planner for next actions and task decomposition.
- Agent loop → Perception: reads · Closed loop consumes current situational state.
- Agent loop → Skills: executes · Loop dispatches planned actions into the skill layer.
- Planner → Memory: retrieves · Planner uses memory context and task history.
- Planner → Perception: contexts · Planning is conditioned on current perception state.
- Chat mode → Memory: references · Conversational mode can use stored context and identity state.
- Skills → Skill loader: loads · Skill registry resolves hard and soft skills at runtime.
- Skill loader → Soft docs: composes · Loader builds soft skills from markdown strategy documents.
- Skills → Motor skills: dispatches · Core skill execution can route to flight and actuation commands.
- Skills → Perception skills: dispatches · Skills can trigger sensing, observation, and map updates.
- Skills → Cognitive skills: dispatches · Core skill execution includes reporting and operator interaction.
- Motor skills → Adapter manager: commands · Motor skills rely on the selected vehicle backend.
- Perception skills → Perception: queries · Perception-oriented skills consume sensor fusion results.
- Perception → VLM analyzer: spawns · Active perception can request on-demand visual analysis.
- Perception → Memory: stores · Perception writes summaries and state into persistence.
- Reflection → Memory: updates · Reflection converts task outcomes into longer-term memory.
- Skill evolution → Memory: learns from · Skill refinement uses execution stats and history.
- Runtime → Agent loop: orchestrates · Runtime manages agent lifecycle and execution flow.
- Runtime → Adapter manager: binds · Runtime binds the current run to a backend implementation.
- Adapter manager → Sim adapter: abstracts · Manager selects through a common simulation/control interface.
- Adapter manager → Mock adapter: selects · Development or no-hardware backend.
- Adapter manager → PX4 adapter: selects · PX4 SITL backend.
- Adapter manager → AirSim adapter: selects · AirSim backend.
- Adapter manager → MAVSDK adapter: selects · MAVSDK-based backend.
- UI app → Server: controls · Operator UI sends commands, mode changes, and requests.
- UI panels → UI app: renders · Panels compose the main monitoring and control surface.
- Server → Memory: persists · Service records task history and system state.
- Memory → Robot profile: syncs · Long-term identity and state are mirrored into profile documents.
- Sim adapter → Sim worlds: runs on · Backends operate within Gazebo world assets.
- Sim adapter → Sim models: uses · Backends rely on drone and environment models.
- Sim adapter → Sim config: configures · Simulation behavior is governed by config assets.
- Perception → UI app: publishes · Telemetry and situational summaries are surfaced to the operator UI.
- Memory → UI app: feeds · UI can display logs, state, and skill evolution data.
