agent-contracts 0.19.4 → 0.20.0

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Declarative YAML DSL toolkit for defining, validating, and rendering multi-agent development workflows. Provides static validation, semantic linting, prompt rendering, guardrail generation, and completeness scoring for agent contract definitions.
4
4
 
5
- **Version:** 0.19.1
5
+ **Version:** 0.19.4
6
6
 
7
7
  ## Table of Contents
8
8
 
@@ -72,7 +72,7 @@ agent-contracts resolve -c agent-contracts.config.yaml
72
72
 
73
73
  **Exit 0:** Resolved DSL output successfully.
74
74
 
75
- - **stdout:** format=`text`
75
+ - **stdout:** format=`{options.format}`
76
76
 
77
77
  **Exit 1:** Resolution failed (file not found, parse error, or config error).
78
78
 
@@ -87,6 +87,9 @@ x-agent:
87
87
  idempotent: true
88
88
  sideEffects:
89
89
 
90
+ expectedDurationMs: 3000
91
+ retryableExitCodes:
92
+
90
93
  ```
91
94
 
92
95
  ---
@@ -135,7 +138,7 @@ agent-contracts validate --quiet
135
138
 
136
139
  **Exit 0:** Validation passed. No errors found.
137
140
 
138
- - **stdout:** format=`text`
141
+ - **stdout:** format=`{options.format}`
139
142
 
140
143
  **Exit 1:** Validation failed or unexpected error.
141
144
 
@@ -150,6 +153,9 @@ x-agent:
150
153
  idempotent: true
151
154
  sideEffects:
152
155
 
156
+ expectedDurationMs: 3000
157
+ retryableExitCodes:
158
+
153
159
  ```
154
160
 
155
161
  ---
@@ -195,7 +201,7 @@ agent-contracts lint --format json
195
201
 
196
202
  **Exit 0:** Lint passed. No errors or warnings.
197
203
 
198
- - **stdout:** format=`text`
204
+ - **stdout:** format=`{options.format}`
199
205
 
200
206
  **Exit 1:** Lint failed or unexpected error.
201
207
 
@@ -210,6 +216,9 @@ x-agent:
210
216
  idempotent: true
211
217
  sideEffects:
212
218
 
219
+ expectedDurationMs: 3000
220
+ retryableExitCodes:
221
+
213
222
  ```
214
223
 
215
224
  ---
@@ -258,11 +267,17 @@ x-agent:
258
267
  riskLevel: medium
259
268
  requiresConfirmation: false
260
269
  idempotent: true
270
+ idempotentNote: Output is deterministic from DSL input and templates. Repeated runs produce identical files. Confirmation is not required because the command is idempotent and --check provides a side-effect-free preview mode.
261
271
  sideEffects:
262
272
  - file_write
273
+ sideEffectNote: Writes rendered files to configured output paths. No file writes occur when --check is specified.
274
+ safeDryRunOption: check
263
275
  recommendedBeforeUse:
264
276
  - Ensure agent-contracts.config.yaml exists with render targets.
265
277
  - Run validate first to confirm DSL is valid.
278
+ expectedDurationMs: 5000
279
+ retryableExitCodes:
280
+
266
281
  ```
267
282
 
268
283
  ---
@@ -271,7 +286,7 @@ x-agent:
271
286
 
272
287
  Run full pipeline — resolve, validate, lint, render --check.
273
288
 
274
- Executes the complete verification pipeline in order: resolve DSL, validate schema and references, run lint rules, and check for render drift. Also verifies cross-team interface imports and team-interface.yaml drift when applicable.
289
+ Executes the complete verification pipeline in order: (1) resolve DSL, (2) validate schema and references, (3) run lint rules, (4) check render drift via render --check. Steps 1–4 always run. Additionally, when the DSL declares cross-team interfaces, (5) verifies interface import consistency and (6) checks team-interface.yaml drift. Steps 5–6 are skipped when no cross-team interfaces exist.
275
290
 
276
291
  **Usage:**
277
292
 
@@ -299,7 +314,7 @@ agent-contracts check --format json --quiet
299
314
 
300
315
  **Exit 0:** All checks passed.
301
316
 
302
- - **stdout:** format=`text`
317
+ - **stdout:** format=`{options.format}`
303
318
 
304
319
  **Exit 1:** One or more checks failed — validation errors, lint errors, render drift, or missing interface files.
305
320
 
@@ -316,6 +331,9 @@ x-agent:
316
331
 
317
332
  recommendedBeforeUse:
318
333
  - Ensure agent-contracts.config.yaml exists.
334
+ expectedDurationMs: 10000
335
+ retryableExitCodes:
336
+
319
337
  ```
320
338
 
321
339
  ---
@@ -360,7 +378,7 @@ agent-contracts score -c agent-contracts.config.yaml
360
378
 
361
379
  **Exit 0:** Score calculated (and above threshold if specified).
362
380
 
363
- - **stdout:** format=`text`
381
+ - **stdout:** format=`{options.format}`
364
382
 
365
383
  **Exit 1:** Score below threshold, schema validation failed, or unexpected error.
366
384
 
@@ -375,6 +393,9 @@ x-agent:
375
393
  idempotent: true
376
394
  sideEffects:
377
395
 
396
+ expectedDurationMs: 5000
397
+ retryableExitCodes:
398
+
378
399
  ```
379
400
 
380
401
  ---
@@ -426,22 +447,31 @@ agent-contracts audit dsl --scope agents:architect,implementer -c config.yaml
426
447
  | `--dry-run` | | No | `false` | Output the audit prompt without calling LLM. |
427
448
  | `--adapter` | | No | | SDK adapter to use for LLM calls (overrides config audit.adapter). |
428
449
  | `--model` | | No | | LLM model override (overrides config audit.model). |
450
+ | `--fail-on` | | No | `"critical"` | Minimum finding severity that causes exit 10 (info|warning|error|critical). |
451
+ | `--output` | -o | No | | Write result to a file instead of stdout. |
452
+ | `--report-format` | | No | `"text"` | Alias for --format. When both are specified, --report-format takes precedence. |
429
453
 
430
454
  #### Exit Codes
431
455
 
432
- **Exit 0:** No critical findings detected.
456
+ **Exit 0:** Audit succeeded. No findings at or above --fail-on threshold.
433
457
 
434
- - **stdout:** format=`text`
458
+ - **stdout:** format=`{options.format}`
435
459
 
436
- **Exit 1:** Critical findings detected.
460
+ **Exit 1:** Unexpected error (invalid input, config error, or internal failure).
437
461
 
438
- - **stdout:** format=`text`
462
+ - **stderr:** format=`text`
463
+
464
+ **Exit 10:** Findings at or above --fail-on severity threshold detected.
465
+
466
+ - **stdout:** format=`{options.format}`
467
+
468
+ - **stderr:** format=`text`
439
469
 
440
- **Exit 2:** Invalid input or configuration error.
470
+ **Exit 11:** Runtime dependency missing (agent-contracts-runtime not installed).
441
471
 
442
472
  - **stderr:** format=`text`
443
473
 
444
- **Exit 3:** LLM adapter error (API failure, runtime not installed).
474
+ **Exit 12:** LLM provider or adapter error (API failure, auth error).
445
475
 
446
476
  - **stderr:** format=`text`
447
477
 
@@ -449,11 +479,17 @@ agent-contracts audit dsl --scope agents:architect,implementer -c config.yaml
449
479
 
450
480
  ```yaml
451
481
  x-agent:
452
- riskLevel: low
482
+ riskLevel: medium
453
483
  requiresConfirmation: false
454
- idempotent: true
484
+ idempotent: false
485
+ idempotentNote: Safe to repeat (no persistent side effects beyond network calls), but LLM inference is non-deterministic — identical inputs may produce different findings, severity assignments, and recommendation text across runs.
455
486
  sideEffects:
456
-
487
+ - network
488
+ sideEffectNote: Makes LLM API calls to the configured adapter (e.g. OpenAI, Gemini, Cursor) unless --dry-run is specified. Incurs token cost and sends DSL content to the LLM provider.
489
+ safeDryRunOption: dry-run
490
+ expectedDurationMs: 120000
491
+ retryableExitCodes:
492
+ - 12
457
493
  recommendedBeforeUse:
458
494
  - Ensure agent-contracts.config.yaml exists with render targets.
459
495
  - Run validate first to confirm DSL is valid.
@@ -527,11 +563,17 @@ x-agent:
527
563
  riskLevel: medium
528
564
  requiresConfirmation: false
529
565
  idempotent: true
566
+ idempotentNote: Output is deterministic from DSL input, policies, and bindings. Repeated runs produce identical files. Confirmation is not required because the command is idempotent and --dry-run provides a side-effect-free preview mode.
530
567
  sideEffects:
531
568
  - file_write
569
+ sideEffectNote: Writes guardrail binding files or team interface files to configured output paths. No file writes occur when --dry-run is specified.
570
+ safeDryRunOption: dry-run
532
571
  recommendedBeforeUse:
533
572
  - Ensure agent-contracts.config.yaml exists with binding definitions.
534
573
  - Run validate first to confirm DSL is valid.
574
+ expectedDurationMs: 5000
575
+ retryableExitCodes:
576
+
535
577
  ```
536
578
 
537
579
  ---
@@ -0,0 +1,18 @@
1
+ version: 1
2
+ system:
3
+ id: dsl-management-base
4
+ name: DSL Management Base
5
+ default_workflow_order:
6
+ - dsl-update
7
+ - dsl-audit
8
+
9
+ agents: { $ref: "./agents/" }
10
+ tasks: { $ref: "./tasks.yaml" }
11
+ artifacts: { $ref: "./artifacts.yaml" }
12
+ tools: { $ref: "./tools.yaml" }
13
+ validations: { $ref: "./validations.yaml" }
14
+ handoff_types: { $ref: "./handoff-types.yaml" }
15
+ workflow: { $ref: "./workflow.yaml" }
16
+ guardrails: { $ref: "./guardrails.yaml" }
17
+ guardrail_policies: { $ref: "./guardrail-policies.yaml" }
18
+ components: { $ref: "./components.yaml" }
@@ -0,0 +1,2 @@
1
+ dsl: ./agent-contracts.yaml
2
+ generated_dir: ../src/generated/dsl-base
@@ -0,0 +1,176 @@
1
+ dsl-auditor:
2
+ role_name: DSL Auditor
3
+ purpose: >-
4
+ Audit completeness of agent-contracts DSL definitions against generated
5
+ agent prompts, detect gaps, and present improvement recommendations.
6
+ mode: read-write
7
+ can_read_artifacts:
8
+ - dsl-source
9
+ - dsl-generated-output
10
+ - dsl-audit-report
11
+ - dsl-score-report
12
+ can_write_artifacts:
13
+ - dsl-audit-report
14
+ can_invoke_agents:
15
+ - dsl-auditor
16
+ can_execute_tools:
17
+ - agent-contracts-cli
18
+ can_perform_validations:
19
+ - dsl-completeness-audit
20
+ - dsl-audit-report-validation
21
+ can_return_handoffs:
22
+ - dsl-audit-result
23
+ guardrails:
24
+ - dsl-readonly-enforcement
25
+ responsibilities:
26
+ - Cross-check DSL definitions against generated prompts across 19 dimensions
27
+ - Classify detected gaps as template gap, data gap, or DSL gap
28
+ - Prioritize improvement recommendations (P0/P1/P2) with concrete fix proposals
29
+ - Report score-based improvement areas as audit recommendations (read-only; consumes dsl-score-report produced by dsl-designer)
30
+ - Review DSL design for semantic coherence (role overlap, scope breadth, gate placement)
31
+ - Verify generated prompts faithfully represent DSL intent (no hallucinated permissions)
32
+ constraints:
33
+ - Do not directly modify DSL definitions (read-only analysis)
34
+ - Do not execute agent-contracts score independently; consume dsl-score-report produced by dsl-designer only
35
+ - Recommendations must include concrete YAML or template fix proposals
36
+ - Findings must be classified as PASS / MISS / PARTIAL / N/A
37
+ rules:
38
+ - id: R-AUDIT-001
39
+ description: >-
40
+ Audit must cover all 19 dimensions: purpose, mode, can_read_artifacts,
41
+ can_write_artifacts, can_invoke_agents, tools, can_perform_validations,
42
+ responsibilities, constraints, rules, escalation_criteria, x-authority,
43
+ supported_tasks, delegatable_tasks, handoff_schemas, guardrails,
44
+ anti_patterns, x-audit-checklist, x-sections.
45
+ severity: mandatory
46
+ - id: R-AUDIT-002
47
+ description: >-
48
+ When a MISS is detected, classify the root cause as one of:
49
+ template gap, data gap, or DSL gap.
50
+ severity: mandatory
51
+ escalation_criteria:
52
+ - condition: 3 or more critical-level gaps detected
53
+ action: stop_and_report
54
+ - condition: Structural defect detected in templates
55
+ action: stop_and_report
56
+ sections:
57
+ - title: "Audit Procedure"
58
+ content: |
59
+ **Phase 1: Source Collection**
60
+ - Read all agent definitions from `agent-contracts/dsl/agents/*.yaml`
61
+ - Read all generated prompts from the rendering output directory
62
+ - Read the agent prompt template (`.hbs`)
63
+
64
+ **Phase 2: Cross-check (19 Dimensions)**
65
+
66
+ | # | Dimension | Importance |
67
+ |---|-----------|------------|
68
+ | 1 | purpose | high |
69
+ | 2 | mode | high |
70
+ | 3 | can_read_artifacts | high |
71
+ | 4 | can_write_artifacts + required_validations | **critical** |
72
+ | 5 | can_invoke_agents | high |
73
+ | 6 | tools (can_execute_tools → tools.yaml) | medium |
74
+ | 7 | can_perform_validations | high |
75
+ | 8 | responsibilities | high |
76
+ | 9 | constraints | high |
77
+ | 10 | rules (id, severity, description) | high |
78
+ | 11 | escalation_criteria | high |
79
+ | 12 | x-authority (can_decide / cannot_decide) | **critical** |
80
+ | 13 | supported_tasks | high |
81
+ | 14 | delegatable_tasks | high |
82
+ | 15 | handoff_schemas (allOf $ref resolved) | **critical** |
83
+ | 16 | guardrails | high |
84
+ | 17 | anti_patterns | low |
85
+ | 18 | x-audit-checklist | medium |
86
+ | 19 | x-sections | medium |
87
+
88
+ **Phase 3: Template Root-Cause Analysis**
89
+ - Template gap: rendering logic does not exist for the dimension
90
+ - Data gap: logic exists but the CLI does not pass the data
91
+ - DSL gap: YAML definition is incomplete or missing
92
+
93
+ **Phase 4: Recommendations**
94
+ - Template fix proposals (additional `.hbs` sections)
95
+ - DSL fix proposals (YAML corrections)
96
+ - Regeneration instructions (`npx agent-contracts render`)
97
+
98
+ - title: "Verdict Criteria"
99
+ content: |
100
+ | Verdict | Meaning |
101
+ |---------|---------|
102
+ | PASS | DSL definition is accurately reflected in generated output |
103
+ | MISS | DSL definition exists but is not reflected in generated output |
104
+ | PARTIAL | Only partially reflected (e.g. some list items missing) |
105
+ | N/A | DSL definition is empty array or undefined; inspection not required |
106
+
107
+ Severity classification:
108
+
109
+ | Severity | Description |
110
+ |----------|-------------|
111
+ | critical | Gap directly impacts governance decisions (authority, write permissions) |
112
+ | warning | Gap affects task quality (validations, tool details) |
113
+ | info | Observation about information redundancy |
114
+
115
+ - title: "Role Boundary with DSL Designer"
116
+ content: |
117
+ **RACI Matrix — DSL quality activities:**
118
+
119
+ | Activity | dsl-designer | dsl-auditor |
120
+ |----------|-------------|-------------|
121
+ | Create/update DSL definitions | R/A | — |
122
+ | Run validate / lint | R/A | — |
123
+ | Run render | R/A | — |
124
+ | Run score | R/A | C (consumes report) |
125
+ | Run generate guardrails | R/A | — |
126
+ | 19-dimension completeness audit | — | R/A |
127
+ | Semantic design review | — | R/A |
128
+ | Prompt fidelity audit | — | R/A |
129
+ | Produce improvement recommendations | I | R/A |
130
+
131
+ **Permitted CLI commands for dsl-auditor:**
132
+ - `agent-contracts audit` (all types)
133
+ - Read-only commands: `validate`, `lint`, `score` (for verification, not production)
134
+
135
+ **Prohibited CLI commands for dsl-auditor:**
136
+ - `render` (modifies generated output)
137
+ - `generate guardrails` (modifies runtime artifacts)
138
+
139
+ **Key distinction:** dsl-designer performs build-time verification
140
+ (validate → lint → render → score) as part of the update workflow.
141
+ dsl-auditor performs independent post-build audit to detect gaps
142
+ the build-time tools cannot catch (semantic coherence, prompt fidelity).
143
+
144
+ - title: "Semantic Design Review Dimensions"
145
+ content: |
146
+ When performing `audit dsl` (semantic design audit), check:
147
+
148
+ | # | Dimension | Severity |
149
+ |---|-----------|----------|
150
+ | 1 | dispatch_only agent holding implementation responsibilities | critical |
151
+ | 2 | Agent responsibility scope too broad (> 8 responsibilities) | warning |
152
+ | 3 | Role overlap between agents (shared responsibilities) | warning |
153
+ | 4 | Handoff schema missing fields for task completion_criteria | critical |
154
+ | 5 | Workflow gates placed after the task they should guard | critical |
155
+ | 6 | Guardrails declared but absent from execution path | warning |
156
+ | 7 | Semantic validations concentrated only in late phases | warning |
157
+ | 8 | Task with no completion_criteria defined | warning |
158
+ | 9 | Agent can_write without corresponding required_validations | warning |
159
+ | 10 | Circular delegation chains in workflow steps | critical |
160
+
161
+ - title: "Prompt Audit Dimensions"
162
+ content: |
163
+ When performing `audit prompt` (generated prompt audit), check:
164
+
165
+ | # | Dimension | Severity |
166
+ |---|-----------|----------|
167
+ | 1 | DSL responsibilities missing from generated prompt | critical |
168
+ | 2 | DSL constraints missing from generated prompt | critical |
169
+ | 3 | Permissions in prompt not declared in DSL | critical |
170
+ | 4 | Tools in prompt not in can_execute_tools | warning |
171
+ | 5 | Ambiguous instructions (conflicting or vague directives) | warning |
172
+ | 6 | Unsafe instructions (missing guardrail enforcement) | critical |
173
+ | 7 | Handoff schema expectations inconsistent with prompt | warning |
174
+ | 8 | Task completion criteria not reflected in prompt | warning |
175
+ | 9 | Delegatable tasks not described in prompt | info |
176
+ | 10 | Guardrail rules not reflected in prompt | warning |