This page traces one user query through MeghaOS, from the shell to a rendered widget.

1. The shell sends the query

The shell POSTs to /chat with a JSON body containing your message.

2. Memory context is fetched

Before doing anything else, the agent pulls relevant long-term memory. Facts extracted from past conversations are injected into the LLM prompt so responses stay personalized. See Memory.

3. Fast-path command handling

Some queries never touch the LLM. The handler short-circuits common commands into prebuilt components:

4. Intent routing

Next, the handler checks for computer-control intent (phrases like “use cursor to build…”, “claude code…”, or “open VS Code and…”). These route into an agentic control loop (via the computer_control capability) before the generic “create” keyword catch, so they aren’t mistaken for UI-composition requests. Other intents (research, comparison, timeline, quiz, etc.) are detected by an intent check that passes a widget hint into compose_ui.

5. UI composition (the LLM call)

For general queries, compose_ui(user_query, session_id) makes a single LLM call. The LLM is given the A2UI (agent-to-user interface) schema and returns JSON describing the interface. The call goes to the model selected in Settings → Configuration: with Megha 0.6B it stays on your machine; with a hosted model, the request and the memory facts in its prompt go to that model. If a widget needs custom computation, the model embeds a __jit__ key holding a short program, which the agent checks and then runs on your machine (not in a sandbox). See JIT Rendering.

6. The response

The endpoint returns:
For multi-step actions, the orchestrator instead returns a task_tracker component summarizing each step’s status. See Workflows.

7. The shell renders it

The renderer walks the JSON tree and instantiates widgets. A layout validator runs first to clamp depth, child counts, and total component count so a malformed tree can’t crash the renderer.

Real-time updates

Stateful and streaming widgets keep updating after the initial render. The agent pushes events to the desktop over a local Unix socket, and the desktop’s event client applies them. For example, JIT stream ticks patch the live UI without another /chat round trip.