# Linear Statechart Notation: State machine modeling for the AI era

> Source: <https://www.state-machine.com/ai-statechart/>
> Published: 2026-12-03 09:57:49+00:00

**Key takeaway:** Statechart models stored as geometry-free XML let an AI read and write them as text while the drawing is regenerated from that text, with drawing and XML edits sharing one Undo/Redo stack.

AI Statechart: Linear Statechart Notation (interactive demo)

Linear Statechart Notation: State machine modeling for the AI era

Conventional statechart diagrams tie the behavior to geometry: every box position and arrow route is stored with the model. For an AI that reads and writes models as text, that geometry is noise; for people, it is the essence. The Linear Statechart Notation keeps the drawing and removes the free geometry.

Pick a model from the drop-down box (the toaster oven, the PELICAN crossing, or a test model with every kind of transition), or open your own .qmodel file.

Hover over the drawing: each state or transition lights up, together with its lines in the XML, so you can see exactly which text produces which part of the drawing.

Click an element in the drawing or in the XML, and the other view follows; a selected transition lights the states it exits and the state it enters. Then move it (Up/Down), delete it, or edit the XML: the drawing redraws instantly, and Undo takes back any step.

Open the Quick guide for folding, outline levels, keyboard shortcuts, and all the ways to edit in the drawing.

On a phone the demo is read-only; open this page in a desktop browser to edit models.

Read the drawing

Each state is a row with a red rail; substates are indented under it, with a vertical nesting guide.

Under each state: entry/exit, initial transition (filled ball), history (H or H*) and one row per trigger.

Each transition runs in a vertical lane and ends with an arrowhead on its target's rail. A dot is a junction; a square end means an internal transition. Diamonds are choices.

Explore

Click a row to select it: a state lights its transitions; a transition lights the states it exits and the state it enters.

Click a triangle or diamond to fold. Level buttons (keys 1...9, 0 = all) show the machine down to that depth.

Up/Down move between rows. Actions shows the action code (or its brief: a leading // comment).

Edit in the drawing

Up/Down buttons (Alt+Up/Alt+Down): move a state among its siblings, a transition within its state, a choice segment among its siblings.

Delete (Del): delete a state with its substates (transitions into it become internal), a transition, a choice segment, an entry/exit action or a history.

F2 rename a state or trigger, or edit a guard. t new transition. Tab/Shift+Tab move a state under its previous sibling / out of its superstate.

Drag an arrowhead onto another state's rail to retarget it; drop it elsewhere (or i) to make it internal. Drag a square end onto a rail to attach it.

c adds a choice segment to a square end (a guard, or else).

Shift+H cycles a state's history (none, shallow, deep); drop an arrowhead on an H row, or press h, to enter through history.

Edit the text

Show XML displays the model file: the only copy of the model. Select in either view; the other follows.

Type in the XML: the drawing follows every edit. Changed lines flash; problems are listed below the drawing.

Every edit, in the drawing or in the text, is one step of a single Undo/Redo stack (Ctrl+Z/Ctrl+Y).

Open your own .qmodel file from the model list, and Download the edited one.

More

The paper specifies the notation and the QModel file format.
