Model UI components as finite state machines before writing code. Compatible with Claude Code, Cursor, Windsurf, and OpenCode.
// 3 booleans = 8 possible states, 5 invalid
const [isLoading, setLoading] = useState(false);
const [isError, setError] = useState(false);
const [data, setData] = useState(null);
if (isLoading && isError) {
// ❌ Impossible: both loading and error
}
if (isLoading && data) {
// ❌ Impossible: loading with data
}
if (!isLoading && !isError && !data) {
// Idle — but is it really?
}
// 4 states, all valid
type State = 'Idle' | 'Loading' | 'Success' | 'Error';
const [state, setState] = useState<State>('Idle');
// Impossible states structurally eliminated
switch (state) {
case 'Idle': return <Empty />;
case 'Loading': return <Spinner />;
case 'Success': return <Content />;
case 'Error': return <ErrorView />;
}
From natural language to a formal FSM: named states, guarded transitions, actions, and invariants. 38 validation gates catch every mistake before code is written.
Auto-prompted after every model. The agent scans your project folders, confirms the target directory with you, and generates code + tests wired to createLightMachine.
Reverse-engineer existing code into a model, detect boolean explosions, identify unhandled transitions, and produce a severity-ranked punch list.