agentic-forge 0.0.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.
Files changed (110) hide show
  1. package/.gitattributes +24 -0
  2. package/.github/workflows/ci.yml +70 -0
  3. package/.markdownlint-cli2.jsonc +16 -0
  4. package/.prettierignore +3 -0
  5. package/.prettierrc +6 -0
  6. package/.vscode/agentic-forge.code-workspace +26 -0
  7. package/CHANGELOG.md +100 -0
  8. package/CLAUDE.md +158 -0
  9. package/CONTRIBUTING.md +152 -0
  10. package/LICENSE +21 -0
  11. package/README.md +145 -0
  12. package/agentic-forge-banner.png +0 -0
  13. package/biome.json +21 -0
  14. package/package.json +5 -0
  15. package/scripts/copy-assets.js +21 -0
  16. package/src/agents/explorer.md +97 -0
  17. package/src/agents/reviewer.md +137 -0
  18. package/src/checkpoints/manager.ts +119 -0
  19. package/src/claude/.claude/skills/analyze/SKILL.md +241 -0
  20. package/src/claude/.claude/skills/analyze/references/bug.md +62 -0
  21. package/src/claude/.claude/skills/analyze/references/debt.md +76 -0
  22. package/src/claude/.claude/skills/analyze/references/doc.md +67 -0
  23. package/src/claude/.claude/skills/analyze/references/security.md +76 -0
  24. package/src/claude/.claude/skills/analyze/references/style.md +72 -0
  25. package/src/claude/.claude/skills/create-checkpoint/SKILL.md +88 -0
  26. package/src/claude/.claude/skills/create-log/SKILL.md +75 -0
  27. package/src/claude/.claude/skills/fix-analyze/SKILL.md +102 -0
  28. package/src/claude/.claude/skills/git-branch/SKILL.md +71 -0
  29. package/src/claude/.claude/skills/git-commit/SKILL.md +107 -0
  30. package/src/claude/.claude/skills/git-pr/SKILL.md +96 -0
  31. package/src/claude/.claude/skills/orchestrate/SKILL.md +120 -0
  32. package/src/claude/.claude/skills/sdlc-plan/SKILL.md +163 -0
  33. package/src/claude/.claude/skills/sdlc-plan/references/bug.md +115 -0
  34. package/src/claude/.claude/skills/sdlc-plan/references/chore.md +105 -0
  35. package/src/claude/.claude/skills/sdlc-plan/references/feature.md +130 -0
  36. package/src/claude/.claude/skills/sdlc-review/SKILL.md +215 -0
  37. package/src/claude/.claude/skills/workflow-builder/SKILL.md +185 -0
  38. package/src/claude/.claude/skills/workflow-builder/references/REFERENCE.md +487 -0
  39. package/src/claude/.claude/skills/workflow-builder/references/workflow-example.yaml +427 -0
  40. package/src/cli.ts +182 -0
  41. package/src/commands/config-cmd.ts +28 -0
  42. package/src/commands/index.ts +21 -0
  43. package/src/commands/init.ts +96 -0
  44. package/src/commands/release-notes.ts +85 -0
  45. package/src/commands/resume.ts +103 -0
  46. package/src/commands/run.ts +234 -0
  47. package/src/commands/shortcuts.ts +11 -0
  48. package/src/commands/skills-dir.ts +11 -0
  49. package/src/commands/status.ts +112 -0
  50. package/src/commands/update.ts +64 -0
  51. package/src/commands/version.ts +27 -0
  52. package/src/commands/workflows.ts +129 -0
  53. package/src/config.ts +129 -0
  54. package/src/console.ts +790 -0
  55. package/src/executor.ts +354 -0
  56. package/src/git/worktree.ts +236 -0
  57. package/src/logging/logger.ts +95 -0
  58. package/src/orchestrator.ts +815 -0
  59. package/src/parser.ts +225 -0
  60. package/src/progress.ts +306 -0
  61. package/src/prompts/agentic-system.md +31 -0
  62. package/src/ralph-loop.ts +260 -0
  63. package/src/renderer.ts +164 -0
  64. package/src/runner.ts +634 -0
  65. package/src/signal-manager.ts +55 -0
  66. package/src/steps/base.ts +71 -0
  67. package/src/steps/conditional-step.ts +144 -0
  68. package/src/steps/index.ts +15 -0
  69. package/src/steps/parallel-step.ts +213 -0
  70. package/src/steps/prompt-step.ts +121 -0
  71. package/src/steps/ralph-loop-step.ts +186 -0
  72. package/src/steps/serial-step.ts +84 -0
  73. package/src/templates/analysis/bug.md.j2 +35 -0
  74. package/src/templates/analysis/debt.md.j2 +38 -0
  75. package/src/templates/analysis/doc.md.j2 +45 -0
  76. package/src/templates/analysis/security.md.j2 +35 -0
  77. package/src/templates/analysis/style.md.j2 +44 -0
  78. package/src/templates/analysis-summary.md.j2 +58 -0
  79. package/src/templates/checkpoint.md.j2 +27 -0
  80. package/src/templates/implementation-report.md.j2 +81 -0
  81. package/src/templates/memory.md.j2 +16 -0
  82. package/src/templates/plan-bug.md.j2 +42 -0
  83. package/src/templates/plan-chore.md.j2 +27 -0
  84. package/src/templates/plan-feature.md.j2 +41 -0
  85. package/src/templates/progress.json.j2 +16 -0
  86. package/src/templates/ralph-report.md.j2 +45 -0
  87. package/src/types.ts +141 -0
  88. package/src/workflows/analyze-codebase-merge.yaml +328 -0
  89. package/src/workflows/analyze-codebase.yaml +196 -0
  90. package/src/workflows/analyze-single.yaml +56 -0
  91. package/src/workflows/demo.yaml +180 -0
  92. package/src/workflows/one-shot.yaml +54 -0
  93. package/src/workflows/plan-build-review.yaml +160 -0
  94. package/src/workflows/ralph-loop.yaml +73 -0
  95. package/tests/config.test.ts +219 -0
  96. package/tests/console.test.ts +506 -0
  97. package/tests/executor.test.ts +339 -0
  98. package/tests/init.test.ts +86 -0
  99. package/tests/logger.test.ts +110 -0
  100. package/tests/parser.test.ts +290 -0
  101. package/tests/progress.test.ts +345 -0
  102. package/tests/ralph-loop.test.ts +418 -0
  103. package/tests/renderer.test.ts +350 -0
  104. package/tests/runner.test.ts +497 -0
  105. package/tests/setup.test.ts +7 -0
  106. package/tests/signal-manager.test.ts +26 -0
  107. package/tests/steps.test.ts +412 -0
  108. package/tests/worktree.test.ts +411 -0
  109. package/tsconfig.json +18 -0
  110. package/vitest.config.ts +8 -0
@@ -0,0 +1,196 @@
1
+ name: analyze-codebase
2
+ version: "1.0"
3
+ description: Run comprehensive codebase analysis with optional autofix in parallel worktrees
4
+
5
+ settings:
6
+ max-retry: 2
7
+ timeout-minutes: 120
8
+ track-progress: true
9
+ terminal-output: base
10
+
11
+ variables:
12
+ - name: autofix
13
+ type: string
14
+ required: false
15
+ default: "none"
16
+ description: Severity level for automatic fixes (none, minor, major, critical)
17
+ - name: paths
18
+ type: string
19
+ required: false
20
+ default: ""
21
+ description: Space-separated list of paths to analyze (optional)
22
+ - name: create_pr
23
+ type: boolean
24
+ required: false
25
+ default: false
26
+ description: Whether to create a PR for each analysis branch
27
+ - name: max_fix_iterations
28
+ type: number
29
+ required: false
30
+ default: 25
31
+ description: Maximum iterations per analysis type for fixing issues
32
+
33
+ steps:
34
+ - name: analyze-and-fix-all
35
+ type: parallel
36
+ merge-strategy: wait-all
37
+ merge-mode: independent
38
+ git:
39
+ worktree: true
40
+ branch-prefix: "agentic/analysis"
41
+ steps:
42
+ - name: bug-analysis
43
+ type: serial
44
+ steps:
45
+ - name: analyze-bug
46
+ type: prompt
47
+ prompt: /af-analyze bug {{ variables.paths }}
48
+
49
+ - name: fix-bug
50
+ type: conditional
51
+ condition: "variables.autofix != 'none'"
52
+ then:
53
+ - name: apply-bug-fixes
54
+ type: ralph-loop
55
+ max-iterations: "{{ variables.max_fix_iterations }}"
56
+ completion-promise: "BUG_FIXES_COMPLETE"
57
+ model: sonnet
58
+ timeout-minutes: 30
59
+ prompt: |
60
+ Use /af-fix-analyze bug {{ variables.autofix }}
61
+
62
+ Return completion promise "BUG_FIXES_COMPLETE" when done.
63
+
64
+ - name: create-bug-pr
65
+ type: conditional
66
+ condition: "variables.create_pr"
67
+ then:
68
+ - name: open-bug-pr
69
+ type: prompt
70
+ prompt: /af-git-pr "[Analysis] Bug analysis and fixes"
71
+
72
+ - name: debt-analysis
73
+ type: serial
74
+ steps:
75
+ - name: analyze-debt
76
+ type: prompt
77
+ prompt: /af-analyze debt {{ variables.paths }}
78
+
79
+ - name: fix-debt
80
+ type: conditional
81
+ condition: "variables.autofix != 'none'"
82
+ then:
83
+ - name: apply-debt-fixes
84
+ type: ralph-loop
85
+ max-iterations: "{{ variables.max_fix_iterations }}"
86
+ completion-promise: "DEBT_FIXES_COMPLETE"
87
+ model: sonnet
88
+ timeout-minutes: 30
89
+ prompt: |
90
+ Use /af-fix-analyze debt {{ variables.autofix }}
91
+
92
+ Return completion promise "DEBT_FIXES_COMPLETE" when done.
93
+
94
+ - name: create-debt-pr
95
+ type: conditional
96
+ condition: "variables.create_pr"
97
+ then:
98
+ - name: open-debt-pr
99
+ type: prompt
100
+ prompt: /af-git-pr "[Analysis] Technical debt analysis and fixes"
101
+
102
+ - name: doc-analysis
103
+ type: serial
104
+ steps:
105
+ - name: analyze-doc
106
+ type: prompt
107
+ prompt: /af-analyze doc {{ variables.paths }}
108
+
109
+ - name: fix-doc
110
+ type: conditional
111
+ condition: "variables.autofix != 'none'"
112
+ then:
113
+ - name: apply-doc-fixes
114
+ type: ralph-loop
115
+ max-iterations: "{{ variables.max_fix_iterations }}"
116
+ completion-promise: "DOC_FIXES_COMPLETE"
117
+ model: sonnet
118
+ timeout-minutes: 30
119
+ prompt: |
120
+ Use /af-fix-analyze doc {{ variables.autofix }}
121
+
122
+ Return completion promise "DOC_FIXES_COMPLETE" when done.
123
+
124
+ - name: create-doc-pr
125
+ type: conditional
126
+ condition: "variables.create_pr"
127
+ then:
128
+ - name: open-doc-pr
129
+ type: prompt
130
+ prompt: /af-git-pr "[Analysis] Documentation analysis and fixes"
131
+
132
+ - name: security-analysis
133
+ type: serial
134
+ steps:
135
+ - name: analyze-security
136
+ type: prompt
137
+ prompt: /af-analyze security {{ variables.paths }}
138
+
139
+ - name: fix-security
140
+ type: conditional
141
+ condition: "variables.autofix != 'none'"
142
+ then:
143
+ - name: apply-security-fixes
144
+ type: ralph-loop
145
+ max-iterations: "{{ variables.max_fix_iterations }}"
146
+ completion-promise: "SECURITY_FIXES_COMPLETE"
147
+ model: sonnet
148
+ timeout-minutes: 30
149
+ prompt: |
150
+ Use /af-fix-analyze security {{ variables.autofix }}
151
+
152
+ Return completion promise "SECURITY_FIXES_COMPLETE" when done.
153
+
154
+ - name: create-security-pr
155
+ type: conditional
156
+ condition: "variables.create_pr"
157
+ then:
158
+ - name: open-security-pr
159
+ type: prompt
160
+ prompt: /af-git-pr "[Analysis] Security analysis and fixes"
161
+
162
+ - name: style-analysis
163
+ type: serial
164
+ steps:
165
+ - name: analyze-style
166
+ type: prompt
167
+ prompt: /af-analyze style {{ variables.paths }}
168
+
169
+ - name: fix-style
170
+ type: conditional
171
+ condition: "variables.autofix != 'none'"
172
+ then:
173
+ - name: apply-style-fixes
174
+ type: ralph-loop
175
+ max-iterations: "{{ variables.max_fix_iterations }}"
176
+ completion-promise: "STYLE_FIXES_COMPLETE"
177
+ model: sonnet
178
+ timeout-minutes: 30
179
+ prompt: |
180
+ Use /af-fix-analyze style {{ variables.autofix }}
181
+
182
+ Return completion promise "STYLE_FIXES_COMPLETE" when done.
183
+
184
+ - name: create-style-pr
185
+ type: conditional
186
+ condition: "variables.create_pr"
187
+ then:
188
+ - name: open-style-pr
189
+ type: prompt
190
+ prompt: /af-git-pr "[Analysis] Style analysis and fixes"
191
+
192
+ outputs:
193
+ - name: analysis-summary
194
+ template: analysis-summary.md.j2
195
+ path: summary.md
196
+ when: completed
@@ -0,0 +1,56 @@
1
+ name: analyze-single
2
+ version: "1.0"
3
+ description: Run a single type of codebase analysis with optional autofix
4
+
5
+ settings:
6
+ max-retry: 2
7
+ timeout-minutes: 60
8
+ track-progress: true
9
+ terminal-output: base
10
+
11
+ variables:
12
+ - name: analysis_type
13
+ type: string
14
+ required: true
15
+ description: Type of analysis to run (bug, debt, doc, security, style)
16
+ - name: autofix
17
+ type: string
18
+ required: false
19
+ default: "none"
20
+ description: Severity level for automatic fixes (none, low, medium, high, critical)
21
+ - name: paths
22
+ type: string
23
+ required: false
24
+ default: ""
25
+ description: Space-separated list of paths to analyze (optional)
26
+ - name: max_fix_iterations
27
+ type: number
28
+ required: false
29
+ default: 25
30
+ description: Maximum iterations for fixing issues
31
+
32
+ steps:
33
+ - name: run-analysis
34
+ type: prompt
35
+ prompt: /af-analyze {{ variables.analysis_type }} {{ variables.paths }}
36
+
37
+ - name: check-autofix
38
+ type: conditional
39
+ condition: "variables.autofix != 'none'"
40
+ then:
41
+ - name: fix-issues
42
+ type: ralph-loop
43
+ max-iterations: "{{ variables.max_fix_iterations }}"
44
+ completion-promise: "ANALYSIS_FIXES_COMPLETE"
45
+ model: sonnet
46
+ timeout-minutes: 30
47
+ prompt: |
48
+ Use /af-fix-analyze {{ variables.analysis_type }} {{ variables.autofix }}
49
+
50
+ Return completion promise "ANALYSIS_FIXES_COMPLETE" when done.
51
+
52
+ outputs:
53
+ - name: analysis-report
54
+ template: analysis/{{ variables.analysis_type }}.md.j2
55
+ path: "{{ variables.analysis_type }}.md"
56
+ when: completed
@@ -0,0 +1,180 @@
1
+ name: demo
2
+ version: "1.0"
3
+ description: Demo workflow to validate agentic-forge plugin installation and configuration
4
+
5
+ settings:
6
+ track-progress: true
7
+ terminal-output: all
8
+ bypass-permissions: false
9
+ required-tools:
10
+ - Write
11
+ - Read
12
+ - Bash
13
+ git:
14
+ enabled: false
15
+ worktree: false
16
+
17
+ steps:
18
+ - name: welcome
19
+ type: prompt
20
+ model: haiku
21
+ prompt: |
22
+ # Welcome to the agentic-forge Demo Workflow
23
+
24
+ This is a demonstration workflow that validates your agentic-forge plugin installation.
25
+
26
+ Please acknowledge this welcome message by saying: "Demo workflow started successfully."
27
+
28
+ - name: create-demo-files
29
+ type: parallel
30
+ merge-strategy: wait-all
31
+ merge-mode: independent
32
+ git:
33
+ worktree: false
34
+ steps:
35
+ - name: create-demo-1
36
+ type: prompt
37
+ model: haiku
38
+ prompt: |
39
+ Create a file named `demo-1.md` at the repository root.
40
+
41
+ The file should contain:
42
+ ```markdown
43
+ # Demo File 1
44
+
45
+ Created by: agentic-forge demo
46
+ Timestamp: [current timestamp]
47
+ Step: create-demo-1
48
+
49
+ This file was created to validate the workflow execution.
50
+ ```
51
+
52
+ Use the Write tool to create this file.
53
+
54
+ IMPORTANT: If you encounter a permission error when trying to write this file,
55
+ you MUST stop immediately and report: "PERMISSION ERROR: Unable to write demo-1.md"
56
+ Do not attempt any workarounds.
57
+
58
+ - name: create-demo-2
59
+ type: prompt
60
+ model: haiku
61
+ prompt: |
62
+ Create a file named `demo-2.md` at the repository root.
63
+
64
+ The file should contain:
65
+ ```markdown
66
+ # Demo File 2
67
+
68
+ Created by: agentic-forge demo
69
+ Timestamp: [current timestamp]
70
+ Step: create-demo-2
71
+
72
+ This file was created to validate the workflow execution.
73
+ ```
74
+
75
+ Use the Write tool to create this file.
76
+
77
+ IMPORTANT: If you encounter a permission error when trying to write this file,
78
+ you MUST stop immediately and report: "PERMISSION ERROR: Unable to write demo-2.md"
79
+ Do not attempt any workarounds.
80
+
81
+ - name: random-facts-loop
82
+ type: ralph-loop
83
+ model: haiku
84
+ max-iterations: 5
85
+ completion-promise: THREE_FACTS_WRITTEN
86
+ prompt: |
87
+ ## Random Facts Loop - Iteration {{iteration}}/{{max_iterations}}
88
+
89
+ You are in a Ralph Wiggum iterative loop adding random knowledge facts to demo-1.md.
90
+
91
+ ## Your Task
92
+ 1. Read the file `demo-1.md` at the repository root
93
+ 2. Add ONE new numbered random knowledge fact to the "Random Facts" section
94
+ 3. If the "Random Facts" section does not exist, create it at the end of the file
95
+ 4. Save the file and STOP (exit the session)
96
+
97
+ ## Random Facts Section Format
98
+ ```markdown
99
+ ## Random Facts
100
+
101
+ 1. [Your first random fact here]
102
+ 2. [Your second random fact here]
103
+ ...
104
+ ```
105
+
106
+ ## Exit Instructions
107
+ - After adding ONE fact, you MUST exit the session immediately
108
+ - Do NOT add multiple facts in a single iteration
109
+ - Simply stop working after saving the file - the loop will automatically continue
110
+
111
+ ## Completion Condition
112
+ When the file contains EXACTLY 3 numbered facts in the Random Facts section, output:
113
+ ```json
114
+ {"ralph_complete": true, "promise": "THREE_FACTS_WRITTEN"}
115
+ ```
116
+
117
+ **IMPORTANT**:
118
+ - Count the existing facts BEFORE adding a new one
119
+ - If there are already 2 facts, add the 3rd fact and THEN output the completion JSON
120
+ - If there are already 3 or more facts, output the completion JSON immediately without adding more
121
+ - If there are 0-1 facts, add ONE fact and then STOP (do not output completion JSON yet)
122
+
123
+ - name: git-branch
124
+ type: prompt
125
+ model: haiku
126
+ prompt: /af-git-branch demo random-facts
127
+
128
+ - name: git-commit
129
+ type: prompt
130
+ model: haiku
131
+ prompt: /af-git-commit "[Demo] Add demo files with random facts"
132
+
133
+ - name: completion
134
+ type: prompt
135
+ model: haiku
136
+ prompt: |
137
+ # Demo Workflow Complete
138
+
139
+ The agentic-forge demo workflow has finished executing.
140
+
141
+ ## Validation Tasks
142
+
143
+ You MUST verify ALL of the following before reporting completion:
144
+
145
+ ### 1. File Validation
146
+ - Read `demo-1.md` and verify it exists at the repository root
147
+ - Read `demo-2.md` and verify it exists at the repository root
148
+
149
+ ### 2. Random Facts Validation
150
+ - Verify that `demo-1.md` contains a "Random Facts" section with EXACTLY 3 numbered facts
151
+ - Count the facts to confirm there are 3
152
+
153
+ ### 3. Git Branch Validation
154
+ - Run `git branch --show-current` to check the current branch
155
+ - Verify the current branch is `demo/random-facts`
156
+
157
+ ### 4. Git Commit Validation
158
+ - Run `git log -1 --oneline` to check the most recent commit
159
+ - Verify a commit exists with a message containing "demo" or "random facts"
160
+
161
+ ## Reporting
162
+
163
+ After performing ALL validations, report the results:
164
+
165
+ If ALL validations passed, say:
166
+ "DEMO WORKFLOW COMPLETED SUCCESSFULLY - Your agentic-forge installation is working correctly!
167
+
168
+ Validation Summary:
169
+ - demo-1.md: Created with 3 random facts
170
+ - demo-2.md: Created
171
+ - Git branch: demo/random-facts
172
+ - Git commit: [commit message]"
173
+
174
+ If ANY validation failed, report which ones and end with:
175
+ "DEMO WORKFLOW COMPLETED WITH ISSUES - Please review the errors above."
176
+
177
+ Remind the user to clean up by running:
178
+ - `git checkout main`
179
+ - `git branch -D demo/random-facts`
180
+ - Delete demo-1.md and demo-2.md
@@ -0,0 +1,54 @@
1
+ name: one-shot
2
+ version: "1.0"
3
+ description: Complete a single task from start to finish with PR
4
+
5
+ settings:
6
+ max-retry: 3
7
+ timeout-minutes: 60
8
+ track-progress: true
9
+ git:
10
+ enabled: true
11
+ worktree: true
12
+ auto-commit: true
13
+ branch-prefix: "agentic"
14
+
15
+ variables:
16
+ - name: task
17
+ type: string
18
+ required: true
19
+ description: Task description or prompt
20
+ - name: create_pr
21
+ type: boolean
22
+ required: false
23
+ default: false
24
+ description: Whether to create a PR
25
+
26
+ steps:
27
+ - name: create-branch
28
+ type: prompt
29
+ model: haiku
30
+ prompt: /af-git-branch {{ variables.type }} {{ variables.task }}
31
+
32
+ - name: execute-task
33
+ type: prompt
34
+ prompt: |
35
+ Complete the following task:
36
+
37
+ {{ variables.task }}
38
+
39
+ Guidelines:
40
+ - Analyze the codebase to understand context
41
+ - Make necessary changes following project conventions
42
+ - Use /af-git-commit to commit changes
43
+
44
+ - name: review
45
+ type: prompt
46
+ prompt: /af-sdlc-review "" major
47
+
48
+ - name: create-pr
49
+ type: conditional
50
+ condition: "variables.create_pr"
51
+ then:
52
+ - name: open-pr
53
+ type: prompt
54
+ prompt: /af-git-pr
@@ -0,0 +1,160 @@
1
+ name: plan-build-review
2
+ version: "1.0"
3
+ description: Full SDLC workflow with planning, implementation, and review
4
+
5
+ settings:
6
+ max-retry: 3
7
+ timeout-minutes: 180
8
+ terminal-output: base
9
+ track-progress: true
10
+ git:
11
+ enabled: true
12
+ worktree: true
13
+ auto-commit: true
14
+ branch-prefix: "feature"
15
+
16
+ variables:
17
+ - name: task
18
+ type: string
19
+ required: true
20
+ description: Feature/task description
21
+ - name: type
22
+ type: string
23
+ required: false
24
+ default: "auto"
25
+ description: Task type (feature, bug, chore, auto)
26
+ - name: fix_severity
27
+ type: string
28
+ required: false
29
+ default: "major"
30
+ description: Minimum severity for auto-fix
31
+ - name: explore_agents
32
+ type: integer
33
+ required: false
34
+ default: 2
35
+ description: Number of explore agents for codebase analysis (0=quick main session, 1+=parallel agents)
36
+ - name: max_iterations
37
+ type: number
38
+ required: false
39
+ default: 25
40
+ description: Maximum iterations for implementation and review fixes loops
41
+ - name: create_pr
42
+ type: boolean
43
+ required: false
44
+ default: false
45
+ description: Whether to create a PR
46
+
47
+ steps:
48
+ - name: plan
49
+ type: prompt
50
+ model: opus
51
+ prompt: /af-sdlc-plan {{ workflow_id }} {{ variables.type }} "agentic/outputs/{{ workflow_id }}" {{ variables.explore_agents }} {{ variables.task }}
52
+ checkpoint: true
53
+
54
+ - name: create-branch
55
+ type: prompt
56
+ model: haiku
57
+ prompt: /af-git-branch {{ variables.type }} {{ variables.task }}
58
+
59
+ - name: implement
60
+ type: ralph-loop
61
+ prompt: |
62
+ ## Implementation Loop - Iteration {{iteration}}/{{max_iterations}}
63
+
64
+ You are in an iterative implementation loop. Each iteration starts a fresh session.
65
+
66
+ ## Your Task This Iteration
67
+ Read the plan at agentic/outputs/{{ workflow_id }}/plan.md and implement the NEXT INCOMPLETE milestone.
68
+
69
+ ## How Iterations Work
70
+ - Each iteration is a FRESH SESSION - you have no memory of previous iterations
71
+ - Work on exactly ONE milestone per iteration, then STOP
72
+ - The loop automatically starts a new iteration after you stop
73
+ - You do NOT need to output anything special to end an iteration - just stop working
74
+
75
+ ## Instructions for This Iteration
76
+ 1. Read the plan file to find the next incomplete milestone
77
+ 2. Implement all tasks within that single milestone
78
+ 3. Run tests to verify your changes
79
+ 4. Mark the milestone as complete in the plan file
80
+ 5. Use /af-git-commit to commit your changes (including the plan.md if not gitignored)
81
+ 6. STOP - do not continue to the next milestone
82
+
83
+ ## Completion Signal
84
+ When ALL milestones are marked complete in the plan, output:
85
+ ```json
86
+ {"ralph_complete": true, "promise": "ALL_MILESTONES_COMPLETE"}
87
+ ```
88
+
89
+ **IMPORTANT**:
90
+ - Only output the completion JSON when ALL milestones are genuinely finished and every validation completed successfully
91
+ - Complete ONE milestone per iteration, then STOP
92
+ - Do NOT try to implement multiple milestones in a single iteration
93
+ max-iterations: "{{ variables.max_iterations }}"
94
+ completion-promise: "ALL_MILESTONES_COMPLETE"
95
+ checkpoint: true
96
+
97
+ - name: review
98
+ type: prompt
99
+ prompt: /af-sdlc-review {{ workflow_id }} "agentic/outputs/{{ workflow_id }}/plan.md" "agentic/outputs/{{ workflow_id }}" minor
100
+ agent: agents/reviewer.md
101
+
102
+ - name: fix-issues
103
+ type: prompt
104
+ prompt: |
105
+ ## Fix Review Issues
106
+
107
+ Read both documents from the workflow output directory:
108
+ - Plan: `agentic/outputs/{{ workflow_id }}/plan.md`
109
+ - Review: `agentic/outputs/{{ workflow_id }}/review.md`
110
+
111
+ ### Task
112
+
113
+ 1. **Parse the review.md** to identify all issues from the Issues table
114
+ 2. **Filter by severity**: Only consider issues with severity `{{ variables.fix_severity }}` or higher
115
+ - Severity order: minor < major < critical
116
+ 3. **If no issues** at or above `{{ variables.fix_severity }}` severity exist:
117
+ - Output success and end the session
118
+ - Return: `{"success": true, "issues_fixed": 0, "issues_remaining": 0}`
119
+ 4. **If issues exist**, attempt to fix each one:
120
+ - For each issue, make the necessary code changes
121
+ - Run relevant checks (tests, lint, types, build) to verify the fix
122
+ - Track which issues were fixed and which could not be fixed
123
+ 5. **After attempting fixes**:
124
+ - Use /af-git-commit to commit all fixes
125
+ - Re-run /af-sdlc-review {{ workflow_id }} "agentic/outputs/{{ workflow_id }}/plan.md" to update the Review section
126
+
127
+ ### Critical Requirement
128
+
129
+ After fixing, if ANY `major` or `critical` issues remain unfixed, you MUST:
130
+ - Output an error indicating which issues could not be fixed
131
+ - Return: `{"success": false, "error": "Unfixable issues remain", "issues_remaining": [...]}`
132
+
133
+ This will prevent the workflow from proceeding to the PR step.
134
+
135
+ ### Output
136
+
137
+ Return JSON with fix results:
138
+ ```json
139
+ {
140
+ "success": [true|false],
141
+ "issues_fixed": [count],
142
+ "issues_remaining": [count],
143
+ "unfixed_issues": ["issue1", "issue2"],
144
+ "error": "[error_message_if_failed]"
145
+ }
146
+ ```
147
+
148
+ - name: create-pr
149
+ type: conditional
150
+ condition: "variables.create_pr"
151
+ then:
152
+ - name: open-pr
153
+ type: prompt
154
+ prompt: /af-git-pr "{{ outputs.plan.summary }}"
155
+
156
+ outputs:
157
+ - name: implementation-report
158
+ template: implementation-report.md.j2
159
+ path: report.md
160
+ when: completed