LEX AI Execution Model
How the coordinator-agent loop runs, the universal rules every mode follows, the loop shape per mode, and where the server enforces its gates.
LEX AI Execution Model
This article summarizes how LEX AI workflows run, and why the reliability comes from the server rather than from the wording of a prompt.
Coordinator and worker model
- The IDE assistant acts as coordinator. It is a flow controller, not the author of the work.
- The coordinator asks an MCP tool for the next brief, which arrives with the name of the agent that should carry it out.
- The named step, task, or responsibility agent performs the implementation or analysis work.
- The coordinator reports completion back to the server, which decides what comes next.
Keeping the two layers apart is what keeps the coordinator's context small and each unit of work self-contained and repeatable.
Universal rules
- Start in the mode that matches the intent. Only one mode's tools are visible at a time.
- Begin every run with that mode's kickstart tool; every other tool assumes a session already exists.
- If any call returns
ok: false, stop. Make no further tool calls, run no git or shell commands, present the troubleshooting payload, wait for the user, then re-call the same tool. - Do not switch mode to get around an error. A switch changes the tool surface, not the underlying cause.
Loop shapes by mode
Mode | Shape |
|---|---|
| Exactly one outstanding question at a time until the contract is complete. |
|
|
| An 18-step pipeline with one questionnaire pause for the user. |
| Flat catalogues: get a brief, delegate, notify completion, in no fixed order. |
| Sequential steps whose bodies are served by the remote Lex deployment handbook. |
| Six checkpoints gated by a boot checklist. |
Forward workflow phases
- Planning (steps 0-8): requirements and design artifacts.
- Implementation (steps 9-11): plan, blueprint, code delivery.
- Hardening (steps 12-14): initial data, dashboard integration, compliance pass.
- Wiki (steps 15-18): technical map scaffold and enrichment.
- Sync (step 19): docs and code reconciliation.
Where the gates sit
The server, not the model, decides when a run may end. Forward-style workflows finish with a two-stage finalize: the bare call returns audit instructions and per-step summaries, and the second call refuses to proceed until plans/technical_docs/audit-report.md exists on disk. MVP generation refuses to finalize while a critical boot check fails. Test mode refuses a clean report while a mandatory responsibility is unfinished, and records an explicitly incomplete one instead. A gate that can be talked around is not a gate.
See During a run and Troubleshooting.
Was this helpful?
Your feedback shapes what we write next.
