State Bag Variables
Complete list of all variables available in prompt templates and workflow expressions.Spec variable
| Variable | Available | Description |
|---|---|---|
{spec} | Always | Full content of the spec file passed to gump run |
Step output variables
Available after the referenced step has executed.| Variable | Description |
|---|---|
{steps.<n>.output} | Main output: git patch (diff), JSON (plan), text (artifact), JSON (review) |
{steps.<n>.files} | Comma-separated list of files changed (diff steps only) |
{steps.<n>.status} | pass, fail, or fatal |
{steps.<n>.duration} | Duration in milliseconds |
{steps.<n>.cost} | Estimated cost in USD |
{steps.<n>.turns} | Number of cognitive turns |
{steps.<n>.retries} | Number of retries executed |
{steps.<n>.tokens_in} | Input tokens consumed |
{steps.<n>.tokens_out} | Output tokens produced |
{steps.<n>.cache_read} | Cache read tokens |
{steps.<n>.cache_write} | Cache write tokens |
{steps.<n>.session_id} | Agent session ID (provider-specific) |
{steps.<n>.check_result} | Gate result: pass, fail, or none |
Sub-workflow variables
After aworkflow: step completes, its state bag is accessible recursively:
| Variable | Description |
|---|---|
{steps.<n>.steps.<m>.output} | Output of step m inside sub-workflow n |
{steps.<n>.steps.<m>.*} | Any metric from the sub-workflow’s step |
{steps.<n>.run.cost} | Total cost of the sub-workflow run |
Item variables (foreach)
Available inside aforeach block, for the current item.
| Variable | Description |
|---|---|
{item.name} | Item name (from the plan JSON) |
{item.description} | Item description |
{item.files} | Item blast radius (file list) |
Run-level variables
Aggregate metrics for the entire run. Updated after each step.| Variable | Description |
|---|---|
{run.cost} | Total cost so far (USD) |
{run.duration} | Elapsed time (ms) |
{run.tokens_in} | Total input tokens |
{run.tokens_out} | Total output tokens |
{run.retries} | Total retries across all steps |
{run.status} | running, pass, fatal, aborted |
Retry variables
Available when a step is retried (attempt > 1).| Variable | Description |
|---|---|
{error} | Stderr from the failed gate or guard reason (truncated to 2000 chars) |
{diff} | Git diff from the failed attempt (truncated to 3000 chars) |
Resolution order
Variables resolve by proximity: same group first, then parent, then root. If{steps.impl.output} exists both in the current group and a parent group, the current group’s version wins. Use --dry-run to check for ambiguity — Gump will reject workflows with ambiguous variable references.
Template escaping
| Syntax | Result |
|---|---|
{variable} | Resolved from the state bag |
{{ | Literal { character |
}} | Literal } character |
{steps.review.output} disappears cleanly on the first iteration when no review has run yet.