Mode chooser
The ten LEX AI modes side by side, what each one is for, which of them touch git, and how to switch between them.
Mode chooser
LEX AI is organized into ten modes. The unified lex-mcp server loads them all at boot and mounts exactly one at a time. Choosing a mode is the single most important decision of a session — it selects the workflow, the guardrails, the tool surface, and whether git and GitHub are touched at all.
The ten modes at a glance
Mode | Key | Job | Git/GitHub | Shape |
|---|---|---|---|---|
Brief |
| Interview you and write the project contract | None | 7 topics, one question at a time |
Forward |
| New app, planning → code → wiki | Commits, pushes, PRs | 20-step loop (0–19) |
Backward |
| Document existing code | None (may clone) | 18 steps, one pause |
Edit |
| One focused change | None (may clone) | Flat task catalog |
Review |
| On-demand audit | None (may clone) | Flat, idempotent |
Test |
| Write the suite, then prove it catches regressions | None (may clone) | 10 responsibilities |
Input |
| Adapt the app to a changed input-data format | None (may clone) | 7 change areas |
Deploy |
| Get a built app running in a target environment | None, deliberately | Sequential, remote-served |
MVP Generator |
| Small capped first version | Local commits only | 6 checkpoints |
MVP Completion |
| Expand an MVP to full product | Commits, pushes, PRs | Steps 9–19 |
How they differ
- Forward-style modes (Forward, MVP Completion) own delivery: they create branches, commit after every step, push, and open and squash-merge a pull request at the end. They are the only two modes that reach GitHub.
- Flat modes (Edit, Review, Test, Input) have no step numbering and no fixed order — they run a selected set of tasks, responsibilities or change areas and write a consolidated report. Review, Test and Input leave the files in your working tree for you to commit; Edit commits its own work on a branch of its own and ends at a pull request.
- Backward is a read-and-write documentation pipeline with a single mandatory pause for a discovery questionnaire.
- Brief produces no code. It asks, writes
.lex/contract.md, and hands off. - Deploy configures and runs; it never writes application code, and it stays git-free on purpose, because a deployment run touches
.envfiles and an auto-commit is how a populated one reaches a remote. - MVP Generator is deliberately capped and uses local git only — no remotes, no pushes.
Choosing correctly
Start from intent (see Choose the right path):
- Requirements still live in your head → Brief.
- New product from scratch → Forward.
- Small first cut, fast → MVP Generator.
- Grow an MVP into the real thing → MVP Completion.
- Change or extend an existing app → Edit.
- Audit an existing app, changing nothing → Review.
- Produce docs from existing code → Backward.
- Write or repair the test suite → Test.
- The input files changed shape → Input.
- Get a finished app running somewhere → Deploy.
Brief is the recommended entry point for anything ambitious. It maps ten build scenarios onto the other nine modes, and finalize_brief names both the target mode and the first tool to call — so the choice above is made from recorded answers rather than from a guess.
What the mode does not change
Four tools sit on every surface: read_input_file and render_pdf_pages read a customer spreadsheet or PDF server-side, and ask_user_question / record_user_answer put one question to you and record who actually authored the answer. You never switch mode to read a file or to ask something. See Tool surfaces.
Dashboards: Streamlit or Reflex
A Lex project can write its dashboards in Streamlit or in Reflex, and every mode that meets a dashboard handles both. A new project chooses the framework before it writes anything. A targeted change offers a Reflex task where the project already uses Reflex. A documentation run detects a Reflex dashboard and writes it into the wiki. A deployment run treats the lex reflex process as part of what has to be started.
Streamlit remains the default, for three reasons that are facts rather than preference:
- Only a Streamlit dashboard opens from the record page's Analytics tab and the grid's dashboard toggle. A Reflex dashboard is reached by its URL, typically a link on the project's own dashboard.
lex_viewandlex_widgets— Lex App's pages and controls inside a dashboard — are Streamlit components. A Reflex dashboard links to Lex App's pages or calls the API as the user instead.- Reflex sign-in runs through Reflex Enterprise, which is free in development but needs a paid Reflex tier to run in production mode.
LEX AI follows what the project already uses, and never moves a dashboard from one framework to the other unless you ask it to — existing Streamlit dashboards are unaffected. Running a Reflex dashboard uses lex reflex, which ships in the LEX App package rather than in LEX AI.
Switching between modes
Any mode exposes a universal switch_to_mode(target_mode=...). Switching flips the visible tool surface in place and fires a tool-list refresh. Some modes also ship legacy pairwise switches — Forward and MVP Completion carry switch_to_backward_mode, Backward and Review carry switch_to_forward_mode. Prefer switch_to_mode in new work, and switch only when your intent genuinely changes, never to work around a failing tool. See Mode switching in the System section for the full contract.
Was this helpful?
Your feedback shapes what we write next.
