Skip to main content
Many platform surfaces take an author-written jq program — a door mapping an inbound message to a run’s kwargs, a state binding shaping an update, a template program. Every one follows a single rule for what the program reads.

The rule

The jq input . holds only the data the program is about. Everything the platform adds beside it arrives as a named jq variable $name. A door’s start_expr reads the inbound payload as . and the run’s parked interactions as $parked; a state update reads the tool’s output as . and the run input as $input. A tool’s output is the update’s ., never a $output variable — the data the program is about is always ., and the variables are the context around it. Each site declares exactly which variables it binds. A program that reads an undeclared $name fails to compile at save, so a typo is a loud refusal rather than a silent null.
The process environment is sealed out of every expression: the env builtin is disabled and $ENV is an empty object. The binding-mechanism names __in, ENV, and __loc__ are reserved and cannot be bound as variables. A value a program must trust comes from its declared input or variables, never the host environment.

Doors

Every door contract expression — a conversation route’s, a hook’s, or a schedule’s cancel_expr, resume_expr, start_expr, and extras_expr — reads the door’s own input document as . and binds:

Route reply

A conversation route’s reply_expr reads the started run’s result as . and binds three variables:

State bindings

A state binding’s jq slots each read a different . and bind the run’s data as variables:

Template jq

A template jq program reads the record’s attached subtree as . and binds the attachment’s context: A template’s declarations check reads the declaration values as . with $parameters bound; its reconcile programs read their own data as . with, per label, $previous/$new (orphans), $id/$resolution (close), or none (resolutions).

Flow authoring

A flow node’s jq adds more variables on top of these — the state documents in scope, the run’s own identity, and, inside a loop, the iteration value and index. The flow editor binds and documents them; see the flow jq editor for $states, $run, $iteration, and $iterate. The rule is the same everywhere: the node’s own data is ., the context around it is named variables.

See also