agent-contracts 0.7.0 → 0.8.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.
package/README.md CHANGED
@@ -204,6 +204,30 @@ An **Artifact** defines the objects that move through the workflow:
204
204
  * required validations
205
205
  * visibility
206
206
 
207
+ ### Tool
208
+
209
+ A **Tool** defines an invokable CLI/MCP tool:
210
+
211
+ * kind (cli, mcp, etc.)
212
+ * input/output artifacts
213
+ * invokable_by (which agents can use it)
214
+ * `commands` — structured list of sub-commands with `category`, `reads`, `writes`, and `purpose`
215
+
216
+ ### Workflow
217
+
218
+ A **Workflow** defines a phase-level execution sequence:
219
+
220
+ * `description` — human-readable summary
221
+ * `entry_conditions`
222
+ * `trigger`
223
+ * `external_participants` — actors/participants outside the agent system (e.g., User, external advisory)
224
+ * ordered steps (handoff, validation, decision)
225
+
226
+ Workflow steps support additional properties:
227
+
228
+ * `group` — consecutive steps with the same group are rendered as `par` (parallel) blocks in sequence diagrams
229
+ * `retry` (handoff steps only) — defines a conditional retry loop with `condition`, `fix_task`, and optional `revalidate_task`
230
+
207
231
  ### Handoff
208
232
 
209
233
  A **Handoff** is a runtime delegation instance.
@@ -458,12 +482,13 @@ tasks:
458
482
  execution_steps:
459
483
  - id: read-specs
460
484
  action: "Read spec-md and design-docs"
461
- description: "Read all relevant specification and design documents"
485
+ reads_artifact: spec-md
462
486
  - id: implement
463
487
  action: "Implement changes in codebase"
488
+ produces_artifact: codebase
489
+ depends_on: [read-specs]
464
490
  - id: run-db-lint
465
491
  action: "Run db-lint"
466
- description: "Run database schema linter to check migrations"
467
492
  uses_tool: db-lint
468
493
  x-timeout: 120
469
494
  completion_criteria:
@@ -493,6 +518,33 @@ artifacts:
493
518
 
494
519
  ---
495
520
 
521
+ ## Example: Workflow definition
522
+
523
+ ````yaml
524
+ workflow:
525
+ specify:
526
+ description: "Externalize requirements — create spec.md from user stories"
527
+ entry_conditions:
528
+ - User story or feature request received
529
+ trigger: "User invokes /speckit.specify or asks to create a feature spec."
530
+ steps:
531
+ - type: handoff
532
+ handoff_kind: delegation
533
+ task: specify-feature
534
+ from_agent: main-architect
535
+ - type: validation
536
+ validation_id: spec-semantic-review
537
+ - type: decision
538
+ agent: main-architect
539
+ options:
540
+ - label: approve
541
+ next_workflow: plan
542
+ - label: revise
543
+ retry_from_step: 0
544
+ ````
545
+
546
+ ---
547
+
496
548
  ## Inheritance and merge operators
497
549
 
498
550
  `agent-contracts` supports shared base definitions with project-level overrides through `extends`.
@@ -686,8 +738,8 @@ Each `context` type provides a different rendering scope:
686
738
 
687
739
  * `relatedTasks` — tasks where `task.workflow` matches this phase
688
740
  * `relatedAgents` — agents from task `target_agent`, `allowed_from_agents`, step `from_agent`, and validation executors
689
- * `relatedTools` — tools from `can_execute_tools` of all related agents
690
- * `relatedArtifacts` — artifacts from `can_read_artifacts`, `can_write_artifacts`, and `input_artifacts`
741
+ * `relatedTools` — tools from `can_execute_tools` of all related agents, plus `uses_tool` in execution steps
742
+ * `relatedArtifacts` — artifacts from `can_read_artifacts`, `can_write_artifacts`, `input_artifacts`, plus `produces_artifact` and `reads_artifact` in execution steps
691
743
  * `relatedValidations` — validations referenced in workflow steps
692
744
 
693
745
  **`artifact` context** provides ownership and cross-reference data:
@@ -724,6 +776,8 @@ Templates can use these built-in helpers:
724
776
  | `or` | `{{#if (or a b)}}` | Boolean OR (variadic) |
725
777
  | `and` | `{{#if (and a b)}}` | Boolean AND (variadic) |
726
778
  | `gt` / `gte` / `lt` | `{{#if (gt a b)}}` | Numeric comparisons |
779
+ | `sequenceDiagram` | `{{{sequenceDiagram}}}` or `{{{sequenceDiagram @key ../dsl}}}` | Generate Mermaid sequence diagram. Supports `external_participants`, `group` (par blocks), `retry` (opt blocks), and read-only agent separation into Audit box |
780
+ | `overviewFlowchart` | `{{{overviewFlowchart dsl}}}` | Generate Mermaid graph showing phases → agents/tools/artifacts relationships (system context) |
727
781
 
728
782
  ---
729
783
 
@@ -762,6 +816,8 @@ Checks:
762
816
  * merge integrity
763
817
  * read-only write violations
764
818
  * prerequisite readability
819
+ * artifact ownership — `produces_artifact`/`reads_artifact` in execution steps vs. artifact producers/editors/consumers
820
+ * tool commands — `commands[].reads`/`commands[].writes` reference valid artifacts and align with `output_artifacts`
765
821
  * naming/style issues through Spectral rules
766
822
 
767
823
  ---