One event through ESP-Claw

    architecture node:

    Representation at this boundary

    Source modules

      Event map

      One event — IM gateways (Telegram, QQ, Feishu, WeChat, local web), the scheduler, Lua scripts, boot triggers, and the agent itself all publish claw_event_t into one FreeRTOS queue. The router task evaluates router_rules.json in file order and picks one of six actions: call_cap, run_agent, run_script, send_message, emit_event, drop. run_script and call_cap answer in milliseconds with no LLM in the path — that is the source of the "response can be as fast as milliseconds" claim — while run_agent is the only action that wakes the cloud loop.
      The on-demand agent task — there is no persistent turn loop: the agent is a separate FreeRTOS task blocked on its own request queue (portMAX_DELAY, claw_core_agent_loop.c:121) that only runs when run_agent submits. One submission runs prompt assembly → one blocking HTTPS LLM call → tool calls against claw_cap, bounded by max_tool_iterations → finalize → an out_message event back onto the same bus. There is no human approval gate anywhere in this path; tool eligibility is the visibility gate chain in claw_cap_authorize_llm_tool_locked (claw_cap.c:605). A new user message mid-run ("Stop") is drained as a user interrupt at four timing points inside the in-flight iteration.
      Sleep and idle — when both queues are empty the router task parks on xQueueReceive(..., 250ms) and the agent task parks on portMAX_DELAY: the device idles on milliwatts until the next event. The scheduler keeps firing timed triggers and Lua-local button/knob callbacks keep actuating hardware without ever touching the cloud — the LLM loop is strictly pay-per-event.