-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathimplementation.json
More file actions
2710 lines (2710 loc) · 114 KB
/
Copy pathimplementation.json
File metadata and controls
2710 lines (2710 loc) · 114 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"name": "implementation",
"description": "Plan, implement, test, and merge a task end-to-end",
"summary": "bootstrap_clone > (claim_and_resolve?) > (create_and_publish?) > make-plan > (review-approach?) > dry-walkthrough > implement > test > merge (per plan part) > (audit-impl?) > (open_pr?) > push > cleanup",
"recipe_version": "1.0.0",
"requires_packs": [
"github",
"ci",
"clone",
"telemetry"
],
"ingredients": {
"task": {
"description": "What to implement",
"required": true
},
"source_dir": {
"description": "Source repository",
"required": false,
"default": "",
"authority": "config"
},
"run_name": {
"description": "Run name prefix",
"default": "impl"
},
"base_branch": {
"description": "Merge target",
"default": "",
"authority": "config"
},
"review_approach": {
"description": "Research approaches first",
"default": "false"
},
"audit_impl": {
"description": "Post-merge quality gate",
"default": "true"
},
"open_pr": {
"description": "PR instead of direct merge",
"default": "true"
},
"arch_lenses": {
"description": "Generate architecture lens diagrams for the PR",
"default": "false"
},
"backend_supports_git_write": {
"description": "Whether the session backend supports .git/ metadata writes (git commit, rebase, worktree add). Resolved from backend capabilities at load time.",
"default": "true",
"hidden": true,
"authority": "config"
},
"auto_merge": {
"description": "Automatically merge the PR after required checks pass — via merge queue when available, direct merge otherwise",
"default": "true"
},
"batch_dispatch": {
"description": "Pack multiple parallel-safe issues per food truck. When \"true\", the fleet dispatcher batches parallel-safe issues (up to max_issues_per_food_truck) into implement-findings food trucks with comma-separated issue_urls.",
"default": "false"
},
"review_max_retries": {
"description": "Maximum number of review-resolve retry cycles before proceeding to CI",
"default": "3"
},
"local_review_rounds": {
"description": "Number of review-resolve cycles to run locally before switching to GitHub-backed review. 0 disables local mode entirely.",
"type": "integer",
"default": "2",
"authority": "config"
},
"merge_fix_max_retries": {
"description": "Maximum number of merge-fix retry cycles before failing",
"default": "3"
},
"audit_remediation_max_retries": {
"description": "Maximum number of audit remediation cycles (audit NO GO recovery) before failing",
"default": "2"
},
"test_fix_max_retries": {
"default": "3",
"description": "Maximum iterations of the pre-merge test → fix → test cycle.",
"hidden": true
},
"merge_test_fix_max_retries": {
"default": "3",
"description": "Maximum iterations of the merge-gate test → fix → test cycle.",
"hidden": true
},
"adversarial_review_level": {
"description": "Controls adversarial review depth in make-plan. \"auto\" estimates complexity and gates agents accordingly. \"full\" always runs all 3 agents. \"none\" skips adversarial review entirely.",
"default": "auto",
"hidden": true,
"authority": "config"
},
"issue_url": {
"description": "GitHub issue to close on merge",
"required": false
},
"upfront_claimed": {
"description": "Set to 'true' when process-issues has already claimed this issue upfront. Allows claim_issue defense step to pass through without aborting.",
"default": "false",
"hidden": true
},
"run_mode": {
"description": "Execution mode when processing multiple issues. Options: sequential (default, one issue at a time) or parallel (all issues simultaneously with wavefront step scheduling — fast steps for all pipelines before any slow step).",
"default": "sequential",
"hidden": true
},
"max_parallel": {
"description": "Maximum number of issues to run in parallel within a single execution-map group. Groups exceeding this cap are split into sequential sub-groups. Passed to build-execution-map. Must be a positive integer (expressed as a string).",
"default": "6",
"hidden": true
},
"post_run_diagnostics": {
"description": "Run diagnostic analysis after pipeline completion",
"default": "false",
"hidden": true,
"authority": "config"
},
"kitchen_id": {
"description": "Kitchen session identifier (auto-injected)",
"default": "",
"hidden": true
},
"is_fleet_dispatch": {
"description": "Whether running as an L2 food truck dispatch (auto-injected)",
"default": "false",
"hidden": true,
"authority": "config"
},
"dispatch_id": {
"description": "Fleet dispatch identifier (auto-injected, empty in non-fleet sessions)",
"default": "",
"hidden": true,
"authority": "config"
},
"diagnostics_log_dir": {
"description": "Resolved diagnostics log directory path (auto-injected)",
"default": "",
"hidden": true
}
},
"kitchen_rules": [
"NEVER use native Claude Code tools (Read, Grep, Glob, Edit, Write, Bash, Agent, WebFetch, WebSearch, NotebookEdit) from the orchestrator. All work is delegated through run_skill.",
"Route to on_failure — never investigate or fix directly from the orchestrator.",
"Process plan parts sequentially. Complete the full cycle (verify → implement → test → merge) for one part before starting the next. Do NOT run verify for all parts upfront.",
"By default (open_pr=true), a feature branch is created with a unique name derived from inputs.run_name and context.issue_number (e.g. impl/124) or a date suffix (e.g. impl/20260304) when no issue is available. All worktree merges target the feature branch (context.merge_target), not base_branch directly. The push step publishes the feature branch, then prepare_pr → run_arch_lenses → compose_pr opens a PR to base_branch. When open_pr=false, merges target base_branch directly and prepare_pr is skipped.",
"When arch_lenses=true (and open_pr=true), prepare_pr routes through run_arch_lenses before compose_pr, adding architecture lens diagrams to the PR. By default arch_lenses is off and prepare_pr routes directly to compose_pr.",
"SOURCE ISOLATION: After bootstrap_clone returns, the source_dir is strictly off-limits. Never run any command in source_dir — no git checkout, git fetch, git reset, git pull, run_cmd, run_skill, or any other operation. All work — skill invocations, git operations, file reads — happens exclusively in the clone (work_dir). source_dir is used ONLY to read the remote URL inside push_to_remote.",
"MERGE ROUTING: check_repo_merge_state performs a single GraphQL round-trip to detect queue_available, merge_group_trigger, and auto_merge_available for the target branch. route_queue_mode then routes to: enable_auto_merge → wait_for_queue ONLY when queue_available=true AND merge_group_trigger=true; direct_merge → wait_for_direct_merge (no queue or trigger missing, autoMergeAllowed=true); or immediate_merge → wait_for_immediate_merge (no queue, autoMergeAllowed=false). Never call gh pr merge directly via run_cmd — all merges go through these named recipe steps so CI enforcement and conflict routing are preserved."
],
"steps": {
"clone": {
"tool": "bootstrap_clone",
"with": {
"source_dir": "${{ inputs.source_dir }}",
"run_name": "${{ inputs.run_name }}",
"base_branch": "${{ inputs.base_branch }}",
"step_name": "bootstrap_clone"
},
"capture": {
"work_dir": "${{ result.work_dir }}",
"remote_url": "${{ result.remote_url }}",
"base_sha": "${{ result.base_sha }}",
"merge_target": "${{ result.merge_target }}"
},
"on_success": "claim_and_resolve",
"on_failure": "escalate_stop",
"note": "Clones source_dir and captures base_sha + merge_target in one turn. Returns work_dir, remote_url, base_sha (SHA of base_branch before any merge), and merge_target (set to base_branch as fallback; overridden by create_and_publish when open_pr=true). On failure, escalate_stop immediately (no clone to remove).\n"
},
"claim_and_resolve": {
"tool": "claim_and_resolve_issue",
"optional": true,
"skip_when_false": "inputs.issue_url",
"with": {
"issue_url": "${{ inputs.issue_url }}",
"allow_reentry": "${{ inputs.upfront_claimed }}"
},
"capture": {
"issue_number": "${{ result.issue_number }}",
"issue_title": "${{ result.issue_title }}",
"issue_slug": "${{ result.issue_slug }}",
"claimed": "${{ result.claimed }}"
},
"on_result": [
{
"when": "${{ result.claimed }} == true",
"route": "create_and_publish"
},
{
"route": "register_clone_failure"
}
],
"on_failure": "register_clone_failure",
"note": "Fetches issue title/slug and claims the issue in one turn. Returns issue_number, issue_title, issue_slug, and claimed boolean. When claimed=false (another session owns it), routes to register_clone_failure before escalate_stop so the clone directory is registered for cleanup. issue_slug and issue_number are passed to create_and_publish for branch naming.\n"
},
"create_and_publish": {
"tool": "create_and_publish_branch",
"optional": true,
"skip_when_false": "inputs.open_pr",
"with": {
"issue_slug": "${{ context.issue_slug }}",
"run_name": "${{ inputs.run_name }}",
"issue_number": "${{ context.issue_number }}",
"work_dir": "${{ context.work_dir }}",
"remote_url": "${{ context.remote_url }}",
"step_name": "create_and_publish_branch"
},
"capture": {
"merge_target": "${{ result.merge_target }}"
},
"on_success": "plan",
"on_failure": "release_issue_failure",
"note": "Computes branch name, creates it (with collision suffix if needed), and pushes to origin in one turn. Overrides merge_target with the feature branch name. merge_worktree requires refs/remotes/origin/{branch} to exist after fetch (step 5.5). When open_pr=false, this step is skipped and merge_target remains as base_branch.\n"
},
"plan": {
"tool": "run_skill",
"model": "",
"with": {
"skill_command": "/autoskillit:make-plan ${{ inputs.task }}",
"cwd": "${{ context.work_dir }}",
"step_name": "plan",
"issue_url": "${{ inputs.issue_url }}",
"issue_title": "${{ context.issue_title }}",
"adversarial_review_level": "${{ inputs.adversarial_review_level }}",
"output_dir": "."
},
"capture": {
"plan_path": "${{ result.plan_path }}",
"all_plan_paths": "${{ result.plan_path }}",
"verdict": "${{ result.verdict }}"
},
"capture_list": {
"plan_parts": "${{ result.plan_parts }}"
},
"retries": 0,
"on_result": [
{
"when": "${{ result.verdict }} == plan",
"route": "review_approach"
},
{
"when": "${{ result.verdict }} == false_positive",
"route": "check_has_commits"
}
],
"on_failure": "release_issue_failure",
"note": "Produces plan in {{AUTOSKILLIT_TEMP}}/make-plan/. Glob plan_dir for *_part_*.md or single plan file. plan_parts context key contains the full ordered list of part files (sorted alphabetically). For a single-part plan, plan_parts has one entry equal to plan_path. REMEDIATION MODE: context.remediation_path is available when the orchestrator re-enters plan from the remediate step; pass it inline in the skill_command rather than as a named with: key. When in remediation mode, also append audit_remediation_mode=true to the skill_command. ACCUMULATION: all_plan_paths accumulates across any re-entries to the plan step (e.g. remediation). For a single-pass run, all_plan_paths equals plan_path (the capture block handles this automatically). When verdict=false_positive, do NOT overwrite all_plan_paths — preserve the existing accumulated value from prior plan executions. ISSUE CONTEXT: If inputs.issue_url is a non-empty string, append it to the skill_command so the make-plan skill can detect and fetch the issue itself: \"/autoskillit:make-plan {task}\\n\\nGitHub Issue: {inputs.issue_url}\" The skill detects the URL pattern and calls fetch_github_issue internally. ADVERSARIAL REVIEW LEVEL: If inputs.adversarial_review_level is a non-empty string, append it to the skill_command: \"/autoskillit:make-plan {task}\\n\\nadversarial_review_level={inputs.adversarial_review_level}\" VERDICT: The skill emits verdict=plan (normal) or verdict=false_positive (remediation finding is a false positive). false_positive skips implement and routes to check_has_commits.\n"
},
"review_approach": {
"tool": "run_skill",
"model": "",
"with": {
"skill_command": "/autoskillit:review-approach ${{ context.plan_path }}",
"cwd": "${{ context.work_dir }}",
"step_name": "review_approach",
"output_dir": "{{AUTOSKILLIT_TEMP}}/review-approach"
},
"capture": {
"review_path": "${{ result.review_path }}"
},
"retries": 1,
"on_success": "verify",
"on_failure": "release_issue_failure",
"on_context_limit": "verify",
"skip_when_false": "inputs.review_approach",
"note": "Only execute this step if review_approach input is 'true'. Otherwise skip directly to verify."
},
"verify": {
"tool": "run_skill",
"model": "",
"with": {
"skill_command": "/autoskillit:dry-walkthrough ${{ context.plan_path }}",
"cwd": "${{ context.work_dir }}",
"step_name": "verify",
"review_path": "${{ context.review_path }}",
"output_dir": "{{AUTOSKILLIT_TEMP}}"
},
"on_success": "create_impl_worktree",
"on_failure": "release_issue_failure",
"note": "SEQUENTIAL EXECUTION: For each plan_part, run the FULL cycle — verify → implement → test → merge — for that part before advancing to the next part. Never run verify for all parts first. If review produced a report, context.review_path is available — pass it as an additional arg to dry-walkthrough."
},
"create_impl_worktree": {
"tool": "run_cmd",
"with": {
"cmd": "bash {{AUTOSKILLIT_SCRIPTS}}/create_impl_worktree.sh \"impl-${{ context.issue_number }}-$(date +%Y%m%d-%H%M%S)\" \"{{AUTOSKILLIT_TEMP}}\"",
"cwd": "${{ context.work_dir }}",
"step_name": "create_impl_worktree"
},
"capture": {
"worktree_path": "${{ result.worktree_path }}"
},
"on_success": "implement",
"on_failure": "release_issue_failure",
"note": "Creates worktree at orchestrator level (unsandboxed) so .git/ metadata writes succeed regardless of backend sandbox constraints."
},
"implement": {
"tool": "run_skill",
"model": "",
"stale_threshold": 2400,
"with": {
"skill_command": "/autoskillit:implement-worktree-no-merge ${{ context.plan_path }}",
"cwd": "${{ context.worktree_path }}",
"step_name": "implement",
"output_dir": "."
},
"capture": {
"worktree_path": "${{ result.worktree_path }}",
"has_implementation_progress": "${{ result.has_implementation_progress }}"
},
"retries": 0,
"on_context_limit": "retry_worktree",
"on_success": "gate_backend_write",
"on_failure": "release_issue_failure",
"optional": true,
"skip_when_false": "inputs.backend_supports_git_write",
"note": "Extracts worktree_path from result for use in subsequent steps."
},
"retry_worktree": {
"tool": "run_skill",
"model": "",
"stale_threshold": 2400,
"with": {
"skill_command": "/autoskillit:retry-worktree ${{ context.plan_path }} ${{ context.worktree_path }}",
"cwd": "${{ context.worktree_path }}",
"step_name": "retry_worktree",
"output_dir": "."
},
"capture": {
"worktree_path": "${{ result.worktree_path }}",
"phases_implemented": "${{ result.phases_implemented }}",
"has_implementation_progress": "${{ result.has_implementation_progress }}",
"deviation_manifest_path": {
"from": "${{ result.deviation_manifest_path }}",
"type": "optional_string"
}
},
"on_result": [
{
"when": "${{ result.phases_implemented }} > 0",
"route": "check_changes"
},
{
"route": "check_changes"
}
],
"on_context_limit": "check_changes",
"on_exhausted": "release_issue_failure",
"on_failure": "release_issue_failure",
"optional": true,
"skip_when_false": "inputs.backend_supports_git_write"
},
"gate_backend_write": {
"tool": "run_python",
"with": {
"callable": "autoskillit.smoke_utils.gate_backend_write",
"backend_supports_git_write": "${{ inputs.backend_supports_git_write }}"
},
"on_result": [
{
"when": "${{ result.backend_capable }} == false",
"route": "release_issue_failure"
},
{
"route": "check_changes"
}
],
"on_failure": "release_issue_failure"
},
"check_changes": {
"tool": "run_python",
"with": {
"callable": "autoskillit.smoke_utils.detect_zero_changes",
"worktree_path": "${{ context.worktree_path }}",
"base_branch": "${{ inputs.base_branch }}",
"write_evidence_override": "${{ context.has_implementation_progress }}"
},
"capture": {
"has_changes": "${{ result.has_changes }}",
"commit_count": "${{ result.commit_count }}"
},
"on_result": [
{
"when": "${{ result.has_changes }} == false",
"route": "close_issue_no_changes"
},
{
"route": "test"
}
],
"on_failure": "release_issue_failure"
},
"close_issue_no_changes": {
"description": "Release issue after zero-change detection — stages on non-default branch, closes on promotion target",
"tool": "release_issue",
"optional": true,
"skip_when_false": "inputs.issue_url",
"with": {
"issue_url": "${{ inputs.issue_url }}",
"target_branch": "${{ inputs.base_branch }}",
"close_issue": "true"
},
"on_success": "register_clone_no_changes",
"on_failure": "register_clone_no_changes",
"note": "Zero changes detected post-implement. Passes target_branch so release_issue stages on non-default branches (base_branch != promotion_target) or closes on the promotion target branch. close_issue is silently ignored by release_issue when staging applies (Branch 1 takes precedence over Branch 3). Routes to register_clone_no_changes for clone cleanup and distinct terminal."
},
"test": {
"tool": "test_check",
"with": {
"worktree_path": "${{ context.worktree_path }}"
},
"on_success": "commit_guard",
"on_failure": "check_test_fix_loop"
},
"check_merge_fix_loop": {
"tool": "run_python",
"with": {
"callable": "autoskillit.smoke_utils.check_loop_iteration",
"current_iteration": "${{ context.merge_fix_count }}",
"max_iterations": "${{ inputs.merge_fix_max_retries }}"
},
"capture": {
"merge_fix_count": "${{ result.next_iteration }}"
},
"on_result": [
{
"when": "${{ result.max_exceeded }} == true",
"route": "release_issue_failure"
},
{
"route": "diagnose_merge_gate"
}
],
"on_failure": "release_issue_failure",
"optional_context_refs": [
"merge_fix_count"
],
"note": "Merge-failure iteration guard (dirty_tree / test_gate / post_rebase_test_gate). Shares merge_fix_count with check_merge_rebase_loop and check_dirty_main_retry.\n"
},
"diagnose_merge_gate": {
"tool": "run_python",
"with": {
"callable": "autoskillit.smoke_utils.diagnose_merge_gate",
"test_stdout": "${{ context.merge_test_stdout }}",
"test_stderr": "${{ context.merge_test_stderr }}",
"output_dir": "{{AUTOSKILLIT_TEMP}}/diagnose-merge-gate",
"work_dir": "${{ context.work_dir }}",
"failed_step": "${{ context.merge_failed_step }}"
},
"capture": {
"merge_gate_diagnosis_path": "${{ result.diagnosis_path }}",
"merge_gate_ci_conclusion": "${{ result.ci_conclusion }}"
},
"on_success": "merge_gate_fix",
"on_failure": "merge_gate_fix",
"optional_context_refs": [
"merge_test_stdout",
"merge_test_stderr",
"merge_failed_step"
],
"note": "Writes a structured diagnosis file from merge gate test output, mirroring diagnose-ci format. Routes to fix on both success and failure — fix proceeds without context if diagnosis fails. Uses distinct context keys (merge_gate_*) to avoid collision with ci_watch/diagnose_ci context variables from the CI path.\n"
},
"check_merge_rebase_loop": {
"tool": "run_python",
"with": {
"callable": "autoskillit.smoke_utils.check_loop_iteration",
"current_iteration": "${{ context.merge_fix_count }}",
"max_iterations": "${{ inputs.merge_fix_max_retries }}"
},
"capture": {
"merge_fix_count": "${{ result.next_iteration }}"
},
"on_result": [
{
"when": "${{ result.max_exceeded }} == true",
"route": "release_issue_failure"
},
{
"route": "rebase_conflict_fix"
}
],
"on_failure": "release_issue_failure",
"optional_context_refs": [
"merge_fix_count"
],
"note": "Merge-failure iteration guard for rebase conflicts. Shares merge_fix_count with check_merge_fix_loop and check_dirty_main_retry.\n"
},
"check_dirty_main_retry": {
"tool": "run_python",
"with": {
"callable": "autoskillit.smoke_utils.check_loop_iteration",
"current_iteration": "${{ context.merge_fix_count }}",
"max_iterations": "${{ inputs.merge_fix_max_retries }}"
},
"capture": {
"merge_fix_count": "${{ result.next_iteration }}"
},
"on_result": [
{
"when": "${{ result.max_exceeded }} == true",
"route": "release_issue_failure"
},
{
"route": "commit_guard"
}
],
"on_failure": "release_issue_failure",
"optional_context_refs": [
"merge_fix_count"
],
"note": "Merge-failure iteration guard for dirty_main_repo retries. Shares merge_fix_count with check_merge_fix_loop and check_merge_rebase_loop.\n"
},
"check_ref_push_loop": {
"tool": "run_python",
"with": {
"callable": "autoskillit.smoke_utils.check_loop_iteration",
"current_iteration": "${{ context.ref_push_count }}",
"max_iterations": "2"
},
"capture": {
"ref_push_count": "${{ result.next_iteration }}"
},
"on_result": [
{
"when": "${{ result.max_exceeded }} == true",
"route": "release_issue_failure"
},
{
"route": "ref_push"
}
],
"on_failure": "release_issue_failure",
"optional_context_refs": [
"ref_push_count"
],
"note": "Ref-coherence recovery guard. Uses a SEPARATE counter (ref_push_count, max 2) from merge_fix_count. Push-and-retry is cheap and near-deterministic (no LLM invocation), so it does not share the merge_fix_count budget. If max exceeded, the divergence is not fixable by pushing — escalate.\n"
},
"ref_push": {
"tool": "push_to_remote",
"with": {
"clone_path": "${{ context.work_dir }}",
"remote_url": "${{ context.remote_url }}",
"branch": "${{ context.merge_target }}",
"force": "true"
},
"on_success": "commit_guard",
"on_failure": "release_issue_failure",
"note": "Pushes the feature branch to remote to resolve ref_coherence divergence. After push, routes back to commit_guard → main_repo_guard → merge to retry the merge with aligned local/remote SHAs.\n"
},
"check_audit_remediation_loop": {
"tool": "run_python",
"with": {
"callable": "autoskillit.smoke_utils.check_loop_iteration",
"current_iteration": "${{ context.audit_remediation_count }}",
"max_iterations": "${{ inputs.audit_remediation_max_retries }}"
},
"capture": {
"audit_remediation_count": "${{ result.next_iteration }}"
},
"on_result": [
{
"when": "${{ result.max_exceeded }} == true",
"route": "release_issue_failure"
},
{
"route": "remediate"
}
],
"on_failure": "release_issue_failure",
"optional_context_refs": [
"audit_remediation_count"
],
"note": "Guards the audit_impl → remediate → plan → implement → test remediation cycle. Separate counter from merge_fix_count.\n"
},
"commit_guard": {
"tool": "run_python",
"with": {
"callable": "autoskillit.recipe._cmd_rpc.commit_guard",
"worktree_path": "${{ context.worktree_path }}",
"base_branch": "${{ inputs.base_branch }}"
},
"on_result": [
{
"when": "${{ result.committed }} == 'regression_detected'",
"route": "release_issue_failure"
},
{
"route": "main_repo_guard"
}
],
"on_failure": "main_repo_guard",
"note": "Belt-and-suspenders guard: auto-commits any uncommitted changes before merge. Catches dirty state from context-exhausted skills, cascading pre-commit auto-fixes, or any other source. Routes to main_repo_guard to handle dirty main repo state.\n"
},
"main_repo_guard": {
"tool": "run_python",
"with": {
"callable": "autoskillit.recipe._cmd_rpc.main_repo_guard",
"clone_path": "${{ context.work_dir }}"
},
"on_result": [
{
"when": "${{ result.cleaned }} == 'failed'",
"route": "release_issue_failure"
},
{
"route": "merge"
}
],
"on_failure": "merge",
"note": "Stashes uncommitted changes in the main repo before merge. Catches dirty state from infrastructure-terminated sessions that left artifacts in the clone. Routes to merge on both success and failure (merge's dirty_main_repo gate handles persistent issues).\n"
},
"merge": {
"tool": "merge_worktree",
"with": {
"worktree_path": "${{ context.worktree_path }}",
"base_branch": "${{ context.merge_target }}"
},
"capture": {
"cleanup_succeeded": "${{ result.cleanup_succeeded }}",
"worktree_path": "${{ result.worktree_path }}",
"merge_test_stdout": "${{ result.test_stdout }}",
"merge_test_stderr": "${{ result.test_stderr }}",
"merge_failed_step": "${{ result.failed_step }}"
},
"on_result": [
{
"when": "result.failed_step == 'dirty_tree'",
"route": "check_merge_fix_loop"
},
{
"when": "result.failed_step == 'test_gate'",
"route": "check_merge_fix_loop"
},
{
"when": "result.failed_step == 'post_rebase_test_gate'",
"route": "check_merge_fix_loop"
},
{
"when": "result.failed_step == 'rebase'",
"route": "check_merge_rebase_loop"
},
{
"when": "result.failed_step == 'dirty_main_repo'",
"route": "check_dirty_main_retry"
},
{
"when": "result.failed_step == 'ref_coherence'",
"route": "check_ref_push_loop"
},
{
"when": "result.error",
"route": "release_issue_failure"
},
{
"route": "inter_part_push"
}
],
"on_failure": "release_issue_failure",
"note": "After merge, route to inter_part_push to sync the remote branch, then next_or_done to process remaining parts before pushing. By default (open_pr=true), merge_target is the feature branch named from run_name. When open_pr=false, merge_target equals base_branch — merges go directly to base. dirty_tree and test_gate failures route to fix (resolve-failures) for recovery; all other failures route to release_issue_failure.\n"
},
"check_has_commits": {
"tool": "run_python",
"with": {
"callable": "autoskillit.smoke_utils.check_commits_ahead",
"cwd": "${{ context.work_dir }}",
"base_branch": "${{ inputs.base_branch }}"
},
"on_result": [
{
"when": "${{ result.has_commits }}",
"route": "push"
},
{
"route": "close_issue_already_done"
}
],
"on_failure": "release_issue_failure"
},
"close_issue_already_done": {
"description": "Close issue as already-implemented when branch has zero commits ahead of base",
"tool": "run_python",
"optional": true,
"skip_when_false": "inputs.issue_url",
"with": {
"callable": "autoskillit.smoke_utils.close_issue_already_done",
"issue_url": "${{ inputs.issue_url }}"
},
"on_success": "register_clone_already_done",
"on_failure": "register_clone_already_done",
"note": "Zero commits ahead of base means the feature is already merged. Remove in-progress label, close issue with \"already implemented\" comment, and route to clone cleanup with distinct terminal.\n"
},
"push": {
"tool": "push_to_remote",
"with": {
"clone_path": "${{ context.work_dir }}",
"remote_url": "${{ context.remote_url }}",
"branch": "${{ context.merge_target }}",
"force": "true"
},
"on_success": "prepare_pr",
"on_failure": "release_issue_failure",
"note": "Runs once at the end, after check_has_commits confirms commits exist. Pushes merge_target branch from the clone to the upstream remote. By default (open_pr=true), this pushes the feature branch; when open_pr=false, pushes base_branch. Uses the pre-resolved remote_url captured at clone time, preserving clone isolation. On success, routes to prepare_pr (which opens the PR by default; skipped when open_pr=false). On failure, release_issue_failure registers the clone and escalates.\n"
},
"fix": {
"tool": "run_skill",
"model": "",
"with": {
"skill_command": "/autoskillit:resolve-failures ${{ context.worktree_path }} ${{ context.plan_path }} ${{ inputs.base_branch }} ${{ context.merge_gate_ci_conclusion }} - ${{ context.merge_gate_diagnosis_path }}",
"cwd": "${{ context.worktree_path }}",
"step_name": "fix",
"output_dir": "."
},
"capture": {
"verdict": "${{ result.verdict }}",
"fixes_applied": "${{ result.fixes_applied }}",
"deviation_manifest_path": {
"from": "${{ result.deviation_manifest_path }}",
"type": "optional_string"
}
},
"on_result": [
{
"when": "${{ result.verdict }} == 'real_fix'",
"route": "test"
},
{
"when": "${{ result.verdict }} == 'already_green'",
"route": "test"
},
{
"when": "${{ result.verdict }} == 'flake_suspected'",
"route": "test"
},
{
"when": "${{ result.verdict }} == 'ci_only_failure'",
"route": "release_issue_failure"
},
{
"when": "${{ result.verdict }} == 'no_test_infrastructure'",
"route": "release_issue_failure"
},
{
"route": "release_issue_failure"
}
],
"on_failure": "release_issue_failure",
"on_context_limit": "release_issue_failure",
"on_rate_limit": "release_issue_failure",
"optional": true,
"skip_when_false": "inputs.backend_supports_git_write",
"optional_context_refs": [
"merge_gate_ci_conclusion",
"merge_gate_diagnosis_path"
],
"note": "Fixes test failures without merging. Routes to test for verification; test failure increments check_test_fix_loop before retrying."
},
"check_test_fix_loop": {
"tool": "run_python",
"with": {
"callable": "autoskillit.smoke_utils.check_loop_iteration",
"current_iteration": "${{ context.test_fix_loop_count }}",
"max_iterations": "${{ inputs.test_fix_max_retries }}"
},
"capture": {
"test_fix_loop_count": "${{ result.next_iteration }}"
},
"on_result": [
{
"when": "${{ result.max_exceeded }} == true",
"route": "release_issue_failure"
},
{
"route": "fix"
}
],
"on_failure": "release_issue_failure",
"optional_context_refs": [
"test_fix_loop_count"
],
"note": "Guards the pre-merge test → fix → test cycle. Caps at test_fix_max_retries iterations (default 3). Counter increments after test failure, so the last fix attempt always gets verified before the budget is exhausted."
},
"merge_gate_fix": {
"tool": "run_skill",
"model": "",
"with": {
"skill_command": "/autoskillit:resolve-failures ${{ context.worktree_path }} ${{ context.plan_path }} ${{ inputs.base_branch }} ${{ context.merge_gate_ci_conclusion }} - ${{ context.merge_gate_diagnosis_path }}",
"cwd": "${{ context.worktree_path }}",
"step_name": "merge_gate_fix",
"output_dir": "."
},
"capture": {
"verdict": "${{ result.verdict }}",
"fixes_applied": "${{ result.fixes_applied }}",
"deviation_manifest_path": {
"from": "${{ result.deviation_manifest_path }}",
"type": "optional_string"
}
},
"on_result": [
{
"when": "${{ result.verdict }} == 'real_fix'",
"route": "merge_gate_test"
},
{
"when": "${{ result.verdict }} == 'already_green'",
"route": "merge_gate_test"
},
{
"when": "${{ result.verdict }} == 'flake_suspected'",
"route": "merge_gate_test"
},
{
"when": "${{ result.verdict }} == 'ci_only_failure'",
"route": "release_issue_failure"
},
{
"when": "${{ result.verdict }} == 'no_test_infrastructure'",
"route": "release_issue_failure"
},
{
"route": "release_issue_failure"
}
],
"on_failure": "release_issue_failure",
"on_context_limit": "release_issue_failure",
"on_rate_limit": "release_issue_failure",
"optional": true,
"skip_when_false": "inputs.backend_supports_git_write",
"optional_context_refs": [
"merge_gate_ci_conclusion",
"merge_gate_diagnosis_path"
],
"note": "Merge-gate-path variant of fix. Uses a separate counter (merge_test_fix_loop_count) so merge-gate retries do not drain the pre-merge test fix budget."
},
"merge_gate_test": {
"tool": "test_check",
"with": {
"worktree_path": "${{ context.worktree_path }}"
},
"on_success": "commit_guard",
"on_failure": "check_merge_test_fix_loop"
},
"check_merge_test_fix_loop": {
"tool": "run_python",
"with": {
"callable": "autoskillit.smoke_utils.check_loop_iteration",
"current_iteration": "${{ context.merge_test_fix_loop_count }}",
"max_iterations": "${{ inputs.merge_test_fix_max_retries }}"
},
"capture": {
"merge_test_fix_loop_count": "${{ result.next_iteration }}"
},
"on_result": [
{
"when": "${{ result.max_exceeded }} == true",
"route": "release_issue_failure"
},
{
"route": "merge_gate_fix"
}
],
"on_failure": "release_issue_failure",
"optional_context_refs": [
"merge_test_fix_loop_count"
],
"note": "Merge-gate test fix iteration guard. Uses merge_test_fix_loop_count (independent of test_fix_loop_count) to prevent merge-gate retries from consuming the pre-merge fix budget."
},
"rebase_conflict_fix": {
"tool": "run_skill",
"model": "",
"with": {
"skill_command": "/autoskillit:resolve-merge-conflicts ${{ context.worktree_path }} ${{ context.plan_path }} ${{ inputs.base_branch }}",
"cwd": "${{ context.worktree_path }}",
"step_name": "rebase_conflict_fix",
"output_dir": "."
},
"capture": {
"conflict_escalation_required": "${{ result.escalation_required }}"
},
"on_result": [
{
"when": "${{ result.escalation_required }} == true",
"route": "release_issue_failure"
},
{
"route": "test"
}
],
"on_failure": "release_issue_failure",
"on_context_limit": "release_issue_failure",
"retries": 1,
"on_exhausted": "release_issue_failure",
"optional": true,
"skip_when_false": "inputs.backend_supports_git_write"
},
"inter_part_push": {
"tool": "push_to_remote",
"with": {
"clone_path": "${{ context.work_dir }}",
"remote_url": "${{ context.remote_url }}",
"branch": "${{ context.merge_target }}",
"force": "true"
},
"on_success": "next_or_done",
"on_failure": "next_or_done",
"note": "Pushes the feature branch to remote after each part's merge succeeds. Closes the ref_coherence divergence window between multi-part merges. Routes to next_or_done on both success and failure — push failure here is not fatal; the ref_coherence recovery route handles it if the next part's merge detects divergence.\n"
},
"next_or_done": {
"action": "route",
"on_result": [
{
"when": "${{ result.next }} == more_parts",
"route": "verify"
},
{
"route": "audit_impl"
}
],
"note": "Routing step — no tool call. The agent evaluates what comes next: 1. If more plan_parts remain for the current plan → go to verify with next part. 2. If all plan_parts are complete → go to audit_impl.\n"
},
"audit_impl": {
"tool": "run_skill",
"model": "",
"with": {
"skill_command": "/autoskillit:audit-impl ${{ context.all_plan_paths }} ${{ context.base_sha }} ${{ inputs.base_branch }} deviation_manifest_path=${{ context.deviation_manifest_path }}",
"cwd": "${{ context.work_dir }}",
"step_name": "audit_impl",
"output_dir": "{{AUTOSKILLIT_TEMP}}/audit-impl"
},
"capture": {
"remediation_path": "${{ result.remediation_path }}"
},
"on_result": [
{
"when": "${{ result.verdict }} == GO",
"route": "check_has_commits"
},
{
"when": "result.error",
"route": "register_clone_failure"
},
{
"route": "check_audit_remediation_loop"
}
],
"on_failure": "register_clone_failure",
"on_context_limit": "register_clone_failure",
"optional": true,
"skip_when_false": "inputs.audit_impl",
"optional_context_refs": [
"deviation_manifest_path"
],
"note": "Only execute if inputs.audit_impl is 'true'. If false, skip directly to check_has_commits. Captures verdict and remediation_path. Routes GO → push, NO GO → remediate which re-enters the plan step with the remediation file. All parts have been merged at this point — no worktree exists. Uses context.base_sha (a stable commit SHA captured before any merge began) as implementation_ref. A SHA names a git object and survives git branch -D unconditionally. HEAD points to merge_target (the feature branch tip when open_pr=true, or base_branch when open_pr=false). The diff git diff base_sha..HEAD covers the full implementation.\n"
},
"remediate": {
"action": "route",
"with": {
"remediation_path": "${{ context.remediation_path }}"
},
"on_success": "plan"
},
"prepare_pr": {
"tool": "run_skill",
"model": "",
"retries": 1,
"with": {
"skill_command": "/autoskillit:prepare-pr ${{ context.all_plan_paths }} ${{ inputs.run_name }} ${{ inputs.base_branch }} ${{ context.issue_number }} ${{ inputs.arch_lenses }}",
"cwd": "${{ context.work_dir }}",
"output_dir": ".",
"step_name": "prepare_pr"
},
"capture": {
"prep_path": "${{ result.prep_path }}",
"selected_lenses": "${{ result.selected_lenses }}",
"lens_context_paths": "${{ result.lens_context_paths }}"
},
"on_result": [
{
"when": "${{ result.prep_path }} and ${{ inputs.arch_lenses }} == 'true'",
"route": "run_arch_lenses"
},
{
"when": "${{ result.prep_path }}",
"route": "compose_pr"
},
{
"route": "release_issue_failure"
}
],
"on_failure": "release_issue_failure",
"on_context_limit": "prepare_pr",
"on_exhausted": "release_issue_failure",
"optional": true,
"skip_when_false": "inputs.open_pr",
"note": "Reads plan(s), runs git diff, classifies changed files, selects 1–3 arch-lens slugs, writes one PR context file per lens, and writes a PR prep file. Does NOT invoke arch-lens skills.\n"
},
"run_arch_lenses": {
"tool": "run_skill",
"model": "",