Write a flow
A flow file is blocks of plain sentences. The grammar is small enough to hold in your head; the sentence patterns are enumerated, with two examples each, in the flow language reference.
Blocks
story (tags=smoke, onFailure=compensate:Cancel booking): Book a slot
inputs: location: string, when: string = "tomorrow"
outputs: booking: string
Go to "/book"
Type {input.location} into the location field
Click the first suggestion
Only if the confirm dialog is visible, Click the confirm button
Remember the text of the booking summary as booking
scenario: Cancel booking
Click the cancel booking button
compose: Booking stories
Book a slot
test: Booking stories
storyis the unit of behaviour;scenariois a story that runs in file order when there is no run block;composenames a sequence of stories;testandrunsay what a run executes.inputs:andoutputs:are the signature. Types arestring,number,boolean,secret; defaults are allowed; asecretis redacted wherever it could be written.Only if <predicate>, <sentence>andUnless …guard a step. A guard that does not hold skips the step and never acts.onFailureisstop,continueorcompensate:<story>, andidempotentis what lets a story be exposed as a tool in production.
Sentences
Targets are phrases, never selectors: "the username field", "the sign in
button", "the first suggestion". The compiler normalises the phrase into an
element id and the recorder binds it. Values come from {input.name},
{data.path}, {name} for a capture in this story, or {Story.name} for
another story's capture; captures never overwrite.
Expectations read as English: The dashboard heading should be visible,
The URL should contain "/dashboard", Every button on this screen should have an id. Expect … to …, Verify … and Check that … are accepted aliases.
Lint before you compile
yam lint
Lint reports ambiguous targets, long sleeps, unused captures, a dialog step with
nothing armed, a side effect inside a story exposed as a tool, and a binding
file that declares no phrases. Each warning has a code you can look up in the
reference. yam compile refuses a flow with an unbound target, an undefined
variable or a type error: failures belong at authoring time, not at replay.
Typed steps for logic
When a sentence is not enough, a Tier 0 step is a typed function you register
from the project's steps/ directory and call by name; its arguments are
validated against its declared schema. The grammar, the local model and the
frontier model never see it. See the compiler tiers.