11# Canonical st2 agent specification
22
33This is the sole agent-authoring specification for this repository. It is pinned to st2
4- [ ` 9887b2842222def0838c2cd82e6c24c218f7efa6 ` ] ( https://github.com/compoundingtech/st2/commit/9887b2842222def0838c2cd82e6c24c218f7efa6 )
5- (` 0.1.0 ` , source ` 9887b28 ` ). It documents the hand-authored KDL accepted at that commit. Do not infer
4+ [ ` 0fed14bb5653b67e1d64f1199e240c4c5c612bf7 ` ] ( https://github.com/compoundingtech/st2/commit/0fed14bb5653b67e1d64f1199e240c4c5c612bf7 )
5+ (` 0.1.0+0fed14b ` , source ` 0fed14b ` ). It documents the hand-authored KDL accepted at that commit. Do not infer
66additional fields or commands from older corpus fixtures.
77
88st2 runs long-lived ` service ` agents made of interactive ` pty ` tasks and terminal-free ` exec ` tasks.
@@ -46,6 +46,8 @@ agent "<identity>" {
4646 retired #false
4747 keep #false
4848
49+ resource "work" _tag="github-issue" uri="github-issue://example/project/123"
50+
4951 restart {
5052 attempts 3
5153 interval "60s"
@@ -82,6 +84,7 @@ Supported agent children are:
8284| ` supervisor "…" ` | Optional bare identity or full bus id for crash-loop routing. |
8385| ` retired #true ` | Decommission the declaration on the next reconciliation. Edit this flag; do not delete a live declaration to retire it. |
8486| ` keep #true ` | Freeze dead evidence and suppress collection/restart for every task; retirement still stops live tasks. |
87+ | ` resource "name" _tag="type" uri="absolute-uri" ` | Binds one uniquely named, externally identified Resource as declaration metadata. |
8588| ` restart { … } ` | Optional service restart policy. |
8689| ` env { KEY "value" } ` | Environment inherited by the compact agent task and sidecars. |
8790| ` command "…" ` | Compact interactive task named ` agent ` . |
@@ -100,6 +103,41 @@ the window reset; `mode "fail"` parks the task after attempts are exhausted and
100103crash-loop message to ` supervisor ` . Invalid restart subfields currently fall back to defaults; authors must not
101104rely on that permissiveness.
102105
106+ ## Resource bindings
107+
108+ An agent may directly carry zero or more Resource bindings:
109+
110+ ``` kdl
111+ resource "work" _tag="github-issue" uri="github-issue://example/project/123"
112+ resource "source" _tag="worktree" uri="worktree://example/project/main"
113+ ```
114+
115+ The positional name is the Resource's agent-local semantic role. Names are non-empty and unique within one
116+ agent. ` _tag ` is a non-empty, opaque discriminator owned by the Resource type's downstream contract. ` uri ` is
117+ an RFC 3986 absolute URI and is the Resource identity. st2 preserves the URI's exact bytes; it does not
118+ normalize or resolve it. Declaration order has no meaning. Canonical KDL and supported TOML/JSON parsing lower
119+ bindings to deterministic name order.
120+
121+ The generic envelope is closed: each binding has exactly the positional name, ` _tag ` , and ` uri ` . Missing or
122+ duplicate fields, duplicate names, child nodes, invalid URI syntax, and unsupported properties such as access
123+ or readiness policy fail validation. This prevents an ignored property from appearing enforced.
124+
125+ Resource bindings are declaration metadata, not launch targets. They do not make an otherwise unrunnable
126+ service runnable and are excluded from effective task launch definitions. Editing only Resource bindings
127+ therefore updates catalog inspection while an already-live task is adopted without stop, replacement, or
128+ relaunch. ` st2 agents --json [--enrich] ` exposes every binding as a name-ordered
129+ ` {"name","_tag","uri"} ` descriptor and preserves unknown downstream tags.
130+
131+ The envelope does not define Resource schemas, resolution, access grants, required/optional status, readiness,
132+ lifecycle, mutation, or rendering. A URI's presence grants no authority. Those semantics belong to the
133+ concrete Resource type and its consumer, not st2.
134+
135+ Executable evidence:
136+ [ ` agent-spec-resource-bindings ` ] ( cells/agent-spec-resource-bindings/ ) covers strict parser failures,
137+ deterministic JSON inspection, exact URI and unknown-tag preservation, Resource-only live adoption, and
138+ cleanup. The matched [ ` assignment-contract-* ` ] ( cells/ ) tournament covers direct Resource selection against
139+ Focus and Assignment controls; direct bindings are the selected treatment.
140+
103141## Compact and explicit tasks
104142
105143The canonical compact pair:
@@ -392,7 +430,7 @@ Codex launch explicitly selects `gpt-5.6-sol` at medium reasoning effort.
392430
393431The folder-eval grammar preserves its ` team ` , ` eval ` , kickoff, timeout, and held-out judge shape. Its
394432agent projection supports ` workspace ` , ` supervisor ` , ` env ` , ` command ` , explicit ` exec ` , and bare
395- ` ding ` ; it does not accept a catalog ` render ` block . For that grammar, ` eval { copy … } ` and a
433+ ` ding ` ; it does not accept catalog ` resource ` or ` render ` nodes . For that grammar, ` eval { copy … } ` and a
396434deterministic pre-boot materializer must place the equivalent harness files in each declared
397435workspace:
398436
@@ -415,9 +453,9 @@ agent { command "true" }
415453At the pinned source it validates as one agent with zero errors and warnings. Production declarations should
416454normally make identity, host, ` ST_AGENT ` , workspace, and the real harness command explicit.
417455
418- The complete declaration, compact pair, explicit PTY/exec blocks, restart policy, and render block earlier in
419- this document collectively exercise every implemented authoring field. Before validating/materializing the
420- example, create every ` $CATALOG ` -rooted workspace it names.
456+ The complete declaration, Resource bindings, compact pair, explicit PTY/exec blocks, restart policy, and
457+ render block earlier in this document collectively exercise every implemented authoring field. Before
458+ validating/materializing the example, create every ` $CATALOG ` -rooted workspace it names.
421459
422460## Free authoring gate
423461
@@ -432,8 +470,11 @@ Inspect the declaration, every referenced template, and every workspace destinat
432470materialization command. Materialization is byte-idempotent and does not imply hook installation. Starting
433471the network is a separate, explicitly authorized action.
434472
435- For source ` 9887b28 ` , the accepted Linux executable has SHA256
436- ` d49d44fd4f3f6f655455c212353a469fefa956082bedf22163deb767d8a36a0d ` ; its published archive has SHA256
437- ` 32ee103bd17ccb3e155ac63d816a3906c2470a3c98e3cc04b56e5a67138b9927 ` . ` bin/check-corpus.sh ` verifies
438- the variable-age version contract, exact installed binary, embedded full source commit, strict semantic
439- validation, fixture resets, and the rest of the model-free corpus gate before an eval may run.
473+ For source ` 0fed14b ` , the accepted pre-merge Nix-built Linux executable has SHA256
474+ ` 96b394f270f0a3eb25dd29574a96f30d527a56bee63c2499d6db7e4a58707648 ` . There is no published portable
475+ archive for this unmerged commit. After ` compoundingtech/st2#86 ` merges, this pin must move to its accepted
476+ release and record the fresh-download archive hash before the corpus is ready. ` bin/check-corpus.sh ` verifies
477+ the variable-age Nix version contract, exact installed candidate binary, strict semantic validation, fixture
478+ resets, and the rest of the model-free corpus gate before an eval may run. The pre-merge Nix stamp embeds only
479+ the short revision, so the full source link above is review/build provenance rather than a claim extracted
480+ from the binary; the post-merge portable release must restore fresh-download full-source proof.
0 commit comments