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,331 @@
1
+ # Dev-Pipeline Refactor Session Bootstrap
2
+
3
+ ## Session Context
4
+
5
+ - **Refactor ID**: {{REFACTOR_ID}}
6
+ - **Refactor Title**: {{REFACTOR_TITLE}}
7
+ - **Refactor Type**: {{REFACTOR_TYPE}}
8
+ - **Priority**: {{PRIORITY}}
9
+ - **Complexity**: {{COMPLEXITY}}
10
+
11
+ ## Your Mission
12
+
13
+ You are the **refactor session orchestrator**. Execute Refactor {{REFACTOR_ID}}: "{{REFACTOR_TITLE}}".
14
+
15
+ **CRITICAL SESSION LIFECYCLE RULE**: You MUST NOT exit until ALL work is complete and session-status.json is written. When you spawn subagents, you MUST **wait for each to finish** (run_in_background=false) before proceeding. Do NOT spawn an agent in the background and exit — that kills the session.
16
+
17
+ **NON-INTERACTIVE MODE**: You are running in headless non-interactive mode. There is NO human on the other end. NEVER ask for user confirmation, NEVER wait for user input, NEVER use interactive prompts (e.g. "Would you like me to…"). If a skill has an interactive step (e.g. offer remediation, ask for approval), skip it and proceed autonomously. Make decisions based on the data available and move forward.
18
+
19
+ **MANDATORY TEAM REQUIREMENT**: You MUST use the `prizm-dev-team` agents (Dev + Reviewer). This is NON-NEGOTIABLE. All implementation and review work MUST be performed by the appropriate team agents (Dev, Reviewer). You are the orchestrator — handle coordination, planning, and commit phases directly.
20
+
21
+ **REFACTOR DOCUMENTATION POLICY**:
22
+ - **DEFAULT**: Run `/prizmkit-retrospective` with full sync (Job 1 + Job 2), because refactoring changes code structure and interfaces.
23
+ - **SKIP Job 2** only if the refactor is a pure rename with no interface changes.
24
+ - Commit with `refactor(<scope>):` prefix, NOT `feat:` or `fix:`
25
+
26
+ ### Team Definition Reference
27
+
28
+ - **Team config**: `{{TEAM_CONFIG_PATH}}`
29
+
30
+ ### Refactor Description
31
+
32
+ {{REFACTOR_DESCRIPTION}}
33
+
34
+ {{USER_CONTEXT}}
35
+
36
+ ### Scope
37
+
38
+ **Files:**
39
+ {{SCOPE_FILES}}
40
+
41
+ **Modules:**
42
+ {{SCOPE_MODULES}}
43
+
44
+ ### Behavior Preservation
45
+
46
+ - **Strategy**: {{BEHAVIOR_STRATEGY}}
47
+ - **Existing Tests**:
48
+ {{EXISTING_TESTS}}
49
+ - **New Tests Needed**:
50
+ {{NEW_TESTS_NEEDED}}
51
+
52
+ ### Acceptance Criteria
53
+
54
+ {{ACCEPTANCE_CRITERIA}}
55
+
56
+ ### Dependencies
57
+
58
+ {{DEPENDENCIES}}
59
+
60
+ ### App Global Context
61
+
62
+ {{GLOBAL_CONTEXT}}
63
+
64
+ ### Project Conventions
65
+
66
+ > Read {{PLATFORM_CONVENTIONS}} for project-level coding standards, architecture decisions, and development rules.
67
+
68
+ ## Refactor Artifacts Directory
69
+
70
+ **ALWAYS** use per-refactor subdirectory `.prizmkit/refactor/{{REFACTOR_ID}}/`:
71
+
72
+ ```
73
+ .prizmkit/refactor/{{REFACTOR_ID}}/
74
+ ├── spec.md ← /prizmkit-plan output (goals, scope, behavior preservation)
75
+ ├── plan.md ← /prizmkit-plan output (change approach, tasks)
76
+ └── refactor-report.md ← Phase 5 output (generated after commit)
77
+ ```
78
+
79
+ ## Execution Instructions
80
+
81
+ **YOU are the orchestrator. Execute each phase by spawning the appropriate team agent with run_in_background=false.**
82
+
83
+ ## Workflow Checkpoint System
84
+
85
+ A checkpoint file tracks your progress through this workflow:
86
+
87
+ **Path**: `{{CHECKPOINT_PATH}}`
88
+
89
+ **How to use**:
90
+ 1. **Before each step**: Read `workflow-checkpoint.json`, verify the previous step has `status: "completed"` or `status: "skipped"`. If not, complete it first.
91
+ 2. **After completing a step**: Update the step's `status` to `"completed"` in `workflow-checkpoint.json`.
92
+
93
+ ### Step 1: Initialize
94
+
95
+ #### Agent Setup
96
+
97
+ Reference `{{TEAM_CONFIG_PATH}}` for agent definitions:
98
+ - Dev: `{{DEV_SUBAGENT_PATH}}`
99
+ - Reviewer: `{{REVIEWER_SUBAGENT_PATH}}`
100
+
101
+ Create refactor artifacts directory:
102
+ ```powershell
103
+ New-Item -ItemType Directory -Force -Path .prizmkit/refactor/{{REFACTOR_ID}} | Out-Null
104
+ ```
105
+
106
+ ### Step 2: Pipeline Phases
107
+
108
+ #### Phase 1: Plan — Specification & Plan Generation
109
+
110
+ **Goal**: Generate spec.md and plan.md with behavior-preserving task breakdown.
111
+
112
+ Run `/prizmkit-plan` with `artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/`:
113
+ - Description: "{{REFACTOR_TITLE}} — {{REFACTOR_DESCRIPTION}}"
114
+ - The spec.md MUST include:
115
+ - Goals with acceptance criteria (from the acceptance criteria above)
116
+ - Scope (files and modules from above)
117
+ - Behavior Preservation section (strategy: {{BEHAVIOR_STRATEGY}}, existing tests, what must not change)
118
+ - The plan.md MUST include:
119
+ - Change approach with behavior preservation strategy
120
+ - Tasks ordered by safety: safe renames first → extractions → structural changes
121
+ - Every task ends with "run test suite to verify behavior preserved"
122
+ - Rollback strategy
123
+
124
+ Resolve any `[NEEDS CLARIFICATION]` markers using the refactor description — do NOT pause for interactive input.
125
+
126
+ {{IF_BROWSER_INTERACTION}}
127
+
128
+ #### Browser Verification Strategy
129
+
130
+ The refactor may affect UI behavior. Browser verification can validate:
131
+ - **UI Render**: UI components render identically after refactoring
132
+ - **User Interactions**: Navigation, form submissions, and workflows function as before
133
+ - **Feature Coverage**: Refactored features work end-to-end in real browser environment
134
+
135
+ {{IF_BROWSER_TOOL_AUTO}}
136
+ Browser tool will be auto-selected at runtime based on dev server and feature complexity.
137
+ {{END_IF_BROWSER_TOOL_AUTO}}
138
+
139
+ {{IF_BROWSER_TOOL_PLAYWRIGHT}}
140
+ **Tool: playwright-cli** — Local isolated browser instance for dev server verification
141
+ {{END_IF_BROWSER_TOOL_PLAYWRIGHT}}
142
+
143
+ {{IF_BROWSER_TOOL_OPENCLI}}
144
+ **Tool: opencli** — Chrome session with existing login for testing OAuth/third-party integrations
145
+ {{END_IF_BROWSER_TOOL_OPENCLI}}
146
+
147
+ **Verification Goals**:
148
+ {{BROWSER_VERIFY_STEPS}}
149
+
150
+ Include browser verification approach in plan.md:
151
+ - Which UI flows should be smoke-tested after refactoring?
152
+ - Any specific user journeys affected by the structural changes?
153
+ - Should verification be part of review phase or implementation phase?
154
+
155
+ {{END_IF_BROWSER_INTERACTION}}
156
+
157
+ - **CP-RF-1**: Both `spec.md` and `plan.md` exist in `.prizmkit/refactor/{{REFACTOR_ID}}/`
158
+ - **Checkpoint update**: set step `prizmkit-plan` to `"completed"` in `{{CHECKPOINT_PATH}}`
159
+
160
+ ---
161
+
162
+ #### Phase 2: Implement — Behavior-Preserving Refactoring
163
+
164
+ **Goal**: Execute all tasks from plan.md while preserving existing behavior.
165
+
166
+ - Spawn Dev agent (Agent tool, subagent_type="prizm-dev-team-dev", run_in_background=false)
167
+ Prompt: "Read {{DEV_SUBAGENT_PATH}}. For refactor {{REFACTOR_ID}} ('{{REFACTOR_TITLE}}'):
168
+ 1. Read `.prizmkit/refactor/{{REFACTOR_ID}}/spec.md` and `.prizmkit/refactor/{{REFACTOR_ID}}/plan.md`
169
+ 2. Read `.prizmkit/prizm-docs/` for affected modules (TRAPS, RULES, PATTERNS)
170
+ 3. Before making any changes, run the existing test suite to establish a green baseline
171
+ 4. Run `/prizmkit-implement` with `artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/` — this handles the full implementation cycle:
172
+ - Reads plan.md Tasks section
173
+ - Implements task-by-task, marking each `[x]` immediately
174
+ - Runs tests after EVERY task — all tests MUST pass (behavior preservation)
175
+ - If tests fail: revert the task, analyze why, try alternative approach
176
+ - Writes '## Implementation Log' to context-snapshot.md (or equivalent)
177
+ 5. Do NOT change behavior — only improve structure
178
+
179
+ {{IF_BROWSER_INTERACTION}}
180
+
181
+ 6. **Browser Smoke Tests** (after every major refactor task):
182
+ - Use browser tools to verify UI still renders correctly
183
+ - Test the primary user flows affected by the refactoring
184
+ - Confirm no visual or interactive regressions
185
+ - Document any manual browser verification steps in implementation notes
186
+
187
+ {{END_IF_BROWSER_INTERACTION}}
188
+
189
+ 7. If the refactor involves multiple files: run `/compact` after completing half the tasks to free context budget. If `/compact` is unavailable, continue without it.
190
+ 8. After all tasks complete, run the full test suite one final time
191
+ "
192
+ - **Wait for Dev to return**
193
+ - If Dev reports test failures that cannot be resolved after 3 attempts: escalate, write status="failed"
194
+ - **CP-RF-2**: All tasks completed, all tests green
195
+ - **Checkpoint update**: set step `prizmkit-implement` to `"completed"` in `{{CHECKPOINT_PATH}}`
196
+
197
+ ---
198
+
199
+ #### Phase 3: Review — Code Review & Behavior Verification
200
+
201
+ **Goal**: Verify refactoring quality and behavior preservation.
202
+
203
+ - Spawn Reviewer agent (Agent tool, subagent_type="prizm-dev-team-reviewer", run_in_background=false)
204
+ Prompt: "Read {{REVIEWER_SUBAGENT_PATH}}. For refactor {{REFACTOR_ID}}:
205
+ 1. Read `.prizmkit/refactor/{{REFACTOR_ID}}/spec.md` for goals and behavior preservation contracts
206
+ 2. Read `.prizmkit/refactor/{{REFACTOR_ID}}/plan.md` for architecture decisions and completed tasks
207
+ 3. Run `/prizmkit-code-review` with artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/. The skill runs an internal review-fix loop (Reviewer → filter → Dev fix, max 3 rounds) and writes review-report.md.
208
+ 4. Run full test suite and verify ALL tests pass
209
+
210
+ {{IF_BROWSER_INTERACTION}}
211
+
212
+ 5. **Browser Verification Review**:
213
+ - Verify that critical user workflows still function end-to-end in browser
214
+ - Confirm UI renders consistently after structural changes
215
+ - Validate any behavior-sensitive components behave identically
216
+ - Document browser verification findings in review-report.md
217
+
218
+ {{END_IF_BROWSER_INTERACTION}}
219
+
220
+ 6. review-report.md will be written to .prizmkit/refactor/{{REFACTOR_ID}}/ by prizmkit-code-review
221
+ 7. Report: verdict (PASS/NEEDS_FIXES), number of rounds, findings fixed/rejected
222
+ "
223
+ - **Wait for Reviewer to return**
224
+ - Read `review-report.md` — if PASS proceed, if NEEDS_FIXES log remaining findings and proceed.
225
+ - **CP-RF-3**: Code review complete, tests pass, behavior preserved
226
+ - **Checkpoint update**: set step `prizmkit-code-review` to `"completed"` in `{{CHECKPOINT_PATH}}`
227
+
228
+ ---
229
+
230
+ #### Phase 4: Commit & Report
231
+
232
+ **Goal**: Commit the refactor, update docs, generate report.
233
+
234
+ **This phase is executed by YOU (the orchestrator), NOT a subagent.**
235
+
236
+ 1. Run `/prizmkit-retrospective` (full sync — Job 1 + Job 2) to update `.prizmkit/prizm-docs/` with structural changes
237
+
238
+ 2. Run `/prizmkit-committer --headless` with:
239
+ - Commit message: `refactor({{REFACTOR_ID}}): {{REFACTOR_TITLE}}`
240
+ - Include all refactored files and any new/updated tests
241
+ - Do NOT push (user will push manually)
242
+
243
+ 3. Write the refactor report to `.prizmkit/refactor/{{REFACTOR_ID}}/refactor-report.md`
244
+
245
+ The refactor-report.md MUST contain these sections:
246
+ - Refactor Summary (ID, title, type, status, phases completed)
247
+ - What Changed (files modified, structural changes made, diff summary)
248
+ - Behavior Verification (test suite results before/after, specific tests exercised)
249
+
250
+ {{IF_BROWSER_INTERACTION}}
251
+
252
+ - Browser Verification (UI flows tested, tools used, any manual verification performed)
253
+
254
+ {{END_IF_BROWSER_INTERACTION}}
255
+
256
+ - Code Quality Metrics (if measurable: files consolidated, duplication reduced, etc.)
257
+ - Acceptance Criteria Verification (checklist with pass/fail for each criterion)
258
+
259
+ 4. Write completion summary for downstream dependency context:
260
+
261
+ Write `.prizmkit/refactor/{{REFACTOR_ID}}/completion-summary.json` — this is NOT committed to git. The pipeline runner reads it to propagate context to dependent refactors.
262
+ ```json
263
+ {
264
+ "completion_notes": [
265
+ "<each item: one key structural change that downstream refactors may need to know>",
266
+ "Example: Extracted shared validation logic into src/utils/validation.ts",
267
+ "Example: Renamed UserService → AuthService, moved from src/services/ to src/auth/",
268
+ "Example: Decoupled payment module from user module via PaymentGateway interface"
269
+ ]
270
+ }
271
+ ```
272
+ Rules: focus on structural changes, new module boundaries, renamed/moved files, changed interfaces. 3-8 notes, each under 120 chars.
273
+
274
+ - **CP-RF-4**: Commit recorded, refactor-report.md written, .prizmkit/prizm-docs/ updated
275
+ - **Checkpoint update**: set steps `prizmkit-committer` and `refactor-report` to `"completed"` in `{{CHECKPOINT_PATH}}`
276
+
277
+ ### Step 3: Report Session Status
278
+
279
+ **CRITICAL**: Before this session ends, you MUST write the session status file.
280
+
281
+ Write to: `{{SESSION_STATUS_PATH}}`
282
+
283
+ ```json
284
+ {
285
+ "session_id": "{{SESSION_ID}}",
286
+ "refactor_id": "{{REFACTOR_ID}}",
287
+ "status": "<success|partial|failed>",
288
+ "completed_phases": [1, 2, 3, 4],
289
+ "current_phase": 4,
290
+ "checkpoint_reached": "CP-RF-4",
291
+ "errors": [],
292
+ "can_resume": false,
293
+ "resume_from_phase": null,
294
+ "artifacts": {
295
+ "spec_path": ".prizmkit/refactor/{{REFACTOR_ID}}/spec.md",
296
+ "plan_path": ".prizmkit/refactor/{{REFACTOR_ID}}/plan.md",
297
+ "report_path": ".prizmkit/refactor/{{REFACTOR_ID}}/refactor-report.md"
298
+ },
299
+ "git_commit": "<commit hash>",
300
+ "behavior_preserved": true,
301
+ "timestamp": "{{TIMESTAMP}}"
302
+ }
303
+ ```
304
+
305
+ **Status values**: `success` (all phases done) | `partial` (can resume) | `failed` (unrecoverable)
306
+
307
+ ## Critical Paths
308
+
309
+ | Resource | Path |
310
+ |----------|------|
311
+ | Team Definition (source of truth) | `{{TEAM_CONFIG_PATH}}` |
312
+ | Refactor Artifacts Dir | `.prizmkit/refactor/{{REFACTOR_ID}}/` |
313
+ | Spec | `.prizmkit/refactor/{{REFACTOR_ID}}/spec.md` |
314
+ | Plan | `.prizmkit/refactor/{{REFACTOR_ID}}/plan.md` |
315
+ | Refactor Report | `.prizmkit/refactor/{{REFACTOR_ID}}/refactor-report.md` |
316
+ | Dev Agent Def | {{DEV_SUBAGENT_PATH}} |
317
+ | Reviewer Agent Def | {{REVIEWER_SUBAGENT_PATH}} |
318
+ | Session Status Output | {{SESSION_STATUS_PATH}} |
319
+ | Workflow Checkpoint | {{CHECKPOINT_PATH}} |
320
+ | Project Root | {{PROJECT_ROOT}} |
321
+
322
+ ## Reminders
323
+
324
+ - **MANDATORY**: Use `prizm-dev-team` agents — single-agent execution is FORBIDDEN
325
+ - **Behavior preservation is the #1 priority**: If tests break, stop and fix before proceeding
326
+ - **Run tests after EVERY task** — not just at the end
327
+ - Use `/prizmkit-plan` with `artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/` for spec + plan generation
328
+ - **Commit with** `refactor(<scope>):` prefix, NOT `feat:` or `fix:`
329
+ - **Run full retrospective** (Job 1 + Job 2) — refactoring changes code structure
330
+ - ALWAYS write session-status.json before exiting
331
+ - Do NOT use `run_in_background=true` when spawning agents
@@ -0,0 +1,270 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "Dev-Pipeline Refactor List",
4
+ "description": "Schema for .prizmkit/plans/refactor-list.json — standardized input for the Refactor Pipeline",
5
+ "type": "object",
6
+ "required": [
7
+ "$schema",
8
+ "project_name",
9
+ "refactors"
10
+ ],
11
+ "properties": {
12
+ "$schema": {
13
+ "type": "string",
14
+ "const": "dev-pipeline-refactor-list-v1"
15
+ },
16
+ "project_name": {
17
+ "type": "string",
18
+ "minLength": 1
19
+ },
20
+ "project_description": {
21
+ "type": "string"
22
+ },
23
+ "created_at": {
24
+ "type": "string",
25
+ "format": "date-time"
26
+ },
27
+ "created_by": {
28
+ "type": "string"
29
+ },
30
+ "refactors": {
31
+ "type": "array",
32
+ "minItems": 1,
33
+ "items": {
34
+ "type": "object",
35
+ "required": [
36
+ "id",
37
+ "title",
38
+ "description",
39
+ "scope",
40
+ "type",
41
+ "priority",
42
+ "complexity",
43
+ "behavior_preservation",
44
+ "acceptance_criteria",
45
+ "dependencies",
46
+ "status"
47
+ ],
48
+ "properties": {
49
+ "id": {
50
+ "type": "string",
51
+ "pattern": "^R-\\d{3}$",
52
+ "description": "Refactor ID, format R-001, R-002..."
53
+ },
54
+ "title": {
55
+ "type": "string",
56
+ "minLength": 1,
57
+ "description": "Refactor title — brief description of the change"
58
+ },
59
+ "description": {
60
+ "type": "string",
61
+ "minLength": 1,
62
+ "description": "Detailed description: what is being refactored and why"
63
+ },
64
+ "scope": {
65
+ "type": "object",
66
+ "description": "Files and modules affected by this refactor",
67
+ "properties": {
68
+ "files": {
69
+ "type": "array",
70
+ "items": {
71
+ "type": "string"
72
+ },
73
+ "description": "File paths affected by this refactor"
74
+ },
75
+ "modules": {
76
+ "type": "array",
77
+ "items": {
78
+ "type": "string"
79
+ },
80
+ "description": "Module names affected by this refactor"
81
+ }
82
+ }
83
+ },
84
+ "type": {
85
+ "type": "string",
86
+ "enum": [
87
+ "extract",
88
+ "rename",
89
+ "restructure",
90
+ "simplify",
91
+ "decouple",
92
+ "migrate"
93
+ ],
94
+ "description": "extract=extract-function/module; rename=rename-symbols; restructure=move/reorganize; simplify=reduce-complexity; decouple=remove-dependencies; migrate=tech-migration"
95
+ },
96
+ "priority": {
97
+ "type": "string",
98
+ "enum": [
99
+ "critical",
100
+ "high",
101
+ "medium",
102
+ "low"
103
+ ],
104
+ "description": "Refactor priority. Pipeline processes critical before high before medium before low; within same level, array order determines sequence."
105
+ },
106
+ "complexity": {
107
+ "type": "string",
108
+ "enum": [
109
+ "low",
110
+ "medium",
111
+ "high"
112
+ ],
113
+ "description": "Estimated complexity of the refactor"
114
+ },
115
+ "behavior_preservation": {
116
+ "type": "object",
117
+ "required": [
118
+ "strategy"
119
+ ],
120
+ "description": "Strategy for ensuring no behavior changes",
121
+ "properties": {
122
+ "strategy": {
123
+ "type": "string",
124
+ "enum": [
125
+ "test-gate",
126
+ "snapshot",
127
+ "manual"
128
+ ],
129
+ "description": "test-gate=existing-tests-must-pass; snapshot=before/after-snapshot-comparison; manual=human-verification"
130
+ },
131
+ "existing_tests": {
132
+ "type": "boolean",
133
+ "description": "Whether existing tests cover the refactored code"
134
+ },
135
+ "new_tests_needed": {
136
+ "type": "array",
137
+ "items": {
138
+ "type": "string"
139
+ },
140
+ "description": "New tests that should be written before refactoring"
141
+ }
142
+ }
143
+ },
144
+ "acceptance_criteria": {
145
+ "type": "array",
146
+ "minItems": 1,
147
+ "items": {
148
+ "type": "string"
149
+ },
150
+ "description": "Conditions that must be met for the refactor to be considered complete"
151
+ },
152
+ "dependencies": {
153
+ "type": "array",
154
+ "items": {
155
+ "type": "string",
156
+ "pattern": "^R-\\d{3}$"
157
+ },
158
+ "description": "IDs of refactors that must be completed before this one"
159
+ },
160
+ "status": {
161
+ "type": "string",
162
+ "enum": [
163
+ "pending",
164
+ "in_progress",
165
+ "completed",
166
+ "failed",
167
+ "skipped",
168
+ "auto_skipped"
169
+ ],
170
+ "description": "Refactor status. Subset of feature status enum."
171
+ },
172
+ "model": {
173
+ "type": "string",
174
+ "description": "AI model ID for this refactor. Overrides $MODEL env var."
175
+ },
176
+ "estimated_lines": {
177
+ "type": "integer",
178
+ "description": "Estimated number of lines affected by this refactor"
179
+ },
180
+ "completion_notes": {
181
+ "type": "array",
182
+ "items": {
183
+ "type": "string"
184
+ },
185
+ "description": "AI-generated summary of key changes from this refactor session. Useful to provide rich dependency context to downstream refactors. Each item is a concise statement about what was refactored (e.g. modules extracted, files restructured, interfaces changed)."
186
+ },
187
+ "user_context": {
188
+ "type": "array",
189
+ "items": { "type": "string" },
190
+ "description": "User-provided supplementary materials, preserved verbatim. Each entry is either inline content/rules (stored as-is) or a file reference (e.g. 'src/auth/login.ts:42-78', 'src/utils/ — focus on validation logic')."
191
+ },
192
+ "critic": {
193
+ "type": "boolean",
194
+ "description": "Enable adversarial plan challenge before implementation. Default: true for critical/high priority refactors, false for others.",
195
+ "default": false
196
+ },
197
+ "critic_count": {
198
+ "type": "integer",
199
+ "description": "Number of parallel critic agents. 1 = single critic, 3 = multi-critic voting. Default: 3 for critical, 1 for high, omit for others.",
200
+ "enum": [
201
+ 1,
202
+ 3
203
+ ]
204
+ },
205
+ "browser_interaction": {
206
+ "type": "object",
207
+ "description": "Browser verification config for refactors affecting UI behavior. Supports playwright-cli and opencli. AI auto-detects dev server command, URL, and port from project config at runtime.",
208
+ "properties": {
209
+ "tool": {
210
+ "type": "string",
211
+ "enum": ["playwright-cli", "opencli", "auto"],
212
+ "default": "auto",
213
+ "description": "Browser tool to use. 'auto' (default) = AI chooses at runtime. 'playwright-cli' = local dev server verification in isolated browser. 'opencli' = reuses Chrome logged-in session, ideal for verifying refactors involving third-party integrations or OAuth flows."
214
+ },
215
+ "verify_steps": {
216
+ "type": "array",
217
+ "description": "Verification goals describing WHAT to verify after refactoring (e.g., 'Navigation still works', 'Form submission succeeds', 'UI renders identically'). AI decides concrete browser tool actions at runtime. If omitted, AI explores the app and verifies no visual or behavioral regressions.",
218
+ "items": {
219
+ "type": "string"
220
+ }
221
+ }
222
+ }
223
+ }
224
+ }
225
+ }
226
+ },
227
+ "global_context": {
228
+ "type": "object",
229
+ "description": "Global context for all refactors in this batch",
230
+ "properties": {
231
+ "tech_stack": {
232
+ "type": "string"
233
+ },
234
+ "language": {
235
+ "type": "string"
236
+ },
237
+ "runtime": {
238
+ "type": "string"
239
+ },
240
+ "frontend_framework": {
241
+ "type": "string"
242
+ },
243
+ "frontend_styling": {
244
+ "type": "string"
245
+ },
246
+ "backend_framework": {
247
+ "type": "string"
248
+ },
249
+ "database": {
250
+ "type": "string"
251
+ },
252
+ "orm": {
253
+ "type": "string"
254
+ },
255
+ "testing_strategy": {
256
+ "type": "string"
257
+ },
258
+ "bundler": {
259
+ "type": "string"
260
+ },
261
+ "project_type": {
262
+ "type": "string"
263
+ },
264
+ "ci_pipeline": {
265
+ "type": "string"
266
+ }
267
+ }
268
+ }
269
+ }
270
+ }
@@ -0,0 +1,13 @@
1
+ ## Acceptance Criteria Verification Checklist
2
+
3
+ This checklist is auto-generated from feature.acceptance_criteria. The Dev agent must verify each criterion and mark as complete:
4
+
5
+ {{AC_CHECKLIST}}
6
+
7
+ **Verification Gates**:
8
+ 1. All [x] items confirmed by Dev agent during implementation
9
+ 2. Reviewer agent verifies checklist is 100% complete before clearing PASS verdict
10
+ 3. Any unmet AC ([ ] remaining) marks feature as incomplete
11
+
12
+ ---
13
+