skip to content

The reference card

Condensed lookup: every word, key and closed vocabulary with a one-line meaning and a pointer into the format reference.

Condensed lookup card for the pattern language, derived from the pattern format; if this card and the spec disagree, the card is wrong. § numbers point into the pattern format.

Primary words (§ 1)

Word Kind One-liner
pattern definition Named sequence of steps and parameters.
agent producing step One fresh untrusted agent session.
gate producing step Gantry's authoritative project check package.
command producing step Deterministic command with declared outputs.
for composition Body pattern once per task in a directory list, sequential.
if composition Routes on one produced value, one step outcome, or absence.
stop composition Ends the run with an authored note.
call composition Invokes another pattern in the composed namespace.
output value Declared file/directory path produced by exactly one step; never a step type.

[header] (§ 3)

Key Req One-liner
pattern_language_compatibility yes Must be "3".
entry yes Pattern name where execution starts; must resolve after include composition.
description yes Human-facing selection/documentation prose.
include no Pattern files composed into one flat namespace; included files' header keys are inert.
on_stop no Hook pattern or hook table for engine stops; not entered for authored stop or operator pause/abort.
default no true claims the flagless gantry <plan> selection; exactly one loadable claim.
cli_flags no [[header.cli_flags]] entries binding engine-owned selector slots.

[[header.cli_flags]]: flag (req, engine-owned selector slot map or until), value_parameter (req, entry parameter for the flag's primary value), passthrough_parameter (no, entry parameter for trailing text). Each flag slot claimed at most once.

on_stop = "pattern" is shorthand for the any catch-all. [header.on_stop] may key hooks by step, absence, plan, gate, record, or any; a class-specific hook takes precedence over any. record and merge hooks never dispatch and neither class falls through to any.

Pattern and parameters (§ 4)

  • [patterns.<name>] keys: parameters, steps — nothing else.
  • There is no level key. A for or a call opens a depth in the task tree, the depth is read from the composed task path, and the interface renders a position as numbers (4/7 flat, 2/5:3/7 nested), so nothing consumes a label.
  • Parameter keys: name (req), kind (req), default (no), declared_plan_source (no, at most one parameter in the entry pattern), description (no).
  • Parameter kinds (closed): path (file/dir path input), prompt-id (prompt identifier via prompt tiers), text (authored prose).
  • A parameter fills a typed slot; it never splices into a pattern/step/output/branch/parameter name.
  • nothing is the engine-provided identity pattern; no file may define anything named nothing (§ 2).

Steps

Every producing step: name required when referenced or when it declares outputs; a named step implicitly produces outcome done/failed (§ 6). Every step may declare title; it is literal display text, with no substitution and no generated fallback (§ 6). summarize is a key of agent and gate only; an absent, failed, or empty generated summary leaves the ordinary finish summary standing (§ 6.1, § 6.2).

agent (§ 6.1)

Key Req One-liner
type yes "agent".
name when referenced Step identifier.
title no Literal display text.
stage no Closed stage label for the work this agent performs; omitted means execute.
summarize no Generated finish summary on the card; only a review-stage agent step has a summarizer prompt (summarize-review.md).
prompt yes Prompt id, or whole {{task.prompt}} / {{prompt-id-parameter}} slot.
inputs no Paths or output references shown to the agent.
outputs no File/directory contracts the agent may produce.
text no Table of prose placeholders injected into the prompt; missing placeholder in carried prose is a no-op.
read_only no Snapshot and restore the tree after the session.
protected no Paths restored after the session.
confine no Detect edits outside the allowed worktree.
on_plan_change no Plan-change policy: handler review, nothing observed acceptance, or omitted unwatched behaviour; watched set is engine-derived.
diff no Boundary reference for the review span shown to the agent (§ 13).
judging_gate no Whole-value command slot for the gate expected to judge this step; the loader compares it with the first following gate.command.
model no Per-step model override, a non-empty string.
effort no Per-step effort override.
harness no Per-step harness override, a registered harness id.

gate (§ 6.2)

Key Req One-liner
type yes "gate".
name when referenced Step identifier.
title no Literal display text.
command yes Whole-value command slot, most often {{task.gate}} or an output reference.
summarize no Generated finish summary on the card, from summarize-gate.md over the gate command.
restore no Boundary reference restored before the gate runs.
outputs no Additional file contracts.

Gate outcomes: done (green), failed (red or no authoritative verdict). Color aliases green/red accepted in step-outcome if; infrastructure failure is not a third color.

command (§ 6.3)

Key Req One-liner
type yes "command".
name when referenced Step identifier.
title no Literal display text.
run yes Command text run with sh -c; no {{...}} interpolation.
outputs no File/directory contracts the command writes.
restore no Boundary reference restored before the command runs.

A deciding command writes a one-word output and an if reads it; numbers are never pattern state.

for (§ 9)

Key Req One-liner
type yes "for".
name when referenced Step identifier.
title no Literal display text.
list yes { directory = "<path-or-output-reference>" } — the only list form; files in sorted order, re-read before each iteration.
body yes Pattern called once per task.
parameters no Parameter bindings for each body invocation.
fail no stop (default: unrouted failed body invocation stops the run) or continue (record and go to next task).

fail governs only unrouted failed body invocations. A stop anywhere ends the whole run, and an engine stop inside the body follows on_stop instead of becoming a continued iteration. A body falling off its end completes the task; task completion recording is part of interpreting for.

if (§ 8) — no type key

Optional key: title, literal display text.

Form Routes on
if = "output" + then = { value = "pattern", ... } A produced value; then table must match the declared values vocabulary exactly, every value once, no extras.
if = { output = "value" } One specific value (must be in the declared vocabulary); non-match or absence goes to else, or falls through to the next step.
if = { step_name = "outcome" } Step outcome done/failed; gates also green/red.
  • else on form 1 handles absence — absence is never a value, never malformed, never implicit fall-through.
  • Step-outcome if with no else: non-matching done falls through; an unrouted failed reaches the engine-forced stop, and the step after a failed producing step must be an if testing that step.
  • Load errors: step-outcome if with no then; any if with neither then nor else.
  • One fact per if: no boolean operators, comparisons, list-empty or compound conditions — use a command that writes a one-word output.
  • Branch targets name patterns; success, complete, rollback, retry, handover, quiesce are not reserved branch words.

stop (§ 12)

Key Req One-liner
type yes "stop".
title no Literal display text.
note yes Why the pattern has no next move.

No stop disposition vocabulary, reason enum, or success word. Falling off the entry pattern's end is ordinary completion; falling off a called pattern returns to the caller unless the call was tail-position recursion.

call (§ 10)

Key Req One-liner
type yes "call".
name when referenced Step identifier.
title no Literal display text.
pattern yes Callee pattern name.
parameters no Callee parameter bindings.
restore no Boundary reference restored before the call runs.

Every invocation rebinds every callee output (a non-produced output reads as absent, not stale). A tail call never returns. Recursion is the only unbounded repetition; every call in a call-graph cycle must be reached only in tail position — a load-time check (§ 11). Run-scoped outputs are the only values surviving across recursive invocations.

Outputs (§ 7)

Key Req One-liner
name yes Identifier for references and branch tests.
path yes Orchestration-relative file or directory path (/-suffixed = directory), or one whole-value reference.
values no Closed value vocabulary; makes a file output branchable. Directory outputs never declare values.
scope no Omitted = current invocation; run = addressed from the run frame, survives the invocation.
  • Every output declaration belongs to one producing step: no output name is declared twice, and no path twice at one scope. Mutually exclusive branches still may not co-produce one path.
  • Run-scoped paths inside a for body must be distinct per iteration ({{task.name}}); a colliding run-scoped path is a load error. Self-recursive re-production of a run-scoped output is last-writer-wins.
  • A present values output must hold exactly one declared value (whitespace trimmed); an unknown value is malformed output = producer's failed outcome, not absence, not a default.

References (§ 5)

Reference One-liner
{{parameter}} Current invocation's bound parameter value.
{{output}} Current readable binding for a declared output.
{{task}} Active task file path inside a for body.
{{task.name}} Active task file basename; may appear inside a declared output path.
{{task.prompt}} Prose body carried by the active task file (agent prompt slot).
{{task.gate}} Gate command carried by the active task file (gate command slot).
{{STOP_REASON}} Prose facts for an on_stop hook.
  • {{name}} only as the whole TOML string, except in prose strings and declared output paths; never substituted into command text.
  • Forward references are legal and resolve at load; only runtime file presence is deferred.
  • Step names and output names are declared once across the whole composed definition, not per pattern.

Boundary references (§ 13)

Reference One-liner
run-base The run's starting project commit.
iteration-start Start boundary of the nearest dynamically enclosing for iteration.
previous-step The accepted boundary before the current step.
{ before = "<step name>" } The accepted boundary immediately before the named step ran.

restore on gate, command, call (tree placed at the boundary before the step); diff on agent (review span, prompt data only). They resolve dynamically against the invocation/iteration stack and never run Git operations as steps.

Command environment (§ 5)

command steps and a gate step's command receive, as whole-value environment variables: every declared parameter and readable output by name, $orchestration (the orchestration directory), and inside a for body $task, $task_name, $task_prompt, $task_gate (dots become underscores). Command text containing {{...}} is a load error unless the whole field is a typed slot such as command = "{{task.gate}}".

Closed vocabularies and reserved names (§ 14)

  • Step type values: agent, gate, command, for, call, stop (if has no type).
  • Parameter kinds: path, prompt-id, text.
  • Output scopes: omitted (invocation), run.
  • Agent stages: environment-build, plan, gate-build, execute, gate, fix, investigate, troubleshoot, review, replan, merge, resolve, support, done.
  • Agent effort values: low, medium, high.
  • List references: { directory = ... } only.
  • Step outcomes: done, failed. Gate color aliases: green, red. for.fail: stop, continue.
  • Stop classes: step, absence, plan, gate, record, merge; any is only an on_stop catch-all key, and merge is not hookable in this release.
  • Reserved names: nothing, the primary words, done, failed, green, red, continue, run, task, task.name, task.prompt, task.gate, STOP_REASON.
  • Words of the retired format (block, rule_block, counter, channel, inner_unit, script, goal-check, git, loop, fan-out, sub-pattern, include as a step, terminate, conditional, validation-gate, write-map-spec, validate-map-spec, classify-units) are not aliases; a file using one as a primary table or type value is refused (§ 1, § 14).

Load errors (quick list)

  • Unknown fields anywhere: header, patterns, parameters, steps, outputs, branch tables, list references, restore references, text tables, step-specific properties (§ 1).
  • Header not declaring the pattern-language compatibility marker; retired-format files are refused, never translated (§ 1, § 15).
  • Duplicate pattern names across the composed closure; any declaration named nothing (§ 2, § 3).
  • Duplicate step or output names anywhere in the composed definition (§ 5).
  • Parameter names empty, duplicated within the pattern, or reserved; more than one declared_plan_source (§ 4).
  • An output name or a path declared twice at one scope; colliding run-scoped paths in a for body (§ 7).
  • then table not matching the output's values vocabulary exactly; testing a value outside the declared vocabulary; step-outcome if without then; if with neither then nor else (§ 8).
  • Command text containing {{...}} outside a whole-field typed slot (§ 5).
  • A recursive call not in tail position on every path (§ 11).

docs/patterns/reference-card.md in the Gantry repository, rendered as it stands