prizmkit 1.1.111 → 1.1.112

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 (110) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/agents/prizm-dev-team-reviewer.md +12 -1
  3. package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +1 -0
  4. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +19 -73
  5. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +283 -421
  6. package/bundled/dev-pipeline/scripts/generate-recovery-prompt.py +1 -1
  7. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +259 -481
  8. package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +34 -0
  9. package/bundled/dev-pipeline/scripts/init-pipeline.py +12 -0
  10. package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +24 -1
  11. package/bundled/dev-pipeline/scripts/prompt_framework.py +312 -0
  12. package/bundled/dev-pipeline/scripts/update-bug-status.py +87 -20
  13. package/bundled/dev-pipeline/scripts/update-feature-status.py +82 -16
  14. package/bundled/dev-pipeline/scripts/update-refactor-status.py +68 -28
  15. package/bundled/dev-pipeline/scripts/utils.py +171 -0
  16. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +1 -1
  17. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +10 -18
  18. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +14 -25
  19. package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +9 -1
  20. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +11 -8
  21. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +122 -182
  22. package/bundled/dev-pipeline/templates/sections/bugfix-artifacts.md +16 -0
  23. package/bundled/dev-pipeline/templates/sections/bugfix-critical-paths.md +12 -0
  24. package/bundled/dev-pipeline/templates/sections/bugfix-mission.md +9 -0
  25. package/bundled/dev-pipeline/templates/sections/bugfix-phase-commit-report.md +31 -0
  26. package/bundled/dev-pipeline/templates/sections/bugfix-phase-critic.md +22 -0
  27. package/bundled/dev-pipeline/templates/sections/bugfix-phase-diagnose-plan.md +23 -0
  28. package/bundled/dev-pipeline/templates/sections/bugfix-phase-implement.md +20 -0
  29. package/bundled/dev-pipeline/templates/sections/bugfix-phase-init.md +9 -0
  30. package/bundled/dev-pipeline/templates/sections/bugfix-phase-manual-verification.md +15 -0
  31. package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +29 -0
  32. package/bundled/dev-pipeline/templates/sections/bugfix-reminders.md +11 -0
  33. package/bundled/dev-pipeline/templates/sections/bugfix-session-context.md +7 -0
  34. package/bundled/dev-pipeline/templates/sections/bugfix-session-status.md +31 -0
  35. package/bundled/dev-pipeline/templates/sections/bugfix-task-contract.md +40 -0
  36. package/bundled/dev-pipeline/templates/sections/failure-capture.md +2 -2
  37. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +1 -1
  38. package/bundled/dev-pipeline/templates/sections/refactor-artifacts.md +17 -0
  39. package/bundled/dev-pipeline/templates/sections/refactor-critical-paths.md +13 -0
  40. package/bundled/dev-pipeline/templates/sections/refactor-mission.md +9 -0
  41. package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +37 -0
  42. package/bundled/dev-pipeline/templates/sections/refactor-phase-critic.md +22 -0
  43. package/bundled/dev-pipeline/templates/sections/refactor-phase-implement.md +16 -0
  44. package/bundled/dev-pipeline/templates/sections/refactor-phase-init.md +9 -0
  45. package/bundled/dev-pipeline/templates/sections/refactor-phase-plan.md +22 -0
  46. package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +19 -0
  47. package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +11 -0
  48. package/bundled/dev-pipeline/templates/sections/refactor-session-context.md +7 -0
  49. package/bundled/dev-pipeline/templates/sections/refactor-session-status.md +28 -0
  50. package/bundled/dev-pipeline/templates/sections/refactor-task-contract.md +52 -0
  51. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +17 -5
  52. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +197 -0
  53. package/bundled/dev-pipeline/tests/test_unified_cli.py +6 -2
  54. package/bundled/dev-pipeline/tests/test_utils.py +66 -1
  55. package/bundled/skills/_metadata.json +1 -1
  56. package/bundled/skills/app-planner/SKILL.md +8 -7
  57. package/bundled/skills/app-planner/references/project-brief-guide.md +2 -2
  58. package/bundled/skills/app-planner/references/rules/backend/derivation-rules.md +1 -1
  59. package/bundled/skills/app-planner/references/rules/frontend/derivation-rules.md +1 -1
  60. package/bundled/skills/app-planner/references/rules-configuration.md +53 -26
  61. package/bundled/skills/bug-fix-workflow/SKILL.md +191 -336
  62. package/bundled/skills/bug-planner/SKILL.md +6 -5
  63. package/bundled/skills/bug-planner/references/critic-and-verification.md +3 -3
  64. package/bundled/skills/bug-planner/references/schema-validation.md +2 -1
  65. package/bundled/skills/bug-planner/scripts/validate-bug-list.py +30 -1
  66. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +16 -16
  67. package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +2 -2
  68. package/bundled/skills/feature-pipeline-launcher/SKILL.md +19 -11
  69. package/bundled/skills/feature-planner/SKILL.md +9 -11
  70. package/bundled/skills/feature-planner/assets/planning-guide.md +1 -1
  71. package/bundled/skills/feature-planner/references/decomposition-patterns.md +1 -1
  72. package/bundled/skills/feature-planner/references/error-recovery.md +2 -1
  73. package/bundled/skills/feature-planner/references/incremental-feature-planning.md +2 -2
  74. package/bundled/skills/feature-planner/references/new-project-planning.md +35 -39
  75. package/bundled/skills/feature-planner/scripts/validate-and-generate.py +1 -1
  76. package/bundled/skills/feature-workflow/SKILL.md +169 -298
  77. package/bundled/skills/prizmkit/SKILL.md +103 -57
  78. package/bundled/skills/prizmkit-code-review/SKILL.md +97 -116
  79. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +1 -0
  80. package/bundled/skills/prizmkit-code-review/references/reviewer-agent-prompt.md +12 -1
  81. package/bundled/skills/prizmkit-committer/SKILL.md +59 -47
  82. package/bundled/skills/prizmkit-deploy/SKILL.md +162 -381
  83. package/bundled/skills/prizmkit-deploy/references/ssh-adapter-flow.md +220 -0
  84. package/bundled/skills/prizmkit-implement/SKILL.md +51 -40
  85. package/bundled/skills/prizmkit-init/SKILL.md +4 -3
  86. package/bundled/skills/prizmkit-plan/SKILL.md +85 -70
  87. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +94 -73
  88. package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +20 -18
  89. package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +18 -14
  90. package/bundled/skills/prizmkit-retrospective/SKILL.md +56 -48
  91. package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +79 -27
  92. package/bundled/skills/prizmkit-test/SKILL.md +138 -141
  93. package/bundled/skills/prizmkit-test/references/examples.md +10 -8
  94. package/bundled/skills/prizmkit-test/references/test-generation-steps.md +1 -1
  95. package/bundled/skills/prizmkit-test/references/test-report-template.md +2 -2
  96. package/bundled/skills/recovery-workflow/SKILL.md +195 -256
  97. package/bundled/skills/recovery-workflow/evals/evals.json +21 -13
  98. package/bundled/skills/recovery-workflow/references/detection.md +48 -39
  99. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +258 -322
  100. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +29 -11
  101. package/bundled/skills/refactor-planner/SKILL.md +2 -2
  102. package/bundled/skills/refactor-planner/references/behavior-preservation.md +24 -19
  103. package/bundled/skills/refactor-planner/references/fast-path.md +2 -4
  104. package/bundled/skills/refactor-planner/references/planning-phases.md +2 -2
  105. package/bundled/skills/refactor-workflow/SKILL.md +173 -307
  106. package/package.json +1 -1
  107. package/src/scaffold.js +5 -0
  108. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-review.md +0 -6
  109. package/bundled/skills/feature-workflow/references/brainstorm-guide.md +0 -137
  110. package/bundled/skills/refactor-workflow/references/brainstorm-guide.md +0 -116
@@ -1,379 +1,245 @@
1
1
  ---
2
2
  name: "refactor-workflow"
3
- description: "Triage-based refactor workflow. Clarifies behavior-preserving refactoring goals, then lets the user choose Fast Path for simple current-session/current-workspace refactors or Pipeline Path for complex/batch refactors via refactor-planner refactor-pipeline-launcher. Use when 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'."
3
+ description: "Thin L3 refactor workflow router for behavior-preserving code restructuring. Clarifies enough to choose Fast Path, Pipeline Path, or existing-list launch; routes deep code analysis and item decomposition to refactor-planner and execution configuration to refactor-pipeline-launcher. Use when the user wants to refactor, clean up, restructure, decouple, simplify, migrate internal structure, extract modules, or run an existing refactor list without changing product behavior. Trigger on: 'refactor', 'clean up code', 'restructure', 'optimize code structure', 'extract module', 'decouple', 'code migration', 'batch refactor', 'run refactor list'."
4
4
  ---
5
5
 
6
6
  # Refactor Workflow
7
7
 
8
- Triage-based entry point for code refactoring. The workflow clarifies behavior-preserving goals, assesses risk and scope, asks the user to choose an approach, then follows one of two paths:
8
+ Thin L3 entry point for behavior-preserving refactoring. This workflow routes the user to the right path, prepares a concise handoff brief, and avoids duplicating `refactor-planner` or `refactor-pipeline-launcher` internals.
9
9
 
10
- - **Fast Path** — a simple behavior-preserving refactor is implemented directly in the **current session** and **current workspace** with the normal PrizmKit lifecycle commands.
11
- - **Pipeline Path** — complex or batch refactors are planned with `refactor-planner`, launched with `refactor-pipeline-launcher`, then monitored.
10
+ ## Responsibility Boundary
12
11
 
13
- This skill keeps Fast Path and Pipeline Path separate. Pipeline monitoring only happens after the user selects Pipeline Path and the launcher starts execution.
12
+ This workflow owns:
13
+ - Scenario recognition: Fast Path, Pipeline Path, existing-list launch, or behavior-change reroute.
14
+ - Lightweight behavior-risk triage.
15
+ - User path selection through `AskUserQuestion`.
16
+ - Prompt brief handoff to Fast Path L1 skills, `refactor-planner`, or `refactor-pipeline-launcher`.
17
+ - Continuation after `refactor-planner` when the user entered through this workflow.
14
18
 
15
- ## When to Use
16
-
17
- User says:
18
- - "Refactor the auth module", "Clean up this code", "Restructure the payment service"
19
- - "Extract shared logic into a separate module", "Optimize code structure"
20
- - "Do this small behavior-preserving cleanup now"
21
- - "Batch refactor these modules", "Code refactoring across multiple files"
22
- - Code has accumulated tech debt that needs structural improvement
23
- - Module needs to be split, merged, or reorganized
24
-
25
- **Do NOT use this skill when:**
26
- - User only wants to plan refactoring without execution → use `refactor-planner` directly
27
- - User only wants to launch an existing `.prizmkit/plans/refactor-list.json` → use `refactor-pipeline-launcher`
28
- - User wants to add features → use `feature-workflow`
29
- - User wants to fix bugs → use `bug-fix-workflow` or `bug-planner` + `bugfix-pipeline-launcher`
30
-
31
- ---
32
-
33
- ## Overview
34
-
35
- The shared contract is:
36
-
37
- 1. **Brainstorm** — clarify refactoring type, collect reference materials, read relevant code/docs/tests, and confirm behavior-preservation requirements.
38
- 2. **Assess difficulty and behavior risk** — decide whether the request is a simple behavior-preserving Fast Path candidate or a complex/batch Pipeline Path candidate.
39
- 3. **AskUserQuestion approach selection** — present selectable options; never silently choose the path.
40
- 4. **Execute selected path**:
41
- - **Fast Path**: `/prizmkit-plan` → `/prizmkit-implement` with behavior-preservation tests/checks → `/prizmkit-code-review` → `/prizmkit-retrospective` → `/prizmkit-committer` in the current workspace.
42
- - **Pipeline Path**: `refactor-planner` → `refactor-pipeline-launcher` → monitoring.
43
-
44
- ### Terminology
45
-
46
- | Term | Meaning |
47
- |------|---------|
48
- | **Fast Path** | Current-session/current-workspace implementation for simple, behavior-preserving refactors. It does not create or consume `.prizmkit/plans/refactor-list.json` and does not start the refactor pipeline. |
49
- | **Pipeline Path** | Complex or batch refactor execution. Planner handoff goes to `refactor-planner`; launcher handoff goes to `refactor-pipeline-launcher`; monitoring follows only after launch. |
50
- | **Current session** | The interactive AI CLI session that is already discussing the refactor with the user. |
51
- | **Current workspace** | The current git checkout and working tree, not a background pipeline worktree/session. |
52
- | **Behavior preservation** | External behavior, public contracts, tests, and user-visible outcomes remain unchanged unless the user explicitly approves a behavior change as a feature. |
53
- | **Monitoring** | Status/log follow-up for a launched refactor pipeline; it is not part of the Fast Path. |
54
-
55
- ### Workspace and Branch Model
56
-
57
- - **Fast Path**: work happens in the current workspace and current interactive session. Use the current branch unless the project policy or user explicitly asks to create a branch.
58
- - **Pipeline Path**: `refactor-pipeline-launcher` and the dev-pipeline manage per-refactor branches/worktrees. This workflow does not create a top-level branch before handing off to the launcher.
59
-
60
- ---
61
-
62
- ## Input Modes
63
-
64
- **Mode A: Natural language refactoring goal** (default)
65
-
66
- Natural language description of the refactoring goals. Can be:
67
- - A simple behavior-preserving refactor: "Extract this helper function and keep behavior unchanged"
68
- - A module target: "Refactor the auth module — extract shared middleware, simplify the token flow"
69
- - A batch of refactors: "Clean up the payment service, decouple the notification module, and extract common utilities"
70
- - An incremental request: "Also refactor the logging layer to use structured logging"
71
-
72
- Flow: brainstorm → complexity/behavior-risk assessment → AskUserQuestion → Fast Path or Pipeline Path.
73
-
74
- **Mode B: Existing `.prizmkit/plans/refactor-list.json`**
75
-
76
- When the user says "run pipeline from existing file" or `.prizmkit/plans/refactor-list.json` already exists and should be executed:
77
- - Skip brainstorm and `refactor-planner`
78
- - Invoke `refactor-pipeline-launcher` directly
79
- - Monitor and report progress
80
-
81
- **Mode C: Incremental refactor request**
82
-
83
- When user says "add more refactors":
84
- - Brainstorm only the new refactoring goals
85
- - Assess whether the new scope is simple and behavior-preserving enough for Fast Path
86
- - For simple work: use Fast Path in the current workspace
87
- - For complex or batch work: invoke `refactor-planner` in incremental mode, then `refactor-pipeline-launcher`
88
-
89
- ---
90
-
91
- ## Phase 1: Brainstorm — Deep Refactoring Goal Clarification
92
-
93
- **Goal**: Through interactive Q&A and deep code reading, 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.
94
-
95
- **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.
96
-
97
- ### Step 1.1: Clarify Refactoring Type
98
-
99
- **First question** — ask the user to classify the refactoring approach:
100
-
101
- | Type | Description | Example |
102
- |------|-------------|---------|
103
- | **Incremental** | Piece-by-piece restructuring, each step independently safe | "Gradually extract shared utilities over several PRs" |
104
- | **Comprehensive** | Full rewrite of a module/area in one pass | "Rewrite the auth module with new architecture" |
105
- | **Targeted** | Specific, focused change to a particular part | "Extract the validation logic from the controller" |
106
-
107
- Then ask:
108
- - **What** code needs restructuring (modules, files, patterns)
109
- - **Why** it needs refactoring (tech debt, coupling, complexity, readability, performance structure)
110
- - **What outcome** they want (target architecture, desired structure, quality goals)
111
- - **What behavior must remain unchanged** (public APIs, outputs, workflows, tests, performance-sensitive paths)
112
-
113
- ### Step 1.2: Collect Reference Materials
19
+ This workflow does not own:
20
+ - Deep code analysis, item decomposition, dependency ordering, behavior-preservation strategy selection, schema validation, or plan review gates — those belong to `refactor-planner`.
21
+ - Execution mode, runtime configuration, preflight, command assembly, status/log/stop/retry details — those belong to `refactor-pipeline-launcher`.
22
+ - Product behavior changes those should route to feature work unless explicitly framed as a behavior-preserving migration.
114
23
 
115
- **Upfront Material Detection (Hard Rule)**: If the user has already provided materials (file paths, URLs, rules, specifications, code snippets) in the same message that invoked this skill:
116
- 1. Acknowledge what was received: "I received the following materials: [list]"
117
- 2. Read/fetch all provided materials immediately
118
- 3. You MUST still ask: "Are there any additional materials you'd like to provide?"
119
- 4. NEVER skip this collection step just because the user already provided some materials
24
+ ## Behavior-Preservation Boundary
120
25
 
121
- **If the user has NOT provided any materials upfront**, ask the user explicitly what resources they have. Do NOT skip this step — user-provided materials are far more valuable than blind directory scanning.
26
+ Refactoring means external behavior remains unchanged:
27
+ - Public product behavior stays the same.
28
+ - User-visible outcomes stay the same.
29
+ - Public contracts stay stable unless the user explicitly confirms a compatibility-preserving migration.
30
+ - Tests and behavior checks are used to prove the change is structural.
122
31
 
123
- Ask:
124
- 1. **Code paths** — "Which files or directories are the main targets? Any specific files I should look at?"
125
- 2. **Design documents** — "Do you have any design docs, architecture diagrams, or refactoring proposals I should read?"
126
- 3. **Knowledge docs** — "Are there related `.prizmkit/prizm-docs/`, README files, or internal wiki pages for the target area?"
127
- 4. **Related issues/PRs** — "Any related issues, PRs, or previous refactoring attempts I should be aware of?"
128
- 5. **Behavior checks** — "Which tests, commands, or manual scenarios prove behavior must stay the same?"
32
+ If the request requires changed product behavior, new user-facing functionality, or a breaking public API change, route to `feature-workflow`. Internal API, import path, or module boundary changes can still be refactoring when external behavior remains unchanged and the planner can define a safe migration strategy.
129
33
 
130
- Record everything the user provides — these become inputs for Step 1.3.
131
-
132
- ### Step 1.3: Parallel Deep Reading
133
-
134
- Read `${SKILL_DIR}/references/brainstorm-guide.md` §Step 1.3 for the parallel agent dispatch procedure — spawn 4 agents (A: code paths, B: documents, C: prizm-docs, D: test files) to build comprehensive understanding before discussion. Synthesize findings before proceeding.
135
-
136
- ### Step 1.4: Discuss Refactoring Plan
34
+ ## When to Use
137
35
 
138
- Read `${SKILL_DIR}/references/brainstorm-guide.md` §Step 1.4 for the full discussion framework code structure, scope, behavior preservation, risk assessment, and constraints. Present what was learned from parallel reading, then ask targeted questions grounded in real code. **Adapt question depth to the refactoring complexity.**
36
+ Use this workflow when the user wants a guided refactoring entry point:
37
+ - Clean up or restructure existing code.
38
+ - Extract modules, helpers, middleware, or shared logic.
39
+ - Decouple modules or simplify structure.
40
+ - Plan or execute behavior-preserving migrations.
41
+ - Decide whether a refactor is small enough for current-session Fast Path or should use the refactor pipeline.
42
+ - Continue from an existing `.prizmkit/plans/refactor-list.json`.
139
43
 
140
- ### Step 1.5: Confirm and Supplement
44
+ Do not use this workflow when the user only wants:
45
+ - Refactor planning without execution intent -> use `refactor-planner`.
46
+ - Launch/status/logs/retry for an existing refactor list -> use `refactor-pipeline-launcher`.
47
+ - New functionality or changed product behavior -> use `feature-workflow`.
48
+ - Bug repair -> use `bug-fix-workflow` or the bug pipeline skills.
141
49
 
142
- After the discussion:
50
+ ## Route Overview
143
51
 
144
- 1. **Summarize** the refactoring plan — present it back to the user
145
- 2. **Ask explicitly**: "Is there anything else you'd like to discuss or supplement before we proceed to formal planning?"
146
- 3. **Identify gaps** if any areas are still unclear, list them explicitly and ask follow-up questions
147
- 4. **Repeat** until the user confirms: "That covers everything" or "Let's proceed"
52
+ | User situation | Route |
53
+ |---|---|
54
+ | Simple local behavior-preserving refactor | Fast Path in current workspace |
55
+ | Batch, cross-module, high-risk, weak-test, or multi-step refactor | `refactor-planner` -> return here -> `refactor-pipeline-launcher` |
56
+ | Product behavior change or breaking public API change | Route to `feature-workflow` |
57
+ | User explicitly says to run an existing refactor list | `refactor-pipeline-launcher` |
58
+ | Refactor list exists but the user did not explicitly ask to run it | Ask launch / inspect / update |
148
59
 
149
- Read `${SKILL_DIR}/references/brainstorm-guide.md` §Completion Signs for the full checklist of when brainstorming is complete vs when more questions are needed.
60
+ ## Route Selection
150
61
 
151
- ### Step 1.6: Requirements Summary
62
+ ### Step 1: Detect the entry mode
152
63
 
153
- Once brainstorming is complete, produce a structured goals summary. Read `${SKILL_DIR}/references/brainstorm-guide.md` §Refactoring Goals Summary Template for the structured output format. Present the summary to the user and get explicit confirmation before proceeding.
64
+ Classify the request before asking detailed refactoring questions:
154
65
 
155
- The summary must include behavior-preservation expectations: tests to run, public contracts to keep stable, and any explicitly approved behavior changes. If behavior changes are required, route them as feature work rather than refactoring unless the user explicitly scopes them here.
66
+ - **Behavior-preserving refactor**: the user asks to clean up, restructure, simplify, extract, decouple, or migrate implementation structure.
67
+ - **Behavior change**: the user asks to change what the product does, add functionality, or break a public contract.
68
+ - **Existing list launch**: the user explicitly asks to run, start, resume, check, retry, or stop `.prizmkit/plans/refactor-list.json`.
69
+ - **Unclear**: the request mixes cleanup with behavior changes.
156
70
 
157
- **CHECKPOINT CP-RW-0**: Refactoring goals fully clarified and confirmed by user.
71
+ If behavior preservation is unclear, ask one concise clarification question before route selection.
158
72
 
159
- ---
73
+ ### Step 2: Lightweight triage for behavior-preserving work
160
74
 
161
- ### Step 1.7: Complexity Assessment & Approach Selection
75
+ Use lightweight criteria only. Do not perform full code analysis or item decomposition here.
162
76
 
163
- After confirming refactoring goals, assess whether this refactor needs the Pipeline Path or can be done directly in the current session/current workspace.
77
+ Fast Path candidate when all are true:
78
+ - One focused refactor or a small tightly related cleanup.
79
+ - Expected work is localized and follows existing patterns.
80
+ - Behavior-preservation checks are obvious or already available.
81
+ - No broad dependency ordering, public behavior change, or risky migration is needed.
164
82
 
165
- **Simple behavior-preserving refactor → Fast Path candidate** (ALL must be true):
166
- - Single module, no cross-module impact
167
- - ≤3 files affected
168
- - No public API or interface changes
169
- - Straightforward transformation (extract method, rename, move file, simplify logic)
170
- - Existing tests or focused checks cover the affected behavior
171
- - No behavior change risk beyond what tests/checks can verify
83
+ Pipeline Path candidate when any are true:
84
+ - Multiple refactor items or batch refactoring request.
85
+ - Cross-module or multi-layer impact.
86
+ - Import-path, internal API, or module-boundary migration needs ordering.
87
+ - Weak test coverage creates behavior-preservation risk.
88
+ - The user wants autonomous/background execution.
89
+ - The request needs `refactor-planner` to analyze code, split items, validate ordering, and review entries.
172
90
 
173
- **Complex or batch refactors Pipeline Path candidate** (ANY is true):
174
- - Multiple refactor items or batch refactoring request
175
- - Cross-module impact (>2 modules affected)
176
- - Public API or interface changes required
177
- - Multiple interrelated refactoring steps with dependency ordering
178
- - Comprehensive rewrite of a module
179
- - Insufficient test coverage in target area (risk of hidden behavior changes)
180
- - Requires coordination with other ongoing work
91
+ ### Step 3: Ask for path selection
181
92
 
182
- **User choice required (mandatory)** — Use `AskUserQuestion` to present interactive selectable options. Tailor the question text to the assessment: for a simple refactor, "This refactor appears straightforward and behavior-preserving enough for the current-session Fast Path." For a complex or batch refactor, "This refactor is complex or batch-oriented and should use the Pipeline Path."
93
+ Use `AskUserQuestion`; do not render path options as plain text.
183
94
 
95
+ ```text
96
+ Question: How would you like to proceed?
97
+ Header: Approach
98
+ Options:
99
+ - Refactor now (Fast Path) — current session/current workspace via /prizmkit-plan -> /prizmkit-implement with behavior checks
100
+ - Use Pipeline Path — refactor-planner creates/reviews refactor-list.json, then refactor-pipeline-launcher configures execution
101
+ - Continue clarifying — ask a few more route-level questions before choosing
184
102
  ```
185
- AskUserQuestion:
186
- question: "How would you like to proceed?"
187
- header: "Approach"
188
- options:
189
- - label: "Refactor now (Fast Path — current session/current workspace)"
190
- description: "Run /prizmkit-plan → /prizmkit-implement → /prizmkit-code-review → /prizmkit-retrospective → /prizmkit-committer directly in this workspace with behavior-preservation checks"
191
- - label: "Use Pipeline Path (refactor-planner → refactor-pipeline-launcher)"
192
- description: "Generate .prizmkit/plans/refactor-list.json with refactor-planner, then launch autonomous execution with refactor-pipeline-launcher"
193
- ```
194
-
195
- - **Refactor now (Fast Path)**:
196
- 1. Invoke `/prizmkit-plan` with the goals summary → generates `spec.md` + `plan.md` including behavior-preservation strategy
197
- 2. Invoke `/prizmkit-implement` to execute the plan in the current workspace and verify behavior stays unchanged
198
- 3. Run `/prizmkit-code-review` for quality and behavior-preservation review
199
- 4. Run `/prizmkit-retrospective` to sync `.prizmkit/prizm-docs/`
200
- 5. Commit via `/prizmkit-committer` with `refactor(<scope>):` prefix
201
- 6. End workflow — do not call `refactor-planner`, do not call `refactor-pipeline-launcher`, and do not enter monitoring
202
- - **Use Pipeline Path** → Continue to Phase 2 (Planner handoff)
203
-
204
- **NEVER proceed without explicit user confirmation via `AskUserQuestion`. Do NOT render options as plain text — the user must be able to click/select.**
205
-
206
- **CHECKPOINT CP-RW-0.5**: Approach selected by user (Fast Path or Pipeline Path).
207
-
208
- ---
209
-
210
- ## Phase 2: Plan — Pipeline Path Only
211
-
212
- **Goal**: Generate structured `.prizmkit/plans/refactor-list.json` from the clarified refactoring goals.
213
-
214
- Run this phase only when the user selected Pipeline Path or provided a batch/complex refactor request that they chose to send through the pipeline.
215
-
216
- **STEPS**:
217
-
218
- 1. **Planner handoff — invoke `refactor-planner`** with the full goals summary from Phase 1:
219
- - Pass the structured goals summary as input — NOT the raw user conversation
220
- - For new refactoring: standard planning mode
221
- - For existing projects with `--incremental`: incremental planning mode
222
- - **Input**: Markdown goals summary (refactor targets, scope, behavior preservation strategy)
223
- - **Output**: `.prizmkit/plans/refactor-list.json` (schema: `dev-pipeline-refactor-list-v1`) containing `project_name`, `refactors[]` with id (R-NNN), title, description, scope, type, priority, complexity, behavior_preservation, acceptance_criteria, dependencies, status
224
103
 
225
- 2. **Interactive planning** (if `refactor-planner` requires clarification):
226
- - Because Phase 1 was thorough, `refactor-planner` should need minimal clarification
227
- - If questions arise, answer from the Phase 1 context or pass through to user
104
+ If the request appears to change product behavior:
228
105
 
229
- 3. **Validate output**:
230
- - Confirm `.prizmkit/plans/refactor-list.json` exists
231
- - Show summary: total refactor items, complexity distribution, dependencies, behavior-preservation coverage
232
-
233
- **CHECKPOINT CP-RW-1**: `.prizmkit/plans/refactor-list.json` generated and validated.
106
+ ```text
107
+ Question: This appears to change behavior rather than only restructure code. What should we do?
108
+ Header: Boundary
109
+ Options:
110
+ - Route to feature-workflow (Recommended) treat behavior change as feature work
111
+ - Keep as refactor — only if behavior remains externally unchanged or this is a compatibility-preserving migration
112
+ - Continue clarifying — define which behavior must stay unchanged
113
+ ```
234
114
 
235
- **If `.prizmkit/plans/refactor-list.json` already exists or user says `--from <file>`**: skip ahead per the [Resume table](#resume--interruption-recovery).
115
+ For an auto-discovered existing refactor list:
236
116
 
237
- ---
117
+ ```text
118
+ Question: Existing refactor-list.json found. What should we do with it?
119
+ Header: Refactor list
120
+ Options:
121
+ - Launch existing list — hand off to refactor-pipeline-launcher
122
+ - Inspect summary first — show refactor count/status, then ask again
123
+ - Update/re-plan — hand off to refactor-planner in incremental mode
124
+ - Ignore and start fresh — continue route selection from the new request
125
+ ```
238
126
 
239
- ## Phase 3: Launch Pipeline Path Only
127
+ If the user explicitly asked to run an existing list, that explicit request counts as path selection; hand off directly to `refactor-pipeline-launcher`.
240
128
 
241
- **Goal**: Start the refactoring pipeline after planner handoff has produced a validated refactor list.
129
+ ## Workflow Handoff Brief
242
130
 
243
- **STEPS**:
131
+ When handing off, include this prompt brief in the next skill invocation. Do not write the brief to disk.
244
132
 
245
- 1. **Show refactor summary** before launching:
246
- ```
247
- Ready to launch Pipeline Path with N refactor items:
248
- R-001: Extract auth middleware (medium complexity)
249
- R-002: Decouple notification service (high complexity)
250
- R-003: Simplify token flow (low complexity)
133
+ ```markdown
134
+ ## Workflow Handoff Brief
251
135
 
252
- Proceed? (Y/n)
253
- ```
136
+ ### Source
137
+ - workflow: refactor-workflow
138
+ - selected_path: fast_path | pipeline_path | existing_list_launch | behavior_change_reroute
254
139
 
255
- 2. **Launcher handoff — invoke `refactor-pipeline-launcher`**:
256
- - **Input**: Path to validated `.prizmkit/plans/refactor-list.json`
257
- - The launcher handles all prerequisites checks
258
- - The launcher presents execution mode choices to the user (foreground/background/manual)
259
- - The launcher preserves strict behavior-check defaults
260
- - Do NOT duplicate execution mode selection here — let the launcher handle it
261
- - **Output**: PID/status, log file path, execution mode selected
262
- - Returns PID/status and log file location
140
+ ### User Goal
141
+ - original_request: <preserve the user's wording>
142
+ - normalized_goal: <lightly normalized refactoring goal>
263
143
 
264
- 3. **Verify launch success**:
265
- - Confirm pipeline is running
266
- - Record PID and log path for Phase 4
144
+ ### Scope
145
+ - included: <explicitly in scope>
146
+ - excluded: <explicitly out of scope or unknown>
267
147
 
268
- **CHECKPOINT CP-RW-2**: Pipeline launched successfully.
148
+ ### Behavior Preservation
149
+ - must_remain_unchanged: <public behavior, user-visible outcomes, APIs, workflows, tests>
150
+ - suspected_behavior_changes: <items that may need feature-workflow>
269
151
 
270
- ---
152
+ ### Materials
153
+ - provided_paths: <paths/directories supplied by the user>
154
+ - provided_docs_or_urls: <docs, links, screenshots, or specs supplied by the user>
155
+ - notes: <rules, constraints, or emphasis from the user>
271
156
 
272
- ## Phase 4: Monitor — Pipeline Path Only
157
+ ### Decision
158
+ - route_reason: <why this path was selected>
159
+ - user_confirmed: yes
273
160
 
274
- **Goal**: Track pipeline progress and report to user. Monitoring applies only after `refactor-pipeline-launcher` has started a pipeline.
161
+ ### Next Skill Instruction
162
+ - For planner: Use this brief as input; perform your own required code analysis, behavior-preservation planning, validation, generation, and review gate.
163
+ - For Fast Path: Use this brief to create spec.md/plan.md and implement only this behavior-preserving scope.
164
+ ```
275
165
 
276
- **STEPS**:
166
+ ## Selected Path Execution
277
167
 
278
- 1. **Initial status check**:
279
- ```bash
280
- python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor status
281
- ```
168
+ ### Fast Path
282
169
 
283
- 2. **Offer monitoring options**:
284
- - "I'll check progress periodically. Say 'status' anytime for an update."
285
- - "Say 'logs' to see recent activity."
286
- - "Say 'stop' to pause the pipeline."
170
+ Use Fast Path only after explicit user selection.
287
171
 
288
- 3. **Periodic progress reports** (when user asks):
289
- ```bash
290
- python3 ./.prizmkit/dev-pipeline/cli.py refactor status .prizmkit/plans/refactor-list.json
291
- ```
172
+ 1. Invoke `/prizmkit-plan` with the handoff brief and behavior-preservation expectations.
173
+ 2. Invoke `/prizmkit-implement` after the plan is ready.
174
+ 3. Run behavior-preservation checks identified in the plan.
175
+ 4. Run `/prizmkit-code-review` as the quality and behavior-preservation gate.
176
+ 5. Run `/prizmkit-retrospective` before commit because refactors often change durable structure.
177
+ 6. Run `/prizmkit-committer` with a `refactor(<scope>):` message.
178
+ 7. End the workflow after commit; do not call `refactor-planner`, `refactor-pipeline-launcher`, or monitoring.
292
179
 
293
- 4. **Completion report** (when pipeline finishes all refactor items):
294
- ```
295
- Pipeline completed: 3/3 refactor items
180
+ If the refactor starts changing behavior or grows beyond Fast Path criteria, pause and ask whether to switch to `feature-workflow` or Pipeline Path.
296
181
 
297
- Summary:
298
- - R-001: Extract auth middleware → COMMITTED (refactor(auth): extract shared middleware)
299
- - R-002: Decouple notification service → COMMITTED (refactor(notifications): decouple from core)
300
- - R-003: Simplify token flow → COMMITTED (refactor(auth): simplify token refresh)
182
+ ### Pipeline Path
301
183
 
302
- Next steps:
303
- - Review changes: git log --oneline -5
304
- - Run tests: npm test
305
- - Push when ready: git push
306
- ```
184
+ 1. Invoke `refactor-planner` with the handoff brief.
185
+ 2. `refactor-planner` performs code analysis, item decomposition, behavior-preservation planning, validation, and plan review.
186
+ 3. After `refactor-planner` reports a validated `.prizmkit/plans/refactor-list.json`, show a concise summary: item count, ordering highlights, preservation strategy summary, and review/validation outcome.
187
+ 4. Ask whether to proceed to launch.
188
+ 5. If yes, invoke `refactor-pipeline-launcher`.
307
189
 
308
- **CHECKPOINT CP-RW-3**: All refactor items completed or user stopped pipeline.
190
+ Do not duplicate launcher execution-mode, strict-behavior-check, or runtime configuration questions in this workflow; the launcher owns them.
309
191
 
310
- ---
192
+ ### Existing list launch
311
193
 
312
- ## Resume Interruption Recovery
194
+ If the user explicitly requested launch/status/logs/retry/stop for an existing refactor list, invoke `refactor-pipeline-launcher` with the user's intent and list path.
313
195
 
314
- The workflow supports resuming by detecting existing state:
196
+ If this workflow discovered the list on its own, use the `Existing refactor-list.json found` question in §Route Selection before invoking the launcher.
315
197
 
316
- | State Found | Resume From |
317
- |-------------|-------------|
318
- | Fast Path `spec.md` + `plan.md` exist, code not committed | Resume `/prizmkit-implement` / review / retrospective / commit based on current state |
319
- | No `.prizmkit/plans/refactor-list.json` and no Fast Path artifacts | Phase 1: Brainstorm |
320
- | `.prizmkit/plans/refactor-list.json` exists, no pipeline state | Phase 3: Launch |
321
- | `.prizmkit/plans/refactor-list.json` + pipeline state exists | Phase 4: Monitor (check status) |
322
- | All refactors completed | Report completion, suggest next steps |
198
+ ## Resume Guidance
323
199
 
324
- **Resume**: If `.prizmkit/plans/refactor-list.json` exists, ask user: "Existing refactor plan found with N items. Resume Pipeline Path or re-plan?" If Fast Path artifacts exist, ask whether to continue the current-workspace refactor or discard/re-plan.
200
+ | State found | Action |
201
+ |---|---|
202
+ | Fast Path `spec.md` / `plan.md` exists | Ask whether to continue current-workspace refactor or re-plan |
203
+ | Valid `.prizmkit/plans/refactor-list.json` exists and user wants execution | Invoke `refactor-pipeline-launcher` |
204
+ | Valid refactor list exists but intent is unclear | Ask launch / inspect / update |
205
+ | No plan/list artifacts | Start route selection |
325
206
 
326
- ---
207
+ For interrupted autonomous pipeline sessions, prefer `refactor-pipeline-launcher` status/retry operations or `recovery-workflow` when the user explicitly asks to recover a broken AI session.
327
208
 
328
- ## Interaction During Pipeline
209
+ ## Runtime Status Reference
329
210
 
330
- While the pipeline runs, the user can continue the conversation:
211
+ This workflow does not assemble runtime commands, but it may show lightweight status before handoff or recovery. Use the canonical Python runtime forms:
331
212
 
332
- | User says | Action |
333
- |-----------|--------|
334
- | "status" / "progress" | Show current progress |
335
- | "logs" | Show recent log activity |
336
- | "stop" | Stop the pipeline (state preserved) |
337
- | "show R-002 logs" | Show specific refactor item's session log |
213
+ ```bash
214
+ python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor status
215
+ python3 ./.prizmkit/dev-pipeline/cli.py refactor status .prizmkit/plans/refactor-list.json
216
+ ```
338
217
 
339
- ---
218
+ For start/stop/logs/retry execution, hand off to `refactor-pipeline-launcher`; do not duplicate launcher configuration here.
340
219
 
341
220
  ## Error Handling
342
221
 
343
- | Error | Action |
344
- |-------|--------|
345
- | User's refactoring goal is too vague | Ask for more context: "Can you describe what's wrong with the current code structure?" |
346
- | Brainstorming stalls | Offer concrete options: "Would you prefer incremental or comprehensive refactoring?" |
347
- | No tests exist for target module | WARN user, recommend writing tests/checks before Fast Path; consider Pipeline Path for risky refactors |
348
- | Fast Path starts risking behavior change | Pause and ask whether to switch to Pipeline Path (`refactor-planner` → `refactor-pipeline-launcher`) |
349
- | `refactor-planner` cannot parse goals | Refine the goals summary and retry |
350
- | `.prizmkit/plans/refactor-list.json` generation failed | Show error, retry with refined input |
351
- | Pipeline launch failed | Show daemon log, suggest manual start with `python3 ./.prizmkit/dev-pipeline/cli.py refactor run .prizmkit/plans/refactor-list.json` or `python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor start .prizmkit/plans/refactor-list.json` |
352
- | All refactor items blocked/failed | Show status, suggest retrying specific items |
353
- | User wants to cancel mid-brainstorming | Save conversation context, offer to resume later |
354
- | Behavior regression detected during Fast Path | Revert or fix immediately before commit; refactoring cannot ship with behavior regression |
355
- | Behavior regression detected during pipeline | Pipeline handles per-item retries/failures; report failed items and behavior checks |
356
-
357
- ---
222
+ | Situation | Action |
223
+ |---|---|
224
+ | Behavior change is required | Route to `feature-workflow` unless user confirms a behavior-preserving migration |
225
+ | User wants planning only | Route to `refactor-planner` and stop after planner summary |
226
+ | User wants execution only | Route to `refactor-pipeline-launcher` |
227
+ | No behavior checks exist | Warn user; recommend Pipeline Path unless scope is very small |
228
+ | Fast Path reveals broader risk | Pause and ask whether to switch to Pipeline Path |
229
+ | Planner needs more detail | Let `refactor-planner` ask its own clarification questions |
230
+ | Launcher finds baseline/config issues | Let `refactor-pipeline-launcher` handle confirmation and configuration |
358
231
 
359
- ## HANDOFF
232
+ ## Handoff Map
360
233
 
361
234
  | From | To | Condition |
362
- |------|----|-----------|
363
- | **this skill** | `/prizmkit-plan` | User selects Fast Path for simple behavior-preserving refactor work in the current workspace |
364
- | **this skill** | `/prizmkit-implement` | Fast Path plan is ready for current-session implementation with behavior checks |
365
- | **this skill** | `/prizmkit-code-review` | Fast Path refactor is complete and needs quality/behavior-preservation review |
366
- | **this skill** | `/prizmkit-retrospective` | Fast Path refactor changes need `.prizmkit/prizm-docs/` sync before commit |
367
- | **this skill** | `/prizmkit-committer` | Fast Path refactor is reviewed, docs are synced, and behavior preservation is verified |
368
- | **this skill** | `refactor-planner` | User selects Pipeline Path for complex or batch refactors |
369
- | `refactor-planner` | `refactor-pipeline-launcher` | Planner handoff produced validated `.prizmkit/plans/refactor-list.json` |
370
- | `refactor-pipeline-launcher` | **this skill** | Launcher handoff completed and monitoring/status follow-up is needed |
371
-
372
- ---
235
+ |---|---|---|
236
+ | `refactor-workflow` | `feature-workflow` | Request requires product behavior change |
237
+ | `refactor-workflow` | `/prizmkit-plan` | User selects Fast Path |
238
+ | `refactor-workflow` | `refactor-planner` | User selects Pipeline Path |
239
+ | `refactor-planner` | `refactor-workflow` | Planner completed from workflow-origin Pipeline Path |
240
+ | `refactor-workflow` | `refactor-pipeline-launcher` | User confirms launch after planner completion or explicitly requests existing-list execution |
373
241
 
374
242
  ## Output
375
243
 
376
- Output depends on the selected path:
377
-
378
- - **Fast Path**: `spec.md` + `plan.md`, behavior-preserving current-workspace code changes, behavior test/check evidence, `/prizmkit-code-review` result, updated `.prizmkit/prizm-docs/`, and one `refactor(<scope>):` commit from `/prizmkit-committer`.
379
- - **Pipeline Path**: structured refactoring goals summary, `.prizmkit/plans/refactor-list.json`, pipeline execution via `refactor-pipeline-launcher`, monitoring updates, and per-refactor commits managed by the dev-pipeline.
244
+ - Fast Path: `spec.md`, `plan.md`, behavior-preserving code changes, behavior-check evidence, review result, Prizm docs sync, and one refactor commit.
245
+ - Pipeline Path: handoff brief, validated `.prizmkit/plans/refactor-list.json` from `refactor-planner`, and pipeline launch/status handled by `refactor-pipeline-launcher`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prizmkit",
3
- "version": "1.1.111",
3
+ "version": "1.1.112",
4
4
  "description": "Create a new PrizmKit-powered project with clean initialization — no framework dev files, just what you need.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/scaffold.js CHANGED
@@ -1130,6 +1130,11 @@ export async function installPipeline(projectRoot, dryRun, options = {}) {
1130
1130
  const src = path.join(pipelineSource, relativeFile);
1131
1131
  const tgt = path.join(pipelineTarget, relativeFile);
1132
1132
 
1133
+ if (!await fs.pathExists(src)) {
1134
+ skippedCount++;
1135
+ continue;
1136
+ }
1137
+
1133
1138
  if (await fs.pathExists(tgt) && !overwriteExisting) {
1134
1139
  skippedCount++;
1135
1140
  continue;
@@ -1,6 +0,0 @@
1
- "Read {{REVIEWER_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
2
- 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/spec.md` (if it exists) for goals and Verification Gates; if spec.md does not exist, read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` Section 1 Task Contract instead.
3
- 2. Read `.prizmkit/specs/{{FEATURE_SLUG}}/plan.md` for architecture decisions and completed tasks.
4
- 3. Review the current workspace changes and return structured findings only. Do not run `/prizmkit-code-review`, do not apply fixes, do not run test suites, and do not spawn other agents.
5
- 4. The main orchestrator owns the review-fix loop: Reviewer Agent → filter → orchestrator fix.
6
- Report: PASS/NEEDS_FIXES, findings with severity/location/problem/suggestion/verification, and a concise summary."