ai-fob 1.9.7 → 1.9.9

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.
@@ -44,9 +44,10 @@ Use one result in frontmatter:
44
44
 
45
45
  - `pass`: every check passed.
46
46
  - `fail`: at least one executable check failed. These are potential code issues for a fix-builder.
47
- - `blocked`: no executable checks failed, but one or more checks could not be executed because of external, environmental, credential, or human-action constraints.
47
+ - `blocked`: no executable checks failed, but one or more **terminal** checks could not be executed because of external, environmental, credential, or human-action constraints that prevent establishing core phase correctness.
48
+ - `pass-with-followups`: no executable checks failed and no terminal blockers exist, but one or more **non-terminal** manual/operator/unsafe/external follow-up checks could not safely run.
48
49
 
49
- If both FAIL and BLOCKED checks exist, overall result is `fail`.
50
+ If both FAIL and BLOCKED checks exist, overall result is `fail`. FAIL beats terminal blockers; terminal blockers beat `pass-with-followups`.
50
51
 
51
52
  ## Check rules
52
53
 
@@ -57,7 +58,10 @@ For every check:
57
58
  - Never mark a check PASS because the plan or build report claims it was done.
58
59
  - For `[HL]` checks, preserve the user's criterion text and verify independently.
59
60
  - If real test credentials are configured, do not mark auth-required browser checks BLOCKED merely because login is required; authenticate and report PASS/FAIL.
60
- - If placeholder credentials remain and auth is required, mark the auth-required browser check BLOCKED.
61
+ - If placeholder credentials remain and auth is required, mark the auth-required browser check BLOCKED and classify whether that blocker is terminal or non-terminal.
62
+ - For every BLOCKED check, include `severity: terminal` or `severity: non-terminal` in the evidence.
63
+ - Terminal blockers prevent establishing core phase correctness or safe continuation.
64
+ - Non-terminal blockers are manual/operator/unsafe/external follow-ups where core functionality has already been validated through other executable/source/browser evidence.
61
65
 
62
66
  ## Browser validation rules
63
67
 
@@ -111,9 +115,11 @@ phase: {PHASE_NUMBER}
111
115
  phase-name: {PHASE_NAME}
112
116
  type: build-validation-report
113
117
  cycle: {BUILD_VALIDATION_CYCLE}
114
- result: pass|fail|blocked
118
+ result: pass|fail|blocked|pass-with-followups
115
119
  checks-passed: X/Y
116
120
  checks-blocked: Z/Y
121
+ checks-blocked-terminal: A/Y
122
+ checks-blocked-nonterminal: B/Y
117
123
  date: {current date}
118
124
  ---
119
125
  ```
@@ -135,10 +141,15 @@ Report structure:
135
141
  If no issues, write: None.
136
142
 
137
143
  ## Blocked Checks
138
- - {check name}: {blocked reason and required action}
144
+ - {check name}: severity: {terminal|non-terminal}; {blocked reason}; substitute evidence: {evidence or none}; human follow-up: {required action}
139
145
 
140
146
  If none blocked, write: None.
141
147
 
148
+ ## Non-Terminal Follow-Ups
149
+ - {check name}: {manual/operator/unsafe/external follow-up and substitute evidence}
150
+
151
+ If none, write: None.
152
+
142
153
  ## Verified Checks
143
154
  - {check name}: {what passed and evidence}
144
155
 
@@ -148,7 +159,7 @@ If none blocked, write: None.
148
159
  After writing, final response should be concise:
149
160
 
150
161
  ```txt
151
- SUCCESS: wrote {ARTIFACT_PATH} ({line count} lines) result={pass|fail|blocked} checks-passed=X/Y checks-blocked=Z/Y
162
+ SUCCESS: wrote {ARTIFACT_PATH} ({line count} lines) result={pass|fail|blocked|pass-with-followups} checks-passed=X/Y checks-blocked=Z/Y checks-blocked-terminal=A/Y checks-blocked-nonterminal=B/Y
152
163
  ```
153
164
 
154
165
  If writing fails:
@@ -0,0 +1,601 @@
1
+ ---
2
+ description: Orchestrate a full multi-phase feature build with Pi build-phase runner monitoring
3
+ argument-hint: "<path to HL plan spec>"
4
+ ---
5
+
6
+ # Build Feature
7
+
8
+ Orchestrate a full multi-phase feature build by launching the Pi build-phase runner once and monitoring it from a distance.
9
+
10
+ The key architecture: **the build-feature agent is an observer/monitor/doctor, not the direct phase controller**. The deterministic phase loop runs in `.pi/scripts/build-phase-runner.sh`; this prompt launches that script in the background, polls durable files on disk, diagnoses stalls, applies bounded interventions when a known recovery playbook matches, audits high-level success criteria, writes a durable learnings file, and presents a final feature-level report.
11
+
12
+ Use careful, evidence-grounded reasoning for diagnosis and intervention decisions. Do not rewrite phase artifacts on behalf of phase agents.
13
+
14
+ ## Required skill
15
+
16
+ Before reading or interpreting `STATE.md`, load and follow the `FOB-state-context` skill.
17
+
18
+ ## Arguments
19
+
20
+ Raw arguments: `$ARGUMENTS`
21
+
22
+ Parse into:
23
+
24
+ - `HL_PLAN_PATH`: first argument
25
+
26
+ If missing, stop with:
27
+
28
+ ```txt
29
+ Usage: /build-feature <path to HL plan spec>
30
+ ```
31
+
32
+ ## Variables
33
+
34
+ Derived in Step 0:
35
+
36
+ - `HL_PLAN_PATH`: absolute path to high-level plan markdown file
37
+ - `SPEC_DIR`: parent directory of `HL_PLAN_PATH`
38
+ - `PROJECT_ROOT`: nearest ancestor containing `.pi/prompts/build-phase.md`
39
+ - `TASK_NAME`: `task:` from HL plan YAML frontmatter
40
+ - `TOTAL_PHASES`: `phases:` from HL plan YAML frontmatter
41
+ - `LEARNINGS_FILE`: `{SPEC_DIR}/build-feature-learnings.md`
42
+ - `RUNNER_SCRIPT`: `{PROJECT_ROOT}/.pi/scripts/build-phase-runner.sh`
43
+ - `HL_CRITERIA`: map of phase number to original HL success criteria strings
44
+
45
+ Monitoring state:
46
+
47
+ - `BUILD_PID`: PID of backgrounded runner process
48
+ - `BUILD_START_TIME`: epoch seconds when launched
49
+ - `CURRENT_PHASE`: phase currently active from `STATE.md`
50
+ - `CURRENT_STEP`: step currently active from `STATE.md`
51
+ - `LAST_POLL_PHASE`: phase from previous poll
52
+ - `LAST_POLL_STEP`: step from previous poll
53
+ - `STALL_SUSPECTED`: false until one no-progress poll, true until confirmed/resolved
54
+ - `INTERVENTION_COUNTS`: per-phase intervention counter, max 2
55
+ - `VERIFIED_PHASES`: phases whose success criteria have already been audited
56
+ - `POLL_NUMBER`: incremented each poll
57
+
58
+ ## Status vocabulary
59
+
60
+ Use Claude-compatible feature-level status names in the final report:
61
+
62
+ ```txt
63
+ completed -> all required phases reached status: complete; validation may be pass or pass-with-followups
64
+ partial -> at least one phase completed, but the run stopped on blocked/failed/incomplete phase
65
+ aborted -> monitor aborted due to unrecoverable stall, process failure, invalid setup, or manual stop
66
+ ```
67
+
68
+ Use Pi phase-level statuses exactly as reported in `phase_completion_report.md`:
69
+
70
+ ```txt
71
+ complete -> phase succeeded; runner may continue, including validation-result: pass-with-followups
72
+ blocked -> terminal external/environment/human-action blocker; stop by default unless explicitly accepted
73
+ failed/fail -> validation/build failure after internal recovery loops; stop
74
+ missing/invalid report -> orchestration/artifact failure; stop
75
+ ```
76
+
77
+ Blocked is not failed, but blocked must not be silently ignored. Non-terminal manual/operator follow-ups should be represented as `status: complete` plus `validation-result: pass-with-followups`, then recorded in Criteria Issues / follow-up summaries without stopping the feature.
78
+
79
+ ## Workflow
80
+
81
+ ### Step 0: Parse and validate inputs
82
+
83
+ 1. Parse `HL_PLAN_PATH` from `$ARGUMENTS`. Trim whitespace.
84
+ 2. Resolve it to an absolute path.
85
+ 3. Verify it exists and ends in `.md`.
86
+ 4. Read the HL plan.
87
+ 5. Parse YAML frontmatter between the first pair of `---` delimiters:
88
+ - `task:` -> `TASK_NAME`; if missing/empty, abort.
89
+ - `phases:` -> `TOTAL_PHASES`; if missing/not positive integer, abort.
90
+ 6. Set `SPEC_DIR` to the parent directory of `HL_PLAN_PATH`.
91
+ 7. Derive `PROJECT_ROOT` by walking upward from `SPEC_DIR` until finding `.pi/prompts/build-phase.md`. If not found, abort.
92
+ 8. Set `RUNNER_SCRIPT` to `{PROJECT_ROOT}/.pi/scripts/build-phase-runner.sh`; verify it exists and is executable.
93
+ 9. Set `LEARNINGS_FILE` to `{SPEC_DIR}/build-feature-learnings.md`.
94
+ 10. Load `FOB-state-context` before reading `STATE.md`.
95
+ 11. Extract original high-level success criteria per phase:
96
+ - Find phase sections such as `### Phase N: ...`.
97
+ - Within each phase section, find `**Success Criteria**:` or equivalent success criteria block.
98
+ - Extract checkbox items beginning `- [ ]` or `- [x]`.
99
+ - Store exact criterion text in `HL_CRITERIA[N]`.
100
+ - If no criteria are found for a phase, store an empty list and log a warning.
101
+
102
+ ### Step 1: Initialize durable learnings file
103
+
104
+ If `LEARNINGS_FILE` does not exist, write:
105
+
106
+ ```markdown
107
+ # Build Feature Learnings: {TASK_NAME}
108
+
109
+ Spec: {HL_PLAN_PATH}
110
+ Project Root: {PROJECT_ROOT}
111
+ Total Phases: {TOTAL_PHASES}
112
+ Started: {ISO-8601 timestamp}
113
+
114
+ ---
115
+ ```
116
+
117
+ If it exists, append a restart section:
118
+
119
+ ```markdown
120
+
121
+ ---
122
+
123
+ # Build Feature Restart: {TASK_NAME}
124
+
125
+ Restarted: {ISO-8601 timestamp}
126
+ Spec: {HL_PLAN_PATH}
127
+ Project Root: {PROJECT_ROOT}
128
+ Total Phases: {TOTAL_PHASES}
129
+
130
+ ---
131
+ ```
132
+
133
+ Always read the current file first, append in memory, then write the full updated content.
134
+
135
+ ### Step 2: Pre-flight checks
136
+
137
+ Run and log these checks before launch. Accumulate results and append one `## Pre-Flight Checks` section to `LEARNINGS_FILE`.
138
+
139
+ #### 2.1 Lock file check
140
+
141
+ Lock file:
142
+
143
+ ```txt
144
+ {SPEC_DIR}/.build-phase.lock
145
+ ```
146
+
147
+ If it exists:
148
+
149
+ 1. Read PID.
150
+ 2. If PID is running, abort with a clear message: another build is active.
151
+ 3. If PID is dead, remove the stale lock and log it.
152
+
153
+ #### 2.2 Port check
154
+
155
+ Check port 3000 for existing processes:
156
+
157
+ ```bash
158
+ lsof -ti:3000 2>/dev/null
159
+ ```
160
+
161
+ If occupied, kill those PIDs before launch and log the action. This matches current test-project behavior. Future versions may read the configured dev port from `testing-and-validation`.
162
+
163
+ #### 2.3 Git status check
164
+
165
+ Run from `PROJECT_ROOT`:
166
+
167
+ ```bash
168
+ git status --porcelain 2>/dev/null || echo GIT_UNAVAILABLE
169
+ ```
170
+
171
+ Log clean/dirty/unavailable. Do not abort on dirty state.
172
+
173
+ #### 2.4 STATE.md check
174
+
175
+ Read `{SPEC_DIR}/../STATE.md` if present, or the nearest `specs/STATE.md` according to `FOB-state-context` conventions.
176
+
177
+ Log whether `TASK_NAME` exists and which phases are already marked `[x]`.
178
+
179
+ #### 2.5 Runner sanity check
180
+
181
+ Run:
182
+
183
+ ```bash
184
+ bash -n "{RUNNER_SCRIPT}"
185
+ ```
186
+
187
+ Abort if syntax check fails.
188
+
189
+ #### 2.6 Write pre-flight section
190
+
191
+ Append:
192
+
193
+ ```markdown
194
+ ## Pre-Flight Checks
195
+ Timestamp: {ISO-8601 timestamp}
196
+
197
+ - Lock file: {clean | stale lock removed PID | active lock abort}
198
+ - Port 3000: {clean | killed PIDs}
199
+ - Git status: {clean | N uncommitted changes | unavailable}
200
+ - STATE.md: {task found, completed phases ... | task not found}
201
+ - Runner syntax: {pass | fail}
202
+ ```
203
+
204
+ ### Step 3: Launch runner once
205
+
206
+ 1. Append to `LEARNINGS_FILE`:
207
+
208
+ ```markdown
209
+ ## Build Launch
210
+ Started: {ISO-8601 timestamp}
211
+ Phase spec: all ({TOTAL_PHASES} total phases)
212
+ Runner: {RUNNER_SCRIPT}
213
+ ```
214
+
215
+ 2. Initialize monitoring state:
216
+ - `INTERVENTION_COUNTS = {}`
217
+ - `VERIFIED_PHASES = {}`
218
+ - `LAST_POLL_PHASE = null`
219
+ - `LAST_POLL_STEP = null`
220
+ - `STALL_SUSPECTED = false`
221
+ - `POLL_NUMBER = 0`
222
+
223
+ 3. Launch the runner using shell-level backgrounding in one Bash call:
224
+
225
+ ```bash
226
+ cd "{PROJECT_ROOT}" && "{RUNNER_SCRIPT}" "{HL_PLAN_PATH}" all > /tmp/build-feature.log 2>&1 &
227
+ echo $!
228
+ ```
229
+
230
+ Important: use shell `&`. Do not attempt to keep the build loop inside the agent. Capture stdout PID as `BUILD_PID`.
231
+
232
+ 4. Append `Build PID: {BUILD_PID}` to `LEARNINGS_FILE`.
233
+ 5. Set `BUILD_START_TIME` using `date +%s`.
234
+ 6. Create freshness marker:
235
+
236
+ ```bash
237
+ touch /tmp/build-feature-lastpoll
238
+ ```
239
+
240
+ ### Step 4: Monitoring loop
241
+
242
+ Poll until the runner exits or the monitor aborts.
243
+
244
+ Default polling interval: 15 minutes, matching Claude Code vocabulary. During initial testing, a user may ask for a shorter interval, but the prompt default is 15 minutes.
245
+
246
+ Each poll:
247
+
248
+ 1. Sleep:
249
+
250
+ ```bash
251
+ sleep 900
252
+ ```
253
+
254
+ 2. Increment `POLL_NUMBER`.
255
+ 3. Check runner process:
256
+
257
+ ```bash
258
+ kill -0 {BUILD_PID} 2>/dev/null && echo ALIVE || echo EXITED
259
+ ```
260
+
261
+ If exited, proceed to Step 7 Completion Assessment.
262
+
263
+ 4. Read `STATE.md` and determine:
264
+ - active phase with any step `[~]`
265
+ - active step number/name
266
+ - completed phases whose Step 1-6 are `[x]`
267
+ - between-phase state, if no `[~]` but next phase not started
268
+
269
+ 5. Detect phase transition:
270
+ - If `CURRENT_PHASE` differs from `LAST_POLL_PHASE` and `LAST_POLL_PHASE` is not null, log transition.
271
+ - Audit the just-completed phase using Step 6.
272
+ - Run between-phase cleanup (Step 5).
273
+ - Reset `STALL_SUSPECTED=false`.
274
+
275
+ 6. Check for new artifacts since last poll:
276
+
277
+ ```bash
278
+ NEW_FILES=""
279
+ for dir in $(find "{SPEC_DIR}" -maxdepth 1 -type d -name "phase*_*" 2>/dev/null); do
280
+ FILES=$(find "$dir" -newer /tmp/build-feature-lastpoll -type f 2>/dev/null | head -5)
281
+ if [ -n "$FILES" ]; then
282
+ NEW_FILES="${NEW_FILES}${FILES}\n"
283
+ fi
284
+ done
285
+ if [ -n "$NEW_FILES" ]; then
286
+ echo "NEW_ARTIFACTS:"
287
+ echo -e "$NEW_FILES"
288
+ else
289
+ echo "NO_NEW_ARTIFACTS"
290
+ fi
291
+ touch /tmp/build-feature-lastpoll
292
+ ```
293
+
294
+ 7. Tail runner log for context:
295
+
296
+ ```bash
297
+ tail -80 /tmp/build-feature.log 2>/dev/null || true
298
+ ```
299
+
300
+ 8. Stall detection:
301
+ - Phase changed -> progress.
302
+ - Step changed -> progress.
303
+ - Same step but new artifacts -> progress.
304
+ - Same step and no new artifacts for one poll -> set `STALL_SUSPECTED=true`, log warning.
305
+ - Same step and no new artifacts for two consecutive polls -> confirmed stall; proceed to Step 8 Diagnosis and Intervention.
306
+
307
+ 9. Append poll section to `LEARNINGS_FILE`:
308
+
309
+ ```markdown
310
+ ### Poll {POLL_NUMBER} ({elapsed_minutes}m)
311
+ - Process alive: yes
312
+ - Current phase: Phase {CURRENT_PHASE}
313
+ - Current step: Step {CURRENT_STEP} - {step_name}
314
+ - Phases completed: {list}
315
+ - New artifacts since last poll: {list or none}
316
+ - Runner log tail: summarized / see /tmp/build-feature.log
317
+ - Progress status: {progress | possible stall | confirmed stall}
318
+ ```
319
+
320
+ 10. Continue polling.
321
+
322
+ ### Step 5: Between-phase cleanup
323
+
324
+ On phase transition only, while runner is still alive:
325
+
326
+ 1. Clear port 3000:
327
+
328
+ ```bash
329
+ lsof -ti:3000 | xargs kill -9 2>/dev/null; echo "Port cleanup done"
330
+ ```
331
+
332
+ 2. Append:
333
+
334
+ ```markdown
335
+ ### Between-Phase Cleanup (Phase {LAST_POLL_PHASE} -> Phase {CURRENT_PHASE})
336
+ - Port 3000: cleared
337
+ ```
338
+
339
+ Do not remove `.build-phase.lock` during normal between-phase cleanup; the runner owns it.
340
+
341
+ ### Step 6: Success criteria verification for a phase
342
+
343
+ Run this when a phase transition is observed and again during final completion assessment for any phases not already verified.
344
+
345
+ For phase `N`:
346
+
347
+ 1. Resolve phase directory:
348
+
349
+ ```bash
350
+ find "{SPEC_DIR}" -maxdepth 1 -type d -name "phase{N}_*" 2>/dev/null | head -1
351
+ ```
352
+
353
+ 2. Read `{PHASE_DIR}/phase_completion_report.md`.
354
+ 3. Parse YAML frontmatter:
355
+ - `status:`
356
+ - `validation-result:`
357
+ - `checks-passed:`
358
+ - `checks-blocked:`
359
+ - `checks-blocked-terminal:` if present
360
+ - `checks-blocked-nonterminal:` if present
361
+ - `fix-cycles:`
362
+ 4. Find the report's `## HL Success Criteria Results` or `## HL Plan Success Criteria Results` section.
363
+ 5. Parse table rows into:
364
+ - criterion text
365
+ - result: `PASS`, `FAIL`, `BLOCKED`
366
+ - evidence
367
+ 6. Cross-reference against `HL_CRITERIA[N]` from the original HL plan:
368
+ - matching row with `PASS` -> `complete`
369
+ - matching row with `FAIL` -> `incomplete`
370
+ - matching row with `BLOCKED` -> `blocked` if terminal, or `follow-up` if the phase report/validation report classifies it as non-terminal
371
+ - no matching row -> `dropped`
372
+ 7. Flag extra report rows not present in original HL criteria as `extra`.
373
+ 8. Append:
374
+
375
+ ```markdown
376
+ ### Success Criteria Verification: Phase {N}
377
+ Timestamp: {ISO-8601 timestamp}
378
+ Source: phase_completion_report.md vs HL plan
379
+ Phase status: {status}
380
+ Validation result: {validation-result}
381
+
382
+ | # | Criterion | Status | Evidence |
383
+ |---|-----------|--------|----------|
384
+ | 1 | {criterion text} | {complete/incomplete/blocked/dropped} | {evidence} |
385
+
386
+ Summary: {complete}/{total} criteria complete; {blocked} terminal blocked; {follow_up} non-terminal follow-up; {dropped} dropped; {extra} extra.
387
+ ```
388
+
389
+ This verification is observational. Do not modify phase reports.
390
+
391
+ ### Step 7: Completion assessment
392
+
393
+ When the runner exits:
394
+
395
+ 1. Try to collect exit code:
396
+
397
+ ```bash
398
+ wait {BUILD_PID} 2>/dev/null; echo $?
399
+ ```
400
+
401
+ If unavailable because process was already reaped, record `unknown`.
402
+
403
+ 2. Read final `STATE.md`.
404
+ 3. For each phase `1..TOTAL_PHASES`:
405
+ - resolve phase directory,
406
+ - read `phase_completion_report.md`,
407
+ - parse frontmatter status,
408
+ - count completed Step 1-6 markers,
409
+ - compute per-phase result.
410
+ 4. Audit success criteria for any phase not in `VERIFIED_PHASES` using Step 6.
411
+ 5. Compute:
412
+ - total phases attempted,
413
+ - total phases complete,
414
+ - blocked phases,
415
+ - failed phases,
416
+ - incomplete/missing-report phases,
417
+ - total criteria,
418
+ - criteria complete,
419
+ - criteria incomplete,
420
+ - criteria blocked,
421
+ - criteria non-terminal follow-up,
422
+ - criteria dropped,
423
+ - total interventions,
424
+ - total duration.
425
+ 6. Determine feature status:
426
+
427
+ ```txt
428
+ all phases status complete and no monitor abort -> completed, even if some phases have validation-result pass-with-followups
429
+ some phases complete but terminal blocked/failed/incomplete exist -> partial
430
+ monitor aborted or unrecoverable stall/process issue -> aborted
431
+ ```
432
+
433
+ 7. Append to `LEARNINGS_FILE`:
434
+
435
+ ```markdown
436
+ ## Build Process Exited
437
+ Timestamp: {ISO-8601 timestamp}
438
+ Exit code: {code}
439
+ Duration: {minutes}m
440
+
441
+ ### Per-Phase Results
442
+ | Phase | Steps Completed | Status | Validation | Interventions |
443
+ |-------|-----------------|--------|------------|---------------|
444
+ | 1 | {count}/6 | {status} | {validation-result} | {count} |
445
+
446
+ ## Success Criteria Audit: Full Build
447
+ Timestamp: {ISO-8601 timestamp}
448
+
449
+ | Phase | Total Criteria | Complete | Incomplete | Blocked | Follow-Up | Dropped |
450
+ |-------|----------------|----------|------------|---------|-----------|---------|
451
+ | 1 | {total} | {complete} | {incomplete} | {blocked} | {follow_up} | {dropped} |
452
+ | TOTAL | {total} | {complete} | {incomplete} | {blocked} | {follow_up} | {dropped} |
453
+ ```
454
+
455
+ Proceed to Step 9 Final Report.
456
+
457
+ ### Step 8: Diagnosis and intervention
458
+
459
+ Run only after confirmed stall: two consecutive polls with same phase/step and no new artifacts.
460
+
461
+ #### 8.1 Diagnosis
462
+
463
+ Collect:
464
+
465
+ ```bash
466
+ echo "=== Main process ==="
467
+ ps -o pid,ppid,stat,%cpu,command -p {BUILD_PID} 2>/dev/null || true
468
+
469
+ echo "=== Child processes ==="
470
+ pgrep -P {BUILD_PID} 2>/dev/null | xargs ps -o pid,ppid,stat,%cpu,command -p 2>/dev/null || true
471
+
472
+ echo "=== Grandchild processes ==="
473
+ for child in $(pgrep -P {BUILD_PID} 2>/dev/null); do
474
+ pgrep -P "$child" 2>/dev/null | xargs ps -o pid,ppid,stat,%cpu,command -p 2>/dev/null
475
+ done 2>/dev/null || true
476
+
477
+ echo "=== Dev server processes ==="
478
+ pgrep -f 'dev\.sh|bun.*dev|next dev|vite' 2>/dev/null | while read pid; do
479
+ ps -o pid,%cpu,command -p "$pid" 2>/dev/null
480
+ done
481
+
482
+ echo "=== Port 3000 ==="
483
+ lsof -ti:3000 2>/dev/null || echo PORT_FREE
484
+
485
+ echo "=== Runner log tail ==="
486
+ tail -120 /tmp/build-feature.log 2>/dev/null || true
487
+ ```
488
+
489
+ Append full diagnosis to `LEARNINGS_FILE`.
490
+
491
+ #### 8.2 Known Error Playbook: Dev Server Foreground Hang
492
+
493
+ Match if all are true:
494
+
495
+ 1. `STUCK_STEP` is Step 5 Validate Build.
496
+ 2. Dev server processes exist, port 3000 is occupied, or Step 5 has had no artifacts for 30+ minutes.
497
+ 3. `INTERVENTION_COUNTS[STUCK_PHASE] < 2`.
498
+
499
+ Fix:
500
+
501
+ 1. Kill port 3000 processes.
502
+ 2. Kill `dev.sh`, `bun dev`, `next dev`, and `vite` processes.
503
+ 3. Kill runner process tree: grandchildren, children, then main PID.
504
+ 4. Sleep 5.
505
+ 5. Remove stale lock: `{SPEC_DIR}/.build-phase.lock`.
506
+ 6. Increment `INTERVENTION_COUNTS[STUCK_PHASE]`.
507
+ 7. Append an `### Intervention` entry to `LEARNINGS_FILE`.
508
+ 8. Relaunch the runner with `all`:
509
+
510
+ ```bash
511
+ cd "{PROJECT_ROOT}" && "{RUNNER_SCRIPT}" "{HL_PLAN_PATH}" all > /tmp/build-feature.log 2>&1 &
512
+ echo $!
513
+ ```
514
+
515
+ 9. Update `BUILD_PID`, reset `STALL_SUSPECTED=false`, touch `/tmp/build-feature-lastpoll`, and return to Step 4.
516
+
517
+ Why `all`: the runner iterates all phases, and `build-phase` resumes/skips completed work from `STATE.md` and artifacts.
518
+
519
+ #### 8.3 Unknown stall
520
+
521
+ If no playbook matches:
522
+
523
+ 1. Append `### Unrecognized Stall` to `LEARNINGS_FILE`.
524
+ 2. Kill runner process tree and port 3000 to avoid orphans.
525
+ 3. Mark feature status `aborted`.
526
+ 4. Proceed to Step 9 Final Report.
527
+
528
+ ### Step 9: Final Build Feature Report
529
+
530
+ Present the final results using this exact vocabulary and structure.
531
+
532
+ ```markdown
533
+ ## Build Feature Report
534
+
535
+ **Feature:** {TASK_NAME}
536
+ **Spec:** {HL_PLAN_PATH}
537
+ **Status:** {completed | partial | aborted}
538
+ **Duration:** {total minutes}m
539
+ **Phases:** {completed_count}/{TOTAL_PHASES}
540
+ **Criteria:** {complete_count}/{total_criteria_count} verified complete{; follow_up_count follow-ups if any}
541
+
542
+ ### Phase Results
543
+ | Phase | Name | Status | Duration | Interventions | Criteria |
544
+ |-------|------|--------|----------|---------------|----------|
545
+ | 1 | {phase_name} | {status} | {duration}m | {count} | {complete}/{total} |
546
+
547
+ ### Criteria Issues
548
+ | Phase | Criterion | Status | Detail |
549
+ |-------|-----------|--------|--------|
550
+ | {N} | {criterion text} | {incomplete/blocked/follow-up/dropped} | {evidence or reason} |
551
+ ```
552
+
553
+ Omit `### Criteria Issues` only if there are no incomplete, terminal blocked, non-terminal follow-up, or dropped criteria.
554
+
555
+ Continue:
556
+
557
+ ```markdown
558
+ ### Interventions
559
+ {total_count} total interventions applied.
560
+
561
+ {If total_count > 0: list each intervention with phase number, step, error type, and outcome.}
562
+ {If total_count == 0: No interventions were needed. All phases completed without monitor intervention.}
563
+
564
+ ### Learnings File
565
+ Full build log saved to: {LEARNINGS_FILE}
566
+ Runner log: /tmp/build-feature.log
567
+
568
+ ### Next Steps
569
+ - {If completed and all criteria complete: All phases built successfully and all success criteria verified. Review STATE.md and phase completion reports for details.}
570
+ - {If completed but criteria issues/follow-ups exist: All phases completed, but {count} success criteria need manual/operator follow-up or were not fully met. Review Criteria Issues and the learnings file.}
571
+ - {If partial: Phases {list} completed. Phase {N} stopped with status {status}. Review the learnings file and phase completion report. To retry: /build-feature {HL_PLAN_PATH}}
572
+ - {If aborted: Build aborted due to {reason}. See learnings file for diagnosis. After resolving the issue, retry with: /build-feature {HL_PLAN_PATH}}
573
+ ```
574
+
575
+ ### Step 10: Cleanup
576
+
577
+ After final report, clean temporary monitor files unless the user asks to preserve them:
578
+
579
+ ```bash
580
+ rm -f /tmp/build-feature-lastpoll
581
+ ```
582
+
583
+ Do not delete `LEARNINGS_FILE`.
584
+
585
+ Do not delete phase artifacts.
586
+
587
+ If the build is still running because of an abort/intervention failure, kill the runner process tree and clear port 3000 before exiting.
588
+
589
+ ## Edge cases
590
+
591
+ 1. **Already-completed phases**: runner invokes `build-phase` for each selected phase; `build-phase` resume logic should detect complete artifacts/state and exit quickly.
592
+ 2. **Partial phases**: `build-phase` resumes from incomplete step according to `STATE.md` and artifact validity.
593
+ 3. **Non-terminal follow-ups**: runner continues when the phase report has `status: complete` and `validation-result: pass-with-followups`; monitor records follow-ups but can still report feature `completed`.
594
+ 4. **Blocked phase**: runner stops by default on `status: blocked`; monitor reports `partial` unless an explicit accepted-blocker policy is later added.
595
+ 5. **Accepted blockers**: future version may support explicit blocker override via prompt argument, HL metadata, or sidecar config. Do not silently continue through terminal blocked phases in v1.
596
+ 5. **Max interventions**: max 2 per phase. After that, abort.
597
+ 6. **Concurrent runs**: active `.build-phase.lock` aborts preflight.
598
+ 7. **Context compaction**: `build-feature-learnings.md` is the durable source of truth.
599
+ 8. **Build continues independently**: monitor is observer, not controller. The runner process owns the phase loop.
600
+ 9. **Restart uses `all`**: this is intentional because `build-phase` resume logic handles skipped/completed work.
601
+ 10. **No macOS `open`**: browser validation remains owned by `build-phase` and must use `agent-browser` through existing skills.
@@ -128,9 +128,10 @@ Step 5 Validate Build is valid when:
128
128
  - `{PHASE_DIR}/build_validation_report.md` exists.
129
129
  - `build_validation_report.md` has YAML frontmatter.
130
130
  - Frontmatter contains `type: build-validation-report`.
131
- - Frontmatter contains `result: pass` or `result: blocked`.
131
+ - Frontmatter contains `result: pass`, `result: blocked`, or `result: pass-with-followups`.
132
132
  - Frontmatter contains `checks-passed:`.
133
133
  - Frontmatter contains `checks-blocked:`.
134
+ - Frontmatter contains `checks-blocked-terminal:` and `checks-blocked-nonterminal:` when any checks are blocked.
134
135
 
135
136
  `result: fail` is not complete for Step 5. If a failed validation report exists, rerun Step 5/fix cycles.
136
137
 
@@ -1300,8 +1301,12 @@ If expected 4xx entries occur, include them as evidence and explain why they are
1300
1301
  - PASS: executed and satisfied with evidence.
1301
1302
  - FAIL: executed and not satisfied; potential code issue.
1302
1303
  - BLOCKED: could not execute due to external/environment/credential/human-action condition.
1304
+ - Every BLOCKED check must include `severity: terminal` or `severity: non-terminal` in evidence.
1305
+ - Use terminal severity when blocked validation prevents establishing core phase correctness or safe continuation.
1306
+ - Use non-terminal severity when core functionality is validated but a manual/operator/unsafe/external follow-up could not safely run, such as external account creation, provider dashboard row inspection, or temporary secret mutation.
1303
1307
  - If any FAIL exists, overall result is `fail`.
1304
- - If no FAIL and at least one BLOCKED exists, overall result is `blocked`.
1308
+ - If no FAIL and at least one terminal BLOCKED exists, overall result is `blocked`.
1309
+ - If no FAIL, no terminal BLOCKED checks, and at least one non-terminal BLOCKED exists, overall result is `pass-with-followups`.
1305
1310
  - If all PASS, overall result is `pass`.
1306
1311
 
1307
1312
  ## Validation Parameters
@@ -1317,12 +1322,14 @@ If expected 4xx entries occur, include them as evidence and explain why they are
1317
1322
  Write `{PHASE_DIR}/build_validation_report.md` with frontmatter including:
1318
1323
  - `type: build-validation-report`
1319
1324
  - `cycle: {BUILD_VALIDATION_CYCLE}`
1320
- - `result: pass|fail|blocked`
1325
+ - `result: pass|fail|blocked|pass-with-followups`
1321
1326
  - `checks-passed: X/{BUILD_CHECK_COUNT}`
1322
1327
  - `checks-blocked: Z/{BUILD_CHECK_COUNT}`
1328
+ - `checks-blocked-terminal: A/{BUILD_CHECK_COUNT}`
1329
+ - `checks-blocked-nonterminal: B/{BUILD_CHECK_COUNT}`
1323
1330
 
1324
1331
  Final response format:
1325
- SUCCESS: wrote {PHASE_DIR}/build_validation_report.md ({line count} lines) result={pass|fail|blocked} checks-passed=X/{BUILD_CHECK_COUNT} checks-blocked=Z/{BUILD_CHECK_COUNT}
1332
+ SUCCESS: wrote {PHASE_DIR}/build_validation_report.md ({line count} lines) result={pass|fail|blocked|pass-with-followups} checks-passed=X/{BUILD_CHECK_COUNT} checks-blocked=Z/{BUILD_CHECK_COUNT} checks-blocked-terminal=A/{BUILD_CHECK_COUNT} checks-blocked-nonterminal=B/{BUILD_CHECK_COUNT}
1326
1333
  ```
1327
1334
 
1328
1335
  ### 5.7 Spawn build validator and read result
@@ -1334,13 +1341,15 @@ Read `{PHASE_DIR}/build_validation_report.md` and extract:
1334
1341
  - `result`
1335
1342
  - `checks-passed`
1336
1343
  - `checks-blocked`
1344
+ - `checks-blocked-terminal`
1345
+ - `checks-blocked-nonterminal`
1337
1346
  - `cycle`
1338
1347
 
1339
1348
  If the report is missing or invalid, treat as orchestration failure and stop with Step 5 incomplete.
1340
1349
 
1341
1350
  ### 5.8 Handle validation result
1342
1351
 
1343
- If `result: pass`, continue to Step 5.13 cleanup/complete.
1352
+ If `result: pass` or `result: pass-with-followups`, continue to Step 5.13 cleanup/complete.
1344
1353
 
1345
1354
  If `result: blocked`:
1346
1355
 
@@ -1401,6 +1410,7 @@ After the fix-builder returns:
1401
1410
  After each re-validation:
1402
1411
 
1403
1412
  - `pass` -> cleanup/complete.
1413
+ - `pass-with-followups` -> cleanup/complete.
1404
1414
  - `blocked` with no FAIL items -> cleanup/complete.
1405
1415
  - `fail` -> repeat Step 5.9 until max cycles.
1406
1416
 
@@ -1440,7 +1450,7 @@ Clean up the dev server if started. Reset or leave Step 5 as `[ ]` so a future r
1440
1450
 
1441
1451
  ### 5.13 Mark Step 5 complete
1442
1452
 
1443
- Only after final result is `pass` or genuine `blocked`, update `STATE.md`:
1453
+ Only after final result is `pass`, `pass-with-followups`, or genuine terminal `blocked`, update `STATE.md`:
1444
1454
 
1445
1455
  ```txt
1446
1456
  Step 5 - Validate Build: [~] -> [x]
@@ -1473,9 +1483,11 @@ Artifacts:
1473
1483
  - fix_report_cycle*.md ({count or none})
1474
1484
 
1475
1485
  Build Validation:
1476
- - Result: {pass|blocked}
1486
+ - Result: {pass|pass-with-followups|blocked}
1477
1487
  - Checks passed: {X/Y}
1478
1488
  - Checks blocked: {Z/Y}
1489
+ - Terminal blockers: {A/Y}
1490
+ - Non-terminal follow-ups: {B/Y}
1479
1491
  - Cycles: {BUILD_VALIDATION_CYCLE}
1480
1492
  - Fix cycles: {count}
1481
1493
  - Browser checks: {yes/no}
@@ -1486,7 +1498,7 @@ Step 5 complete. Continuing to Step 6 Finalize & Report.
1486
1498
 
1487
1499
  ## Step 6: Finalize & Report
1488
1500
 
1489
- Run this step after Step 5 completes with final result `pass` or genuine `blocked`, or directly after Step 0 when `RESUME_FROM = 6`.
1501
+ Run this step after Step 5 completes with final result `pass`, `pass-with-followups`, or genuine terminal `blocked`, or directly after Step 0 when `RESUME_FROM = 6`.
1490
1502
 
1491
1503
  Step 6 is main/orchestrator-owned. Do not spawn a reporting sub-agent.
1492
1504
 
@@ -1554,6 +1566,8 @@ From `build_validation_report.md`:
1554
1566
  - Validation result.
1555
1567
  - Checks passed.
1556
1568
  - Checks blocked.
1569
+ - Terminal blocked count.
1570
+ - Non-terminal blocked/follow-up count.
1557
1571
  - Checks table.
1558
1572
  - Issues found.
1559
1573
  - Blocked checks.
@@ -1573,13 +1587,14 @@ Use:
1573
1587
 
1574
1588
  ```yaml
1575
1589
  status: complete|blocked|failed
1576
- validation-result: pass|blocked|fail
1590
+ validation-result: pass|pass-with-followups|blocked|fail
1577
1591
  ```
1578
1592
 
1579
1593
  Rules:
1580
1594
 
1581
1595
  - `status: complete` when `build_validation_report.md` has `result: pass`.
1582
- - `status: blocked` when `build_validation_report.md` has `result: blocked`.
1596
+ - `status: complete` when `build_validation_report.md` has `result: pass-with-followups`; preserve non-terminal follow-ups in report sections/frontmatter.
1597
+ - `status: blocked` when `build_validation_report.md` has `result: blocked` due to terminal blockers.
1583
1598
  - `status: failed` when `build_validation_report.md` has `result: fail`.
1584
1599
 
1585
1600
  Normally Step 6 should not run after failed Step 5. If a failed report is present, report it defensively and do not claim completion.
@@ -1597,9 +1612,12 @@ phase: {PHASE_NUMBER}
1597
1612
  phase-name: {PHASE_NAME}
1598
1613
  type: phase-report
1599
1614
  status: complete|blocked|failed
1600
- validation-result: pass|blocked|fail
1615
+ validation-result: pass|pass-with-followups|blocked|fail
1601
1616
  checks-passed: X/Y
1602
1617
  checks-blocked: Z/Y
1618
+ checks-blocked-terminal: A/Y
1619
+ checks-blocked-nonterminal: B/Y
1620
+ manual-followups: B
1603
1621
  fix-cycles: N
1604
1622
  date: {current date}
1605
1623
  pre-phase-sha: {PRE_PHASE_SHA}
@@ -1634,6 +1652,8 @@ Required sections:
1634
1652
 
1635
1653
  ## Blocked Items / Human Action Required
1636
1654
 
1655
+ ## Non-Terminal Follow-Ups
1656
+
1637
1657
  ## Fix Cycles
1638
1658
 
1639
1659
  ## Files Changed
@@ -1654,7 +1674,8 @@ Important report rules:
1654
1674
  - Extract HL success criteria results from `[HL]` rows in `build_validation_report.md` Checks table.
1655
1675
  - Do not guess HL results by semantic matching when `[HL]` rows exist.
1656
1676
  - Include explicit human action for blocked `[HL]` criteria.
1657
- - Distinguish validation blockers from code failures.
1677
+ - Distinguish terminal blockers, non-terminal manual/operator follow-ups, and code failures.
1678
+ - For `pass-with-followups`, keep `status: complete` but list follow-ups clearly in `## Non-Terminal Follow-Ups` and `## Blocked Items / Human Action Required`.
1658
1679
  - Always include `## Impacts on Future Phases` because future phase runs consume prior phase reports.
1659
1680
 
1660
1681
  ### 6.6 Verify report
@@ -1696,9 +1717,11 @@ BUILD PHASE {N} — COMPLETE
1696
1717
  Spec: {SPEC_DIR_BASENAME} ({TASK_NAME})
1697
1718
  Phase: {N} — {PHASE_NAME}
1698
1719
  Status: {complete|blocked|failed}
1699
- Validation Result: {pass|blocked|fail}
1720
+ Validation Result: {pass|pass-with-followups|blocked|fail}
1700
1721
  Checks Passed: {X/Y}
1701
1722
  Checks Blocked: {Z/Y}
1723
+ Terminal Blockers: {A/Y}
1724
+ Non-Terminal Follow-Ups: {B/Y}
1702
1725
  Fix Cycles: {N}
1703
1726
 
1704
1727
  Artifacts:
@@ -106,6 +106,45 @@ Examples of acceptable expected 4xx responses:
106
106
 
107
107
  Validators must record these entries as expected evidence rather than hiding them.
108
108
 
109
+ ## Blocked Check Severity
110
+
111
+ Every blocked validation check must be classified as either **terminal** or **non-terminal**.
112
+
113
+ ### Terminal blocked
114
+
115
+ Use terminal blocked when the agent cannot establish the phase's core correctness, or when continuing may make later phases invalid.
116
+
117
+ Examples:
118
+
119
+ - the app or required dev server cannot start
120
+ - required environment variables are missing for core functionality
121
+ - no usable auth path exists for an auth-dependent phase
122
+ - database/service unavailable for core validation
123
+ - a core user story cannot be executed or source-verified
124
+ - validation infrastructure failure prevents meaningful assessment
125
+
126
+ ### Non-terminal blocked
127
+
128
+ Use non-terminal blocked when core functionality has already been validated by executable/source/browser checks, but an additional manual, operator-only, destructive, unsafe, or external-provider check could not safely run.
129
+
130
+ Examples:
131
+
132
+ - dashboard-only database row inspection
133
+ - creating external provider accounts without explicit approval
134
+ - mutating production-like secrets or provider configuration
135
+ - forcing rare failure states that require unsafe environment changes
136
+ - manual provider-console verification
137
+ - external billing/provider configuration checks
138
+
139
+ For every BLOCKED check, validators must document:
140
+
141
+ - `severity: terminal` or `severity: non-terminal`
142
+ - the blocked reason
143
+ - any executable substitute evidence that was available
144
+ - the recommended human/operator follow-up
145
+
146
+ If no FAIL checks exist and all blocked checks are non-terminal, the overall validation result should be `pass-with-followups`, not `blocked`.
147
+
109
148
  ## For Agents Consuming This Skill
110
149
 
111
150
  1. Use the exact configured commands. Do not improvise substitutes from memory.
package/manifest.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.9.7",
2
+ "version": "1.9.9",
3
3
  "presets": {
4
4
  "coding": {
5
5
  "description": "Research-driven coding workflow",
@@ -99,7 +99,8 @@
99
99
  ],
100
100
  "prompts": [
101
101
  "explore-codebase",
102
- "build-phase"
102
+ "build-phase",
103
+ "build-feature"
103
104
  ],
104
105
  "extensions": [
105
106
  "pinned-response",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-fob",
3
- "version": "1.9.7",
3
+ "version": "1.9.9",
4
4
  "description": "Deploy research-driven AI coding assistant assets (skills, agents, commands) into your projects",
5
5
  "bin": {
6
6
  "ai-fob": "bin/install.js"