@atlashub/smartstack-cli 1.34.0 → 1.36.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 (75) hide show
  1. package/.documentation/installation.html +56 -31
  2. package/dist/index.js +1098 -582
  3. package/dist/index.js.map +1 -1
  4. package/package.json +1 -1
  5. package/templates/agents/docs-context-reader.md +125 -0
  6. package/templates/agents/docs-sync-checker.md +122 -0
  7. package/templates/hooks/docs-drift-check.md +97 -0
  8. package/templates/skills/_resources/context-digest-template.md +53 -0
  9. package/templates/skills/_resources/doc-context-cache.md +62 -0
  10. package/templates/skills/_resources/docs-manifest-schema.md +157 -0
  11. package/templates/skills/_resources/mcp-validate-documentation-spec.md +183 -0
  12. package/templates/skills/_shared.md +15 -7
  13. package/templates/skills/apex/SKILL.md +6 -0
  14. package/templates/skills/apex/steps/step-00-init.md +9 -0
  15. package/templates/skills/apex/steps/step-01-analyze.md +36 -0
  16. package/templates/skills/apex/steps/step-02-plan.md +38 -0
  17. package/templates/skills/apex/steps/step-03-execute.md +39 -0
  18. package/templates/skills/apex/steps/step-04-validate.md +31 -1
  19. package/templates/skills/apex/steps/step-04b-doc-sync.md +162 -0
  20. package/templates/skills/apex/steps/step-05-examine.md +7 -0
  21. package/templates/skills/apex/templates/04b-doc-sync.md +31 -0
  22. package/templates/skills/apex/templates/context-digest.md +35 -0
  23. package/templates/skills/application/steps/step-04-backend.md +17 -17
  24. package/templates/skills/application/steps/step-05-frontend.md +4 -1
  25. package/templates/skills/application/templates-backend.md +8 -8
  26. package/templates/skills/application/templates-frontend.md +8 -8
  27. package/templates/skills/business-analyse/SKILL.md +18 -5
  28. package/templates/skills/business-analyse/_shared.md +306 -4
  29. package/templates/skills/business-analyse/questionnaire/01-context.md +21 -6
  30. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +34 -0
  31. package/templates/skills/business-analyse/questionnaire/03-scope.md +23 -0
  32. package/templates/skills/business-analyse/questionnaire/04-data.md +44 -0
  33. package/templates/skills/business-analyse/questionnaire/05-integrations.md +29 -7
  34. package/templates/skills/business-analyse/questionnaire/06-security.md +28 -0
  35. package/templates/skills/business-analyse/questionnaire/07-ui.md +32 -7
  36. package/templates/skills/business-analyse/questionnaire/08-performance.md +21 -0
  37. package/templates/skills/business-analyse/questionnaire/09-constraints.md +29 -6
  38. package/templates/skills/business-analyse/questionnaire/10-documentation.md +27 -6
  39. package/templates/skills/business-analyse/questionnaire/11-data-lifecycle.md +59 -0
  40. package/templates/skills/business-analyse/questionnaire/12-migration.md +58 -0
  41. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +69 -0
  42. package/templates/skills/business-analyse/steps/step-00-init.md +110 -16
  43. package/templates/skills/business-analyse/steps/step-01-discover.md +530 -85
  44. package/templates/skills/business-analyse/steps/step-02-analyse.md +81 -25
  45. package/templates/skills/business-analyse/steps/step-03-specify.md +116 -24
  46. package/templates/skills/business-analyse/steps/step-04-validate.md +107 -33
  47. package/templates/skills/business-analyse/steps/step-05-handoff.md +256 -33
  48. package/templates/skills/business-analyse/steps/step-06-doc-html.md +84 -25
  49. package/templates/skills/business-analyse/templates/{frd-handoff.md → tpl-handoff.md} +18 -4
  50. package/templates/skills/business-analyse/templates-frd.md +19 -5
  51. package/templates/skills/business-analyse/tracking/change-template.md +30 -0
  52. package/templates/skills/documentation/SKILL.md +68 -31
  53. package/templates/skills/documentation/data-schema.md +198 -0
  54. package/templates/skills/documentation/templates.md +30 -1
  55. package/templates/skills/gitflow/_shared.md +188 -53
  56. package/templates/skills/gitflow/phases/abort.md +28 -16
  57. package/templates/skills/gitflow/phases/cleanup.md +13 -9
  58. package/templates/skills/gitflow/phases/status.md +16 -17
  59. package/templates/skills/gitflow/steps/step-commit.md +11 -5
  60. package/templates/skills/gitflow/steps/step-finish.md +43 -33
  61. package/templates/skills/gitflow/steps/step-init.md +134 -2
  62. package/templates/skills/gitflow/steps/step-merge.md +24 -10
  63. package/templates/skills/gitflow/steps/step-pr.md +42 -28
  64. package/templates/skills/gitflow/steps/step-start.md +19 -13
  65. package/templates/skills/gitflow/templates/config.json +14 -4
  66. package/templates/skills/ralph-loop/SKILL.md +58 -9
  67. package/templates/skills/ralph-loop/steps/step-00-init.md +170 -30
  68. package/templates/skills/ralph-loop/steps/step-01-task.md +243 -40
  69. package/templates/skills/ralph-loop/steps/step-02-execute.md +142 -24
  70. package/templates/skills/ralph-loop/steps/step-03-commit.md +140 -36
  71. package/templates/skills/ralph-loop/steps/step-04-check.md +128 -44
  72. package/templates/skills/ralph-loop/steps/step-05-report.md +175 -88
  73. /package/templates/skills/business-analyse/templates/{frd-brd.md → tpl-brd.md} +0 -0
  74. /package/templates/skills/business-analyse/templates/{frd-discovery.md → tpl-discovery.md} +0 -0
  75. /package/templates/skills/business-analyse/templates/{frd-spec.md → tpl-frd.md} +0 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: step-03-commit
3
- description: Commit changes, update prd.json and progress.txt
3
+ description: Commit changes, update prd.json v2 with full tracking
4
4
  next_step: steps/step-04-check.md
5
5
  ---
6
6
 
@@ -8,7 +8,7 @@ next_step: steps/step-04-check.md
8
8
 
9
9
  ## YOUR TASK:
10
10
 
11
- Commit the changes from the executed task, update prd.json and progress.txt.
11
+ Commit the changes from the executed task, finalize task tracking in prd.json, and append to history.
12
12
 
13
13
  ---
14
14
 
@@ -20,12 +20,16 @@ Commit the changes from the executed task, update prd.json and progress.txt.
20
20
 
21
21
  ```bash
22
22
  git add {files_created} {files_modified}
23
+
24
+ # Also stage prd.json (already updated in step-02)
25
+ git add .ralph/prd.json
23
26
  ```
24
27
 
25
28
  **Verify staged changes:**
26
29
 
27
30
  ```bash
28
31
  git status
32
+ git diff --cached --stat
29
33
  ```
30
34
 
31
35
  ### 2. Create Commit
@@ -34,47 +38,107 @@ git status
34
38
 
35
39
  ```bash
36
40
  git commit -m "$(cat <<'EOF'
37
- feat(ralph): {current_task_description}
41
+ {PREFIX}({scope}): {current_task_description}
38
42
 
39
43
  Task {current_task_id}/{tasks_total} - Iteration {current_iteration}
44
+ Category: {current_task_category}
40
45
 
41
46
  Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
42
47
  EOF
43
48
  )"
44
49
  ```
45
50
 
46
- **Commit message format:**
47
- - Type: `feat`, `fix`, `refactor`, `test`, `docs`
48
- - Scope: `ralph` or specific module
49
- - Description: Task description
50
- - Footer: Iteration info
51
+ **Determine commit prefix from category:**
52
+
53
+ | Category | Prefix | Scope |
54
+ |----------|--------|-------|
55
+ | `domain` | `feat` | entity name or module |
56
+ | `application` | `feat` | module name |
57
+ | `infrastructure` | `db` | migrations / config |
58
+ | `api` | `feat` | controller name |
59
+ | `frontend` | `feat` | component/page name |
60
+ | `i18n` | `chore` | i18n |
61
+ | `test` | `test` | module name |
62
+ | `validation` | `chore` | validation |
63
+ | `other` | `chore` | ralph |
64
+
65
+ **Get commit hash:**
66
+ ```bash
67
+ COMMIT_HASH=$(git rev-parse --short HEAD)
68
+ ```
69
+
70
+ ### 3. Finalize Task in prd.json
51
71
 
52
- ### 3. Update prd.json
72
+ **Mark task as completed with all tracking data:**
53
73
 
54
- **Mark current task as complete:**
74
+ ```javascript
75
+ const prd = readJSON('.ralph/prd.json');
76
+ const task = prd.tasks.find(t => t.id === {current_task_id});
77
+ const now = new Date().toISOString();
55
78
 
56
- ```json
57
- {
58
- "feature": "{task_description}",
59
- "current_iteration": {current_iteration + 1},
60
- "tasks": [
61
- { "id": 1, "description": "...", "passes": true }, // was false
62
- { "id": 2, "description": "...", "passes": false } // next task
63
- ]
79
+ // Only mark completed if not already failed in step-02
80
+ if (task.status !== 'failed') {
81
+ task.status = 'completed';
82
+ }
83
+ task.completed_at = now;
84
+ task.iteration = prd.config.current_iteration;
85
+ task.commit_hash = COMMIT_HASH;
86
+
87
+ // files_changed already set in step-02, but verify
88
+ if (!task.files_changed || (!task.files_changed.created.length && !task.files_changed.modified.length)) {
89
+ // Fallback: extract from git diff
90
+ task.files_changed = {
91
+ created: getGitNewFiles(), // git diff --cached --name-only --diff-filter=A
92
+ modified: getGitModifiedFiles() // git diff --cached --name-only --diff-filter=M
93
+ };
64
94
  }
65
95
  ```
66
96
 
67
- **Write updated prd.json:**
97
+ ### 4. Append to History
98
+
99
+ **Add structured iteration entry:**
68
100
 
69
101
  ```javascript
70
- const prd = readJSON('.ralph/prd.json');
71
- const task = prd.tasks.find(t => t.id === currentTaskId);
72
- task.passes = true;
73
- prd.current_iteration++;
102
+ prd.history.push({
103
+ iteration: prd.config.current_iteration,
104
+ task_id: task.id,
105
+ action: task.status, // "completed" or "failed"
106
+ timestamp: now,
107
+ commit_hash: COMMIT_HASH,
108
+ duration_seconds: Math.round(
109
+ (new Date(now) - new Date(task.started_at)) / 1000
110
+ ),
111
+ notes: "{What was learned or accomplished during this task}"
112
+ });
113
+ ```
114
+
115
+ ### 5. Increment Iteration and Update Timestamps
116
+
117
+ **IMPORTANT: Increment AFTER recording the current iteration in task and history.**
118
+
119
+ ```javascript
120
+ prd.config.current_iteration++;
121
+ prd.updated_at = now;
122
+
123
+ // Update top-level status
124
+ const allCompleted = prd.tasks.every(t =>
125
+ t.status === 'completed' || t.status === 'skipped'
126
+ );
127
+ const anyFailed = prd.tasks.some(t => t.status === 'failed');
128
+ const anyBlocked = prd.tasks.some(t => t.status === 'blocked');
129
+
130
+ if (allCompleted) {
131
+ prd.status = 'completed';
132
+ } else if (anyFailed || anyBlocked) {
133
+ prd.status = 'partial';
134
+ } else {
135
+ prd.status = 'in_progress';
136
+ }
137
+
74
138
  writeJSON('.ralph/prd.json', prd);
75
139
  ```
76
140
 
77
- ### 4. Update progress.txt
141
+ ### 6. Update progress.txt
78
142
 
79
143
  **Append learnings to progress.txt:**
80
144
 
@@ -85,10 +149,17 @@ writeJSON('.ralph/prd.json', prd);
85
149
 
86
150
  ### Task Completed
87
151
  [{current_task_id}] {current_task_description}
152
+ Category: {current_task_category}
153
+ Status: {task.status}
154
+ Commit: {COMMIT_HASH}
88
155
 
89
156
  ### Files Changed
90
- - Created: {files_created}
91
- - Modified: {files_modified}
157
+ - Created: {task.files_changed.created}
158
+ - Modified: {task.files_changed.modified}
159
+
160
+ ### Acceptance Criteria
161
+ {current_task_criteria}
162
+ Result: ✅ Met / ❌ Not met
92
163
 
93
164
  ### Learnings
94
165
  {What was learned during this task}
@@ -99,20 +170,38 @@ writeJSON('.ralph/prd.json', prd);
99
170
  {What the next iteration should know}
100
171
  ```
101
172
 
102
- ### 5. Verify Commit
173
+ ### 7. Commit prd.json and progress.txt Updates
174
+
175
+ **Stage and commit the tracking files separately:**
176
+
177
+ ```bash
178
+ git add .ralph/prd.json .ralph/progress.txt
179
+ git commit -m "$(cat <<'EOF'
180
+ chore(ralph): update progress - task {current_task_id}/{tasks_total}
181
+
182
+ Iteration {current_iteration} complete
183
+ Status: {task.status}
184
+
185
+ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
186
+ EOF
187
+ )"
188
+ ```
189
+
190
+ ### 8. Verify Commit
103
191
 
104
192
  **Check commit was created:**
105
193
 
106
194
  ```bash
107
- git log -1 --oneline
195
+ git log -2 --oneline
108
196
  ```
109
197
 
110
198
  **Expected output:**
111
199
  ```
112
- abc1234 feat(ralph): {current_task_description}
200
+ def5678 chore(ralph): update progress - task {id}/{total}
201
+ abc1234 feat(scope): {current_task_description}
113
202
  ```
114
203
 
115
- ### 6. Log Activity (if verbose)
204
+ ### 9. Log Activity (if verbose)
116
205
 
117
206
  **If {verbose_mode} = true:**
118
207
 
@@ -120,9 +209,13 @@ Append to `.ralph/logs/{date}.log`:
120
209
  ```
121
210
  [{timestamp}] TASK COMPLETED
122
211
  Task: [{current_task_id}] {current_task_description}
123
- Commit: {commit_hash}
124
- Files: {file_count} changed
212
+ Category: {current_task_category}
213
+ Status: {task.status}
214
+ Commit: {COMMIT_HASH}
215
+ Files: {file_count} changed ({created_count} created, {modified_count} modified)
216
+ Duration: {duration_seconds}s
125
217
  Iteration: {current_iteration}
218
+ Validation: {validation_result}
126
219
  ```
127
220
 
128
221
  ---
@@ -134,13 +227,17 @@ Changes Committed:
134
227
 
135
228
  | Field | Value |
136
229
  |-------|-------|
137
- | Commit | {commit_hash} |
138
- | Task | [{current_task_id}] |
230
+ | Commit | {COMMIT_HASH} |
231
+ | Task | [{current_task_id}] {current_task_description} |
232
+ | Category | {current_task_category} |
233
+ | Status | {task.status} |
139
234
  | Iteration | {current_iteration} |
140
235
  | Files | {file_count} changed |
236
+ | Duration | {duration_seconds}s |
237
+ | Validation | {validation_result} |
141
238
 
142
- prd.json: Updated task {current_task_id} to passes: true
143
- progress.txt: Added iteration {current_iteration} learnings
239
+ prd.json: Task {current_task_id} {task.status}, history entry added
240
+ progress.txt: Iteration {current_iteration} learnings appended
144
241
 
145
242
  -> Checking completion...
146
243
  ```
@@ -163,6 +260,13 @@ progress.txt: Added iteration {current_iteration} learnings
163
260
  2. Retry write
164
261
  3. If still fails, output error and stop
165
262
 
263
+ **If task was failed in step-02:**
264
+
265
+ 1. Still commit whatever was done (partial progress)
266
+ 2. task.status remains "failed"
267
+ 3. history entry records action: "failed"
268
+ 4. step-04 will handle downstream blocking
269
+
166
270
  ---
167
271
 
168
272
  ## NEXT STEP:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: step-04-check
3
- description: Check completion criteria and decide next action
3
+ description: Check completion criteria with status-based logic
4
4
  next_step: steps/step-05-report.md OR steps/step-01-task.md
5
5
  ---
6
6
 
@@ -8,7 +8,7 @@ next_step: steps/step-05-report.md OR steps/step-01-task.md
8
8
 
9
9
  ## YOUR TASK:
10
10
 
11
- Check if all tasks are complete and decide whether to output completion promise or continue to next task.
11
+ Check if all tasks are complete and decide whether to output completion promise or continue to next task. Uses v2 status-based checks instead of boolean `passes`.
12
12
 
13
13
  ---
14
14
 
@@ -20,50 +20,74 @@ Check if all tasks are complete and decide whether to output completion promise
20
20
 
21
21
  ```javascript
22
22
  const prd = readJSON('.ralph/prd.json');
23
- const tasksCompleted = prd.tasks.filter(t => t.passes).length;
24
- const tasksTotal = prd.tasks.length;
25
- const allComplete = tasksCompleted === tasksTotal;
23
+
24
+ const tasksCompleted = prd.tasks.filter(t => t.status === 'completed').length;
25
+ const tasksSkipped = prd.tasks.filter(t => t.status === 'skipped').length;
26
+ const tasksFailed = prd.tasks.filter(t => t.status === 'failed').length;
27
+ const tasksBlocked = prd.tasks.filter(t => t.status === 'blocked').length;
28
+ const tasksPending = prd.tasks.filter(t => t.status === 'pending').length;
29
+ const tasksTotal = prd.tasks.length;
30
+
31
+ const allDone = (tasksCompleted + tasksSkipped) === tasksTotal;
32
+ const hasFailures = tasksFailed > 0;
33
+ const hasBlocked = tasksBlocked > 0;
34
+ const hasPending = tasksPending > 0;
26
35
  ```
27
36
 
28
37
  ### 2. Check Iteration Limit
29
38
 
30
- **If {current_iteration} >= {max_iterations}:**
39
+ **If `prd.config.current_iteration` > `prd.config.max_iterations`:**
31
40
 
32
41
  ```
33
42
  ╔══════════════════════════════════════════════════════════════════╗
34
- ║ ⚠️ MAX ITERATIONS REACHED
43
+ ║ ⚠️ MAX ITERATIONS REACHED
35
44
  ╠══════════════════════════════════════════════════════════════════╣
36
- ║ Iterations: {current_iteration} / {max_iterations}
37
- ║ Tasks: {tasksCompleted} / {tasksTotal} complete
45
+ ║ Iterations: {current_iteration} / {max_iterations}
46
+ ║ Tasks: {tasksCompleted} / {tasksTotal} complete
47
+ ║ Failed: {tasksFailed} | Blocked: {tasksBlocked} ║
38
48
  ╠══════════════════════════════════════════════════════════════════╣
39
- ║ Ralph loop stopped due to iteration limit.
40
- ║ Remaining tasks:
41
- ║ {list of tasks with passes: false}
49
+ ║ Ralph loop stopped due to iteration limit.
50
+ ║ Remaining tasks:
51
+ ║ {list of tasks with status != completed and != skipped}
42
52
  ╚══════════════════════════════════════════════════════════════════╝
43
53
 
44
54
  -> Generating partial report...
45
55
  ```
46
56
 
57
+ **Update prd.json:**
58
+ ```javascript
59
+ prd.status = 'partial';
60
+ prd.updated_at = new Date().toISOString();
61
+ writeJSON('.ralph/prd.json', prd);
62
+ ```
63
+
47
64
  **Proceed to step-05-report.md**
48
65
 
49
66
  ### 3. Check All Tasks Complete
50
67
 
51
- **If allComplete = true:**
68
+ **If allDone = true:**
52
69
 
53
70
  ```
54
71
  ╔══════════════════════════════════════════════════════════════════╗
55
- ║ ✅ ALL TASKS COMPLETE
72
+ ║ ✅ ALL TASKS COMPLETE
56
73
  ╠══════════════════════════════════════════════════════════════════╣
57
- ║ Iterations: {current_iteration}
58
- ║ Tasks: {tasksTotal} / {tasksTotal} complete
74
+ ║ Iterations: {current_iteration - 1}
75
+ ║ Tasks: {tasksCompleted} completed, {tasksSkipped} skipped
59
76
  ╠══════════════════════════════════════════════════════════════════╣
60
- ║ Output completion promise:
61
- ║ <promise>{completion_promise}</promise>
77
+ ║ Output completion promise:
78
+ ║ <promise>{completion_promise}</promise>
62
79
  ╚══════════════════════════════════════════════════════════════════╝
63
80
 
64
81
  <promise>{completion_promise}</promise>
65
82
  ```
66
83
 
84
+ **Update prd.json:**
85
+ ```javascript
86
+ prd.status = 'completed';
87
+ prd.updated_at = new Date().toISOString();
88
+ writeJSON('.ralph/prd.json', prd);
89
+ ```
90
+
67
91
  **CRITICAL: Output the promise tag exactly as shown:**
68
92
  ```
69
93
  <promise>{completion_promise}</promise>
@@ -71,15 +95,48 @@ const allComplete = tasksCompleted === tasksTotal;
71
95
 
72
96
  **Proceed to step-05-report.md**
73
97
 
74
- ### 4. More Tasks Remaining
98
+ ### 4. Check for Dead-End (all remaining are blocked/failed)
99
+
100
+ **If !hasPending AND !allDone:**
101
+
102
+ All remaining tasks are blocked or failed. No progress is possible.
103
+
104
+ ```
105
+ ╔══════════════════════════════════════════════════════════════════╗
106
+ ║ ⚠️ DEAD-END DETECTED ║
107
+ ╠══════════════════════════════════════════════════════════════════╣
108
+ ║ Tasks: {tasksCompleted} completed, {tasksFailed} failed, ║
109
+ ║ {tasksBlocked} blocked ║
110
+ ╠══════════════════════════════════════════════════════════════════╣
111
+ ║ No more tasks can be executed. ║
112
+ ║ Failed tasks: ║
113
+ ║ {list of failed tasks with error messages} ║
114
+ ║ ║
115
+ ║ Blocked tasks (downstream): ║
116
+ ║ {list of blocked tasks with dependency info} ║
117
+ ╚══════════════════════════════════════════════════════════════════╝
118
+
119
+ -> Generating partial report...
120
+ ```
121
+
122
+ **Update prd.json:**
123
+ ```javascript
124
+ prd.status = 'failed';
125
+ prd.updated_at = new Date().toISOString();
126
+ writeJSON('.ralph/prd.json', prd);
127
+ ```
128
+
129
+ **Proceed to step-05-report.md**
130
+
131
+ ### 5. More Tasks Remaining
75
132
 
76
- **If allComplete = false AND iteration < max_iterations:**
133
+ **If hasPending AND iteration < max_iterations:**
77
134
 
78
135
  ```
79
136
  Progress: {tasksCompleted} / {tasksTotal} tasks
137
+ Failed: {tasksFailed} | Blocked: {tasksBlocked} | Pending: {tasksPending}
80
138
 
81
- Next task:
82
- [{next_task_id}] {next_task_description}
139
+ Next eligible task will be determined by dependency resolution.
83
140
 
84
141
  Continuing to next iteration...
85
142
  ```
@@ -95,20 +152,25 @@ Continuing to next iteration...
95
152
  │ Check Completion │
96
153
  └──────────┬──────────┘
97
154
 
98
- ┌────────────────┼────────────────┐
99
-
100
-
101
- ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
102
- │ Max Iters │ │ All Tasks │ │ Tasks │
103
- │ Reached │ Complete │ Remaining │
104
- └──────┬───────┘ └──────┬───────┘ └──────┬───────┘
105
-
106
- ▼ ▼ ▼
107
- ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
108
- │ Partial │ │ Output │ │ Loop to │
109
- Report │ │ Promise │ │ step-01 │
110
- step-05 │ │ step-05 │ │
111
- └──────────────┘ └──────────────┘ └──────────────┘
155
+ ┌────────────────────┼────────────────────┐
156
+
157
+
158
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
159
+ │ Max Iters │ │ All Tasks │ │ Tasks │
160
+ │ Reached │ Done │ Remaining │
161
+ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘
162
+
163
+ │ │ ┌────────┴────────┐
164
+ │ │ │ │
165
+ ▼ ▼ ▼ ▼
166
+ ┌──────────────┐ ┌──────────────┐ ┌─────────────┐ ┌─────────────┐
167
+ Partial Output │ Dead-End │ │ Loop to
168
+ │ Report │ │ Promise (all blocked│ │ step-01 │
169
+ │ step-05 │ │ step-05 │ │ or failed) │ │ │
170
+ │ status: │ │ status: │ │ step-05 │ │ │
171
+ │ "partial" │ │ "completed" │ │ status: │ │ │
172
+ └──────────────┘ └──────────────┘ │ "failed" │ └─────────────┘
173
+ └─────────────┘
112
174
  ```
113
175
 
114
176
  ---
@@ -122,9 +184,11 @@ Completion Check:
122
184
  | Field | Value |
123
185
  |-------|-------|
124
186
  | Iteration | {current_iteration} / {max_iterations} |
125
- | Tasks | {tasksCompleted} / {tasksTotal} |
187
+ | Completed | {tasksCompleted} / {tasksTotal} |
188
+ | Failed | {tasksFailed} |
189
+ | Blocked | {tasksBlocked} |
190
+ | Pending | {tasksPending} |
126
191
  | Status | Continuing |
127
- | Next | [{next_task_id}] {next_task_description} |
128
192
 
129
193
  -> Loading next task...
130
194
  ```
@@ -135,8 +199,9 @@ Completion Check:
135
199
 
136
200
  | Field | Value |
137
201
  |-------|-------|
138
- | Iteration | {current_iteration} |
139
- | Tasks | {tasksTotal} / {tasksTotal} |
202
+ | Iterations Used | {current_iteration - 1} |
203
+ | Completed | {tasksCompleted} / {tasksTotal} |
204
+ | Skipped | {tasksSkipped} |
140
205
  | Status | COMPLETE |
141
206
 
142
207
  <promise>{completion_promise}</promise>
@@ -144,19 +209,38 @@ Completion Check:
144
209
  -> Generating report...
145
210
  ```
146
211
 
212
+ **If partial/failed:**
213
+ ```
214
+ Completion Check:
215
+
216
+ | Field | Value |
217
+ |-------|-------|
218
+ | Iterations Used | {current_iteration - 1} |
219
+ | Completed | {tasksCompleted} / {tasksTotal} |
220
+ | Failed | {tasksFailed} |
221
+ | Blocked | {tasksBlocked} |
222
+ | Status | {PARTIAL or FAILED} |
223
+ | Reason | {max iterations / dead-end} |
224
+
225
+ -> Generating report...
226
+ ```
227
+
147
228
  ---
148
229
 
149
- ## CRITICAL RULE:
230
+ ## CRITICAL RULES:
150
231
 
151
232
  **NEVER output the completion promise unless:**
152
- 1. ALL tasks have `passes: true`
153
- 2. The statement is genuinely true
233
+ 1. ALL tasks have `status: "completed"` or `status: "skipped"`
234
+ 2. Zero tasks with `status: "blocked"` or `status: "failed"`
235
+ 3. The statement is genuinely true
154
236
 
155
237
  **False promises to escape the loop are FORBIDDEN.**
156
238
 
239
+ **Always update `prd.status` and `prd.updated_at` before proceeding.**
240
+
157
241
  ---
158
242
 
159
243
  ## NEXT STEP:
160
244
 
161
- - If complete or max iterations: `./step-05-report.md`
245
+ - If complete or max iterations or dead-end: `./step-05-report.md`
162
246
  - If tasks remaining: `./step-01-task.md`