Check every order of steps your design allows.

Keep a TLA+ specification of a state machine or protocol in your flow. The TLC model checker tries every order of steps the specification allows and returns the shortest one that breaks a rule. Events recorded from a real run can be checked against the same design.

Optional plugin. reflow init --upgrade TLA adds it to an application and downloads it once for your platform. It brings its own Java runtime, so there is nothing else to install.

reflow / TLA · plugin lockRecorded plugin output
Two recorded flowsLine 6 · selected step
  1. # Second flow, one step: two CLI releases take turns
  2. shell.bash command="bash \"$REFLOW_FLOW_FILES/record-upgrades.sh\"" timeout=20m

Exact RFL from two flows: the first is meant to fail; the second records two CLI releases and checks the recording twice. Comment lines are presentation. Select a checkpoint line to inspect its output; preceding lines provide context.

Output · selected step
PluginLock.tlaflow file · excerpt
Upgrade(c) ==
  /\ OffersUpgrade(c)
  /\ lock' = Bundle(c)
  /\ last' = c.id
  /\ UNCHANGED catalog

Next == \E c \in Team : Upgrade(c)
...
Quiet == \A c \in Team : ~OffersUpgrade(c)
Stabilises == <>[]Quiet
...
TeamOldRule == {Main("A", 1, "old"), Main("B", 2, "old")}
PluginLock.old-rule.cfgflow file
SPECIFICATION Spec
CONSTANTS
  CatalogChoices <- JustLinear
  Team <- TeamOldRule
INVARIANTS TypeOK AdviceCanBeFollowed
PROPERTIES Stabilises
CHECK_DEADLOCK FALSE
A’s CLI is built from catalog row 1 and bundles Browser build 1; B’s is built from row 2 and bundles build 2. Under the old rule a CLI offers the upgrade whenever a locked build differs from its own. Stabilises says that, in the end, nobody is offered an upgrade again.
Old rule settlesstep 1 · failed
Plugin TLA.check failed: temporal property Stabilises is violated: counterexample of 3 steps, then back to step 2, for ever (PluginLock.tla with PluginLock.old-rule.cfg)
Counterexample: 3 steps, then back to step 2, for ever
  1. Step 1 Initial state
    Browser
    1
    Mailbox
    1
  2. Step 2 Upgrade · B
    Browser
    1 → 2
    Mailbox
    1
  3. Step 3 Upgrade · A
    Browser
    2 → 1
    Mailbox
    1
then back to step 2, for ever
B’s CLI moves Browser to build 2, A’s moves it back, and B is offered the upgrade again. The lock never settles.
States
18 generated, 8 distinct, depth 2
Run
0.4 s, TLC 1.8.0 (2026.11.15.002146) on Java jdk-21.0.13+9, 1 worker, 1024 MB heap
counterexample.txt · kept with the step
temporal property Stabilises is violated (PluginLock.tla with PluginLock.old-rule.cfg)

1. Initial state
     catalog = [{"Browser":1,"Mailbox":1},{"Browser":2,"Mailbox":1},{"Browser":2,"Mailbox":2},{"Browser":3,"Mailbox":2}]
     lock = {"Browser":1,"Mailbox":1}
     last = "nobody"
2. Upgrade {"c":{"id":"B","at":2,"rule":"old","own":{"Browser":0,"Mailbox":0}}}
     lock.Browser: 1 → 2
     last: "nobody" → "B"
3. Upgrade {"c":{"id":"A","at":1,"rule":"old","own":{"Browser":0,"Mailbox":0}}}
     lock.Browser: 2 → 1
     last: "B" → "A"

then back to step 2, for ever
Two releases move the lock back and forth, as the old rule saysone step · passed
shell.bash · stdout, excerpt
Upgraded: Browser 5e18e95 -> 4b3ccd8, Mailbox d10395d -> 4118194
Upgraded: Browser 4b3ccd8 -> 5e18e95, Mailbox 4118194 -> d10395d
upgrades.ndjson · the lock after each command
  1. Line 1 start
    Browser
    1
    Mailbox
    1
    matched
  2. Line 2 UpgradeBy R2
    Browser
    1 → 2
    Mailbox
    1 → 2
    matched
  3. Line 3 UpgradeBy R1
    Browser
    2 → 1
    Mailbox
    2 → 1
    matched
  4. Line 4 UpgradeBy R2
    Browser
    1 → 2
    Mailbox
    1 → 2
    matched
Accepted. The 4 lines of the trace, in order, are a behaviour of the spec.
Old-rule configuration · matched 4 of 4 lines. R1 and R2 are the two CLI releases; builds are numbered by first appearance: Browser 5e18e95 is 1, 4b3ccd8 is 2; Mailbox d10395d is 1, 4118194 is 2.
tla.trace · new ruleexpectRejection=3 · succeeded
Rejected at line 3, as this step expects. The 2 lines before it are a behaviour of the spec; no step of the spec leads from there to line 3.
Under the new rule a CLI uses the catalog history it carries to tell an older build from a newer one, and offers no upgrade while the lock holds a newer build.
Design · the counterexample under the old rule
  1. Step 1 Initial state
    Browser
    1
    Mailbox
    1
  2. Step 2 Upgrade · B
    Browser
    1 → 2
    Mailbox
    1
  3. Step 3 Upgrade · A
    Browser
    2 → 1
    Mailbox
    1
then back to step 2, for ever
Run · the lock two releases recorded
  1. Line 1 start
    Browser
    1
    Mailbox
    1
    matched
  2. Line 2 UpgradeBy R2
    Browser
    1 → 2
    Mailbox
    1 → 2
    matched
  3. Line 3 UpgradeBy R1
    Browser
    2 → 1
    Mailbox
    2 → 1
    rejected
  4. Line 4 UpgradeBy R2
    Browser
    1 → 2
    Mailbox
    1 → 2
    not reached
Line 3
{"state":{"lock":{"Browser":1,"Mailbox":1},"last":"R1"},"event":"UpgradeBy","args":["R1"],"note":"Browser 5e18e955, Mailbox d10395d6"}
Its event
UpgradeBy("R1"), not enabled after the lines before it
It records
last: "R2" → "R1"; lock.Browser: 2 → 1; lock.Mailbox: 2 → 1
Review pointAt line 3 the older release takes the lock back to its own builds, as A does in step 3 of the counterexample. The new rule never offers that upgrade.
Recorded TLA plugin output from two flows of the plugin-lock example: one meant to fail, and one step in which LocalBash ran two CLI releases against a scratch application. Values are copied from the run pages; the specification is an excerpt and the layout is illustrative.

A journey test runs one order.
TLC tries them all.

Use TLA for the orders a journey test cannot stage: two teammates on different releases, a retry that crosses a crash, a message that arrives late.

  1. The design travels in the flow.

    The specification and its configurations are blocks of the flow, named in the step. TLC gets them from the flow, never from a checkout, so a flow saved in Reflow runs the same check on any device, and the step reruns exactly when the flow changes.

  2. Every order, within bounds.

    TLC explores every state the model reaches within the bounds its configuration sets. When an invariant or property breaks, the step fails, names what broke and keeps the shortest counterexample.

  3. Then check what really ran.

    A journey can write one line for each step the program takes. tla.trace checks those lines against the same specification and names the first line no behaviour of the design reaches.

Read the failure step by step.

A violated step keeps the counterexample: each step, the action that led to it and what changed. A property that must hold for ever, such as “the lock settles”, ends by naming the step it returns to.

In the example, each teammate’s CLI offers an upgrade whenever a locked build differs from the one it bundles. TLC finds the loop in a model of 8 distinct states; staging it as a journey would take two people on two releases.

  • The counterexample as text, and every state in full as JSON
  • Everything TLC printed
  • The exact specification and configuration bytes TLC checked
Read a counterexample

Hold the design to the code.

A specification is someone’s reading of the code, and it keeps passing when the code changes. tla.trace checks events recorded from a real run against it: line 1 must be an initial state, and every later line a step of the specification. A rejected recording names the first line no behaviour reaches.

In the example, one step runs two CLI releases in turn against a scratch application and records the lock after each upgrade. Under the old rule all four lines are a behaviour of the specification, so the model describes what those releases do. Under the new rule, where a CLI uses the catalog history it carries to tell an older build from a newer one, the same recording is rejected at line 3, where the older release moves the lock back.

expectViolation and expectRejection keep a known fault on record: the step passes only while TLC still finds it.

Check recorded events

A design check, carried in the flow.

When a change is a state machine, a protocol, retries or ownership, your agent can write the specification beside a journey flow of the same behaviour, and check that journey’s recorded events with tla.trace.

Install once.

reflow init --upgrade TLA \
  --collection <collection-id>

TLA is not in the CLI download. This command adds it to an application and downloads it once for your platform, 54 to 59 MB, checked against the release manifest. It carries TLC 1.8.0, built from the TLA+ source, and its own Java runtime, so there is nothing else to install. Teammates and CI install it with plain reflow init, because the application’s lock names it.

What it does not check.

  • What a user sees. TLA says nothing about screens, and it replaces no journey test.
  • Large ranges of values. TLC checks the model its configuration bounds, and time and memory grow steeply with constants. A pass says nothing about larger ones.
  • A specification nobody keeps. It is someone’s reading of the code and keeps passing when the code changes, unless a recorded run is checked against it.
Flow excerptTLA
---
providers:
  tla: TLA
  shell: LocalBash
---

```rfl step="Old rule flips back for ever"
tla.check spec="PluginLock.tla" config="PluginLock.old-rule.cfg" expectViolation="Stabilises"
```

```rfl step="Upgrades follow the plugin-lock design"
shell.bash command="./record-upgrades.sh > \"$REFLOW_STEP_FILES/upgrade.ndjson\""
tla.trace spec="PluginLock.tla" config="PluginLock.trace.cfg" trace="step:upgrade.ndjson"
```

```tla file="PluginLock.tla"
---- MODULE PluginLock ----
...
Upgrade(c) ==
  /\ OffersUpgrade(c)
  /\ lock' = Bundle(c)
  /\ last' = c.id
  /\ UNCHANGED catalog
...
Stabilises == <>[]Quiet
====
```

```cfg file="PluginLock.old-rule.cfg"
SPECIFICATION Spec
CONSTANTS
  CatalogChoices <- JustLinear
  Team <- TeamOldRule
INVARIANTS TypeOK AdviceCanBeFollowed
PROPERTIES Stabilises
CHECK_DEADLOCK FALSE
```

Steps from the plugin’s example flows and documentation; ... marks parts of the specification left out, and the flow also carries PluginLock.trace.cfg. The binding takes no configuration.

Check the rest
of the application.