prizmkit 1.1.130 → 1.1.134

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/claude/command-adapter.js +0 -2
  3. package/bundled/dev-pipeline/.env.example +1 -1
  4. package/bundled/dev-pipeline/assets/skill-subagent-integration.md +11 -6
  5. package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +445 -8
  6. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +2 -9
  7. package/bundled/dev-pipeline/prizmkit_runtime/processes.py +21 -1
  8. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +87 -66
  9. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +53 -3
  10. package/bundled/dev-pipeline/prizmkit_runtime/runner_recovery.py +55 -25
  11. package/bundled/dev-pipeline/prizmkit_runtime/runner_status.py +4 -0
  12. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +119 -18
  13. package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +3 -2
  14. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +411 -17
  15. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +57 -14
  16. package/bundled/dev-pipeline/scripts/generate-recovery-prompt.py +5 -4
  17. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +55 -2
  18. package/bundled/dev-pipeline/scripts/prompt_framework.py +152 -1
  19. package/bundled/dev-pipeline/scripts/update-bug-status.py +53 -0
  20. package/bundled/dev-pipeline/scripts/update-checkpoint.py +294 -69
  21. package/bundled/dev-pipeline/scripts/update-feature-status.py +57 -0
  22. package/bundled/dev-pipeline/scripts/update-refactor-status.py +53 -0
  23. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +5 -5
  24. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +28 -22
  25. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +24 -10
  26. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +20 -2
  27. package/bundled/dev-pipeline/templates/sections/bugfix-phase-commit-report.md +2 -2
  28. package/bundled/dev-pipeline/templates/sections/bugfix-phase-diagnose-plan.md +1 -1
  29. package/bundled/dev-pipeline/templates/sections/bugfix-phase-manual-verification.md +5 -10
  30. package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +9 -19
  31. package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +21 -0
  32. package/bundled/dev-pipeline/templates/sections/bugfix-session-status.md +1 -1
  33. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +10 -10
  34. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +1 -1
  35. package/bundled/dev-pipeline/templates/sections/headless-commit-authorization.md +15 -0
  36. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +2 -2
  37. package/bundled/dev-pipeline/templates/sections/phase-commit.md +2 -2
  38. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +26 -23
  39. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +5 -5
  40. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +15 -11
  41. package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +1 -1
  42. package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +6 -6
  43. package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +21 -0
  44. package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +1 -1
  45. package/bundled/dev-pipeline/templates/sections/subagent-timeout-recovery.md +1 -1
  46. package/bundled/dev-pipeline/templates/sections/task-contract.md +4 -0
  47. package/bundled/dev-pipeline/tests/test_checkpoint_state.py +362 -3
  48. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +349 -48
  49. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +129 -0
  50. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +91 -0
  51. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +567 -23
  52. package/bundled/dev-pipeline/tests/test_unified_cli.py +37 -10
  53. package/bundled/skills/_metadata.json +63 -26
  54. package/bundled/skills/app-planner/SKILL.md +4 -3
  55. package/bundled/skills/bug-fix-workflow/SKILL.md +89 -180
  56. package/bundled/skills/bug-planner/SKILL.md +12 -27
  57. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +131 -220
  58. package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +36 -90
  59. package/bundled/skills/feature-pipeline-launcher/SKILL.md +129 -271
  60. package/bundled/skills/feature-pipeline-launcher/references/configuration.md +35 -76
  61. package/bundled/skills/feature-planner/SKILL.md +27 -22
  62. package/bundled/skills/feature-planner/assets/planning-guide.md +4 -4
  63. package/bundled/skills/feature-workflow/SKILL.md +94 -121
  64. package/bundled/skills/prizmkit/SKILL.md +130 -94
  65. package/bundled/skills/prizmkit/references/workflow-state-protocol.md +181 -0
  66. package/bundled/skills/prizmkit-code-review/SKILL.md +132 -86
  67. package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +243 -0
  68. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +42 -1
  69. package/bundled/skills/prizmkit-code-review/references/workflow-state-protocol.md +181 -0
  70. package/bundled/skills/prizmkit-code-review/scripts/render_review_report.py +93 -1
  71. package/bundled/skills/prizmkit-committer/SKILL.md +125 -48
  72. package/bundled/skills/prizmkit-committer/references/workflow-state-protocol.md +181 -0
  73. package/bundled/skills/prizmkit-implement/SKILL.md +99 -73
  74. package/bundled/skills/prizmkit-implement/references/implementation-subagent-procedure.md +1 -1
  75. package/bundled/skills/prizmkit-implement/references/workflow-state-protocol.md +181 -0
  76. package/bundled/skills/prizmkit-init/SKILL.md +5 -5
  77. package/bundled/skills/prizmkit-plan/SKILL.md +146 -105
  78. package/bundled/skills/prizmkit-plan/assets/plan-template.md +18 -0
  79. package/bundled/skills/prizmkit-plan/references/independent-plan-review.md +242 -0
  80. package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +4 -4
  81. package/bundled/skills/prizmkit-plan/references/workflow-state-protocol.md +181 -0
  82. package/bundled/skills/prizmkit-retrospective/SKILL.md +111 -53
  83. package/bundled/skills/prizmkit-retrospective/references/knowledge-injection-steps.md +7 -6
  84. package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +5 -4
  85. package/bundled/skills/prizmkit-retrospective/references/workflow-state-protocol.md +181 -0
  86. package/bundled/skills/prizmkit-test/SKILL.md +52 -6
  87. package/bundled/skills/prizmkit-test/assets/authoritative-records.schema.json +63 -12
  88. package/bundled/skills/prizmkit-test/assets/evidence-manifest.schema.json +1 -1
  89. package/bundled/skills/prizmkit-test/assets/evidence-package-template.json +13 -0
  90. package/bundled/skills/prizmkit-test/references/evidence-protocol.md +6 -1
  91. package/bundled/skills/prizmkit-test/references/evidence-request-protocol.md +8 -1
  92. package/bundled/skills/prizmkit-test/references/examples.md +1 -1
  93. package/bundled/skills/prizmkit-test/references/test-generation-steps.md +4 -1
  94. package/bundled/skills/prizmkit-test/references/test-report-template.md +1 -1
  95. package/bundled/skills/prizmkit-test/references/trusted-evidence-execution.md +15 -0
  96. package/bundled/skills/prizmkit-test/references/workflow-state-protocol.md +181 -0
  97. package/bundled/skills/prizmkit-test/scripts/build_test_evidence.py +744 -23
  98. package/bundled/skills/prizmkit-test/scripts/validate_test_evidence.py +194 -15
  99. package/bundled/skills/prizmkit-workflow/SKILL.md +266 -0
  100. package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +181 -0
  101. package/bundled/skills/recovery-workflow/SKILL.md +62 -241
  102. package/bundled/skills/recovery-workflow/evals/evals.json +17 -33
  103. package/bundled/skills/recovery-workflow/references/detection.md +28 -52
  104. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +105 -439
  105. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +136 -275
  106. package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +53 -88
  107. package/bundled/skills/refactor-planner/SKILL.md +12 -57
  108. package/bundled/skills/refactor-planner/references/behavior-preservation.md +111 -230
  109. package/bundled/skills/refactor-planner/references/error-recovery.md +37 -0
  110. package/bundled/skills/refactor-planner/references/planning-phases.md +11 -17
  111. package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +1 -1
  112. package/bundled/skills/refactor-workflow/SKILL.md +98 -139
  113. package/bundled/templates/project-memory-template.md +4 -4
  114. package/package.json +1 -1
  115. package/src/index.js +4 -0
  116. package/src/prompts.js +10 -3
  117. package/src/scaffold.js +1 -1
  118. package/bundled/dev-pipeline/tests/test-deploy-safety.sh +0 -223
  119. package/bundled/skills/feature-pipeline-launcher/scripts/preflight-check.py +0 -462
@@ -1,30 +1,28 @@
1
- # Configuration Reference — Refactor Pipeline Launcher
1
+ # Configuration Reference — Refactor Pipeline Command Builder
2
2
 
3
- Environment variable mappings for the refactor launcher.
3
+ Use this reference only to translate confirmed user choices into command fragments. The skill returns commands; it does not execute them.
4
4
 
5
- ## Configured AI CLI Prerequisite Check
5
+ ## Configured AI CLI Prerequisite Command
6
6
 
7
- Read this section during launcher prerequisite validation before reporting AI CLI availability.
7
+ Runtime AI CLI selection is config-driven. Resolve the executable in this order:
8
8
 
9
- Runtime AI CLI selection is config-driven. Resolve the executable name in this order:
10
- 1. `AI_CLI` environment variable when set.
11
- 2. `.prizmkit/config.json` `ai_cli` when present.
12
- 3. `claude` fallback only when neither is configured.
9
+ 1. `AI_CLI` environment variable.
10
+ 2. `.prizmkit/config.json` `ai_cli`.
11
+ 3. `claude` only when neither is configured.
12
+
13
+ Return this check command as part of start-command preparation:
13
14
 
14
- Run this quick check from the project root:
15
15
  ```bash
16
- command -v python3 >/dev/null && command -v git >/dev/null || { echo "python3 or git missing"; exit 1; }
17
16
  AI_CLI="$(
18
17
  python3 - <<'PY'
19
18
  import json, os, shlex
20
19
  from pathlib import Path
21
20
  cli = os.environ.get("AI_CLI", "").strip()
22
21
  if not cli:
23
- config_path = Path(".prizmkit/config.json")
24
- if config_path.is_file():
22
+ path = Path(".prizmkit/config.json")
23
+ if path.is_file():
25
24
  try:
26
- data = json.loads(config_path.read_text(encoding="utf-8"))
27
- cli = str(data.get("ai_cli") or "").strip()
25
+ cli = str(json.loads(path.read_text(encoding="utf-8")).get("ai_cli") or "").strip()
28
26
  except (OSError, json.JSONDecodeError):
29
27
  cli = ""
30
28
  cli = cli or "claude"
@@ -35,79 +33,46 @@ except ValueError:
35
33
  PY
36
34
  )"
37
35
  printf 'Configured AI CLI: %s\n' "$AI_CLI"
38
- command -v "$AI_CLI" >/dev/null && printf 'AI CLI OK: %s\n' "$(command -v "$AI_CLI")" || { printf 'AI CLI not found: %s\n' "$AI_CLI"; exit 1; }
39
- echo "All dependencies OK"
36
+ command -v "$AI_CLI" >/dev/null
40
37
  ```
41
38
 
42
- Report the configured executable, for example `Configured AI CLI: claude`. Do not report the first arbitrary PATH match such as `cbc` when project config selects a different AI CLI.
43
-
44
- ## Environment Variable Mapping
45
-
46
- Translating user responses to env vars:
47
-
48
- | Config choice | Environment variable |
49
- |-----------|---------------------|
50
- | Verbose: On | `VERBOSE=1` |
51
- | Verbose: Off | `VERBOSE=0` |
52
- | Max retries: N | `MAX_RETRIES=N` |
53
- | Strict behavior: On | `STRICT_BEHAVIOR_CHECK=1` |
54
- | Strict behavior: Off | `STRICT_BEHAVIOR_CHECK=0` |
55
- | Stop on failure: On | `STOP_ON_FAILURE=1` |
56
- | Deploy: Yes | `ENABLE_DEPLOY=1` |
57
- | Effort: value | `PRIZMKIT_EFFORT=<value>` |
58
-
59
- ## Advanced Environment Variables
60
-
61
- Not exposed in interactive menu, pass via `--env`:
62
-
63
- | Variable | Default | Purpose |
64
- |----------|---------|---------|
65
- | `MODEL` | (none) | AI model override (e.g. `claude-opus-4.6`) |
66
- | `AUTO_PUSH` | `0` | Auto-push to remote after successful refactor (`1` to enable) |
67
- | `DEV_BRANCH` | auto-generated | Custom dev branch name (default: `refactor/pipeline-{run_id}`) |
68
- | `HEARTBEAT_INTERVAL` | `30` | Heartbeat log interval in seconds |
69
- | `HEARTBEAT_STALE_THRESHOLD` | `600` | Max seconds without heartbeat before marking stale |
70
-
71
- ## Error Handling
72
-
73
- | Error | Action |
74
- |-------|--------|
75
- | `.prizmkit/plans/refactor-list.json` not found | Tell user to run `refactor-planner` skill first |
76
- | Circular dependencies in refactor list | Fix dependency graph in `.prizmkit/plans/refactor-list.json` before launching |
77
- | Test baseline failing | Fix failing tests before starting refactoring — behavior preservation requires a green baseline |
78
- | `python3` not installed | Install Python 3.10+ and rerun the Python runtime command |
79
- | `git` not installed | Install git; the Python runtime uses git for branch/worktree/status operations |
80
- | Configured AI CLI not in PATH | Install the executable selected by `AI_CLI` or `.prizmkit/config.json` `ai_cli`, or update the config to a CLI available in PATH. |
81
- | Refactor pipeline already running | Show status, ask if user wants to stop and restart |
82
- | PID file stale (process dead) | `python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor start .prizmkit/plans/refactor-list.json` auto-cleans, retry start |
83
- | Launch failed (process died immediately) | Show last 20 lines of log: `python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor logs --lines 20` |
84
- | Refactor stuck/blocked | Use `python3 ./.prizmkit/dev-pipeline/cli.py reset refactor <R-XXX> --clean --run` for a fresh retry |
85
- | All refactors blocked/failed | Show status, suggest recovery: `python3 ./.prizmkit/dev-pipeline/cli.py reset refactor <R-XXX> --clean --run .prizmkit/plans/refactor-list.json` |
86
- | `playwright-cli` not installed | Browser verification skipped for playwright refactors (non-blocking). Suggest: `npm install -g @playwright/cli@latest && playwright-cli install --skills` |
87
- | `opencli` not installed | Browser verification skipped for opencli refactors (non-blocking). Install opencli for Chrome session-based browser verification |
88
- | Deploy session failed | Pipeline completed but deploy session exited non-zero. Check `.prizmkit/state/refactor/deploy/<session_id>/logs/session.log`. Retry manually: `/prizmkit-deploy`. |
89
- | Permission denied running Python CLI | Ensure Python is installed and the command uses `python3 ./.prizmkit/dev-pipeline/cli.py ...` |
90
-
91
- ## Advanced Configuration Round
92
-
93
- Only run this when the user answered "Yes" to the **Advanced config?** question in step 6. It applies to a minority of sessions.
94
-
95
- Ask a second round of `AskUserQuestion` with these 2 questions:
96
-
97
- **Question 1 — Stop on failure** (multiSelect: false):
98
- - Off (default) — Pipeline continues to next task after failure
99
- - On — Pipeline halts immediately when a task exhausts all retries (`STOP_ON_FAILURE=1`)
100
-
101
- **Question 2 — Deploy after completion?** (multiSelect: false):
102
- - No (default) — Skip deployment after pipeline completes
103
- - Yes — Run /prizmkit-deploy automatically after all refactors complete successfully (`ENABLE_DEPLOY=1`). Deployment is blocked if any refactor did not complete successfully (status not 'completed' or manually 'skipped').
104
-
105
- Then ask about reasoning effort in a follow-up `AskUserQuestion` call:
106
-
107
- **Question — Reasoning effort** (multiSelect: false):
108
- - Default (none) — Use CLI default
109
- - low — Minimize reasoning, fastest output (`PRIZMKIT_EFFORT=low`)
110
- - medium — Moderate reasoning (`PRIZMKIT_EFFORT=medium`)
111
- - high — Thorough reasoning for complex tasks (`PRIZMKIT_EFFORT=high`)
112
- - xhigh — Extensive reasoning (`PRIZMKIT_EFFORT=xhigh`)
113
- - max — Maximum reasoning, Claude Code only (`PRIZMKIT_EFFORT=max`)
39
+ Do not claim the configured executable exists until the user supplies successful command output.
40
+
41
+ ## Base Configuration Mapping
42
+
43
+ | Choice | Command fragment |
44
+ |---|---|
45
+ | Verbose Off | `VERBOSE=0` |
46
+ | Verbose On | `VERBOSE=1` |
47
+ | Max retries N | `MAX_RETRIES=N` |
48
+ | Strict behavior On | `STRICT_BEHAVIOR_CHECK=1` |
49
+ | Strict behavior Off | `STRICT_BEHAVIOR_CHECK=0` |
50
+
51
+ ## Advanced Configuration Questions
52
+
53
+ Ask only when the user selected Advanced config.
54
+
55
+ 1. **Stop on failure**
56
+ - Off (default) — continue to other eligible tasks after a task exhausts retries.
57
+ - On — add `STOP_ON_FAILURE=1`.
58
+ 2. **Reasoning effort**
59
+ - Default — omit `PRIZMKIT_EFFORT`.
60
+ - `low`, `medium`, `high`, `xhigh`, or `max` — add `PRIZMKIT_EFFORT=<value>` after confirming the configured AI CLI supports it.
61
+
62
+ These are the complete advanced choices for this command builder.
63
+
64
+ ## Baseline Command Guidance
65
+
66
+ - Return `git status --short` as a suggested baseline cleanliness check.
67
+ - When the project already declares a test command, return that exact command as an optional baseline command.
68
+ - Do not infer a test command from framework names alone.
69
+ - Do not claim the baseline is green until the user supplies successful output.
70
+
71
+ ## Command Construction Rules
72
+
73
+ - Foreground: place environment assignments before `python3`.
74
+ - Background daemon: place assignments inside one `--env "..."` value.
75
+ - Include only confirmed options.
76
+ - Preserve the user-provided list path.
77
+ - Shell-quote custom paths and values.
78
+ - Return one start command for the selected mode, never both.
@@ -5,7 +5,7 @@ description: "Interactive refactoring planner. Understands refactoring intent th
5
5
 
6
6
  # refactor planner
7
7
 
8
- Plan executable refactoring items for dev-pipeline:
8
+ Plan executable refactoring items for later autonomous dev-pipeline execution. This skill creates or updates planning artifacts only:
9
9
  - **Scope Assessment**: analyze current code structure and identify refactoring targets
10
10
  - **Item Decomposition**: break refactoring goals into well-ordered, behavior-preserving items
11
11
 
@@ -27,7 +27,7 @@ The user chose this skill intentionally. Respect that choice.
27
27
 
28
28
  ## Scope Boundary (Hard Rule)
29
29
 
30
- **This skill is PLANNING ONLY.** You must NEVER:
30
+ **This skill is PLANNING ONLY.** It may analyze code for planning evidence and create, append, validate, and review refactor planning artifacts, but it must never perform the refactor or start execution. You must NEVER:
31
31
  - Create, modify, or delete source code files (*.js, *.ts, *.py, *.go, *.html, *.css, etc.)
32
32
  - Execute refactoring operations (rename, move, extract, etc.)
33
33
  - Run build/install/test commands
@@ -42,7 +42,8 @@ The user chose this skill intentionally. Respect that choice.
42
42
  2. **Ask the user explicitly** whether they want to proceed to execution
43
43
  3. If the user agrees → recommend invoking `refactor-pipeline-launcher` (do NOT execute it yourself)
44
44
  4. If the user wants to adjust → continue refining `.prizmkit/plans/refactor-list.json`
45
- 5. **NEVER auto-execute** the pipeline, launcher, or any implementation step
45
+ 5. **NEVER auto-execute** the pipeline, launcher, composite workflow, or any implementation step
46
+ 6. Return the validated refactor list to the caller; only `refactor-pipeline-launcher` prepares the runtime command
46
47
 
47
48
  ## User-Provided Content Priority (Hard Rule)
48
49
 
@@ -145,7 +146,7 @@ Execute the planning workflow in conversation mode with mandatory checkpoints:
145
146
 
146
147
  **Goal**: Understand the current codebase structure and tech stack.
147
148
 
148
- 1. Read `.prizmkit/prizm-docs/root.prizm` and relevant L1 docs
149
+ 1. Read `.prizmkit/prizm-docs/root.prizm` and the relevant module documents it points to
149
150
  2. Read `.prizmkit/config.json` for tech stack info
150
151
  3. Identify existing test suite and coverage
151
152
  4. Summarize project context to the user: "Here's what I found about your project..."
@@ -202,10 +203,10 @@ Continue collecting goals until the user says they're done. There is no limit on
202
203
 
203
204
  **Goal**: Analyze the target code to inform item decomposition.
204
205
 
205
- Dispatch **parallel Agent reads** of target files:
206
- - **Agent A (Structure)**: File inventory, dependency graph, module boundaries, public API surface
207
- - **Agent B (Quality)**: Code smells, complexity hotspots, duplication, coupling metrics
208
- - **Agent C (Tests)**: Test coverage of target areas, existing test patterns, behavior contracts
206
+ Run three parallel read-only analysis perspectives over the target files:
207
+ - **Structure perspective**: File inventory, dependency graph, module boundaries, public API surface
208
+ - **Quality perspective**: Code smells, complexity hotspots, duplication, coupling metrics
209
+ - **Test perspective**: Test coverage of target areas, existing test patterns, behavior contracts
209
210
 
210
211
  Present consolidated findings:
211
212
  ```
@@ -287,22 +288,9 @@ See `${SKILL_DIR}/references/planning-phases.md` for the full 5-step review chec
287
288
 
288
289
  ## Local Generated-Plan Review Gate
289
290
 
290
- User requirement preserved verbatim: `there is a litter bug for prizm-code-review will to check git diff in working space and staged space , however the .prizmkit will be gitignored in most situation. so do you think the content should be change to inline a new reference file instead of use prizmkit-code-review`
291
+ Run this gate after `.prizmkit/plans/refactor-list.json` passes generation and validation, and before the final handoff. It applies whenever this session added or changed final refactor entries. For validate-only, summary-only, or draft-save flows with no final content change, report that the gate is not applicable.
291
292
 
292
- Run this gate **after** `.prizmkit/plans/refactor-list.json` passes the validation/generate script and **before** the final handoff summary recommends `refactor-pipeline-launcher`. This gate applies to full workflow, Mode B from analysis, and fast-path refactor planning when the current session generated, appended, or rewrote final refactor planning content. For validate-only, summary-only, or draft-save flows with no new final planning content, report: `Local generated-plan review: not applicable no new final planning content written.`
293
-
294
- 1. **Load the local reference**: read `${SKILL_DIR}/references/generated-plan-review.md` and follow it as the source of truth for this planner-output review loop.
295
- 2. **Read actual planning artifacts directly**: inspect `.prizmkit/plans/refactor-list.json`, `.prizmkit/plans/refactor-list.draft.json` when present, and any pre-session or in-memory draft snapshot. Do not rely on `git status`, `git diff`, or `git diff --cached`, because `.prizmkit` planning artifacts are often gitignored or untracked.
296
- 3. **Identify review scope**: compare by stable refactor IDs and item fields against the pre-session list when one existed. Ignore root generator metadata such as `$schema`, `created_at`, and `created_by`. Review only newly added or changed refactor entries; preserve unchanged historical entries except when needed to verify dependency references or behavior-preservation interactions.
297
- 4. **Run the local checklist** from the reference: schema compatibility, dependency/DAG soundness, safe behavior-preserving order, description completeness, headless execution readiness, acceptance criteria measurability, `behavior_preservation` strategy quality, user-provided wording preservation, task-scoped `user_context` isolation, and priority/complexity calibration.
298
- 5. **Keep the review planning-only**: do NOT start `refactor-pipeline-launcher`, do NOT run the refactor pipeline, do NOT run tests/builds/installs, and do NOT implement source-code refactors.
299
- 6. **Apply accepted review fixes through the draft/source plan**: when a finding is accepted, update `.prizmkit/plans/refactor-list.draft.json` or the in-memory draft representation first, then regenerate the final file with:
300
- ```bash
301
- python3 ${SKILL_DIR}/scripts/validate-and-generate-refactor.py generate --input .prizmkit/plans/refactor-list.draft.json --output .prizmkit/plans/refactor-list.json
302
- ```
303
- Do not hand-patch the final JSON as the source of truth; map final-output findings back to draft entries before regeneration.
304
- 7. **Revalidate after every accepted fix batch**: the generate script must pass again before the planner can proceed. If validation fails, fix the draft and rerun until pass.
305
- 8. **Report the gate outcome** in the final summary: include local generated-plan review verdict, reviewed refactor IDs, accepted fixes (or "none"), and final validation result.
293
+ Read `${SKILL_DIR}/references/generated-plan-review.md` and follow it as the single source of truth. Review the actual draft and final artifacts directly because `.prizmkit` files may be gitignored. Keep the review planning-only, apply accepted findings to the draft/source representation, regenerate the final JSON, and require validation to pass again before reporting the review result.
306
294
 
307
295
  ## Output Rules
308
296
 
@@ -403,40 +391,7 @@ Recommend invoking `refactor-pipeline-launcher` to configure and launch the dev-
403
391
 
404
392
  ## Error Recovery & Resume
405
393
 
406
- Key behaviors:
407
- - Warnings only -> proceed with user approval
408
- - Critical errors -> group by type, auto-fix where possible, max 3 total attempts
409
- - Interrupted session -> detect checkpoint from existing artifacts, offer resume or restart
410
- - `.prizmkit/plans/refactor-list.json` MUST be written to `.prizmkit/plans/` (project root level: `./{root}/.prizmkit/plans/refactor-list.json`)
411
-
412
- ### Resume Detection
413
-
414
- If existing artifacts are found, offer to resume from the appropriate checkpoint/phase:
415
-
416
- | Artifact Found | Resume From |
417
- |---------------|------------|
418
- | Nothing | Phase 1: Project Context |
419
- | Draft in `.prizmkit/plans/` | Phase matching draft state |
420
- | Partial `.prizmkit/plans/refactor-list.json` | Phase 6: Completeness Review |
421
- | Valid `.prizmkit/plans/refactor-list.json` | Mode D: Summary |
422
-
423
- ### Session Exit Gate
424
-
425
- Prevent accidental session exit without deliverable completion.
426
-
427
- **Trigger conditions** — activate the exit gate when ALL are true:
428
- - User invoked `/refactor-planner` (not just mentioned refactoring)
429
- - Current phase < Phase 7 (validation not yet passed)
430
- - No valid `.prizmkit/plans/refactor-list.json` has been written in this session
431
-
432
- **Gate behavior** — when the session appears to be ending:
433
- 1. **Remind**: "You set out to produce `.prizmkit/plans/refactor-list.json` but we haven't completed it yet."
434
- 2. **Offer 3 options**:
435
- - **(a) Continue to completion** — resume from current phase
436
- - **(b) Save draft & exit** — write current progress as draft, exit session
437
- - **(c) Abandon** — exit without saving
438
- 3. **If (b)**: Write draft and remind: "This is a draft, not validated. Run `/refactor-planner` again to resume."
439
- 4. **If (c)**: Accept without further prompting.
394
+ When validation fails, existing planning artifacts are detected, the session is interrupted, or the user exits before producing a valid final plan, read `${SKILL_DIR}/references/error-recovery.md`. Keep recovery planning-only and resume from the artifact's actual completeness rather than restarting or guessing.
440
395
 
441
396
  ## Handoff Message Template
442
397