prizmkit 1.1.10 → 1.1.12

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 (47) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/dev-pipeline/README.md +10 -46
  3. package/bundled/dev-pipeline/reset-bug.sh +84 -10
  4. package/bundled/dev-pipeline/reset-feature.sh +86 -10
  5. package/bundled/dev-pipeline/reset-refactor.sh +68 -4
  6. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +47 -46
  7. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +7 -12
  8. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +124 -20
  9. package/bundled/dev-pipeline/scripts/utils.py +20 -0
  10. package/bundled/dev-pipeline/templates/agent-prompts/dev-implement.md +13 -7
  11. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +62 -66
  12. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +37 -40
  13. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +35 -48
  14. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +135 -182
  15. package/bundled/dev-pipeline/templates/feature-list-schema.json +6 -21
  16. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +9 -9
  17. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +1 -1
  18. package/bundled/dev-pipeline/templates/sections/feature-context.md +4 -0
  19. package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +41 -24
  20. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +4 -12
  21. package/bundled/dev-pipeline/templates/sections/phase-deploy-verification.md +9 -17
  22. package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +1 -1
  23. package/bundled/dev-pipeline/templates/sections/phase-plan-agent.md +3 -2
  24. package/bundled/dev-pipeline/templates/sections/phase-plan-lite.md +4 -2
  25. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +0 -18
  26. package/bundled/dev-pipeline/templates/sections/session-context.md +1 -2
  27. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-agent.md +75 -0
  28. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-lite.md +66 -0
  29. package/bundled/skills/_metadata.json +1 -1
  30. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +3 -8
  31. package/bundled/skills/feature-pipeline-launcher/SKILL.md +4 -16
  32. package/bundled/skills/feature-planner/SKILL.md +8 -4
  33. package/bundled/skills/feature-planner/assets/planning-guide.md +16 -11
  34. package/bundled/skills/feature-planner/references/browser-interaction.md +9 -8
  35. package/bundled/skills/feature-planner/references/completeness-review.md +1 -1
  36. package/bundled/skills/feature-planner/references/error-recovery.md +1 -1
  37. package/bundled/skills/feature-planner/references/incremental-feature-planning.md +1 -1
  38. package/bundled/skills/feature-planner/scripts/validate-and-generate.py +10 -7
  39. package/bundled/skills/recovery-workflow/SKILL.md +3 -3
  40. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +4 -15
  41. package/package.json +1 -1
  42. package/bundled/dev-pipeline/retry-bugfix.sh +0 -429
  43. package/bundled/dev-pipeline/retry-feature.sh +0 -445
  44. package/bundled/dev-pipeline/retry-refactor.sh +0 -441
  45. package/bundled/dev-pipeline/templates/sections/failure-log-check.md +0 -9
  46. package/bundled/dev-pipeline/templates/sections/resume-header.md +0 -5
  47. package/bundled/dev-pipeline/templates/sections/test-failure-recovery.md +0 -75
@@ -2,40 +2,18 @@
2
2
 
3
3
  ## Session Context
4
4
 
5
- - **Pipeline Run ID**: {{RUN_ID}}
6
- - **Session ID**: {{SESSION_ID}}
7
5
  - **Bug ID**: {{BUG_ID}}
8
6
  - **Bug Title**: {{BUG_TITLE}}
9
7
  - **Severity**: {{SEVERITY}}
10
8
  - **Verification Type**: {{VERIFICATION_TYPE}}
11
- - **Retry Count**: {{RETRY_COUNT}} / {{MAX_RETRIES}}
12
- - **Previous Session Status**: {{PREV_SESSION_STATUS}}
13
- - **Resume From Phase**: {{RESUME_PHASE}}
14
9
 
15
10
  ## Your Mission
16
11
 
17
- You are the **bug fix session orchestrator**. Fix Bug {{BUG_ID}}: "{{BUG_TITLE}}".
12
+ You are the **bug fix session agent**. Fix Bug {{BUG_ID}}: "{{BUG_TITLE}}".
18
13
 
19
- **CRITICAL SESSION LIFECYCLE RULE**: You MUST NOT exit until ALL work is complete and session-status.json is written. When you spawn subagents, you MUST **wait for each to finish** (run_in_background=false) before proceeding. Do NOT spawn an agent in the background and exit — that kills the session.
14
+ **CRITICAL**: You MUST NOT exit until ALL work is complete and committed.
20
15
 
21
- **NON-INTERACTIVE MODE**: You are running in headless non-interactive mode. There is NO human on the other end. NEVER ask for user confirmation, NEVER wait for user input, NEVER use interactive prompts (e.g. "Would you like me to…"). If a skill has an interactive step (e.g. offer remediation, ask for approval), skip it and proceed autonomously. Make decisions based on the data available and move forward.
22
-
23
- **MANDATORY TEAM REQUIREMENT**: You MUST use the `prizm-dev-team` agents (Dev + Reviewer). This is NON-NEGOTIABLE. All implementation and review work MUST be performed by the appropriate team agents (Dev, Reviewer). You are the orchestrator — handle coordination, planning, and commit phases directly.
24
-
25
- **BUG FIX DOCUMENTATION POLICY**:
26
- - **DEFAULT**: Run `/prizmkit-retrospective` with structural sync only (Job 1). Skip knowledge injection (Job 2).
27
- - **UPDATE DOCS** (run full retrospective — Job 1 + Job 2) when the bug fix causes:
28
- • Interface signature changes
29
- • Dependency additions/removals
30
- • Observable behavior changes to existing features
31
- • Newly discovered TRAPs (gotchas/pitfalls)
32
- - **Simple bugs** (single file, clear root cause, ≤10 lines): Direct triage → fix → commit. No spec/plan needed. Artifacts: `fix-plan.md` + `fix-report.md` only.
33
- - **Complex bugs** (cross-module, cascading, data model/API changes): Use `/prizmkit-plan` with `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/` → generates `spec.md` + `plan.md`. Then use `/prizmkit-implement` to execute the plan. Artifacts: `spec.md` + `plan.md` + `fix-report.md`.
34
- - Commit with `fix(<scope>):` prefix, NOT `feat:`
35
-
36
- ### Team Definition Reference
37
-
38
- - **Team config**: `{{TEAM_CONFIG_PATH}}`
16
+ **NON-INTERACTIVE MODE**: There is NO human on the other end. NEVER ask for user confirmation, NEVER wait for user input. Make decisions autonomously and move forward.
39
17
 
40
18
  ### Bug Description
41
19
 
@@ -58,203 +36,184 @@ You are the **bug fix session orchestrator**. Fix Bug {{BUG_ID}}: "{{BUG_TITLE}}
58
36
 
59
37
  {{GLOBAL_CONTEXT}}
60
38
 
61
- ## Bug Fix Artifacts Directory
39
+ ### Project Conventions
62
40
 
63
- **ALWAYS** use per-bug subdirectory `.prizmkit/bugfix/{{BUG_ID}}/`:
41
+ > Read {{PLATFORM_CONVENTIONS}} for project-level coding standards, architecture decisions, and development rules.
64
42
 
65
- ```
66
- Simple bugs:
67
- .prizmkit/bugfix/{{BUG_ID}}/
68
- ├── fix-plan.md Phase 1 output (generated after triage)
69
- └── fix-report.md ← Phase 5 output (generated after commit)
43
+ ## ⚠️ Context Budget Rules (CRITICAL)
44
+
45
+ 0. **NON-INTERACTIVE MODE** — NEVER ask for confirmation. Proceed autonomously.
46
+ 1. **context-snapshot.md is your single source of truth** — After it is built, read context-snapshot.md instead of re-reading individual source files.
47
+ 2. **Never re-read your own writes** Trust your write was correct.
48
+ 3. **Stay focused** — Do NOT explore code unrelated to this bug.
49
+ 4. **Minimize tool output** — Capture to temp file, scan head/tail, filter with grep/sed/awk. Never load full output.
50
+ 5. **No intermediate commits** — All changes committed once at the end via `/prizmkit-committer`.
70
51
 
71
- Complex bugs (cross-module, data model/API changes):
52
+ ## Bug Fix Artifacts Directory
53
+
54
+ ```
72
55
  .prizmkit/bugfix/{{BUG_ID}}/
73
- ├── spec.md ← /prizmkit-plan output (goals, root cause, scope)
74
- ├── plan.md ← /prizmkit-plan output (fix approach, tasks)
75
- └── fix-report.md Phase 5 output (generated after commit)
56
+ ├── spec.md ← /prizmkit-plan output (root cause, scope, behavior preservation)
57
+ ├── plan.md ← /prizmkit-plan output (fix tasks, first task = reproduction test)
58
+ ├── context-snapshot.md Project context for this bug
59
+ └── fix-report.md ← Final bug resolution report
76
60
  ```
77
61
 
78
- **IMPORTANT**: Simple bugs produce 2 artifact files (fix-plan.md + fix-report.md). Complex bugs produce 3 artifact files (spec.md + plan.md + fix-report.md).
79
-
80
62
  ## Workflow Checkpoint System
81
63
 
82
- A checkpoint file tracks your progress through this workflow:
83
-
84
64
  **Path**: `{{CHECKPOINT_PATH}}`
85
65
 
86
66
  **Rules**:
87
- 1. **Before each step**: Read `workflow-checkpoint.json`, verify the previous step has `status: "completed"` or `status: "skipped"`. If not, complete it first.
88
- 2. **Starting a step**: Update the current step to `status: "in_progress"`.
89
- 3. **After each step completes**: Update the step to `status: "completed"`. Verify JSON is valid after writing.
90
- 4. **On failure**: Set the step to `status: "failed"` and halt.
91
- 5. **On resume**: Steps already `"completed"` are skipped. Start from the first `"pending"` or `"in_progress"` step.
67
+ 1. **Before each step**: Read `workflow-checkpoint.json`, verify the previous step is `"completed"`. If not, complete it first.
68
+ 2. **Starting a step**: Update to `status: "in_progress"`.
69
+ 3. **After step completes**: Update to `status: "completed"`.
70
+ 4. **On failure**: Set to `status: "failed"` and continue if possible.
71
+ 5. **On resume**: Skip `"completed"` steps. Start from first `"pending"` or `"in_progress"` step.
72
+
73
+ ---
92
74
 
93
- ## Execution Instructions
75
+ ## Execution
94
76
 
95
- **YOU are the orchestrator. Execute each phase by spawning the appropriate team agent with run_in_background=false.**
77
+ ### Phase 0: Initialize
96
78
 
97
- ### Step 1: Initialize
79
+ ```bash
80
+ mkdir -p .prizmkit/bugfix/{{BUG_ID}}
81
+ ```
98
82
 
99
- #### Agent Setup
83
+ ### Phase 1: Diagnose & Plan
100
84
 
101
- Reference `{{TEAM_CONFIG_PATH}}` for agent definitions:
102
- - Dev: `{{DEV_SUBAGENT_PATH}}`
103
- - Reviewer: `{{REVIEWER_SUBAGENT_PATH}}`
85
+ **Goal**: Identify root cause, build project context, produce spec.md + plan.md.
104
86
 
105
- 3. Create bug fix artifacts directory:
106
- ```bash
107
- mkdir -p .prizmkit/bugfix/{{BUG_ID}}
108
- ```
87
+ **Step 1 Diagnose the bug**:
109
88
 
110
- ### Step 2: Pipeline Phases
89
+ 1. Read `.prizm-docs/root.prizm` and relevant L1/L2 docs for affected modules
90
+ 2. Trace the bug:
91
+ - Classify error type (Runtime / Network / Auth / Data / Logic / Config / External)
92
+ - Check `.prizm-docs/` TRAPS sections for matching known issues
93
+ - Trace call chain from error source to root cause
94
+ - Identify all affected files and modules
95
+ 3. Read the affected source files and related test files
111
96
 
112
- #### Phase 1: Triage Classification
97
+ **Step 2 Build context snapshot** (skip if already exists):
113
98
 
114
- **Goal**: Classify the bug, identify scope and severity, check known issues, produce fix-plan.md.
99
+ Write `.prizmkit/bugfix/{{BUG_ID}}/context-snapshot.md`:
100
+ - **Section 1 — Bug Brief**: bug description + acceptance criteria + root cause analysis
101
+ - **Section 2 — Affected Files**: full verbatim content of each affected source file
102
+ - **Section 3 — Existing Tests**: full content of related test files
103
+ - **Section 4 — Prizm Context**: relevant TRAPS, RULES from .prizm-docs/
115
104
 
116
- - Spawn Dev agent (Agent tool, subagent_type="prizm-dev-team-dev", run_in_background=false)
117
- Prompt: "Read {{DEV_SUBAGENT_PATH}}. For bug {{BUG_ID}} ('{{BUG_TITLE}}'):
118
- 1. Triage the bug: classify error type (Runtime/Network/Auth/Data/Logic/Config/External), check `.prizm-docs/` TRAPS for known patterns, trace call chain to identify root cause
119
- 2. Check `.prizm-docs/` TRAPS sections for matching known issues
120
- 3. Classify: category, subcategory, root cause (confirmed or suspected), affected files
121
- 4. Assess impact: which modules are affected, what is the blast radius
122
- 5. Design test strategy based on verification_type='{{VERIFICATION_TYPE}}'
123
- 6. Propose fix approach: specific code changes, estimated scope
124
- 7. Write the complete fix plan to `.prizmkit/bugfix/{{BUG_ID}}/fix-plan.md`
105
+ **Step 3 Plan the fix**:
125
106
 
126
- The fix-plan.md MUST contain these sections:
127
- - Bug Summary (ID, title, severity, source type, affected feature)
128
- - Root Cause Analysis (error classification, root cause, call chain, TRAP match)
129
- - Impact Assessment (directly affected files, potentially affected modules)
130
- - Test Strategy (reproduction test design, regression test plan, manual steps if hybrid/manual)
131
- - Fix Approach (proposed fix, fix scope, constraints)
132
- "
133
- - **Wait for Dev to return**
134
- - **CP-BF-1**: `.prizmkit/bugfix/{{BUG_ID}}/fix-plan.md` exists
135
- - **Checkpoint update**: set step `bug-diagnosis` to `"completed"` in `{{CHECKPOINT_PATH}}`
107
+ Run `/prizmkit-plan` with `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`:
108
+ - The spec.md should capture: root cause, impact scope, behavior that must be preserved
109
+ - The plan.md Tasks section **MUST start with a reproduction test task** — a test that FAILS with current code (RED state), proving the bug exists
110
+ - Subsequent tasks implement the minimal fix to make the test pass (GREEN state)
111
+ - Resolve any `[NEEDS CLARIFICATION]` markers autonomously do NOT pause
136
112
 
137
113
  **DECISION GATE — Fast Path Check**:
138
- - If severity is LOW or MEDIUM, AND root cause is obvious (high confidence), AND fix is < 10 lines:
139
- → Set `FAST_PATH=true`, skip Phase 2, go to Phase 3
140
- - Otherwise proceed to Phase 2
114
+ - If plan.md has 2 tasks AND root cause is obvious mark `FAST_PATH=true`, skip Phase 3 (Review) later
115
+
116
+ **CP-1**: spec.md and plan.md exist with Tasks section.
117
+
118
+ **Checkpoint update**: Set step `bug-diagnosis-and-plan` to `"completed"`.
141
119
 
142
120
  {{IF_VERIFICATION_MANUAL_OR_HYBRID}}
143
- **NOTE**: When verification_type is 'manual' or 'hybrid', the fix-plan.md MUST also include:
121
+ **NOTE**: verification_type is '{{VERIFICATION_TYPE}}'. The plan.md MUST also include:
144
122
  - Manual Verification Plan section with UAT checklist
145
123
  - User Review Required section specifying reviewer and blocking behavior
146
124
  {{END_IF_VERIFICATION_MANUAL_OR_HYBRID}}
147
125
 
148
126
  ---
149
127
 
150
- #### Phase 2: Reproduce Reproduction Confirmation
151
-
152
- **Goal**: Create an automated reproduction that proves the bug exists.
153
-
154
- - Spawn Dev agent (Agent tool, subagent_type="prizm-dev-team-dev", run_in_background=false)
155
- Prompt: "Read {{DEV_SUBAGENT_PATH}}. For bug {{BUG_ID}}:
156
- 1. Read the fix plan from `.prizmkit/bugfix/{{BUG_ID}}/fix-plan.md`
157
- 2. Generate a minimal reproduction test (API: curl sequence; UI: step-by-step; Logic: unit test; Data: seed+query) that FAILS with current code
158
- 4. Execute the reproduction test to confirm it fails
159
- 5. If reproduction fails, refine and retry (max 2 rounds)
160
- 6. Report: reproduction test path, red/green status, investigation pointers
161
- "
162
- - **Wait for Dev to return**
163
- - If Dev reports reproduction failed after 2 rounds:
164
- - Output: "Unable to reproduce bug {{BUG_ID}}. Need more information."
165
- - Write session-status.json with status="partial", errors=["reproduction_failed"]
166
- - Set bug status to `needs_info` and STOP
167
- - **CP-BF-2**: Reproduction test exists and FAILS
168
- - **Checkpoint update**: set step `bug-reproduce` to `"completed"` in `{{CHECKPOINT_PATH}}`
128
+ ### Phase 2: Implement & Fix
169
129
 
170
- ---
130
+ **Goal**: Execute the fix plan. Reproduction test goes from RED → GREEN.
131
+
132
+ Run `/prizmkit-implement` with `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`:
133
+ - Executes plan.md tasks in order (TDD: first task creates failing test, subsequent tasks fix the code)
134
+ - Marks each task `[x]` on completion
135
+ - Runs test suite after each task
136
+ - Uses convergence-based test failure recovery (keep fixing while progress is being made)
137
+
138
+ After implement completes, verify:
139
+ 1. All tasks in plan.md are `[x]`
140
+ 2. Reproduction test passes (GREEN)
141
+ 3. Full test suite passes (no regression)
142
+ 4. Each acceptance criterion is met
171
143
 
172
- #### Phase 3: Fix Implementation
173
-
174
- **Goal**: Implement the fix. The reproduction test goes from red to green.
175
-
176
- - Spawn Dev agent (Agent tool, subagent_type="prizm-dev-team-dev", run_in_background=false)
177
- Prompt: "Read {{DEV_SUBAGENT_PATH}}. For bug {{BUG_ID}}:
178
- 1. Read the fix plan from `.prizmkit/bugfix/{{BUG_ID}}/fix-plan.md`
179
- 2. Read `.prizm-docs/` for affected modules (TRAPS, RULES, PATTERNS)
180
- 3. Implement the minimal fix following TDD:
181
- - The reproduction test is the 'red test'
182
- - Make it pass with the smallest possible code change
183
- - Do NOT refactor — fix the bug only
184
- 4. Run the reproduction test → MUST PASS
185
- 5. Run the module's test suite → MUST PASS (no regression)
186
- 6. If the fix involves multiple files or steps: run `/compact` after completing the core fix and before running the full test suite, to free context budget. If `/compact` is unavailable, continue without it.
187
- 7. If fix fails after 3 rounds, report detailed analysis
188
- "
189
- - **Wait for Dev to return**
190
- - If fix fails after 3 rounds: escalate to user, write status="failed"
191
- - **CP-BF-3**: Reproduction test passes, module tests pass
192
- - **Checkpoint update**: set step `bug-fix` to `"completed"` in `{{CHECKPOINT_PATH}}`
144
+ **CP-2**: All tasks complete, reproduction test passes, no regression.
145
+
146
+ **Checkpoint update**: Set step `prizmkit-implement` to `"completed"`.
193
147
 
194
148
  ---
195
149
 
196
- #### Phase 4: Verify — Code Review & Regression Verification
150
+ ### Phase 3: Review
151
+
152
+ If `FAST_PATH=true` (≤ 2 tasks, obvious root cause), skip this phase entirely.
197
153
 
198
- **Goal**: Ensure fix correctness and no regressions.
154
+ Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`:
155
+ - Reviews changes against spec.md
156
+ - If NEEDS_FIXES: fix the issues and re-run review (max 3 review rounds)
157
+ - If PASS or PASS_WITH_WARNINGS: proceed
199
158
 
200
- - Spawn Reviewer agent (Agent tool, subagent_type="prizm-dev-team-reviewer", run_in_background=false)
201
- Prompt: "Read {{REVIEWER_SUBAGENT_PATH}}. For bug {{BUG_ID}}:
202
- 1. Read `.prizmkit/bugfix/{{BUG_ID}}/fix-plan.md` for goals, root cause, and fix approach (always exists for both simple and complex bugs)
203
- 2. Read `.prizmkit/bugfix/{{BUG_ID}}/plan.md` (if it exists, complex bugs only) for architecture decisions and completed tasks
204
- 3. Run `/prizmkit-code-review` with artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/ scoped to CHANGED FILES ONLY (both phases: diagnostic + fix strategy)
205
- 4. Run full test suite and verify ALL tests pass
206
- 5. review-report.md will be written to .prizmkit/bugfix/{{BUG_ID}}/ by prizmkit-code-review
207
- 6. Report: number of findings found, or 'no findings' if clean
208
- "
209
- - **Wait for Reviewer to return**
210
- - **Verdict decision** (L4 responsibility): If findings exist → return to Phase 3 for refinement (max 2 review rounds). If no findings → proceed.
211
- - **CP-BF-4**: Code review passes, all tests green
212
- - **Checkpoint update**: set step `prizmkit-code-review` to `"completed"` in `{{CHECKPOINT_PATH}}`
159
+ **CP-3**: Code review passes, all tests green.
160
+
161
+ **Checkpoint update**: Set step `prizmkit-code-review` to `"completed"`.
213
162
 
214
163
  {{IF_VERIFICATION_MANUAL_OR_HYBRID}}
215
164
  **MANUAL VERIFICATION GATE**:
216
- - After automated review passes, Pipeline PAUSES here
217
- - Output: "Bug {{BUG_ID}} fix is ready for manual verification. Please perform UAT checklist from fix-plan.md."
218
- - Write session-status.json with status="partial", current_phase=4, resume_from_phase=5
219
- - Set bug status to `verifying` and wait for user confirmation
165
+ - After automated review passes, write session-status.json with status="partial", resume_from_phase=4
166
+ - Set bug status to `verifying` and STOP manual UAT required before commit
220
167
  {{END_IF_VERIFICATION_MANUAL_OR_HYBRID}}
221
168
 
222
169
  ---
223
170
 
224
- #### Phase 5: Commit & Learn — Commit & Knowledge Capture
225
-
226
- **Goal**: Commit the fix, update TRAPS, generate fix-report.md.
171
+ ### Phase 4: Commit & Learn
227
172
 
228
- **This phase is executed by YOU (the orchestrator), NOT a subagent.**
173
+ **Bug Fix Documentation Policy**:
174
+ - **DEFAULT**: Run `/prizmkit-retrospective` with structural sync only (Job 1). Skip knowledge injection.
175
+ - **Full retrospective** (Job 1 + Job 2): Only when the fix causes interface signature changes, dependency additions/removals, observable behavior changes, or reveals new TRAPs.
229
176
 
230
- 1. If a new pitfall was discovered (not previously in TRAPS):
177
+ **a.** If a new pitfall was discovered (not previously in TRAPS):
231
178
  - Update the affected module's TRAPS section in `.prizm-docs/`
232
179
  - Format: `- TRAP: <description> | FIX: <solution> | DATE: YYYY-MM-DD`
233
180
 
234
- 2. Run `/prizmkit-retrospective` following the BUG FIX DOCUMENTATION POLICY above:
235
- - **DEFAULT**: Structural sync only (Job 1)
236
- - **Full retrospective** (Job 1 + Job 2): Only if the fix changes interfaces, dependencies, observable behavior, or reveals new TRAPs
181
+ **b.** Run `/prizmkit-retrospective` following the policy above.
182
+ Stage doc changes: `git add .prizm-docs/`
237
183
 
238
- 3. Run `/prizmkit-committer` with:
239
- - Commit message: `fix({{FIX_SCOPE}}): {{BUG_TITLE}}`
184
+ **c.** Stage all changed files explicitly (NEVER use `git add -A` or `git add .`):
185
+ ```bash
186
+ git add <specific-files-modified>
187
+ git add .prizm-docs/
188
+ ```
189
+
190
+ **d.** Run `/prizmkit-committer`:
191
+ - Commit message prefix: `fix({{FIX_SCOPE}}): {{BUG_TITLE}}`
240
192
  - Include both fix code and reproduction test
241
- - Do NOT push (user will push manually)
193
+ - Do NOT push
194
+
195
+ **e.** Final verification:
196
+ ```bash
197
+ git status --short
198
+ ```
199
+ Working tree MUST be clean. If any files remain, amend the commit.
242
200
 
243
- 4. Write the complete fix report to `.prizmkit/bugfix/{{BUG_ID}}/fix-report.md`
201
+ **f.** Write fix report to `.prizmkit/bugfix/{{BUG_ID}}/fix-report.md`:
244
202
 
245
- The fix-report.md MUST contain these sections:
246
- - Bug Resolution Summary (ID, title, status, phases completed, duration)
247
- - What Was Fixed (changes made, diff summary, commit message)
248
- - Verification Results (reproduction test before/after, regression tests, review findings)
249
- - Knowledge Captured (TRAPS updated, prevention recommendation)
250
- - Acceptance Criteria Verification (checklist with pass/fail for each criterion)
203
+ The fix-report.md MUST contain:
204
+ - **Bug Resolution Summary**: ID, title, status, phases completed
205
+ - **What Was Fixed**: changes made, diff summary, commit hash
206
+ - **Verification Results**: reproduction test before/after, regression tests, review findings
207
+ - **Knowledge Captured**: TRAPS updated (if any), prevention recommendation
208
+ - **Acceptance Criteria Verification**: checklist with pass/fail for each criterion
251
209
 
252
- - **CP-BF-5**: Commit recorded, fix-report.md written, TRAPS updated (if applicable)
253
- - **Checkpoint update**: set steps `prizmkit-committer` and `bug-report` to `"completed"` in `{{CHECKPOINT_PATH}}`
210
+ **Checkpoint update**: Set steps `prizmkit-committer` and `bug-report` to `"completed"`.
211
+
212
+ ---
254
213
 
255
214
  ### Step 3: Report Session Status
256
215
 
257
- **CRITICAL**: Before this session ends, you MUST write the session status file.
216
+ **CRITICAL**: Before exiting, write the session status file.
258
217
 
259
218
  Write to: `{{SESSION_STATUS_PATH}}`
260
219
 
@@ -263,15 +222,16 @@ Write to: `{{SESSION_STATUS_PATH}}`
263
222
  "session_id": "{{SESSION_ID}}",
264
223
  "bug_id": "{{BUG_ID}}",
265
224
  "status": "<success|partial|failed>",
266
- "completed_phases": [1, 2, 3, 4, 5],
267
- "current_phase": 5,
268
- "checkpoint_reached": "CP-BF-5",
225
+ "completed_phases": [1, 2, 3, 4],
226
+ "current_phase": 4,
227
+ "checkpoint_reached": "CP-4",
269
228
  "fast_path": false,
270
229
  "errors": [],
271
230
  "can_resume": false,
272
231
  "resume_from_phase": null,
273
232
  "artifacts": {
274
- "fix_plan_path": ".prizmkit/bugfix/{{BUG_ID}}/fix-plan.md",
233
+ "spec_path": ".prizmkit/bugfix/{{BUG_ID}}/spec.md",
234
+ "plan_path": ".prizmkit/bugfix/{{BUG_ID}}/plan.md",
275
235
  "fix_report_path": ".prizmkit/bugfix/{{BUG_ID}}/fix-report.md"
276
236
  },
277
237
  "git_commit": "<commit hash>",
@@ -280,30 +240,23 @@ Write to: `{{SESSION_STATUS_PATH}}`
280
240
  }
281
241
  ```
282
242
 
283
- **Status values**: `success` (all phases done) | `partial` (can resume) | `failed` (unrecoverable)
284
-
285
243
  ## Critical Paths
286
244
 
287
245
  | Resource | Path |
288
246
  |----------|------|
289
- | Team Definition (source of truth) | `{{TEAM_CONFIG_PATH}}` |
290
247
  | Bug Fix Artifacts Dir | `.prizmkit/bugfix/{{BUG_ID}}/` |
291
- | Fix Plan | `.prizmkit/bugfix/{{BUG_ID}}/fix-plan.md` |
248
+ | Spec | `.prizmkit/bugfix/{{BUG_ID}}/spec.md` |
249
+ | Plan | `.prizmkit/bugfix/{{BUG_ID}}/plan.md` |
292
250
  | Fix Report | `.prizmkit/bugfix/{{BUG_ID}}/fix-report.md` |
293
- | Dev Agent Def | {{DEV_SUBAGENT_PATH}} |
294
- | Reviewer Agent Def | {{REVIEWER_SUBAGENT_PATH}} |
295
251
  | Session Status Output | {{SESSION_STATUS_PATH}} |
296
252
  | Project Root | {{PROJECT_ROOT}} |
297
253
 
298
254
  ## Reminders
299
255
 
300
- - **MANDATORY**: Use `prizm-dev-team` agents single-agent execution is FORBIDDEN
301
- - **Only 2 artifact files per bug**: fix-plan.md + fix-report.md — NEVER more
302
- - **Simple bugs**: No spec/plan needed artifacts are `fix-plan.md` + `fix-report.md` only
303
- - **Complex bugs** (cross-module, data model/API changes): Use `/prizmkit-plan` with `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/` → `spec.md` + `plan.md` + `fix-report.md`
304
- - **DEFAULT**: Run `/prizmkit-retrospective` structural sync only (Job 1). Run full retrospective (Job 1 + Job 2) when fix changes interfaces, dependencies, observable behavior, or reveals new TRAPs
305
- - **Commit with** `fix(<scope>):` prefix, NOT `feat:`
306
- - **Update TRAPS** in `.prizm-docs/` only if a genuinely new pitfall was discovered
307
- - Dev agents use TDD approach: reproduction test goes from RED → GREEN
256
+ - Use L1 Skills: `/prizmkit-plan`, `/prizmkit-implement`, `/prizmkit-code-review`, `/prizmkit-committer`, `/prizmkit-retrospective`
257
+ - All skills use `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`
258
+ - plan.md first task MUST be reproduction test (RED GREEN TDD)
259
+ - Commit with `fix(<scope>):` prefix, NOT `feat:`
260
+ - DEFAULT: `/prizmkit-retrospective` structural sync only (Job 1). Full retrospective when fix changes interfaces/dependencies/behavior
308
261
  - ALWAYS write session-status.json before exiting
309
- - Do NOT use `run_in_background=true` when spawning agents
262
+ - Do NOT run `git add`/`git commit` during Phases 1-3 — all committed once in Phase 4
@@ -72,9 +72,10 @@
72
72
  "enum": [
73
73
  "low",
74
74
  "medium",
75
- "high"
75
+ "high",
76
+ "critical"
76
77
  ],
77
- "description": "Estimated implementation complexity. Determines pipeline execution tier: low=lite, medium=standard, high=full."
78
+ "description": "Estimated implementation complexity. Determines pipeline execution tier: low/medium → lite (single agent), high → standard (orchestrator + dev + reviewer), critical → full (full team + critic)."
78
79
  },
79
80
  "dependencies": {
80
81
  "type": "array",
@@ -166,32 +167,16 @@
166
167
  },
167
168
  "browser_interaction": {
168
169
  "type": "object",
169
- "description": "Browser verification config for features with UI. Requires playwright-cli. Pipeline uses this to verify UI behavior after implementation.",
170
+ "description": "Browser verification config for features with UI. Requires playwright-cli. AI auto-detects dev server command, URL, and port from project config at runtime.",
170
171
  "properties": {
171
- "url": {
172
- "type": "string",
173
- "description": "URL to open for verification (e.g. http://localhost:3000/login)"
174
- },
175
- "setup_command": {
176
- "type": "string",
177
- "description": "Command to start the dev server before verification (e.g. npm run dev)"
178
- },
179
172
  "verify_steps": {
180
173
  "type": "array",
181
- "description": "Verification goals describing WHAT to verify (not HOW). Pipeline AI decides concrete playwright-cli actions at runtime based on actual code and snapshot.",
174
+ "description": "Verification goals describing WHAT to verify (not HOW). AI decides concrete playwright-cli actions at runtime based on actual code and snapshot. If omitted, AI explores the app and verifies the feature works.",
182
175
  "items": {
183
176
  "type": "string"
184
177
  }
185
- },
186
- "screenshot": {
187
- "type": "boolean",
188
- "description": "Capture screenshot after verification steps. Default: true.",
189
- "default": true
190
178
  }
191
- },
192
- "required": [
193
- "url"
194
- ]
179
+ }
195
180
  }
196
181
  }
197
182
  }
@@ -2,16 +2,11 @@
2
2
 
3
3
  ## Session Context
4
4
 
5
- - **Pipeline Run ID**: {{RUN_ID}}
6
- - **Session ID**: {{SESSION_ID}}
7
5
  - **Refactor ID**: {{REFACTOR_ID}}
8
6
  - **Refactor Title**: {{REFACTOR_TITLE}}
9
7
  - **Refactor Type**: {{REFACTOR_TYPE}}
10
8
  - **Priority**: {{PRIORITY}}
11
9
  - **Complexity**: {{COMPLEXITY}}
12
- - **Retry Count**: {{RETRY_COUNT}} / {{MAX_RETRIES}}
13
- - **Previous Session Status**: {{PREV_SESSION_STATUS}}
14
- - **Resume From Phase**: {{RESUME_PHASE}}
15
10
 
16
11
  ## Your Mission
17
12
 
@@ -64,6 +59,10 @@ You are the **refactor session orchestrator**. Execute Refactor {{REFACTOR_ID}}:
64
59
 
65
60
  {{GLOBAL_CONTEXT}}
66
61
 
62
+ ### Project Conventions
63
+
64
+ > Read {{PLATFORM_CONVENTIONS}} for project-level coding standards, architecture decisions, and development rules.
65
+
67
66
  ## Refactor Artifacts Directory
68
67
 
69
68
  **ALWAYS** use per-refactor subdirectory `.prizmkit/refactor/{{REFACTOR_ID}}/`:
@@ -136,11 +135,12 @@ Resolve any `[NEEDS CLARIFICATION]` markers using the refactor description — d
136
135
  1. Read `.prizmkit/refactor/{{REFACTOR_ID}}/spec.md` and `.prizmkit/refactor/{{REFACTOR_ID}}/plan.md`
137
136
  2. Read `.prizm-docs/` for affected modules (TRAPS, RULES, PATTERNS)
138
137
  3. Before making any changes, run the existing test suite to establish a green baseline
139
- 4. Execute each task from plan.md in order:
140
- - Apply the change
141
- - Run the test suite after EVERY task all tests MUST pass
138
+ 4. Run `/prizmkit-implement` with `artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/` this handles the full implementation cycle:
139
+ - Reads plan.md Tasks section
140
+ - Implements task-by-task, marking each `[x]` immediately
141
+ - Runs tests after EVERY task — all tests MUST pass (behavior preservation)
142
142
  - If tests fail: revert the task, analyze why, try alternative approach
143
- - Mark task as [x] in plan.md after tests pass
143
+ - Writes '## Implementation Log' to context-snapshot.md (or equivalent)
144
144
  5. Do NOT change behavior — only improve structure
145
145
  6. If the refactor involves multiple files: run `/compact` after completing half the tasks to free context budget. If `/compact` is unavailable, continue without it.
146
146
  7. After all tasks complete, run the full test suite one final time
@@ -8,6 +8,6 @@ You are running in **headless non-interactive mode** with a FINITE context windo
8
8
  2. **Never re-read your own writes** — After you create/modify a file, do NOT read it back to verify. Trust your write was correct.
9
9
  3. **Stay focused** — Do NOT explore code unrelated to this feature. No curiosity-driven reads.
10
10
  4. **One task at a time** — Complete and test one task before starting the next.
11
- 5. **Minimize tool output** — When running commands, use `| head -20` or `| tail -20` to limit output. Never dump entire test suites or logs.
11
+ 5. **Minimize tool output** — Never load full command output into context. First capture to a temp file (`cmd 2>&1 | tee /tmp/out.txt | tail -20`), then scan the head/tail to identify relevant fields, and use targeted filtering (`grep`, `sed`, `awk`) to extract only the information needed for the current task. Only read the filtered result never the raw full output.
12
12
  6. **No intermediate commits** — Do NOT run `git add`/`git commit` during implementation phases. All changes are committed once at the end via `/prizmkit-committer`.
13
13
  7. **Capture test output once** — When running test suites, always use `$TEST_CMD 2>&1 | tee /tmp/test-out.txt | tail -20`. Then grep `/tmp/test-out.txt` for details. Never re-run the suite just to apply a different filter.
@@ -22,4 +22,8 @@
22
22
  ### App Global Context
23
23
 
24
24
  {{GLOBAL_CONTEXT}}
25
+
26
+ ### Project Conventions
27
+
28
+ > Read {{PLATFORM_CONVENTIONS}} for project-level coding standards, architecture decisions, and development rules. Follow these conventions throughout implementation.
25
29
  </feature-context>
@@ -2,32 +2,49 @@
2
2
 
3
3
  You MUST execute this phase. Do NOT skip it. Do NOT mark it as completed without actually running playwright-cli.
4
4
 
5
- **Startup**:
6
- 1. Check if port is already in use: `lsof -ti:3001 | xargs kill -9 2>/dev/null || true`
7
- 2. Start dev server: `{{BROWSER_SETUP_COMMAND}}`
8
- 3. Wait for server to be ready: poll `{{BROWSER_URL}}` with `curl -s -o /dev/null -w "%{http_code}"` until it returns 200 or 302 (max 30 seconds, 2s interval)
9
- 4. If the page requires authentication, use playwright-cli to register a test user and log in first
10
-
11
- **Verification**:
12
- 5. Use `playwright-cli snapshot` on `{{BROWSER_URL}}` to discover actual element refs, then verify these goals:
13
- {{BROWSER_VERIFY_STEPS}}
14
- Decide the concrete playwright-cli actions (click, fill, assert, etc.) yourself based on the snapshot output and your knowledge of the implemented code. The goals above describe WHAT to verify — you determine HOW.
15
- 6. Take a final screenshot for evidence
16
-
17
- **Cleanup (REQUIRED — you started it, you stop it)**:
18
- 7. Stop the dev server process you started in step 2 (kill the process)
19
- 8. Verify port is released: `lsof -ti:3001 | xargs kill -9 2>/dev/null || true`
20
-
21
- **Reporting**:
22
- 9. Append results to `context-snapshot.md`:
5
+ **Step 1 — Start Dev Server**:
6
+
7
+ You know this project's tech stack. Detect and start the dev server yourself:
8
+
9
+ 1. Identify the dev server start command from project config (`package.json` scripts, `Makefile`, `docker-compose.yml`, etc.)
10
+ 2. Choose an available port — check what the project defaults to, or pick one that is free:
11
+ ```bash
12
+ lsof -ti:<port> 2>/dev/null && echo "PORT_IN_USE" || echo "PORT_FREE"
23
13
  ```
24
- ## Browser Verification
25
- URL: {{BROWSER_URL}}
26
- Steps executed: [list]
27
- Screenshot: [path]
28
- Result: PASS / FAIL (reason)
29
- Server cleanup: confirmed
14
+ 3. Start the dev server in background, capture PID:
15
+ ```bash
16
+ <start-command> &
17
+ DEV_SERVER_PID=$!
30
18
  ```
19
+ 4. Wait for server to be ready: poll the target URL with `curl -s -o /dev/null -w "%{http_code}"` until it returns 200 or 302 (max 30 seconds, 2s interval)
20
+ 5. If the page requires authentication, use playwright-cli to register a test user and log in first
21
+
22
+ **Step 2 — Verification**:
23
+
24
+ Use `playwright-cli snapshot` on the running app to discover actual element refs, then verify these goals:
25
+ {{BROWSER_VERIFY_STEPS}}
26
+
27
+ Decide the concrete playwright-cli actions (click, fill, assert, etc.) yourself based on the snapshot output and your knowledge of the implemented code. The goals above describe WHAT to verify — you determine HOW.
28
+
29
+ Take a final screenshot for evidence.
30
+
31
+ **Step 3 — Cleanup (REQUIRED — you started it, you stop it)**:
32
+
33
+ 1. Kill the dev server process: `kill $DEV_SERVER_PID 2>/dev/null || true`
34
+ 2. Verify port is released: `lsof -ti:<port> | xargs kill -9 2>/dev/null || true`
35
+
36
+ **Step 4 — Reporting**:
37
+
38
+ Append results to `context-snapshot.md`:
39
+ ```
40
+ ## Browser Verification
41
+ URL: <actual URL used>
42
+ Dev Server Command: <actual command used>
43
+ Steps executed: [list]
44
+ Screenshot: [path]
45
+ Result: PASS / FAIL (reason)
46
+ Server cleanup: confirmed
47
+ ```
31
48
 
32
49
  If verification fails, log the failure details but continue to commit. Failures do NOT block the commit, but you MUST attempt verification and MUST clean up the dev server.
33
50