One message through MimiClaw

    architecture node:

    Representation at this boundary

    Source modules

      Message map

      One message shape — Telegram polls, Feishu events, WebSocket frames, cron firings, and heartbeat ticks all become the same mimi_msg_t (channel, chat_id, heap text) in one inbound FreeRTOS queue of depth 16 (message_bus.c). There is no router and no rule engine: the queue's only consumer is the agent loop, and every message — user chat or the device's own scheduled prompt — runs the full cloud ReAct loop. A full queue drops messages after a 1-second push timeout; nothing is persisted.
      The single-consumer loop — one FreeRTOS task on Core 1 (agent_loop.c) pops a message, rebuilds the prompt from SPIFFS files, loads the last 20 session messages, and iterates llm_chat_tools() → tool execution against the 12-tool registry → repeat, bounded by MIMI_AGENT_MAX_TOOL_ITER = 10 and at most 4 tool calls per response. There is no human approval gate and no mid-turn interrupt: a new message waits in the queue until the current turn finishes. Only the user text and the final answer are saved to the session file.
      Idle and offline — with the queue empty the agent task parks on pop_inbound(UINT32_MAX) and the Telegram task sits in its 30-second long poll: always-on, no sleep modes anywhere in the firmware. The cron task wakes every 60 s and the heartbeat timer every 30 min, each feeding the same queue. If Wi-Fi is down, channels and the model are unreachable and turns fail with a generic error reply — only the serial CLI keeps working locally.