Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

States and transitions

State types

TypeBehavior
passiveWaits for an external transition label (e.g. approval)
activeRuns the referenced node when entered
finalTerminal state; ends the run

Active states

Must declare node: <node_id> matching a key in nodes:.

lint:
  type: active
  node: moon_lint
  on:
    success: doctor
    failure: fix_lint
    partial: fix_lint

Transitions (on:)

Each key is an outcome label from the node’s outcome rules. Each value is the next state name.

Common labels:

  • success — primary happy path
  • failure — hard failure
  • partial — incomplete but recoverable (often routes to a fix state)
  • retry — explicit retry loop (classified as failure internally, but used as transition key)

Initial and final states

  • program.initial must name an existing state.
  • At least one type: final state is required.
  • At least one final state must be reachable from initial (validated at load time).

Passive states

Used for approval gates or manual triggers. The engine transitions when a label is supplied (e.g. auto-approve in tests).

Try it: Draw your state graph with definitively visualize program.yml.