agent-contracts 0.19.4 → 0.19.5

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.
@@ -0,0 +1,73 @@
1
+ dsl-source:
2
+ type: config
3
+ description: >-
4
+ agent-contracts DSL source files — YAML definitions for agents, tasks,
5
+ artifacts, tools, validations, handoff_types, workflow, policies,
6
+ guardrails, guardrail_policies, and bindings.
7
+ owner: dsl-designer
8
+ producers:
9
+ - dsl-designer
10
+ editors:
11
+ - dsl-designer
12
+ consumers:
13
+ - dsl-auditor
14
+ states:
15
+ - draft
16
+ - validated
17
+ - rendered
18
+ required_validations:
19
+ - dsl-schema-validation
20
+ - dsl-lint-validation
21
+
22
+ dsl-generated-output:
23
+ type: doc
24
+ description: >-
25
+ Files generated from DSL via render — agent prompts, overview documents,
26
+ workflow commands, guardrail configurations, etc.
27
+ owner: dsl-designer
28
+ producers:
29
+ - dsl-designer
30
+ editors:
31
+ - dsl-designer
32
+ consumers:
33
+ - dsl-auditor
34
+ states:
35
+ - generated
36
+ - verified
37
+ required_validations:
38
+ - dsl-completeness-audit
39
+
40
+ dsl-score-report:
41
+ type: doc
42
+ description: >-
43
+ Output of agent-contracts score command — completeness evaluation
44
+ across 7 dimensions.
45
+ owner: dsl-designer
46
+ producers:
47
+ - dsl-designer
48
+ editors:
49
+ - dsl-designer
50
+ consumers:
51
+ - dsl-auditor
52
+ states:
53
+ - generated
54
+ required_validations:
55
+ - dsl-score-report-validation
56
+
57
+ dsl-audit-report:
58
+ type: doc
59
+ description: >-
60
+ DSL completeness audit report — PASS/MISS matrix across 19 dimensions,
61
+ gap analysis, and improvement recommendations.
62
+ owner: dsl-auditor
63
+ producers:
64
+ - dsl-auditor
65
+ editors:
66
+ - dsl-auditor
67
+ consumers:
68
+ - dsl-designer
69
+ states:
70
+ - submitted
71
+ required_validations:
72
+ - dsl-audit-report-validation
73
+ x-artifact-class: evidence
@@ -0,0 +1,2 @@
1
+ dsl: ./agent-contracts.yaml
2
+ renders: []
@@ -0,0 +1,110 @@
1
+ schemas:
2
+ agent-evidence:
3
+ type: object
4
+ description: Evidence supporting an agent finding.
5
+ required: [kind]
6
+ properties:
7
+ kind:
8
+ type: string
9
+ enum: [file, command, schema, diff, stdout, stderr, text]
10
+ target:
11
+ type: string
12
+ description: Target identifier (file path, command ID, schema name).
13
+ location:
14
+ type: string
15
+ description: Location within the target (line number, JSON pointer).
16
+ excerpt:
17
+ type: string
18
+ description: Relevant excerpt from the target.
19
+
20
+ agent-finding:
21
+ type: object
22
+ description: A single finding from an agent audit or analysis.
23
+ required: [severity, category, message]
24
+ properties:
25
+ id:
26
+ type: string
27
+ description: Unique finding identifier.
28
+ severity:
29
+ type: string
30
+ enum: [info, warning, error, critical]
31
+ category:
32
+ type: string
33
+ description: Finding category (e.g. missing-policy, inconsistent-risk).
34
+ target:
35
+ type: string
36
+ description: Target of the finding (command ID, schema path).
37
+ location:
38
+ type: string
39
+ description: Location within the target.
40
+ message:
41
+ type: string
42
+ recommendation:
43
+ type: string
44
+ confidence:
45
+ type: number
46
+ minimum: 0
47
+ maximum: 1
48
+ description: Confidence score (0-1) for LLM-generated findings.
49
+ evidence:
50
+ type: array
51
+ items:
52
+ $ref: "#/schemas/agent-evidence"
53
+ details:
54
+ type: object
55
+ additionalProperties: true
56
+
57
+ agent-recommended-action:
58
+ type: object
59
+ description: A recommended action from an agent audit.
60
+ required: [kind, title]
61
+ properties:
62
+ kind:
63
+ type: string
64
+ enum: [run_command, edit_file, review, confirm, block, ignore]
65
+ title:
66
+ type: string
67
+ command:
68
+ type: string
69
+ description: CLI command to run (for run_command kind).
70
+ target:
71
+ type: string
72
+ description: Target file or resource.
73
+ rationale:
74
+ type: string
75
+
76
+ agent-audit-result:
77
+ type: object
78
+ description: >-
79
+ Top-level result from an agent audit.
80
+ Canonical schema for agent interoperability across toolchains.
81
+ required: [summary, riskLevel, findings]
82
+ properties:
83
+ summary:
84
+ type: string
85
+ riskLevel:
86
+ type: string
87
+ enum: [low, medium, high, critical]
88
+ findings:
89
+ type: array
90
+ items:
91
+ $ref: "#/schemas/agent-finding"
92
+ recommendedActions:
93
+ type: array
94
+ items:
95
+ $ref: "#/schemas/agent-recommended-action"
96
+ metadata:
97
+ type: object
98
+ properties:
99
+ tool:
100
+ type: string
101
+ command:
102
+ type: string
103
+ version:
104
+ type: string
105
+ generatedAt:
106
+ type: string
107
+ adapter:
108
+ type: string
109
+ model:
110
+ type: string
@@ -0,0 +1,18 @@
1
+ dsl-management-policy:
2
+ description: >-
3
+ Guardrail policy governing DSL management operations.
4
+ Groups all DSL-related guardrails and specifies resolution
5
+ behavior.
6
+ rules:
7
+ - guardrail: dsl-readonly-enforcement
8
+ severity: critical
9
+ action: block
10
+ - guardrail: dsl-validate-before-render
11
+ severity: mandatory
12
+ action: block
13
+ - guardrail: dsl-no-hallucinated-permissions
14
+ severity: critical
15
+ action: block
16
+ escalation:
17
+ target: dsl-designer
18
+ condition: Hallucinated permissions detected in generated prompts
@@ -0,0 +1,46 @@
1
+ dsl-readonly-enforcement:
2
+ description: >-
3
+ Prevent audit-purpose agents from modifying DSL source files.
4
+ dsl-auditor is mode=read-write (to produce dsl-audit-report) but
5
+ must not write to dsl-source. This guardrail enforces that boundary.
6
+ scope:
7
+ agents:
8
+ - dsl-auditor
9
+ artifacts:
10
+ - dsl-source
11
+ rationale: >-
12
+ dsl-auditor uses mode=read-write because it produces dsl-audit-report,
13
+ but its constraints prohibit modifying DSL definitions. This guardrail
14
+ blocks writes to dsl-source from audit-purpose agents.
15
+
16
+ dsl-validate-before-render:
17
+ description: >-
18
+ Ensure DSL validation passes before rendering is attempted.
19
+ Prevents generation of prompts from invalid DSL definitions.
20
+ scope:
21
+ workflows:
22
+ - dsl-update
23
+ tasks:
24
+ - render-dsl-outputs
25
+ artifacts:
26
+ - dsl-generated-output
27
+ rationale: >-
28
+ render-dsl-outputs must not be invoked while validation_result
29
+ of update-dsl-definitions is not 'pass'.
30
+
31
+ dsl-no-hallucinated-permissions:
32
+ description: >-
33
+ Rendered prompts must not grant permissions not declared in DSL.
34
+ Detected via audit-generated-prompts; any hallucinated-permission
35
+ finding of severity critical must be escalated.
36
+ scope:
37
+ artifacts:
38
+ - dsl-generated-output
39
+ tasks:
40
+ - audit-generated-prompts
41
+ tools:
42
+ - agent-contracts-cli
43
+ rationale: >-
44
+ audit-generated-prompts detects permissions or tool references
45
+ in generated prompts that have no corresponding declaration
46
+ in the agent's DSL definition.
@@ -0,0 +1,182 @@
1
+ dsl-task-request:
2
+ version: 1
3
+ description: Request to execute a DSL management task
4
+ schema:
5
+ type: object
6
+ properties:
7
+ task_id:
8
+ type: string
9
+ description: Identifier of the task to execute
10
+ scope:
11
+ type: string
12
+ description: Scope of changes (agents, tasks, artifacts, workflow, bindings, etc.)
13
+ context:
14
+ type: string
15
+ description: Background and purpose of the change
16
+ required:
17
+ - task_id
18
+
19
+ dsl-task-result:
20
+ version: 3
21
+ description: Result of a DSL management task execution
22
+ schema:
23
+ type: object
24
+ properties:
25
+ changed_files:
26
+ type: array
27
+ items:
28
+ type: string
29
+ description: List of changed file paths
30
+ validation_result:
31
+ type: string
32
+ enum:
33
+ - pass
34
+ - fail
35
+ description: Result of agent-contracts validate
36
+ lint_result:
37
+ type: string
38
+ enum:
39
+ - pass
40
+ - fail
41
+ - skipped
42
+ description: Result of agent-contracts lint (separate from validate)
43
+ generate_result:
44
+ type: string
45
+ enum:
46
+ - pass
47
+ - fail
48
+ - skipped
49
+ description: >-
50
+ Result of agent-contracts generate guardrails (binding task).
51
+ Used by post-binding gate to block render on failure.
52
+ render_result:
53
+ type: string
54
+ enum:
55
+ - pass
56
+ - fail
57
+ - skipped
58
+ description: >-
59
+ Result of agent-contracts render execution.
60
+ Distinct from drift_detected — captures whether render itself succeeded.
61
+ drift_detected:
62
+ type: boolean
63
+ description: >-
64
+ True if render --check detected drift between DSL source
65
+ and generated outputs
66
+ cross_reference_check:
67
+ type: string
68
+ enum:
69
+ - pass
70
+ - fail
71
+ - skipped
72
+ description: >-
73
+ Result of cross-reference integrity verification for newly
74
+ added entities (update-dsl-definitions completion criterion).
75
+ score:
76
+ type: number
77
+ description: Score command result (0-100)
78
+ score_dimensions:
79
+ type: object
80
+ description: Per-dimension score breakdown
81
+ notes:
82
+ type: string
83
+ description: Additional notes or improvement suggestions
84
+ required:
85
+ - validation_result
86
+
87
+ audit-result:
88
+ version: 1
89
+ description: >-
90
+ Generic audit result for tool/agent execution.
91
+ Uses canonical agent-audit-result schema from components.schemas.
92
+ schema:
93
+ $ref: "#/components/schemas/agent-audit-result"
94
+
95
+ dsl-audit-result:
96
+ version: 3
97
+ description: Result of DSL audit (completeness, semantic design, or prompt fidelity)
98
+ schema:
99
+ type: object
100
+ properties:
101
+ audit_type:
102
+ type: string
103
+ enum:
104
+ - completeness
105
+ - semantic
106
+ - prompt
107
+ description: Which audit task produced this result
108
+ total_dimensions:
109
+ type: integer
110
+ description: Number of dimensions inspected
111
+ pass_count:
112
+ type: integer
113
+ description: Number of PASS dimensions
114
+ miss_count:
115
+ type: integer
116
+ description: Number of MISS dimensions
117
+ partial_count:
118
+ type: integer
119
+ description: Number of PARTIAL dimensions
120
+ agents_reviewed:
121
+ type: integer
122
+ description: Number of agents reviewed (semantic and prompt audits)
123
+ prompts_reviewed:
124
+ type: integer
125
+ description: Number of generated prompts compared (prompt audit)
126
+ gate_analysis_complete:
127
+ type: boolean
128
+ description: >-
129
+ True when workflow gate placement analysis has been performed
130
+ (semantic audit completion criterion).
131
+ guardrail_enforcement_verified:
132
+ type: boolean
133
+ description: >-
134
+ True when all declared guardrails have been verified to exist
135
+ in execution paths (semantic audit completion criterion).
136
+ critical_gaps:
137
+ type: array
138
+ items:
139
+ type: object
140
+ properties:
141
+ dimension:
142
+ type: string
143
+ agent:
144
+ type: string
145
+ gap_type:
146
+ type: string
147
+ enum:
148
+ - template_gap
149
+ - data_gap
150
+ - dsl_gap
151
+ severity:
152
+ type: string
153
+ enum:
154
+ - critical
155
+ - warning
156
+ - info
157
+ description: List of detected gaps
158
+ recommendations:
159
+ type: array
160
+ items:
161
+ type: object
162
+ properties:
163
+ priority:
164
+ type: string
165
+ enum:
166
+ - P0
167
+ - P1
168
+ - P2
169
+ description:
170
+ type: string
171
+ fix_type:
172
+ type: string
173
+ enum:
174
+ - template_fix
175
+ - dsl_fix
176
+ - regeneration
177
+ description: Prioritized improvement recommendation list
178
+ required:
179
+ - audit_type
180
+ - total_dimensions
181
+ - pass_count
182
+ - miss_count
@@ -0,0 +1,269 @@
1
+ # === DSL Update Tasks ===
2
+
3
+ update-dsl-definitions:
4
+ description: Create new or update existing agent-contracts DSL definitions
5
+ target_agent: dsl-designer
6
+ allowed_from_agents:
7
+ - dsl-designer
8
+ workflow: dsl-update
9
+ input_artifacts:
10
+ - dsl-source
11
+ invocation_handoff: dsl-task-request
12
+ result_handoff: dsl-task-result
13
+ validations:
14
+ - dsl-schema-validation
15
+ - dsl-lint-validation
16
+ responsibilities:
17
+ - Create and update DSL YAML files
18
+ - Define agents, tasks, artifacts, tools, validations, handoff_types, workflow, guardrails
19
+ - Configure system section
20
+ completion_criteria:
21
+ - agent-contracts validate succeeds
22
+ - agent-contracts lint reports no errors
23
+ - Cross-references for newly added entities are correct
24
+ execution_steps:
25
+ - id: read-current-dsl
26
+ action: Read current DSL definitions and understand the structure
27
+ reads_artifact: dsl-source
28
+ required: true
29
+ - id: update-dsl
30
+ action: Create or update DSL definitions
31
+ produces_artifact: dsl-source
32
+ - id: validate
33
+ action: Run agent-contracts validate
34
+ uses_tool: agent-contracts-cli
35
+ required: true
36
+ - id: lint
37
+ action: Run agent-contracts lint
38
+ uses_tool: agent-contracts-cli
39
+ escalation_criteria:
40
+ - condition: Schema errors from validate cannot be resolved
41
+ action: stop_and_report
42
+
43
+ update-dsl-binding:
44
+ description: Create new or update existing software bindings
45
+ target_agent: dsl-designer
46
+ allowed_from_agents:
47
+ - dsl-designer
48
+ workflow: dsl-update
49
+ input_artifacts:
50
+ - dsl-source
51
+ invocation_handoff: dsl-task-request
52
+ result_handoff: dsl-task-result
53
+ validations:
54
+ - dsl-schema-validation
55
+ responsibilities:
56
+ - Add and update guardrail_impl check definitions
57
+ - Configure outputs section templates and inline templates
58
+ - Set up binding extends inheritance
59
+ completion_criteria:
60
+ - Binding YAML conforms to the correct schema
61
+ - guardrail_impl hook_event / matcher values are valid
62
+ - agent-contracts generate guardrails succeeds
63
+ execution_steps:
64
+ - id: read-guardrails
65
+ action: Review target guardrail definitions and policies
66
+ reads_artifact: dsl-source
67
+ required: true
68
+ - id: update-binding
69
+ action: Create or update binding YAML
70
+ produces_artifact: dsl-source
71
+ - id: generate
72
+ action: Run agent-contracts generate guardrails to verify
73
+ uses_tool: agent-contracts-cli
74
+ required: true
75
+ escalation_criteria:
76
+ - condition: Binding guardrail_impl is inconsistent with DSL guardrails
77
+ action: stop_and_report
78
+
79
+ render-dsl-outputs:
80
+ description: Render prompts and documents from DSL and check for drift
81
+ target_agent: dsl-designer
82
+ allowed_from_agents:
83
+ - dsl-designer
84
+ workflow: dsl-update
85
+ input_artifacts:
86
+ - dsl-source
87
+ invocation_handoff: dsl-task-request
88
+ result_handoff: dsl-task-result
89
+ validations:
90
+ - dsl-schema-validation
91
+ responsibilities:
92
+ - Generate prompts and documents via agent-contracts render
93
+ - Detect and resolve drift using render --check
94
+ completion_criteria:
95
+ - render succeeds
96
+ - render --check reports no drift
97
+ execution_steps:
98
+ - id: render
99
+ action: Run agent-contracts render
100
+ uses_tool: agent-contracts-cli
101
+ produces_artifact: dsl-generated-output
102
+ required: true
103
+ - id: check-drift
104
+ action: Run agent-contracts render --check to verify no drift
105
+ uses_tool: agent-contracts-cli
106
+ escalation_criteria:
107
+ - condition: Unresolved template errors during render
108
+ action: stop_and_report
109
+
110
+ check-dsl-score:
111
+ description: Check DSL completeness score and identify improvement areas
112
+ target_agent: dsl-designer
113
+ allowed_from_agents:
114
+ - dsl-designer
115
+ workflow: dsl-update
116
+ input_artifacts:
117
+ - dsl-source
118
+ invocation_handoff: dsl-task-request
119
+ result_handoff: dsl-task-result
120
+ validations:
121
+ - dsl-score-validation
122
+ - dsl-score-report-validation
123
+ responsibilities:
124
+ - Review score across 7 dimensions and identify weaknesses
125
+ - List entities that need improvement
126
+ completion_criteria:
127
+ - Score results have been reviewed
128
+ - Improvement areas have been identified
129
+ execution_steps:
130
+ - id: run-score
131
+ action: Run agent-contracts score
132
+ uses_tool: agent-contracts-cli
133
+ required: true
134
+ - id: analyze
135
+ action: Analyze score weaknesses and formulate improvement plan
136
+ produces_artifact: dsl-score-report
137
+ escalation_criteria:
138
+ - condition: Score is significantly below threshold with no clear improvement path
139
+ action: stop_and_report
140
+
141
+ # === DSL Audit Tasks ===
142
+
143
+ audit-dsl-completeness:
144
+ description: Audit completeness of DSL definitions against generated prompts
145
+ target_agent: dsl-auditor
146
+ allowed_from_agents:
147
+ - dsl-auditor
148
+ workflow: dsl-audit
149
+ input_artifacts:
150
+ - dsl-source
151
+ - dsl-generated-output
152
+ invocation_handoff: dsl-task-request
153
+ result_handoff: dsl-audit-result
154
+ validations:
155
+ - dsl-completeness-audit
156
+ - dsl-audit-report-validation
157
+ responsibilities:
158
+ - Cross-check across 19 dimensions per audit procedure
159
+ - Classify gaps as template gap, data gap, or DSL gap
160
+ - Present improvement recommendations
161
+ completion_criteria:
162
+ - All dimensions inspected for all agents
163
+ - Detected gaps are classified
164
+ - Improvement recommendations are presented with priority
165
+ execution_steps:
166
+ - id: collect-sources
167
+ action: Collect DSL definitions, generated prompts, and templates
168
+ reads_artifact: dsl-source
169
+ required: true
170
+ - id: collect-outputs
171
+ action: Collect generated prompts
172
+ reads_artifact: dsl-generated-output
173
+ required: true
174
+ - id: run-audit
175
+ action: Execute 19-dimension cross-check
176
+ - id: analyze-gaps
177
+ action: Analyze root causes of detected gaps
178
+ - id: produce-report
179
+ action: Produce audit report and improvement recommendations
180
+ produces_artifact: dsl-audit-report
181
+ escalation_criteria:
182
+ - condition: 3 or more critical-level gaps detected
183
+ action: stop_and_report
184
+
185
+ audit-semantic-design:
186
+ description: Audit DSL design for semantic coherence
187
+ target_agent: dsl-auditor
188
+ allowed_from_agents:
189
+ - dsl-auditor
190
+ workflow: dsl-audit
191
+ input_artifacts:
192
+ - dsl-source
193
+ invocation_handoff: dsl-task-request
194
+ result_handoff: dsl-audit-result
195
+ validations:
196
+ - dsl-completeness-audit
197
+ - dsl-audit-report-validation
198
+ responsibilities:
199
+ - Check dispatch_only agents for implementation responsibilities
200
+ - Detect agents with overly broad scope
201
+ - Identify role overlap between agents
202
+ - Verify handoff schemas carry sufficient fields for task completion_criteria
203
+ - Check workflow gates are placed effectively
204
+ - Detect guardrails declared but absent from execution path
205
+ - Check semantic validations are distributed across phases
206
+ completion_criteria:
207
+ - All agents reviewed for scope and overlap
208
+ - Workflow gate placement analyzed
209
+ - Guardrail enforcement path verified
210
+ - Findings classified with severity and category
211
+ execution_steps:
212
+ - id: load-dsl
213
+ action: Load resolved DSL definitions
214
+ reads_artifact: dsl-source
215
+ required: true
216
+ - id: analyze-agents
217
+ action: Review agent responsibilities, permissions, and role boundaries
218
+ - id: analyze-workflows
219
+ action: Analyze workflow structure, gate placement, and validation coverage
220
+ - id: analyze-guardrails
221
+ action: Verify guardrail enforcement paths
222
+ - id: produce-report
223
+ action: Produce semantic design audit report
224
+ produces_artifact: dsl-audit-report
225
+ escalation_criteria:
226
+ - condition: 3 or more critical-level design issues detected
227
+ action: stop_and_report
228
+
229
+ audit-generated-prompts:
230
+ description: Audit generated prompts against DSL intent
231
+ target_agent: dsl-auditor
232
+ allowed_from_agents:
233
+ - dsl-auditor
234
+ workflow: dsl-audit
235
+ input_artifacts:
236
+ - dsl-source
237
+ - dsl-generated-output
238
+ invocation_handoff: dsl-task-request
239
+ result_handoff: dsl-audit-result
240
+ validations:
241
+ - dsl-completeness-audit
242
+ - dsl-audit-report-validation
243
+ responsibilities:
244
+ - Compare generated prompt content against DSL agent definitions
245
+ - Detect missing requirements from DSL
246
+ - Detect hallucinated permissions not in DSL
247
+ - Identify ambiguous or unsafe instructions
248
+ - Verify consistency between prompt and handoff schema expectations
249
+ completion_criteria:
250
+ - All generated prompts compared against DSL definitions
251
+ - Missing, hallucinated, and ambiguous instructions identified
252
+ - Findings classified with severity and category
253
+ execution_steps:
254
+ - id: collect-sources
255
+ action: Collect DSL agent definitions and related entities
256
+ reads_artifact: dsl-source
257
+ required: true
258
+ - id: collect-prompts
259
+ action: Collect generated prompt files
260
+ reads_artifact: dsl-generated-output
261
+ required: true
262
+ - id: compare
263
+ action: Compare each prompt against its DSL definition
264
+ - id: produce-report
265
+ action: Produce prompt audit report
266
+ produces_artifact: dsl-audit-report
267
+ escalation_criteria:
268
+ - condition: Hallucinated permissions detected in generated prompts
269
+ action: stop_and_report