# Request lifecycle

> Follow a GUIJam request from your drawing to a committed source edit. Routing, exact edits, AI variants, live previews, commit and undo.

Here's what happens between circling a button and keeping the variant you like.

## You draw and describe

The widget finds the element you circled. It picks the largest source-mapped element your loop mostly encloses, or the smallest one that covers your stroke. A tap picks the element under it. It reads that element's source location and sends your prompt, with any images or links, to the dev server.

## The plugin forwards it

The dev server plugin accepts only the widget's own request types and forwards them to the `gjd` daemon over its token-protected WebSocket.

## gjd routes it

The daemon reads the element's source and picks a route:

| Route        | When                                                            | What runs                                                                                        |
| ------------ | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| **Exact**    | Every word is a color or radius change, and it isn't a question | No model. GUIJam makes the edit itself.                                                          |
| **Fast**     | A short style, motion or color request, or a question           | Your CLI's fast model at low effort, with 40 lines of context, no tools, 60 s                    |
| **Standard** | Everything else, or any request with a sketch, images or links  | Your CLI's standard model at medium effort, with 120 lines of context and read-only tools, 180 s |

Requests with 3 or more images or any link get 300 s. Effort applies to Claude Code and Codex, and you can [set your own](https://guijam.francistinao.com/docs/ai-tools#choose-an-effort).

## Your CLI answers

GUIJam runs your CLI three times at once, asking each run for one variant with its own direction: exactly what you asked, a distinctly different take, or the simplest version that works. Each variant has a one-word style such as Solid, Soft or Outline. A question runs once and gets an answer instead.

Each variant is a list of structured edits: replace a snippet, change class tokens, set a style property, set a JSX attribute or create a file. At most six runs go at once across all drawings. The rest wait for a free slot.

## gjd checks the edits

The daemon validates each variant's edits against the current file as soon as that variant arrives. If you saved the file meanwhile, it re-applies the variant to your new content, or reports that it no longer fits.

## The page previews it

The daemon hands the first variant that arrives to the plugin, which compile-checks it and serves it from memory through hot reload. Later variants join the panel as they finish. The widget reports whether the update applied cleanly. Switching variants swaps the preview. Your files on disk are untouched.

## You keep it

**Use** sends the commit through the daemon's write lock. It journals the exact previous bytes, writes the files, then clears the preview, so nothing flickers. A conflict with your own edits is refused.

## Or you undo it

For 10 seconds, **Undo** restores the exact previous bytes and removes any new files the variant created.
