prizmkit 1.1.1 → 1.1.4

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 (119) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/claude/agent-adapter.js +18 -0
  3. package/bundled/adapters/claude/command-adapter.js +1 -27
  4. package/bundled/agents/prizm-dev-team-critic.md +2 -0
  5. package/bundled/agents/prizm-dev-team-dev.md +2 -0
  6. package/bundled/agents/prizm-dev-team-reviewer.md +2 -0
  7. package/bundled/dev-pipeline/README.md +63 -63
  8. package/bundled/dev-pipeline/assets/feature-list-example.json +1 -1
  9. package/bundled/dev-pipeline/assets/prizm-dev-team-integration.md +1 -1
  10. package/bundled/dev-pipeline/{launch-daemon.sh → launch-feature-daemon.sh} +33 -33
  11. package/bundled/dev-pipeline/launch-refactor-daemon.sh +454 -0
  12. package/bundled/dev-pipeline/lib/branch.sh +1 -1
  13. package/bundled/dev-pipeline/reset-feature.sh +3 -3
  14. package/bundled/dev-pipeline/reset-refactor.sh +312 -0
  15. package/bundled/dev-pipeline/{retry-bug.sh → retry-bugfix.sh} +47 -59
  16. package/bundled/dev-pipeline/retry-feature.sh +41 -54
  17. package/bundled/dev-pipeline/retry-refactor.sh +358 -0
  18. package/bundled/dev-pipeline/run-bugfix.sh +41 -0
  19. package/bundled/dev-pipeline/{run.sh → run-feature.sh} +64 -31
  20. package/bundled/dev-pipeline/run-refactor.sh +787 -0
  21. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +398 -10
  22. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +124 -0
  23. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +419 -0
  24. package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +393 -0
  25. package/bundled/dev-pipeline/scripts/update-refactor-status.py +726 -0
  26. package/bundled/dev-pipeline/templates/agent-prompts/critic-code-challenge.md +13 -0
  27. package/bundled/dev-pipeline/templates/agent-prompts/critic-plan-challenge.md +7 -0
  28. package/bundled/dev-pipeline/templates/agent-prompts/dev-fix.md +7 -0
  29. package/bundled/dev-pipeline/templates/agent-prompts/dev-implement.md +27 -0
  30. package/bundled/dev-pipeline/templates/agent-prompts/dev-resume.md +5 -0
  31. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-analyze.md +5 -0
  32. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-review.md +12 -0
  33. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +33 -2
  34. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +13 -9
  35. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +16 -12
  36. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +22 -4
  37. package/bundled/dev-pipeline/templates/feature-list-schema.json +1 -1
  38. package/bundled/dev-pipeline/templates/refactor-list-schema.json +159 -0
  39. package/bundled/dev-pipeline/templates/sections/ac-verification-checklist.md +13 -0
  40. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +36 -0
  41. package/bundled/dev-pipeline/templates/sections/failure-log-check.md +2 -1
  42. package/bundled/dev-pipeline/templates/sections/feature-context.md +1 -1
  43. package/bundled/dev-pipeline/templates/sections/phase-analyze-agent.md +11 -7
  44. package/bundled/dev-pipeline/templates/sections/phase-analyze-full.md +11 -7
  45. package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +5 -1
  46. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +3 -0
  47. package/bundled/dev-pipeline/templates/sections/phase-commit.md +3 -0
  48. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +3 -0
  49. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-lite-suffix.md +3 -0
  50. package/bundled/dev-pipeline/templates/sections/phase-critic-code.md +11 -10
  51. package/bundled/dev-pipeline/templates/sections/phase-critic-plan-full.md +12 -10
  52. package/bundled/dev-pipeline/templates/sections/phase-critic-plan.md +11 -9
  53. package/bundled/dev-pipeline/templates/sections/phase-deploy-verification.md +3 -0
  54. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +10 -10
  55. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +12 -16
  56. package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +3 -0
  57. package/bundled/dev-pipeline/templates/sections/phase-plan-agent.md +3 -0
  58. package/bundled/dev-pipeline/templates/sections/phase-plan-lite.md +3 -0
  59. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +11 -13
  60. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +12 -20
  61. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +3 -0
  62. package/bundled/dev-pipeline/templates/sections/phase0-init.md +3 -0
  63. package/bundled/dev-pipeline/templates/sections/phase0-test-baseline.md +3 -0
  64. package/bundled/dev-pipeline/templates/sections/resume-header.md +4 -1
  65. package/bundled/dev-pipeline/templates/sections/test-failure-recovery.md +75 -0
  66. package/bundled/rules/prizm/prizm-commit-workflow.md +1 -0
  67. package/bundled/rules/prizm/prizm-documentation.md +15 -15
  68. package/bundled/rules/prizm/prizm-progressive-loading.md +2 -1
  69. package/bundled/skills/_metadata.json +33 -6
  70. package/bundled/skills/app-planner/SKILL.md +105 -320
  71. package/bundled/skills/app-planner/assets/app-design-guide.md +101 -0
  72. package/bundled/skills/app-planner/references/frontend-design-guide.md +1 -1
  73. package/bundled/skills/app-planner/references/project-brief-guide.md +49 -80
  74. package/bundled/skills/bug-fix-workflow/SKILL.md +2 -2
  75. package/bundled/skills/bug-planner/SKILL.md +68 -5
  76. package/bundled/skills/bug-planner/scripts/validate-bug-list.py +3 -2
  77. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +19 -5
  78. package/bundled/skills/{dev-pipeline-launcher → feature-pipeline-launcher}/SKILL.md +32 -32
  79. package/bundled/skills/feature-planner/SKILL.md +337 -0
  80. package/bundled/skills/{app-planner → feature-planner}/assets/evaluation-guide.md +4 -4
  81. package/bundled/skills/{app-planner → feature-planner}/assets/planning-guide.md +3 -171
  82. package/bundled/skills/{app-planner → feature-planner}/references/browser-interaction.md +6 -5
  83. package/bundled/skills/feature-planner/references/decomposition-patterns.md +75 -0
  84. package/bundled/skills/{app-planner → feature-planner}/references/error-recovery.md +8 -8
  85. package/bundled/skills/{app-planner → feature-planner}/references/incremental-feature-planning.md +1 -1
  86. package/bundled/skills/{app-planner/references/new-app-planning.md → feature-planner/references/new-project-planning.md} +1 -1
  87. package/bundled/skills/{app-planner → feature-planner}/scripts/validate-and-generate.py +4 -4
  88. package/bundled/skills/feature-workflow/SKILL.md +23 -23
  89. package/bundled/skills/prizm-kit/SKILL.md +1 -3
  90. package/bundled/skills/prizm-kit/assets/project-memory-template.md +4 -2
  91. package/bundled/skills/prizmkit-analyze/SKILL.md +2 -5
  92. package/bundled/skills/prizmkit-code-review/SKILL.md +2 -2
  93. package/bundled/skills/prizmkit-committer/SKILL.md +32 -8
  94. package/bundled/skills/prizmkit-deploy/SKILL.md +1 -5
  95. package/bundled/skills/prizmkit-implement/SKILL.md +5 -51
  96. package/bundled/skills/prizmkit-init/SKILL.md +7 -78
  97. package/bundled/skills/prizmkit-plan/SKILL.md +1 -12
  98. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +13 -28
  99. package/bundled/skills/prizmkit-prizm-docs/assets/PRIZM-SPEC.md +52 -1
  100. package/bundled/skills/prizmkit-retrospective/SKILL.md +12 -117
  101. package/bundled/skills/recovery-workflow/SKILL.md +168 -316
  102. package/bundled/skills/recovery-workflow/evals/evals.json +29 -13
  103. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +232 -274
  104. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +352 -0
  105. package/bundled/skills/refactor-planner/SKILL.md +436 -0
  106. package/bundled/skills/refactor-planner/assets/planning-guide.md +292 -0
  107. package/bundled/skills/refactor-planner/references/behavior-preservation.md +301 -0
  108. package/bundled/skills/refactor-planner/references/refactor-scoping-guide.md +221 -0
  109. package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +786 -0
  110. package/bundled/skills/refactor-workflow/SKILL.md +299 -319
  111. package/bundled/team/prizm-dev-team.json +1 -1
  112. package/package.json +1 -1
  113. package/src/clean.js +3 -3
  114. package/src/scaffold.js +6 -6
  115. package/bundled/skills/prizmkit-plan/assets/spec-template.md +0 -56
  116. package/bundled/skills/prizmkit-plan/references/clarify-guide.md +0 -67
  117. package/src/config.js +0 -504
  118. package/src/prompts.js +0 -210
  119. /package/bundled/skills/{dev-pipeline-launcher → feature-pipeline-launcher}/scripts/preflight-check.py +0 -0
@@ -1,378 +1,237 @@
1
1
  ---
2
2
  name: "recovery-workflow"
3
- description: "Recover and resume interrupted feature pipeline sessions. Detects partial work (code changes, spec/plan artifacts, branch state, test results) from failed or interrupted sessions and intelligently resumes from the correct phaseinstead of discarding everything and restarting from scratch. Use this skill whenever a pipeline session fails mid-execution, times out, gets interrupted, or when the user wants to salvage partial work from a failed feature. Trigger on: 'recover feature', 'resume session', 'continue from where it stopped', 'salvage partial work', 'fix failed feature', 'session interrupted', 'recover F-XXX', 'resume F-XXX', 'continue F-XXX', 'feature stuck', 'pick up where it left off', 'session timed out', 'don't want to restart from scratch', 'token limit exceeded'. (project)"
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 statethen 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'. (project)"
4
4
  ---
5
5
 
6
6
  # Recovery Workflow
7
7
 
8
- Intelligently recover and resume interrupted feature pipeline sessions. Instead of discarding partial work and restarting from scratch (which wastes tokens and time), this skill inspects the actual filesystem state code changes, artifacts, git branches, test results and continues from the right point.
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
9
 
10
10
  ## When to Use
11
11
 
12
12
  User says:
13
- - "Recover F-007", "Resume F-007", "Continue F-007 from where it stopped"
14
- - "Feature session failed/timed out, salvage the work"
15
- - "Pipeline interrupted, don't want to restart from scratch"
16
- - "F-003 is stuck, pick up where it left off"
17
- - "Session timed out but there's code already written"
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"
18
17
 
19
18
  **Do NOT use when:**
20
- - User wants a clean retry from scratch → `retry-feature.sh` or `reset-feature.sh --clean --run`
21
- - Pipeline is still running normally`dev-pipeline-launcher` (Intent B: Check Status)
22
- - User wants to fix a specific bug `bug-fix-workflow`
23
- - Feature never started (no state at all) → `dev-pipeline-launcher` (Intent E: Retry)
19
+ - Pipeline interrupted use `retry-feature.sh` / `retry-bugfix.sh`
20
+ - User wants a clean restartuse the original workflow skill directly (`/feature-workflow`, `/bug-fix-workflow`, `/refactor-workflow`)
21
+ - Nothing was ever started use the original workflow skill
24
22
 
25
- ## Why This Skill Exists
23
+ ## Supported Workflows
26
24
 
27
- Current retry tools have a fundamental limitation:
28
-
29
- | Tool | What it does | What's lost |
30
- |------|-------------|-------------|
31
- | `retry-feature.sh` | Cleans all artifacts, resets status, spawns fresh session | All code changes, spec, plan — everything |
32
- | `reset-feature.sh --clean --run` | Even more thorough clean + retry | Same, plus session history |
33
- | `run.sh --resume-phase N` | Tells new session "start from phase N" via prompt | Better, but doesn't inspect actual worktree state — the new AI session has no memory of what was done |
34
-
35
- The gap: when a session is interrupted mid-implementation, the **worktree already has real code changes** — possibly a spec, plan, partial or complete implementation, even passing tests. Discarding all of this wastes significant tokens and time. This skill bridges that gap by inspecting the actual filesystem state and resuming intelligently within the current interactive session.
25
+ | Workflow | Branch Pattern | Key Artifacts |
26
+ |----------|---------------|---------------|
27
+ | bug-fix-workflow | `fix/<BUG_ID>-*` | `.prizmkit/bugfix/<BUG_ID>/fix-plan.md`, `fix-report.md` |
28
+ | feature-workflow | `feat/*` | `feature-list.json`, `dev-pipeline/state/features/` |
29
+ | refactor-workflow | `refactor/*` | `refactor-list.json`, `dev-pipeline/state/refactors/` |
36
30
 
37
31
  ---
38
32
 
39
33
  ## Overview
40
34
 
41
35
  ```
42
- recovery-workflow <feature-id>
43
-
44
- ├── Phase 0: Identify feature and gather context
45
-
46
- ├── Phase 1: Detect state (artifacts, code, tests, branch)
47
-
48
- ├── Phase 2: Diagnose and present recovery options
49
-
50
- └── Phase 3: Execute recovery (chain remaining prizmkit skills)
36
+ recovery-workflow
37
+
38
+ ├── Phase 0: Auto-detect
39
+ ├── Read current branch name
40
+ ├── Scan characteristic artifacts
41
+ ├── Match workflow signature → determine workflow type
42
+ ├── Based on artifact presence infer current phase
43
+ └── No match → reject and guide user
44
+
45
+ ├── Phase 1: Report + user confirmation
46
+ │ ├── Display detection results
47
+ │ ├── If code changes exist → run test suite
48
+ │ └── User confirms "continue" → proceed
49
+
50
+ └── Phase 2: Execute remaining steps
51
+ ├── Read target workflow's SKILL.md
52
+ ├── Read existing artifacts to restore context
53
+ └── Execute from inferred phase through completion
51
54
  ```
52
55
 
53
- ## Input
56
+ ---
54
57
 
55
- | Input | Required | Example |
56
- |-------|----------|---------|
57
- | Feature ID | Yes | `F-007` |
58
- | Feature list path | No (default: `feature-list.json`) | `my-features.json` |
58
+ ## Phase 0: Auto-detect
59
59
 
60
- ---
60
+ **Goal**: Identify which workflow was interrupted and what phase it reached.
61
+
62
+ Run the detection script:
61
63
 
62
- ## Phase 0: Feature Identification
63
-
64
- **Goal**: Locate the feature and its context.
65
-
66
- 1. **Parse feature ID** from user input (e.g., "recover F-007", "resume F-007")
67
- 2. **Read feature-list.json** to get feature metadata:
68
- ```bash
69
- python3 -c "
70
- import json, re
71
- with open('feature-list.json') as f:
72
- data = json.load(f)
73
- for feat in data.get('features', []):
74
- if feat.get('id') == 'F-007':
75
- print(json.dumps(feat, indent=2))
76
- "
77
- ```
78
- 3. **Compute feature slug** (same algorithm the pipeline uses):
79
- ```python
80
- # F-007 + "User Authentication" → "007-user-authentication"
81
- numeric = feature_id.replace('F-', '').zfill(3)
82
- slug = re.sub(r'[^a-z0-9\s-]', '', title.lower())
83
- slug = re.sub(r'[\s]+', '-', slug.strip()).strip('-')
84
- slug = f"{numeric}-{slug}"
85
- ```
86
-
87
- If the feature is not found, ask the user for the correct ID or file path.
64
+ ```bash
65
+ python3 ${SKILL_DIR}/scripts/detect-recovery-state.py
66
+ ```
88
67
 
89
- ---
68
+ The script uses **priority-ordered signature matching**:
69
+
70
+ ```
71
+ 1. Current branch matches fix/* → bug-fix-workflow
72
+ 2. .prizmkit/bugfix/ directory has content → bug-fix-workflow
73
+ 3. Current branch matches refactor/* → refactor-workflow
74
+ 4. refactor-list.json exists → refactor-workflow
75
+ 5. Current branch matches feat/* → feature-workflow
76
+ 6. feature-list.json exists → feature-workflow
77
+ 7. None of the above → no workflow detected
78
+ ```
90
79
 
91
- ## Phase 1: State Detection
80
+ Bug-fix-workflow has highest priority because it is purely interactive and benefits most from recovery (no pipeline retry fallback).
92
81
 
93
- **Goal**: Build a complete picture of what exists from the interrupted session.
82
+ ### If no workflow detected
94
83
 
95
- Run the detection script:
84
+ Show guidance and exit:
96
85
 
97
- ```bash
98
- python3 ${SKILL_DIR}/scripts/detect-recovery-state.py \
99
- --feature-id <FEATURE_ID> \
100
- --feature-list feature-list.json
101
86
  ```
87
+ No interrupted workflow detected in this workspace.
102
88
 
103
- The script scans four categories of state and outputs structured JSON:
104
-
105
- ### 1.1 Pipeline State
106
- - `dev-pipeline/state/features/{FEATURE_ID}/status.json` pipeline tracking status, retry count, session history
107
- - Last session directory — path for log inspection
108
-
109
- ### 1.2 PrizmKit Artifacts
110
- - `.prizmkit/specs/{slug}/spec.md` — specification generated?
111
- - `.prizmkit/specs/{slug}/plan.md` — plan generated?
112
- - If plan.md exists: count completed vs total tasks (look for `[x]` vs `[ ]` checkboxes)
113
-
114
- ### 1.3 Git State
115
- - **Feature branch**: does `feat/{slug}` exist?
116
- - **Current branch**: are we already on the feature branch?
117
- - **Uncommitted changes**: `git diff --stat` (working tree changes)
118
- - **Staged changes**: `git diff --cached --stat`
119
- - **Commits ahead of main**: `git log main..HEAD --oneline`
120
-
121
- ### 1.4 Code Changes
122
- - Number of modified/added/deleted files
123
- - Which directories were touched
124
- - Whether test files were created/modified
125
-
126
- ### Detection Output
127
-
128
- The script produces a structured JSON report:
129
-
130
- ```json
131
- {
132
- "feature_id": "F-007",
133
- "feature_title": "User Authentication",
134
- "feature_slug": "007-user-authentication",
135
- "pipeline": {
136
- "status": "failed",
137
- "retry_count": 1,
138
- "last_session_id": "F-007-20260329101500",
139
- "last_session_dir": "dev-pipeline/state/features/F-007/sessions/F-007-20260329101500"
140
- },
141
- "artifacts": {
142
- "spec_exists": true,
143
- "plan_exists": true,
144
- "spec_path": ".prizmkit/specs/007-user-authentication/spec.md",
145
- "plan_path": ".prizmkit/specs/007-user-authentication/plan.md",
146
- "plan_tasks_total": 5,
147
- "plan_tasks_completed": 3
148
- },
149
- "git": {
150
- "feature_branch": "feat/007-user-authentication",
151
- "branch_exists": true,
152
- "on_feature_branch": true,
153
- "uncommitted_files": 8,
154
- "staged_files": 0,
155
- "commits_ahead_of_main": 0
156
- },
157
- "code": {
158
- "files_modified": 6,
159
- "files_added": 4,
160
- "test_files_touched": 2,
161
- "directories_touched": ["src/auth/", "src/middleware/", "tests/"]
162
- },
163
- "recovery": {
164
- "recommended_action": "continue_implementation",
165
- "recommended_phase": "implement",
166
- "reason": "spec and plan exist, 3/5 plan tasks completed, code changes present",
167
- "remaining_work": "2 tasks + review + commit"
168
- }
169
- }
89
+ To start a new workflow:
90
+ • /feature-workflow — build features from idea to code
91
+ /bug-fix-workflow — fix a specific bug interactively
92
+ /refactor-workflow behavior-preserving code restructuring
170
93
  ```
171
94
 
172
- **CHECKPOINT CP-RW-0**: State detection complete, structured report available.
95
+ **CHECKPOINT CP-RW-0**: Workflow type and phase identified.
173
96
 
174
97
  ---
175
98
 
176
- ## Phase 2: Diagnosis & Recovery Options
99
+ ## Phase 1: Report + User Confirmation
177
100
 
178
- **Goal**: Present findings to user and agree on a recovery strategy.
101
+ **Goal**: Show the user what was found and get confirmation before executing.
179
102
 
180
- ### 2.1 Present Discovery Summary
103
+ ### 1.1 Display Detection Report
181
104
 
182
- Read the detection script output and show the user a clear summary:
105
+ Read the script output and present a formatted summary:
183
106
 
184
107
  ```
185
108
  ═══════════════════════════════════════════════════
186
- Recovery Report: F-007 — User Authentication
109
+ Recovery Report
187
110
  ═══════════════════════════════════════════════════
188
111
 
189
- Pipeline Status: FAILED (retry 1)
190
- Feature Branch: feat/007-user-authentication
112
+ Workflow: bug-fix-workflow
113
+ Branch: fix/B-001-login-crash
114
+ Phase: 5 — Review
191
115
 
192
116
  Artifacts Found:
193
- spec.md (specification)
194
- plan.md (5 tasks, 3 completed)
195
- ✓ Code changes (10 files — 6 modified, 4 new)
196
- ✓ Test files (2 found)
117
+ fix-plan.md (fix approach documented)
118
+ fix-report.md (not yet created)
119
+ ✓ Code changes (4 files — 3 modified, 1 new)
120
+ ✓ Test files (1 touched)
197
121
 
198
- Recommended: Continue implementation
199
- Remaining: 2 tasks + review + commit
122
+ Reason: fix-plan.md exists + code changes present
123
+ Remaining: code review user verification → commit & merge
200
124
  ═══════════════════════════════════════════════════
201
125
  ```
202
126
 
203
- ### 2.2 Run Tests (if code changes exist)
127
+ ### 1.2 Run Tests (if code changes exist)
204
128
 
205
- Before presenting options, run the project's test suite to understand the health of existing code:
129
+ If the detection report shows code changes (`code.has_changes == true`), run the project's test suite:
206
130
 
207
131
  ```bash
208
- # detect test command from .prizmkit/config.json or package.json
132
+ # detect test command from package.json or .prizmkit/config.json
209
133
  npm test # or the appropriate test command
210
134
  ```
211
135
 
212
- Include test results in the summary:
136
+ Include test results in the report:
213
137
  - How many tests pass/fail
214
- - If there are failures — which tests and why
215
-
216
- ### 2.3 Present Recovery Options
217
-
218
- Based on the detected state, offer the appropriate options. The most common scenarios:
219
-
220
- **Scenario A: Implementation in progress** (spec + plan + code changes)
221
- Most common case — session died mid-implementation.
222
-
223
- | Option | Description |
224
- |--------|-------------|
225
- | **(a) Smart Resume** (recommended) | Fix test failures if any, complete remaining plan tasks, then review → commit |
226
- | **(b) Review & Commit Only** | If implementation looks complete (all tasks done, tests passing), skip to code review |
227
- | **(c) Re-implement from Plan** | Keep spec and plan, discard code changes, re-implement. Useful if partial code is low quality |
228
- | **(d) Clean Restart** | Discard everything, start from scratch (equivalent to `reset-feature.sh --clean --run`) |
229
-
230
- **Scenario B: Only planning artifacts** (spec/plan exist, no code changes)
231
- Session died during or after planning, before implementation started.
232
-
233
- | Option | Description |
234
- |--------|-------------|
235
- | **(a) Start Implementation** (recommended) | Plan is ready, begin implementing |
236
- | **(b) Re-plan** | Keep spec, regenerate plan (useful if plan was incomplete or poor) |
237
- | **(c) Clean Restart** | Discard everything and start over |
138
+ - If failures exist — which tests and why
238
139
 
239
- **Scenario C: Code changes but no artifacts** (git changes, no .prizmkit artifacts)
240
- Unusual — might be manual work or artifacts were cleaned.
140
+ ### 1.3 Ask User to Confirm
241
141
 
242
- | Option | Description |
243
- |--------|-------------|
244
- | **(a) Adopt & Continue** | Read existing code, proceed to review + commit |
245
- | **(b) Clean Restart** | Discard and restart |
246
-
247
- **Scenario D: Already committed** (feature branch has commits ahead of main)
248
- Session completed implementation but didn't finish post-commit steps.
249
-
250
- | Option | Description |
251
- |--------|-------------|
252
- | **(a) Complete Post-commit** (recommended) | Run code review, retrospective, handle merge |
253
- | **(b) Clean Restart** | Discard and restart |
254
-
255
- **Scenario E: No state found** (no branch, no artifacts, no code)
256
- Feature was never executed or was fully cleaned.
257
-
258
- | Option | Description |
259
- |--------|-------------|
260
- | **(a) Run from Scratch** | Suggest using `dev-pipeline-launcher` (Intent E) or `retry-feature.sh` instead |
142
+ ```
143
+ Ready to resume from Phase 5 (Review). Continue?
144
+ ```
261
145
 
262
- Ask the user to choose. Default to the recommended option.
146
+ If the user declines, suggest alternatives:
147
+ - "Use `/bug-fix-workflow` to start fresh"
148
+ - "Use `/feature-workflow` to start fresh"
149
+ - "Use `/refactor-workflow` to start fresh"
263
150
 
264
- **CHECKPOINT CP-RW-1**: User confirmed recovery strategy.
151
+ **CHECKPOINT CP-RW-1**: User confirmed recovery.
265
152
 
266
153
  ---
267
154
 
268
- ## Phase 3: Execute Recovery
269
-
270
- **Goal**: Execute the remaining phases based on the user's chosen strategy.
155
+ ## Phase 2: Execute Remaining Steps
271
156
 
272
- ### 3.0 Branch Setup
157
+ **Goal**: Read the target workflow's SKILL.md and execute from the inferred phase.
273
158
 
274
- Ensure we're on the right branch:
159
+ ### 2.0 Read Target Workflow
275
160
 
276
- ```bash
277
- # If feature branch exists but we're not on it:
278
- git checkout feat/{slug}
279
-
280
- # If no feature branch but code changes are on current branch:
281
- git checkout -b feat/{slug}
282
- ```
161
+ 1. **Read the workflow's SKILL.md** from `core/skills/orchestration-skill/workflows/{workflow-type}/SKILL.md`
162
+ 2. **Read existing artifacts** to restore context check in this order for the most efficient recovery:
163
+ - If `session-summary.md` exists in the artifact directory → read it first. It provides a lightweight summary of completed tasks, key decisions, active TRAPS, and remaining work from the interrupted session.
164
+ - Then read remaining artifacts: spec, plan, code diffs, bug descriptions, etc.
165
+ 3. **Read relevant `.prizm-docs/`** — load project context (L0 root, relevant L1). If `session-summary.md` was found, use its "Files Changed" section to focus L1/L2 loading on affected modules only.
283
166
 
284
- ### 3.1 Read Existing Artifacts
167
+ This step replaces the context that was lost when the AI session was interrupted.
285
168
 
286
- Load the artifacts that were preserved, so we have full context:
287
-
288
- 1. **Read spec.md** (if exists) — understand what this feature should do
289
- 2. **Read plan.md** (if exists) — understand the implementation plan and task breakdown
290
- 3. **Scan code changes** — `git diff main --stat` to understand what was already done
291
- 4. **Read relevant `.prizm-docs/`** — load project context (L0 root, relevant L1)
292
-
293
- This step replaces the Phase 0-2 that the pipeline would have done (project bootstrap, context building, planning). The artifacts serve as memory of the interrupted session.
294
-
295
- ### 3.2 Fix Existing Test Failures (if any)
169
+ ---
296
170
 
297
- If tests are failing from the interrupted session, fix them first. Continuing implementation on top of a broken state compounds errors.
171
+ ### 2.1 Bug-Fix-Workflow Recovery
298
172
 
299
- 1. Read the test failure output
300
- 2. Read the relevant source files
301
- 3. Apply minimal fixes to make tests pass
302
- 4. Verify: run test suite → all green
173
+ Phase inference table:
303
174
 
304
- If failures cannot be fixed after 3 attempts, ask the user whether to:
305
- - Continue anyway (if failures are unrelated to this feature)
306
- - Switch to "Re-implement from Plan" strategy
307
- - Clean restart
175
+ | Detected State | Resume From | Actions |
176
+ |---------------|------------|---------|
177
+ | On `fix/<BUG_ID>-*` branch, no artifacts | Phase 1: Deep Bug Diagnosis | Read bug description from `bug-fix-list.json`. Start interactive diagnosis Q&A |
178
+ | `fix-plan.md` exists, no code changes | Phase 4: Fix | Read fix-plan.md. Implement the fix following the plan |
179
+ | `fix-plan.md` + code changes exist | Phase 5: Review | Invoke `/prizmkit-code-review` on all changes |
180
+ | All docs + review passed | Phase 6: User Verification | Ask user to verify the fix works |
181
+ | All docs + committed | Phase 7: Merge Decision | Ask merge vs keep branch |
308
182
 
309
- ### 3.3 Continue Implementation
183
+ **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.
310
184
 
311
- If plan.md exists with incomplete tasks:
185
+ **Special handling**:
186
+ - 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.
187
+ - If resuming from Phase 4 (Fix), read fix-plan.md to understand the planned approach before writing code.
312
188
 
313
- 1. **Read plan.md** and identify remaining tasks — look for unchecked `[ ]` items in the Tasks section
314
- 2. **For each remaining task**:
315
- - Read the task description from plan.md
316
- - Implement the change following the same approach as `/prizmkit-implement`
317
- - Run full test suite after each task
318
- - Mark task as complete `[x]` in plan.md
319
- 3. After all tasks complete → full test suite must pass
189
+ ---
320
190
 
321
- If no plan.md exists but code changes are present (Scenario C), skip this step — go straight to review.
191
+ ### 2.2 Feature-Workflow Recovery
322
192
 
323
- ### 3.4 Code Review
193
+ Phase inference table:
324
194
 
325
- Invoke `/prizmkit-code-review` on all changes:
326
- - Review scope: all files modified/added relative to main branch (`git diff main --stat`)
327
- - If review returns NEEDS_FIXES apply fixes, re-review (max 2 rounds)
328
- - If review returns PASS or PASS_WITH_WARNINGS proceed
195
+ | Detected State | Resume From | Actions |
196
+ |---------------|------------|---------|
197
+ | No `feature-list.json` | Phase 1: Brainstorm | Cannot recover conversation context. Start requirement clarification, but leverage any workspace content (README, existing code) for context |
198
+ | `feature-list.json` exists, no pipeline state | Phase 3: Launch | Invoke `feature-pipeline-launcher` to start the pipeline |
199
+ | `feature-list.json` + pipeline state exists | Phase 4: Monitor | Check pipeline status via `feature-pipeline-launcher` (Intent B: Check Status) |
329
200
 
330
- ### 3.5 User Verification
201
+ **Note**: Feature-workflow recovery is simpler because Phases 3-4 are pipeline-driven. The main recovery value is avoiding re-brainstorming (Phase 1) when `feature-list.json` already exists.
331
202
 
332
- Ask user: "Implementation recovered and reviewed. Verify before committing?"
333
- - **(a) Run the app** → suggest and start the dev server
334
- - **(b) Run a specific command** → execute what the user specifies
335
- - **(c) Skip** → proceed directly to commit
203
+ ---
336
204
 
337
- If user reports issues: return to 3.3 (max 2 additional rounds).
205
+ ### 2.3 Refactor-Workflow Recovery
338
206
 
339
- ### 3.6 Retrospective & Commit
207
+ Phase inference table (mirrors feature-workflow):
340
208
 
341
- 1. **Invoke `/prizmkit-retrospective`** update `.prizm-docs/` for structural changes caused by this feature
342
- 2. **Invoke `/prizmkit-committer`** — commit with `feat(<scope>): <description>` prefix
343
- 3. **Update pipeline state** mark feature as completed:
344
- ```bash
345
- python3 dev-pipeline/scripts/update-feature-status.py \
346
- --feature-list feature-list.json \
347
- --state-dir dev-pipeline/state \
348
- --feature-id <FEATURE_ID> \
349
- --action complete
350
- ```
209
+ | Detected State | Resume From | Actions |
210
+ |---------------|------------|---------|
211
+ | No `refactor-list.json` | Phase 1: Brainstorm | Start refactoring goal clarification |
212
+ | `refactor-list.json` exists, no pipeline state | Phase 3: Launch | Invoke `refactor-pipeline-launcher` to start the pipeline |
213
+ | `refactor-list.json` + pipeline state exists | Phase 4: Monitor | Check pipeline status |
351
214
 
352
- ### 3.7 Post-Recovery
215
+ ---
353
216
 
354
- 1. **Ask merge preference**:
355
- - (a) Merge to main and delete feature branch
356
- - (b) Keep feature branch for PR review
357
- - (c) Decide later
217
+ ### 2.4 Post-Recovery Report
358
218
 
359
- 2. **Report completion**:
360
- ```
361
- Recovery complete: F-007 — User Authentication
219
+ After all remaining phases complete, output a summary:
362
220
 
363
- Recovered from: implementation phase (3/5 tasks done)
364
- Completed: 2 remaining tasks + test fixes + review + commit
365
- Work preserved: spec.md, plan.md, 3 completed tasks
221
+ ```
222
+ Recovery complete.
366
223
 
367
- Next: Check pipeline status for remaining features,
368
- or invoke /recovery-workflow for another failed feature.
369
- ```
224
+ Workflow: bug-fix-workflow
225
+ Recovered from: Phase 5 (Review)
226
+ Completed: code review → user verification → commit & merge
227
+ Preserved: fix-plan.md, 4 code files, 1 test file
370
228
 
371
- 3. **Suggest next steps**:
372
- - If other features are pending/failed → offer to check pipeline status or recover another
373
- - If this was the last feature → suggest integration verification
229
+ Next steps:
230
+ Check for other interrupted workflows
231
+ Or start a new workflow
232
+ ```
374
233
 
375
- **CHECKPOINT CP-RW-2**: Feature recovered, committed, and pipeline state updated.
234
+ **CHECKPOINT CP-RW-2**: Workflow recovered and completed.
376
235
 
377
236
  ---
378
237
 
@@ -380,14 +239,12 @@ If user reports issues: return to 3.3 (max 2 additional rounds).
380
239
 
381
240
  | Scenario | Action |
382
241
  |----------|--------|
383
- | Feature ID not found in feature-list.json | Ask user for correct ID or file path |
384
- | No state to recover (never executed) | Inform user, suggest `dev-pipeline-launcher` instead |
385
- | Feature branch was deleted | Check if changes exist elsewhere; if not, offer clean start |
386
- | Merge conflicts on feature branch | Show conflicts, help resolve before continuing |
387
- | Test failures unfixable after 3 attempts | Escalate to user, offer alternative strategies |
388
- | Code quality too low to salvage | Recommend re-implement from plan |
389
- | Pipeline state file inconsistent with git | Trust git and filesystem over status.json — git is the ground truth |
390
- | detection script fails | Fall back to manual detection (Phase 1 checks can be done individually via bash) |
242
+ | No workflow signature matches | Show guidance message, suggest original workflow skills |
243
+ | Branch exists but artifacts are inconsistent | Trust git as ground truth, report discrepancy in detection report |
244
+ | Test failures in existing code | Report in detection summary; user decides whether to continue |
245
+ | Multiple workflows could match (e.g., on main but both feature-list.json and bug-fix artifacts exist) | Pick highest priority (bug-fix > refactor > feature), mention others in report |
246
+ | Detection script fails | Fall back to manual detection (run individual git/file checks in bash) |
247
+ | Bug ID not found in bug-fix-list.json | Continue with branch-only context; note that full bug description is unavailable |
391
248
 
392
249
  ---
393
250
 
@@ -395,34 +252,29 @@ If user reports issues: return to 3.3 (max 2 additional rounds).
395
252
 
396
253
  | Skill | Relationship |
397
254
  |-------|-------------|
398
- | `dev-pipeline-launcher` | **Upstream** — launcher can suggest this skill when features fail; this skill updates pipeline state after recovery |
399
- | `retry-feature.sh` | **Alternative** — full clean retry; this skill is the smart alternative |
400
- | `reset-feature.sh` | **Used by option (d)** — clean restart delegates to reset-feature |
401
- | `/prizmkit-implement` | **Approach shared in Phase 3.3** — same implementation methodology |
402
- | `/prizmkit-code-review` | **Called in Phase 3.4** reviews recovered code |
403
- | `/prizmkit-committer` | **Called in Phase 3.6** commits the result |
404
- | `/prizmkit-retrospective` | **Called in Phase 3.6** — updates .prizm-docs/ |
405
- | `feature-workflow` | **Sibling** feature-workflow builds new features; this skill salvages interrupted ones |
255
+ | `feature-workflow` | **Recovery target** — this skill can resume interrupted feature-workflow sessions |
256
+ | `bug-fix-workflow` | **Recovery target** — this skill can resume interrupted bug-fix-workflow sessions |
257
+ | `refactor-workflow` | **Recovery target** — this skill can resume interrupted refactor-workflow sessions |
258
+ | `feature-pipeline-launcher` | **Called in Phase 2.2** — launches or checks pipeline status for feature recovery |
259
+ | `retry-feature.sh` | **Alternative** full clean retry for pipeline failures; this skill is the smart interactive alternative |
260
+ | `retry-bugfix.sh` | **Alternative** full clean retry for bugfix pipeline failures |
261
+ | `/prizmkit-code-review` | **Called in Phase 2.1** — reviews recovered bug-fix code |
262
+ | `/prizmkit-committer` | **Called in Phase 2.1** commits the recovered result |
406
263
 
407
264
  ---
408
265
 
409
- ## Comparison with Existing Recovery Tools
266
+ ## Comparison with Previous Version
410
267
 
411
- | Dimension | recovery-workflow | retry-feature.sh | reset + run | run.sh --resume-phase |
412
- |-----------|------------------|-------------------|-------------|----------------------|
413
- | State inspection | Deep (git + artifacts + tests) | None | None | None |
414
- | Preserves code | Yes | No (cleans) | No (cleans) | Prompt-level only |
415
- | Preserves artifacts | Yes (selective) | No | No | Prompt-level |
416
- | Runs tests first | Yes | No | No | No |
417
- | User choice | Multiple strategies | Always clean | Always clean | Fixed phase number |
418
- | Execution mode | Interactive (in-session) | Spawns new session | Spawns new session | Spawns new session |
419
- | Token efficiency | High (skips done work) | Low (redo all) | Low (redo all) | Medium |
420
- | Context continuity | Full (reads existing artifacts) | None (fresh AI session) | None | Partial |
268
+ | Dimension | Previous | Current |
269
+ |-----------|----------|---------|
270
+ | Scope | Feature pipeline only | All 3 interactive workflows |
271
+ | Input | Required `F-XXX` feature ID | No input fully auto-detect |
272
+ | Detection | Feature-specific (spec/plan/git) | Signature-based (branch + artifacts) |
273
+ | Strategy | Multi-option (5 scenarios × 2-4 options each) | Single path: report → confirm → execute |
274
+ | Intrusion | None | None (zero changes to target workflows) |
421
275
 
422
276
  ## Output
423
277
 
424
- - Recovered and completed feature implementation
425
- - Updated pipeline state (feature marked complete)
426
- - Git commit with `feat(<scope>):` prefix
427
- - Updated `.prizm-docs/` (via retrospective)
428
- - Recovery summary showing what was salvaged vs what was re-done
278
+ - Resumed and completed workflow from the breakpoint
279
+ - Same outputs as the original workflow would produce (commits, artifacts, state updates)
280
+ - Recovery summary showing what was preserved vs what was re-done