agent-contracts 0.13.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -180,6 +180,7 @@ An **Agent** defines who an execution entity is:
180
180
  * permissions
181
181
  * constraints
182
182
  * behavioral rules
183
+ * structured content sections (reference material, procedures, criteria)
183
184
 
184
185
  ### Task
185
186
 
@@ -317,6 +318,7 @@ Design regressions become testable.
317
318
  ## Features
318
319
 
319
320
  * **Declarative YAML DSL** for multi-agent development workflows
321
+ * **Agent `sections`** for embedding structured reference material, procedures, and criteria directly in agent definitions
320
322
  * **Static schema validation**
321
323
  * **Reference integrity checks**
322
324
  * **Semantic linting**
@@ -574,9 +576,11 @@ agents:
574
576
  constraints:
575
577
  - "Never write code directly"
576
578
 
577
- x-identity: |
578
- You act as the Architect. You NEVER implement or test directly.
579
- Instead you delegate to specialist sub-agents.
579
+ sections:
580
+ - title: "Delegation Protocol"
581
+ content: |
582
+ You act as the Architect. You NEVER implement or test directly.
583
+ Instead you delegate to specialist sub-agents.
580
584
  ````
581
585
 
582
586
  ---
@@ -1166,7 +1170,7 @@ guardrail_policies:
1166
1170
 
1167
1171
  ### Software bindings
1168
1172
 
1169
- Bindings define software-specific check implementations:
1173
+ Bindings define software-specific check implementations, output generation, and rendering:
1170
1174
 
1171
1175
  ````yaml
1172
1176
  # bindings/cursor.yaml
@@ -1188,6 +1192,19 @@ outputs:
1188
1192
  mode: write
1189
1193
  executable: true
1190
1194
  template: ./templates/cursor-hook-wrapper.sh.hbs
1195
+
1196
+ renders:
1197
+ - context: agent
1198
+ output: "{cursor_root}/agent-team/{agent.id}.md"
1199
+ template: ./templates/agent-prompt.md.hbs
1200
+ exclude:
1201
+ - architect
1202
+ - context: system
1203
+ output: "{cursor_root}/rules/agent-team.mdc"
1204
+ inline_template: |
1205
+ {{#each agents}}
1206
+ - {{@key}}: {{this.role_name}}
1207
+ {{/each}}
1191
1208
  ````
1192
1209
 
1193
1210
  ### Binding inheritance
@@ -1244,6 +1261,7 @@ Merge behavior:
1244
1261
  | `software` | Project wins |
1245
1262
  | `guardrail_impl` | Map merge by guardrail ID (new IDs added; same ID deep-merged) |
1246
1263
  | `outputs` | Map merge by output ID (project overrides base) |
1264
+ | `renders` | Array concatenation (base renders + project renders) |
1247
1265
  | `reporting` | Deep merge (project fields override base) |
1248
1266
  | passthrough fields | Project wins |
1249
1267
 
@@ -1275,6 +1293,62 @@ paths:
1275
1293
  git_hooks_root: scripts/git-hooks
1276
1294
  ````
1277
1295
 
1296
+ ### Binding template context
1297
+
1298
+ Both `outputs` and `renders` templates have access to the full binding generation context:
1299
+
1300
+ | Variable | Type | Description |
1301
+ |----------|------|-------------|
1302
+ | `system` | `{ id, name }` | System metadata |
1303
+ | `guardrails` | `Record<string, Guardrail>` | All guardrail definitions |
1304
+ | `policy` | `GuardrailPolicy` | Active guardrail policy |
1305
+ | `binding` | `SoftwareBinding` | Current binding |
1306
+ | `all_bindings` | `Record<string, SoftwareBinding>` | All loaded bindings |
1307
+ | `vars` | `Record<string, string>` | Variables from `config.vars` |
1308
+ | `paths` | `Record<string, string>` | Path variables from `config.paths` |
1309
+ | `reporting` | `{ commands, fail_open, timeout_ms } \| null` | Reporting config |
1310
+ | `resolved_checks` | `ResolvedCheck[]` | Resolved guardrail checks |
1311
+ | `tasks` | `Record<string, Task>` | All DSL tasks |
1312
+ | `artifacts` | `Record<string, Artifact>` | All DSL artifacts |
1313
+ | `agents` | `Record<string, Agent>` | All DSL agents |
1314
+ | `handoff_types` | `Record<string, HandoffType>` | All DSL handoff types |
1315
+ | `workflow` | `Record<string, Workflow>` | All DSL workflows |
1316
+
1317
+ DSL entities include passthrough fields (`x-*` extensions), so custom metadata defined in the DSL is accessible in templates (e.g., `{{agents.implementer.x-team}}`).
1318
+
1319
+ ### Binding renders
1320
+
1321
+ Binding `renders` provide entity-iteration rendering with full DSL context — the same capability as config-level `renders`, but defined within binding YAML files.
1322
+
1323
+ Each render target specifies a `context` type and an `output` path pattern:
1324
+
1325
+ | Field | Required | Description |
1326
+ |-------|----------|-------------|
1327
+ | `context` | yes | Entity type: `agent`, `task`, `artifact`, `tool`, `workflow`, `system`, etc. |
1328
+ | `output` | yes | Output path with `{entity.id}` and `{paths_var}` expansion |
1329
+ | `template` | one of | Path to external `.hbs` template file |
1330
+ | `inline_template` | one of | Inline Handlebars template string |
1331
+ | `include` | no | Only render these entity IDs |
1332
+ | `exclude` | no | Skip these entity IDs |
1333
+ | `skip_empty` | no | Delete target if rendered output is empty |
1334
+ | `executable` | no | Set file permissions to 0755 |
1335
+
1336
+ For non-`system` contexts, one file is generated per entity (filtered by `include`/`exclude`). The output path supports two types of variable expansion:
1337
+
1338
+ - `{agent.id}`, `{task.id}`, etc. — replaced with the current entity ID
1339
+ - `{cursor_root}`, `{observability_root}`, etc. — replaced from `config.paths`
1340
+
1341
+ **When to use binding renders vs config renders vs binding outputs:**
1342
+
1343
+ | Use case | Recommended |
1344
+ |----------|-------------|
1345
+ | Generate per-entity files (agent prompts, workflow docs) | Binding `renders` or config `renders` |
1346
+ | Generate guardrail/policy runtime artifacts | Binding `outputs` |
1347
+ | Generate files using DSL data + guardrail data | Binding `renders` (has both) |
1348
+ | Simple config without bindings | Config `renders` |
1349
+
1350
+ Config `renders` remains supported and is not deprecated. Binding `renders` offers the advantage of co-locating templates with their binding definition and having access to the full binding context (`vars`, `paths`, `resolved_checks`, etc.) in addition to DSL entities.
1351
+
1278
1352
  ### Generate command
1279
1353
 
1280
1354
  ````bash