prizmkit 1.1.57 → 1.1.60

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 (188) hide show
  1. package/bin/create-prizmkit.js +8 -6
  2. package/bundled/VERSION.json +3 -3
  3. package/bundled/adapters/codex/agent-adapter.js +38 -0
  4. package/bundled/adapters/codex/paths.js +27 -0
  5. package/bundled/adapters/codex/rules-adapter.js +30 -0
  6. package/bundled/adapters/codex/settings-adapter.js +27 -0
  7. package/bundled/adapters/codex/skill-adapter.js +65 -0
  8. package/bundled/adapters/codex/team-adapter.js +37 -0
  9. package/bundled/dev-pipeline/.env.example +2 -1
  10. package/bundled/dev-pipeline/README.md +10 -7
  11. package/bundled/dev-pipeline/lib/common.sh +278 -37
  12. package/bundled/dev-pipeline/run-bugfix.sh +10 -61
  13. package/bundled/dev-pipeline/run-feature.sh +10 -78
  14. package/bundled/dev-pipeline/run-recovery.sh +10 -46
  15. package/bundled/dev-pipeline/run-refactor.sh +10 -61
  16. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +17 -7
  17. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +9 -3
  18. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +9 -3
  19. package/bundled/dev-pipeline/scripts/utils.py +6 -4
  20. package/bundled/dev-pipeline-windows/.env.example +28 -0
  21. package/bundled/dev-pipeline-windows/README.md +30 -0
  22. package/bundled/dev-pipeline-windows/SCHEMA_ANALYSIS.md +525 -0
  23. package/bundled/dev-pipeline-windows/assets/feature-list-example.json +146 -0
  24. package/bundled/dev-pipeline-windows/assets/prizm-dev-team-integration.md +138 -0
  25. package/bundled/dev-pipeline-windows/launch-bugfix-daemon.ps1 +9 -0
  26. package/bundled/dev-pipeline-windows/launch-feature-daemon.ps1 +9 -0
  27. package/bundled/dev-pipeline-windows/launch-refactor-daemon.ps1 +9 -0
  28. package/bundled/dev-pipeline-windows/lib/common.ps1 +432 -0
  29. package/bundled/dev-pipeline-windows/lib/daemon.ps1 +140 -0
  30. package/bundled/dev-pipeline-windows/lib/pipeline.ps1 +446 -0
  31. package/bundled/dev-pipeline-windows/lib/reset.ps1 +87 -0
  32. package/bundled/dev-pipeline-windows/reset-bug.ps1 +9 -0
  33. package/bundled/dev-pipeline-windows/reset-feature.ps1 +9 -0
  34. package/bundled/dev-pipeline-windows/reset-refactor.ps1 +9 -0
  35. package/bundled/dev-pipeline-windows/run-bugfix.ps1 +9 -0
  36. package/bundled/dev-pipeline-windows/run-feature.ps1 +9 -0
  37. package/bundled/dev-pipeline-windows/run-recovery.ps1 +76 -0
  38. package/bundled/dev-pipeline-windows/run-refactor.ps1 +9 -0
  39. package/bundled/dev-pipeline-windows/scripts/check-session-status.py +228 -0
  40. package/bundled/dev-pipeline-windows/scripts/cleanup-logs.py +192 -0
  41. package/bundled/dev-pipeline-windows/scripts/detect-stuck.py +530 -0
  42. package/bundled/dev-pipeline-windows/scripts/generate-bootstrap-prompt.py +1737 -0
  43. package/bundled/dev-pipeline-windows/scripts/generate-bugfix-prompt.py +685 -0
  44. package/bundled/dev-pipeline-windows/scripts/generate-recovery-prompt.py +805 -0
  45. package/bundled/dev-pipeline-windows/scripts/generate-refactor-prompt.py +763 -0
  46. package/bundled/dev-pipeline-windows/scripts/init-bugfix-pipeline.py +316 -0
  47. package/bundled/dev-pipeline-windows/scripts/init-dev-team.py +134 -0
  48. package/bundled/dev-pipeline-windows/scripts/init-pipeline.py +380 -0
  49. package/bundled/dev-pipeline-windows/scripts/init-refactor-pipeline.py +399 -0
  50. package/bundled/dev-pipeline-windows/scripts/parse-stream-progress.py +388 -0
  51. package/bundled/dev-pipeline-windows/scripts/patch-completion-notes.py +191 -0
  52. package/bundled/dev-pipeline-windows/scripts/update-bug-status.py +864 -0
  53. package/bundled/dev-pipeline-windows/scripts/update-checkpoint.py +173 -0
  54. package/bundled/dev-pipeline-windows/scripts/update-feature-status.py +1501 -0
  55. package/bundled/dev-pipeline-windows/scripts/update-refactor-status.py +1073 -0
  56. package/bundled/dev-pipeline-windows/scripts/utils.py +542 -0
  57. package/bundled/dev-pipeline-windows/templates/agent-prompts/critic-plan-challenge.md +7 -0
  58. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-fix.md +7 -0
  59. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-implement.md +30 -0
  60. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-resume.md +5 -0
  61. package/bundled/dev-pipeline-windows/templates/agent-prompts/reviewer-review.md +7 -0
  62. package/bundled/dev-pipeline-windows/templates/bootstrap-prompt.md +46 -0
  63. package/bundled/dev-pipeline-windows/templates/bootstrap-tier1.md +43 -0
  64. package/bundled/dev-pipeline-windows/templates/bootstrap-tier2.md +43 -0
  65. package/bundled/dev-pipeline-windows/templates/bootstrap-tier3.md +43 -0
  66. package/bundled/dev-pipeline-windows/templates/bug-fix-list-schema.json +263 -0
  67. package/bundled/dev-pipeline-windows/templates/bugfix-bootstrap-prompt.md +320 -0
  68. package/bundled/dev-pipeline-windows/templates/feature-list-schema.json +237 -0
  69. package/bundled/dev-pipeline-windows/templates/refactor-bootstrap-prompt.md +331 -0
  70. package/bundled/dev-pipeline-windows/templates/refactor-list-schema.json +270 -0
  71. package/bundled/dev-pipeline-windows/templates/sections/ac-verification-checklist.md +13 -0
  72. package/bundled/dev-pipeline-windows/templates/sections/checkpoint-system.md +91 -0
  73. package/bundled/dev-pipeline-windows/templates/sections/context-budget-rules.md +33 -0
  74. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-agent.md +10 -0
  75. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-full.md +12 -0
  76. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-lite.md +7 -0
  77. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-agent.md +8 -0
  78. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-full.md +9 -0
  79. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-lite.md +6 -0
  80. package/bundled/dev-pipeline-windows/templates/sections/failure-capture.md +21 -0
  81. package/bundled/dev-pipeline-windows/templates/sections/feature-context.md +31 -0
  82. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-auto.md +72 -0
  83. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-opencli.md +63 -0
  84. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification.md +62 -0
  85. package/bundled/dev-pipeline-windows/templates/sections/phase-commit-full.md +71 -0
  86. package/bundled/dev-pipeline-windows/templates/sections/phase-commit.md +64 -0
  87. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-agent-suffix.md +23 -0
  88. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-base.md +24 -0
  89. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-lite-suffix.md +12 -0
  90. package/bundled/dev-pipeline-windows/templates/sections/phase-critic-plan-full.md +53 -0
  91. package/bundled/dev-pipeline-windows/templates/sections/phase-critic-plan.md +32 -0
  92. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-agent.md +37 -0
  93. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-full.md +50 -0
  94. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-lite.md +52 -0
  95. package/bundled/dev-pipeline-windows/templates/sections/phase-plan-agent.md +27 -0
  96. package/bundled/dev-pipeline-windows/templates/sections/phase-plan-lite.md +27 -0
  97. package/bundled/dev-pipeline-windows/templates/sections/phase-review-agent.md +27 -0
  98. package/bundled/dev-pipeline-windows/templates/sections/phase-review-full.md +29 -0
  99. package/bundled/dev-pipeline-windows/templates/sections/phase-specify-plan-full.md +77 -0
  100. package/bundled/dev-pipeline-windows/templates/sections/phase0-init.md +13 -0
  101. package/bundled/dev-pipeline-windows/templates/sections/phase0-test-baseline.md +23 -0
  102. package/bundled/dev-pipeline-windows/templates/sections/session-context.md +5 -0
  103. package/bundled/dev-pipeline-windows/templates/sections/subagent-timeout-recovery.md +6 -0
  104. package/bundled/dev-pipeline-windows/templates/sections/test-failure-recovery-agent.md +67 -0
  105. package/bundled/dev-pipeline-windows/templates/sections/test-failure-recovery-lite.md +58 -0
  106. package/bundled/dev-pipeline-windows/templates/session-status-schema.json +83 -0
  107. package/bundled/skills/_metadata.json +1 -1
  108. package/bundled/skills/app-planner/SKILL.md +26 -18
  109. package/bundled/skills/app-planner/references/architecture-decisions.md +9 -5
  110. package/bundled/skills/app-planner/references/frontend-design-guide.md +1 -1
  111. package/bundled/skills/feature-planner/SKILL.md +9 -2
  112. package/bundled/skills/prizmkit-init/SKILL.md +7 -6
  113. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +2 -0
  114. package/bundled/skills-windows/app-planner/SKILL.md +639 -0
  115. package/bundled/skills-windows/app-planner/assets/app-design-guide.md +101 -0
  116. package/bundled/skills-windows/app-planner/references/architecture-decisions.md +52 -0
  117. package/bundled/skills-windows/app-planner/references/brainstorm-guide.md +101 -0
  118. package/bundled/skills-windows/app-planner/references/frontend-design-guide.md +71 -0
  119. package/bundled/skills-windows/app-planner/references/project-brief-guide.md +82 -0
  120. package/bundled/skills-windows/app-planner/references/red-team-checklist.md +40 -0
  121. package/bundled/skills-windows/app-planner/references/rules/backend/derivation-rules.md +609 -0
  122. package/bundled/skills-windows/app-planner/references/rules/backend/fixed-rules.md +285 -0
  123. package/bundled/skills-windows/app-planner/references/rules/backend/question-bank.md +249 -0
  124. package/bundled/skills-windows/app-planner/references/rules/backend/template.md +173 -0
  125. package/bundled/skills-windows/app-planner/references/rules/database/derivation-rules.md +373 -0
  126. package/bundled/skills-windows/app-planner/references/rules/database/fixed-rules.md +211 -0
  127. package/bundled/skills-windows/app-planner/references/rules/database/question-bank.md +184 -0
  128. package/bundled/skills-windows/app-planner/references/rules/database/template.md +158 -0
  129. package/bundled/skills-windows/app-planner/references/rules/frontend/derivation-rules.md +810 -0
  130. package/bundled/skills-windows/app-planner/references/rules/frontend/fixed-rules.md +188 -0
  131. package/bundled/skills-windows/app-planner/references/rules/frontend/question-bank.md +302 -0
  132. package/bundled/skills-windows/app-planner/references/rules/frontend/template.md +320 -0
  133. package/bundled/skills-windows/app-planner/references/rules/mobile/derivation-rules.md +639 -0
  134. package/bundled/skills-windows/app-planner/references/rules/mobile/fixed-rules.md +290 -0
  135. package/bundled/skills-windows/app-planner/references/rules/mobile/question-bank.md +232 -0
  136. package/bundled/skills-windows/app-planner/references/rules/mobile/template.md +175 -0
  137. package/bundled/skills-windows/bug-fix-workflow/SKILL.md +415 -0
  138. package/bundled/skills-windows/bug-planner/SKILL.md +395 -0
  139. package/bundled/skills-windows/bug-planner/assets/bug-confirmation-template.md +43 -0
  140. package/bundled/skills-windows/bug-planner/references/critic-and-verification.md +44 -0
  141. package/bundled/skills-windows/bug-planner/references/error-recovery.md +73 -0
  142. package/bundled/skills-windows/bug-planner/references/input-formats.md +53 -0
  143. package/bundled/skills-windows/bug-planner/references/schema-validation.md +25 -0
  144. package/bundled/skills-windows/bug-planner/references/severity-rules.md +16 -0
  145. package/bundled/skills-windows/bug-planner/scripts/validate-bug-list.py +322 -0
  146. package/bundled/skills-windows/bugfix-pipeline-launcher/SKILL.md +380 -0
  147. package/bundled/skills-windows/feature-pipeline-launcher/SKILL.md +441 -0
  148. package/bundled/skills-windows/feature-pipeline-launcher/scripts/preflight-check.py +462 -0
  149. package/bundled/skills-windows/feature-planner/SKILL.md +401 -0
  150. package/bundled/skills-windows/feature-planner/assets/evaluation-guide.md +64 -0
  151. package/bundled/skills-windows/feature-planner/assets/planning-guide.md +214 -0
  152. package/bundled/skills-windows/feature-planner/references/browser-interaction.md +59 -0
  153. package/bundled/skills-windows/feature-planner/references/completeness-review.md +57 -0
  154. package/bundled/skills-windows/feature-planner/references/decomposition-patterns.md +75 -0
  155. package/bundled/skills-windows/feature-planner/references/error-recovery.md +90 -0
  156. package/bundled/skills-windows/feature-planner/references/incremental-feature-planning.md +112 -0
  157. package/bundled/skills-windows/feature-planner/references/new-project-planning.md +85 -0
  158. package/bundled/skills-windows/feature-planner/scripts/validate-and-generate.py +1029 -0
  159. package/bundled/skills-windows/feature-workflow/SKILL.md +531 -0
  160. package/bundled/skills-windows/prizmkit-init/SKILL.md +356 -0
  161. package/bundled/skills-windows/prizmkit-init/assets/project-brief-template.md +82 -0
  162. package/bundled/skills-windows/prizmkit-init/references/config-schema.md +68 -0
  163. package/bundled/skills-windows/prizmkit-init/references/rules/layer-detection.md +41 -0
  164. package/bundled/skills-windows/prizmkit-init/references/tech-stack-catalog.md +13 -0
  165. package/bundled/skills-windows/prizmkit-init/references/update-supplement.md +9 -0
  166. package/bundled/skills-windows/recovery-workflow/SKILL.md +456 -0
  167. package/bundled/skills-windows/recovery-workflow/evals/evals.json +46 -0
  168. package/bundled/skills-windows/recovery-workflow/scripts/detect-recovery-state.py +544 -0
  169. package/bundled/skills-windows/refactor-pipeline-launcher/SKILL.md +406 -0
  170. package/bundled/skills-windows/refactor-planner/SKILL.md +540 -0
  171. package/bundled/skills-windows/refactor-planner/assets/planning-guide.md +292 -0
  172. package/bundled/skills-windows/refactor-planner/references/behavior-preservation.md +301 -0
  173. package/bundled/skills-windows/refactor-planner/references/refactor-scoping-guide.md +221 -0
  174. package/bundled/skills-windows/refactor-planner/scripts/validate-and-generate-refactor.py +858 -0
  175. package/bundled/skills-windows/refactor-workflow/SKILL.md +503 -0
  176. package/package.json +3 -2
  177. package/src/clean.js +73 -2
  178. package/src/config.js +159 -50
  179. package/src/detect-platform.js +16 -8
  180. package/src/external-skills.js +26 -19
  181. package/src/index.js +31 -9
  182. package/src/manifest.js +6 -2
  183. package/src/metadata.js +43 -5
  184. package/src/platforms.js +36 -0
  185. package/src/prompts.js +31 -6
  186. package/src/runtimes.js +20 -0
  187. package/src/scaffold.js +314 -110
  188. package/src/upgrade.js +81 -41
@@ -0,0 +1,456 @@
1
+ ---
2
+ name: "recovery-workflow"
3
+ description: "Recover and resume interrupted interactive workflow sessions. Auto-detects which workflow (feature-workflow, bug-fix-workflow, refactor-workflow) was interrupted and what phase it reached by inspecting git branch names, characteristic artifacts, and pipeline state — then resumes from the breakpoint. Use this skill whenever an AI CLI session is interrupted mid-workflow, times out, or hits token limits. Trigger on: 'recover', 'resume', 'continue where I left off', 'session interrupted', 'session timed out', 'pick up where it left off', 'token limit exceeded', 'salvage partial work'."
4
+ ---
5
+
6
+ # Recovery Workflow
7
+
8
+ Auto-detect and resume interrupted interactive workflow sessions. When a user's AI CLI session is interrupted mid-workflow (timeout, token limit, crash, manual stop), this skill inspects the workspace to determine which workflow was running and what phase it reached, then continues from the breakpoint.
9
+
10
+ ## When to Use
11
+
12
+ User says:
13
+ - "Recover", "Resume", "Continue where I left off"
14
+ - "Session interrupted / timed out / token limit exceeded"
15
+ - "Pick up where it left off"
16
+ - "Don't want to restart from scratch"
17
+
18
+ **Do NOT use when:**
19
+ - Pipeline interrupted → use `reset-feature.ps1 <F-XXX> --clean --run` / `reset-bug.ps1 <B-XXX> --clean --run` for a fresh retry
20
+ - User wants a clean restart → use the original workflow skill directly (`/feature-workflow`, `/bug-fix-workflow`, `/refactor-workflow`)
21
+ - Nothing was ever started → use the original workflow skill
22
+
23
+ ## Pipeline Recovery (Recommended)
24
+
25
+ **IMPORTANT**: In Phase 1.3, you MUST present the user with a choice between pipeline recovery (`run-recovery.ps1`) and interactive recovery. **NEVER skip this choice. NEVER decide for the user.** The pipeline approach is recommended because it generates a comprehensive bootstrap prompt that explicitly lists every remaining phase with full instructions, ensuring the AI completes the full workflow — not just the implementation part.
26
+
27
+ Pipeline commands (for reference — Phase 1.3 will present these as a selectable option):
28
+
29
+ ```powershell
30
+ .\.prizmkit\dev-pipeline\run-recovery.ps1 # Auto-detect and recover
31
+ .\.prizmkit\dev-pipeline\run-recovery.ps1 detect # Detection report only
32
+ .\.prizmkit\dev-pipeline\run-recovery.ps1 run --dry-run # Generate prompt, don't execute
33
+ .\.prizmkit\dev-pipeline\run-recovery.ps1 run --yes # Skip confirmation
34
+ .\.prizmkit\dev-pipeline\run-recovery.ps1 run --model <model> # Override AI model
35
+ ```
36
+
37
+ ### When to use pipeline vs interactive recovery
38
+
39
+ | Scenario | Approach |
40
+ |----------|----------|
41
+ | Pipeline session timed out / crashed | `.\run-recovery.ps1` — autonomous, completes all phases reliably |
42
+ | Interactive session interrupted | This skill (`/recovery-workflow`) — for in-session interactive use |
43
+ | Want to inspect before recovering | `.\run-recovery.ps1 detect` or `.\run-recovery.ps1 run --dry-run` |
44
+ | Daemon/scripted use | `.\run-recovery.ps1 run --yes` — no user confirmation needed |
45
+
46
+ ## Supported Workflows
47
+
48
+ | Workflow | Branch Pattern | Key Artifacts |
49
+ |----------|---------------|---------------|
50
+ | bug-fix-workflow | `fix/<BUG_ID>-*` | `.prizmkit/bugfix/<BUG_ID>/fix-plan.md`, `fix-report.md` |
51
+ | feature-workflow | `feat/*` | `.prizmkit/plans/feature-list.json`, `.prizmkit/state/features/features/` |
52
+ | refactor-workflow | `refactor/*` | `.prizmkit/plans/refactor-list.json`, `.prizmkit/state/refactor/refactors/` |
53
+
54
+ ---
55
+
56
+ ## Overview
57
+
58
+ ```
59
+ recovery-workflow
60
+
61
+ ├── Phase 0: Auto-detect
62
+ │ ├── Read current branch name
63
+ │ ├── Scan characteristic artifacts
64
+ │ ├── Match workflow signature → determine workflow type
65
+ │ ├── Based on artifact presence → infer current phase
66
+ │ └── No match → reject and guide user
67
+
68
+ ├── Phase 1: Diagnose + report + user choice
69
+ │ ├── Check branch and working tree state
70
+ │ ├── Scan all pipelines for failed/in-progress tasks
71
+ │ ├── Find residual dev branches from failed tasks
72
+ │ ├── Display diagnosis + detection results
73
+ │ ├── If code changes exist → run test suite
74
+ │ ├── If multiple failed tasks → ask user which to recover
75
+ │ └── User chooses: run-recovery.ps1 (recommended) | interactive | start fresh
76
+
77
+ └── Phase 2: Execute remaining steps
78
+ ├── Read target workflow's SKILL.md
79
+ ├── Read existing artifacts to restore context
80
+ └── Execute from inferred phase through completion
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Phase 0: Auto-detect
86
+
87
+ **Goal**: Identify which workflow was interrupted and what phase it reached.
88
+
89
+ Run the detection script:
90
+
91
+ ```powershell
92
+ function Invoke-PrizmPython {
93
+ param([Parameter(ValueFromRemainingArguments = $true)][string[]]$Arguments)
94
+ $python = Get-Command python -ErrorAction SilentlyContinue
95
+ if ($python) {
96
+ & $python.Source -c 'import sys; raise SystemExit(0 if sys.version_info[0] == 3 else 1)' *> $null
97
+ if ($LASTEXITCODE -eq 0) {
98
+ & $python.Source @Arguments
99
+ return
100
+ }
101
+ }
102
+ $py = Get-Command py -ErrorAction SilentlyContinue
103
+ if ($py) {
104
+ & $py.Source -3 -c 'import sys; raise SystemExit(0 if sys.version_info[0] == 3 else 1)' *> $null
105
+ if ($LASTEXITCODE -eq 0) {
106
+ & $py.Source -3 @Arguments
107
+ return
108
+ }
109
+ }
110
+ throw "Python 3 is required. Install Python and ensure python or py is in PATH."
111
+ }
112
+ Invoke-PrizmPython ${SKILL_DIR}/scripts/detect-recovery-state.py
113
+ ```
114
+
115
+ The script uses **priority-ordered signature matching**:
116
+
117
+ ```
118
+ 1. Current branch matches fix/* → bug-fix-workflow
119
+ 2. .prizmkit/bugfix/ directory has content → bug-fix-workflow
120
+ 3. Current branch matches refactor/* → refactor-workflow
121
+ 4. .prizmkit/plans/refactor-list.json exists → refactor-workflow
122
+ 5. Current branch matches feat/* → feature-workflow
123
+ 6. .prizmkit/plans/feature-list.json exists → feature-workflow
124
+ 7. None of the above → no workflow detected
125
+ ```
126
+
127
+ Bug-fix-workflow has highest priority because it is purely interactive and benefits most from recovery (no pipeline retry fallback).
128
+
129
+ ### If no workflow detected
130
+
131
+ Show guidance and exit:
132
+
133
+ ```
134
+ No interrupted workflow detected in this workspace.
135
+
136
+ To start a new workflow:
137
+ • /feature-workflow — build features from idea to code
138
+ • /bug-fix-workflow — fix a specific bug interactively
139
+ • /refactor-workflow — behavior-preserving code restructuring
140
+ ```
141
+
142
+ **CHECKPOINT CP-REC-0**: Workflow type and phase identified.
143
+
144
+ ---
145
+
146
+ ## Phase 1: Diagnose + Report + User Confirmation
147
+
148
+ **Goal**: Assess workspace health, identify failed tasks across all pipelines, and present recovery options.
149
+
150
+ ### 1.0 Workspace & Failure Diagnosis
151
+
152
+ Before showing the recovery report, run a comprehensive diagnosis:
153
+
154
+ 1. **Check current branch and working tree**:
155
+ ```powershell
156
+ git branch --show-current
157
+ git status --porcelain | Select-Object -First 10
158
+ ```
159
+ Report: which branch is active, whether there are uncommitted changes.
160
+
161
+ 2. **Scan all pipelines for failed/in-progress tasks**:
162
+ ```powershell
163
+ # Feature pipeline
164
+ Invoke-PrizmPython .prizmkit/dev-pipeline/scripts/update-feature-status.py `
165
+ --feature-list .prizmkit/plans/feature-list.json `
166
+ --state-dir .prizmkit/state/features `
167
+ --action status
168
+
169
+ # Bugfix pipeline
170
+ Invoke-PrizmPython .prizmkit/dev-pipeline/scripts/update-bug-status.py `
171
+ --bug-list .prizmkit/plans/bug-fix-list.json `
172
+ --state-dir .prizmkit/state/bugfix `
173
+ --action status
174
+
175
+ # Refactor pipeline
176
+ Invoke-PrizmPython .prizmkit/dev-pipeline/scripts/update-refactor-status.py `
177
+ --refactor-list .prizmkit/plans/refactor-list.json `
178
+ --state-dir .prizmkit/state/refactor `
179
+ --action status
180
+ ```
181
+ For each pipeline that has state, extract: total tasks, completed, failed, in-progress, pending.
182
+
183
+ 3. **Find residual dev branches** from failed/interrupted tasks:
184
+ ```powershell
185
+ git branch --list 'dev/*' 'feat/*' 'fix/*' 'bugfix/*' 'refactor/*'
186
+ ```
187
+ Cross-reference with failed task IDs to identify which branches belong to which failed tasks.
188
+
189
+ 4. **Present diagnosis summary** — show all findings before the recovery report:
190
+ ```
191
+ ═══════════════════════════════════════════════════
192
+ Workspace Diagnosis
193
+ ═══════════════════════════════════════════════════
194
+
195
+ Branch: fix/B-001-login-crash
196
+ Working tree: 3 uncommitted changes
197
+
198
+ Feature pipeline: 2 completed, 1 failed (F-003), 2 pending
199
+ Bugfix pipeline: 1 completed, 1 failed (B-002), 0 pending
200
+ Refactor pipeline: (no state found)
201
+
202
+ Residual branches:
203
+ dev/F-003-payment-integration-202604201030
204
+ fix/B-002-encoding-bug
205
+
206
+ Failed tasks:
207
+ F-003: Payment integration [FAILED] → branch: dev/F-003-...
208
+ B-002: CSV encoding bug [FAILED] → branch: fix/B-002-...
209
+ ═══════════════════════════════════════════════════
210
+ ```
211
+
212
+ If no pipelines have state and no failed tasks are found, skip to 1.1 (standard recovery report).
213
+
214
+ ### 1.1 Display Detection Report
215
+
216
+ Read the script output and present a formatted summary:
217
+
218
+ ```
219
+ ═══════════════════════════════════════════════════
220
+ Recovery Report
221
+ ═══════════════════════════════════════════════════
222
+
223
+ Workflow: bug-fix-workflow
224
+ Branch: fix/B-001-login-crash
225
+ Phase: 5 — Review
226
+
227
+ Artifacts Found:
228
+ ✓ fix-plan.md (fix approach documented)
229
+ ✗ fix-report.md (not yet created)
230
+ ✓ Code changes (4 files — 3 modified, 1 new)
231
+ ✓ Test files (1 touched)
232
+
233
+ Reason: fix-plan.md exists + code changes present
234
+ Remaining: code review → user verification → commit & merge
235
+ ═══════════════════════════════════════════════════
236
+ ```
237
+
238
+ ### 1.2 Run Tests (if code changes exist)
239
+
240
+ If the detection report shows code changes (`code.has_changes == true`), run the project's test suite:
241
+
242
+ ```powershell
243
+ # detect test command from package.json or .prizmkit/config.json
244
+ npm test # or the appropriate test command
245
+ ```
246
+
247
+ Include test results in the report:
248
+ - How many tests pass/fail
249
+ - If failures exist — which tests and why
250
+
251
+ ### 1.3 Select Recovery Target (if multiple failed tasks)
252
+
253
+ If the diagnosis in 1.0 found **multiple failed/interrupted tasks** across pipelines, ask the user which one to recover first before proceeding:
254
+
255
+ ```
256
+ AskUserQuestion:
257
+ question: "Multiple failed/interrupted tasks found. Which would you like to recover?"
258
+ header: "Target"
259
+ options:
260
+ - label: "F-003: Payment integration"
261
+ description: "Feature pipeline — FAILED — branch: dev/F-003-payment-integration-202604201030"
262
+ - label: "B-002: CSV encoding bug"
263
+ description: "Bugfix pipeline — FAILED — branch: fix/B-002-encoding-bug"
264
+ - label: "Recover all sequentially"
265
+ description: "Recover each failed task one by one in priority order"
266
+ ```
267
+
268
+ Generate the options dynamically from the diagnosis results. Include task ID, title, pipeline type, status, and branch name.
269
+
270
+ If only one failed/interrupted task is found, skip this step — proceed directly to 1.4 with that task as the recovery target.
271
+
272
+ ### 1.4 Ask User to Choose Recovery Approach
273
+
274
+ **User choice required (mandatory)** — Use `AskUserQuestion` to present interactive selectable options. **NEVER skip this step. NEVER choose for the user.**
275
+
276
+ ```
277
+ AskUserQuestion:
278
+ question: "Interrupted {workflow_type} detected at Phase {N} ({phase_name}). How would you like to recover?"
279
+ header: "Recovery"
280
+ options:
281
+ - label: "Run recovery script (Recommended)"
282
+ description: "Execute .\.prizmkit\dev-pipeline\run-recovery.ps1 — autonomously completes ALL remaining phases (review, commit, merge, etc.) via a dedicated AI session with explicit phase instructions"
283
+ - label: "Copy command and run manually"
284
+ description: "I'll give you the exact shell command to paste into your terminal — you run it yourself outside this session"
285
+ - label: "Resume interactively in this session"
286
+ description: "Continue from Phase {N} within this conversation — more control, but may not complete all phases if session is interrupted again"
287
+ - label: "Start fresh"
288
+ description: "Discard interrupted work and restart the original workflow from scratch"
289
+ ```
290
+
291
+ **If "Run recovery script"** → Execute the pipeline recovery:
292
+ ```powershell
293
+ .\.prizmkit\dev-pipeline\run-recovery.ps1
294
+ ```
295
+ The script handles everything: detection, confirmation, prompt generation, session spawn, and post-session validation. **End this skill after launching the script** — do not proceed to Phase 2.
296
+
297
+ **If "Copy command and run manually"** → Output the command for the user to copy and run in their own terminal:
298
+ ```
299
+ To recover, run this command in your project root:
300
+
301
+ .\.prizmkit\dev-pipeline\run-recovery.ps1
302
+
303
+ Or with options:
304
+ .\.prizmkit\dev-pipeline\run-recovery.ps1 run --dry-run # Preview the recovery prompt first
305
+ .\.prizmkit\dev-pipeline\run-recovery.ps1 run --yes # Skip confirmation
306
+ .\.prizmkit\dev-pipeline\run-recovery.ps1 run --model <model> # Specify AI model
307
+ ```
308
+ **End this skill** — do not proceed to Phase 2. The user will run the command themselves.
309
+
310
+ **If "Resume interactively"** → Continue to Phase 2 below (execute remaining steps in this session).
311
+
312
+ **If "Start fresh"** → Suggest the appropriate original workflow skill:
313
+ - bug-fix-workflow → `/bug-fix-workflow`
314
+ - feature-workflow → `/feature-workflow`
315
+ - refactor-workflow → `/refactor-workflow`
316
+ End this skill.
317
+
318
+ **NEVER proceed to Phase 2 without explicit user selection via `AskUserQuestion`. Do NOT render options as plain text — the user must be able to click/select.**
319
+
320
+ **CHECKPOINT CP-REC-1**: User chose recovery target and approach.
321
+
322
+ ---
323
+
324
+ ## Phase 2: Execute Remaining Steps
325
+
326
+ **Goal**: Read the target workflow's SKILL.md and execute from the inferred phase.
327
+
328
+ ### 2.0 Read Target Workflow
329
+
330
+ 1. **Read the workflow's installed skill file** for `{workflow-type}`:
331
+ - Codex: `.agents/skills/{workflow-type}/SKILL.md`
332
+ - Claude: `.claude/commands/{workflow-type}.md`
333
+ - CodeBuddy: `.codebuddy/skills/{workflow-type}/SKILL.md`
334
+ 2. **Read existing artifacts** to restore context — check in this order for the most efficient recovery:
335
+ - If `context-snapshot.md` exists in the artifact directory → read it first. It provides a snapshot of completed tasks, key decisions, and remaining work from the interrupted session.
336
+ - If `session-summary.md` exists → read it for a lightweight summary of the previous session.
337
+ - Then read remaining artifacts: spec.md, plan.md, review-report.md, code diffs, bug descriptions, etc.
338
+ 3. **Read relevant `.prizmkit/prizm-docs/`** — load project context (L0 root, relevant L1/L2 for affected modules).
339
+
340
+ This step replaces the context that was lost when the AI session was interrupted.
341
+
342
+ ---
343
+
344
+ ### 2.1 Bug-Fix-Workflow Recovery
345
+
346
+ Phase inference table:
347
+
348
+ | Detected State | Resume From | Actions |
349
+ |---------------|------------|---------|
350
+ | On `fix/<BUG_ID>-*` branch, no artifacts | Phase 1: Deep Bug Diagnosis | Read bug description from `.prizmkit/plans/bug-fix-list.json`. Start interactive diagnosis Q&A |
351
+ | `fix-plan.md` exists, no code changes | Phase 4: Fix | Read fix-plan.md. Implement the fix following the plan |
352
+ | `fix-plan.md` + code changes exist | Phase 5: Review | Invoke `/prizmkit-code-review` on all changes |
353
+ | All docs + review passed | Phase 6: User Verification | Ask user to verify the fix works |
354
+ | All docs + committed | Phase 7: Merge Decision | Ask merge vs keep branch |
355
+
356
+ **Note**: Bug-fix Phases 1-3 (Diagnosis, Triage, Reproduce) collapse to Phase 1 for detection purposes because these phases don't produce persistent artifacts. If interrupted during these phases, recovery restarts from Phase 1 (diagnosis), which re-derives understanding from available inputs (bug description, code) without interactive Q&A.
357
+
358
+ **Execution for each remaining phase**: Follow the bug-fix-workflow SKILL.md instructions exactly. Call the same prizmkit sub-commands (`/prizmkit-code-review`, `/prizmkit-committer`) at the same points.
359
+
360
+ **Special handling**:
361
+ - If resuming from Phase 5 (Review) and tests are failing, fix test failures first (max 3 attempts). If unfixable, ask user whether to continue or restart.
362
+ - If resuming from Phase 4 (Fix), read fix-plan.md to understand the planned approach before writing code.
363
+
364
+ ---
365
+
366
+ ### 2.2 Feature-Workflow Recovery
367
+
368
+ Phase inference table:
369
+
370
+ | Detected State | Resume From | Actions |
371
+ |---------------|------------|---------|
372
+ | No `.prizmkit/plans/feature-list.json` | Phase 1: Brainstorm | Cannot recover conversation context. Start requirement clarification, but leverage any workspace content (README, existing code) for context |
373
+ | `.prizmkit/plans/feature-list.json` exists, no pipeline state | Phase 3: Launch | Invoke `feature-pipeline-launcher` to start the pipeline |
374
+ | `.prizmkit/plans/feature-list.json` + pipeline state exists | Phase 4: Monitor | Check pipeline status via `feature-pipeline-launcher` (Intent B: Check Status) |
375
+
376
+ **Note**: Feature-workflow recovery is simpler because Phases 3-4 are pipeline-driven. The main recovery value is avoiding re-brainstorming (Phase 1) when `.prizmkit/plans/feature-list.json` already exists.
377
+
378
+ ---
379
+
380
+ ### 2.3 Refactor-Workflow Recovery
381
+
382
+ Phase inference table (mirrors feature-workflow):
383
+
384
+ | Detected State | Resume From | Actions |
385
+ |---------------|------------|---------|
386
+ | No `.prizmkit/plans/refactor-list.json` | Phase 1: Brainstorm | Start refactoring goal clarification |
387
+ | `.prizmkit/plans/refactor-list.json` exists, no pipeline state | Phase 3: Launch | Invoke `refactor-pipeline-launcher` to start the pipeline |
388
+ | `.prizmkit/plans/refactor-list.json` + pipeline state exists | Phase 4: Monitor | Check pipeline status |
389
+
390
+ ---
391
+
392
+ ### 2.4 Post-Recovery Report
393
+
394
+ After all remaining phases complete, output a summary:
395
+
396
+ ```
397
+ Recovery complete.
398
+
399
+ Workflow: bug-fix-workflow
400
+ Recovered from: Phase 5 (Review)
401
+ Completed: code review → user verification → commit & merge
402
+ Preserved: fix-plan.md, 4 code files, 1 test file
403
+
404
+ Next steps:
405
+ • Check for other interrupted workflows
406
+ • Or start a new workflow
407
+ ```
408
+
409
+ **CHECKPOINT CP-REC-2**: Workflow recovered and completed.
410
+
411
+ ---
412
+
413
+ ## Error Handling
414
+
415
+ | Scenario | Action |
416
+ |----------|--------|
417
+ | No workflow signature matches | Show guidance message, suggest original workflow skills |
418
+ | Branch exists but artifacts are inconsistent | Trust git as ground truth, report discrepancy in detection report |
419
+ | Test failures in existing code | Report in detection summary; user decides whether to continue |
420
+ | Multiple workflows could match (e.g., on main but both .prizmkit/plans/feature-list.json and bug-fix artifacts exist) | Pick highest priority (bug-fix > refactor > feature), mention others in report |
421
+ | Detection script fails | Fall back to manual detection (run individual git/file checks in PowerShell) |
422
+ | Bug ID not found in .prizmkit/plans/bug-fix-list.json | Continue with branch-only context; note that full bug description is unavailable |
423
+
424
+ ---
425
+
426
+ ## Relationship to Other Skills
427
+
428
+ | Skill | Relationship |
429
+ |-------|-------------|
430
+ | `feature-workflow` | **Recovery target** — this skill can resume interrupted feature-workflow sessions |
431
+ | `bug-fix-workflow` | **Recovery target** — this skill can resume interrupted bug-fix-workflow sessions |
432
+ | `refactor-workflow` | **Recovery target** — this skill can resume interrupted refactor-workflow sessions |
433
+ | `feature-pipeline-launcher` | **Called in Phase 2.2** — launches or checks pipeline status for feature recovery |
434
+ | `reset-feature.ps1 <F-XXX> --clean --run` | **Alternative** — clean retry for one feature; this skill is the smart interactive alternative |
435
+ | `reset-bug.ps1 <B-XXX> --clean --run` | **Alternative** — clean retry for one bugfix item |
436
+ | `run-recovery.ps1` | **Pipeline counterpart** — shell-driven recovery that generates bootstrap prompt and spawns AI CLI session for autonomous completion |
437
+ | `/prizmkit-code-review` | **Called in Phase 2.1** — reviews recovered bug-fix code |
438
+ | `/prizmkit-committer` | **Called in Phase 2.1** — commits the recovered result |
439
+
440
+ ---
441
+
442
+ ## Comparison with Previous Version
443
+
444
+ | Dimension | Previous | Current |
445
+ |-----------|----------|---------|
446
+ | Scope | Feature pipeline only | All 3 interactive workflows |
447
+ | Input | Required `F-XXX` feature ID | No input — fully auto-detect |
448
+ | Detection | Feature-specific (spec/plan/git) | Signature-based (branch + artifacts) |
449
+ | Strategy | Multi-option (5 scenarios × 2-4 options each) | Single path: report → confirm → execute |
450
+ | Intrusion | None | None (zero changes to target workflows) |
451
+
452
+ ## Output
453
+
454
+ - Resumed and completed workflow from the breakpoint
455
+ - Same outputs as the original workflow would produce (commits, artifacts, state updates)
456
+ - Recovery summary showing what was preserved vs what was re-done
@@ -0,0 +1,46 @@
1
+ {
2
+ "skill_name": "recovery-workflow",
3
+ "notes": "These test cases require workspace state setup. Each has a setup_description that creates the necessary mock state before the skill is invoked. Due to the interactive nature and state-dependency of this skill, automated evaluation is limited — qualitative review is primary.",
4
+ "evals": [
5
+ {
6
+ "id": 1,
7
+ "name": "bugfix-mid-fix",
8
+ "prompt": "session 断了,帮我恢复一下",
9
+ "expected_output": "Should auto-detect bug-fix-workflow from fix/B-001-* branch. Should detect fix-plan.md + code changes → infer Phase 5 (Review). Should display recovery report with workflow type, phase, artifacts, code stats. After user confirms, should invoke /prizmkit-code-review on existing changes.",
10
+ "setup_description": "Create fix/B-001-login-crash branch, .prizmkit/bugfix/B-001/fix-plan.md, modify 3 source files + 1 test file. No fix-report.md, no commits ahead of main.",
11
+ "files": []
12
+ },
13
+ {
14
+ "id": 2,
15
+ "name": "bugfix-plan-only",
16
+ "prompt": "继续之前的工作",
17
+ "expected_output": "Should auto-detect bug-fix-workflow from fix/B-002-* branch. Should detect fix-plan.md but no code changes → infer Phase 4 (Fix). Should read fix-plan.md and start implementing the fix.",
18
+ "setup_description": "Create fix/B-002-null-pointer branch, .prizmkit/bugfix/B-002/fix-plan.md with diagnosis and fix approach. No code changes.",
19
+ "files": []
20
+ },
21
+ {
22
+ "id": 3,
23
+ "name": "feature-list-exists",
24
+ "prompt": "resume",
25
+ "expected_output": "Should auto-detect feature-workflow from .prizmkit/plans/feature-list.json. Should detect .prizmkit/plans/feature-list.json exists but no pipeline state → infer Phase 3 (Launch). Should invoke feature-pipeline-launcher to start the pipeline.",
26
+ "setup_description": "On main branch, create .prizmkit/plans/feature-list.json with 3 features. No .prizmkit/state/features/features/ directory.",
27
+ "files": []
28
+ },
29
+ {
30
+ "id": 4,
31
+ "name": "refactor-monitoring",
32
+ "prompt": "pick up where it left off",
33
+ "expected_output": "Should auto-detect refactor-workflow from .prizmkit/plans/refactor-list.json + pipeline state. Should infer Phase 4 (Monitor). Should check pipeline status and report results.",
34
+ "setup_description": "On main branch, create .prizmkit/plans/refactor-list.json with 2 items. Create .prizmkit/state/refactor/refactors/ with status files showing 1 completed, 1 in-progress.",
35
+ "files": []
36
+ },
37
+ {
38
+ "id": 5,
39
+ "name": "no-workflow-detected",
40
+ "prompt": "恢复",
41
+ "expected_output": "Should detect no workflow signatures in workspace. Should display guidance message suggesting /feature-workflow, /bug-fix-workflow, or /refactor-workflow. Should NOT attempt any recovery actions.",
42
+ "setup_description": "Clean workspace on main branch. No .prizmkit/plans/feature-list.json, no bug-fix artifacts, no .prizmkit/plans/refactor-list.json, no fix/* or feat/* or refactor/* branches.",
43
+ "files": []
44
+ }
45
+ ]
46
+ }