prizmkit 1.1.111 → 1.1.113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/codex/skill-adapter.js +4 -0
  3. package/bundled/agents/prizm-dev-team-reviewer.md +12 -1
  4. package/bundled/dev-pipeline/SCHEMA_ANALYSIS.md +10 -10
  5. package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +1 -0
  6. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +20 -73
  7. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +290 -421
  8. package/bundled/dev-pipeline/scripts/generate-recovery-prompt.py +1 -1
  9. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +259 -481
  10. package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +34 -0
  11. package/bundled/dev-pipeline/scripts/init-pipeline.py +12 -0
  12. package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +24 -1
  13. package/bundled/dev-pipeline/scripts/prompt_framework.py +312 -0
  14. package/bundled/dev-pipeline/scripts/update-bug-status.py +87 -20
  15. package/bundled/dev-pipeline/scripts/update-feature-status.py +82 -16
  16. package/bundled/dev-pipeline/scripts/update-refactor-status.py +68 -28
  17. package/bundled/dev-pipeline/scripts/utils.py +171 -0
  18. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +1 -1
  19. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +7 -1
  20. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +17 -19
  21. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +21 -26
  22. package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +9 -1
  23. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +11 -8
  24. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +122 -182
  25. package/bundled/dev-pipeline/templates/sections/bugfix-artifacts.md +16 -0
  26. package/bundled/dev-pipeline/templates/sections/bugfix-critical-paths.md +12 -0
  27. package/bundled/dev-pipeline/templates/sections/bugfix-mission.md +9 -0
  28. package/bundled/dev-pipeline/templates/sections/bugfix-phase-commit-report.md +31 -0
  29. package/bundled/dev-pipeline/templates/sections/bugfix-phase-critic.md +22 -0
  30. package/bundled/dev-pipeline/templates/sections/bugfix-phase-diagnose-plan.md +23 -0
  31. package/bundled/dev-pipeline/templates/sections/bugfix-phase-implement.md +20 -0
  32. package/bundled/dev-pipeline/templates/sections/bugfix-phase-init.md +9 -0
  33. package/bundled/dev-pipeline/templates/sections/bugfix-phase-manual-verification.md +15 -0
  34. package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +29 -0
  35. package/bundled/dev-pipeline/templates/sections/bugfix-reminders.md +11 -0
  36. package/bundled/dev-pipeline/templates/sections/bugfix-session-context.md +7 -0
  37. package/bundled/dev-pipeline/templates/sections/bugfix-session-status.md +31 -0
  38. package/bundled/dev-pipeline/templates/sections/bugfix-task-contract.md +40 -0
  39. package/bundled/dev-pipeline/templates/sections/failure-capture.md +2 -2
  40. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +8 -2
  41. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-opencli.md +7 -1
  42. package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +7 -1
  43. package/bundled/dev-pipeline/templates/sections/refactor-artifacts.md +17 -0
  44. package/bundled/dev-pipeline/templates/sections/refactor-critical-paths.md +13 -0
  45. package/bundled/dev-pipeline/templates/sections/refactor-mission.md +9 -0
  46. package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +37 -0
  47. package/bundled/dev-pipeline/templates/sections/refactor-phase-critic.md +22 -0
  48. package/bundled/dev-pipeline/templates/sections/refactor-phase-implement.md +16 -0
  49. package/bundled/dev-pipeline/templates/sections/refactor-phase-init.md +9 -0
  50. package/bundled/dev-pipeline/templates/sections/refactor-phase-plan.md +22 -0
  51. package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +19 -0
  52. package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +11 -0
  53. package/bundled/dev-pipeline/templates/sections/refactor-session-context.md +7 -0
  54. package/bundled/dev-pipeline/templates/sections/refactor-session-status.md +28 -0
  55. package/bundled/dev-pipeline/templates/sections/refactor-task-contract.md +52 -0
  56. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +104 -26
  57. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +14 -0
  58. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +239 -0
  59. package/bundled/dev-pipeline/tests/test_unified_cli.py +6 -2
  60. package/bundled/dev-pipeline/tests/test_utils.py +66 -1
  61. package/bundled/skills/_metadata.json +1 -1
  62. package/bundled/skills/app-planner/SKILL.md +8 -7
  63. package/bundled/skills/app-planner/references/project-brief-guide.md +2 -2
  64. package/bundled/skills/app-planner/references/rules/backend/derivation-rules.md +1 -1
  65. package/bundled/skills/app-planner/references/rules/frontend/derivation-rules.md +1 -1
  66. package/bundled/skills/app-planner/references/rules-configuration.md +53 -26
  67. package/bundled/skills/bug-fix-workflow/SKILL.md +191 -336
  68. package/bundled/skills/bug-planner/SKILL.md +6 -5
  69. package/bundled/skills/bug-planner/references/critic-and-verification.md +3 -3
  70. package/bundled/skills/bug-planner/references/schema-validation.md +2 -1
  71. package/bundled/skills/bug-planner/scripts/validate-bug-list.py +70 -1
  72. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +21 -21
  73. package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +2 -2
  74. package/bundled/skills/feature-pipeline-launcher/SKILL.md +25 -26
  75. package/bundled/skills/feature-planner/SKILL.md +9 -11
  76. package/bundled/skills/feature-planner/assets/planning-guide.md +1 -1
  77. package/bundled/skills/feature-planner/references/decomposition-patterns.md +1 -1
  78. package/bundled/skills/feature-planner/references/error-recovery.md +2 -1
  79. package/bundled/skills/feature-planner/references/incremental-feature-planning.md +2 -2
  80. package/bundled/skills/feature-planner/references/new-project-planning.md +35 -39
  81. package/bundled/skills/feature-planner/scripts/validate-and-generate.py +1 -1
  82. package/bundled/skills/feature-workflow/SKILL.md +170 -298
  83. package/bundled/skills/prizmkit/SKILL.md +103 -57
  84. package/bundled/skills/prizmkit-code-review/SKILL.md +97 -116
  85. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +1 -0
  86. package/bundled/skills/prizmkit-code-review/references/reviewer-agent-prompt.md +14 -3
  87. package/bundled/skills/prizmkit-committer/SKILL.md +59 -47
  88. package/bundled/skills/prizmkit-deploy/SKILL.md +162 -381
  89. package/bundled/skills/prizmkit-deploy/references/database-setup.md +12 -3
  90. package/bundled/skills/prizmkit-deploy/references/ssh-adapter-flow.md +220 -0
  91. package/bundled/skills/prizmkit-implement/SKILL.md +51 -40
  92. package/bundled/skills/prizmkit-init/SKILL.md +4 -3
  93. package/bundled/skills/prizmkit-plan/SKILL.md +85 -70
  94. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +94 -73
  95. package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +20 -18
  96. package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +11 -13
  97. package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +18 -14
  98. package/bundled/skills/prizmkit-retrospective/SKILL.md +56 -48
  99. package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +79 -27
  100. package/bundled/skills/prizmkit-test/SKILL.md +138 -141
  101. package/bundled/skills/prizmkit-test/references/boundary-coverage-protocol.md +1 -1
  102. package/bundled/skills/prizmkit-test/references/examples.md +11 -9
  103. package/bundled/skills/prizmkit-test/references/test-generation-steps.md +1 -1
  104. package/bundled/skills/prizmkit-test/references/test-report-template.md +2 -2
  105. package/bundled/skills/recovery-workflow/SKILL.md +195 -256
  106. package/bundled/skills/recovery-workflow/evals/evals.json +21 -13
  107. package/bundled/skills/recovery-workflow/references/detection.md +48 -39
  108. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +258 -322
  109. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +32 -13
  110. package/bundled/skills/refactor-planner/SKILL.md +2 -2
  111. package/bundled/skills/refactor-planner/references/behavior-preservation.md +24 -19
  112. package/bundled/skills/refactor-planner/references/fast-path.md +2 -4
  113. package/bundled/skills/refactor-planner/references/planning-phases.md +2 -2
  114. package/bundled/skills/refactor-workflow/SKILL.md +174 -307
  115. package/package.json +1 -1
  116. package/src/scaffold.js +5 -0
  117. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-review.md +0 -6
  118. package/bundled/skills/feature-workflow/references/brainstorm-guide.md +0 -137
  119. package/bundled/skills/refactor-workflow/references/brainstorm-guide.md +0 -116
@@ -12,7 +12,7 @@ You are the **session orchestrator**. Implement Feature {{FEATURE_ID}}: "{{FEATU
12
12
 
13
13
  **CRITICAL**: You MUST NOT exit until ALL work is complete and committed. When you spawn Critic or Reviewer agents, wait for each to finish (run_in_background=false). Do NOT spawn agents in background and exit — that kills the session.
14
14
 
15
- **Tier 3 — Orchestrator + Critic/Reviewer**: For complex features, the main orchestrator handles context, planning, and implementation directly. Critic challenges the plan and Reviewer reviews. Do not spawn a top-level Dev implementation agent.
15
+ **Tier 3 — Orchestrator + Critic**: For complex features, the main orchestrator handles context, planning, and implementation directly. Critic challenges the plan. Do not spawn top-level Dev or Reviewer subagents; code review runs later through `/prizmkit-code-review`.
16
16
 
17
17
  **Agent spawn failure policy (all Agent tool calls)**:
18
18
  - If spawning Reviewer or Critic fails with team/config/lock errors, retry at most once.
@@ -180,23 +180,16 @@ Before proceeding past CP-1, verify:
180
180
 
181
181
  **CP-1**: Both spec.md and plan.md exist.
182
182
 
183
- ### Phase 3: AnalyzeReviewer Agent
183
+ ### Phase 3: Plan Self-Check Orchestrator Direct
184
184
 
185
- Spawn Reviewer agent (Agent tool, subagent_type="prizm-dev-team-reviewer", mode="plan", run_in_background=false, isolation=default/no worktree). Do not request worktree isolation; this prevents AI tool-created `.claude/worktrees/...` subagent worktrees. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are separate and controlled by `USE_WORKTREE`.
185
+ Do not spawn a top-level Reviewer subagent for planning analysis. Perform a bounded self-check before implementation:
186
186
 
187
- Spawn failure cap: for team/config/lock errors, retry at most once for this Reviewer spawn. If the second attempt fails, do not poll for report artifacts; fix/check the plan inline or write `failure-log.md` before stopping for recovery.
187
+ 1. Re-read only `context-snapshot.md`, `spec.md`, and `plan.md`.
188
+ 2. Cross-check spec.md and plan.md Tasks against the feature description and acceptance criteria.
189
+ 3. Verify the plan references the File Manifest and avoids unrelated work.
190
+ 4. If you find CRITICAL issues, fix ONLY those issues in spec.md/plan.md before continuing.
188
191
 
189
- Prompt:
190
- > "Read {{REVIEWER_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
191
- > 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST — Section 3 has TRAPS/RULES, Section 4 has file manifest.
192
- > 2. Cross-check `spec.md` and `plan.md` (including Tasks section) for consistency.
193
- > 3. Before flagging CRITICAL or HIGH issues, read the relevant source files listed in the File Manifest to verify.
194
- > Report: CRITICAL, HIGH, MEDIUM issues found (or 'No issues found')."
195
-
196
- Wait for Reviewer to return.
197
- - If CRITICAL issues found: fix them yourself — read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` for full project context. Fix ONLY the listed CRITICAL issues in spec.md/plan.md. Then re-run analyze (max 1 round).
198
-
199
- **CP-2**: No CRITICAL issues.
192
+ **CP-2**: Plan self-check complete; no CRITICAL plan issues remain.
200
193
 
201
194
  {{IF_CRITIC_ENABLED}}
202
195
  ### Phase 3.5: Plan Challenge — Critic Agent(s)
@@ -490,17 +483,21 @@ Append results to `context-snapshot.md`:
490
483
  Browser cleanup: confirmed
491
484
  ```
492
485
 
493
- 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.
486
+ Browser blocking policy: `{{BROWSER_BLOCKING}}`.
487
+
488
+ If verification fails:
489
+ - If `{{BROWSER_BLOCKING}}` is `true`: mark checkpoint step `browser-verification` as `failed`, write `failure-log.md` with browser evidence, clean up the dev server/browser, and stop before commit.
490
+ - If `{{BROWSER_BLOCKING}}` is `false`: log the failure details, mark checkpoint step `browser-verification` according to the evidence, clean up the dev server/browser, and continue.
491
+
492
+ You MUST attempt verification and MUST clean up the dev server in both cases.
494
493
  {{END_IF_BROWSER_INTERACTION}}
495
494
 
496
495
  ### Phase 6: Retrospective & Commit (SINGLE COMMIT) — DO NOT SKIP
497
496
 
498
- **Bug Fix Documentation Policy**:
499
- - DEFAULT: Run `/prizmkit-retrospective` with structural sync only (update file counts, interfaces, dependencies). Skip knowledge injection.
500
- - UPDATE DOCS (run full retrospective — Job 1 + Job 2) when bug fix causes: interface signature changes, dependency additions/removals, observable behavior changes to existing features, or newly discovered TRAPs.
501
- - Simple bugs: No new spec.md/plan.md needed. Use fast path.
502
- - Complex bugs (multi-module, cascading): Use `/prizmkit-plan` with `artifact_dir=.prizmkit/bugfix/<BUG_ID>/`.
503
- - Commit prefix: `fix(<scope>):` (not `feat:`).
497
+ **Feature Documentation Policy**:
498
+ - Run `/prizmkit-retrospective` before commit to update `.prizmkit/prizm-docs/` with durable structural knowledge from this feature.
499
+ - Capture architecture knowledge when the feature adds interfaces, dependencies, observable behavior, modules, or durable TRAPS/RULES/DECISIONS.
500
+ - Commit prefix: `feat({{FEATURE_ID}}):`.
504
501
 
505
502
  **6a.** Check if feature already committed by inspecting recent git history for `{{FEATURE_ID}}`:
506
503
  ```bash
@@ -515,7 +512,6 @@ git log --oneline
515
512
  - **L2 coverage check**: For any module/sub-module with source files created or significantly modified in this session but no L2 `.prizm` doc — evaluate whether L2 is warranted and create if so. The current session has the best context for accurate KEY_FILES, TRAPS, and DECISIONS.
516
513
  - Stage doc changes: `git add .prizmkit/prizm-docs/`
517
514
  ⚠️ Do NOT commit here. Only stage.
518
- - **For bug-fix sessions**: structural sync (Job 1) by default. Run knowledge injection (Job 2) when the fix causes interface signature changes, dependency additions/removals, observable behavior changes, or reveals new TRAPs
519
515
 
520
516
  **6c.** Stage all feature code explicitly (NEVER use `git add -A` or `git add .`):
521
517
  ```bash
@@ -566,7 +562,6 @@ Rules for writing completion notes:
566
562
  | Feature Artifacts Dir | `.prizmkit/specs/{{FEATURE_SLUG}}/` |
567
563
  | Context Snapshot | `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` |
568
564
  | Team Config | `{{TEAM_CONFIG_PATH}}` |
569
- | Reviewer Agent Def | {{REVIEWER_SUBAGENT_PATH}} |
570
565
  {{IF_CRITIC_ENABLED}}
571
566
  | Critic Agent Def | {{CRITIC_SUBAGENT_PATH}} |
572
567
  {{END_IF_CRITIC_ENABLED}}
@@ -592,10 +587,10 @@ If you encounter an unrecoverable error, context overflow, or are about to exit
592
587
 
593
588
  ## Reminders
594
589
 
595
- - Tier 3: orchestrator implements directly; Critic challenges plan; Reviewer reviews
590
+ - Tier 3: orchestrator implements directly; Critic challenges plan; `/prizmkit-code-review` handles review later
596
591
  - context-snapshot.md is append-only: orchestrator writes Sections 1-4 + Implementation Log, Reviewer appends Review Notes
597
592
  - Gate checks enforce Implementation Log and Review Notes are written before proceeding
598
- - Do NOT use `run_in_background=true` when spawning Critic or Reviewer agents
593
+ - Do NOT use `run_in_background=true` when spawning Critic agents
599
594
  - Commit phase must use `/prizmkit-committer`; do NOT replace with manual git commit commands
600
595
  - **NEVER delete, modify, or touch any file under `.prizmkit/state/`** — those are pipeline runtime files managed by the runner
601
596
  - NEVER run `rm -rf`, `git clean`, or any destructive filesystem operations
@@ -75,7 +75,15 @@
75
75
  "medium",
76
76
  "low"
77
77
  ],
78
- "description": "Fix priority. Pipeline processes high before medium before low; within same level, array order determines sequence. Both critical and high severity map to high priority."
78
+ "description": "Fix priority. Planner should order bugs by severity/priority before runtime execution. Runtime preserves stable list order subject to dependency constraints. Both critical and high severity map to high priority."
79
+ },
80
+ "dependencies": {
81
+ "type": "array",
82
+ "items": {
83
+ "type": "string",
84
+ "pattern": "^B-\\d{3}$"
85
+ },
86
+ "description": "IDs of bugs that must be completed before this one"
79
87
  },
80
88
  "error_source": {
81
89
  "type": "object",
@@ -11,7 +11,7 @@
11
11
 
12
12
  You are the **bug fix session agent**. Fix Bug {{BUG_ID}}: "{{BUG_TITLE}}".
13
13
 
14
- **CRITICAL**: You MUST NOT exit until ALL work is complete and committed.
14
+ **CRITICAL**: You MUST NOT exit until ALL automated work is complete and committed, unless a fresh manual/hybrid verification gate requires stopping as `partial` before commit.
15
15
 
16
16
  **SUBAGENT LIFECYCLE**: Any normal work subagent must be awaited with `run_in_background=false`. Do not spawn persistent background subagents for headless recovery.
17
17
 
@@ -177,7 +177,7 @@ After implement completes, verify:
177
177
 
178
178
  ### Phase 3: Review
179
179
 
180
- If `FAST_PATH=true` (≤ 2 tasks, obvious root cause), skip this phase entirely.
180
+ If `FAST_PATH=true` (≤ 2 tasks, obvious root cause), skip this phase entirely and mark checkpoint step `prizmkit-code-review` as `skipped` before continuing.
181
181
 
182
182
  Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`:
183
183
  - The skill runs an internal review-fix loop (Reviewer → filter → orchestrator fix, max 3 rounds) and writes `review-report.md`
@@ -209,8 +209,10 @@ Read `review-report.md` and check the Verdict:
209
209
 
210
210
  {{IF_VERIFICATION_MANUAL_OR_HYBRID}}
211
211
  **MANUAL VERIFICATION GATE**:
212
- - After automated review passes, write session-status.json with status="partial", resume_from_phase=4
213
- - Set bug status to `verifying` and STOP — manual UAT required before commit
212
+ - Fresh manual/hybrid bugfix sessions stop after automated review and before commit.
213
+ - Write session-status.json with status="partial", resume_from_phase=4, and STOP — manual UAT is required before commit.
214
+ - Recovery/retry/continuation sessions may substitute automated verification for manual/hybrid UAT only when evidence is documented in fix-report.md and session-status.json.
215
+ - Do not write `verifying` to the external bug-list status field; fine-grained verification is session/checkpoint metadata, while the external list status remains one of `pending`, `in_progress`, `completed`, `failed`, `skipped`, or `needs_info`.
214
216
  {{END_IF_VERIFICATION_MANUAL_OR_HYBRID}}
215
217
 
216
218
  ---
@@ -223,10 +225,11 @@ Read `review-report.md` and check the Verdict:
223
225
 
224
226
  **a.** If a new pitfall was discovered (not previously in TRAPS):
225
227
  - Update the affected module's TRAPS section in `.prizmkit/prizm-docs/`
226
- - Format: `- TRAP: <description> | FIX: <solution> | DATE: YYYY-MM-DD`
228
+ - Format: `- [LOW|HIGH|CRITICAL] <description> | FIX: <approach>`
229
+ - Do not add dates.
227
230
 
228
231
  **b.** Run `/prizmkit-retrospective` following the policy above.
229
- Stage doc changes: `git add .prizmkit/prizm-docs/`
232
+ Stage doc changes explicitly when `.prizmkit/prizm-docs/` changed.
230
233
 
231
234
  **c.** Stage all changed files explicitly (NEVER use `git add -A` or `git add .`):
232
235
  ```bash
@@ -234,7 +237,7 @@ git add <specific-files-modified>
234
237
  git add .prizmkit/prizm-docs/
235
238
  ```
236
239
 
237
- **d.** Run `/prizmkit-committer --headless`:
240
+ **d.** Run `/prizmkit-committer`:
238
241
  - Commit message prefix: `fix({{FIX_SCOPE}}): {{BUG_TITLE}}`
239
242
  - Include both fix code and reproduction test
240
243
  - Do NOT push
@@ -259,7 +262,7 @@ The fix-report.md MUST contain:
259
262
  - **Knowledge Captured**: TRAPS updated (if any), prevention recommendation
260
263
  - **Acceptance Criteria Verification**: checklist with pass/fail for each criterion
261
264
 
262
- **Checkpoint update**: Set steps `prizmkit-committer` and `bug-report` to `"completed"`.
265
+ - **Checkpoint update**: Set `prizmkit-retrospective`, `prizmkit-committer`, and `bug-report` to `completed` as each finishes.
263
266
 
264
267
  ---
265
268
 
@@ -7,25 +7,22 @@
7
7
  - **Refactor Type**: {{REFACTOR_TYPE}}
8
8
  - **Priority**: {{PRIORITY}}
9
9
  - **Complexity**: {{COMPLEXITY}}
10
+ - **Pipeline Mode**: {{PIPELINE_MODE}}
10
11
 
11
12
  ## Your Mission
12
13
 
13
14
  You are the **refactor session orchestrator**. Execute Refactor {{REFACTOR_ID}}: "{{REFACTOR_TITLE}}".
14
15
 
15
- **CRITICAL SESSION LIFECYCLE RULE**: You MUST NOT exit until ALL work is complete and session-status.json is written. When you spawn normal work subagents, you MUST **wait for each to finish** (run_in_background=false) before proceeding. Do NOT spawn a work agent in the background and exit — that kills the session.
16
+ **CRITICAL SESSION LIFECYCLE RULE**: You MUST NOT exit until all refactor work is complete, checkpoint state is updated, and session-status.json is written.
16
17
 
17
- **NON-INTERACTIVE MODE**: You are running in headless non-interactive mode. There is NO human on the other end. NEVER ask for user confirmation, NEVER wait for user input, NEVER use interactive prompts (e.g. "Would you like me to…"). If a skill has an interactive step (e.g. offer remediation, ask for approval), skip it and proceed autonomously. Make decisions based on the data available and move forward.
18
+ **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, and NEVER use interactive prompts. Resolve uncertainty from existing code, project docs, and conservative behavior-preserving defaults.
18
19
 
19
- **NORMAL-PATH TEAM REQUIREMENT**: Use the `prizm-dev-team` agents (Dev + Reviewer) for implementation and review. You are the orchestrator handle coordination, planning, and commit phases directly. If a required agent cannot be spawned after the bounded retry policy below, follow the documented recovery exception instead of looping forever.
20
+ **ORCHESTRATOR-DIRECT RULE**: Do not spawn top-level Dev or Reviewer subagents. The main orchestrator plans, implements via `/prizmkit-implement`, and runs `/prizmkit-code-review` directly.
20
21
 
21
22
  **REFACTOR DOCUMENTATION POLICY**:
22
- - **DEFAULT**: Run `/prizmkit-retrospective` with full sync (Job 1 + Job 2), because refactoring changes code structure and interfaces.
23
- - **SKIP Job 2** only if the refactor is a pure rename with no interface changes.
24
- - Commit with `refactor(<scope>):` prefix, NOT `feat:` or `fix:`
25
-
26
- ### Team Definition Reference
27
-
28
- - **Team config**: `{{TEAM_CONFIG_PATH}}`
23
+ - Default: run `/prizmkit-retrospective` with full sync because refactoring changes structure and interfaces.
24
+ - Skip architecture knowledge injection only for a pure rename with no interface or dependency changes.
25
+ - Commit with `refactor(<scope>):`, not `feat:` or `fix:`.
29
26
 
30
27
  ### Refactor Description
31
28
 
@@ -43,11 +40,7 @@ You are the **refactor session orchestrator**. Execute Refactor {{REFACTOR_ID}}:
43
40
 
44
41
  ### Behavior Preservation
45
42
 
46
- - **Strategy**: {{BEHAVIOR_STRATEGY}}
47
- - **Existing Tests**:
48
- {{EXISTING_TESTS}}
49
- - **New Tests Needed**:
50
- {{NEW_TESTS_NEEDED}}
43
+ {{BEHAVIOR_PRESERVATION}}
51
44
 
52
45
  ### Acceptance Criteria
53
46
 
@@ -61,268 +54,215 @@ You are the **refactor session orchestrator**. Execute Refactor {{REFACTOR_ID}}:
61
54
 
62
55
  {{GLOBAL_CONTEXT}}
63
56
 
64
-
65
57
  ## Refactor Artifacts Directory
66
58
 
67
- **ALWAYS** use per-refactor subdirectory `.prizmkit/refactor/{{REFACTOR_ID}}/`:
59
+ Always use per-refactor subdirectory `.prizmkit/refactor/{{REFACTOR_ID}}/`:
68
60
 
69
61
  ```
70
62
  .prizmkit/refactor/{{REFACTOR_ID}}/
71
- ├── spec.md ← /prizmkit-plan output (goals, scope, behavior preservation)
72
- ├── plan.md ← /prizmkit-plan output (change approach, tasks)
73
- └── refactor-report.md ← Phase 5 output (generated after commit)
63
+ ├── spec.md
64
+ ├── plan.md
65
+ ├── review-report.md
66
+ ├── refactor-report.md
67
+ └── completion-summary.json
74
68
  ```
75
69
 
76
- ## Execution Instructions
77
-
78
- **YOU are the orchestrator. Execute each phase by spawning the appropriate team agent with run_in_background=false.**
79
-
80
- **Agent spawn failure policy (all Agent tool calls)**:
81
- - If spawning Dev or Reviewer fails with team/config/lock errors, retry at most once.
82
- - If the second attempt fails, do not keep spawning variants and do not enter artifact polling for Implementation Log, review-report, or refactor-report markers.
83
- - Recovery exception: complete remaining refactor work directly in the orchestrator only when the action is safe and bounded; otherwise write `failure-log.md` with the spawn error and last observable state before stopping for recovery.
84
- - Any recovery exception must be recorded in the required report or session status so downstream runs know the normal team path was unavailable.
85
- - Apply the same cap to any re-spawn for report repair or resume prompts; do not burn multiple minutes on identical team/config/lock failures.
86
-
87
70
  {{CHECKPOINT_SYSTEM}}
88
71
 
89
- ### Step 1: Initialize
90
-
91
- #### Agent Setup
72
+ ## Execution
92
73
 
93
- Reference `{{TEAM_CONFIG_PATH}}` for agent definitions:
94
- - Dev: `{{DEV_SUBAGENT_PATH}}`
95
- - Reviewer: `{{REVIEWER_SUBAGENT_PATH}}`
74
+ ### Phase 0: Initialize
96
75
 
97
76
  Create refactor artifacts directory:
77
+
98
78
  ```bash
99
79
  {{RUNTIME_HELPER_CMD}} artifact ensure-dir .prizmkit/refactor/{{REFACTOR_ID}}
100
80
  ```
101
81
 
102
- ### Step 2: Pipeline Phases
82
+ **Checkpoint update**: set step `prizmkit-init` to `completed` in `{{CHECKPOINT_PATH}}`.
103
83
 
104
- #### Phase 1: Plan — Specification & Plan Generation
84
+ ---
105
85
 
106
- **Goal**: Generate spec.md and plan.md with behavior-preserving task breakdown.
86
+ ### Phase 1: Plan Specification & Plan Generation
107
87
 
108
- Run `/prizmkit-plan` with `artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/`:
109
- - Description: "{{REFACTOR_TITLE}} — {{REFACTOR_DESCRIPTION}}"
110
- - The spec.md MUST include:
111
- - Goals with acceptance criteria (from the acceptance criteria above)
112
- - Scope (files and modules from above)
113
- - Behavior Preservation section (strategy: {{BEHAVIOR_STRATEGY}}, existing tests, what must not change)
114
- - The plan.md MUST include:
115
- - Change approach with behavior preservation strategy
116
- - Tasks ordered by safety: safe renames first → extractions → structural changes
117
- - Every task ends with "run test suite to verify behavior preserved"
118
- - Rollback strategy
88
+ Run `/prizmkit-plan` with `artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/`.
119
89
 
120
- Resolve uncertain refactor details from the refactor description, existing code, and conservative existing-project patterns.
90
+ The generated `spec.md` MUST include:
91
+ - goals with acceptance criteria;
92
+ - scope files/modules;
93
+ - behavior preservation strategy;
94
+ - interfaces or observable behavior that must not change.
121
95
 
122
- {{IF_BROWSER_INTERACTION}}
96
+ The generated `plan.md` MUST include:
97
+ - behavior-preserving task order;
98
+ - test strategy before, during, and after refactor;
99
+ - rollback strategy;
100
+ - explicit risks and mitigations.
123
101
 
124
- #### Browser Behavior Preservation Protocol
125
-
126
- The refactor may affect UI behavior. Use this single browser protocol for planning, implementation, review, and final reporting:
102
+ Resolve uncertain refactor details from existing code and conservative existing-project patterns.
127
103
 
128
- {{IF_BROWSER_TOOL_AUTO}}
129
- - **Browser Tool**: Auto-select at runtime based on dev server and feature complexity.
130
- {{END_IF_BROWSER_TOOL_AUTO}}
104
+ {{IF_BROWSER_INTERACTION}}
131
105
 
132
- {{IF_BROWSER_TOOL_PLAYWRIGHT}}
133
- - **Browser Tool**: playwright-cli — local isolated browser instance for dev server verification.
134
- {{END_IF_BROWSER_TOOL_PLAYWRIGHT}}
106
+ #### Browser Behavior Preservation Protocol
135
107
 
136
- {{IF_BROWSER_TOOL_OPENCLI}}
137
- - **Browser Tool**: opencli — Chrome session with existing login for OAuth/third-party integrations.
138
- {{END_IF_BROWSER_TOOL_OPENCLI}}
108
+ The refactor may affect UI behavior. Browser verification is a mandatory attempt by default, but it blocks only when the task explicitly marks browser verification as blocking.
139
109
 
140
- **Verification Goals**:
110
+ **Browser Verification Goals**:
141
111
  {{BROWSER_VERIFY_STEPS}}
142
112
 
143
- Evidence must cover affected UI render, primary user interactions, behavior-sensitive workflows, tool used, and whether verification belongs in implementation, review, or both.
113
+ If `DEV_PORT` is unknown, discover it from project config; do not guess port 3000.
144
114
 
145
115
  {{END_IF_BROWSER_INTERACTION}}
146
116
 
147
- - **CP-RF-1**: Both `spec.md` and `plan.md` exist in `.prizmkit/refactor/{{REFACTOR_ID}}/`
148
- - **Checkpoint update**: set step `prizmkit-plan` to `"completed"` in `{{CHECKPOINT_PATH}}`
117
+ **Checkpoint update**: set step `prizmkit-plan` to `completed` in `{{CHECKPOINT_PATH}}`.
149
118
 
150
119
  ---
151
120
 
152
- #### Phase 2: Implement — Behavior-Preserving Refactoring
121
+ {{IF_CRITIC_ENABLED}}
122
+ ### Phase 2: Critic — Behavior Preservation Review
153
123
 
154
- **Goal**: Execute all tasks from plan.md while preserving existing behavior.
124
+ Challenge the plan before implementation. Focus on:
125
+ - behavior preservation gaps;
126
+ - unsafe task ordering;
127
+ - missing rollback strategy;
128
+ - insufficient test evidence.
155
129
 
156
- - Spawn Dev agent (Agent tool, subagent_type="prizm-dev-team-dev", run_in_background=false)
157
- Apply the all-agent spawn failure policy above for this Dev spawn: for team/config/lock errors, retry at most once; if the second attempt fails, do not poll for `## Implementation Log`; use the bounded recovery exception.
158
- Prompt: "Read {{DEV_SUBAGENT_PATH}}. For refactor {{REFACTOR_ID}} ('{{REFACTOR_TITLE}}'):
159
- 1. Read `.prizmkit/refactor/{{REFACTOR_ID}}/spec.md` and `.prizmkit/refactor/{{REFACTOR_ID}}/plan.md`
160
- 2. Read `.prizmkit/prizm-docs/` for affected modules (TRAPS, RULES, PATTERNS)
161
- 3. Before making any changes, run the existing test suite to establish a green baseline
162
- 4. Run `/prizmkit-implement` with `artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/` — this handles the full implementation cycle:
163
- - Reads plan.md Tasks section
164
- - Implements task-by-task, marking each `[x]` immediately
165
- - Runs tests after EVERY task — all tests MUST pass (behavior preservation)
166
- - If tests fail: revert the task, analyze why, try alternative approach
167
- - Writes '## Implementation Log' to context-snapshot.md (or equivalent)
168
- 5. Do NOT change behavior — only improve structure
130
+ Write the critic result into `.prizmkit/refactor/{{REFACTOR_ID}}/context-snapshot.md` or the plan notes, then update any unsafe plan details before implementation.
169
131
 
170
- {{IF_BROWSER_INTERACTION}}
132
+ **Checkpoint update**: set step `critic-plan-review` to `completed` in `{{CHECKPOINT_PATH}}`.
171
133
 
172
- 6. Apply the Browser Behavior Preservation Protocol above after major refactor tasks and document evidence in implementation notes.
134
+ ---
173
135
 
174
- {{END_IF_BROWSER_INTERACTION}}
136
+ {{END_IF_CRITIC_ENABLED}}
137
+ ### Phase 3: Implement — Behavior-Preserving Refactoring
175
138
 
176
- 7. If the refactor involves multiple files: update durable checkpoints/artifacts at the midpoint, minimize output, and rely on runner continuation if context overflow occurs.
177
- 8. After all tasks complete, run the full test suite one final time
178
- "
179
- - **Wait for Dev to return**
180
- - If Dev reports test failures that cannot be resolved after 3 attempts: escalate, write status="failed"
181
- - **CP-RF-2**: All tasks completed, all tests green
182
- - **Checkpoint update**: set step `prizmkit-implement` to `"completed"` in `{{CHECKPOINT_PATH}}`
139
+ Run `/prizmkit-implement` with `artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/`.
183
140
 
184
- ---
141
+ Implementation requirements:
142
+ 1. Establish a green baseline before changes when tests exist.
143
+ 2. Execute plan tasks in order.
144
+ 3. Preserve existing behavior; do not mix unrelated feature work or bug fixes into the refactor.
145
+ 4. Run focused tests after each risky task and full relevant tests before review.
146
+ 5. Mark each completed task `[x]` in plan.md.
185
147
 
186
- #### Phase 3: Review — Code Review & Behavior Verification
148
+ {{IF_BROWSER_INTERACTION}}
149
+ Apply the browser behavior preservation protocol where UI behavior can be affected. Document evidence in implementation notes.
150
+ {{END_IF_BROWSER_INTERACTION}}
187
151
 
188
- **Goal**: Verify refactoring quality and behavior preservation.
152
+ **Checkpoint update**: set step `prizmkit-implement` to `completed` in `{{CHECKPOINT_PATH}}`.
189
153
 
190
- - Spawn Reviewer agent (Agent tool, subagent_type="prizm-dev-team-reviewer", run_in_background=false)
191
- Apply the all-agent spawn failure policy above for this Reviewer spawn.
192
- Prompt: "Read {{REVIEWER_SUBAGENT_PATH}}. For refactor {{REFACTOR_ID}}:
193
- 1. Read `.prizmkit/refactor/{{REFACTOR_ID}}/spec.md` for goals and behavior preservation contracts
194
- 2. Read `.prizmkit/refactor/{{REFACTOR_ID}}/plan.md` for architecture decisions and completed tasks
195
- 3. Run `/prizmkit-code-review` with artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/. The skill runs an internal review-fix loop (Reviewer → filter → orchestrator fix, max 3 rounds) and writes review-report.md.
196
- 4. Run full test suite and verify ALL tests pass
154
+ ---
197
155
 
198
- {{IF_BROWSER_INTERACTION}}
156
+ ### Phase 4: Review — Code Review & Behavior Verification
199
157
 
200
- 5. Verify the Browser Behavior Preservation Protocol evidence and document findings in `review-report.md`.
158
+ Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/` directly from the main orchestrator.
201
159
 
202
- {{END_IF_BROWSER_INTERACTION}}
160
+ Review requirements:
161
+ - verify refactor quality against spec.md and plan.md;
162
+ - verify behavior preservation evidence;
163
+ - run or confirm relevant tests;
164
+ - write `.prizmkit/refactor/{{REFACTOR_ID}}/review-report.md` with `## Verdict`.
165
+
166
+ If the report is missing after one bounded status check, write `failure-log.md` and either perform a safe inline fallback review or stop with a clear recovery failure.
203
167
 
204
- 6. review-report.md will be written to .prizmkit/refactor/{{REFACTOR_ID}}/ by prizmkit-code-review
205
- 7. Report: verdict (PASS/NEEDS_FIXES), number of rounds, findings fixed/rejected
206
- "
207
- - **Wait for Reviewer to return**
208
- - **Gate Check — Review Report**:
209
- After Reviewer returns, verify the review report contains a verdict:
210
- ```bash
211
- {{RUNTIME_HELPER_CMD}} text contains .prizmkit/refactor/{{REFACTOR_ID}}/review-report.md --pattern "## Verdict"
212
- ```
213
- If GATE:MISSING:
214
- - Do not enter an unbounded report-repair loop and do not repeatedly re-spawn Reviewer.
215
- - Perform one bounded status check; retry at most once: inspect the Reviewer output, `review-report.md` path, and any internal Reviewer agent spawn messages from `/prizmkit-code-review`.
216
- - If the missing report is caused by team/config/lock errors from the Reviewer or internal Reviewer agent spawn, retry the Reviewer agent at most once only if it appears transient.
217
- - If the report is still missing after that single check/retry, write `.prizmkit/refactor/{{REFACTOR_ID}}/failure-log.md` with the spawn/skill error and last observable state, then either perform a safe inline fallback review (spec/plan/diff/tests → write `review-report.md` with `## Verdict`) or stop with a clear recovery failure.
218
-
219
- Read `review-report.md` and check the Verdict:
220
- - `PASS` → proceed to next phase
221
- - `NEEDS_FIXES` → log remaining findings and proceed (do not retry externally)
222
- - **CP-RF-3**: Code review complete, tests pass, behavior preserved
223
- - **Checkpoint update**: set step `prizmkit-code-review` to `"completed"` in `{{CHECKPOINT_PATH}}`
168
+ **Checkpoint update**: set step `prizmkit-code-review` to `completed` in `{{CHECKPOINT_PATH}}`.
224
169
 
225
170
  ---
226
171
 
227
- #### Phase 4: Commit & Report
172
+ {{IF_BROWSER_INTERACTION}}
173
+ ### Phase 5: Browser Verification
228
174
 
229
- **Goal**: Commit the refactor, update docs, generate report.
175
+ Attempt browser verification for affected UI behavior. If no usable browser tool/server/port can be found and browser verification is non-blocking, mark browser verification `skipped` and continue. If explicit policy marks browser verification as blocking, mark it `failed` and write `failure-log.md`.
230
176
 
231
- **This phase is executed by YOU (the orchestrator), NOT a subagent.**
177
+ Record tool choice, URL, steps, screenshot path if available, result, and cleanup status in `.prizmkit/refactor/{{REFACTOR_ID}}/context-snapshot.md`.
232
178
 
233
- 1. Run `/prizmkit-retrospective` (full sync Job 1 + Job 2) to update `.prizmkit/prizm-docs/` with structural changes
179
+ **Checkpoint update**: set step `browser-verification` to `completed`, `skipped`, or `failed` according to the evidence.
234
180
 
235
- 2. Run `/prizmkit-committer --headless` with:
236
- - Commit message: `refactor({{REFACTOR_ID}}): {{REFACTOR_TITLE}}`
237
- - Include all refactored files and any new/updated tests
238
- - Do NOT push (user will push manually)
181
+ ---
239
182
 
240
- 3. Write the refactor report to `.prizmkit/refactor/{{REFACTOR_ID}}/refactor-report.md`
183
+ {{END_IF_BROWSER_INTERACTION}}
184
+ ### Phase 6: Commit, Report & Completion Summary
241
185
 
242
- The refactor-report.md MUST contain these sections:
243
- - Refactor Summary (ID, title, type, status, phases completed)
244
- - What Changed (files modified, structural changes made, diff summary)
245
- - Behavior Verification (test suite results before/after, specific tests exercised)
186
+ Run `/prizmkit-retrospective` using the current working tree and staged changes as input context. Do not rely only on `git diff --cached`.
246
187
 
247
- {{IF_BROWSER_INTERACTION}}
188
+ Stage changed files explicitly; never use `git add -A` or `git add .`.
248
189
 
249
- - Browser Verification (UI flows tested, tools used, any manual verification performed)
190
+ Run `/prizmkit-committer` with commit prefix:
250
191
 
251
- {{END_IF_BROWSER_INTERACTION}}
192
+ ```text
193
+ refactor({{REFACTOR_ID}}): {{REFACTOR_TITLE}}
194
+ ```
252
195
 
253
- - Code Quality Metrics (if measurable: files consolidated, duplication reduced, etc.)
254
- - Acceptance Criteria Verification (checklist with pass/fail for each criterion)
196
+ Do not push.
255
197
 
256
- 4. Write completion summary for downstream dependency context:
198
+ Write `.prizmkit/refactor/{{REFACTOR_ID}}/refactor-report.md` with:
199
+ - refactor summary;
200
+ - files/modules changed;
201
+ - behavior-preservation evidence before/after;
202
+ - review findings;
203
+ - browser evidence when applicable;
204
+ - acceptance criteria checklist.
257
205
 
258
- Write `.prizmkit/refactor/{{REFACTOR_ID}}/completion-summary.json` this is NOT committed to git. The pipeline runner reads it to propagate context to dependent refactors.
259
- ```json
260
- {
261
- "completion_notes": [
262
- "<each item: one key structural change that downstream refactors may need to know>",
263
- "Example: Extracted shared validation logic into src/utils/validation.ts",
264
- "Example: Renamed UserService → AuthService, moved from src/services/ to src/auth/",
265
- "Example: Decoupled payment module from user module via PaymentGateway interface"
266
- ]
267
- }
268
- ```
269
- Rules: focus on structural changes, new module boundaries, renamed/moved files, changed interfaces. 3-8 notes, each under 120 chars.
206
+ Write `.prizmkit/refactor/{{REFACTOR_ID}}/completion-summary.json` for downstream refactor context:
270
207
 
271
- - **CP-RF-4**: Commit recorded, refactor-report.md written, .prizmkit/prizm-docs/ updated
272
- - **Checkpoint update**: set steps `prizmkit-committer` and `refactor-report` to `"completed"` in `{{CHECKPOINT_PATH}}`
208
+ ```json
209
+ {
210
+ "completion_notes": [
211
+ "<key structural change, moved/renamed interface, or new module boundary>"
212
+ ]
213
+ }
214
+ ```
215
+
216
+ **Checkpoint update**: set `prizmkit-retrospective`, `prizmkit-committer`, `refactor-report`, and `completion-summary` to `completed` as each finishes.
273
217
 
274
- ### Step 3: Report Session Status
218
+ ---
275
219
 
276
- **CRITICAL**: Before this session ends, you MUST write the session status file.
220
+ ### Final: Report Session Status
277
221
 
278
- Write to: `{{SESSION_STATUS_PATH}}`
222
+ Before exiting, write `{{SESSION_STATUS_PATH}}`:
279
223
 
280
224
  ```json
281
225
  {
282
226
  "session_id": "{{SESSION_ID}}",
283
227
  "refactor_id": "{{REFACTOR_ID}}",
284
228
  "status": "<success|partial|failed>",
285
- "completed_phases": [1, 2, 3, 4],
286
- "current_phase": 4,
287
- "checkpoint_reached": "CP-RF-4",
229
+ "completed_phases": [1, 2, 3, 4, 5, 6],
230
+ "current_phase": 6,
231
+ "checkpoint_reached": "completion-summary",
288
232
  "errors": [],
289
233
  "can_resume": false,
290
234
  "resume_from_phase": null,
291
235
  "artifacts": {
292
236
  "spec_path": ".prizmkit/refactor/{{REFACTOR_ID}}/spec.md",
293
237
  "plan_path": ".prizmkit/refactor/{{REFACTOR_ID}}/plan.md",
294
- "report_path": ".prizmkit/refactor/{{REFACTOR_ID}}/refactor-report.md"
238
+ "review_report_path": ".prizmkit/refactor/{{REFACTOR_ID}}/review-report.md",
239
+ "report_path": ".prizmkit/refactor/{{REFACTOR_ID}}/refactor-report.md",
240
+ "completion_summary_path": ".prizmkit/refactor/{{REFACTOR_ID}}/completion-summary.json"
295
241
  },
296
242
  "git_commit": "<commit hash>",
297
- "behavior_preserved": true,
298
- "timestamp": "{{TIMESTAMP}}"
243
+ "behavior_preserved": true
299
244
  }
300
245
  ```
301
246
 
302
- **Status values**: `success` (all phases done) | `partial` (can resume) | `failed` (unrecoverable)
303
-
304
247
  ## Critical Paths
305
248
 
306
249
  | Resource | Path |
307
250
  |----------|------|
308
- | Team Definition (source of truth) | `{{TEAM_CONFIG_PATH}}` |
309
251
  | Refactor Artifacts Dir | `.prizmkit/refactor/{{REFACTOR_ID}}/` |
310
252
  | Spec | `.prizmkit/refactor/{{REFACTOR_ID}}/spec.md` |
311
253
  | Plan | `.prizmkit/refactor/{{REFACTOR_ID}}/plan.md` |
254
+ | Review Report | `.prizmkit/refactor/{{REFACTOR_ID}}/review-report.md` |
312
255
  | Refactor Report | `.prizmkit/refactor/{{REFACTOR_ID}}/refactor-report.md` |
313
- | Dev Agent Def | {{DEV_SUBAGENT_PATH}} |
314
- | Reviewer Agent Def | {{REVIEWER_SUBAGENT_PATH}} |
256
+ | Completion Summary | `.prizmkit/refactor/{{REFACTOR_ID}}/completion-summary.json` |
315
257
  | Session Status Output | {{SESSION_STATUS_PATH}} |
316
258
  | Workflow Checkpoint | {{CHECKPOINT_PATH}} |
317
259
  | Project Root | {{PROJECT_ROOT}} |
318
260
 
319
261
  ## Reminders
320
262
 
321
- - **MANDATORY**: Use `prizm-dev-team` agents single-agent execution is FORBIDDEN
322
- - **Behavior preservation is the #1 priority**: If tests break, stop and fix before proceeding
323
- - **Run tests after EVERY task** — not just at the end
324
- - Use `/prizmkit-plan` with `artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/` for spec + plan generation
325
- - **Commit with** `refactor(<scope>):` prefix, NOT `feat:` or `fix:`
326
- - **Run full retrospective** (Job 1 + Job 2) — refactoring changes code structure
327
- - ALWAYS write session-status.json before exiting
328
- - Do NOT use `run_in_background=true` when spawning normal work agents
263
+ - Use L1 skills: `/prizmkit-plan`, `/prizmkit-implement`, `/prizmkit-code-review`, `/prizmkit-retrospective`, `/prizmkit-committer`.
264
+ - Do not spawn top-level Dev or Reviewer subagents.
265
+ - Behavior preservation is the first priority.
266
+ - Browser verification is a mandatory attempt by default; it blocks only when explicitly required.
267
+ - If `DEV_PORT` is unknown, discover it from project config; do not guess port 3000.
268
+ - Always write session-status.json before exiting.
@@ -0,0 +1,16 @@
1
+ ## Bug Fix Artifacts Directory
2
+
3
+ Use only this durable artifact directory for this bug fix:
4
+
5
+ ```text
6
+ .prizmkit/bugfix/{{BUG_ID}}/
7
+ ├── spec.md
8
+ ├── plan.md
9
+ ├── context-snapshot.md
10
+ ├── review-report.md
11
+ ├── fix-report.md
12
+ ├── failure-log.md
13
+ └── workflow-checkpoint.json
14
+ ```
15
+
16
+ Do not write bugfix artifacts under feature or refactor artifact directories.