imliubo fee405adf5 boards: add M5Stack CoreS3 board support
Add a complete board package for the M5Stack CoreS3 under
application/basic_demo/boards/m5stack_cores3/, so basic_demo can be
built and flashed on CoreS3 with:

  idf.py gen-bmgr-config -c ./boards -b m5stack_cores3
  idf.py build flash monitor

Highlights:

* board_info.yaml / board_peripherals.yaml / board_devices.yaml
  describe the CoreS3 hardware for esp_board_manager:
    - I2C0 (SDA=12, SCL=11) for AXP2101, AW9523B, AW88298, ES7210, FT5x06
    - I2S0 48 kHz stereo (MCLK=0, BCLK=34, WS=33, DOUT=13, DIN=14)
    - SPI2 (MOSI=37, MISO=35, SCLK=36) for the ILI9341 LCD
    - GPIO46 for AW88298 PA enable
    - ILI9341 SPI panel (320x240, BGR, big-endian, color inverted)
    - FT5x06 I2C touch
    - AW9523B GPIO expander with the output mask required by CoreS3
      (incl. pin 1 BUS_EN and pin 15 BOOST_EN for the Grove 5V rail)

* power_manager.[ch]: custom AXP2101 power manager that brings up
  SD / Speaker / LCD / Touch / Grove 5V in order, configures the
  AXP rails (ALDO1/2/3/4 and DLDO1 for the LCD backlight), and
  exposes cores3_power_manager_enable() for runtime control.

* setup_device.c: factory entries for the AW9523B expander, the
  ILI9341 LCD panel and the FT5x06 touch panel. The expander setup
  programs GCR=0x10 (P0 push-pull) and LEDMODE0/1=0xFF so every
  P0/P1 pin leaves the power-on LED constant-current mode and acts
  as a real GPIO; without this, set_level(high) only releases the
  current sink and cannot drive enables such as BUS_EN/BOOST_EN, so
  the Grove port stays at 0 V.

* components/esp_io_expander_aw9523b/: minimal AW9523B driver
  (16 IOs, push-pull / LED mode register definitions, raw register
  write helper) used by the board package.

* sdkconfig.defaults.board:
    - 16 MB QIO flash @ 80 MHz
    - 8 MB Quad PSRAM @ 80 MHz with XIP / instr / rodata in PSRAM
      disabled (octal-only on ESP32-S3)
    - CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM=n so claw tasks
      tagged CLAW_TASK_STACK_PREFER_PSRAM fall back to internal
      RAM, avoiding the cache-disabled stack-sanity assert that
      Quad PSRAM triggers during SPI flash transactions.

Signed-off-by: imliubo <imliubo@makingfun.xyz>
2026-04-22 12:16:05 +08:00
2026-04-20 18:46:27 +08:00
2026-04-20 21:41:15 +08:00
2026-04-20 21:41:15 +08:00
2026-04-20 17:50:29 +08:00
2026-04-03 14:42:55 +08:00
2026-04-20 19:13:11 +08:00
2026-04-20 19:13:11 +08:00

ESP-Claw: An AI Agent Framework for IoT Devices

English | 中文

LOGO

Home | Docs

ESP-Claw is a Chat Coding AI agent framework for IoT devices. It defines device behavior through conversation and completes the full loop of sensing, reasoning, decision-making, and execution locally on Espressif chips. Built on the OpenClaw concept, ESP-Claw adds the following features:

  • Chat Coding: Ordinary users can define device behavior through IM chat + dynamic Lua loading, without traditional programming
  • Event-driven: Any event can trigger the Agent Loop and other actions, not just user messages
  • Structured memory management: Organizes memories so they can accumulate and stay useful over time, with privacy kept local
  • MCP communication: Supports both standard MCP devices and traditional IoT hardware, with dual Server/Client identities
  • Ready out of the box: Fast configuration through Board Manager with one-click flashing
  • Modularized: Every module can be included or trimmed on demand

breadboard-photo

Why ESP-Claw: From Cloud-Centric to Edge AI

Traditional IoT stays at the connectivity layer: devices can connect, but cannot think; can execute, but cannot decide; can log, but cannot learn. ESP-Claw brings the Agent Runtime down from PC environments to Espressif chips, turning chips from passive executors into active decision centers.

  • Decentralized: from an instruction receiver to an edge-side decision maker
  • Standardized protocols: eliminate protocol silos through MCP
  • Localized data: build a physical barrier for privacy
  • Autonomous logic: move from hard-coded behavior to a dynamic canvas
Dimension Traditional IoT (Cloud-Centric) ESP-Claw (Edge AI)
Core scenario Device connectivity and remote control Physical-world sensing, decision-making, and control
Processing logic Preset static rules (If-This-Then-That) LLM dynamic decision-making + Lua deterministic rules
Execution engine Rule engine LLM + Lua + Router (three-tier event handling)
Control center Cloud server Edge node (ESP chip)
Device protocol MQTT / Matter / proprietary SDK MCP as a unified language + multi-protocol bridging
Inter-device communication Strong dependence on cloud relay Direct local links + MCP abstraction
Memory management Cloud data storage Local structured memory (JSONL + tags)
Interaction model App / control panel IM chat (Telegram / WeChat / Feishu)
Extensibility Closed ecosystem, high development barrier Plug-and-play MCP Tools
Intelligence Preset automation LLM + local rules for physical closed loops

Chat to Build: LLM Dynamic Decisions + Lua Deterministic Rules

With a single sentence sent through Feishu, WeChat, or Telegram, ESP-Claw can generate and run Lua scripts to drive peripherals like LED strips, screens, and cameras, or implement custom mini games and control algorithms. Once verified, generated logic can be persisted as local Lua rules, ensuring stable execution even when LLM services are unavailable or models change.

Try ideas like these:

  • Connect an LED strip and let it generate dynamic lighting effects or weather lights
  • Ask the Agent to generate a pixel-art mini game
  • Let your balancing robot iteratively improve its own algorithm so it runs faster and more steadily
  • Build a debugger that collects logs and controls devices for you

Millisecond-Level Response: Event-Driven and Proactive

Unlike OpenClaw, which primarily reacts to user messages, ESP-Claw uses an event-driven architecture: devices actively report events, and local event buses trigger processing logic.

Capabilities can both emit events and execute actions. For example:

  • IM can deliver user commands, call the Agent, and notify users with results
  • MCP can receive sensor data, call the Agent for analysis, and then call MCP again to control actuators
  • Lua scripts can call the Agent for analysis and store results locally

For high real-time requirements, local rules execute directly for millisecond-level response and can run independently even offline. If no local rule matches, the Agent automatically calls an LLM. For tasks beyond local compute (such as image recognition), it automatically uploads to the cloud and returns results, achieving cloud-edge collaboration.

event router

Local Memory System: Learns More About You Over Time

Traditional AI agents usually keep memory only inside the conversation window, which means context is easily lost once the session ends. ESP-Claw implements a complete structured long-term memory system directly on the device:

Five memory types: user profile (profile), user preference (preference), factual knowledge (fact), device event (event), and behavior rule (rule)

Lightweight retrieval: instead of relying on a vector database, ESP-Claw uses a summary tag mechanism. Each memory entry carries 1 to 3 keyword tags. At request time, the system injects the tag pool so the LLM can selectively recall full memory content, enabling efficient retrieval under MCU resource constraints.

Automatic evolution: memories keep accumulating through three paths: dialogue extraction, event archiving, and behavior rule consolidation. More importantly, the LLM can discover patterns from those memories and proactively suggest automations.

It also supports editable and persistent Agent core roles (such as soul and identity), giving devices customizable personality and behavior style.

MCP as a Unified Protocol: Make Devices AI-Native Objects

ESP-Claw devices have dual identities as both MCP Server and MCP Client:

  • As an MCP Server: hardware capabilities such as sensor reads and actuator control are packaged as standard MCP Tools that any MCP-compatible Agent (such as OpenClaw, Claude, or Codex) can call directly
  • As an MCP Client: actively call any service exposed by MCP Servers on the network, including other IoT devices, PC-side services, and cloud software capabilities (such as querying Gaode Maps traffic or sending Feishu reminders)

AI-native semantic interface: tool naming follows a verb-noun pattern such as turn_on and get_temperature, while return values include units and freshness metadata. This lets AI understand and invoke tools without external documentation.

Rich Peripheral Access: Built for Information Processing

ESP-Claw supports cameras, microphones, and many other sensors. Most drivers can be obtained through the ESP-IDF Component Registry. Built-in Lua modules include:

  • Display and interaction: lua_module_display, lua_module_lcd_touch, lua_module_button
  • Multimedia: lua_module_camera, lua_module_audio
  • Actuators: lua_module_led_strip, lua_module_gpio, lua_module_mcpwm
  • System tools: lua_module_storage, lua_module_delay, lua_module_event_publisher

How to Deploy and Use

Online Flashing

Configuration and firmware retrieval can be completed directly in the browser. No extra firmware compilation or software installation is required before flashing and use. Try Online Flashing

Build from Source

basic_demo provides a foundational example. For detailed build and flashing instructions, please refer to the docs

Code Architecture

The project follows an "application example + reusable components" structure. application/basic_demo is a ready-to-build ESP-IDF sample project. components contains reusable runtime cores, capability plugins, and hardware/script extension modules.

The current codebase is divided into four layers:

  • Application assembly layer: application/basic_demo/main, responsible for startup entry, network connection, parameter configuration, HTTP config pages, and demo-level module registration
  • Capability layer: components/claw_capabilities, including IM communication, MCP Client/Server, Lua runtime, scheduling, files, time, web search, and more
  • Runtime core layer: components/claw_modules, including core context, capability registration, event routing, memory management, and skill management
  • Device and script extension layer: components/lua_modules, exposing displays, cameras, audio, buttons, GPIO, storage, and other peripherals to Lua and upper-layer Agents
esp-claw/
├── application/
│   └── basic_demo/
│       ├── main/
│       │   ├── main.c                    # Firmware entry
│       │   ├── app_claw.c                # App bootstrap and assembly
│       │   ├── basic_demo_wifi.*         # Wi-Fi connection and network setup
│       │   ├── basic_demo_settings.*     # Local settings persistence
│       │   ├── config_http_server.*      # Web configuration service
│       │   ├── basic_demo_lua_modules.*  # Lua module registration
│       │   └── web/                      # Frontend assets for device config
│       └── README.md
├── components/
│   ├── claw_modules/
│   │   ├── claw_core/          # Core runtime context
│   │   ├── claw_cap/           # Capability abstraction and registration
│   │   ├── claw_event_router/  # Deterministic event routing
│   │   ├── claw_memory/        # Structured memory management
│   │   └── claw_skill/         # Skill metadata and loading
│   ├── claw_capabilities/
│   │   ├── cap_im_feishu / cap_im_qq / cap_im_tg / cap_im_wechat
│   │   ├── cap_mcp_client / cap_mcp_server
│   │   ├── cap_lua / cap_skill_mgr / cap_scheduler / cap_router_mgr
│   │   ├── cap_files / cap_time / cap_web_search / cap_cli
│   │   └── ...
│   └── lua_modules/
│       ├── lua_module_display / lua_module_camera / lua_module_audio
│       ├── lua_module_button / lua_module_gpio / lua_module_led_strip
│       ├── lua_module_storage / lua_module_delay / lua_module_event_publisher
│       └── esp_painter
├── docs/
├── README.md
└── README_CN.md

Notes

  • The project is still under active development. If you run into issues, feel free to open an issue at any time.
  • Features such as self-programming depend on strong reasoning models. GPT-5.4, Qwen3.5-plus, or a model with similar capability is recommended for the best experience.

Follow Us

If this project inspires or helps you, please consider giving it a star.

Acknowledgements

ESP-Claw is inspired by OpenClaw.

Its implementation of Agent Loop and IM communication on ESP32 was also informed by MimiClaw.

S
Description
No description provided
Readme Apache-2.0
16 MiB
Languages
C 84.8%
JavaScript 4%
Lua 3.4%
Python 2.8%
HTML 2%
Other 3%