agent-contracts-runtime 0.30.0 → 0.30.2

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,1444 @@
1
+ # agent-runtime CLI
2
+
3
+ Runtime bridge for executing agent-contracts workflows on Agent SDKs.
4
+ Generates typed contracts, handoff validators, and guardrail hooks from DSL,
5
+ then runs workflows through pluggable SDK adapters.
6
+
7
+
8
+ **Version:** 0.1.0
9
+
10
+ ## Table of Contents
11
+
12
+ - [agent-runtime](#agent-runtime)
13
+ - [init](#agent-runtime-init)
14
+ - [generate](#agent-runtime-generate)
15
+ - [run](#agent-runtime-run)
16
+ - [list](#agent-runtime-list)
17
+ - [show-prompt](#agent-runtime-show-prompt)
18
+ - [doctor](#agent-runtime-doctor)
19
+
20
+ ---
21
+
22
+ ## agent-runtime
23
+
24
+ CLI for agent-contracts-runtime — generate, run, and manage agent workflows.
25
+
26
+ ### Global Options
27
+
28
+ | Option | Aliases | Required | Default | Description |
29
+ |---|---|---|---|---|
30
+ | `--config` | -c | No | `"./agent-runtime.config.yaml"` | Path to agent-runtime.config.yaml. |
31
+ | `--verbose` | -v | No | `false` | Enable verbose output. |
32
+ | `--quiet` | -q | No | `false` | Suppress non-error output. |
33
+
34
+ ### init
35
+
36
+ Initialize runtime scaffolding for a project.
37
+
38
+ Generates the initial directory structure and configuration files
39
+ for using agent-contracts-runtime in a project.
40
+ Creates agent-runtime.config.yaml and agent/src/ user code templates.
41
+
42
+
43
+ **Usage:**
44
+
45
+ ```
46
+ agent-runtime init [--adapter] [--output] [--force]
47
+ ```
48
+
49
+ #### Options
50
+
51
+ | Option | Aliases | Required | Default | Description |
52
+ |---|---|---|---|---|
53
+ | `--adapter` | -a | No | `"mock"` | Default SDK adapter to configure. |
54
+ | `--output` | -o | No | `"."` | Output directory for generated scaffolding. |
55
+ | `--force` | -f | No | `false` | Overwrite existing files without prompting. |
56
+
57
+ #### Exit Codes
58
+
59
+ **Exit 0:** Scaffolding generated successfully.
60
+
61
+ - **stdout:** format=`json`
62
+
63
+ | Property | Type | Required | Description |
64
+ |---|---|---|---|
65
+ | `files_created` | `string[]` | Yes | List of files created by init. |
66
+
67
+ <details>
68
+ <summary>JSON Schema</summary>
69
+
70
+ ```json
71
+ {
72
+ "type": "object",
73
+ "required": [
74
+ "files_created"
75
+ ],
76
+ "properties": {
77
+ "files_created": {
78
+ "type": "array",
79
+ "items": {
80
+ "type": "string"
81
+ },
82
+ "description": "List of files created by init."
83
+ }
84
+ }
85
+ }
86
+ ```
87
+
88
+ </details>
89
+
90
+ **Exit 1:** Initialization failed (existing files, permission error, etc.).
91
+
92
+ - **stderr:** format=`text`
93
+
94
+ #### Extensions
95
+
96
+ ```yaml
97
+ x-agent:
98
+ risk_level: low
99
+ requires_confirmation: false
100
+ idempotent: false
101
+ side_effects:
102
+ - filesystem_write
103
+ safe_dry_run_option:
104
+ ```
105
+
106
+ ---
107
+
108
+ ### generate
109
+
110
+ Generate runtime contracts and hooks from DSL.
111
+
112
+ Reads agent-contracts.yaml, resolves the DSL, validates it,
113
+ and generates typed contracts, handoff schemas, guardrail hooks,
114
+ and a runtime manifest into the configured generated_dir.
115
+
116
+ Each generated file includes a DO NOT EDIT header.
117
+
118
+
119
+ **Usage:**
120
+
121
+ ```
122
+ agent-runtime generate [--clean] [--check] [--templates]
123
+ ```
124
+
125
+ #### Options
126
+
127
+ | Option | Aliases | Required | Default | Description |
128
+ |---|---|---|---|---|
129
+ | `--clean` | | No | `false` | Delete generated_dir before regenerating.
130
+ Removes stale files that may remain from previous generations.
131
+ |
132
+ | `--check` | | No | `false` | Dry-run mode for CI. Does not write files.
133
+ Compares current generated output with what would be regenerated.
134
+ Exits with code 1 if any differences are found.
135
+ |
136
+ | `--templates` | -t | No | | Custom templates directory. Overrides built-in templates. |
137
+
138
+ #### Exit Codes
139
+
140
+ **Exit 0:** Generation completed successfully (or --check found no differences).
141
+
142
+ - **stdout:** format=`json`
143
+
144
+ | Property | Type | Required | Description |
145
+ |---|---|---|---|
146
+ | `files_generated` | `string[]` | Yes | List of generated file paths. |
147
+ | `dsl_hash` | `string` | Yes | SHA-256 hash of the resolved DSL (canonical stringify). |
148
+ | `generation_input_hash` | `string` | Yes | SHA-256 hash of all generation inputs. |
149
+ | `cleaned` | `boolean` | No | Whether --clean was used. |
150
+ | `check_mode` | `boolean` | No | Whether --check was used. |
151
+ | `has_differences` | `boolean` | No | In --check mode, whether differences were found. |
152
+
153
+ <details>
154
+ <summary>JSON Schema</summary>
155
+
156
+ ```json
157
+ {
158
+ "type": "object",
159
+ "required": [
160
+ "files_generated",
161
+ "dsl_hash",
162
+ "generation_input_hash"
163
+ ],
164
+ "properties": {
165
+ "files_generated": {
166
+ "type": "array",
167
+ "items": {
168
+ "type": "string"
169
+ },
170
+ "description": "List of generated file paths."
171
+ },
172
+ "dsl_hash": {
173
+ "type": "string",
174
+ "description": "SHA-256 hash of the resolved DSL (canonical stringify)."
175
+ },
176
+ "generation_input_hash": {
177
+ "type": "string",
178
+ "description": "SHA-256 hash of all generation inputs."
179
+ },
180
+ "cleaned": {
181
+ "type": "boolean",
182
+ "description": "Whether --clean was used."
183
+ },
184
+ "check_mode": {
185
+ "type": "boolean",
186
+ "description": "Whether --check was used."
187
+ },
188
+ "has_differences": {
189
+ "type": "boolean",
190
+ "description": "In --check mode, whether differences were found."
191
+ }
192
+ }
193
+ }
194
+ ```
195
+
196
+ </details>
197
+
198
+ **Exit 1:** Generation failed, or --check detected differences between
199
+ current generated files and expected output.
200
+
201
+
202
+ - **stderr:** format=`text`
203
+
204
+ **Exit 2:** DSL validation error. The input DSL has structural or semantic issues.
205
+
206
+ - **stderr:** format=`json`
207
+
208
+ | Property | Type | Required | Description |
209
+ |---|---|---|---|
210
+ | `errors` | `object[]` | Yes | |
211
+ | `errors[].code` | `string` | Yes | |
212
+ | `errors[].message` | `string` | Yes | |
213
+ | `errors[].path` | `string` | No | JSON path to the invalid element. |
214
+
215
+ <details>
216
+ <summary>JSON Schema</summary>
217
+
218
+ ```json
219
+ {
220
+ "type": "object",
221
+ "required": [
222
+ "errors"
223
+ ],
224
+ "properties": {
225
+ "errors": {
226
+ "type": "array",
227
+ "items": {
228
+ "type": "object",
229
+ "required": [
230
+ "code",
231
+ "message"
232
+ ],
233
+ "properties": {
234
+ "code": {
235
+ "type": "string"
236
+ },
237
+ "message": {
238
+ "type": "string"
239
+ },
240
+ "path": {
241
+ "type": "string",
242
+ "description": "JSON path to the invalid element."
243
+ }
244
+ }
245
+ }
246
+ }
247
+ }
248
+ }
249
+ ```
250
+
251
+ </details>
252
+
253
+ #### Extensions
254
+
255
+ ```yaml
256
+ x-agent:
257
+ risk_level: low
258
+ requires_confirmation: false
259
+ idempotent: true
260
+ side_effects:
261
+ - filesystem_write
262
+ safe_dry_run_option: check
263
+ ```
264
+
265
+ ---
266
+
267
+ ### run
268
+
269
+ Execute a workflow.
270
+
271
+ Loads generated contracts, creates an SDK adapter, registers user plugins,
272
+ and executes the specified workflow with the given user request.
273
+
274
+ The workflow runner orchestrates task delegation, retry, gate handling,
275
+ and handoff validation mechanically.
276
+
277
+
278
+ **Usage:**
279
+
280
+ ```
281
+ agent-runtime run [workflow-id] [user-request] [--adapter] [--max-retries] [--max-follow-ups] [--dry-run] [--auto-approve-gates] [--file]
282
+ ```
283
+
284
+ #### Arguments
285
+
286
+ | Name | Required | Description |
287
+ |---|---|---|
288
+ | `workflow-id` | No | ID of the workflow to execute. Required unless --file is used. |
289
+ | `user-request` | No | Natural language description of what to do. Required unless --file is used. |
290
+
291
+ #### Options
292
+
293
+ | Option | Aliases | Required | Default | Description |
294
+ |---|---|---|---|---|
295
+ | `--adapter` | -a | No | | SDK adapter to use. Overrides config. |
296
+ | `--max-retries` | -r | No | | Override default max retries per step. |
297
+ | `--max-follow-ups` | -f | No | | Override default max follow-ups per step. |
298
+ | `--dry-run` | -n | No | `false` | Simulate execution without calling the SDK adapter. |
299
+ | `--auto-approve-gates` | | No | `false` | Automatically approve all gate steps. |
300
+ | `--file` | | No | | Path to a YAML invocation file. When provided, workflow-id and
301
+ user-request arguments are read from the file instead of CLI args.
302
+ |
303
+
304
+ #### Exit Codes
305
+
306
+ **Exit 0:** Workflow completed successfully.
307
+
308
+ - **stdout:** format=`json`
309
+
310
+ | Property | Type | Required | Description |
311
+ |---|---|---|---|
312
+ | `workflow_id` | `string` | Yes | |
313
+ | `status` | `"completed" \| "escalated" \| "gate_rejected" \| "error"` | Yes | |
314
+ | `steps` | `object[]` | Yes | |
315
+ | `steps[].step_index` | `integer (min: 0)` | Yes | |
316
+ | `steps[].task_id` | `string` | No | |
317
+ | `steps[].gate_kind` | `string` | No | |
318
+ | `steps[].outcome` | `object` | Yes | |
319
+ | `steps[].outcome.status` | `enum(7 values)` | Yes | |
320
+ | `steps[].retries_used` | `integer (min: 0)` | Yes | |
321
+ | `steps[].elapsed_ms` | `integer (min: 0)` | Yes | |
322
+ | `total_elapsed_ms` | `integer (min: 0)` | Yes | |
323
+ | `escalation_reason` | `string` | No | |
324
+ | `error_message` | `string` | No | |
325
+
326
+ <details>
327
+ <summary>JSON Schema</summary>
328
+
329
+ ```json
330
+ {
331
+ "type": "object",
332
+ "required": [
333
+ "workflow_id",
334
+ "status",
335
+ "steps",
336
+ "total_elapsed_ms"
337
+ ],
338
+ "properties": {
339
+ "workflow_id": {
340
+ "type": "string"
341
+ },
342
+ "status": {
343
+ "type": "string",
344
+ "enum": [
345
+ "completed",
346
+ "escalated",
347
+ "gate_rejected",
348
+ "error"
349
+ ]
350
+ },
351
+ "steps": {
352
+ "type": "array",
353
+ "items": {
354
+ "type": "object",
355
+ "required": [
356
+ "step_index",
357
+ "retries_used",
358
+ "elapsed_ms",
359
+ "outcome"
360
+ ],
361
+ "properties": {
362
+ "step_index": {
363
+ "type": "integer",
364
+ "minimum": 0
365
+ },
366
+ "task_id": {
367
+ "type": "string"
368
+ },
369
+ "gate_kind": {
370
+ "type": "string"
371
+ },
372
+ "outcome": {
373
+ "type": "object",
374
+ "required": [
375
+ "status"
376
+ ],
377
+ "properties": {
378
+ "status": {
379
+ "type": "string",
380
+ "enum": [
381
+ "success",
382
+ "validation_error",
383
+ "escalation",
384
+ "error",
385
+ "gate_approved",
386
+ "gate_rejected",
387
+ "skipped"
388
+ ]
389
+ }
390
+ }
391
+ },
392
+ "retries_used": {
393
+ "type": "integer",
394
+ "minimum": 0
395
+ },
396
+ "elapsed_ms": {
397
+ "type": "integer",
398
+ "minimum": 0
399
+ }
400
+ }
401
+ }
402
+ },
403
+ "total_elapsed_ms": {
404
+ "type": "integer",
405
+ "minimum": 0
406
+ },
407
+ "escalation_reason": {
408
+ "type": "string"
409
+ },
410
+ "error_message": {
411
+ "type": "string"
412
+ }
413
+ }
414
+ }
415
+ ```
416
+
417
+ </details>
418
+
419
+ **Exit 1:** Workflow failed (escalation, error, or gate rejection).
420
+
421
+ - **stdout:** format=`json`
422
+
423
+ | Property | Type | Required | Description |
424
+ |---|---|---|---|
425
+ | `workflow_id` | `string` | Yes | |
426
+ | `status` | `"completed" \| "escalated" \| "gate_rejected" \| "error"` | Yes | |
427
+ | `steps` | `object[]` | Yes | |
428
+ | `steps[].step_index` | `integer (min: 0)` | Yes | |
429
+ | `steps[].task_id` | `string` | No | |
430
+ | `steps[].gate_kind` | `string` | No | |
431
+ | `steps[].outcome` | `object` | Yes | |
432
+ | `steps[].outcome.status` | `enum(7 values)` | Yes | |
433
+ | `steps[].retries_used` | `integer (min: 0)` | Yes | |
434
+ | `steps[].elapsed_ms` | `integer (min: 0)` | Yes | |
435
+ | `total_elapsed_ms` | `integer (min: 0)` | Yes | |
436
+ | `escalation_reason` | `string` | No | |
437
+ | `error_message` | `string` | No | |
438
+
439
+ <details>
440
+ <summary>JSON Schema</summary>
441
+
442
+ ```json
443
+ {
444
+ "type": "object",
445
+ "required": [
446
+ "workflow_id",
447
+ "status",
448
+ "steps",
449
+ "total_elapsed_ms"
450
+ ],
451
+ "properties": {
452
+ "workflow_id": {
453
+ "type": "string"
454
+ },
455
+ "status": {
456
+ "type": "string",
457
+ "enum": [
458
+ "completed",
459
+ "escalated",
460
+ "gate_rejected",
461
+ "error"
462
+ ]
463
+ },
464
+ "steps": {
465
+ "type": "array",
466
+ "items": {
467
+ "type": "object",
468
+ "required": [
469
+ "step_index",
470
+ "retries_used",
471
+ "elapsed_ms",
472
+ "outcome"
473
+ ],
474
+ "properties": {
475
+ "step_index": {
476
+ "type": "integer",
477
+ "minimum": 0
478
+ },
479
+ "task_id": {
480
+ "type": "string"
481
+ },
482
+ "gate_kind": {
483
+ "type": "string"
484
+ },
485
+ "outcome": {
486
+ "type": "object",
487
+ "required": [
488
+ "status"
489
+ ],
490
+ "properties": {
491
+ "status": {
492
+ "type": "string",
493
+ "enum": [
494
+ "success",
495
+ "validation_error",
496
+ "escalation",
497
+ "error",
498
+ "gate_approved",
499
+ "gate_rejected",
500
+ "skipped"
501
+ ]
502
+ }
503
+ }
504
+ },
505
+ "retries_used": {
506
+ "type": "integer",
507
+ "minimum": 0
508
+ },
509
+ "elapsed_ms": {
510
+ "type": "integer",
511
+ "minimum": 0
512
+ }
513
+ }
514
+ }
515
+ },
516
+ "total_elapsed_ms": {
517
+ "type": "integer",
518
+ "minimum": 0
519
+ },
520
+ "escalation_reason": {
521
+ "type": "string"
522
+ },
523
+ "error_message": {
524
+ "type": "string"
525
+ }
526
+ }
527
+ }
528
+ ```
529
+
530
+ </details>
531
+
532
+ - **stderr:** format=`text`
533
+
534
+ **Exit 2:** Invalid arguments or unknown workflow/adapter.
535
+
536
+ - **stderr:** format=`text`
537
+
538
+ **Exit 3:** Generated files outdated. Run `agent-runtime generate` first.
539
+
540
+ - **stderr:** format=`text`
541
+
542
+ #### Extensions
543
+
544
+ ```yaml
545
+ x-agent:
546
+ risk_level: high
547
+ requires_confirmation: true
548
+ idempotent: false
549
+ side_effects:
550
+ - sdk_call
551
+ - filesystem_write
552
+ safe_dry_run_option: dry-run
553
+ recommended_before_use:
554
+ - Run `agent-runtime generate --check` to ensure contracts are up to date.
555
+ - Run `agent-runtime doctor` to verify SDK configuration.
556
+ ```
557
+
558
+ ---
559
+
560
+ ### list
561
+
562
+ List available workflows, tasks, or agents.
563
+
564
+ Reads generated contracts and displays available resources.
565
+ Useful for discovering what workflows, tasks, and agents
566
+ are defined in the current project.
567
+
568
+
569
+ **Usage:**
570
+
571
+ ```
572
+ agent-runtime list <resource> [--format]
573
+ ```
574
+
575
+ #### Arguments
576
+
577
+ | Name | Required | Description |
578
+ |---|---|---|
579
+ | `resource` | Yes | Type of resource to list. |
580
+
581
+ #### Options
582
+
583
+ | Option | Aliases | Required | Default | Description |
584
+ |---|---|---|---|---|
585
+ | `--format` | | No | `"table"` | Output format. |
586
+
587
+ #### Exit Codes
588
+
589
+ **Exit 0:** Resources listed successfully.
590
+
591
+ - **stdout:** format=`json`
592
+
593
+ | Property | Type | Required | Description |
594
+ |---|---|---|---|
595
+ | `resource` | `"workflows" \| "tasks" \| "agents"` | Yes | |
596
+ | `items` | `object[]` | Yes | |
597
+ | `items[].id` | `string` | Yes | |
598
+ | `items[].description` | `string` | Yes | |
599
+
600
+ <details>
601
+ <summary>JSON Schema</summary>
602
+
603
+ ```json
604
+ {
605
+ "type": "object",
606
+ "required": [
607
+ "resource",
608
+ "items"
609
+ ],
610
+ "properties": {
611
+ "resource": {
612
+ "type": "string",
613
+ "enum": [
614
+ "workflows",
615
+ "tasks",
616
+ "agents"
617
+ ]
618
+ },
619
+ "items": {
620
+ "type": "array",
621
+ "items": {
622
+ "type": "object",
623
+ "required": [
624
+ "id",
625
+ "description"
626
+ ],
627
+ "properties": {
628
+ "id": {
629
+ "type": "string"
630
+ },
631
+ "description": {
632
+ "type": "string"
633
+ }
634
+ }
635
+ }
636
+ }
637
+ }
638
+ }
639
+ ```
640
+
641
+ </details>
642
+
643
+ **Exit 1:** Failed to load contracts.
644
+
645
+ - **stderr:** format=`text`
646
+
647
+ #### Extensions
648
+
649
+ ```yaml
650
+ x-agent:
651
+ risk_level: low
652
+ requires_confirmation: false
653
+ idempotent: true
654
+ side_effects:
655
+
656
+ ```
657
+
658
+ ---
659
+
660
+ ### show-prompt
661
+
662
+ Display the generated prompt for a task.
663
+
664
+ Builds and displays the full prompt that would be sent to an SDK agent
665
+ for a given task. Useful for inspecting, debugging, and validating
666
+ prompt content before execution.
667
+
668
+ Shows the agent role, responsibilities, constraints, task details,
669
+ completion criteria, handoff schema fields, and output format example.
670
+
671
+
672
+ **Usage:**
673
+
674
+ ```
675
+ agent-runtime show-prompt <task-id> [--user-request] [--format] [--with-plugins]
676
+ ```
677
+
678
+ #### Arguments
679
+
680
+ | Name | Required | Description |
681
+ |---|---|---|
682
+ | `task-id` | Yes | ID of the task to show the prompt for (e.g. plan-and-implement, audit-tests). |
683
+
684
+ #### Options
685
+
686
+ | Option | Aliases | Required | Default | Description |
687
+ |---|---|---|---|---|
688
+ | `--user-request` | -u | No | `"(preview)"` | User request text to include in the prompt preview. |
689
+ | `--format` | | No | `"markdown"` | Output format. |
690
+ | `--with-plugins` | | No | `false` | Apply registered plugin prompt enhancers to the output. |
691
+
692
+ #### Exit Codes
693
+
694
+ **Exit 0:** Prompt displayed successfully.
695
+
696
+ - **stdout:** format=`json`
697
+
698
+ | Property | Type | Required | Description |
699
+ |---|---|---|---|
700
+ | `task_id` | `string` | Yes | The task ID used to build the prompt. |
701
+ | `agent_id` | `string` | Yes | The target agent ID for this task. |
702
+ | `prompt` | `string` | Yes | The full generated prompt text. |
703
+ | `handoff_schema` | `string` | No | The handoff schema ID for the task result. |
704
+ | `plugins_applied` | `boolean` | No | Whether plugin prompt enhancers were applied. |
705
+
706
+ <details>
707
+ <summary>JSON Schema</summary>
708
+
709
+ ```json
710
+ {
711
+ "type": "object",
712
+ "required": [
713
+ "task_id",
714
+ "agent_id",
715
+ "prompt"
716
+ ],
717
+ "properties": {
718
+ "task_id": {
719
+ "type": "string",
720
+ "description": "The task ID used to build the prompt."
721
+ },
722
+ "agent_id": {
723
+ "type": "string",
724
+ "description": "The target agent ID for this task."
725
+ },
726
+ "prompt": {
727
+ "type": "string",
728
+ "description": "The full generated prompt text."
729
+ },
730
+ "handoff_schema": {
731
+ "type": "string",
732
+ "description": "The handoff schema ID for the task result."
733
+ },
734
+ "plugins_applied": {
735
+ "type": "boolean",
736
+ "description": "Whether plugin prompt enhancers were applied."
737
+ }
738
+ }
739
+ }
740
+ ```
741
+
742
+ </details>
743
+
744
+ **Exit 1:** Failed to build prompt (unknown task, missing contracts, etc.).
745
+
746
+ - **stderr:** format=`text`
747
+
748
+ #### Extensions
749
+
750
+ ```yaml
751
+ x-agent:
752
+ risk_level: low
753
+ requires_confirmation: false
754
+ idempotent: true
755
+ side_effects:
756
+
757
+ ```
758
+
759
+ ---
760
+
761
+ ### doctor
762
+
763
+ Verify configuration, generated files, and SDK connectivity.
764
+
765
+ Runs a series of diagnostic checks to verify that the project
766
+ is correctly configured for agent-runtime execution.
767
+
768
+ Checks: config existence, DSL existence, generated manifest freshness,
769
+ adapter configuration, API key environment variables, plugin entrypoint.
770
+
771
+
772
+ **Usage:**
773
+
774
+ ```
775
+ agent-runtime doctor
776
+ ```
777
+
778
+ #### Exit Codes
779
+
780
+ **Exit 0:** All checks passed.
781
+
782
+ - **stdout:** format=`json`
783
+
784
+ | Property | Type | Required | Description |
785
+ |---|---|---|---|
786
+ | `checks` | `object[]` | Yes | |
787
+ | `checks[].name` | `string` | Yes | Check name (e.g. config_exists, dsl_exists, manifest_fresh). |
788
+ | `checks[].status` | `"pass" \| "fail" \| "warn"` | Yes | |
789
+ | `checks[].message` | `string` | No | Human-readable detail. |
790
+ | `all_passed` | `boolean` | Yes | |
791
+
792
+ <details>
793
+ <summary>JSON Schema</summary>
794
+
795
+ ```json
796
+ {
797
+ "type": "object",
798
+ "required": [
799
+ "checks",
800
+ "all_passed"
801
+ ],
802
+ "properties": {
803
+ "checks": {
804
+ "type": "array",
805
+ "items": {
806
+ "type": "object",
807
+ "required": [
808
+ "name",
809
+ "status"
810
+ ],
811
+ "properties": {
812
+ "name": {
813
+ "type": "string",
814
+ "description": "Check name (e.g. config_exists, dsl_exists, manifest_fresh)."
815
+ },
816
+ "status": {
817
+ "type": "string",
818
+ "enum": [
819
+ "pass",
820
+ "fail",
821
+ "warn"
822
+ ]
823
+ },
824
+ "message": {
825
+ "type": "string",
826
+ "description": "Human-readable detail."
827
+ }
828
+ }
829
+ }
830
+ },
831
+ "all_passed": {
832
+ "type": "boolean"
833
+ }
834
+ }
835
+ }
836
+ ```
837
+
838
+ </details>
839
+
840
+ **Exit 1:** One or more checks failed.
841
+
842
+ - **stdout:** format=`json`
843
+
844
+ | Property | Type | Required | Description |
845
+ |---|---|---|---|
846
+ | `checks` | `object[]` | Yes | |
847
+ | `checks[].name` | `string` | Yes | Check name (e.g. config_exists, dsl_exists, manifest_fresh). |
848
+ | `checks[].status` | `"pass" \| "fail" \| "warn"` | Yes | |
849
+ | `checks[].message` | `string` | No | Human-readable detail. |
850
+ | `all_passed` | `boolean` | Yes | |
851
+
852
+ <details>
853
+ <summary>JSON Schema</summary>
854
+
855
+ ```json
856
+ {
857
+ "type": "object",
858
+ "required": [
859
+ "checks",
860
+ "all_passed"
861
+ ],
862
+ "properties": {
863
+ "checks": {
864
+ "type": "array",
865
+ "items": {
866
+ "type": "object",
867
+ "required": [
868
+ "name",
869
+ "status"
870
+ ],
871
+ "properties": {
872
+ "name": {
873
+ "type": "string",
874
+ "description": "Check name (e.g. config_exists, dsl_exists, manifest_fresh)."
875
+ },
876
+ "status": {
877
+ "type": "string",
878
+ "enum": [
879
+ "pass",
880
+ "fail",
881
+ "warn"
882
+ ]
883
+ },
884
+ "message": {
885
+ "type": "string",
886
+ "description": "Human-readable detail."
887
+ }
888
+ }
889
+ }
890
+ },
891
+ "all_passed": {
892
+ "type": "boolean"
893
+ }
894
+ }
895
+ }
896
+ ```
897
+
898
+ </details>
899
+
900
+ #### Extensions
901
+
902
+ ```yaml
903
+ x-agent:
904
+ risk_level: low
905
+ requires_confirmation: false
906
+ idempotent: true
907
+ side_effects:
908
+
909
+ ```
910
+
911
+ ---
912
+
913
+ ---
914
+
915
+ ## Schemas
916
+
917
+ ### InitResult
918
+
919
+ Type: `object`
920
+
921
+ | Property | Type | Required | Description |
922
+ |---|---|---|---|
923
+ | `files_created` | `string[]` | Yes | List of files created by init. |
924
+
925
+ <details>
926
+ <summary>JSON Schema</summary>
927
+
928
+ ```json
929
+ {
930
+ "type": "object",
931
+ "required": [
932
+ "files_created"
933
+ ],
934
+ "properties": {
935
+ "files_created": {
936
+ "type": "array",
937
+ "items": {
938
+ "type": "string"
939
+ },
940
+ "description": "List of files created by init."
941
+ }
942
+ }
943
+ }
944
+ ```
945
+
946
+ </details>
947
+
948
+ ### GenerateResult
949
+
950
+ Type: `object`
951
+
952
+ | Property | Type | Required | Description |
953
+ |---|---|---|---|
954
+ | `files_generated` | `string[]` | Yes | List of generated file paths. |
955
+ | `dsl_hash` | `string` | Yes | SHA-256 hash of the resolved DSL (canonical stringify). |
956
+ | `generation_input_hash` | `string` | Yes | SHA-256 hash of all generation inputs. |
957
+ | `cleaned` | `boolean` | No | Whether --clean was used. |
958
+ | `check_mode` | `boolean` | No | Whether --check was used. |
959
+ | `has_differences` | `boolean` | No | In --check mode, whether differences were found. |
960
+
961
+ <details>
962
+ <summary>JSON Schema</summary>
963
+
964
+ ```json
965
+ {
966
+ "type": "object",
967
+ "required": [
968
+ "files_generated",
969
+ "dsl_hash",
970
+ "generation_input_hash"
971
+ ],
972
+ "properties": {
973
+ "files_generated": {
974
+ "type": "array",
975
+ "items": {
976
+ "type": "string"
977
+ },
978
+ "description": "List of generated file paths."
979
+ },
980
+ "dsl_hash": {
981
+ "type": "string",
982
+ "description": "SHA-256 hash of the resolved DSL (canonical stringify)."
983
+ },
984
+ "generation_input_hash": {
985
+ "type": "string",
986
+ "description": "SHA-256 hash of all generation inputs."
987
+ },
988
+ "cleaned": {
989
+ "type": "boolean",
990
+ "description": "Whether --clean was used."
991
+ },
992
+ "check_mode": {
993
+ "type": "boolean",
994
+ "description": "Whether --check was used."
995
+ },
996
+ "has_differences": {
997
+ "type": "boolean",
998
+ "description": "In --check mode, whether differences were found."
999
+ }
1000
+ }
1001
+ }
1002
+ ```
1003
+
1004
+ </details>
1005
+
1006
+ ### ValidationError
1007
+
1008
+ Type: `object`
1009
+
1010
+ | Property | Type | Required | Description |
1011
+ |---|---|---|---|
1012
+ | `errors` | `object[]` | Yes | |
1013
+ | `errors[].code` | `string` | Yes | |
1014
+ | `errors[].message` | `string` | Yes | |
1015
+ | `errors[].path` | `string` | No | JSON path to the invalid element. |
1016
+
1017
+ <details>
1018
+ <summary>JSON Schema</summary>
1019
+
1020
+ ```json
1021
+ {
1022
+ "type": "object",
1023
+ "required": [
1024
+ "errors"
1025
+ ],
1026
+ "properties": {
1027
+ "errors": {
1028
+ "type": "array",
1029
+ "items": {
1030
+ "type": "object",
1031
+ "required": [
1032
+ "code",
1033
+ "message"
1034
+ ],
1035
+ "properties": {
1036
+ "code": {
1037
+ "type": "string"
1038
+ },
1039
+ "message": {
1040
+ "type": "string"
1041
+ },
1042
+ "path": {
1043
+ "type": "string",
1044
+ "description": "JSON path to the invalid element."
1045
+ }
1046
+ }
1047
+ }
1048
+ }
1049
+ }
1050
+ }
1051
+ ```
1052
+
1053
+ </details>
1054
+
1055
+ ### WorkflowResult
1056
+
1057
+ Type: `object`
1058
+
1059
+ | Property | Type | Required | Description |
1060
+ |---|---|---|---|
1061
+ | `workflow_id` | `string` | Yes | |
1062
+ | `status` | `"completed" \| "escalated" \| "gate_rejected" \| "error"` | Yes | |
1063
+ | `steps` | `object[]` | Yes | |
1064
+ | `steps[].step_index` | `integer (min: 0)` | Yes | |
1065
+ | `steps[].task_id` | `string` | No | |
1066
+ | `steps[].gate_kind` | `string` | No | |
1067
+ | `steps[].outcome` | `object` | Yes | |
1068
+ | `steps[].outcome.status` | `enum(7 values)` | Yes | |
1069
+ | `steps[].retries_used` | `integer (min: 0)` | Yes | |
1070
+ | `steps[].elapsed_ms` | `integer (min: 0)` | Yes | |
1071
+ | `total_elapsed_ms` | `integer (min: 0)` | Yes | |
1072
+ | `escalation_reason` | `string` | No | |
1073
+ | `error_message` | `string` | No | |
1074
+
1075
+ <details>
1076
+ <summary>JSON Schema</summary>
1077
+
1078
+ ```json
1079
+ {
1080
+ "type": "object",
1081
+ "required": [
1082
+ "workflow_id",
1083
+ "status",
1084
+ "steps",
1085
+ "total_elapsed_ms"
1086
+ ],
1087
+ "properties": {
1088
+ "workflow_id": {
1089
+ "type": "string"
1090
+ },
1091
+ "status": {
1092
+ "type": "string",
1093
+ "enum": [
1094
+ "completed",
1095
+ "escalated",
1096
+ "gate_rejected",
1097
+ "error"
1098
+ ]
1099
+ },
1100
+ "steps": {
1101
+ "type": "array",
1102
+ "items": {
1103
+ "type": "object",
1104
+ "required": [
1105
+ "step_index",
1106
+ "retries_used",
1107
+ "elapsed_ms",
1108
+ "outcome"
1109
+ ],
1110
+ "properties": {
1111
+ "step_index": {
1112
+ "type": "integer",
1113
+ "minimum": 0
1114
+ },
1115
+ "task_id": {
1116
+ "type": "string"
1117
+ },
1118
+ "gate_kind": {
1119
+ "type": "string"
1120
+ },
1121
+ "outcome": {
1122
+ "type": "object",
1123
+ "required": [
1124
+ "status"
1125
+ ],
1126
+ "properties": {
1127
+ "status": {
1128
+ "type": "string",
1129
+ "enum": [
1130
+ "success",
1131
+ "validation_error",
1132
+ "escalation",
1133
+ "error",
1134
+ "gate_approved",
1135
+ "gate_rejected",
1136
+ "skipped"
1137
+ ]
1138
+ }
1139
+ }
1140
+ },
1141
+ "retries_used": {
1142
+ "type": "integer",
1143
+ "minimum": 0
1144
+ },
1145
+ "elapsed_ms": {
1146
+ "type": "integer",
1147
+ "minimum": 0
1148
+ }
1149
+ }
1150
+ }
1151
+ },
1152
+ "total_elapsed_ms": {
1153
+ "type": "integer",
1154
+ "minimum": 0
1155
+ },
1156
+ "escalation_reason": {
1157
+ "type": "string"
1158
+ },
1159
+ "error_message": {
1160
+ "type": "string"
1161
+ }
1162
+ }
1163
+ }
1164
+ ```
1165
+
1166
+ </details>
1167
+
1168
+ ### StepResult
1169
+
1170
+ Type: `object`
1171
+
1172
+ | Property | Type | Required | Description |
1173
+ |---|---|---|---|
1174
+ | `step_index` | `integer (min: 0)` | Yes | |
1175
+ | `task_id` | `string` | No | |
1176
+ | `gate_kind` | `string` | No | |
1177
+ | `outcome` | `object` | Yes | |
1178
+ | `outcome.status` | `enum(7 values)` | Yes | |
1179
+ | `retries_used` | `integer (min: 0)` | Yes | |
1180
+ | `elapsed_ms` | `integer (min: 0)` | Yes | |
1181
+
1182
+ <details>
1183
+ <summary>JSON Schema</summary>
1184
+
1185
+ ```json
1186
+ {
1187
+ "type": "object",
1188
+ "required": [
1189
+ "step_index",
1190
+ "retries_used",
1191
+ "elapsed_ms",
1192
+ "outcome"
1193
+ ],
1194
+ "properties": {
1195
+ "step_index": {
1196
+ "type": "integer",
1197
+ "minimum": 0
1198
+ },
1199
+ "task_id": {
1200
+ "type": "string"
1201
+ },
1202
+ "gate_kind": {
1203
+ "type": "string"
1204
+ },
1205
+ "outcome": {
1206
+ "type": "object",
1207
+ "required": [
1208
+ "status"
1209
+ ],
1210
+ "properties": {
1211
+ "status": {
1212
+ "type": "string",
1213
+ "enum": [
1214
+ "success",
1215
+ "validation_error",
1216
+ "escalation",
1217
+ "error",
1218
+ "gate_approved",
1219
+ "gate_rejected",
1220
+ "skipped"
1221
+ ]
1222
+ }
1223
+ }
1224
+ },
1225
+ "retries_used": {
1226
+ "type": "integer",
1227
+ "minimum": 0
1228
+ },
1229
+ "elapsed_ms": {
1230
+ "type": "integer",
1231
+ "minimum": 0
1232
+ }
1233
+ }
1234
+ }
1235
+ ```
1236
+
1237
+ </details>
1238
+
1239
+ ### ListResult
1240
+
1241
+ Type: `object`
1242
+
1243
+ | Property | Type | Required | Description |
1244
+ |---|---|---|---|
1245
+ | `resource` | `"workflows" \| "tasks" \| "agents"` | Yes | |
1246
+ | `items` | `object[]` | Yes | |
1247
+ | `items[].id` | `string` | Yes | |
1248
+ | `items[].description` | `string` | Yes | |
1249
+
1250
+ <details>
1251
+ <summary>JSON Schema</summary>
1252
+
1253
+ ```json
1254
+ {
1255
+ "type": "object",
1256
+ "required": [
1257
+ "resource",
1258
+ "items"
1259
+ ],
1260
+ "properties": {
1261
+ "resource": {
1262
+ "type": "string",
1263
+ "enum": [
1264
+ "workflows",
1265
+ "tasks",
1266
+ "agents"
1267
+ ]
1268
+ },
1269
+ "items": {
1270
+ "type": "array",
1271
+ "items": {
1272
+ "type": "object",
1273
+ "required": [
1274
+ "id",
1275
+ "description"
1276
+ ],
1277
+ "properties": {
1278
+ "id": {
1279
+ "type": "string"
1280
+ },
1281
+ "description": {
1282
+ "type": "string"
1283
+ }
1284
+ }
1285
+ }
1286
+ }
1287
+ }
1288
+ }
1289
+ ```
1290
+
1291
+ </details>
1292
+
1293
+ ### ShowPromptResult
1294
+
1295
+ Type: `object`
1296
+
1297
+ | Property | Type | Required | Description |
1298
+ |---|---|---|---|
1299
+ | `task_id` | `string` | Yes | The task ID used to build the prompt. |
1300
+ | `agent_id` | `string` | Yes | The target agent ID for this task. |
1301
+ | `prompt` | `string` | Yes | The full generated prompt text. |
1302
+ | `handoff_schema` | `string` | No | The handoff schema ID for the task result. |
1303
+ | `plugins_applied` | `boolean` | No | Whether plugin prompt enhancers were applied. |
1304
+
1305
+ <details>
1306
+ <summary>JSON Schema</summary>
1307
+
1308
+ ```json
1309
+ {
1310
+ "type": "object",
1311
+ "required": [
1312
+ "task_id",
1313
+ "agent_id",
1314
+ "prompt"
1315
+ ],
1316
+ "properties": {
1317
+ "task_id": {
1318
+ "type": "string",
1319
+ "description": "The task ID used to build the prompt."
1320
+ },
1321
+ "agent_id": {
1322
+ "type": "string",
1323
+ "description": "The target agent ID for this task."
1324
+ },
1325
+ "prompt": {
1326
+ "type": "string",
1327
+ "description": "The full generated prompt text."
1328
+ },
1329
+ "handoff_schema": {
1330
+ "type": "string",
1331
+ "description": "The handoff schema ID for the task result."
1332
+ },
1333
+ "plugins_applied": {
1334
+ "type": "boolean",
1335
+ "description": "Whether plugin prompt enhancers were applied."
1336
+ }
1337
+ }
1338
+ }
1339
+ ```
1340
+
1341
+ </details>
1342
+
1343
+ ### DoctorResult
1344
+
1345
+ Type: `object`
1346
+
1347
+ | Property | Type | Required | Description |
1348
+ |---|---|---|---|
1349
+ | `checks` | `object[]` | Yes | |
1350
+ | `checks[].name` | `string` | Yes | Check name (e.g. config_exists, dsl_exists, manifest_fresh). |
1351
+ | `checks[].status` | `"pass" \| "fail" \| "warn"` | Yes | |
1352
+ | `checks[].message` | `string` | No | Human-readable detail. |
1353
+ | `all_passed` | `boolean` | Yes | |
1354
+
1355
+ <details>
1356
+ <summary>JSON Schema</summary>
1357
+
1358
+ ```json
1359
+ {
1360
+ "type": "object",
1361
+ "required": [
1362
+ "checks",
1363
+ "all_passed"
1364
+ ],
1365
+ "properties": {
1366
+ "checks": {
1367
+ "type": "array",
1368
+ "items": {
1369
+ "type": "object",
1370
+ "required": [
1371
+ "name",
1372
+ "status"
1373
+ ],
1374
+ "properties": {
1375
+ "name": {
1376
+ "type": "string",
1377
+ "description": "Check name (e.g. config_exists, dsl_exists, manifest_fresh)."
1378
+ },
1379
+ "status": {
1380
+ "type": "string",
1381
+ "enum": [
1382
+ "pass",
1383
+ "fail",
1384
+ "warn"
1385
+ ]
1386
+ },
1387
+ "message": {
1388
+ "type": "string",
1389
+ "description": "Human-readable detail."
1390
+ }
1391
+ }
1392
+ }
1393
+ },
1394
+ "all_passed": {
1395
+ "type": "boolean"
1396
+ }
1397
+ }
1398
+ }
1399
+ ```
1400
+
1401
+ </details>
1402
+
1403
+ ### DoctorCheck
1404
+
1405
+ Type: `object`
1406
+
1407
+ | Property | Type | Required | Description |
1408
+ |---|---|---|---|
1409
+ | `name` | `string` | Yes | Check name (e.g. config_exists, dsl_exists, manifest_fresh). |
1410
+ | `status` | `"pass" \| "fail" \| "warn"` | Yes | |
1411
+ | `message` | `string` | No | Human-readable detail. |
1412
+
1413
+ <details>
1414
+ <summary>JSON Schema</summary>
1415
+
1416
+ ```json
1417
+ {
1418
+ "type": "object",
1419
+ "required": [
1420
+ "name",
1421
+ "status"
1422
+ ],
1423
+ "properties": {
1424
+ "name": {
1425
+ "type": "string",
1426
+ "description": "Check name (e.g. config_exists, dsl_exists, manifest_fresh)."
1427
+ },
1428
+ "status": {
1429
+ "type": "string",
1430
+ "enum": [
1431
+ "pass",
1432
+ "fail",
1433
+ "warn"
1434
+ ]
1435
+ },
1436
+ "message": {
1437
+ "type": "string",
1438
+ "description": "Human-readable detail."
1439
+ }
1440
+ }
1441
+ }
1442
+ ```
1443
+
1444
+ </details>