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
@@ -0,0 +1,352 @@
1
+ ---
2
+ name: "refactor-pipeline-launcher"
3
+ description: "Launch and manage the refactor pipeline from within an AI CLI session. Start pipeline in background, monitor logs, check status, stop pipeline. Use this skill whenever the user wants to start refactoring, run the refactor pipeline, check refactor progress, retry refactors, or stop the pipeline. Trigger on: 'run refactor pipeline', 'start refactoring', 'refactor pipeline status', 'stop refactor pipeline', 'retry refactor', 'launch refactor pipeline'. (project)"
4
+ ---
5
+
6
+ # Refactor Pipeline Launcher
7
+
8
+ Launch the autonomous refactor pipeline from within an AI CLI conversation. The pipeline runs as a fully detached background process -- closing the AI CLI session does NOT stop the pipeline.
9
+
10
+ ### Execution Mode
11
+
12
+ Three execution modes are available. The user chooses one before configuring other options:
13
+
14
+ 1. **Foreground** (recommended) — `dev-pipeline/run-refactor.sh run`. Visible output, direct error feedback, no orphaned processes.
15
+ 2. **Background daemon** — `dev-pipeline/launch-refactor-daemon.sh`. Runs fully detached, survives AI CLI session closure.
16
+ 3. **Manual** — Display the assembled command(s) only. Do not execute anything. User runs them on their own.
17
+
18
+ ### When to Use
19
+
20
+ **Start pipeline** -- User says:
21
+ - "run refactor pipeline", "start refactoring", "launch refactor pipeline"
22
+ - "execute refactor list", "refactor all", "start refactoring tasks"
23
+ - After refactor-planner completes: "refactor it", "start refactoring from the list"
24
+
25
+ **Check status** -- User says:
26
+ - "refactor pipeline status", "refactor progress", "check refactoring"
27
+ - "how's the refactoring going", "refactor status"
28
+
29
+ **Stop pipeline** -- User says:
30
+ - "stop refactor pipeline", "stop refactoring", "halt refactor", "pause refactoring"
31
+
32
+ **Show logs** -- User says:
33
+ - "refactor logs", "show refactor logs", "what's being refactored"
34
+ - "view refactor logs"
35
+
36
+ **Retry single refactor** -- User says:
37
+ - "retry R-001", "retry this refactor", "re-run R-001"
38
+
39
+ **Do NOT use this skill when:**
40
+ - User wants to plan refactoring (use `refactor-planner` instead)
41
+ - User wants a single interactive refactor in current session (use `refactor-workflow` — but note it will delegate back here for batch execution)
42
+ - User wants to implement features (use `feature-pipeline-launcher`)
43
+
44
+ ### Prerequisites
45
+
46
+ Before any action, validate:
47
+
48
+ 1. **refactor pipeline exists**: Confirm `dev-pipeline/launch-refactor-daemon.sh` and `dev-pipeline/run-refactor.sh` are present and executable
49
+ 2. **For start**: `refactor-list.json` must exist in project root (or user-specified path)
50
+ 3. **Dependencies**: `jq`, `python3`, AI CLI (`cbc` or `claude`) must be in PATH
51
+ 4. **Python version**: Requires Python 3.8+ for dev-pipeline scripts
52
+
53
+ Quick check:
54
+ ```bash
55
+ command -v jq && command -v python3 && (command -v cbc || command -v claude) && echo "All dependencies OK"
56
+ ```
57
+
58
+ If `refactor-list.json` is missing, inform user:
59
+ > "No refactor-list.json found. Run the `refactor-planner` skill first to generate one, or provide a path to your refactor list."
60
+
61
+ ### Workflow
62
+
63
+ Detect user intent from their message, then follow the corresponding workflow:
64
+
65
+ ---
66
+
67
+ #### Intent A: Start Pipeline
68
+
69
+ 1. **Check prerequisites**:
70
+ ```bash
71
+ ls refactor-list.json 2>/dev/null && echo "Found" || echo "Missing"
72
+ ```
73
+
74
+ 2. **Check not already running**:
75
+ ```bash
76
+ dev-pipeline/launch-refactor-daemon.sh status 2>/dev/null
77
+ ```
78
+ If running, inform user and ask: "Refactor pipeline is already running. Want to restart it, check status, or view logs?"
79
+
80
+ 3. **Show refactor summary** (so user knows what will be refactored):
81
+ ```bash
82
+ python3 -c "
83
+ import json
84
+ with open('refactor-list.json') as f:
85
+ data = json.load(f)
86
+ refactors = data.get('refactors', [])
87
+ print(f'Total refactor tasks: {len(refactors)}')
88
+ type_counts = {}
89
+ for r in refactors:
90
+ t = r.get('type', 'unknown')
91
+ type_counts[t] = type_counts.get(t, 0) + 1
92
+ if type_counts:
93
+ print(f'By type: {dict(sorted(type_counts.items()))}')
94
+ print()
95
+ priority_order = {'critical': 0, 'high': 1, 'medium': 2, 'low': 3}
96
+ refactors_sorted = sorted(refactors, key=lambda r: (priority_order.get(r.get('priority', 'medium'), 2), r.get('id', '')))
97
+ for r in refactors_sorted:
98
+ print(f\" {r['id']}: [{r.get('priority','medium').upper()}] [{r.get('type','?')}] {r.get('title', 'untitled')}\")
99
+ "
100
+ ```
101
+ If pipeline state already exists, use the status command instead:
102
+ ```bash
103
+ python3 dev-pipeline/scripts/update-refactor-status.py \
104
+ --refactor-list refactor-list.json \
105
+ --state-dir dev-pipeline/refactor-state \
106
+ --action status 2>/dev/null
107
+ ```
108
+
109
+ 4. **Run preflight checks** (behavior-preservation baseline):
110
+
111
+ Before refactoring, verify the codebase is in a clean, testable state:
112
+ ```bash
113
+ # Check git working tree is clean
114
+ git status --porcelain | head -5
115
+ # Run existing test suite to establish baseline
116
+ npm test 2>&1 | tail -20 || echo "Test command failed or not configured"
117
+ ```
118
+
119
+ If git working tree is dirty, warn the user:
120
+ > "Working tree has uncommitted changes. It's recommended to commit or stash changes before starting refactoring so each refactor task has a clean baseline. Continue anyway?"
121
+
122
+ If test baseline fails, warn the user:
123
+ > "Test suite is not passing. Refactoring relies on tests to verify behavior preservation. Fix failing tests before starting the refactor pipeline, or continue at your own risk."
124
+
125
+ Wait for user confirmation before proceeding.
126
+
127
+ 5. **Ask execution mode** (first user decision):
128
+
129
+ Present the three modes and ask the user to choose:
130
+ - **(1) Foreground** (recommended) — pipeline runs in the current session via `run-refactor.sh run`. Visible output and direct error feedback.
131
+ - **(2) Background daemon** — pipeline runs fully detached via `launch-refactor-daemon.sh`. Survives AI CLI session closure.
132
+ - **(3) Manual** — display the final assembled commands only. Do not execute anything. User runs them on their own.
133
+
134
+ 6. **Ask configuration options** ⚠️ MANDATORY INTERACTIVE STEP — applies to ALL execution modes (Foreground, Background, AND Manual). You MUST ask the user to configure options and WAIT for their response BEFORE proceeding to step 7. Do NOT skip this step or merge it with step 7.
135
+
136
+ Use `AskUserQuestion` to present the following configuration choices. Each question is a separate selectable option:
137
+
138
+ **Question 1 — Verbose logging** (multiSelect: false):
139
+ - On (default) — Detailed AI session logs including tool calls and subagent activity
140
+ - Off — Minimal logging
141
+
142
+ **Question 2 — Max retries** (multiSelect: false):
143
+ - 3 (default)
144
+ - 1
145
+ - 5
146
+
147
+ **Question 3 — Session timeout** (multiSelect: false):
148
+ - None (default) — No timeout
149
+ - 30 min — `SESSION_TIMEOUT=1800`
150
+ - 1 hour — `SESSION_TIMEOUT=3600`
151
+ - 2 hours — `SESSION_TIMEOUT=7200`
152
+
153
+ **Question 4 — Strict behavior check** (multiSelect: false):
154
+ - On (default) — Run full test suite after each refactor task to verify behavior preservation
155
+ - Off — Skip post-task test verification (faster but riskier)
156
+
157
+ Note: Refactor filter defaults to all refactor items (by priority order). If the user selects "Other" on any option, handle their custom input.
158
+
159
+ **Environment variable mapping** (for translating user responses → env vars):
160
+
161
+ | Config choice | Environment variable |
162
+ |-----------|---------------------|
163
+ | Verbose: On | `VERBOSE=1` |
164
+ | Verbose: Off | `VERBOSE=0` |
165
+ | Max retries: N | `MAX_RETRIES=N` |
166
+ | Timeout: value | `SESSION_TIMEOUT=<seconds>` |
167
+ | Strict behavior: On | `STRICT_BEHAVIOR_CHECK=1` |
168
+ | Strict behavior: Off | `STRICT_BEHAVIOR_CHECK=0` |
169
+
170
+ ⚠️ STOP HERE and wait for user response before continuing to step 7.
171
+
172
+ 7. **Show final command**: After user confirms configuration in step 6, assemble the complete command from execution mode + user-confirmed configuration, and present it to the user.
173
+
174
+ **Foreground command:**
175
+ ```bash
176
+ VERBOSE=1 STRICT_BEHAVIOR_CHECK=1 dev-pipeline/run-refactor.sh run refactor-list.json
177
+ ```
178
+ With all options:
179
+ ```bash
180
+ VERBOSE=1 STRICT_BEHAVIOR_CHECK=1 MAX_RETRIES=5 SESSION_TIMEOUT=3600 \
181
+ dev-pipeline/run-refactor.sh run refactor-list.json
182
+ ```
183
+
184
+ **Background daemon command:**
185
+ ```bash
186
+ dev-pipeline/launch-refactor-daemon.sh start refactor-list.json --env "VERBOSE=1 STRICT_BEHAVIOR_CHECK=1"
187
+ ```
188
+ With all options:
189
+ ```bash
190
+ dev-pipeline/launch-refactor-daemon.sh start refactor-list.json \
191
+ --env "VERBOSE=1 STRICT_BEHAVIOR_CHECK=1 MAX_RETRIES=5"
192
+ ```
193
+
194
+ **Manual mode**: Print the assembled command(s) and **stop here**. Do not execute anything. Do not proceed to step 8.
195
+ ```
196
+ # To run in foreground:
197
+ VERBOSE=1 STRICT_BEHAVIOR_CHECK=1 dev-pipeline/run-refactor.sh run refactor-list.json
198
+
199
+ # To run in background (detached):
200
+ dev-pipeline/launch-refactor-daemon.sh start refactor-list.json --env "VERBOSE=1 STRICT_BEHAVIOR_CHECK=1"
201
+
202
+ # To check status:
203
+ dev-pipeline/run-refactor.sh status refactor-list.json
204
+ ```
205
+
206
+ 8. **Confirm and launch** (Foreground and Background only — Manual mode ends at step 7):
207
+
208
+ Ask: "Ready to launch the refactor pipeline with the above command?"
209
+
210
+ After user confirms, execute the command from step 7.
211
+
212
+ 9. **Post-launch** (depends on execution mode):
213
+
214
+ **If foreground**: Pipeline runs to completion in the terminal. After it finishes:
215
+ - Summarize results: total refactors, succeeded, failed, skipped
216
+ - If all succeeded: each refactor session has already run `prizmkit-retrospective` internally. Ask user what's next.
217
+ - If some failed: show failed refactor IDs and suggest `retry-refactor.sh <R-XXX>` or `reset-refactor.sh <R-XXX> --clean --run`
218
+
219
+ **If background daemon**:
220
+ 1. Verify launch:
221
+ ```bash
222
+ dev-pipeline/launch-refactor-daemon.sh status
223
+ ```
224
+ 2. Start log monitoring — Use the Bash tool with `run_in_background: true`:
225
+ ```bash
226
+ tail -f dev-pipeline/refactor-state/pipeline-daemon.log
227
+ ```
228
+ 3. Report to user:
229
+ - Pipeline PID
230
+ - Log file location
231
+ - "You can ask me 'refactor status' or 'show refactor logs' at any time"
232
+ - "Closing this session will NOT stop the pipeline"
233
+
234
+ ---
235
+
236
+ #### Intent B: Check Status
237
+
238
+ 1. **Check daemon status**:
239
+ ```bash
240
+ dev-pipeline/launch-refactor-daemon.sh status
241
+ ```
242
+
243
+ 2. **Show refactor-level progress**:
244
+ ```bash
245
+ python3 dev-pipeline/scripts/update-refactor-status.py \
246
+ --refactor-list refactor-list.json \
247
+ --state-dir dev-pipeline/refactor-state \
248
+ --action status
249
+ ```
250
+
251
+ 3. **Show recent log activity** (last 20 lines):
252
+ ```bash
253
+ tail -20 dev-pipeline/refactor-state/pipeline-daemon.log
254
+ ```
255
+
256
+ 4. **Summarize** to user: total refactors, completed, in-progress, failed, pending.
257
+
258
+ ---
259
+
260
+ #### Intent C: Stop Pipeline
261
+
262
+ 1. **Stop the daemon**:
263
+ ```bash
264
+ dev-pipeline/launch-refactor-daemon.sh stop
265
+ ```
266
+
267
+ 2. **Verify stopped**:
268
+ ```bash
269
+ dev-pipeline/launch-refactor-daemon.sh status 2>/dev/null || true
270
+ ```
271
+
272
+ 3. **Inform user**: "Refactor pipeline stopped. State is preserved -- you can resume later with 'start refactoring' and it will pick up where it left off."
273
+
274
+ ---
275
+
276
+ #### Intent D: Show Logs
277
+
278
+ 1. **Check if running**:
279
+ ```bash
280
+ dev-pipeline/launch-refactor-daemon.sh status 2>/dev/null
281
+ ```
282
+
283
+ 2. **If running** -- Start live tail with Bash tool `run_in_background: true`:
284
+ ```bash
285
+ tail -f dev-pipeline/refactor-state/pipeline-daemon.log
286
+ ```
287
+
288
+ 3. **If not running** -- Show last 50 lines:
289
+ ```bash
290
+ tail -50 dev-pipeline/refactor-state/pipeline-daemon.log
291
+ ```
292
+
293
+ 4. **For per-refactor session logs** (when user asks about a specific refactor):
294
+ ```bash
295
+ # Check refactor status for last session ID
296
+ cat dev-pipeline/refactor-state/refactors/<REFACTOR_ID>/status.json 2>/dev/null
297
+ # Then tail that refactor's session log
298
+ tail -100 dev-pipeline/refactor-state/refactors/<REFACTOR_ID>/sessions/<SESSION_ID>/logs/session.log
299
+ ```
300
+
301
+ ---
302
+
303
+ #### Intent E: Retry Single Refactor
304
+
305
+ When user says "retry R-001":
306
+
307
+ ```bash
308
+ dev-pipeline/retry-refactor.sh R-001 refactor-list.json
309
+ ```
310
+
311
+ When user says "clean retry R-001" or "retry R-001 from scratch":
312
+
313
+ ```bash
314
+ dev-pipeline/reset-refactor.sh R-001 --clean --run refactor-list.json
315
+ ```
316
+
317
+ Environment variables (optional):
318
+ ```bash
319
+ SESSION_TIMEOUT=3600 STRICT_BEHAVIOR_CHECK=1 dev-pipeline/retry-refactor.sh R-001 refactor-list.json
320
+ ```
321
+
322
+ Notes:
323
+ - `retry-refactor.sh` runs exactly one refactor session and exits.
324
+ - `reset-refactor.sh --clean --run` clears the refactor state before retrying (fresh start).
325
+ - Keep pipeline daemon mode for main run management (`launch-refactor-daemon.sh`).
326
+
327
+ ---
328
+
329
+ ### Error Handling
330
+
331
+ | Error | Action |
332
+ |-------|--------|
333
+ | `refactor-list.json` not found | Tell user to run `refactor-planner` skill first |
334
+ | Circular dependencies in refactor list | Fix dependency graph in `refactor-list.json` before launching |
335
+ | Test baseline failing | Fix failing tests before starting refactoring -- behavior preservation requires a green baseline |
336
+ | `jq` not installed | Suggest: `brew install jq` |
337
+ | `cbc`/`claude` not in PATH | Check AI CLI installation |
338
+ | Refactor pipeline already running | Show status, ask if user wants to stop and restart |
339
+ | PID file stale (process dead) | `launch-refactor-daemon.sh` auto-cleans, retry start |
340
+ | Launch failed (process died immediately) | Show last 20 lines of log: `tail -20 dev-pipeline/refactor-state/pipeline-daemon.log` |
341
+ | Refactor stuck/blocked | Use `retry-refactor.sh <R-XXX>` to retry; use `reset-refactor.sh <R-XXX> --clean --run` for fresh start |
342
+ | All refactors blocked/failed | Show status, suggest recovery: `dev-pipeline/reset-refactor.sh <R-XXX> --clean --run refactor-list.json` |
343
+ | Permission denied on script | Run `chmod +x dev-pipeline/launch-refactor-daemon.sh dev-pipeline/run-refactor.sh` |
344
+
345
+ ### Integration Notes
346
+
347
+ - **After refactor-planner**: This is the natural next step. When user finishes refactor planning and has `refactor-list.json`, suggest launching the refactor pipeline.
348
+ - **Session independence**: The pipeline runs completely detached. User can close the AI CLI session, open a new session later, and use this skill to check progress or stop the pipeline.
349
+ - **Single instance**: Only one refactor pipeline can run at a time. The PID file prevents duplicates.
350
+ - **Pipeline coexistence**: Refactor pipeline uses `refactor-state/` separate from `state/` (features) and `bugfix-state/` (bugs), so all three pipelines can run simultaneously without conflict.
351
+ - **State preservation**: Stopping and restarting the pipeline resumes from where it left off -- completed refactors are not re-run.
352
+ - **HANDOFF**: After pipeline completes all refactors, each session has already run `prizmkit-retrospective` internally. Ask user what's next.