RFL — the Reflow Language
RFL is the command language inside Reflow flows. A flow can query a database, run a shell command, read a test inbox or drive a browser. Plugins define the commands and the evidence they return; RFL connects those commands to named bindings and values.
Agents write the steps, people review them in Git or Reflow, and the runner executes them deterministically as written.
| Topic | Jump to |
|---|---|
| Providers & tool requirements | Bind plugins · requires: |
| Plugin calls, waits & JSON | Call a plugin command · within= · JSON arguments · Grouped calls |
| Browser actions & selectors | Browser steps · Targets · Fallback chains · Visual checkpoints |
| Control flow & teardown | Conditionals (if/unless) · Cleanup steps |
| Data, composition & fan-out | Inputs · matrix · capture · use & session |
| Limits & spec | Timeouts · Grammar · Execution rules |
Bind plugins to your environment
Section titled “Bind plugins to your environment”A provider declaration gives a plugin a local alias. The alias selects commands;
binding names the private connection configured for your execution target.
For example, db can use PostgreSQL through a connection named orders-test:
providers: db: {use: PostgreSQL, binding: orders-test} worker: {use: LocalBash, binding: checkout} container: {use: DockerUbuntu, binding: ubuntu-test} inbox: Mailbox ui: {use: Browser, binding: site} api: {use: MCP, binding: orders-mcp}The short form inbox: Mailbox uses inbox as both the alias and connection name.
Aliases belong to the flow. Keep connection strings, tokens and local paths in
private bindings supplied to reflow target --bindings /absolute/path/to/connections.json.
Plugin versions are selected once for the application in a generated lock document.
Run reflow init to install that selection; changing versions requires an explicit
upgrade. Flows declare aliases and bindings, not source commits or descriptor hashes.
See Write a flow for complete examples.
| Plugin | Private binding selects | Commands in a flow |
|---|---|---|
| PostgreSQL | A test database; writes require allowWrites | db.query, db.execute |
| LocalBash | An absolute working directory | worker.bash, worker.observe for a read-only status command |
| DockerUbuntu | An existing Ubuntu container | container.bash |
| Mailbox | Your Reflow team: the CLI login by default; a token is optional, for example in CI | inbox.address, inbox.cursor, inbox.capture, inbox.extract |
| Browser | A browser session and target | ui.open, ui.fill, ui.click, ui.snapshot |
| MCP | An MCP server endpoint and test identity | api.tools, api.call, api.read_resource and more |
| OpenAPI | An API base URL, auth, and pinned OpenAPI spec | http.read, http.call, http.call_value and more |
| ClickHouse (optional) | A ClickHouse server’s HTTP interface; writes require allowWrites | ch.query, ch.value, ch.execute |
| TLA (optional) | Nothing: the flow carries the specification | tla.check, tla.trace |
| Lean (optional) | Nothing: the flow carries the .lean files | lean.check |
| Bombadil (optional) | Nothing (a private traces directory only for explore.replay); browser= names the flow’s Browser alias whose page it explores | explore.run, explore.replay |
You can also declare a binding directly in RFL. Use either frontmatter or the statement form for an alias, because duplicate declarations fail validation:
provider db use="PostgreSQL" binding="orders-test"db.query sql="SELECT id, status FROM orders ORDER BY id" key="id" checkpoint="orders"Declare the tools a flow’s commands need
Section titled “Declare the tools a flow’s commands need”requires: lists, per alias, the programs that alias’s commands run, with an
optional version floor. Reflow checks them where those commands run, when the
first step that acts starts and before any authored command (a run that reuses
every step checks nothing), and refuses the flow with every missing or older tool
of every alias named:
providers: gen: {use: LocalBash, binding: checkout}requires: gen: [go>=1.26, uv]requires: this flow cannot run here, and no authored step ran. gen (LocalBash):go 1.22.3 is older than go>=1.26; uv is not on its PATH. … [tool_unavailable]A tool is a program name (python3, g++, clang-format); >= with a dotted
version (java>=21, go>=1.26) is the only constraint, written literally (no
${…}). A tool counts as found when the PATH that alias’s commands get holds an
executable file of that name: for LocalBash the PATH of the Reflow device service,
for DockerUbuntu the container’s. A tool without a floor is never run. With a
floor Reflow runs one query: go version (with GOTOOLCHAIN=local, so nothing
is downloaded), java -version, otherwise tool --version. A pre-release
(1.26.0-rc1) never meets a floor, and output with no single version, or a query
that does not answer within 5 s, is an unknown version and refuses too. Reflow
checks and never installs a tool or changes PATH: provision tools before the flow
starts, and leave out of requires: a tool a step installs itself. Planning refuses a requires: entry that is malformed
([requires_invalid]), names an alias the flow does not declare
([requires_unknown_alias]) or a provider that cannot check tools
([requires_unsupported]; LocalBash and DockerUbuntu can). A flow that uses
another declares the used flow’s tools too ([requires_not_declared]).
Call a plugin command
Section titled “Call a plugin command”Qualified calls use alias.command argument=value. The plugin descriptor defines
required arguments, their types, and whether the command observes or mutates state.
Reflow rejects unknown aliases, commands, arguments and incompatible types before
execution. A mutating command’s declaration describes its effect; it does not grant
operating-system permissions.
worker.bash command="./bin/check-orders"container.bash command="./bin/check-worker"db.query sql="SELECT id, status FROM orders ORDER BY id" key="id" checkpoint="orders"inbox.address name="signup" -> emailui.open url="/login"ui.fill selector="[name=email]" value=${email}ui.snapshot name="login"These fragments assume the bindings above and application-specific scripts and
data. A command returns a snapshot with its status and any evidence. Only commands
that declare a scalar return type can bind it with -> variable_name. A SQL query,
for example, retains rows as evidence; it does not return a scalar to bind. The
variable name is language syntax, not a plugin argument. References resolve in
source order and keep the provider’s declared type.
For MCP, call the tool through your binding alias. call_value selects one
public scalar from its JSON result; a later call can use the captured value:
api.call_value tool="create_record" arguments="{\"title\":\"test record\"}" select="/id" -> record_idapi.call tool="get_record" arguments="{\"id\":\"${record_id}\"}" expect="{\"isError\":false,\"json\":[{\"pointer\":\"/id\",\"equals\":\"${record_id}\"}]}"The tool names and JSON paths are examples; use those declared by your server.
The private orders-mcp binding above selects the endpoint, so these commands
have no server argument. See MCP JSON captures and assertions
for selection limits, privacy and uncertain completion.
Wait for a check to hold
Section titled “Wait for a check to hold”within= runs a call again until its check holds, for at most that long.
every= is the pause between attempts: 1 second unless the call says, and at
least 100ms. Write a wait this way, never as a polling loop in a script:
db.query ( sql="SELECT count(*) AS n FROM audit_logs WHERE actor = 'zz-e2e'" expect=json( {"json": [{"pointer": "/0/n", "equals": 2}]} ) within=30s every=2s)- Only an attempt whose check did not hold (unmet) is tried again. A call that
broke (it could not run, its result could not be judged, its completion is
unknown) ends the statement at once, as without
within=. The first attempt that holds ends the wait. - When
withinruns out, the step fails with the last attempt’s result:did not hold within 30s (15 attempts), then that attempt’s own message. The step keeps the last attempt’s evidence and says how many attempts ran. withinis the latest time an attempt may start, not a limit on the last attempt: an attempt started inside it runs to its answer, bounded by its owntimeout=. The wait never outlasts its step or flow: when their time (or the run) ends beforewithindoes, the step fails as broke, not as a check that did not hold, and a condition takes neither block.- Holds (
reflow apply --hold) run a line once:within=is refused there. - The call needs a check to wait for: its
expect=, or a command that is a check itself, such as Browserexpect. Its command must declare judged outcome v1 (judged-v1:<command>; see each plugin’s page). Waiting runs the call again, so the command must be safe to repeat: an observe command, or one its plugin marks repeatable. No bundled mutating command is repeatable. To wait for the effect of a change, make the change once in its own statement and wait on a read of its result. within=andevery=belong to Reflow and are never sent to the plugin. They take a duration with a unit, written out (not a${…}reference).
Email reading and extraction are separate commands:
inbox.capture name="signup" after=${before} from="noreply@" subject="Sign-in code" -> email_bodyinbox.extract text=${email_body} pattern="code is ([0-9]{6})" group=1 -> codeThe Mailbox guide shows the cursor and browser actions around these commands. Each variable name and the extraction pattern is explicit.
capture result = alias.command arguments is also accepted. Prefer
-> variable_name for plugin result bindings.
checkpoint="orders" names retained plugin evidence for review. Browser screenshots,
Bash output and database rows have different comparison rules. See
snapshots and review for examples of each.
Step screenshots
Section titled “Step screenshots”A plugin that drives something you can see, such as a browser page, an application
window or a virtual machine display, retains a screenshot of it after each of its
steps. The screenshot is on unless you turn it off. screenshot on a provider
declaration sets the choice for every step of that alias, and screenshot= on one
plugin call overrides it for that step:
providers: ui: {use: Browser, binding: site, screenshot: false}ui.open url="/orders" screenshot=trueThe statement form is provider ui use="Browser" binding="site" screenshot=false.
The value is a literal true or false, never a reference. With the screenshot off
nothing is captured for that step, including when it fails; a named ui.snapshot
checkpoint is a separate command and is unaffected. Plugins without a visible
surface accept the setting and retain no screenshot.
A step’s picture
Section titled “A step’s picture”Reflow shows each step as one picture: what one of its calls kept, such as the
lines a command printed, the rows a query returned or the page. In a step that
calls several plugins it picks that call itself, a failed call first. When it
picks the wrong one, name the call in the fence info with face=: a binding the
step uses, or one of its statements by number, counting from 1:
---name: Seed an orderproviders: worker: {use: LocalBash, binding: checkout} db: {use: PostgreSQL, binding: orders-test}---
### Seed and check the order
```rfl face=dbworker.bash command="./bin/seed-order A-1"worker.bash command="./bin/settle-orders"db.query sql="SELECT id, status FROM orders WHERE id = 'A-1'" checkpoint="settled-order"```face=3 names the same call here. Blank lines, comments and else lines are not
statements; a | fallback belongs to the statement above it, and a parenthesized
call is one statement. The binding must be one the step uses, and the statement
cannot be an if or unless line, which keeps nothing of its own. face= changes
only the picture: what the step runs, checks and keeps stays the same. It can
follow step="…" and timeout= in either order, as in
```rfl step="Pay" timeout=45s face=2.
Literal interpolation openings
Section titled “Literal interpolation openings”Quoted plugin string arguments support $${ to pass a literal ${ to the
provider, without resolving an RFL reference. Use it for shell parameter expansion
in LocalBash and DockerUbuntu commands:
worker.bash command="unset VAR; printf '%s\\n' \"$${VAR:-default}\""RFL sends unset VAR; printf '%s\n' "${VAR:-default}" to Bash, which prints
default. Use the same escape for $${PIPESTATUS[0]} and $${#arr[@]}. Escape
each opening in a nested expansion: $${VAR:-$${OTHER:-default}}.
The escape is processed once: ${inputs.name} still resolves normally alongside
escaped text, and neither inserted input values nor literal openings are scanned
again. It applies to quoted plugin argument strings, including command;
it is not a general escape for compact browser statements or capture expressions.
Whole unquoted ${name} arguments retain their declared primitive type.
A reference needs a value when its statement runs. A statement that reads a
${name} with no value in the run fails before its plugin is called, and the
failure names the reference and says why it has no value: an output the needed
flow’s run did not keep, a capture whose statement has not run, a misspelt name or
a team environment variable that is not set. The text ${name} itself is never
sent in place of a value, so a step cannot pass by filling in a reference and then
expecting the same reference. In a compact browser statement, text that is not a
reference, such as ${VAR:-x}, is left as written, and $${price} is a dollar
sign before the value. To send the text ${name} itself to the page, use a
Browser call with a quoted argument, such as ui.fill selector="[name=q]" value="$${name}".
$${name} is the literal text ${name}, never a literal dollar followed by the
resolved RFL value. To print a dollar before a value in Bash output, put the dollar in the
printf format (for example printf '$%s' ...) and pass the RFL value separately.
RFL strings use JSON escapes for quotes and backslashes. \${ is not an RFL
escape, and shell single quotes do not disable RFL interpolation. Shell quoting
still controls what Bash does with the resulting command. See
LocalBash examples.
References in JSON arguments
Section titled “References in JSON arguments”Some arguments hold JSON text: their descriptor declares a contentSchema, for
example MCP arguments and expect, Browser evaluate.argument and Bash
files. In those arguments a reference must sit inside a JSON string value, and
its value is inserted as escaped string content. With a customer string input:
api.call tool="find_orders" arguments="{\"customer\":\"${customer}\"}" expect="{\"textIncludes\":\"${customer}\"}"api.call tool="refund_order" arguments="{\"customer\":\"${customer}\",\"reason\":\"duplicate\"}" expect="{\"isError\":false}"If customer is x","admin":true, the MCP server receives {"customer":"x\",\"admin\":true",…}:
one customer member holding exactly that text, never extra members. Validation before
execution refuses:
- a reference outside a JSON string, in a member name, or after a backslash
(
reference_outside_json_string,reference_in_member_name,reference_after_escape); - invalid JSON (
json_template_syntax), and duplicate member names when the text has a reference (duplicate_member_name); - unpaired UTF-16 surrogates in the literal text (
ill_formed_unicode_literal); - a reference whose declared type is not
string(non_string_reference_in_json); - a captured variable used before an unconditional statement binds it, or bound only
inside a prerequisite, by an
optionalstatement or through a fallback (capture_forward_reference,capture_binding_conditional); - a definite schema failure, such as an unknown member, in the same invocation
(
json_template_schema_violation).
An output of a flow listed in needs and declared string under references fills
a JSON string slot the same way. With this frontmatter:
needs: [seed-order]references: needs.seed-order.outputs.orderId: {type: string}api.call tool="refund_order" arguments="{\"orderId\":\"${needs.seed-order.outputs.orderId}\"}" expect="{\"textIncludes\":\"${needs.seed-order.outputs.orderId}\"}"Its value is the one the producer captured in the execution the plan chose for this
run. A run without that output refuses the call (needs_output_unavailable). A
capture of the output, such as capture order_id = "${needs.seed-order.outputs.orderId}",
fills a slot as ${order_id} too.
An argument that is exactly "${inputs.name}" forwards that input’s JSON text
unchanged. Only a declared string input of the admitted run qualifies; captures,
needs outputs and other names are refused (capture_whole_json_forbidden,
needs_output_whole_json_forbidden, whole_json_source_not_declared_input). Arguments without a contentSchema, such
as Bash command, keep the interpolation described above. An argument whose schema
mixes JSON and plain branches, or is unconstrained, refuses references. Runners
that pass no JSON-capture context refuse these references instead of splicing raw
text (json_slot_requires_context).
For a call with a ${name} reference inside JSON text, Reflow refuses, before
resolving any reference, everything about the whole call that needs no resolved value:
argument context, placement, bindings, missing or unverified inputs, captures and
needs outputs, and
definite JSON value or schema failures in the authored text. A check on a value that a
reference resolver returns, such as a non-string result, happens after that resolver
runs. For every other call, its arguments, including JSON text
without such a reference, are checked in full only after its references resolve.
Long plugin calls and JSON blocks
Section titled “Long plugin calls and JSON blocks”A plugin call can span several lines inside parentheses. The ( ends the first line
and a line starting with ) closes the call; a result binding goes after it:
inbox.cursor name="signup" -> beforeinbox.capture ( name="signup" after=${before} from="noreply@" subject="Sign-in code") -> email_bodyEach argument line uses the same name=value tokens as a one-line call, and the call
means exactly the same as its one-line form. Blank lines and # comments are allowed
between arguments. Plugin calls still cannot use | fallbacks.
name=json( starts a JSON block for one argument. Every following line is JSON text,
with no RFL quoting or comments, until a line containing only ). The lines are
trimmed and joined with newlines; a $${ in the text is a literal ${. In an
argument with a contentSchema, ${name} references follow the JSON-argument rules
above. In any other argument a JSON block must not contain references
(json_block_reference_outside_json_context); its text must still be valid JSON.
Outside parentheses, x=json( is the plain text json(.
api.call ( tool="find_orders" # The customer reference is inserted as escaped JSON string content. arguments=json( {"customer": "${customer}", "status": "open"} ) expect=json( {"textIncludes": "${customer}"} ))Grouped calls and json(...) blocks are recognized in rfl fences only (not in ts fences).
Pass values between commands and flows
Section titled “Pass values between commands and flows”Typed inputs supply parameters. capture gives a returned or generated value a
name, and later commands read it with ${name}. A dependent flow declares needs
and reads ${needs.flow-slug.outputs.name} with a matching reference type. See
variables and the complete flow examples.
capture suffix = random.string length=12capture orderId = "test-${suffix}"capture total = expression "number(${inputs.quantity}) * number(${inputs.unitPrice})"inbox.address name="signup" -> emailNamed generated values and mailbox addresses survive replanning and partial reruns
until reflow reset starts a new test-data generation. Reset does not delete test
accounts or other records in your application. Shell and SQL interpolation is text
substitution, so keep untrusted values out of command strings and SQL fragments.
The execution rule
Section titled “The execution rule”Every step is RFL. An rfl fence contains executable commands: it needs at least
one statement, and every non-comment line must be valid RFL. Planning rejects an
invalid line with its diagnostic; it is never reinterpreted as free text or
JavaScript.
Put intent in the ### heading above the fence, or in its step="…" attribute.
Put explanations outside the fence.
reflow plan, reflow apply and reflow taint
refuse a flow with a step fence that is empty or holds only comments, and name
every such step in one message (prose_step_removed). Keep the heading as the intent and write
the statements that carry it out:
### Sign in as the test user
```rflfill label="Email" ${inputs.email}click role=button name="Sign in"expect role=heading name="Dashboard"```Editors, formatters and catalogs load such a flow; planning, taint and execution refuse it.
Browser steps
Section titled “Browser steps”Browser steps also support the compact statements below. Declare a Browser binding before using them. Keep each executable fence under its step heading:
### Add the first product on the page to the cart
```rflclick role=listitem nth=0 >> role=button name="Add to cart" | click testid=product-grid >> text="Add to cart"expect testid=cart-badge text="1"```Browser statements
Section titled “Browser statements”Write one statement per line: verb target [value] [modifiers]. A #
outside quotes starts a full-line or trailing comment.
Navigate
Section titled “Navigate”open /checkoutopen https://status.example.comreloadgo backgo forwardPaths resolve against the run target. A run may cross origins only when each
document origin was granted with reflow target --allow-origin. This includes
intermediate authentication redirects. See Browser navigation grants.
Pointer
Section titled “Pointer”click role=button name="Pay now"click role=row name~="Invoice 42" button=rightclick testid=canvas at=120,80dblclick testid=row-42hover role=menuitem name="Account"drag testid=card-3 to testid=column-donescroll role=main to=bottomtap role=button name="Menu"Keyboard and focus
Section titled “Keyboard and focus”fill label="Email" ${MAILBOX}type role=textbox name="Search" "wireless headphones"press role=textbox name="Search" Enterpress page Control+Kfocus label="Promo code"blur label="Promo code"fill clears before entering the value. type appends one key at a time.
Forms and files
Section titled “Forms and files”select label="Country" "United Kingdom"check label="Save this card"uncheck label="Subscribe to updates"upload label="Attachment" fixtures/receipt.pdfupload <target> <path> puts a file into a file input. The path is one the flow
declares under uploads: in its frontmatter, written exactly as declared:
uploads: - path: fixtures/receipt.pdf bytes: 48213 sha256: 5f2b6c0e9d1a4b7c8e3f0a1b2c3d4e5f60718293a4b5c6d7e8f9a0b1c2d3e4f5 mimeType: application/pdfDeclared files are read from the checkout of the selected target and must match their declared size and SHA-256. A flow can declare at most 8 files, 16 MiB each and 64 MiB together. A declared upload needs no code execution opt-in.
upload is a bare statement, not a command of the Browser alias: ui.upload does
not exist. It accepts only the timeout modifier, cannot be optional and cannot
be part of a | fallback chain.
In a flow without uploads:, an upload path is any file on the device. That is
local file access, so it needs trusted code execution: pass
--allow-code-execution (or set REFLOW_LOCAL_ALLOW_CODE_EXECUTION=1) to both
reflow plan and reflow apply. Prefer declaring the file. See
upload files.
Frames, tabs, dialogs, and downloads
Section titled “Frames, tabs, dialogs, and downloads”fill frame title~="Payment" >> label="Card number" "4242 4242 4242 4242"
on dialog acceptclick role=button name="Delete account"
click role=link name="Open invoice" opens=tabswitch tab lastswitch tab main
click role=button name="Export CSV" opens=downloadexpect download filename~=".csv"Dialog handling applies to the next action. switch tab accepts main,
last, or a 1-based index.
Saved browser flows capture the next download from an action marked
opens=download before checking its filename. The listener starts before the
click; exact output bytes and filename metadata become review artifacts. A later
marked action replaces the current download, and consecutive filename assertions
check that same retained file. Filename substring matching is literal.
Missing, interrupted, oversized or unretained downloads do not pass. Download evidence cannot be optional or hidden by fallback chains. A filename invariant checks the current retained file without triggering another download. Retained downloads are limited to eight files, 16 MiB per file and 64 MiB per run. These are evidence limits, not an OS quota for temporary browser files. The stepwise executor does not support tab switching.
Assertions and waits
Section titled “Assertions and waits”expect <target> <condition> retries until the condition holds or its
timeout= (5 seconds by default) runs out. wait for is the same assertion
form when the wait is the intent:
expect role=status name="cart count" text="1"expect role=alert hiddenexpect testid=price-total value="£42.00"expect role=listitem count=3expect label="Email" attr.aria-invalid="false"expect label="Promo code" focusedexpect role=textbox name="Notes" emptyexpect page url~="/order/"expect page title="Order confirmed"wait for role=progressbar hidden timeout=30sElement conditions are visible (the default), hidden, attached,
enabled, disabled, editable, checked, unchecked, focused, empty,
text="…", text~="…", contains="…", value="…", count=N,
class~="…", and attr.<name>="…". Page conditions are url=, url~=,
title=, and title~=. A condition’s text="…" is the element’s whole
text; text~="…" and contains="…" are case-sensitive substrings.
Most conditions judge exactly one element, so a target matching several fails
at once. hidden and count=N judge every match instead. hidden passes when
no match is visible, including when nothing matches, and keeps waiting while any
match is still visible, such as a stale row that a list has not yet refreshed.
Use count=0 when the element must leave the page, not merely become hidden.
A mailbox-enabled run has a disposable mailbox; see
test accounts. Use ${MAILBOX} as its address, then
wait for a message, open a link, or extract an OTP without an agent:
wait for email from~="noreply@" subject~="Verify your email" timeout=60sexpect email subject="Welcome" unreadopen email link href~="/confirm" subject~="Verify"fill label="Verification code" email code pattern~="\d{6}" from~="login@"Email conditions are from=, from~=, subject=, subject~=, href=,
href~=, pattern=, pattern~=, and unread. timeout= is also accepted.
No matcher means the next message, or the first link in the selected message.
See mailbox testing and test accounts for complete
signup and OTP flows.
Captures and cross-flow outputs
Section titled “Captures and cross-flow outputs”capture records a value as a run output:
capture account_email = text of testid=account-emailcapture verification_code = value of testid=otpcapture confirmation_url = page.urlcapture source = "signup"capture tenant = ${TENANT_ID}The source may be text of <target>, value of <target>, page.url, a
literal, ${VAR}, or the computed and generated sources. A downstream flow named in needs reads a successful
upstream output as ${needs.<flow-slug>.outputs.<name>}.
Visual checkpoints
Section titled “Visual checkpoints”A visual checkpoint is the Browser plugin’s snapshot command, called through
the flow’s Browser alias:
ui.snapshot name="checkout"ui.snapshot name="order-summary" selector="[data-testid=order-summary]"ui.snapshot name="spinner" settle=0name identifies the capture, so the same checkpoint can be found in another
run. Scope each capture tightly: selector captures one element instead of the
whole viewport, and mask covers regions that change for good reasons, such as
timestamps. Finite animations may finish naturally before the capture; settle
is that bound in milliseconds and settle=0 captures immediately. Clocks and
looping animations remain live. The Browser plugin
lists every argument.
Reflow keeps no approved baseline, and a visual difference does not fail a run. Each run retains its captures. Differences are found by comparing a run with a reference run, and the calling agent judges whether a difference is a regression. See visual testing.
RFL has no bare snapshot <name> statement. reflow plan,
reflow apply and reflow taint refuse a flow that uses one
(bare_snapshot_removed) and print the replacement for every occurrence:
snapshot checkout -> ui.snapshot name="checkout"snapshot cart-empty settle="2s" -> ui.snapshot name="cart-empty" settle=2000snapshot hero threshold="2%" -> ui.snapshot name="hero"threshold has no replacement, because a difference does not fail a run. A
plugin command cannot be part of a | fallback chain, so move a snapshot out of
one. The flow must declare a Browser provider
for the alias.
Shell commands
Section titled “Shell commands”Run shell commands through a provider: worker.bash command="…" with a
LocalBash binding, or container.bash command="…"
with a DockerUbuntu binding. Both run on the
device that runs the flow.
RFL has no runnable exec or bash statement. exec "<command>" in <name> and
bash "<command>" in <name> parse, so editors and formatters load a flow that
holds one, but they never run: a flow that
uses one fails at reflow apply, with or without the code execution opt-in.
Targets
Section titled “Targets”A target is a chain of anchors joined by >>, from outer scope to inner:
click role=dialog name="Checkout" >> role=button name="Pay now"| Anchor | Playwright equivalent |
|---|---|
role=button name="Pay" | getByRole('button', { name: 'Pay', exact: true }) |
role=button name~="Pay" | getByRole('button', { name: 'Pay' }) |
label="Email" | getByLabel('Email', { exact: true }) |
placeholder="Search…" | getByPlaceholder('Search…', { exact: true }) |
text="Add to cart" | getByText('Add to cart', { exact: true }) |
text~="Add to" | getByText('Add to') |
alt="Logo" | getByAltText('Logo', { exact: true }) |
title="Close" | getByTitle('Close', { exact: true }) |
testid=cart-badge | getByTestId('cart-badge') |
frame title~="Payment" | frameLocator(…) |
css=.product-grid | locator('.product-grid') (last resort) |
For label, placeholder, text, alt, title and a role’s name, =
matches the whole value exactly and case-sensitively, after Playwright’s
whitespace normalization. ~= matches a case-insensitive substring. A quoted
target such as click "Sign in" is text="Sign in". There is no separate
exact option; write = or ~=.
Target and statement modifiers include nth=N, timeout=10s, optional,
button=left|right|middle, at=x,y, opens=tab|download, and
scroll … to=top|bottom|into-view.
Fallback chains
Section titled “Fallback chains”Continuation lines starting with | are ordered alternatives. Reflow tries
each complete statement until one resolves uniquely:
click role=button name="Add to cart" | click role=menuitem name="Add to cart" | click testid=product-grid >> text="Add to cart"Keep reviewed fallbacks when the UI genuinely has multiple forms. Reflow never adds or rewrites a line itself: when a line fails, the calling agent reads the failure and edits the flow.
Conditionals
Section titled “Conditionals”if runs the lines indented under it when its condition holds. unless runs
them when it does not. An else at the same indentation holds the lines for
the other case.
open /if role=dialog name="Cookies" visible timeout=2s click role=button name="Accept all" expect role=dialog name="Cookies" hiddenunless page url~="/dashboard" click role=link name="Dashboard"else expect role=heading name="Dashboard"click role=link name="Billing"The condition is what you would write after expect: a target and what must
hold for it, or page and a url or title matcher. A bare target means
visible. Reflow waits for the condition like an expectation does, for 5
seconds unless the line has timeout=. A condition that holds selects its
branch at once; one that does not costs the whole wait, so give a short
timeout= to a check that is usually false.
A condition that does not hold is not a failure: the run records which branch
ran and continues. A condition that cannot be judged fails the step, exactly as
the same expect would: several elements match the target, the page closed,
or the Browser provider is older than conditionals. Reflow never takes else
because something broke.
A condition can also be a plugin call with a check. The call runs once, and its
judged outcome selects the branch: its check held, so if runs its block; it
did not hold, so the else block runs; the call broke, so the step fails.
if db.query sql="SELECT id FROM agents WHERE name = 'zz-e2e-agent'" expect="{\"rows\":1}" db.execute sql="DELETE FROM agents WHERE name = 'zz-e2e-agent'"unless worker.bash command="\"$REFLOW_FLOW_FILES/has-package.sh\"" expect="{\"json\":[{\"pointer\":\"/exists\",\"equals\":true}]}" worker.bash command="make package"The helper finishes its lookup and prints {"exists":true} or {"exists":false}
with exit status 0, and exits nonzero when it cannot tell. Its expect states no
exit, so only a confirmed false takes the block; a failed lookup fails the
step. An expect that names an exit status ({"exit":0}) turns every other
status into a check that did not hold, including a command’s own error.
A condition is written on its if line; it cannot be a parenthesized group.
The call needs its expect= (or a command that is a check itself), and its
command must declare judged outcome v1. It may be any such command, mutating or
not (a mutating one runs once, and what it changed stays whichever block runs, so
prefer a read), and may take timeout= and within=. It cannot bind a result
with -> name, the line is at most 4,096 characters, it is not judged during
private consent, and a flow’s own if: cannot be a plugin call.
Blocks are indentation:
- a block is indented exactly two spaces more than its
if,unlessorelseline, with spaces only, and has at least one statement; - every line of a block has the same indentation; an
iforunlessinside a block opens its own, two spaces deeper; elsesits at the indentation of the line it belongs to, alone on its line, at most once. There is noelse if: put anifinside theelseblock;- a
|fallback line is indented like the statement above it, or deeper. Blank lines, comments, and the argument lines of a parenthesized plugin call may be indented freely; - outside conditionals, indentation still means nothing.
What a block may hold: Browser statements, plugin calls, fallback chains and
further conditionals. What it may not: a capture or a -> name result
binding (a value later lines read must not depend on which branch ran), a
provider declaration, or use. A condition cannot be an
email or download check, or optional, and an if line has no |
fallback. A conditional lives inside one step: a step is never skipped as a
whole, and both branches count as the step’s source for reuse.
reflow apply prints the branch each conditional took, and comparing two
runs reports a conditional whose branch changed, so a regression that flips a
condition does not pass unnoticed.
A condition for the whole flow
Section titled “A condition for the whole flow”A flow can run only when a condition holds. Write if: or unless: in its
frontmatter, with the condition a block takes:
---name: Dismiss the holiday bannerurl: /providers: site: Browserif: testid=holiday-banner visible timeout=2s---
### Dismiss it
```rflclick role=button name="Dismiss"expect testid=holiday-banner hidden```Before the first step, Reflow opens the flow’s url on its Browser page and
judges the condition there, as it judges a block’s, waiting up to 5 seconds
unless the condition has timeout=. When if holds, or unless does not, the
flow runs and its first step starts on that page. Otherwise the flow is
skipped: none of its steps or prerequisites run, the results list it as
skipped with its condition, and a skipped flow is not a failure, so a run whose
flows all passed or were skipped exits 0. A flow that needs a skipped flow is
skipped too: what it reads was never captured.
A condition that cannot be judged fails the flow, as it fails a step: the page did not open, several elements match, or the Browser provider is older than conditionals. Reflow never skips a flow because something broke.
A flow with a condition declares a Browser provider and a url, and exactly one
of if and unless. The condition can read ${inputs.…} and ${matrix.…}
(judged per variant) and nothing a step captures. Such a flow cannot be used by another flow with use. Quote the whole
value when it starts with a quote, as in if: '"Accept all" visible'.
Clean up after a flow
Section titled “Clean up after a flow”A step that makes something the flow should not leave behind (a record, an
account, a changed role, a running server) gets a cleanup step that undoes it.
Write cleanup after rfl in the fence, below the step whose work it undoes:
### Make the customer an admin
```rfldb.execute sql="UPDATE memberships SET role = 'admin' WHERE user_id = '${inputs.customer}'"```
```rfl cleanup step="Restore the customer's role"db.execute sql="UPDATE memberships SET role = 'member' WHERE user_id = '${inputs.customer}'"```
### The admin page lists the audit log
```rflsite.open url="/admin/audit"expect role=heading name="Audit log"```A cleanup step does not run in its place. It is armed when the step written
above it starts to act (after the run accepted it, before its first statement);
one written above every step is armed when the flow’s first step does, which
suits removing what an earlier run left. When the flow’s steps are over, passed
or failed, every armed cleanup step runs, the last armed first, so teardown
mirrors setup. A cleanup step whose step never acted never runs, and a flow
skipped by its if: runs none.
- Every armed cleanup step runs, even after another one failed. It reads the captures as its step left them, passed or failed, so a later step that captures the same name again does not change what it removes. A statement that reads a capture or a used flow’s output this run never made (the step that makes it failed first) is skipped, not failed: there is nothing to remove. Inputs, references and outputs of needed flows are always read.
- Name what you create before you create it. A setup that fails after the
application acted may never return the ID it made. Build a run-specific key
first (
capture suffix = random.string length=8, then a name such aszz-e2e-${suffix}), create with it, and remove by that key, so the cleanup finds the record whether or not the setup step saw it come back. - A failing cleanup step fails the run. The step that failed first keeps its own error, and the cleanup step reports its own, so the results show both. Say which outcomes are acceptable in the check, such as a delete that accepts “not found”, rather than ignoring errors.
- Results. Each cleanup step is a step of its own after the flow’s steps,
named
cleanup: <name>, with its screenshot and timeline. A cleanup step that was not armed is listed as skipped. Cleanup steps have no plan identity: they are never reused and keep no receipt of their own. - Time. Cleanup steps are outside the flow’s
timeout:. Together they have what is left of it and 2 minutes more, and they end before the device’s last minutes, which close providers and report;timeout=on a cleanup fence bounds that step. - What it may hold. Any statement an ordinary step may,
ifandunlessincluded, reading what the steps above it captured. Not acaptureor a-> namebinding (nothing runs after it to read them),use, or aproviderdeclaration. - Reuse. A flow with cleanup steps is reused only whole: when any of its steps runs, all of them run, because the last run’s cleanup undid what the earlier steps made. Editing a cleanup step runs the flow again.
use. A used flow’s cleanup steps run at the end of the calling flow, among the caller’s own and last armed first, with the used flow’s inputs and captures, namedcleanup: <name> › <step>.use create-agent as agenthands back the agent and its removal in one line. A flow that keeps asessioncannot have cleanup steps.needs. A producer runs in its own execution, so its cleanup steps run when it ends, before any consumer starts. Leave what a consumer reads out of the producer’s cleanup.- Holds.
reflow apply --holdholds at the failed step before any cleanup step runs; they run when the hold ends, and the hold is 2 minutes shorter to leave them their time. A flow with cleanup steps does not continue on a held environment: the next apply runs it from the start. - Ctrl-C. With a CLI and device service that support it, the first Ctrl-C
of
reflow applyinterrupts the flows running on your device: each stops its running step (its outcome is unknown), starts no other step, and runs its armed cleanup steps, recorded as usual, before it ends as failed. An older device service cancels instead. A second Ctrl-C cancels at once. - What stops cleanup. A cancelled run (a second Ctrl-C, or a cancel from
elsewhere) stops at once and runs no further cleanup step: the run is closed
and nothing more can be recorded in it. Each cleanup step starts only after
the run acknowledged it. A cleanup step already running when the cancel came
may or may not have finished.
reflow applyreports, as best it can, which armed cleanup steps did not run (CLEANUP NOT RUN), or that it cannot tell (flow cleanup UNCONFIRMED): either way, what the steps made may remain. That is apart fromprocess cleanup confirmed, which is about the device’s own worker processes. A worker stopped by the device at its hard limit runs nothing more either.
Variables
Section titled “Variables”Inputs and overrides
Section titled “Inputs and overrides”Declare typed inputs with optional defaults:
inputs: orderLimit: {type: integer, default: 10} unitPrice: {type: number, default: 25} promoCode: {type: string, default: QA10} giftWrap: {type: boolean, default: false}Use ${inputs.orderLimit} in a command. ${orderLimit} is also accepted for a
declared input. A whole plugin argument reference keeps the declared primitive
type; inside a quoted string it becomes text. Inputs accept string, number,
integer and boolean.
Supply overrides with reflow target --inputs /absolute/path/to/inputs.json.
JSON keys are input names, for example {"orderLimit": 25, "giftWrap": false}.
An explicit false, 0 or empty string overrides its default. Reflow validates
values before execution; changing an effective input changes the plan.
See the complete database flow.
Inputs are private by default: kept evidence and step errors show
${inputs.promoCode} where the value appeared. Declare private: false on an
input that is no secret, such as a commit or a branch name, to keep its value as
written:
inputs: commit: {type: string, private: false}A true or false input and a value of fewer than 4 characters are never
replaced, and a private value of 4 to 7 characters is replaced only where it
stands alone, never inside a longer word. reflow plan names a private text
input whose value is too short to protect. See
private values in shell evidence.
Run a flow once per value: matrix
Section titled “Run a flow once per value: matrix”A flow that checks the same thing for several values (a base and a head build,
three generator targets) declares the values once in a matrix, instead of a
loop in a script or a copy of the flow per value:
matrix: side: [base, head]reflow plan runs the flow once per combination of values, a variant. Each
variant is an ordinary run of the same flow, with its own steps, result,
evidence and reuse, named generation-lint [side=head] in plans, results and
reports. A step reads its value as ${matrix.side}, a string, anywhere an input
can be read: in a statement, a JSON argument, the flow’s own if: and the
arguments of a use. One variant failing does not stop the others. A matrix
value is not private: kept evidence and step errors show it as written.
Several axes run every combination. Rows say which values go together:
matrix: - {side: base, expected: refused} - {side: head, expected: accepted}worker.bash command="\"$REFLOW_FLOW_FILES/check.sh\" ${matrix.side} ${matrix.expected}" checkpoint="check"- Limits. At most 3 axes and 8 variants per flow. Axis names are letters,
digits and
_; values are words of letters, digits and_ . : / @ + -(at most 64, empty allowed). Each variant counts as one flow toward the 500-flow plan limit. - Private values per variant. In the inputs file, a
matrixobject maps a selector to the inputs of the variants it matches; more axes win:{"serverUrl": "http://localhost:8080", "matrix": {"side=head": {"serverUrl": "http://localhost:8081"}}}. needs. A matrix flow that needs a plain flow: every variant waits for its one run. A flow that needs a matrix flow and has the same axes runs each variant after the producer’s variant with the same values and reads its outputs as${needs.<slug>.outputs.…}. Any other consumer waits for every variant and cannot read their outputs.use. A matrix flow canuseanother flow and pass${matrix.side}as an input. A used flow cannot declare a matrix: make the value an input.- Test data and holds. Each variant has its own
random.*values and its own browser session;reflow apply --holdholds the variant that failed. - Taint.
reflow taint generation-lintruns every variant again;reflow taint 'generation-lint [side=head]'runs one. - Golden. The flow is golden as a whole: its
golden.runscites the second-pass run of every variant, one id each, and it is pristine only while every variant has a passing cited run. - Inputs file selectors are read strictly: each is
axis=valuepairs joined by commas. A malformed one is refused, andreflow plannames a selector that matches no selected variant (never the values it supplies).
Capture and compute
Section titled “Capture and compute”Captures make values available to following statements in the same flow:
capture quantity = random.integer min=1 max=5capture suffix = random.string length=12capture requestId = random.uuidcapture email = "test-${suffix}@example.test"capture total = expression "number(${quantity}) * number(${inputs.unitPrice})"capture label = expression "string(${total})"| Source | Result |
|---|---|
random.string length=12 | Lowercase letters and digits; length 1–64. |
random.integer min=1 max=5 | Inclusive ordered safe-integer bounds; the range width must also be safe. |
random.uuid | A UUID-shaped test identifier with version 4 and variant bits. |
| A quoted template | A string with named references substituted as values. |
expression "…" | A scalar computed from literals, references and operators. |
Expressions support +, -, *, /, %, unary minus, parentheses, number()
and string(). References are values, not executable expression text. Expressions
cannot call JavaScript, read files or make network requests. Unknown references,
invalid conversions and non-finite results fail. The limits are 512 characters,
128 tokens and an expression-tree depth of 16. Long arithmetic chains count
toward the depth limit, even without nested parentheses.
These helpers execute on the host in admitted CLI/MCP plan / apply RFL flows;
no browser is needed for generated values. Browser sources such as text of,
value of and page.url still need a browser.
Reuse and random values
Section titled “Reuse and random values”Planning does not sample random values. Admission allocates each named generator once in the selected group’s test-data generation. New applies, retries, partial reruns, taint and browser-session reconstruction keep that value. Moving a capture between steps does not change it; its flow slug and capture name identify it.
| Value | Lifecycle |
|---|---|
Named random.* capture | Preserved until reflow reset; a new name gets a new allocation. |
| Named Mailbox address | Shared across flows in the group until reset. |
| Expression or quoted template | Recomputed from current inputs when its step executes. |
| Browser or plugin observation | Read again when its step executes; an unchanged plan can reuse its evidence. |
| Explicit input | Uses the supplied value or declared default; edits invalidate affected evidence. |
Changing a named generator’s kind, length or range refuses with a reset-or-rename explanation. Duplicate generated names in a flow are invalid. A flow can declare up to 256 generated names. The same name in another flow is a separate value. Shared groups use the same generation across devices; device groups are isolated. Selecting another target configuration for the same group preserves test data, although the new execution epoch invalidates previous execution evidence.
reflow taint seed-order # rerun with the same test datareflow planreflow applyreflow reset # replace test data for the selected groupreflow planreflow applyReset reruns random-generating and plugin-invoking steps, including fallback invocations, plus their dependents. Every plugin receives the generation in its runtime context, so this also reruns plugin observations that do not use named data. Unrelated steps without generators or plugin invocations can remain reusable.
Reset does not clear application accounts or unresolved execution uncertainty. It refuses active ownership and requires uncertain outcomes to be reconciled. These generators produce retained test data, not private keys or authentication tokens.
Capture plugin results
Section titled “Capture plugin results”A command declaring a scalar return type can feed an ordinary variable:
inbox.address name="signup" -> emailinbox.cursor name="signup" -> beforeThe inbox alias binds the Mailbox provider. The first
command returns a string and the second an integer. A command without a declared
return type cannot be captured; failed, missing or incorrectly typed values do
not become outputs. false, 0 and an empty string are valid declared values.
Provider snapshots remain reviewable evidence; Reflow does not scrape their JSON
or rendered text to invent variables.
Pass data between flows
Section titled “Pass data between flows”The producer captures named values. A consumer lists its producer under needs
and declares the types of outputs it uses:
needs: [seed-order]references: needs.seed-order.outputs.orderId: {type: string} needs.seed-order.outputs.quantity: {type: integer}Read an output with ${needs.seed-order.outputs.orderId}. A reference binds to
the exact successful upstream execution chosen by the plan, including reused
results. A missing output or failed producer cannot supply a value. Captures are
stored as strings in evidence; typed consumers validate and decode the declared
primitive. Ordinary browser text captures are strings. Use explicit number()
conversion when computing from text.
The two-flow walkthrough shows a complete producer and consumer. Inputs and captures follow the RFL scope; raw TypeScript fences have their own environment and do not automatically inherit all of these values. Use a declared plugin return or another supported capture source for values you need to pass along.
Keep credentials in private connection settings. Do not capture secrets or sensitive transformed inputs: captured values become retained, shared evidence.
Use another flow as a step
Section titled “Use another flow as a step”needs orders whole flows: the producer runs first, in its own execution, and the
consumer reads what it captured. use runs another flow’s steps inside this one,
in the same execution and the same browser session, as a single step:
---name: Edit billing detailsproviders: site: Browserinputs: adminEmail: {type: string}---
### Sign in
```rfluse sign-in-admin as admin email="${inputs.adminEmail}"```
### Open billing
```rflsite.open url="/users/${admin.outputs.userId}/billing"```use <flow> names the flow by its slug within the same application. as <name>
gives the result a name for this flow; without it the name is the slug. The
remaining name=value pairs are the used flow’s declared inputs: text, a number,
true/false or a ${reference} from this flow. Required inputs must be given,
unknown inputs are refused, and each value is checked against the type the used
flow declares.
The used flow says what it hands back in its frontmatter:
outputs: userId: {type: string}Each output names a capture the flow always makes, with that capture’s type. The
calling flow reads it as ${admin.outputs.userId} in any step after the use.
Nothing else crosses: the used flow’s other captures and its inputs stay inside
it, and it cannot read the calling flow’s captures or inputs except through the
values passed on the use line.
A use statement is the whole of its step, so the step list of the calling flow
never depends on the used flow’s contents. The step’s result records the used
flow’s own steps; a failure is reported as <flow> › <step>: <error>. Editing
the used flow re-plans every flow that uses it. Two use steps in one flow need
different names (use create-user as boss, use create-user as staff).
A flow can be used when it could run in the calling flow’s place:
- the calling flow declares every provider the used flow declares, under the same alias, type and binding;
- the calling flow’s
requires:lists every tool the used flow requires, on the same alias and with at least its version floor ([requires_not_declared]); - it declares no
needs,prerequisites, uploads or invariants; - it does not
useanother flow itself; - it generates no values (
random.*or a named mailbox address); pass them in as inputs instead.
A flow that is used still runs on its own like any other flow. use cannot be a
fallback alternative or have one.
Keep a used flow’s browser session
Section titled “Keep a used flow’s browser session”A flow that signs in can keep the browser session it leaves, so the next flow to use it starts signed in instead of signing in again. Declare it on the used flow:
session: expires: 8h valid: expect testid=account-menuexpires says how long a saved session is trusted: a duration from 1m to
30d, such as 30m, 8h or 7d. valid is one expect assertion that holds
only while signed in. Both are required. valid runs before the flow’s steps,
so it can read ${inputs.…} and nothing the steps capture. A flow needs a
Browser provider to keep a session.
Every use of such a flow does the same thing:
- If this device holds a session for the flow, its source and these inputs that
is younger than
expires, the cookies and local storage are put back, the page the flow ended on is opened andvalidruns. - If
validpasses, the flow’s steps do not run. Its declared outputs are the ones saved with the session. - Otherwise (no session, an expired one, or
validfailed because the server dropped it) the flow’s steps run,validmust then pass, and the session is saved with the outputs.
Either way the use is one passed step of the calling flow, which continues on
the same page with the same outputs. The step’s result says which happened:
ran, restored, or ran · session rejected. reflow plan prints what it
expects, such as “Restores the session of sign-in-admin saved 09:14, good until
17:14”; it cannot know a server dropped a session early, and the run says so
when it finds out.
The session is the cookies and local storage the flow’s steps added or changed; what the calling flow had in the browser before the step is not part of it. Session storage and IndexedDB are not kept. Flows that run in parallel share one sign-in: the first runs the steps and the others wait and restore what it saved.
A session is kept in the device’s private profile, per target group, readable
only by its owner. It is never uploaded and never part of evidence or of a
captured value. It is forgotten by reflow reset, by reflow taint <flow>, when
the target changes and when the flow is edited. A run without a device profile
runs the flow’s steps every time.
Leave session off for an application that allows one session per user or
rotates its tokens on every use: parallel callers would sign each other out.
use works without it.
Browser-run environment variables
Section titled “Browser-run environment variables”Reference a team environment variable as ${VAR}. Names inside a reference
may also contain dots and hyphens, which supports cross-flow references such
as ${needs.create-account.outputs.email}. In the separate browser-run mailbox
path, ${MAILBOX} is the current run’s disposable inbox address. For named inboxes
that survive plan / apply reruns, use the Mailbox plugin.
Set team variables in dashboard settings. Values are encrypted and injected
when the run is claimed; they are not declared in flow frontmatter.
Substitution happens only at the last moment before a line or TypeScript body
executes. Step names and recorded flow documents keep the ${VAR} placeholder,
and substituted values in execution errors are redacted back to the
placeholder.
These are browser-run substitutions. Host-evaluated captures in plan/apply
use the declared input and reference types described above.
Timeouts
Section titled “Timeouts”timeout says how long something may take. It is written the same way at three
levels, as a whole number and a unit: 500ms, 30s, 5m, 8h or 1d (the
most any of them accepts).
---name: Checkouturl: /checkoutproviders: site: Browsertimeout: 5m---
### Pay
```rfl timeout=45ssite.open url="/checkout" timeout=10sclick role=button name="Pay now"wait for role=progressbar hidden timeout=30sexpect page title="Order confirmed"```- A statement:
timeout=after any statement is how long that one statement may take. Without it an action or assertion gets 5 seconds, a navigation (open,reload, an email link) 30 seconds and an email wait 30 seconds. A navigation giventimeout=10sgets 10 seconds, not 30. On a typed plugin call whose command has notimeoutargument,timeout=bounds the whole call and is not sent to the provider. A command that has its owntimeoutin milliseconds (Browserclick,fill,expect) takes a duration or the number of milliseconds; a command whosetimeoutis in another unit keeps its own number. - A step:
timeout=in the fence info, afterrflor afterstep="Name"(rfl step="Pay" timeout=45s), is how long the whole step may take. When it runs out the step fails, naming the step, its timeout, the time taken and the statement that was running; later steps are skipped as after any failed step, and the step keeps its screenshot. - A flow:
timeout:in the frontmatter is how long the whole flow may take, counted from when it starts to run.
A statement never gets more time than its step has left, and a step never more
than its flow has left. The failure says which limit ran out. A use step is
bounded by the calling flow’s timeouts; the used flow’s own step and flow
timeouts apply only when it runs on its own.
session.expires is written in the same form, from 1m to 30d.
Small print
Section titled “Small print”- Values are a quoted string, a
${VAR}interpolation, or one bare token with no spaces and no=. Usefill label="Promo code" ""to clear a field. - Multiple conditions on one
expectline are AND-ed. - A bare
expect <target>assertsvisible. timeout=takes a duration such as500ms,30sor5m; see timeouts. A bare number is milliseconds.at=x,yis relative to the element’s top-left.- A
#outside quotes starts a comment.
Grammar
Section titled “Grammar”Formal EBNF grammar for RFL v1 (Apache-2.0). Every RFL example in these docs is validated against the parser and the bundled plugin registry.
block = [ "rfl" INT ] line*line = comment | statement | "|" statement | conditional
conditional = ("if"|"unless") judged NEWLINE INDENT line+ DEDENT [ "else" NEWLINE INDENT line+ DEDENT ]judged = ("page"|target) condition* [ "timeout=" value ] | NAME "." NAME (NAME "=" value)*
statement = nav | pointer | keys | forms | meta | assertion | email | capture | cli | provider | invocation | useprovider = "provider" NAME "use=" value "binding=" valueuse = "use" FLOW [ "as" NAME ] (NAME "=" value)*nav = "open" value | "reload" | "go back" | "go forward"pointer = ("click"|"dblclick"|"hover"|"tap") target | "drag" target "to" target | "scroll" targetkeys = ("fill"|"type") target value | "press" ("page"|target) value | ("focus"|"blur") targetforms = "select" target value | ("check"|"uncheck") target | "upload" target valuemeta = "on dialog" ("accept"|"dismiss") [ "text~=" STRING ] | "switch tab" ("main"|"last"|INT)assertion = ("expect"|"wait for") ("page"|"download"|target) condition*email = ("expect"|"wait for") "email" email-condition* | "open email link" email-condition* | "fill" target "email code" email-condition*capture = "capture" NAME "=" ("text of" target | "value of" target | "page.url" | value | invocation | "random.uuid" | "random.string" "length=" INT | "random.integer" "min=" INT "max=" INT | "expression" STRING)cli = ("exec"|"bash") value "in" value (* removed: never runs *)invocation = NAME "." NAME (NAME "=" value)* [ "->" NAME ]
target = anchor ( ">>" anchor )*anchor = KIND ["~"] "=" value param* | "frame" param*KIND = "role"|"label"|"placeholder"|"text"|"alt"|"title"|"testid"|"css"param = ("name"|"name~"|"title"|"title~"|"url~") "=" value | "nth=" INT | "exact"
condition = FLAG | CONDKEY ["~"] "=" value | "attr." NAME "=" valueFLAG = "visible"|"hidden"|"attached"|"enabled"|"disabled"|"editable" | "checked"|"unchecked"|"focused"|"empty"CONDKEY = "text"|"contains"|"value"|"count"|"class~" (* element *) | "url"|"title" (* page *) | "filename" (* download *)email-condition = ("from"|"from~"|"subject"|"subject~"|"href"|"href~" | "pattern"|"pattern~") "=" value | "unread"
value = STRING | "${" VAR_NAME "}" | BAREWORDmodifiers = "timeout=" DURATION | ("button"|"at"|"opens"|"to") "=" value | "optional"DURATION = INT ("ms"|"s"|"m"|"h"|"d")Statement modifiers may appear after the verb’s required operands. Anchor
parameters bind to the anchor they follow. Anything outside the grammar is an error in an rfl fence.
INDENT and DEDENT are produced from leading spaces, only after a
conditional head: INDENT is a line indented exactly two spaces more than
the if, unless or else line above it, and DEDENT is the first line at
or left of that line’s indentation. else is read at exactly its head’s
indentation. Inside a block, a conditional’s lines exclude capture,
provider, use and an invocation with ->; see conditionals.
On an invocation, timeout=, within=, every=, checkpoint= and
screenshot= are Reflow’s own; see wait for a check to hold.
FLOW is a flow slug: a letter, then letters, digits, - or _. A use
statement stands alone in its step; see use another flow as a step.
A visual capture is an invocation of the Browser snapshot command; there is no
"snapshot" NAME statement (see visual checkpoints). The cli statement
parses and never runs; see shell commands. A ts fence whose
body is not RFL is Browser script: trusted local code that reflow plan and
reflow apply run only with the code execution opt-in. See
TypeScript steps.
Execution and failure rules
Section titled “Execution and failure rules”- For browser selectors, an anchor chain must match exactly one element. Zero
or many matches without
nth=fail instead of picking silently. Thehiddenandcount=Nconditions are the exceptions; they judge every match. - For browser fallbacks, the first uniquely resolving alternative wins and is recorded in the trace.
- Browser actions inherit Playwright’s auto-waiting;
RFL has no sleep statement. A plugin call waits with
within=, which tries again only while its check comes back unmet. - Parsing and executing RFL makes no model call, and no model runs inside Reflow. The calling agent writes the steps, reads the evidence and judges differences between runs.
- A block may begin with
rfl 1to name its grammar version. - An
iforunlesstakes a branch only on a judged condition. A condition that cannot be judged, or a plugin call that broke, fails the step. - A flow whose frontmatter
ifdoes not hold, or whoseunlessholds, is skipped, not failed. A condition that cannot be judged fails the flow. - A cleanup step (
```rfl cleanup) runs after the flow’s steps when the step above it started, last armed first, whether the steps passed or failed. A cleanup step that fails fails the run beside any earlier failure.
Running a flow needs no model provider key. A step without RFL statements is
refused before execution; see the execution rule. The
frontmatter settings self_heal: false, validate: false, provider_key and
budgets.tokens are accepted and have no effect. Write
checks as deterministic assertions.