prizmkit 1.1.0 → 1.1.3

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 (95) 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 +6 -0
  19. package/bundled/dev-pipeline/{run.sh → run-feature.sh} +31 -31
  20. package/bundled/dev-pipeline/run-refactor.sh +787 -0
  21. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +177 -10
  22. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +419 -0
  23. package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +393 -0
  24. package/bundled/dev-pipeline/scripts/update-refactor-status.py +726 -0
  25. package/bundled/dev-pipeline/templates/agent-prompts/critic-code-challenge.md +13 -0
  26. package/bundled/dev-pipeline/templates/agent-prompts/critic-plan-challenge.md +7 -0
  27. package/bundled/dev-pipeline/templates/agent-prompts/dev-fix.md +7 -0
  28. package/bundled/dev-pipeline/templates/agent-prompts/dev-implement.md +26 -0
  29. package/bundled/dev-pipeline/templates/agent-prompts/dev-resume.md +5 -0
  30. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-analyze.md +5 -0
  31. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-review.md +12 -0
  32. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +29 -2
  33. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +8 -7
  34. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +11 -10
  35. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +2 -3
  36. package/bundled/dev-pipeline/templates/feature-list-schema.json +1 -1
  37. package/bundled/dev-pipeline/templates/refactor-list-schema.json +159 -0
  38. package/bundled/dev-pipeline/templates/sections/ac-verification-checklist.md +13 -0
  39. package/bundled/dev-pipeline/templates/sections/feature-context.md +1 -1
  40. package/bundled/dev-pipeline/templates/sections/phase-analyze-agent.md +9 -8
  41. package/bundled/dev-pipeline/templates/sections/phase-analyze-full.md +9 -8
  42. package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +2 -1
  43. package/bundled/dev-pipeline/templates/sections/phase-critic-code.md +8 -10
  44. package/bundled/dev-pipeline/templates/sections/phase-critic-plan-full.md +9 -10
  45. package/bundled/dev-pipeline/templates/sections/phase-critic-plan.md +8 -9
  46. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +7 -10
  47. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +8 -15
  48. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +7 -12
  49. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +8 -19
  50. package/bundled/dev-pipeline/templates/sections/test-failure-recovery.md +75 -0
  51. package/bundled/skills/_metadata.json +33 -6
  52. package/bundled/skills/app-planner/SKILL.md +105 -320
  53. package/bundled/skills/app-planner/assets/app-design-guide.md +101 -0
  54. package/bundled/skills/app-planner/references/frontend-design-guide.md +1 -1
  55. package/bundled/skills/app-planner/references/project-brief-guide.md +49 -80
  56. package/bundled/skills/bug-fix-workflow/SKILL.md +2 -2
  57. package/bundled/skills/bug-planner/SKILL.md +68 -5
  58. package/bundled/skills/bug-planner/scripts/validate-bug-list.py +3 -2
  59. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +19 -5
  60. package/bundled/skills/{dev-pipeline-launcher → feature-pipeline-launcher}/SKILL.md +32 -32
  61. package/bundled/skills/feature-planner/SKILL.md +337 -0
  62. package/bundled/skills/{app-planner → feature-planner}/assets/evaluation-guide.md +4 -4
  63. package/bundled/skills/{app-planner → feature-planner}/assets/planning-guide.md +3 -171
  64. package/bundled/skills/{app-planner → feature-planner}/references/browser-interaction.md +6 -5
  65. package/bundled/skills/feature-planner/references/decomposition-patterns.md +75 -0
  66. package/bundled/skills/{app-planner → feature-planner}/references/error-recovery.md +8 -8
  67. package/bundled/skills/{app-planner → feature-planner}/references/incremental-feature-planning.md +1 -1
  68. package/bundled/skills/{app-planner/references/new-app-planning.md → feature-planner/references/new-project-planning.md} +1 -1
  69. package/bundled/skills/{app-planner → feature-planner}/scripts/validate-and-generate.py +4 -4
  70. package/bundled/skills/feature-workflow/SKILL.md +23 -23
  71. package/bundled/skills/prizm-kit/SKILL.md +1 -3
  72. package/bundled/skills/prizmkit-analyze/SKILL.md +2 -5
  73. package/bundled/skills/prizmkit-code-review/SKILL.md +2 -2
  74. package/bundled/skills/prizmkit-committer/SKILL.md +4 -8
  75. package/bundled/skills/prizmkit-deploy/SKILL.md +1 -5
  76. package/bundled/skills/prizmkit-implement/SKILL.md +3 -50
  77. package/bundled/skills/prizmkit-init/SKILL.md +5 -77
  78. package/bundled/skills/prizmkit-plan/SKILL.md +1 -12
  79. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +6 -24
  80. package/bundled/skills/prizmkit-prizm-docs/assets/PRIZM-SPEC.md +21 -0
  81. package/bundled/skills/prizmkit-retrospective/SKILL.md +12 -117
  82. package/bundled/skills/recovery-workflow/SKILL.md +166 -316
  83. package/bundled/skills/recovery-workflow/evals/evals.json +29 -13
  84. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +232 -274
  85. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +352 -0
  86. package/bundled/skills/refactor-planner/SKILL.md +436 -0
  87. package/bundled/skills/refactor-planner/assets/planning-guide.md +292 -0
  88. package/bundled/skills/refactor-planner/references/behavior-preservation.md +301 -0
  89. package/bundled/skills/refactor-planner/references/refactor-scoping-guide.md +221 -0
  90. package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +786 -0
  91. package/bundled/skills/refactor-workflow/SKILL.md +299 -319
  92. package/package.json +1 -1
  93. package/src/clean.js +3 -3
  94. package/src/scaffold.js +6 -6
  95. /package/bundled/skills/{dev-pipeline-launcher → feature-pipeline-launcher}/scripts/preflight-check.py +0 -0
@@ -1,424 +1,404 @@
1
1
  ---
2
2
  name: "refactor-workflow"
3
- tier: 1
4
- description: "End-to-end refactor workflow: structured scoping parallel code & doc analysis collaborative planning implementreviewcommit. 6-phase behavior-preserving pipeline with mandatory test gates. Use this skill whenever the user wants to restructure, clean up, or optimize code without changing behavior. Trigger on: 'refactor', 'clean up code', 'restructure', 'optimize code structure', 'extract module', 'code refactoring'. (project)"
3
+ tier: companion
4
+ description: "One-stop entry point for code refactoring. Brainstorms refactoring goals with the user until fully clarified, then orchestrates refactor-planner refactor-pipeline-launcherexecution. Handles multi-refactor batch development from a single request. Use this skill whenever the user wants to restructure, clean up, or optimize code without changing behavior. Trigger on: 'refactor', 'clean up code', 'restructure', 'optimize code structure', 'extract module', 'code refactoring', 'batch refactor'. (project)"
5
5
  ---
6
6
 
7
- # PrizmKit Refactor Workflow
7
+ # Refactor Workflow
8
8
 
9
- End-to-end orchestration skill for code refactoring and optimization. Chains existing PrizmKit skills into a 6-phase behavior-preserving pipeline with mandatory test gates after each task.
9
+ One-stop entry point for code refactoring. Covers the complete journey from a rough refactoring idea to verified, behavior-preserving code changes: deep goal clarification structured planning → autonomous pipeline execution.
10
10
 
11
- ### When to Use
12
- - User says "refactor", "clean up code", "restructure", "extract module", "code refactoring", "optimize code structure"
11
+ ## When to Use
12
+
13
+ User says:
14
+ - "Refactor the auth module", "Clean up this code", "Restructure the payment service"
15
+ - "Extract shared logic into a separate module", "Optimize code structure"
16
+ - "Batch refactor these modules", "Code refactoring across multiple files"
13
17
  - Code has accumulated tech debt that needs structural improvement
14
18
  - Module needs to be split, merged, or reorganized
15
- - When behavior must remain unchanged but internal quality needs improvement
16
19
 
17
- **Do NOT use when:**
18
- - User wants to add new features (use `feature-workflow`)
20
+ **Do NOT use this skill when:**
21
+ - User only wants to plan refactoring (use `refactor-planner` directly)
22
+ - User only wants to launch pipeline for existing refactor-list.json (use `refactor-pipeline-launcher`)
23
+ - User wants to add features (use `feature-workflow`)
19
24
  - User wants to fix bugs (use `bug-planner` + `bugfix-pipeline-launcher`)
20
- - Change is trivial (single rename, <5 lines) — just do it directly
25
+
26
+ ---
21
27
 
22
28
  ## Overview
23
29
 
24
30
  ```
25
- refactor-workflow
26
- → Phase 0: Branch → refactor/<slug> branch
27
- Phase 1: Understand & Analyze structured scoping + parallel Agent reading + collaborative planning
28
- → Phase 2: Plan → plan.md (including Tasks section)
29
- Phase 3: Implement (code)
30
- → Phase 4: Review → (review report)
31
- Phase 5: Verify & Commit git commit + merge decision
31
+ refactor-workflow <target / goals>
32
+
33
+ ├── Phase 1: Brainstorminteractive Q&A until refactoring goals are clear
34
+
35
+ ├── Phase 2: Plan refactor-planner → refactor-list.json
36
+
37
+ ├── Phase 3: Launchrefactor-pipeline-launcher pipeline execution
38
+
39
+ └── Phase 4: Monitor → track progress → report results
32
40
  ```
33
41
 
34
- ### Pipeline Phases
35
-
36
- | Phase | Name | Skill Used | Artifact |
37
- |-------|------|-----------|----------|
38
- | 0 | Branch Setup | git | → `refactor/<slug>` branch |
39
- | 1 | Understand & Analyze | Interactive scoping + parallel Agent reading + code analysis | → Refactoring scope confirmed + `refactor-analysis.md` |
40
- | 2 | Plan (Refactor Plan & Tasks) | `/prizmkit-plan` | → `plan.md` (with Tasks section) |
41
- | 3 | Implement | `/prizmkit-implement` | (code changes) |
42
- | 4 | Code Review | `/prizmkit-code-review` | (review report) |
43
- | 5 | Verify & Commit | `/prizmkit-committer` | git commit + merge |
44
-
45
- ### Key Principles
46
-
47
- | Principle | Description |
48
- |-----------|-------------|
49
- | **Structured scoping first** | Use structured choices (not open-ended Q&A) to quickly establish refactoring type, scope, and reference materials. |
50
- | **Parallel understanding** | Dispatch multiple Agents concurrently to read code, docs, and knowledge files — don't read sequentially. |
51
- | **Show findings, then collaborate** | Present what the Agents discovered, then work with the user to shape the refactoring plan — don't just ask questions without context. |
52
- | **Behavior preservation** | Refactoring changes structure, not behavior. If tests pass before and after, behavior is preserved. |
53
- | **Test gates** | Full test suite runs after every task — not just at checkpoints. |
54
- | **Structural sync only** | Refactoring triggers `/prizmkit-retrospective` Job 1 (structural sync) — update `.prizm-docs/` to reflect file/interface changes. Skip knowledge injection unless a genuinely new pitfall was discovered. |
55
- | **Incremental safety** | Each task preserves all tests (green → green). If tests fail → stop and revert. |
56
-
57
- ### Artifacts
58
- Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
59
- - **`refactor-analysis.md`** — Scoping + code analysis (Phase 1)
60
- - **`plan.md`** — Refactoring plan with Tasks section (Phase 2)
61
-
62
- **PRECONDITION:**
63
-
64
- | Required | Check | If Missing |
65
- |---|---|---|
66
- | Refactoring target (module path, file path, or natural language description) | User provides target in request | Ask: "What module or code do you want to refactor?" |
67
- | Test suite exists for target module | Tests can be located and run | WARN user, recommend writing tests first before refactoring |
68
- | No uncommitted changes on current branch | `git status` is clean | Ask user to commit or stash changes first |
69
-
70
- **INPUT**: Target description. Can be:
71
- - Module or file path (e.g., "src/auth/")
72
- - Natural language description (e.g., "refactor the auth module, extract shared logic")
73
- - Specific refactoring goal (e.g., "extract payment processing into separate service")
42
+ ### What This Skill Does
74
43
 
75
- ---
44
+ | Phase | Action | Result |
45
+ |-------|--------|--------|
46
+ | 1 | **Brainstorm** — interactive Q&A with user | Fully clarified refactoring goals |
47
+ | 2 | Call `refactor-planner` with clarified goals | `refactor-list.json` with N refactor items |
48
+ | 3 | Call `refactor-pipeline-launcher` | Pipeline started (execution mode chosen by user via launcher) |
49
+ | 4 | Monitor progress | Status updates, completion report |
76
50
 
77
- ## Phase 0: Branch Setup
51
+ ### Why This Skill Exists
78
52
 
79
- **Goal**: Create an isolated working branch to keep main clean.
53
+ Without this skill, users must:
54
+ 1. Figure out all refactoring goals and scope themselves
55
+ 2. Invoke `refactor-planner` → wait for refactor-list.json
56
+ 3. Invoke `refactor-pipeline-launcher` → wait for pipeline start
57
+ 4. Manually check progress
80
58
 
81
- 1. **Check current branch**:
82
- ```bash
83
- git branch --show-current
84
- ```
85
- 2. **If on `main` or a shared branch**: Create and switch to refactor branch:
86
- ```bash
87
- git checkout -b refactor/<refactor-slug>
88
- ```
89
- Example: `git checkout -b refactor/extract-auth-middleware`
90
- 3. **If already on a refactor branch**: Confirm with user: "Continue on current branch `<branch-name>`, or create a new one?"
91
- 4. **Record the original branch name** for later merge.
59
+ With this skill, users can:
60
+ 1. Say "Refactor the auth module to extract shared middleware" with a rough idea
61
+ 2. The skill brainstorms to fill in all gaps (scope, risks, behavior contracts)
62
+ 3. All planning + execution happens automatically
63
+
64
+ ### Branch Management
92
65
 
93
- **CHECKPOINT CP-RW-0**: On a dedicated refactor branch, not main/shared branch.
66
+ The dev-pipeline handles branch management per-refactor automatically:
67
+ - Each refactor item is implemented on its own branch by the pipeline
68
+ - Branches are created, committed, and managed by the pipeline session
69
+ - This workflow does NOT create a top-level branch — the pipeline manages granular per-refactor branches
94
70
 
95
71
  ---
96
72
 
97
- ## Phase 1: Understand & Analyze
73
+ ## Input Modes
98
74
 
99
- **Goal**: Through structured choices, parallel Agent reading, and collaborative discussion, fully understand the refactoring scope and produce a code analysis — all in one integrated phase.
75
+ **Mode A: From natural language description** (default)
100
76
 
101
- **CRITICAL RULE**: This phase has 5 steps executed in order. Do NOT skip to planning without completing all steps, especially the parallel reading and collaborative discussion.
77
+ Natural language description of the refactoring goals. Can be:
78
+ - A module target: "Refactor the auth module — extract shared middleware, simplify the token flow"
79
+ - A batch of refactors: "Clean up the payment service, decouple the notification module, and extract common utilities"
80
+ - An incremental request: "Also refactor the logging layer to use structured logging"
102
81
 
103
- ### Step 1.1: Refactoring Type Selection
82
+ Flow: brainstorm refactor-planner refactor-pipeline-launcher → monitor
104
83
 
105
- Present the user with a structured choice to establish the refactoring approach:
84
+ **Mode B: From existing refactor-list.json**
106
85
 
107
- Ask the user to choose:
108
- - **(a) Incremental refactoring** — Gradual, low-risk improvements. Refactor piece by piece, each step independently deployable.
109
- - **(b) Full refactoring** — Comprehensive restructuring of the entire target area. Higher risk, bigger payoff.
110
- - **(c) Targeted refactoring** — Focus on a specific part or concern (e.g., extract one module, decouple one dependency, simplify one flow).
86
+ When user says "run pipeline from existing file" or refactor-list.json already exists:
87
+ - Skip brainstorm and `refactor-planner` (file already exists)
88
+ - Invoke `refactor-pipeline-launcher` directly
89
+ - Monitor and report progress
111
90
 
112
- Follow up based on choice:
113
- - If **(a)**: Ask which area to start with, and what the incremental milestones should be
114
- - If **(b)**: Confirm the full scope boundary — what's included and what's explicitly excluded
115
- - If **(c)**: Confirm the specific target and the expected outcome
91
+ **Mode C: Incremental (add to existing refactor plan)**
116
92
 
117
- ### Step 1.2: Reference Materials Collection
93
+ When user says "add more refactors" or the project already has a refactor-list.json:
94
+ - Brainstorm new refactoring goals with the user
95
+ - Invoke `refactor-planner` in incremental mode (reads existing refactor-list.json)
96
+ - Append new refactor items to existing list
97
+ - Invoke `refactor-pipeline-launcher`
98
+ - Monitor and report progress
118
99
 
119
- Ask the user if they have supplementary materials that can inform the refactoring:
100
+ ---
120
101
 
121
- Present as a multi-select checklist:
122
- - **Code paths** — Specific files or directories to focus on (e.g., `src/auth/`, `lib/payment.js`)
123
- - **Refactoring-related documents** — Design docs, RFCs, architecture proposals, migration guides
124
- - **Existing knowledge docs** — `.prizm-docs/`, ADRs, inline documentation, wiki pages, or team notes about the target area
125
- - **None** — No additional materials, rely on code reading
102
+ ## Phase 1: Brainstorm — Deep Refactoring Goal Clarification
126
103
 
127
- For each item the user provides, record the path or description for the next step.
104
+ **Goal**: Through interactive Q&A, transform the user's rough refactoring idea into fully clarified, implementation-ready refactoring goals. This phase is the foundation for safe, behavior-preserving code changes — vague goals produce risky refactors.
128
105
 
129
- ### Step 1.3: Parallel Agent Reading
106
+ **CRITICAL RULE**: The number of questions is **unlimited**. Do NOT rush through this phase. Ask as many rounds as needed until every aspect is clear. Refactoring is inherently risky — thorough understanding prevents broken behavior.
130
107
 
131
- Based on the user's selections in Steps 1.1 and 1.2, dispatch **multiple Agents in parallel** to read and analyze:
108
+ ### Step 1.1: Understand the User's Refactoring Goals
132
109
 
133
- **Agent allocation strategy:**
134
- - **Agent A (Code Structure)**: Read the target code files understand architecture, dependencies (incoming/outgoing), module boundaries, public API surface
135
- - **Agent B (Documentation)**: Read any user-provided docs + relevant `.prizm-docs/` (TRAPS, PATTERNS, RULES) + TODO/FIXME/HACK comments in target code
136
- - **Agent C (Test Baseline)**: Locate and run test suites for the target area — record pass/fail counts, identify pre-existing failures, assess coverage
110
+ Ask the user to describe what they want to refactor. Listen for:
111
+ - **What** code needs restructuring (modules, files, patterns)
112
+ - **Why** it needs refactoring (tech debt, coupling, complexity, readability, performance structure)
113
+ - **What outcome** they want (target architecture, desired structure, quality goals)
137
114
 
138
- If the user provided no docs (chose "None" in Step 1.2), Agent B focuses entirely on `.prizm-docs/` and inline code comments.
115
+ ### Step 1.2: Context Gathering
139
116
 
140
- **Each Agent produces a structured summary:**
141
- - Agent A: file inventory, dependency graph, complexity hotspots, code smells
142
- - Agent B: known traps, architectural decisions, existing knowledge about the target
143
- - Agent C: test suite status (total/passing/failing), coverage estimate, behavior contracts
117
+ Before asking detailed questions, gather existing project context:
118
+ - If `.prizm-docs/root.prizm` exists read it to understand existing architecture, tech stack, patterns
119
+ - If `.prizmkit/config.json` exists read tech stack preferences
120
+ - If existing source code exists scan directory structure:
121
+ ```bash
122
+ find . -maxdepth 2 -type d -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/dist/*' -not -path '*/build/*' -not -path '*/__pycache__/*' -not -path '*/vendor/*' | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
123
+ ```
124
+ - Check test suite existence and coverage for the target area:
125
+ ```bash
126
+ find . -maxdepth 4 -type f \( -name "*.test.*" -o -name "*.spec.*" -o -name "test_*" -o -path "*/tests/*" -o -path "*/__tests__/*" \) -not -path '*/node_modules/*' -not -path '*/.git/*' | head -20
127
+ ```
144
128
 
145
- ### Step 1.4: Present Findings & Collaborative Planning
129
+ This context informs better questions — e.g., if the target module has no tests, the conversation must address test coverage before refactoring.
146
130
 
147
- After all Agents complete, **present a consolidated findings report** to the user:
131
+ ### Step 1.3: Adaptive Deep-Dive Questioning
148
132
 
149
- ```
150
- ## Refactoring Findings
151
-
152
- ### Code Structure (Agent A)
153
- - [file inventory, dependency graph, complexity metrics]
154
- - [identified code smells: long functions, deep nesting, duplication, coupling]
155
-
156
- ### Existing Knowledge (Agent B)
157
- - [known traps and risks from docs]
158
- - [relevant architectural decisions]
159
- - [user-provided doc insights]
160
-
161
- ### Test Baseline (Agent C)
162
- - [test suite status: X total, Y passing, Z failing]
163
- - [coverage estimate]
164
- - [behavior contracts to preserve]
165
-
166
- ### Recommended Refactoring Approach
167
- - [based on findings, propose concrete refactoring strategy]
168
- - [identify highest-impact opportunities]
169
- - [flag risks and cross-module impacts]
170
- ```
133
+ Based on the user's description, ask questions across these dimensions. **Adapt question depth to the refactoring complexity** — a simple extract-method refactor needs fewer questions than a full module decomposition.
171
134
 
172
- Then engage the user in **collaborative discussion**:
173
- - "Based on these findings, here's what I recommend for the refactoring approach. What do you think?"
174
- - Discuss priorities: which improvements matter most?
175
- - Discuss constraints: any areas that are off-limits?
176
- - Discuss risks: how to handle fragile or undocumented areas?
177
- - If the scope needs adjustment based on findings, negotiate with the user
135
+ **Code Structure:**
136
+ - What's wrong with the current structure? What specific pain points exist?
137
+ - What's the target state? What should the code look like after refactoring?
138
+ - Are there specific code smells? (duplication, deep nesting, god classes, tight coupling)
139
+ - What are the dependency relationships between the target and other modules?
178
140
 
179
- ### Step 1.5: Confirm & Generate Analysis
141
+ **Scope:**
142
+ - Which files/modules are in scope? Which are explicitly out of scope?
143
+ - Is this a single-module refactor or does it span multiple modules?
144
+ - Should the refactoring be incremental (piece by piece) or comprehensive?
180
145
 
181
- After the collaborative discussion concludes:
146
+ **Behavior Preservation:**
147
+ - What behavior must stay identical? Are there contracts/APIs that must not change?
148
+ - What tests exist for the target area? Are they passing currently?
149
+ - Are there integration tests or end-to-end tests that cover this area?
150
+ - Any undocumented behavior that callers depend on?
182
151
 
183
- 1. **Ask the user**: "Is there anything else you'd like to add or adjust before we finalize the refactoring scope?"
184
- 2. **If yes**: Incorporate feedback, revisit relevant points
185
- 3. **If no**: Generate `refactor-analysis.md` at `.prizmkit/refactor/<refactor-slug>/refactor-analysis.md`
152
+ **Risk Assessment:**
153
+ - What could break? Are there fragile or undocumented areas?
154
+ - Are there known gotchas or traps in this code? (check `.prizm-docs/` TRAPS)
155
+ - Does this code have external consumers (other teams, published APIs)?
156
+ - Any concurrent development happening in the target area?
186
157
 
187
- **`refactor-analysis.md` required sections:**
188
- - **Refactoring Type**: Incremental / Full / Targeted (from Step 1.1)
189
- - **Current State**: module overview, file inventory, dependency graph, complexity metrics (from Agent A)
190
- - **Refactoring Goals**: what structural improvements are targeted, why — aligned with collaborative discussion
191
- - **Risk Assessment**: what could break, cross-module impact, fragile areas (from Agent B + discussion)
192
- - **Baseline Tests**: test suite status, coverage estimate, behavior contracts to preserve (from Agent C)
193
- - **Scope Boundary**: what IS in scope, what is explicitly OUT of scope — confirmed with user
194
- - **Reference Materials**: list of docs/paths the user provided and key insights from each
158
+ **Constraints:**
159
+ - Timeline or urgency? (affects whether to do incremental vs comprehensive)
160
+ - Team coordination needed? (other developers working in the same area)
161
+ - Deployment concerns? (feature flags, backward compatibility, migration)
195
162
 
196
- **CHECKPOINT CP-RW-1**: `refactor-analysis.md` exists with confirmed scope, baseline test results, and user agreement.
163
+ ### Step 1.4: Iterative Clarification Loop
197
164
 
198
- ---
165
+ After the initial deep-dive:
199
166
 
200
- ## Phase 2: PlanRefactor Plan & Tasks
167
+ 1. **Summarize** what you've understood so far present it back to the user
168
+ 2. **Identify gaps** — explicitly list any areas that are still unclear or ambiguous
169
+ 3. **Ask follow-up questions** for each gap
170
+ 4. **Repeat** until the user confirms: "Yes, that covers everything" or "That's clear enough"
201
171
 
202
- **Goal**: Generate technical refactoring plan that preserves behavior, including task breakdown.
172
+ **Signs that brainstorming is complete:**
173
+ - All refactoring goals have concrete target state descriptions
174
+ - Scope boundaries are clearly defined (in/out)
175
+ - Behavior preservation contracts are identified
176
+ - Risk areas are acknowledged and mitigation is discussed
177
+ - The user has confirmed the summary is accurate
203
178
 
204
- **STEPS:**
179
+ **Signs that more questions are needed:**
180
+ - User's answers contain vague terms ("clean it up", "make it better", "fix the structure")
181
+ - Scope is undefined ("refactor everything" without specifics)
182
+ - No awareness of test coverage for the target area
183
+ - Risk areas are handwaved ("it should be fine")
184
+ - User says "I'm not sure" — help them think through it with concrete options
205
185
 
206
- 1. **Read context**: refactor-analysis.md, `.prizm-docs/` (PATTERNS, RULES, TRAPS)
207
- 2. **Invoke `/prizmkit-plan`** with refactor-analysis.md as input (in place of spec.md):
208
- - Plan specifies: what changes, what stays the same, how behavior is preserved
209
- - plan.md Tasks section: each task is independently testable and preserves all tests (green → green) — this ensures any failure is immediately traceable to the task that caused it
210
- - Artifact path: `.prizmkit/refactor/<refactor-slug>/plan.md`
211
- 3. **Verify plan constraints**:
212
- - All public API contracts preserved (unless explicitly agreed in Phase 1 to change)
213
- - Test strategy: how to verify behavior unchanged at each step
214
- - Rollback strategy: how to revert if behavior breaks
215
- - Tasks ordered to minimize risk (safe renames first, structural changes later)
216
- - Every task ends with "run full test suite"
186
+ ### Step 1.5: Requirements Summary
217
187
 
218
- **CHECKPOINT CP-RW-2**: `plan.md` exists with behavior preservation strategy and Tasks section.
188
+ Once brainstorming is complete, produce a structured goals summary:
219
189
 
220
- ---
190
+ ```markdown
191
+ ## Refactoring Goals Summary
192
+
193
+ ### Target: [Module/area name]
194
+
195
+ ### Refactoring Objectives
196
+ - [Bullet list of what structural changes are needed and why]
197
+
198
+ ### Current Problems
199
+ - [What's wrong with the current structure]
200
+
201
+ ### Target State
202
+ - [What the code should look like after refactoring]
203
+
204
+ ### Scope
205
+ - **In scope**: [files, modules, directories]
206
+ - **Out of scope**: [explicitly excluded areas]
221
207
 
222
- ## Phase 3: Implement
208
+ ### Behavior Preservation Contracts
209
+ - [What behavior must remain unchanged]
210
+ - [Key APIs/interfaces that must be preserved]
211
+ - [Existing test coverage status]
223
212
 
224
- **Goal**: Execute refactoring tasks with mandatory test verification after each task.
213
+ ### Risk Assessment
214
+ - [Risk]: [Mitigation strategy]
225
215
 
226
- **STEPS:**
216
+ ### Constraints
217
+ - [Timeline, coordination, deployment concerns]
227
218
 
228
- 1. **For EACH task in plan.md Tasks section**:
229
- a. Implement the refactoring change
230
- b. **Run FULL test suite** (not just affected tests) — refactoring can have surprising cross-module effects that targeted tests miss
231
- c. Verify: all previously-passing tests still pass
232
- d. If any test fails → stop, revert task, investigate
233
- 2. **Progress tracking**:
234
- - Mark tasks complete in plan.md Tasks section as they finish
235
- - Record test results after each task
219
+ ### Confirmed by user:
220
+ ```
236
221
 
237
- **CHECKPOINT CP-RW-3**: All tasks complete, full test suite green.
222
+ Present this summary to the user and get explicit confirmation before proceeding to Phase 2.
238
223
 
239
- **Important constraints for Phase 3:**
240
- - Never skip the test gate between tasks — a broken intermediate state compounds into much harder debugging later
241
- - Never allow temporary test failures ("we'll fix it in the next task") — this assumption is almost always wrong in refactoring
242
- - If a task cannot be completed without breaking tests → split it into smaller tasks
243
- - Max 3 attempts per task before escalating to user
224
+ **CHECKPOINT CP-RW-0**: Refactoring goals fully clarified and confirmed by user.
244
225
 
245
226
  ---
246
227
 
247
- ## Phase 4: Code Review
228
+ ## Phase 2: Plan
229
+
230
+ **Goal**: Generate structured refactor-list.json from the clarified refactoring goals.
231
+
232
+ **STEPS**:
248
233
 
249
- **Goal**: Verify refactoring quality and behavior preservation.
234
+ 1. **Invoke `refactor-planner` skill** with the full goals summary from Phase 1:
235
+ - Pass the structured goals summary as input — NOT the raw user conversation
236
+ - For new refactoring: standard planning mode
237
+ - For existing projects with `--incremental`: incremental planning mode
250
238
 
251
- **STEPS:**
239
+ 2. **Interactive planning** (if refactor-planner requires clarification):
240
+ - Because Phase 1 was thorough, refactor-planner should need minimal clarification
241
+ - If questions arise, answer from the Phase 1 context or pass through to user
252
242
 
253
- 1. **Invoke `/prizmkit-code-review`** (scoped to changed files, both phases):
254
- - Review dimensions for refactoring:
255
- - **Behavior preservation**: Does observable behavior remain identical?
256
- - **Structural improvement**: Is the code measurably better? (complexity, coupling, readability)
257
- - **Test integrity**: Are all tests still meaningful and passing?
258
- - **Code quality**: Does refactored code follow project conventions?
259
- - If findings exist, produce Fix Instructions with Root Cause, Fix Strategy, and Verification criteria
260
- - Verdict: PASS / PASS_WITH_WARNINGS / NEEDS_FIXES
261
- 2. **Run full test suite one final time**: All tests must pass
262
- 3. **Handle review results**:
263
- - **PASS / PASS_WITH_WARNINGS**: Proceed to Phase 5
264
- - **NEEDS_FIXES**: Return to Phase 3 following Fix Instructions (max 2 review rounds)
243
+ 3. **Validate output**:
244
+ - Confirm `refactor-list.json` exists
245
+ - Show summary: total refactor items, complexity distribution, dependencies
265
246
 
266
- **CHECKPOINT CP-RW-4**: Code review passes, all tests green.
247
+ **CHECKPOINT CP-RW-1**: `refactor-list.json` generated and validated.
248
+
249
+ **If user says `--from <file>`**: Skip Phase 1 and Phase 2 entirely.
267
250
 
268
251
  ---
269
252
 
270
- ## Phase 5: Verify, Commit & Merge
271
-
272
- **Goal**: Let user verify, commit with refactor convention, and merge back.
273
-
274
- **STEPS:**
275
-
276
- 1. **User verification** (optional):
277
- - Ask user: "Refactoring complete and all tests pass. Would you like to verify before committing?"
278
- - **(a) Run the app** — Start dev server for manual verification
279
- - **(b) Run a specific command** — Specify a test or script
280
- - **(c) Skip** — Proceed to commit (tests already pass)
281
- - If user reports issues: return to Phase 3
282
- 2. **Invoke `/prizmkit-retrospective`** (Job 1: structural sync only):
283
- - Update KEY_FILES/INTERFACES/DEPENDENCIES in affected `.prizm-docs/` files
284
- - Skip knowledge injection unless refactoring revealed a genuinely new pitfall (e.g. a non-obvious coupling)
285
- - If structural changes are significant (module split/merge), update L1 doc
286
- - Stage doc changes: `git add .prizm-docs/`
287
- 3. **Invoke `/prizmkit-committer`**:
288
- - Commit message: `refactor(<scope>): <description>`
289
- - Include all refactored code + any test updates
290
- - Do NOT push
291
- 4. **Ask merge preference**:
253
+ ## Phase 3: Launch
254
+
255
+ **Goal**: Start the refactoring pipeline.
256
+
257
+ **STEPS**:
258
+
259
+ 1. **Show refactor summary** before launching:
292
260
  ```
293
- Refactoring committed on branch `refactor/<slug>`.
294
- What would you like to do?
295
- (a) Merge to <original-branch> and delete refactor branch
296
- (b) Keep refactor branch (for PR review workflow)
297
- (c) Decide later
261
+ Ready to launch pipeline with N refactor items:
262
+ R-001: Extract auth middleware (medium complexity)
263
+ R-002: Decouple notification service (high complexity)
264
+ R-003: Simplify token flow (low complexity)
265
+
266
+ Proceed? (Y/n)
298
267
  ```
299
- 5. **If (a)**:
268
+
269
+ 2. **Invoke `refactor-pipeline-launcher` skill**:
270
+ - The launcher handles all prerequisites checks
271
+ - The launcher presents execution mode choices to the user (foreground/background/manual)
272
+ - Do NOT duplicate execution mode selection here — let the launcher handle it
273
+ - Returns PID/status and log file location
274
+
275
+ 3. **Verify launch success**:
276
+ - Confirm pipeline is running
277
+ - Record PID and log path for Phase 4
278
+
279
+ **CHECKPOINT CP-RW-2**: Pipeline launched successfully.
280
+
281
+ ---
282
+
283
+ ## Phase 4: Monitor
284
+
285
+ **Goal**: Track pipeline progress and report to user.
286
+
287
+ **STEPS**:
288
+
289
+ 1. **Initial status check**:
300
290
  ```bash
301
- git checkout <original-branch>
302
- git merge refactor/<slug>
303
- git branch -d refactor/<slug>
291
+ dev-pipeline/launch-refactor-daemon.sh status
304
292
  ```
305
- 6. **If (b)**: Inform user: "Branch `refactor/<slug>` retained. Create a PR when ready."
306
293
 
307
- **CHECKPOINT CP-RW-5**: Commit recorded with `refactor()` prefix. Merge decision made.
294
+ 2. **Offer monitoring options**:
295
+ - "I'll check progress periodically. Say 'status' anytime for an update."
296
+ - "Say 'logs' to see recent activity."
297
+ - "Say 'stop' to pause the pipeline."
308
298
 
309
- ---
299
+ 3. **Periodic progress reports** (when user asks):
300
+ ```bash
301
+ python3 dev-pipeline/scripts/update-refactor-status.py \
302
+ --refactor-list refactor-list.json \
303
+ --state-dir dev-pipeline/refactor-state \
304
+ --action status
305
+ ```
310
306
 
311
- ## Fast Path
307
+ 4. **Completion report** (when pipeline finishes all refactor items):
308
+ ```
309
+ Pipeline completed: 3/3 refactor items
312
310
 
313
- For single-file refactoring (rename, extract method, <30 lines changed):
311
+ Summary:
312
+ - R-001: Extract auth middleware → COMMITTED (refactor(auth): extract shared middleware)
313
+ - R-002: Decouple notification service → COMMITTED (refactor(notifications): decouple from core)
314
+ - R-003: Simplify token flow → COMMITTED (refactor(auth): simplify token refresh)
314
315
 
315
- ```
316
- Phase 0 (Branch) Phase 1 (Simplified) → Phase 2 (Simplified Plan) → Phase 3 (Implement) → Phase 4 (Review) → Phase 5 (Commit & Merge)
317
- ```
316
+ Next steps:
317
+ - Review changes: git log --oneline -5
318
+ - Run tests: npm test
319
+ - Push when ready: git push
320
+ ```
318
321
 
319
- Phase 1 is simplified: skip parallel Agents, use a quick 2-3 question confirmation instead. Skip detailed doc collection. Still generate a lightweight `refactor-analysis.md`.
320
-
321
- **CRITERIA** (ALL must be true):
322
- - Single file change
323
- - Estimated change < 30 lines
324
- - Well-known refactoring pattern (rename, extract method/class, inline, move)
325
- - No cross-module impact
326
- - No dependency changes
327
-
328
- **Fast Path implementation differs from full path:**
329
- - Phase 1 Steps 1.2-1.3 are skipped (no doc collection, no parallel Agents)
330
- - Step 1.1 simplified to quick confirmation of refactoring goal
331
- - Step 1.4 simplified to brief scope confirmation
332
- - Phase 2 is simplified: generate a lightweight plan.md with 1-2 tasks directly from refactor-analysis.md
333
- - Phase 3 still reads plan.md Tasks as normal, marks tasks `[x]` on completion
334
- - Single-task refactors typically have just one task in plan.md
335
-
336
- **Fast Path still requires:**
337
- - Refactor branch (Phase 0)
338
- - Scope confirmation (Phase 1, simplified)
339
- - refactor-analysis.md (lightweight version with baseline)
340
- - plan.md (simplified, 1-2 tasks)
341
- - Full test suite run after implementation
342
- - Code review
343
- - `refactor(<scope>):` commit convention
344
- - Merge decision
322
+ **CHECKPOINT CP-RW-3**: All refactor items completed or user stopped pipeline.
345
323
 
346
324
  ---
347
325
 
348
326
  ## Resume — Interruption Recovery
349
327
 
350
- The pipeline supports resuming from the last completed phase by detecting existing artifacts.
328
+ The workflow supports resuming by detecting existing state:
329
+
330
+ | State Found | Resume From |
331
+ |-------------|------------|
332
+ | No `refactor-list.json` | Phase 1: Brainstorm |
333
+ | `refactor-list.json` exists, no pipeline state | Phase 3: Launch |
334
+ | `refactor-list.json` + pipeline state exists | Phase 4: Monitor (check status) |
335
+ | All refactors completed | Report completion, suggest next steps |
351
336
 
352
- **Detection logic**: Check `.prizmkit/refactor/<slug>/` and git branch state:
337
+ **Resume**: If `refactor-list.json` exists, ask user: "Existing refactor plan found with N items. Resume pipeline or re-plan?"
353
338
 
354
- | Artifact Found | Resume From |
355
- |---------------|------------|
356
- | (nothing) | Phase 0: Branch Setup |
357
- | On `refactor/<slug>` branch, no artifacts | Phase 1: Understand & Analyze |
358
- | `refactor-analysis.md` only | Phase 2: Plan |
359
- | `refactor-analysis.md` + `plan.md` | Phase 3: Implement |
360
- | All docs + code changes exist | Phase 4: Review |
361
- | All docs + review passed | Phase 5: Verify & Commit |
339
+ ---
340
+
341
+ ## Interaction During Pipeline
342
+
343
+ While the pipeline runs, the user can continue the conversation:
362
344
 
363
- **Resume**: If `<slug>` matches an existing `.prizmkit/refactor/<slug>/` directory, resume instead of starting fresh.
345
+ | User says | Action |
346
+ |-----------|--------|
347
+ | "status" / "progress" | Show current progress |
348
+ | "logs" | Show recent log activity |
349
+ | "stop" | Stop the pipeline (state preserved) |
350
+ | "show R-002 logs" | Show specific refactor item's session log |
364
351
 
365
352
  ---
366
353
 
367
354
  ## Error Handling
368
355
 
369
- | Scenario | Action |
370
- |----------|--------|
371
- | Cannot identify target module | Ask user for clarification |
372
- | User's refactoring goal is unclear | Use Step 1.1 structured choices to narrow down |
373
- | No tests exist for target module | WARN user, recommend writing tests first |
374
- | Baseline tests already failing | Isolate failures, document, proceed with caution |
375
- | Parallel Agent fails to read a file | Log warning, continue with available results, notify user |
376
- | Test fails after a refactoring task | Revert task, investigate, retry or split |
377
- | Implementation fails after 3 rounds | Escalate to user with analysis |
378
- | Review fails after 2 rounds | Escalate with review findings |
379
- | Refactoring creates circular dependency | STOP, revise plan |
380
- | Performance regression detected | STOP, investigate, revise approach |
381
- | Branch conflict during merge | Show conflict, ask user to resolve or keep branch |
356
+ | Error | Action |
357
+ |-------|--------|
358
+ | User's refactoring goal is too vague | Ask for more context: "Can you describe what's wrong with the current code structure?" |
359
+ | Brainstorming stalls | Offer concrete options: "Would you prefer incremental or comprehensive refactoring?" |
360
+ | No tests exist for target module | WARN user, recommend writing tests first before refactoring |
361
+ | `refactor-planner` cannot parse goals | Refine the goals summary and retry |
362
+ | `refactor-list.json` generation failed | Show error, retry with refined input |
363
+ | Pipeline launch failed | Show daemon log, suggest manual start |
364
+ | All refactor items blocked/failed | Show status, suggest retrying specific items |
365
+ | User wants to cancel mid-brainstorming | Save conversation context, offer to resume later |
366
+ | Behavior regression detected during pipeline | Pipeline handles per-item — failed items are retried or reported |
382
367
 
383
368
  ---
384
369
 
385
370
  ## Relationship to Other Skills
386
371
 
387
- | Skill | Role in Refactor Workflow |
388
- |-------|-----------------------------|
389
- | (parallel Agents) | Phase 1: concurrent code & doc reading |
390
- | `/prizmkit-plan` | Phase 2: refactoring plan + task generation |
391
- | `/prizmkit-implement` | Phase 3: execute refactoring tasks |
392
- | `/prizmkit-code-review` | Phase 4: review quality and behavior preservation |
393
- | `/prizmkit-committer` | Phase 5: commit with `refactor()` convention |
394
- | `/prizmkit-retrospective` | Phase 5: structural sync before commit (Job 1 only, skip knowledge injection unless new pitfall) |
395
- | `feature-workflow` | Handoff target when new behavior is needed |
396
- | `/prizmkit-plan` | NOT used (no user stories for refactoring) |
397
- | `/prizmkit-analyze` | NOT used (no spec <-> plan consistency needed) |
372
+ | Skill | Relationship |
373
+ |-------|-------------|
374
+ | `refactor-planner` | **Called by Phase 2** generates refactor-list.json from clarified goals |
375
+ | `refactor-pipeline-launcher` | **Called by Phase 3** starts pipeline (handles execution mode selection) |
376
+ | `feature-workflow` | **Alternative** for new feature development |
377
+ | `bug-fix-workflow` | **Alternative** for bug fix workflows |
398
378
 
399
379
  ---
400
380
 
401
- ## Comparison with Feature and Bug Fix Pipelines
402
-
403
- | Dimension | Feature Workflow | Refactor Workflow | Bug Fix Workflow |
404
- |-----------|-----------------|-------------------|------------------|
405
- | Input | Natural language requirement | Module/code target | Bug description |
406
- | Deep Q&A | Yes (brainstorm) | Yes (structured scoping + parallel analysis) | Yes (diagnosis) |
407
- | Branch | Pipeline manages per-feature | `refactor/<slug>` | `fix/<BUG_ID>-*` |
408
- | Pipeline Phases | 4 (brainstorm plan → launch → monitor) | 6 (branch understand & analyze → plan → implement → review → commit) | 8 (branch → diagnose → triage → reproduce → fix → review → verify → commit) |
409
- | Phase 1 | Brainstorm (requirements Q&A) | Understand & Analyze (structured scoping + parallel reading + collaborative planning) | Deep Bug Diagnosis (symptom Q&A) |
410
- | Artifact Path | `.prizmkit/specs/<slug>/` | `.prizmkit/refactor/<slug>/` | `.prizmkit/bugfix/<id>/` |
411
- | Commit Prefix | `feat(<scope>):` | `refactor(<scope>):` | `fix(<scope>):` |
412
- | Test Strategy | TDD per task | Full suite after EVERY task | Reproduction test |
413
- | Scope Guard | N/A | Enforced | N/A |
414
- | Behavior Change | Expected | Forbidden | Fix behavior |
415
- | User Verification | Yes (brainstorm confirmation) | Yes (Phase 5) | Yes (Phase 6) |
381
+ ## Comparison with Alternative Workflows
382
+
383
+ | Dimension | refactor-workflow | feature-workflow | bug-fix-workflow |
384
+ |-----------|-------------------|-----------------|------------------|
385
+ | **Purpose** | Code restructuring (batch) | New features (batch) | Single bug fix (interactive) |
386
+ | **Brainstorming** | Yes — deep interactive Q&A on refactoring goals | Yes deep interactive Q&A on requirements | No (bug report is input) |
387
+ | **Planning Skill** | `refactor-planner` | `feature-planner` | None (triage built-in) |
388
+ | **Branch** | Pipeline manages per-refactor | Pipeline manages per-feature | `fix/<BUG_ID>-*` |
389
+ | **Execution** | Foreground or background daemon | Foreground or background daemon | In-session, interactive |
390
+ | **Input** | Rough refactoring idea or target | Rough idea or requirements | Bug report / stack trace |
391
+ | **Output** | Multiple `refactor()` commits | Multiple `feat()` commits | Single `fix()` commit |
392
+ | **Behavior Change** | Forbidden (structure only) | Expected (new functionality) | Fix behavior |
393
+ | **Batch alternative** | (this is the batch flow) | (this is the batch flow) | `bug-planner` + `bugfix-pipeline-launcher` |
394
+
395
+ ---
416
396
 
417
397
  ## Output
418
398
 
419
- - `refactor-analysis.md` (Phase 1 artifact)
420
- - `plan.md` with Tasks section (Phase 2 artifact)
421
- - Refactored implementation code (Phase 3)
422
- - Code review report (Phase 4, conversation only)
423
- - Git commit with `refactor(<scope>):` prefix on dedicated refactor branch (Phase 5)
424
- - Updated `.prizm-docs/` (if applicable)
399
+ - Structured refactoring goals summary (Phase 1 artifact)
400
+ - `refactor-list.json` (Phase 2 artifact)
401
+ - Pipeline execution (Phase 3)
402
+ - Progress updates (Phase 4)
403
+ - Multiple git commits with `refactor(<scope>):` prefix
404
+ - Updated `.prizm-docs/` (via prizmkit-retrospective per refactor item)