# AWL steps and decisions

Step dependencies, expressions, guards, terminal routes and list pipelines.

Steps bind values and route control through a checked graph. Dependencies make predecessor values available. Every terminal route supplies the declared outcome's type.

## Steps and list expressions

- `step`: Declares one node of the step graph; the statements inside it run in written order. Arguments: form: declaration; positions: top-level, recipe-body.
- `after`: Names the steps a step waits for, so the dependency is written rather than inferred from position. Arguments: form: statement; positions: step-body, recipe-step.
- `filter`: Keeps the elements of a collection its predicate accepts. Arguments: form: pipeline-stage; positions: pipe-stage.
- `map`: Rewrites each element of a collection through a deterministic value expression. Arguments: form: pipeline-stage; positions: pipe-stage.
- `sort`: Orders a collection by a key, which the compile refuses unless it is `Int`, `Float`, or `String`. Arguments: form: pipeline-stage; positions: pipe-stage.
- `count`: Counts a collection's elements. Arguments: form: pipeline-stage; positions: pipe-stage, condition.
- `any`: True when at least one element of a collection satisfies its predicate. Arguments: form: pipeline-stage; positions: pipe-stage, condition.
- `all`: True when every element of a collection satisfies its predicate. Arguments: form: pipeline-stage; positions: pipe-stage, condition.
- `is`: Opens a predicate: `is empty`, `is present`, or `is absent`. Arguments: form: condition-word; positions: condition.
- `empty`: The predicate for a collection with nothing in it. Arguments: form: condition-word; positions: condition.
- `present`: Proves an optional access path present, narrowing it from `T?` to `T` wherever that proof holds. Arguments: form: condition-word; positions: condition.
- `absent`: Proves an optional access path absent, which is what an `or` chain narrows on its false edge. Arguments: form: condition-word; positions: condition.
- `not`: Negates a boolean expression. Arguments: form: condition-word; positions: condition.
- `and`: Boolean conjunction, where each conjunct's presence proof holds for the operands after it. Arguments: form: condition-word; positions: condition.
- `or`: Boolean disjunction, where each disjunct's absence proof holds on its false edge. Arguments: form: condition-word; positions: condition.


A dependency must name a step. The checker rejects unknown targets and invalid binding flow. Read a binding only on paths that establish it.

Boolean aliases are accepted, then formatted to the word spellings. Parentheses preserve the grouping the expression needs.

## Decisions and outcomes

- `outcome`: Declares a terminal payload in the workflow header, and a guarded arm inside a step body. Arguments: form: statement; positions: workflow-header, step-body.
- `if`: Guards an outcome arm; the first true guard wins, and its proofs narrow optionals through that arm. Arguments: form: statement; positions: step-body.
- `else`: The complement arm of a guarded outcome set, which must come last. Arguments: form: condition-word; positions: condition.
- `when`: Accepted spelling of the `if` guard; `aion awl fmt` rewrites it to the canon. Arguments: form: condition-word; positions: condition.
- `otherwise`: Accepted spelling of the `else` complement arm; `aion awl fmt` rewrites it to the canon. Arguments: form: condition-word; positions: condition.
- `route`: Sends flow to another step or to a declared outcome, supplying that outcome's payload. Arguments: form: statement; positions: workflow-header, step-body, pipe-stage.


An outcome arm combines a named guard and a route. A complement arm covers the remaining case. The checker verifies exhaustiveness where the construct requires it.

A route can carry named record fields or an already-bound value. A successful terminal route records the outcome envelope. A failure-routed outcome records failure rather than a successful result.

## Pipeline behavior

Filter keeps matching items. Map selects values. Sort orders by a comparable key. Count, any and all return aggregate values. Each stage's types are checked; the compiler additionally requires sortable keys to be numbers or strings.

## Concurrent dependency layers

Independent eligible steps compile into one parallel dispatch only when every member is exactly one ordinary action call, with no outcome clauses, failure block or visit bound. Other layers run in written order. Child and advisory calls do not qualify for this layer form.
