prizmkit 1.1.106 → 1.1.108

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 (85) hide show
  1. package/bin/create-prizmkit.js +4 -0
  2. package/bundled/VERSION.json +3 -3
  3. package/bundled/dev-pipeline/prizmkit_runtime/config.py +81 -14
  4. package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +19 -8
  5. package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +0 -1
  6. package/bundled/dev-pipeline/prizmkit_runtime/launch_profiles.py +18 -0
  7. package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +22 -2
  8. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +56 -5
  9. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +0 -8
  10. package/bundled/dev-pipeline/prizmkit_runtime/runner_recovery.py +11 -1
  11. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +298 -63
  12. package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +243 -37
  13. package/bundled/dev-pipeline/scripts/continuation.py +0 -5
  14. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +10 -82
  15. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +7 -64
  16. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +40 -63
  17. package/bundled/dev-pipeline/scripts/utils.py +123 -0
  18. package/bundled/dev-pipeline/templates/agent-prompts/critic-plan-challenge.md +4 -3
  19. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-review.md +5 -6
  20. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +1 -1
  21. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +36 -35
  22. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +53 -80
  23. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +43 -78
  24. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +5 -17
  25. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +6 -18
  26. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +14 -48
  27. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +7 -14
  28. package/bundled/dev-pipeline/templates/sections/feature-context.md +0 -4
  29. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +0 -7
  30. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-opencli.md +0 -7
  31. package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +0 -7
  32. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +0 -14
  33. package/bundled/dev-pipeline/templates/sections/phase-commit.md +0 -14
  34. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +0 -7
  35. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-base.md +0 -2
  36. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-lite-suffix.md +0 -7
  37. package/bundled/dev-pipeline/templates/sections/phase-critic-plan-full.md +6 -8
  38. package/bundled/dev-pipeline/templates/sections/phase-critic-plan.md +3 -7
  39. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +4 -16
  40. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +4 -17
  41. package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +0 -7
  42. package/bundled/dev-pipeline/templates/sections/phase-plan-agent.md +2 -9
  43. package/bundled/dev-pipeline/templates/sections/phase-plan-lite.md +1 -8
  44. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +15 -16
  45. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +3 -10
  46. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +3 -10
  47. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +2 -9
  48. package/bundled/dev-pipeline/templates/sections/phase0-init.md +0 -7
  49. package/bundled/dev-pipeline/templates/sections/phase0-test-baseline.md +2 -15
  50. package/bundled/dev-pipeline/tests/conftest.py +0 -1
  51. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +395 -21
  52. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +50 -14
  53. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +154 -2
  54. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +431 -3
  55. package/bundled/dev-pipeline/tests/test_unified_cli.py +857 -5
  56. package/bundled/skills/_metadata.json +4 -4
  57. package/bundled/skills/app-planner/SKILL.md +1 -1
  58. package/bundled/skills/app-planner/references/architecture-decisions.md +1 -1
  59. package/bundled/skills/bug-fix-workflow/SKILL.md +174 -128
  60. package/bundled/skills/bug-planner/SKILL.md +101 -15
  61. package/bundled/skills/bug-planner/references/severity-rules.md +20 -8
  62. package/bundled/skills/feature-planner/SKILL.md +87 -8
  63. package/bundled/skills/feature-planner/assets/planning-guide.md +34 -10
  64. package/bundled/skills/feature-workflow/SKILL.md +100 -81
  65. package/bundled/skills/{prizm-kit → prizmkit}/SKILL.md +1 -1
  66. package/bundled/skills/prizmkit-code-review/SKILL.md +12 -13
  67. package/bundled/skills/prizmkit-code-review/references/reviewer-agent-prompt.md +10 -10
  68. package/bundled/skills/refactor-planner/SKILL.md +88 -7
  69. package/bundled/skills/refactor-planner/references/fast-path.md +2 -1
  70. package/bundled/skills/refactor-planner/references/planning-phases.md +29 -11
  71. package/bundled/skills/refactor-workflow/SKILL.md +116 -57
  72. package/bundled/templates/project-memory-template.md +1 -1
  73. package/package.json +1 -1
  74. package/src/ai-cli-launch.js +194 -0
  75. package/src/config.js +26 -14
  76. package/src/index.js +11 -44
  77. package/src/platforms.js +10 -3
  78. package/src/prompts.js +60 -2
  79. package/src/scaffold.js +26 -14
  80. package/bundled/dev-pipeline/scripts/prizmkit-test-gate.py +0 -446
  81. package/bundled/dev-pipeline/templates/agent-prompts/dev-fix.md +0 -7
  82. package/bundled/dev-pipeline/templates/agent-prompts/dev-resume.md +0 -5
  83. package/bundled/dev-pipeline/templates/sections/log-size-awareness.md +0 -20
  84. package/bundled/dev-pipeline/tests/test_prizmkit_test_gate.py +0 -107
  85. package/bundled/skills/prizmkit-code-review/references/dev-agent-prompt.md +0 -30
@@ -46,9 +46,22 @@ When the user provides detailed specifications, rules, or implementation require
46
46
  1. **Verbatim preservation**: The user's exact wording MUST be preserved in `description` and `acceptance_criteria` fields. Do NOT paraphrase, summarize, abstract, or simplify.
47
47
  2. **No autonomous simplification**: A 200-word user specification must NOT become a 30-word description. Match the detail level of the user's input.
48
48
  3. **Clarify, don't assume**: If any user-provided rule is ambiguous or potentially conflicts with another, ASK the user to clarify. No limit on clarification rounds. Do NOT proceed with unresolved ambiguities.
49
- 4. **Populate `user_context`**: ALL user-provided materials (supplementary content, rules, file path references) MUST be written into the `user_context` array of each bug in the generated `.prizmkit/plans/bug-fix-list.json`. Format:
50
- - Supplementary content or rules store as-is (verbatim text)
51
- - File references store as path string, e.g. `src/auth/login.ts:42-78` or `src/utils/validate.ts — focus on validateEmail function`
49
+ 4. **Task-scoped `user_context`**: In single-bug planning, write the relevant user-provided materials into that bug's `user_context`. In multi-bug planning, multi-bug `user_context` must contain only the user text, file references, logs, and reproduction details relevant to that specific bug.
50
+ - Preserve the matching user wording verbatim, but scope it to the item it belongs to.
51
+ - Do NOT copy the full multi-bug request into every bug.
52
+ - Ensure there are no unrelated sibling bug descriptions, stack traces, logs, reproduction steps, expected/actual behavior notes, or supplementary materials in a bug's `user_context`.
53
+ - Shared global context may be copied to every item only when it is explicitly applicable to all generated items.
54
+ - If a log, stack trace, screenshot, reproduction path, or file reference applies to only one bug, attach it only to that matching bug.
55
+ - If applicability is unclear, ask the user to map the material to the correct bug before generating the final list.
56
+ 5. **`user_context` format**:
57
+ - Bug-specific supplementary content or rules → store as-is (verbatim text) on the matching bug only
58
+ - Bug-specific file references → store as path string, e.g. `src/auth/login.ts:42-78` or `src/utils/validate.ts — focus on validateEmail function`
59
+ - Truly shared global constraints or environment context → repeat only when they apply to every generated bug
60
+
61
+ **Multi-bug isolation example:**
62
+ - User request includes: `Bug A: login crashes when password is empty`, `Bug B: CSV export loses Chinese characters`, and `Shared: production uses Node 20`.
63
+ - The login bug `user_context` includes `Bug A: login crashes when password is empty` and the shared Node 20 environment; it MUST NOT include `Bug B: CSV export loses Chinese characters`.
64
+ - The CSV bug `user_context` includes `Bug B: CSV export loses Chinese characters` and the shared Node 20 environment; it MUST NOT include `Bug A: login crashes when password is empty`.
52
65
 
53
66
  ## When to Use
54
67
 
@@ -59,6 +72,43 @@ The `description` frontmatter declares the trigger phrases for this skill. Beyon
59
72
  - User wants to fix a single bug interactively → use `bug-fix-workflow`
60
73
  - User wants to plan features → use `feature-planner`
61
74
 
75
+ ## Priority and Severity Calibration (Mandatory)
76
+
77
+ Bug planning must preserve the severity-to-priority mapping, but severity must be justified from concrete bug impact rather than from user frustration or the fact that something needs fixing.
78
+
79
+ ### Severity → Priority Mapping (Preserved)
80
+
81
+ - `critical` severity → `high` priority (treated with highest urgency)
82
+ - `high` severity → `high` priority
83
+ - `medium` severity → `medium` priority
84
+ - `low` severity → `low` priority
85
+
86
+ ### High Classification Guardrails
87
+
88
+ Do not classify a user report as `high` severity or `high` priority unless the bug independently shows at least one high-impact indicator:
89
+ - core feature outage or the user cannot complete a primary workflow
90
+ - data loss, data corruption, or data integrity risk
91
+ - security, privacy, authentication, or authorization failure
92
+ - timeout, crash, unrecoverable error, or production 500 affecting a meaningful path
93
+ - no reasonable workaround for affected users
94
+
95
+ Do not assign every generated bug `Priority: high` and `Complexity: high` unless every bug independently satisfies the high/critical severity criteria and the rationale names the matching indicator. For bugs, `Complexity` is represented by the `Severity` classification in the planning summary. "The user cares about this", "this needs fixing", or "the bug is in framework code" is not enough.
96
+
97
+ ### Required Planning Review Summary
98
+
99
+ Before writing `.prizmkit/plans/bug-fix-list.json`, display severity and priority rationales for every bug:
100
+
101
+ ```
102
+ ID | Title | Severity | Severity Rationale | Priority | Priority Rationale
103
+ B-001 | Login returns 500 | high | Core auth fails; no workaround | high | High severity maps to high priority
104
+ B-002 | CSV export mojibake | medium | Incorrect output; workaround exists | medium | Medium severity maps to medium priority
105
+ B-003 | Warning text typo | low | Cosmetic copy issue only | low | Low severity maps to low priority
106
+ ```
107
+
108
+ Medium and low bug assignments are expected for partial failures, workaround cases, cosmetic issues, and non-critical edge cases.
109
+
110
+ ---
111
+
62
112
  ## Intent Routing
63
113
 
64
114
  This skill handles multiple operations. Determine the user's intent and dispatch to the matching operation section below — each operation's authoritative trigger phrases live in its own **Operation:** section.
@@ -108,7 +158,6 @@ Gather project metadata from the project's own configuration and documentation
108
158
  1. **Identify project**: Read project name and description from these sources (first match wins):
109
159
  - `.prizmkit/config.json` (`project_name`, `description` fields)
110
160
  - `.prizmkit/prizm-docs/root.prizm` (project overview section)
111
- - `CLAUDE.md` or `CODEBUDDY.md` (project instructions)
112
161
  - `package.json` / `pyproject.toml` / `Cargo.toml` (name + description fields)
113
162
  - If none found, ask the user
114
163
  2. **Identify tech stack**: Read from these sources (first match wins):
@@ -169,7 +218,7 @@ Only finalize the bug entry after user confirms all three points.
169
218
 
170
219
  ### Phase 3: Prioritization & Review
171
220
 
172
- 1. **Auto-assign priorities**: Based on severity, adjustable by user
221
+ 1. **Auto-assign priorities**: Based on severity, adjustable by user; require a short severity rationale and priority rationale for each bug
173
222
 
174
223
  **Severity → Priority Mapping**:
175
224
  - `critical` severity → `high` priority (treated with highest urgency)
@@ -177,13 +226,18 @@ Only finalize the bug entry after user confirms all three points.
177
226
  - `medium` severity → `medium` priority
178
227
  - `low` severity → `low` priority
179
228
 
180
- Note: Severity has 4 levels (critical, high, medium, low) but Priority has 3 levels (high, medium, low). Both critical and high severity bugs map to high priority.
181
- 2. **Display summary table**:
229
+ Note: Severity has 4 levels (critical, high, medium, low) but Priority has 3 levels (high, medium, low). Both critical and high severity bugs map to high priority. Preserve this mapping exactly.
230
+
231
+ **Calibration check before accepting high**:
232
+ - High/critical severity requires a concrete indicator: core feature outage, data loss/integrity, security/privacy/auth failure, timeout/crash/production 500, or no workaround.
233
+ - If the report is "annoying", partially broken, has a workaround, or affects a non-critical edge case, prefer `medium` or `low` as documented in the severity rules.
234
+ - Do not treat "needs fixing", "user reported it", or "framework bug" as automatic high priority.
235
+ 2. **Display summary table with rationales**:
182
236
  ```
183
- ID | Title | Severity | Priority | Verification
184
- B-001 | Login null reference crash | critical | high | automated
185
- B-002 | CSV export Chinese encoding | medium | medium | hybrid
186
- B-003 | Slow dashboard loading | low | low | manual
237
+ ID | Title | Severity | Severity Rationale | Priority | Priority Rationale | Verification
238
+ B-001 | Login null reference crash | high | Core auth fails; no workaround | high | High severity maps to high | automated
239
+ B-002 | CSV export Chinese encoding | medium | Incorrect output; workaround exists | medium | Medium severity maps to medium | hybrid
240
+ B-003 | Slow dashboard loading | low | Non-critical page; minor delay | low | Low severity maps to low | manual
187
241
  ```
188
242
  3. **Ask for adjustments**: "Want to reorder priorities, change severity, or remove any bugs?"
189
243
  4. **Detect potential duplicates**: If two bugs have similar error messages or affected modules, warn user
@@ -229,14 +283,42 @@ Only proceed to Phase 5 after user confirms.
229
283
  ```
230
284
  The script fills in defaults (`$schema`, `created_at`, `created_by`), validates all fields, and writes the final file only if validation passes.
231
285
  3. **If validation fails**: Fix the draft and retry (max 3 attempts). If the script is unavailable, use the checklist in `${SKILL_DIR}/references/schema-validation.md`.
232
- 4. **Output**: File path, summary, and next steps
286
+ 4. **Run the mandatory Post-Generation Plan Review Gate** (see §Post-Generation Plan Review Gate below): invoke `/prizmkit-code-review` on only newly added/changed bug entries after validation passes and before success output.
287
+ 5. **Output**: File path, summary, review result, validation outcome, and next steps
233
288
 
234
289
  **Gate → CP-BP-5**: `bug-fix-list.json` passes validation script with zero errors.
235
290
 
291
+ **Gate → CP-BP-6**: `/prizmkit-code-review` reviewed only newly added/changed bug entries; accepted fixes were regenerated and revalidated.
292
+
293
+ ## Post-Generation Plan Review Gate
294
+
295
+ User requirement preserved verbatim: `每次完成任务规划的时候,应该调用/prizmkit-code-review 对新增的计划内容进行review,确保生成新增的计划的正确行和完整性。`
296
+
297
+ Run this gate **after** `.prizmkit/plans/bug-fix-list.json` passes the validation/generate script and **before** any success output or next-step summary recommends `bugfix-pipeline-launcher`. This gate applies to Interactive Planning, From Log, From Tests, and any append-to-existing bug list flow.
298
+
299
+ 1. **Identify review scope**: compare the final validated bug list against the pre-session list when one existed. Review only newly added or changed bug entries. Do not re-review unchanged historical entries except when needed to verify duplicate/root-cause overlap or dependency references.
300
+ 2. **Invoke `/prizmkit-code-review` as a planning-quality gate** with an explicit prompt that this is a bug-plan-entry review, not an implementation review. The review must check:
301
+ - schema correctness and compatibility with `dev-pipeline-bug-fix-list-v1`
302
+ - dependency/DAG consistency, duplicate handling, and root-cause overlap
303
+ - description completeness, including expected vs actual behavior, reproduction path, code-location hints, and headless execution readiness
304
+ - acceptance criteria specificity and measurable verification method
305
+ - preservation of user-provided wording in `description`, `acceptance_criteria`, and `user_context`
306
+ - task-scoped `user_context` isolation: no unrelated sibling bug descriptions, logs, stack traces, reproduction steps, or supplementary materials, and shared context appears on multiple items only when explicitly global
307
+ - severity/priority calibration: every reviewed bug has a short severity rationale and priority rationale, the preserved severity-to-priority mapping is followed, and high priority is not used without core outage, data loss/integrity, security/auth, timeout/crash, or no-workaround indicators
308
+ 3. **Keep the review planning-only**: do NOT start `bugfix-pipeline-launcher`, do NOT run the bugfix pipeline, do NOT run tests/builds/installs, and do NOT implement source-code fixes.
309
+ 4. **Apply accepted review fixes through the draft/source plan**: when a finding is accepted, update `.prizmkit/plans/bug-fix-list.draft.json` or the in-memory draft representation first, then regenerate the final file with:
310
+ ```bash
311
+ python3 ${SKILL_DIR}/scripts/validate-bug-list.py generate --input .prizmkit/plans/bug-fix-list.draft.json --output .prizmkit/plans/bug-fix-list.json
312
+ ```
313
+ Do not hand-patch the final JSON as the source of truth; map final-output findings back to draft entries before regeneration.
314
+ 5. **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.
315
+ 6. **Report the gate outcome** in the final summary: include `/prizmkit-code-review` verdict, reviewed bug IDs, accepted fixes (or "none"), and final validation result.
316
+
236
317
  #### Success Output
237
318
 
238
319
  ```
239
320
  .prizmkit/plans/bug-fix-list.json generated with 3 bugs (1 critical, 1 medium, 1 low)
321
+ Review gate: /prizmkit-code-review PASS, reviewed B-001..B-003, accepted fixes: none, final validation: PASS
240
322
 
241
323
  Next steps:
242
324
  - Review: cat .prizmkit/plans/bug-fix-list.json
@@ -254,6 +336,7 @@ Checkpoints catch cascading errors early — skipping one means the next phase b
254
336
  | **CP-BP-3** | Priorities Set | Severity/priority assigned, duplicates resolved | 3 |
255
337
  | **CP-BP-4** | Completeness Passed | All bugs pass headless execution readiness check | 4 |
256
338
  | **CP-BP-5** | File Generated | `bug-fix-list.json` passes validation script | 5 |
339
+ | **CP-BP-6** | Plan Review Passed | `/prizmkit-code-review` reviewed only newly added/changed bug entries; accepted fixes were regenerated and revalidated | 5 |
257
340
 
258
341
  **Resume Detection**: If existing `.prizmkit/plans/bug-fix-list.json` or draft found, read `${SKILL_DIR}/references/error-recovery.md` §Resume Support for checkpoint-based resumption.
259
342
 
@@ -280,6 +363,7 @@ Batch-parse error logs to generate bug entries without interactive prompts:
280
363
  ```bash
281
364
  python3 ${SKILL_DIR}/scripts/validate-bug-list.py generate --input .prizmkit/plans/bug-fix-list.draft.json --output .prizmkit/plans/bug-fix-list.json
282
365
  ```
366
+ 7. If validation passes, run the mandatory Post-Generation Plan Review Gate before summarizing or recommending `bugfix-pipeline-launcher`.
283
367
 
284
368
  ## Operation: From Tests
285
369
 
@@ -296,6 +380,7 @@ Batch-parse failed test output:
296
380
  ```bash
297
381
  python3 ${SKILL_DIR}/scripts/validate-bug-list.py generate --input .prizmkit/plans/bug-fix-list.draft.json --output .prizmkit/plans/bug-fix-list.json
298
382
  ```
383
+ 7. If validation passes, run the mandatory Post-Generation Plan Review Gate before summarizing or recommending `bugfix-pipeline-launcher`.
299
384
 
300
385
  ## Operation: Validate
301
386
 
@@ -348,10 +433,11 @@ Key points:
348
433
 
349
434
  Recommend invoking `bugfix-pipeline-launcher` to configure and launch the pipeline. Do NOT recommend running shell scripts directly — that is the launcher's responsibility.
350
435
 
351
- After `.prizmkit/plans/bug-fix-list.json` is generated, present:
436
+ After `.prizmkit/plans/bug-fix-list.json` is generated, validated, and reviewed, present:
352
437
  1. Summary of generated bugs (count, severity breakdown)
353
- 2. Recommend: "Say 'start fixing' to launch the bugfix pipeline via `bugfix-pipeline-launcher`"
354
- 3. Alternative: fix a single bug interactively via `bug-fix-workflow`
438
+ 2. Review result: `/prizmkit-code-review` verdict, reviewed bug IDs, accepted fixes (or "none"), and final validation result
439
+ 3. Recommend: "Say 'start fixing' to launch the bugfix pipeline via `bugfix-pipeline-launcher`"
440
+ 4. Alternative: fix a single bug interactively via `bug-fix-workflow`
355
441
 
356
442
  ## Error Handling
357
443
 
@@ -1,16 +1,28 @@
1
1
  # Severity Auto-Classification Rules
2
2
 
3
- When extracting bugs, apply these rules to auto-suggest severity:
3
+ When extracting bugs, apply these rules to auto-suggest severity. Require a short rationale for every severity assignment and then map severity to priority using the planner's preserved mapping.
4
4
 
5
5
  | Severity | Indicators | Examples |
6
6
  |----------|------------|----------|
7
- | **critical** | System crash, data loss, security breach, OOM, unrecoverable error | `Segmentation fault`, `OutOfMemoryError`, `SQL injection vulnerability`, `Database corrupted` |
8
- | **high** | Core feature broken, authentication failure, data integrity issue, timeout | `Auth token invalid`, `Payment failed`, `Connection timeout`, `500 Internal Server Error` |
9
- | **medium** | Feature partially broken, workaround exists, incorrect output | `CSV encoding issue`, `Pagination not working`, `Wrong date format`, `Missing validation` |
10
- | **low** | Cosmetic issue, minor inconvenience, edge case | `UI misalignment`, `Typo in error message`, `Slow loading (non-critical page)`, `Non-breaking warning` |
7
+ | **critical** | System-wide crash, active data loss/corruption, exploitable security breach, OOM, unrecoverable production outage, no workaround | `Segmentation fault` on startup, `OutOfMemoryError` halting workers, `SQL injection vulnerability`, `Database corrupted` |
8
+ | **high** | Core feature outage, authentication/authorization failure, data integrity issue, repeated timeout/crash/500 on primary workflow, payment blocked, no reasonable workaround | `Auth token invalid for all users`, `Payment failed for valid cards`, `Connection timeout on checkout`, `500 Internal Server Error on login` |
9
+ | **medium** | Feature partially broken, incorrect output, validation gap, failed non-critical test, workaround exists, limited user segment affected | `CSV encoding issue with manual export workaround`, `Pagination not working on admin table`, `Wrong date format`, `Missing optional validation` |
10
+ | **low** | Cosmetic issue, minor inconvenience, rare edge case with easy workaround, non-breaking warning, docs/copy issue | `UI misalignment`, `Typo in error message`, `Slow loading on non-critical page`, `Non-breaking warning` |
11
11
 
12
12
  ## Special Cases
13
13
 
14
- - Failed test → medium (unless test covers critical path, then high)
15
- - User report with "cannot use app" → high
16
- - User report with "annoying but works" → low
14
+ - Failed test → medium unless the failed test covers auth, payment, data integrity, security, startup, or another critical path; then high with rationale.
15
+ - User report with "cannot use app" → high only when a primary workflow is blocked and no workaround exists.
16
+ - User report with "annoying but works" → low.
17
+ - User frustration, repeated wording, or "please fix urgently" is not a severity indicator by itself; look for objective impact.
18
+ - Framework or infrastructure bugs are not automatically high; classify by user/runtime impact and workaround availability.
19
+
20
+ ## Mixed Calibration Examples
21
+
22
+ | Bug | Severity | Priority | Rationale |
23
+ |-----|----------|----------|-----------|
24
+ | Login returns 500 for every valid credential | high | high | Core auth workflow outage with no workaround; high severity maps to high priority. |
25
+ | CSV export corrupts non-ASCII characters but JSON export works | medium | medium | Incorrect output with a workaround; medium severity maps to medium priority. |
26
+ | Settings tooltip has outdated wording | low | low | Cosmetic copy issue only; low severity maps to low priority. |
27
+
28
+ Anti-pattern: do not generate an all-high bug list unless each bug independently includes high/critical indicators such as core outage, data loss/integrity, security/auth failure, timeout/crash, or no workaround.
@@ -54,9 +54,22 @@ When the user provides detailed specifications, rules, or implementation require
54
54
  1. **Verbatim preservation**: The user's exact wording MUST be preserved in `description` and `acceptance_criteria` fields. Do NOT paraphrase, summarize, abstract, or simplify.
55
55
  2. **No autonomous simplification**: A 200-word user specification must NOT become a 30-word description. Match the detail level of the user's input.
56
56
  3. **Clarify, don't assume**: If any user-provided rule is ambiguous or potentially conflicts with another, ASK the user to clarify. No limit on clarification rounds. Do NOT proceed with unresolved ambiguities.
57
- 4. **Populate `user_context`**: ALL user-provided materials (supplementary content, rules, file path references) MUST be written into the `user_context` array of each feature in the generated `.prizmkit/plans/feature-list.json`. Format:
58
- - Supplementary content or rules store as-is (verbatim text)
59
- - File references store as path string, e.g. `src/auth/login.ts:42-78` or `src/utils/validate.ts — focus on validateEmail function`
57
+ 4. **Task-scoped `user_context`**: In single-feature planning, write the relevant user-provided materials into that feature's `user_context`. In multi-feature planning, multi-feature `user_context` must contain only the user text, file references, and supplementary materials relevant to that specific feature.
58
+ - Preserve the matching user wording verbatim, but scope it to the item it belongs to.
59
+ - Do NOT copy the full multi-feature request into every feature.
60
+ - Ensure there are no unrelated sibling feature descriptions, file references, screenshots, or supplementary materials in a feature's `user_context`.
61
+ - Shared global context may be copied to every item only when it is explicitly applicable to all generated items.
62
+ - If a material applies to only one feature, attach it only to that matching feature.
63
+ - If applicability is unclear, ask the user to map the material to the correct feature before generating the final list.
64
+ 5. **`user_context` format**:
65
+ - Feature-specific supplementary content or rules → store as-is (verbatim text) on the matching feature only
66
+ - Feature-specific file references → store as path string, e.g. `src/auth/login.ts:42-78` or `src/utils/validate.ts — focus on validateEmail function`
67
+ - Truly shared global constraints → repeat only when they apply to every generated feature
68
+
69
+ **Multi-feature isolation example:**
70
+ - User request includes: `Feature A: add saved filters to the dashboard`, `Feature B: export filtered results as CSV`, and `Shared: preserve existing auth permissions`.
71
+ - The saved-filters feature `user_context` includes `Feature A: add saved filters to the dashboard` and the shared auth constraint; it MUST NOT include `Feature B: export filtered results as CSV`.
72
+ - The CSV export feature `user_context` includes `Feature B: export filtered results as CSV` and the shared auth constraint; it MUST NOT include `Feature A: add saved filters to the dashboard`.
60
73
 
61
74
  ## When to Use
62
75
 
@@ -147,6 +160,45 @@ The `global_context` object in `.prizmkit/plans/feature-list.json` provides tech
147
160
 
148
161
  All `global_context` fields are optional — including recommended fields improves downstream code generation quality. See `.prizmkit/dev-pipeline/templates/feature-list-schema.json` for the full schema definition.
149
162
 
163
+ ## Priority and Complexity Calibration (Mandatory)
164
+
165
+ Do not let planner output collapse into uniform `Priority: high` and `estimated_complexity: high`. Medium and low assignments are normal when the documented indicators fit. New framework work or multi-file work is not automatically `high` priority; the feature must satisfy the documented priority criteria independently.
166
+
167
+ ### Priority Rubric
168
+
169
+ | Priority | Use When | Do NOT Use Merely Because |
170
+ |----------|----------|---------------------------|
171
+ | `critical` | A production-blocking capability, security/compliance requirement, data-loss prevention, or release blocker with no acceptable workaround. | The item is important, large, or requested by a stakeholder. |
172
+ | `high` | Core user workflow or platform capability is blocked, revenue/security/auth/data integrity is at risk, a hard deadline depends on it, or many downstream items cannot proceed without it. | The item is multi-file, framework-related, or described with urgent language but no concrete blocker. |
173
+ | `medium` | Valuable planned feature, quality improvement, integration, or automation that should be scheduled soon but has a workaround or does not block core operation. | It is less exciting than another item; medium is the default for normal planned work. |
174
+ | `low` | Nice-to-have, polish, documentation, cleanup, optional convenience, or isolated improvement with little user/runtime impact. | The item is small; small work can still be high only when it blocks critical outcomes. |
175
+
176
+ ### Complexity Rationale Rules
177
+
178
+ Assign `estimated_complexity` from concrete scope indicators, not from perceived importance. For each feature, write a short rationale using at least two relevant indicators:
179
+ - affected module count and layer count
180
+ - file count or expected implementation surface
181
+ - API/interface or schema changes
182
+ - architectural impact or new infrastructure
183
+ - dependency depth and cross-feature coupling
184
+ - acceptance-criteria count and edge-case breadth
185
+ - test coverage and verification difficulty
186
+
187
+ Use `low` for focused changes in 1 module with <=5 acceptance criteria and no public API/schema changes. Use `medium` for normal multi-file or 2-3 module work with bounded interfaces. Use `high` only when multiple concrete high indicators are present, such as 3+ modules plus public API changes, deep dependencies, weak tests, or substantial architectural risk. Use `critical` only for system-wide architectural/infrastructure changes or safety-critical work requiring full-team/multi-critic execution.
188
+
189
+ ### Required Planning Review Summary
190
+
191
+ Before writing `.prizmkit/plans/feature-list.json`, show a calibration table with rationale columns:
192
+
193
+ ```
194
+ ID | Title | Priority | Priority Rationale | Complexity | Complexity Rationale
195
+ F-001 | Auth outage recovery | high | Core login blocked; no workaround | high | Auth API + middleware + weak tests
196
+ F-002 | Export polish option | medium | Useful workflow; not blocking | medium | UI + API parameter; bounded tests
197
+ F-003 | Tooltip copy update | low | Cosmetic clarity only | low | One component; no interface change
198
+ ```
199
+
200
+ Anti-pattern rule: do not assign every generated item `Priority: high` and `Complexity: high` unless each item independently satisfies the documented high criteria and its rationale names those criteria. In feature JSON this means `estimated_complexity: high`; in user-facing review summaries label the column `Complexity`.
201
+
150
202
 
151
203
  ---
152
204
 
@@ -196,12 +248,13 @@ Execute the planning workflow in conversation mode with mandatory checkpoints:
196
248
  4. Refine descriptions and acceptance criteria
197
249
  4.1 **Per-feature clarification** — for each feature, if the description, acceptance criteria, or scope is vague or could be interpreted multiple ways, ask the user to clarify before finalizing.
198
250
  4.2 **Browser interaction** (mandatory for fullstack/frontend projects) — see §Browser Interaction Planning below. Qualifying features get `browser_interaction` by default. Only confirm with the user as a batch summary; do NOT ask per-feature.
199
- 5. Verify DAG/order/priorities
251
+ 5. Verify DAG/order/priorities and show the mandatory priority/complexity calibration table with short rationales for every item
200
252
  6. Pre-generation completeness review (see §Pre-Generation Completeness Review below)
201
253
  7. Build or append `.prizmkit/plans/feature-list.json`
202
254
  8. Apply default testing strategy (see §Testing Defaults below)
203
255
  9. Validate and fix until pass
204
- 10. Summarize final feature table
256
+ 10. Run the mandatory Post-Generation Plan Review Gate (see §Post-Generation Plan Review Gate below); apply accepted fixes to the draft/source plan, regenerate, and revalidate until pass
257
+ 11. Summarize final feature table with review result and validation outcome
205
258
 
206
259
  ### Checkpoints (Mandatory Gates)
207
260
 
@@ -217,6 +270,7 @@ Checkpoints catch cascading errors early — skipping one means the next phase b
217
270
  | **CP-FP-3.3** | Completeness Review Passed | All features reviewed for description adequacy and cross-feature gaps | 6 |
218
271
  | **CP-FP-4** | `.prizmkit/plans/feature-list.json` Generated | Schema validates, all required keys present | 7-8 |
219
272
  | **CP-FP-5** | Final Validation Pass | Python script returns `"valid": true` with zero errors | 9 |
273
+ | **CP-FP-6** | Plan Review Passed | `/prizmkit-code-review` reviewed only newly added/changed feature entries; accepted fixes were regenerated and revalidated | 10 |
220
274
 
221
275
  **Resume Detection**: If existing artifacts are found, read `${SKILL_DIR}/references/error-recovery.md` §Resume Support for checkpoint-based resumption.
222
276
 
@@ -268,7 +322,7 @@ For simple incremental planning, skip detailed Phase 2-3 analysis:
268
322
  ```bash
269
323
  python3 ${SKILL_DIR}/scripts/validate-and-generate.py generate --input .prizmkit/plans/feature-list.draft.json --output .prizmkit/plans/feature-list.json
270
324
  ```
271
- 6. If valid → summarize and recommend next step
325
+ 6. If valid → run the mandatory Post-Generation Plan Review Gate, then summarize and recommend next step
272
326
  7. If invalid → apply fixes to the draft, re-run generate (max 2 attempts, then escalate to full workflow)
273
327
 
274
328
  ## Browser Interaction Planning
@@ -321,6 +375,30 @@ python3 ${SKILL_DIR}/scripts/validate-and-generate.py generate --input .prizmkit
321
375
  ```
322
376
  The script fills in defaults (`$schema`, `created_at`, `created_by`), validates all fields, and writes the final file only if validation passes. If validation fails, fix the draft and retry.
323
377
 
378
+ ## Post-Generation Plan Review Gate
379
+
380
+ User requirement preserved verbatim: `每次完成任务规划的时候,应该调用/prizmkit-code-review 对新增的计划内容进行review,确保生成新增的计划的正确行和完整性。`
381
+
382
+ Run this gate **after** `.prizmkit/plans/feature-list.json` passes the validation/generate script and **before** the final handoff summary recommends `feature-pipeline-launcher`. This gate applies to full workflow and fast-path incremental planning.
383
+
384
+ 1. **Identify review scope**: compare the final validated feature list against the pre-session list when one existed. Review only newly added or changed feature entries. Do not re-review unchanged historical entries except when needed to verify dependency references.
385
+ 2. **Invoke `/prizmkit-code-review` as a planning-quality gate** with an explicit prompt that this is a plan-entry review, not an implementation review. The review must check:
386
+ - schema correctness and compatibility with `dev-pipeline-feature-list-v1`
387
+ - dependency/DAG soundness, including missing, invalid, circular, or poorly ordered dependencies
388
+ - description completeness and headless execution readiness
389
+ - acceptance criteria specificity and measurability
390
+ - preservation of user-provided wording in `description`, `acceptance_criteria`, and `user_context`
391
+ - task-scoped `user_context` isolation: no unrelated sibling feature descriptions, file references, or supplementary materials, and shared context appears on multiple items only when explicitly global
392
+ - priority/complexity calibration: every reviewed feature has a short priority rationale and complexity rationale, medium/low assignments are allowed when criteria fit, and high/high is not used merely because work is framework-related, multi-file, or user-requested
393
+ 3. **Keep the review planning-only**: do NOT start `feature-pipeline-launcher`, do NOT run the dev-pipeline, do NOT run tests/builds/installs, and do NOT implement source-code changes.
394
+ 4. **Apply accepted review fixes through the draft/source plan**: when a finding is accepted, update `.prizmkit/plans/feature-list.draft.json` or the in-memory draft representation first, then regenerate the final file with:
395
+ ```bash
396
+ python3 ${SKILL_DIR}/scripts/validate-and-generate.py generate --input .prizmkit/plans/feature-list.draft.json --output .prizmkit/plans/feature-list.json
397
+ ```
398
+ Do not hand-patch the final JSON as the source of truth; map final-output findings back to draft entries before regeneration.
399
+ 5. **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.
400
+ 6. **Report the gate outcome** in the final summary: include `/prizmkit-code-review` verdict, reviewed feature IDs, accepted fixes (or "none"), and final validation result.
401
+
324
402
  ## Testing Defaults (Phase 8)
325
403
 
326
404
  Set default testing-related fields for each feature. The user can opt out.
@@ -369,10 +447,11 @@ When the session appears to be ending:
369
447
 
370
448
  ## Handoff Message Template
371
449
 
372
- After successful validation, report:
450
+ After successful validation and the Post-Generation Plan Review Gate, report:
373
451
  1. Output file path
374
452
  2. Total features + newly added features
375
453
  3. Dependency and priority highlights
376
- 4. Recommended next action: `feature-pipeline-launcher`
454
+ 4. Review result: `/prizmkit-code-review` verdict, reviewed feature IDs, accepted fixes (or "none"), and final validation result
455
+ 5. Recommended next action: `feature-pipeline-launcher`
377
456
 
378
457
  Then apply the post-planning handoff in §Scope Boundary (ask before proceeding; never auto-execute).
@@ -116,12 +116,25 @@ Then [expected outcome]
116
116
 
117
117
  ## Complexity Estimation Guide
118
118
 
119
- | Complexity | Characteristics | Typical Scope | Pipeline Tier |
120
- |------------|----------------|---------------|---------------|
121
- | low | Single module, straightforward CRUD, minimal UI | 1-2 API endpoints, 1-2 pages | lite (1 agent) |
122
- | medium | Multiple modules, business logic, moderate UI | 3-5 API endpoints, 2-4 pages | lite (1 agent) |
123
- | high | Cross-cutting concerns, complex state, advanced UI | 5+ API endpoints, complex interactions | standard (3 agents) |
124
- | critical | Architectural changes, 10+ files, multi-module API surface changes | System-wide refactoring, new infrastructure + app logic | full (5 agents + critic) |
119
+ Complexity is an execution-scope estimate, not a priority or importance signal. Do not default to `high` because a feature is framework work, multi-file work, or strongly requested by the user. Assign complexity from concrete indicators and include a short rationale in the planner's confirmation table.
120
+
121
+ | Complexity | Concrete Indicators | Typical Scope | Pipeline Tier |
122
+ |------------|---------------------|---------------|---------------|
123
+ | low | 1 module/layer, 1-3 files, no public API/schema change, shallow dependencies, <=5 acceptance criteria, clear existing tests | 1-2 API endpoints, 1-2 pages, focused config or copy behavior | lite (1 agent) |
124
+ | medium | 2-3 modules/layers, 3-6 files, bounded API/interface changes, moderate dependency depth, 4-8 acceptance criteria, standard test updates | 3-5 API endpoints, 2-4 pages, normal integration work | lite (1 agent) |
125
+ | high | 3+ modules/layers plus public API/interface or schema impact, deep dependencies, weak test coverage, complex state, third-party integration risk, or 8+ acceptance criteria | 5+ API endpoints, complex interactions, cross-cutting behavior | standard (3 agents) |
126
+ | critical | System-wide architecture, new infrastructure, 10+ files with multi-module API surface changes, safety/security/data-loss risk requiring multi-critic review | System-wide refactoring, new infrastructure + app logic | full (5 agents + critic) |
127
+
128
+ ### Complexity Indicator Checklist
129
+
130
+ Use at least two relevant indicators in each `estimated_complexity` rationale:
131
+ - affected module count and layer count
132
+ - expected file count and implementation surface
133
+ - API/interface/schema changes
134
+ - architectural impact or new infrastructure
135
+ - dependency depth and cross-feature coupling
136
+ - acceptance-criteria count and edge-case breadth
137
+ - existing test coverage and verification difficulty
125
138
 
126
139
  ### Complexity Red Flags
127
140
 
@@ -136,10 +149,21 @@ Consider splitting a feature if it exhibits any of the following:
136
149
 
137
150
  ### Estimation Consistency Rules
138
151
 
139
- - If a feature is marked as "low" complexity, it should not have more than 5 acceptance criteria.
140
- - If a feature is marked as "high" complexity, it should have a clear justification (e.g., "involves payment processing with webhook handling and idempotency").
141
- - Use "critical" complexity only for features requiring architectural changes that touch 10+ files, involve cross-module API surface changes, or need multi-critic voting for safety.
142
- - When in doubt, estimate higher -- it is better to over-allocate than to under-allocate.
152
+ - If a feature is marked as `low` complexity, it should not have more than 5 acceptance criteria and should have no public API/schema changes.
153
+ - If a feature is marked as `medium` complexity, explain why the scope is bounded even if it touches multiple files.
154
+ - If a feature is marked as `high` complexity, it must have a clear concrete justification (e.g., "payment processing with webhook idempotency across API, persistence, and worker modules").
155
+ - Use `critical` complexity only for features requiring architectural changes that touch 10+ files, involve cross-module API surface changes, or need multi-critic voting for safety.
156
+ - When in doubt between two levels, choose the higher level only when the concrete scope indicators support it; do not use `high` as a safe default.
157
+
158
+ ### Mixed Calibration Examples
159
+
160
+ | Feature | Priority | Complexity | Rationale |
161
+ |---------|----------|------------|-----------|
162
+ | Restore broken login for all users | high | high | Core auth workflow blocked with no workaround; API, middleware, and session tests affected. |
163
+ | Add CSV delimiter option to existing export | medium | medium | Useful workflow improvement with workaround; bounded UI + API parameter and existing tests. |
164
+ | Update tooltip wording on settings page | low | low | Cosmetic clarity only; one component, no interface change, simple visual check. |
165
+
166
+ Anti-pattern: a generated plan where every item is `Priority: high` and `Complexity: high` is invalid unless every item independently names the documented high-priority and high-complexity indicators it satisfies. In feature JSON this corresponds to `estimated_complexity: high`; review summaries should still show a human-readable `Complexity` column.
143
167
 
144
168
  ---
145
169