context block declares a named set of deployment labels and settings. Stacks opt in by naming the context in their meta {} block. A context sits between a workspace {} and a per-stack meta {} in the resolution chain.
Syntax
prod_us) is a bare identifier immediately after the context keyword — not a quoted string. Use underscores, not hyphens: prod_us not prod-us.
Context names must be unique across the compilation unit. A duplicate produces a hard compile error.
Opting in from a stack
A stack opts in to a context via thecontext field inside its meta {} block:
labels sub-block
Declares the labels that this context contributes to the resolution chain. Labels are key-value string pairs. They are used byworkspace {} blocks with match {} to select which scoped workspace applies.
prod_us, its effective labels include env = "prod", region = "us-east-1", and tier = "critical". A label-scoped workspace with match { env = "prod" } then applies to that stack.
Fields
Acontext {} supports the same fields as workspace {}, except name, match {}, and plugins {} (which belong only to workspace {}).
| Field | Type | Default | Description |
|---|---|---|---|
engine | string | "native" | Execution engine — overrides any workspace value |
runtime | string | "xcl" | Codegen runtime — overrides any workspace value |
backend {} | block | — | State backend override |
provider {} | block | — | Provider config override |
tags {} | block | — | Additional tags (merged additively with workspace tags) |
hooks {} | block | — | Hook scripts (concatenated with workspace hooks) |
ai {} | block | — | AI feature toggle override |
scan {} | block | — | Security scan settings override |
telemetry {} | block | — | Telemetry settings override |
history {} | block | — | History settings override |
engine, runtime, and all sub-blocks except tags and hooks, the context value wins over the workspace value for any stack that opts into this context. Tags and hooks are always additive — they extend rather than replace.
backend sub-block
tags sub-block
Tags declared in a context are added to any tags set by a workspace block. They do not replace them.hooks sub-block
Hooks declared in a context are appended to the workspace hooks list. Order follows the resolution chain: workspace hooks first, then context hooks.Full example
Resolution chain position
Context sits at step 3 in the four-level resolution chain:- Universal
workspace {}— lowest priority - Label-matched
workspace {}— fields override step 1 context {}named by the stack’smeta { context = "..." }— fields override step 2meta {}insidestack {}— highest priority
meta {} override the context.
See meta for the full resolution reference.

