Matrix runs and parallel execution
Run one flow across multiple variants—such as a pull request’s base and head builds, multiple user roles, or several target configurations—by declaring matrix: in frontmatter. Pair it with --parallelism to overlap independent flows across workers, reflow watch to follow the live dependency tree from another terminal, and reflow evidence diff --request to compare variants directly.
┌─▶ api-check [side=base] ─▶ verify-report [side=base]seed-data (runs once) ─┤ (parallel worker 1) └─▶ api-check [side=head] ─▶ verify-report [side=head] (parallel worker 2)Declare a matrix
Section titled “Declare a matrix”Axes form (Cartesian product)
Section titled “Axes form (Cartesian product)”Declare one or more axes in frontmatter to expand every combination into its own variant:
matrix: side: [base, head] locale: [en, de]reflow plan expands this into four variants ([side=base, locale=en], [side=base, locale=de], [side=head, locale=en], [side=head, locale=de]). Each variant runs as an ordinary execution of the flow with its own steps, result, retained evidence, and reuse key. One failing variant never cancels the others.
Explicit rows form
Section titled “Explicit rows form”When specific values belong together—for example pairing each side with its expected outcome—list explicit row objects instead of expanding a Cartesian product:
---name: Verify base and head buildsproviders: worker: LocalBashmatrix: - {side: base, expectedStatus: open} - {side: head, expectedStatus: closed}---
### Check order status for each build
```rflworker.bash ( command="./bin/check-build '${matrix.side}'" expect=json( {"json": [{"pointer": "/status", "equals": "${matrix.expectedStatus}"}]} ) checkpoint="build-status")```Read axis values with ${matrix.<axis>} anywhere an input is accepted: in RFL statements, JSON arguments, whole-flow if:/unless: conditions, and use arguments. Matrix values are not private—retained evidence and step errors display them verbatim.
Limits and naming
Section titled “Limits and naming”| Rule | Constraint |
|---|---|
| Axes and variants | Up to 3 axes and 8 variants per flow. |
| Plan capacity | Each variant counts as one flow toward the 500-flow plan limit. |
| Axis names | Letters, digits, and _. |
| Axis values | Up to 64 characters of letters, digits, and _ . : / @ + - (empty value allowed). |
| Display name | <flow-slug> [axis1=val1, axis2=val2] in plans, status, reports, and taint. |
Supply per-variant private inputs
Section titled “Supply per-variant private inputs”Keep URLs, ports, or tokens out of matrix values by supplying them through the private inputs JSON file passed to reflow target --inputs. Add a top-level matrix map whose keys are comma-joined axis=value selectors; more specific selectors (more matching axes) take precedence:
{ "serverUrl": "http://127.0.0.1:8080", "matrix": { "side=head": { "serverUrl": "http://127.0.0.1:8081" }, "side=head,locale=de": { "serverUrl": "http://127.0.0.1:8082" } }}Selectors are validated strictly: malformed selectors are refused, and reflow plan warns when a selector matches no selected variant (without printing its private values).
Compose with needs, use, taint, --hold, and golden
Section titled “Compose with needs, use, taint, --hold, and golden”| Feature | Behavior with matrix: |
|---|---|
needs a plain flow | The plain producer runs once; every matrix variant waits for that run and can read ${needs.<slug>.outputs.<name>}. |
needs a matrix flow (matching axes) | Each variant waits only for the producer’s variant with the same axis values and reads its outputs directly via ${needs.<slug>.outputs.<name>}. |
needs a matrix flow (different axes or plain consumer) | Waits for every producer variant to complete; cannot read variant-scoped outputs. |
use another flow | A matrix flow can use another flow and pass ${matrix.<axis>} as an input. A used flow cannot itself declare matrix:—declare an input instead. |
random.* and browser sessions | Each variant allocates its own random.* test data and runs in its own browser session. |
reflow taint | reflow taint api-check taints every variant; reflow taint 'api-check [side=head]' taints one specific variant. |
reflow apply --hold | Holds the specific variant that failed so you can inspect and repair it live. |
golden | The flow is golden as a whole: golden.runs cites one passing second-pass run ID per variant, and the flow remains pristine only while every variant’s cited run passes. |
Overlap independent flows with --parallelism
Section titled “Overlap independent flows with --parallelism”By default, flows execute according to their dependency graph. Pass --parallelism <n> (between 1 and 16) to reflow apply or reflow ci run to overlap independent flows and matrix variants concurrently:
reflow apply --parallelism 4reflow ci run --golden --base-branch main --parallelism 4- DAG ordering is always preserved: A flow never starts until every dependency in
needs:has passed (or been reused). Within each ready tier, independent flows and matrix variants fan out across up tonconcurrent workers within device permit limits. - Keep concurrent flows isolated: Only run flows concurrently when they operate on independent records (using
random.*generators or distinct named Mailbox inboxes) or isolated target state. Whenever two flows mutate the same shared record or global setting, declare an explicitneeds:edge so they serialize cleanly. - Inspect bottlenecks: If a parallel apply takes longer than expected, inspect the Where the time went breakdown and
waiting: parallelism Nlines in Plan and apply output.
Watch live progress with reflow watch
Section titled “Watch live progress with reflow watch”Monitor any active parallel or matrix apply read-only from another terminal without risking cancellation (Ctrl-C detaches cleanly):
reflow watch # follow the active apply on this devicereflow watch --request <request-key> # attach to a specific apply keyreflow watch --result-file /tmp/apply.json # mirror final summary and exit codereflow watch --titles # show flow titles instead of slugsapply 8 flows · 4 running · 2 waiting · 2 done · 0 failed · 0:24 · about 0:18 leftseed-data ✔ 0:06├─ ✔ 1 passed slowest seed-data 0:06├─ ● api-check [side=base] 0:14 of ~0:22│ ▮▮▯ 2/3 Check order status 0:05├─ ● api-check [side=head] 0:14 of ~0:21│ ▮▮▯ 2/3 Check order status 0:04└─ ◌ 2 waiting: needs api-check next verify-report [side=base], …See Plan and apply output for non-interactive CI output and Guiding the agent for agent conventions.
Compare base and head variants
Section titled “Compare base and head variants”When a matrix apply finishes, compare side=base against side=head directly using the admission --request key (or --result-file) and --select:
reflow evidence diff side=base side=head --request <apply-request-key> \ --select '1/stdout.txt#/received' \ --control base=<base-rerun-id> --control head=<head-rerun-id>When an apply runs multiple matrix flows, qualify the flow slug in quotes: 'api-check [side=base]' 'api-check [side=head]'. See Evidence diffing for selector syntax, A/A noise controls, and --json output, and RFL language reference for the complete grammar.