Skip to content

PATTERN Cited by 1 source

SCM workflow state machine

Definition

An SCM workflow state machine is a pattern where source-control operations (branch creation, PR preparation, CI validation, merge) are modeled as a finite set of states with blocking gates between them, each transition driven by a CLI command that validates preconditions before performing work. The state is persisted in a schema-validated file (e.g., .lakebase/workflow-state.json) that serves as the single source of truth for both human and agent actors.

The pattern ensures that agents and humans follow identical paths through the development lifecycle, with the substrate refusing transitions that violate declared invariants (wrong parent tier, CI not green, migration not applied).

Mechanics

  1. Define states as a linear sequence with explicit gates
  2. Each gate has documented preconditions and postconditions
  3. Transitions are CLI-driven — no ad-hoc API calls bypass the gate
  4. State is written to a schema-validated artifact after each transition
  5. Failed gates leave the machine at the prior state (recoverable, not corrupted)
  6. Structural decisions (tier hierarchy, promotion path) are declared once and honored by the substrate

Anti-pattern

Treating an agent as a "senior engineer in a chat window" — dumping context and asking for output. This breaks at team scale because the context cannot be reviewed, governed, or replayed. The state machine ensures every action is auditable and constrained.

Seen in

Last updated · 542 distilled / 1,571 read