prizmkit 1.1.69 → 1.1.72

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 (57) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/dev-pipeline/lib/common.sh +427 -0
  3. package/bundled/dev-pipeline/lib/heartbeat.sh +36 -0
  4. package/bundled/dev-pipeline/run-feature.sh +109 -29
  5. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +11 -12
  6. package/bundled/dev-pipeline/scripts/parse-stream-progress.py +160 -3
  7. package/bundled/dev-pipeline/scripts/update-feature-status.py +27 -3
  8. package/bundled/dev-pipeline/templates/agent-prompts/dev-implement.md +36 -22
  9. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-review.md +1 -1
  10. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +24 -21
  11. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +13 -26
  12. package/bundled/dev-pipeline/templates/sections/ac-verification-checklist.md +4 -10
  13. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +1 -0
  14. package/bundled/dev-pipeline/templates/sections/feature-context.md +16 -11
  15. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +17 -26
  16. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-opencli.md +1 -1
  17. package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +1 -1
  18. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +11 -0
  19. package/bundled/dev-pipeline/templates/sections/phase-commit.md +11 -0
  20. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-base.md +1 -1
  21. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +2 -9
  22. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +2 -9
  23. package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +8 -17
  24. package/bundled/dev-pipeline/templates/sections/phase-plan-lite.md +1 -1
  25. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +1 -1
  26. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +1 -1
  27. package/bundled/dev-pipeline/templates/sections/task-contract.md +34 -0
  28. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-agent.md +27 -46
  29. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-lite.md +27 -37
  30. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +13 -0
  31. package/bundled/dev-pipeline-windows/lib/common.ps1 +61 -1
  32. package/bundled/dev-pipeline-windows/lib/pipeline.ps1 +299 -14
  33. package/bundled/dev-pipeline-windows/scripts/generate-bootstrap-prompt.py +11 -12
  34. package/bundled/dev-pipeline-windows/scripts/parse-stream-progress.py +160 -3
  35. package/bundled/dev-pipeline-windows/scripts/update-feature-status.py +27 -3
  36. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-implement.md +36 -22
  37. package/bundled/dev-pipeline-windows/templates/agent-prompts/reviewer-review.md +1 -1
  38. package/bundled/dev-pipeline-windows/templates/bugfix-bootstrap-prompt.md +24 -21
  39. package/bundled/dev-pipeline-windows/templates/refactor-bootstrap-prompt.md +13 -26
  40. package/bundled/dev-pipeline-windows/templates/sections/ac-verification-checklist.md +4 -10
  41. package/bundled/dev-pipeline-windows/templates/sections/context-budget-rules.md +1 -0
  42. package/bundled/dev-pipeline-windows/templates/sections/feature-context.md +16 -11
  43. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-auto.md +22 -10
  44. package/bundled/dev-pipeline-windows/templates/sections/phase-commit-full.md +11 -0
  45. package/bundled/dev-pipeline-windows/templates/sections/phase-commit.md +11 -0
  46. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-base.md +1 -1
  47. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-agent.md +2 -9
  48. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-full.md +2 -9
  49. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-lite.md +8 -19
  50. package/bundled/dev-pipeline-windows/templates/sections/phase-plan-lite.md +1 -1
  51. package/bundled/dev-pipeline-windows/templates/sections/phase-review-full.md +1 -1
  52. package/bundled/dev-pipeline-windows/templates/sections/phase-specify-plan-full.md +1 -1
  53. package/bundled/dev-pipeline-windows/templates/sections/task-contract.md +34 -0
  54. package/bundled/dev-pipeline-windows/templates/sections/test-failure-recovery-agent.md +27 -46
  55. package/bundled/dev-pipeline-windows/templates/sections/test-failure-recovery-lite.md +27 -37
  56. package/bundled/skills/_metadata.json +1 -1
  57. package/package.json +1 -1
@@ -49,6 +49,7 @@ SESSION_STATUS_VALUES = [
49
49
  "commit_missing",
50
50
  "docs_missing",
51
51
  "merge_conflict",
52
+ "finalization_needed",
52
53
  ]
53
54
 
54
55
  TERMINAL_STATUSES = {"completed", "failed", "skipped", "auto_skipped", "split"}
@@ -644,7 +645,25 @@ def action_update(args, feature_list_path, state_dir):
644
645
  fs["degraded_reason"] = session_status
645
646
  fs["resume_from_phase"] = None
646
647
  fs["sessions"] = []
647
- fs["last_session_id"] = None
648
+ if session_id:
649
+ fs["last_session_id"] = session_id
650
+ fs["last_failed_session_id"] = session_id
651
+
652
+ err = update_feature_in_list(feature_list_path, feature_id, new_status)
653
+ if err:
654
+ error_out("Failed to update .prizmkit/plans/feature-list.json: {}".format(err))
655
+ return
656
+ elif session_status == "finalization_needed":
657
+ # Runtime preserved dirty post-completion changes but could not safely
658
+ # clean them for automatic merge. Preserve the dev branch and stop for
659
+ # manual finalization instead of spending code retry budget.
660
+ new_status = "failed"
661
+ fs["degraded_reason"] = session_status
662
+ fs["resume_from_phase"] = None
663
+ fs["finalization_needed_count"] = fs.get("finalization_needed_count", 0) + 1
664
+ if session_id:
665
+ fs["last_session_id"] = session_id
666
+ fs["last_failed_session_id"] = session_id
648
667
 
649
668
  err = update_feature_in_list(feature_list_path, feature_id, new_status)
650
669
  if err:
@@ -657,6 +676,8 @@ def action_update(args, feature_list_path, state_dir):
657
676
  new_status = "pending"
658
677
  fs["infra_error_count"] = fs.get("infra_error_count", 0) + 1
659
678
  fs["last_infra_error_session_id"] = session_id
679
+ if session_id:
680
+ fs["last_session_id"] = session_id
660
681
  fs["resume_from_phase"] = None
661
682
 
662
683
  err = update_feature_in_list(feature_list_path, feature_id, new_status)
@@ -673,6 +694,9 @@ def action_update(args, feature_list_path, state_dir):
673
694
  new_status = "pending"
674
695
 
675
696
  fs["resume_from_phase"] = None
697
+ if session_id:
698
+ fs["last_session_id"] = session_id
699
+ fs["last_failed_session_id"] = session_id
676
700
  # Keep sessions list and last_session_id for debugging
677
701
 
678
702
  err = update_feature_in_list(feature_list_path, feature_id, new_status)
@@ -712,9 +736,9 @@ def action_update(args, feature_list_path, state_dir):
712
736
  }
713
737
  if auto_skipped_features:
714
738
  summary["auto_skipped"] = [info["feature_id"] for info in auto_skipped_features]
715
- if session_status in ("commit_missing", "docs_missing", "merge_conflict"):
739
+ if session_status in ("commit_missing", "docs_missing", "merge_conflict", "finalization_needed"):
716
740
  summary["degraded_reason"] = session_status
717
- summary["restart_policy"] = "finalization_retry"
741
+ summary["restart_policy"] = "manual_finalization" if session_status == "finalization_needed" else "finalization_retry"
718
742
  elif session_status == "infra_error":
719
743
  summary["restart_policy"] = "infra_retry"
720
744
  summary["infra_error_count"] = fs.get("infra_error_count", 0)
@@ -1,30 +1,44 @@
1
1
  "Read {{DEV_SUBAGENT_PATH}}. Implement feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}).
2
- **IMPORTANT**: Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST — Section 3 has Prizm Context (TRAPS/RULES), Section 4 has File Manifest with paths and interfaces.
3
- ⚠️ DO NOT re-read source files already listed in Section 4 File Manifest unless you need implementation detail beyond the interface summary.
4
- 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` for full context.
5
- 2. Run `/prizmkit-implement` to execute the tasks in plan.md. Run tests with: `{{TEST_CMD}}`. Known baseline failures (pre-existing, not your fault): `{{BASELINE_FAILURES}}`.
6
- 3. If plan.md has more than 5 tasks: run `/compact` after completing every 3 tasks to manage context budget. If `/compact` is unavailable, continue without it.
7
- 4. After implement completes, verify the '## Implementation Log' section was written to context-snapshot.md.
8
2
 
9
- ## Acceptance Criteria Verification
3
+ ## Required Inputs
10
4
 
11
- Update the AC Verification Checklist in context-snapshot.md by marking each item [x] as you verify it:
12
- - As you complete each task, verify the corresponding acceptance criteria
13
- - Check the AC Checklist at the end of implementation
14
- - All [ ] must become [x] if any AC remains unverified, the feature is incomplete
15
- - Document any AC that cannot be verified due to test failures
5
+ 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` first.
6
+ 2. Use Section 4 File Manifest for targeted reads.
7
+ 3. Do not expand scope beyond the Task Contract and Verification Gates.
8
+ 4. Do not re-read source files already listed in Section 4 unless implementation details are missing from the manifest.
16
9
 
17
- ## Test Failure Recovery (Convergence-Based)
10
+ ## Work
18
11
 
19
- If tests fail, use convergence recovery — keep fixing while progress is being made:
12
+ Run `/prizmkit-implement` to execute `plan.md`.
20
13
 
21
- 1. **Run tests, record results**: count failures, exclude baseline failures
22
- 2. **Check termination**: All pass → done | Plateau (same failures 3 rounds) → stop | Failures decreased → continue
23
- 3. **Fix and iterate**: analyze, apply fix, re-run `{{TEST_CMD}}`, go back to step 1
14
+ Test command:
15
+ `{{TEST_CMD}}`
24
16
 
25
- **Key rule**: If failures decrease (even by 1), plateau counter resets.
26
- **Do NOT block completion** if unable to resolve — only NEW REGRESSIONS (not in baseline) require fixing.
27
- **If any AC cannot be verified** due to test failure: the feature is incomplete, add to failure notes.
17
+ Known baseline failures:
18
+ `{{BASELINE_FAILURES}}`
28
19
 
29
- 4. Do NOT execute any git commands (no git add/commit/reset/push).
30
- Do NOT exit until all tasks are [x], the '## Implementation Log' section is written, and AC Verification Checklist is 100% complete in context-snapshot.md."
20
+ If plan.md has more than 5 tasks, run `/compact` after completing every 3 tasks to manage context budget. If `/compact` is unavailable, continue without it.
21
+
22
+ ## Required Outputs
23
+
24
+ Before returning, append `## Implementation Log` to `context-snapshot.md` with:
25
+ - files changed/created
26
+ - key decisions
27
+ - deviations from plan
28
+ - test results
29
+ - Verification Gate status
30
+ - unresolved blockers, if any
31
+
32
+ ## Protocol References
33
+
34
+ - Follow the global Context Budget Rules.
35
+ - Carry forward the Dev-isolated subset: skip scaffold/generated files listed in `context-snapshot.md`; verify dependency versions before install/build commands that resolve dependencies; after build/compile commands, ensure outputs are ignored and never commit generated artifacts.
36
+ - If tests fail, follow this Test Failure Recovery subset: classify failures as baseline, new regression, brittle test, or environment/tooling; fix new regressions and brittle tests while progress is being made; document baseline failures; write `failure-log.md` for blockers.
37
+ - Do not run git commands; staging and commit are handled by the orchestrator.
38
+
39
+ Do not return success unless:
40
+ 1. implementation tasks are complete;
41
+ 2. `## Implementation Log` exists;
42
+ 3. every Verification Gate is verified.
43
+
44
+ If any Verification Gate is blocked, write `failure-log.md` and return a blocked/incomplete result instead of success."
@@ -1,5 +1,5 @@
1
1
  "Read {{REVIEWER_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
2
- 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/spec.md` (if it exists) for goals and acceptance criteria; if spec.md does not exist, read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` Section 1 instead
2
+ 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/spec.md` (if it exists) for goals and Verification Gates; if spec.md does not exist, read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` Section 1 Task Contract instead
3
3
  2. Read `.prizmkit/specs/{{FEATURE_SLUG}}/plan.md` for architecture decisions and completed tasks
4
4
  3. Run /prizmkit-code-review with artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/. The skill will run its internal review-fix loop (Reviewer → filter → Dev fix, max 3 rounds) and write review-report.md.
5
5
  4. Run the full test suite using `{{TEST_CMD}}`. When running tests: `({{TEST_CMD}}) 2>&1 | Tee-Object (Join-Path $env:TEMP "review-test-out.txt") | Select-Object -Last 20`, then Select-String (Join-Path $env:TEMP "review-test-out.txt") for details — do NOT re-run the suite multiple times.
@@ -84,12 +84,12 @@ New-Item -ItemType Directory -Force -Path .prizmkit/bugfix/{{BUG_ID}} | Out-Null
84
84
 
85
85
  {{IF_BROWSER_INTERACTION}}
86
86
 
87
- #### Browser Verification Setup
87
+ #### Browser Verification Protocol
88
88
 
89
- The bug may be reproducible via the UI using browser tools:
89
+ The bug may be reproducible via the UI. Use this single browser protocol for planning, implementation, review, and final reporting:
90
90
 
91
91
  {{IF_BROWSER_TOOL_AUTO}}
92
- - **Browser Tool**: Will be auto-selected based on error type and dev server configuration
92
+ - **Browser Tool**: Auto-select at runtime based on error type and dev server configuration
93
93
  {{END_IF_BROWSER_TOOL_AUTO}}
94
94
 
95
95
  {{IF_BROWSER_TOOL_PLAYWRIGHT}}
@@ -103,10 +103,7 @@ The bug may be reproducible via the UI using browser tools:
103
103
  **Browser Verification Goals**:
104
104
  {{BROWSER_VERIFY_STEPS}}
105
105
 
106
- If the bug is related to UI/frontend, you may use these tools to:
107
- 1. Reproduce the bug in a running dev server
108
- 2. Verify the fix after implementation
109
- 3. Smoke-test related UI flows for regression
106
+ Use this protocol only when the bug is UI/frontend-reproducible. Evidence must cover: original bug reproduction, post-fix behavior, related UI regression smoke tests, tool used, and any manual verification steps.
110
107
 
111
108
  {{END_IF_BROWSER_INTERACTION}}
112
109
 
@@ -141,7 +138,7 @@ Run `/prizmkit-plan` with `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`:
141
138
  - Resolve any `[NEEDS CLARIFICATION]` markers autonomously — do NOT pause
142
139
 
143
140
  {{IF_BROWSER_INTERACTION}}
144
- - **Browser Verification**: If the bug is UI-reproducible, plan.md should include browser-based reproduction as an optional verification step
141
+ - **Browser Verification**: If the bug is UI-reproducible, plan.md should reference the Browser Verification Protocol above instead of redefining browser steps.
145
142
  {{END_IF_BROWSER_INTERACTION}}
146
143
 
147
144
  **DECISION GATE — Fast Path Check**:
@@ -171,11 +168,7 @@ Run `/prizmkit-implement` with `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`:
171
168
 
172
169
  {{IF_BROWSER_INTERACTION}}
173
170
 
174
- **Browser Verification During Implementation**:
175
- - After each code fix, you may optionally use browser tools to verify the behavior
176
- - Reproduce the original bug steps and confirm they no longer occur
177
- - Test related UI flows to ensure no regression
178
- - Document any manual verification steps in the implementation notes
171
+ **Browser Verification During Implementation**: If the bug is UI-reproducible, apply the Browser Verification Protocol above and document evidence in the implementation notes.
179
172
 
180
173
  {{END_IF_BROWSER_INTERACTION}}
181
174
 
@@ -196,20 +189,30 @@ After implement completes, verify:
196
189
  If `FAST_PATH=true` (≤ 2 tasks, obvious root cause), skip this phase entirely.
197
190
 
198
191
  Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`:
199
- - The skill runs an internal review-fix loop (Reviewer → filter → Dev fix, max 3 rounds) and writes review-report.md
200
- - If PASS: proceed
201
- - If NEEDS_FIXES: the skill exhausted its max rounds; log remaining findings and proceed
192
+ - The skill runs an internal review-fix loop (Reviewer → filter → Dev fix, max 3 rounds) and writes `review-report.md`
193
+ - `review-report.md` must contain `## Verdict`
194
+
195
+ **Gate Check — Review Report**:
196
+ After `/prizmkit-code-review` returns, verify the review report:
197
+ ```powershell
198
+ if (Select-String -Path .prizmkit/bugfix/{{BUG_ID}}/review-report.md -Pattern "## Verdict" -Quiet) { "GATE:PASS" } else { "GATE:MISSING" }
199
+ ```
200
+ If GATE:MISSING:
201
+ - Do not re-run `/prizmkit-code-review` in an unbounded report-repair loop.
202
+ - Perform one bounded status check; retry `/prizmkit-code-review` at most once only if the missing report appears caused by a transient team/config/lock error.
203
+ - If the report is still missing after that single check/retry, write `failure-log.md` with the spawn/skill error and last observable state, then either perform a safe inline fallback review (spec/plan/diff/tests → write `review-report.md` with `## Verdict`) or stop with a clear recovery failure.
204
+
205
+ Read `review-report.md` and check the Verdict:
206
+ - `PASS` → proceed
207
+ - `NEEDS_FIXES` → the skill exhausted its max rounds; log remaining findings and proceed
202
208
 
203
209
  {{IF_BROWSER_INTERACTION}}
204
210
 
205
- **Code Review — Browser Verification Check**:
206
- - Verify that browser-based reproduction steps (if applicable) are clearly documented
207
- - Confirm that the fix maintains the expected UI behavior for all affected flows
208
- - Validate that any manual verification steps have been completed successfully
211
+ **Code Review — Browser Verification Check**: Confirm that UI-reproducible bug evidence follows the Browser Verification Protocol above.
209
212
 
210
213
  {{END_IF_BROWSER_INTERACTION}}
211
214
 
212
- **CP-3**: Code review complete, all tests green.
215
+ **CP-3**: Code review complete, `review-report.md` written, and all tests green.
213
216
 
214
217
  **Checkpoint update**: Set step `prizmkit-code-review` to `"completed"`.
215
218
 
@@ -16,7 +16,7 @@ You are the **refactor session orchestrator**. Execute Refactor {{REFACTOR_ID}}:
16
16
 
17
17
  **NON-INTERACTIVE MODE**: You are running in headless non-interactive mode. There is NO human on the other end. NEVER ask for user confirmation, NEVER wait for user input, NEVER use interactive prompts (e.g. "Would you like me to…"). If a skill has an interactive step (e.g. offer remediation, ask for approval), skip it and proceed autonomously. Make decisions based on the data available and move forward.
18
18
 
19
- **MANDATORY TEAM REQUIREMENT**: You MUST use the `prizm-dev-team` agents (Dev + Reviewer). This is NON-NEGOTIABLE. All implementation and review work MUST be performed by the appropriate team agents (Dev, Reviewer). You are the orchestrator — handle coordination, planning, and commit phases directly.
19
+ **NORMAL-PATH TEAM REQUIREMENT**: Use the `prizm-dev-team` agents (Dev + Reviewer) for implementation and review. You are the orchestrator — handle coordination, planning, and commit phases directly. If a required agent cannot be spawned after the bounded retry policy below, follow the documented recovery exception instead of looping forever.
20
20
 
21
21
  **REFACTOR DOCUMENTATION POLICY**:
22
22
  - **DEFAULT**: Run `/prizmkit-retrospective` with full sync (Job 1 + Job 2), because refactoring changes code structure and interfaces.
@@ -83,7 +83,8 @@ You are the **refactor session orchestrator**. Execute Refactor {{REFACTOR_ID}}:
83
83
  **Agent spawn failure policy (all Agent tool calls)**:
84
84
  - If spawning Dev or Reviewer fails with team/config/lock errors, retry at most once.
85
85
  - If the second attempt fails, do not keep spawning variants and do not enter artifact polling for Implementation Log, review-report, or refactor-report markers.
86
- - Use the documented inline/recovery fallback for that phase: complete remaining refactor work directly in the orchestrator when safe, write the required report yourself where possible, or write `failure-log.md` with the spawn error and last observable state before stopping for recovery.
86
+ - Recovery exception: complete remaining refactor work directly in the orchestrator only when the action is safe and bounded; otherwise write `failure-log.md` with the spawn error and last observable state before stopping for recovery.
87
+ - Any recovery exception must be recorded in the required report or session status so downstream runs know the normal team path was unavailable.
87
88
  - Apply the same cap to any re-spawn for report repair or resume prompts; do not burn multiple minutes on identical team/config/lock failures.
88
89
 
89
90
  ## Workflow Checkpoint System
@@ -131,32 +132,26 @@ Resolve any `[NEEDS CLARIFICATION]` markers using the refactor description — d
131
132
 
132
133
  {{IF_BROWSER_INTERACTION}}
133
134
 
134
- #### Browser Verification Strategy
135
+ #### Browser Behavior Preservation Protocol
135
136
 
136
- The refactor may affect UI behavior. Browser verification can validate:
137
- - **UI Render**: UI components render identically after refactoring
138
- - **User Interactions**: Navigation, form submissions, and workflows function as before
139
- - **Feature Coverage**: Refactored features work end-to-end in real browser environment
137
+ The refactor may affect UI behavior. Use this single browser protocol for planning, implementation, review, and final reporting:
140
138
 
141
139
  {{IF_BROWSER_TOOL_AUTO}}
142
- Browser tool will be auto-selected at runtime based on dev server and feature complexity.
140
+ - **Browser Tool**: Auto-select at runtime based on dev server and feature complexity.
143
141
  {{END_IF_BROWSER_TOOL_AUTO}}
144
142
 
145
143
  {{IF_BROWSER_TOOL_PLAYWRIGHT}}
146
- **Tool: playwright-cli**Local isolated browser instance for dev server verification
144
+ - **Browser Tool**: playwright-cli — local isolated browser instance for dev server verification.
147
145
  {{END_IF_BROWSER_TOOL_PLAYWRIGHT}}
148
146
 
149
147
  {{IF_BROWSER_TOOL_OPENCLI}}
150
- **Tool: opencli** — Chrome session with existing login for testing OAuth/third-party integrations
148
+ - **Browser Tool**: opencli — Chrome session with existing login for OAuth/third-party integrations.
151
149
  {{END_IF_BROWSER_TOOL_OPENCLI}}
152
150
 
153
151
  **Verification Goals**:
154
152
  {{BROWSER_VERIFY_STEPS}}
155
153
 
156
- Include browser verification approach in plan.md:
157
- - Which UI flows should be smoke-tested after refactoring?
158
- - Any specific user journeys affected by the structural changes?
159
- - Should verification be part of review phase or implementation phase?
154
+ Evidence must cover affected UI render, primary user interactions, behavior-sensitive workflows, tool used, and whether verification belongs in implementation, review, or both.
160
155
 
161
156
  {{END_IF_BROWSER_INTERACTION}}
162
157
 
@@ -170,7 +165,7 @@ Include browser verification approach in plan.md:
170
165
  **Goal**: Execute all tasks from plan.md while preserving existing behavior.
171
166
 
172
167
  - Spawn Dev agent (Agent tool, subagent_type="prizm-dev-team-dev", run_in_background=false)
173
- Spawn failure cap: for team/config/lock errors, retry at most once for this Dev spawn. If the second attempt fails, do not poll for `## Implementation Log`; write `failure-log.md` and either complete remaining refactor work directly in the orchestrator or stop for recovery.
168
+ Apply the all-agent spawn failure policy above for this Dev spawn: for team/config/lock errors, retry at most once; if the second attempt fails, do not poll for `## Implementation Log`; use the bounded recovery exception.
174
169
  Prompt: "Read {{DEV_SUBAGENT_PATH}}. For refactor {{REFACTOR_ID}} ('{{REFACTOR_TITLE}}'):
175
170
  1. Read `.prizmkit/refactor/{{REFACTOR_ID}}/spec.md` and `.prizmkit/refactor/{{REFACTOR_ID}}/plan.md`
176
171
  2. Read `.prizmkit/prizm-docs/` for affected modules (TRAPS, RULES, PATTERNS)
@@ -185,11 +180,7 @@ Include browser verification approach in plan.md:
185
180
 
186
181
  {{IF_BROWSER_INTERACTION}}
187
182
 
188
- 6. **Browser Smoke Tests** (after every major refactor task):
189
- - Use browser tools to verify UI still renders correctly
190
- - Test the primary user flows affected by the refactoring
191
- - Confirm no visual or interactive regressions
192
- - Document any manual browser verification steps in implementation notes
183
+ 6. Apply the Browser Behavior Preservation Protocol above after major refactor tasks and document evidence in implementation notes.
193
184
 
194
185
  {{END_IF_BROWSER_INTERACTION}}
195
186
 
@@ -208,7 +199,7 @@ Include browser verification approach in plan.md:
208
199
  **Goal**: Verify refactoring quality and behavior preservation.
209
200
 
210
201
  - Spawn Reviewer agent (Agent tool, subagent_type="prizm-dev-team-reviewer", run_in_background=false)
211
- Spawn failure cap: for team/config/lock errors, retry at most once for this Reviewer spawn. If the second attempt fails, do not poll for `review-report.md`; write `failure-log.md` with the spawn error and last observable state before stopping or performing an inline fallback.
202
+ Apply the all-agent spawn failure policy above for this Reviewer spawn.
212
203
  Prompt: "Read {{REVIEWER_SUBAGENT_PATH}}. For refactor {{REFACTOR_ID}}:
213
204
  1. Read `.prizmkit/refactor/{{REFACTOR_ID}}/spec.md` for goals and behavior preservation contracts
214
205
  2. Read `.prizmkit/refactor/{{REFACTOR_ID}}/plan.md` for architecture decisions and completed tasks
@@ -217,11 +208,7 @@ Include browser verification approach in plan.md:
217
208
 
218
209
  {{IF_BROWSER_INTERACTION}}
219
210
 
220
- 5. **Browser Verification Review**:
221
- - Verify that critical user workflows still function end-to-end in browser
222
- - Confirm UI renders consistently after structural changes
223
- - Validate any behavior-sensitive components behave identically
224
- - Document browser verification findings in review-report.md
211
+ 5. Verify the Browser Behavior Preservation Protocol evidence and document findings in `review-report.md`.
225
212
 
226
213
  {{END_IF_BROWSER_INTERACTION}}
227
214
 
@@ -1,13 +1,7 @@
1
- ## Acceptance Criteria Verification Checklist
1
+ ## Verification Gates Compatibility Note
2
2
 
3
- This checklist is auto-generated from feature.acceptance_criteria. The Dev agent must verify each criterion and mark as complete:
3
+ This section file is retained for compatibility with older bootstrap templates.
4
4
 
5
- {{AC_CHECKLIST}}
6
-
7
- **Verification Gates**:
8
- 1. All [x] items confirmed by Dev agent during implementation
9
- 2. Reviewer agent verifies checklist is 100% complete before clearing PASS verdict
10
- 3. Any unmet AC ([ ] remaining) marks feature as incomplete
11
-
12
- ---
5
+ Current section assembly renders Verification Gates only inside `task-contract.md` so the feature scope and acceptance requirements have a single source of truth.
13
6
 
7
+ Do not add this section separately unless you intentionally want to duplicate the gates outside the Task Contract.
@@ -31,3 +31,4 @@ You are running in **headless non-interactive mode** with a FINITE context windo
31
31
  (c) Use no version constraint (e.g., `"express": "*"`)
32
32
  - **This is a BLOCKING gate**: do NOT run `npm install` / `pip install` / `cargo build` / `go mod tidy` until ALL versions in the manifest have been verified or use open constraints
33
33
  - Batch version lookups: query multiple packages in parallel to save time (e.g., run multiple `npm view` commands concurrently)
34
+ 10. **Build artifact hygiene** — After any build/compile command (`go build`, `npm run build`, `tsc`, etc.), ensure the output binary, build directory, generated bundle, or cache directory is ignored by git before the commit phase. Never commit compiled binaries, build output, or generated artifacts.
@@ -1,25 +1,30 @@
1
1
  <feature-context>
2
- ### Feature Description
2
+ ## Source Semantics
3
3
 
4
- {{FEATURE_DESCRIPTION}}
4
+ Use this material according to the following priority:
5
5
 
6
- {{USER_CONTEXT}}
6
+ 1. **Task Contract** — defines current scope and Verification Gates.
7
+ 2. **User Raw Context** — authoritative constraints, but not automatic scope expansion.
8
+ 3. **Completed Dependencies** — existing behavior and interfaces; do not re-implement them.
9
+ 4. **Project Brief** — product background and architecture alignment.
10
+ 5. **App Global Context** — stack, runtime, and testing conventions.
11
+ 6. **Project Conventions** — repository-specific rules.
7
12
 
8
- ### Acceptance Criteria
13
+ ### User Raw Context
9
14
 
10
- {{ACCEPTANCE_CRITERIA}}
15
+ {{USER_CONTEXT}}
11
16
 
12
- ### Project Brief
17
+ ### Completed Dependencies
13
18
 
14
- > Product ideas checklist from planning. Lines marked [x] are already implemented. When your feature touches any [ ] item, ensure alignment. After implementation, mark relevant items [x] and append the key file/directory paths.
19
+ > Use this section to understand available interfaces and avoid duplicating completed work.
15
20
 
16
- {{PROJECT_BRIEF}}
21
+ {{COMPLETED_DEPENDENCIES}}
17
22
 
18
- ### Dependencies (Already Completed)
23
+ ### Project Brief
19
24
 
20
- > Below are features that this feature depends on, along with their key implementation notes. Use this context to understand what has already been built and what interfaces/APIs/models are available.
25
+ > Use this section for alignment only. Do not treat unrelated backlog items as current feature scope.
21
26
 
22
- {{COMPLETED_DEPENDENCIES}}
27
+ {{PROJECT_BRIEF}}
23
28
 
24
29
  ### App Global Context
25
30
 
@@ -1,8 +1,9 @@
1
1
  ### Browser Verification — MANDATORY
2
2
 
3
- You MUST execute this phase. Use native PowerShell commands for setup, server lifecycle, and cleanup.
3
+ You MUST attempt this phase. Mark it as skipped only when no usable browser tool can be found, installed, or started. Use native PowerShell commands for setup, server lifecycle, and cleanup.
4
+
5
+ **Step 0 — Tool Selection (BLOCKING — decide before any browser action)**:
4
6
 
5
- **Tool readiness**:
6
7
  ```powershell
7
8
  $playwright = Get-Command playwright-cli -ErrorAction SilentlyContinue
8
9
  $opencli = Get-Command opencli -ErrorAction SilentlyContinue
@@ -10,16 +11,25 @@ if ($playwright) { playwright-cli --version } else { "PLAYWRIGHT_CLI:NOT_INSTALL
10
11
  if ($opencli) { opencli --version } else { "OPENCLI:NOT_INSTALLED" }
11
12
  ```
12
13
 
13
- If neither browser tool is available, install playwright-cli as the default:
14
+ Use this single decision tree:
15
+ 1. If `playwright-cli` is available, use it by default for local dev-server verification.
16
+ 2. Else if `opencli` is available, run `opencli doctor`; use `opencli` only if doctor passes.
17
+ 3. Else install `playwright-cli` as the default:
18
+ ```powershell
19
+ npm install -g @playwright/cli@latest
20
+ playwright-cli --version
21
+ ```
22
+ 4. If no browser tool is usable after these steps, append `## Browser Verification: SKIPPED — no usable browser tool` to `context-snapshot.md`, then continue to reporting/checkpoint.
23
+
24
+ Use `opencli` instead of `playwright-cli` only when the scenario requires an existing Chrome login/session or third-party integration cookies.
25
+
26
+ Record your choice:
14
27
  ```powershell
15
- npm install -g @playwright/cli@latest
16
- playwright-cli --version
28
+ $BROWSER_TOOL = "playwright-cli" # or "opencli" or "skipped"
29
+ "Selected browser tool: $BROWSER_TOOL"
17
30
  ```
18
31
 
19
- **Choose the tool**:
20
- - Use `playwright-cli` for isolated local dev-server verification.
21
- - Use `opencli` when the scenario needs an existing Chrome login/session.
22
- - If opencli is selected, verify connectivity with `opencli doctor` before browser actions.
32
+ If `$BROWSER_TOOL -eq "skipped"`, do NOT start a dev server and do NOT run browser commands. Go directly to result reporting and the checkpoint update.
23
33
 
24
34
  **Dev server setup**:
25
35
  ```powershell
@@ -56,6 +66,8 @@ Use the selected browser tool to inspect current page state, perform actions, an
56
66
  - `playwright-cli open http://localhost:$DEV_PORT`, `playwright-cli snapshot`, `playwright-cli screenshot`, `playwright-cli close`
57
67
  - `opencli browser open http://localhost:$DEV_PORT`, `opencli browser state`, `opencli browser screenshot`, `opencli browser close`
58
68
 
69
+ Base concrete actions on the Task Contract's Verification Gates.
70
+
59
71
  **Cleanup**:
60
72
  ```powershell
61
73
  if ($DEV_SERVER_PID) { Stop-Process -Id $DEV_SERVER_PID -Force -ErrorAction SilentlyContinue }
@@ -64,7 +76,7 @@ Get-NetTCPConnection -LocalPort ([int]$DEV_PORT) -ErrorAction SilentlyContinue |
64
76
  ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue }
65
77
  ```
66
78
 
67
- Append results to `context-snapshot.md` with tool, URL, commands used, screenshot path, PASS/FAIL reason, and cleanup status.
79
+ Append results to `context-snapshot.md` with tool, URL, commands used, screenshot path, PASS/FAIL/SKIPPED reason, and cleanup status.
68
80
 
69
81
  **Checkpoint update**:
70
82
  ```powershell
@@ -69,3 +69,14 @@ Invoke-PrizmPython {{PIPELINE_DIR}}\scripts\update-checkpoint.py `
69
69
  --step prizmkit-committer `
70
70
  --status completed
71
71
  ```
72
+
73
+ ### TERMINAL STOP — S09 Completed
74
+
75
+ After all of the following are true, the session is **TERMINAL**:
76
+
77
+ - `/prizmkit-committer` has completed
78
+ - `git status --short` is clean (except ignored/local-only pipeline artifacts)
79
+ - `.prizmkit/specs/{{FEATURE_SLUG}}/completion-summary.json` is written
80
+ - the S09 / `prizmkit-committer` checkpoint is marked `completed`
81
+
82
+ At that point, stop immediately. Do **not** process delayed teammate/reviewer findings, do **not** edit files, do **not** amend the commit, and do **not** start any new tool calls. Any findings that arrive after S09 is completed are follow-up work for a later session, not part of this feature commit.
@@ -62,3 +62,14 @@ Invoke-PrizmPython {{PIPELINE_DIR}}\scripts\update-checkpoint.py `
62
62
  --step prizmkit-committer `
63
63
  --status completed
64
64
  ```
65
+
66
+ ### TERMINAL STOP — S09 Completed
67
+
68
+ After all of the following are true, the session is **TERMINAL**:
69
+
70
+ - `/prizmkit-committer` has completed
71
+ - `git status --short` is clean (except ignored/local-only pipeline artifacts)
72
+ - `.prizmkit/specs/{{FEATURE_SLUG}}/completion-summary.json` is written
73
+ - the S09 / `prizmkit-committer` checkpoint is marked `completed`
74
+
75
+ At that point, stop immediately. Do **not** process delayed teammate/reviewer findings, do **not** edit files, do **not** amend the commit, and do **not** start any new tool calls. Any findings that arrive after S09 is completed are follow-up work for a later session, not part of this feature commit.
@@ -15,7 +15,7 @@ If MISSING — build it now:
15
15
  Identify the top-level source directories from the results.
16
16
  3. Scan the detected source directories for files related to this feature; read each one
17
17
  4. Write `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md`:
18
- - **Section 1 — Feature Brief**: feature description + acceptance criteria (copy from above)
18
+ - **Section 1 — Task Contract**: Objective, scope rule, non-scope rule, and Verification Gates from the Task Contract above
19
19
  - **Section 2 — Project Structure**: run the following to get a visual directory tree, then paste output:
20
20
  ```powershell
21
21
  Get-ChildItem -Path . -Directory -Recurse -Depth 2 -ErrorAction SilentlyContinue |
@@ -1,13 +1,6 @@
1
1
  ### Implement — Dev Subagent
2
2
 
3
- **Build artifacts rule** (passed to Dev): After any build/compile command (`go build`, `npm run build`, `tsc`, etc.), ensure the output binary or build directory is in `.gitignore`. Never commit compiled binaries, build output, or generated artifacts.
4
-
5
- **Dependency version gate (BLOCKING — pass to Dev agent)**: Before running ANY package install command (`npm install`, `pip install`, `cargo build`, `go mod tidy`, `bundle install`, etc.):
6
- 1. Every version number in the dependency manifest MUST be verified against the real registry (see Context Budget Rules §9)
7
- 2. If a scaffold tool generated a `package.json` / `requirements.txt` / etc., verify the versions it wrote too — scaffold tools can emit outdated versions
8
- 3. Do NOT proceed with install until all versions are confirmed real. Violation = wasted timeout cycles that can crash the session
9
-
10
- **Scaffold file rule (pass to Dev agent)**: After running any init/scaffold command, record generated files in context-snapshot.md under `### Scaffold Files (do not re-read)`. Never re-read these files — their content is standard boilerplate (see Context Budget Rules §8). When spawning subagents, explicitly list scaffold files so they skip reading them.
3
+ **Protocol handoff to Dev**: The Dev prompt already carries the required subset of Context Budget Rules, the Test Failure Recovery Protocol, and Task Contract / Verification Gate constraints. Do not duplicate those rules here; verify Dev output against the gates below.
11
4
 
12
5
  **Spawn Agent**:
13
6
  | Parameter | Value |
@@ -24,7 +17,7 @@
24
17
  **Prompt**:
25
18
  > {{AGENT_PROMPT_DEV_IMPLEMENT}}
26
19
 
27
- Wait for Dev to return. All tasks must be `[x]`, tests pass.
20
+ Wait for Dev to return. Implementation may proceed only when tasks are complete and the Test Failure Recovery Protocol's Success Rule is satisfied.
28
21
 
29
22
  **No silent artifact polling**:
30
23
  - Do NOT run a long no-output loop that only waits for `## Implementation Log` or any other file marker.
@@ -1,13 +1,6 @@
1
1
  ### Implement — Dev Agent
2
2
 
3
- **Build artifacts rule** (passed to Dev): After any build/compile command (`go build`, `npm run build`, `tsc`, etc.), ensure the output binary or build directory is in `.gitignore`. Never commit compiled binaries, build output, or generated artifacts.
4
-
5
- **Dependency version gate (BLOCKING — pass to Dev agent)**: Before running ANY package install command (`npm install`, `pip install`, `cargo build`, `go mod tidy`, `bundle install`, etc.):
6
- 1. Every version number in the dependency manifest MUST be verified against the real registry (see Context Budget Rules §9)
7
- 2. If a scaffold tool generated a `package.json` / `requirements.txt` / etc., verify the versions it wrote too — scaffold tools can emit outdated versions
8
- 3. Do NOT proceed with install until all versions are confirmed real. Violation = wasted timeout cycles that can crash the session
9
-
10
- **Scaffold file rule (pass to Dev agent)**: After running any init/scaffold command, record generated files in context-snapshot.md under `### Scaffold Files (do not re-read)`. Never re-read these files — their content is standard boilerplate (see Context Budget Rules §8). When spawning subagents, explicitly list scaffold files so they skip reading them.
3
+ **Protocol handoff to Dev**: The Dev prompt already carries the required subset of Context Budget Rules, the Test Failure Recovery Protocol, and Task Contract / Verification Gate constraints. Do not duplicate those rules here; verify Dev output against the gates below.
11
4
 
12
5
  Before spawning Dev, check plan.md Tasks section:
13
6
  ```powershell
@@ -50,7 +43,7 @@ Wait for Dev to return. **If Dev times out before all tasks are `[x]`**:
50
43
  > {{AGENT_PROMPT_DEV_RESUME}}
51
44
  3. Max 2 recovery retries. After 2 failures, orchestrator implements remaining tasks directly.
52
45
 
53
- All tasks `[x]`, tests pass.
46
+ Implementation phase is complete only when all tasks are `[x]` and the Test Failure Recovery Protocol's Success Rule is satisfied.
54
47
 
55
48
 
56
49
  **Checkpoint update**: Run the update script to set step `prizmkit-implement` to `"completed"`:
@@ -1,20 +1,9 @@
1
1
  ### Implement + Test
2
2
 
3
- **Build artifacts**: After any build/compile command (`go build`, `npm run build`, `tsc`, etc.), ensure the output binary or build directory is in `.gitignore`:
4
- ```powershell
5
- # Example for Go
6
- if (-not (Select-String -Path .gitignore -Pattern '^/binary-name$' -Quiet -ErrorAction SilentlyContinue)) {
7
- Add-Content -Path .gitignore -Value '/binary-name'
8
- }
9
- ```
10
- Never commit compiled binaries, build output, or generated artifacts.
11
-
12
- **Dependency version gate (BLOCKING)**: Before running ANY package install command (`npm install`, `pip install`, `cargo build`, `go mod tidy`, `bundle install`, etc.):
13
- 1. Every version number in your dependency manifest MUST be verified against the real registry (see Context Budget Rules §9)
14
- 2. If you used a scaffold tool that generated a `package.json` / `requirements.txt` / etc., verify the versions it wrote too — scaffold tools can emit outdated versions
15
- 3. Do NOT proceed with install until all versions are confirmed real. Violation = wasted timeout cycles
16
-
17
- **Scaffold file rule**: After running any init/scaffold command, record generated files in context-snapshot.md under `### Scaffold Files (do not re-read)`. Never re-read these files — their content is standard boilerplate (see Context Budget Rules §8).
3
+ **Protocol references**:
4
+ - Follow Context Budget Rules §8 for scaffold/generated files.
5
+ - Follow Context Budget Rules §9 before package install/build commands that resolve dependencies.
6
+ - Follow Context Budget Rules §10 after build/compile commands.
18
7
 
19
8
  **3a.** Detect test commands and record baseline:
20
9
 
@@ -36,11 +25,11 @@ You know this project's tech stack. Identify ALL test commands that apply (e.g.,
36
25
 
37
26
  **3c.** After implement completes, verify:
38
27
  1. All tasks in plan.md are `[x]`
39
- 2. Run the full test suite to ensure nothing is broken
40
- 3. Verify each acceptance criterion from Section 1 of context-snapshot.md is met — check mentally, do NOT re-read files you already wrote
41
- 4. If any criterion is not met, fix it now using the convergence-based recovery loop (see Test Failure Recovery Protocol)
28
+ 2. Run the full test suite to ensure no new regressions remain
29
+ 3. Verify each Verification Gate from the Task Contract — check mentally, do NOT re-read files you already wrote
30
+ 4. If any gate is unmet or blocked, follow the Test Failure Recovery Protocol
42
31
 
43
- **CP-2**: All acceptance criteria met, all tests pass.
32
+ **CP-2**: Implementation may proceed only when all tasks are `[x]` and the Test Failure Recovery Protocol's Success Rule is satisfied. Blocked gates must be documented in `failure-log.md` and are not success.
44
33
 
45
34
 
46
35
  **Checkpoint update**: Run the update script to set step `prizmkit-implement` to `"completed"`:
@@ -5,7 +5,7 @@ Get-ChildItem .prizmkit/specs/{{FEATURE_SLUG}}/ -ErrorAction SilentlyContinue
5
5
  ```
6
6
 
7
7
  If plan.md missing, run `/prizmkit-plan` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`:
8
- - Pass the feature description and acceptance criteria from the Feature Context section above as input
8
+ - Pass the Objective and Verification Gates from the Task Contract as input
9
9
  - The plan.md should include: key components, data flow, files to create/modify, and a Tasks section with `[ ]` checkboxes (each task = one implementable unit). Keep under 80 lines.
10
10
  - Resolve any `[NEEDS CLARIFICATION]` markers using the feature description — do NOT pause for interactive input.
11
11
 
@@ -21,7 +21,7 @@ Read `review-report.md` and check the Verdict:
21
21
 
22
22
  Run the full test suite: `({{TEST_CMD}}) 2>&1 | Tee-Object (Join-Path $env:TEMP "review-test-out.txt") | Select-Object -Last 20`
23
23
 
24
- **CP-3**: Review complete, tests pass, report written.
24
+ **CP-3**: Review complete, report written, and the Test Failure Recovery Protocol's Success Rule is satisfied.
25
25
 
26
26
 
27
27
  **Checkpoint update**: Run the update script to set step `prizmkit-code-review` to `"completed"`: