prizmkit 1.1.112 → 1.1.114

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 (48) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/codex/skill-adapter.js +4 -0
  3. package/bundled/dev-pipeline/SCHEMA_ANALYSIS.md +10 -10
  4. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +1 -0
  5. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +7 -0
  6. package/bundled/dev-pipeline/scripts/utils.py +8 -3
  7. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +7 -1
  8. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +7 -1
  9. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +7 -1
  10. package/bundled/dev-pipeline/templates/sections/bugfix-phase-commit-report.md +1 -1
  11. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +7 -1
  12. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-opencli.md +7 -1
  13. package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +7 -1
  14. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +87 -21
  15. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +14 -0
  16. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +42 -0
  17. package/bundled/dev-pipeline/tests/test_runtime_helper.py +23 -0
  18. package/bundled/skills/_metadata.json +1 -1
  19. package/bundled/skills/app-planner/SKILL.md +18 -2
  20. package/bundled/skills/app-planner/references/generated-plan-review.md +67 -0
  21. package/bundled/skills/bug-planner/SKILL.md +19 -24
  22. package/bundled/skills/bug-planner/references/generated-plan-review.md +63 -0
  23. package/bundled/skills/bug-planner/scripts/validate-bug-list.py +43 -3
  24. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +6 -6
  25. package/bundled/skills/feature-pipeline-launcher/SKILL.md +7 -16
  26. package/bundled/skills/feature-planner/SKILL.md +17 -22
  27. package/bundled/skills/feature-planner/references/generated-plan-review.md +63 -0
  28. package/bundled/skills/feature-workflow/SKILL.md +8 -7
  29. package/bundled/skills/prizmkit-code-review/references/reviewer-agent-prompt.md +2 -2
  30. package/bundled/skills/prizmkit-deploy/references/database-setup.md +12 -3
  31. package/bundled/skills/prizmkit-init/SKILL.md +2 -2
  32. package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +12 -14
  33. package/bundled/skills/prizmkit-test/SKILL.md +1 -1
  34. package/bundled/skills/prizmkit-test/references/boundary-coverage-protocol.md +1 -1
  35. package/bundled/skills/prizmkit-test/references/examples.md +2 -2
  36. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +3 -2
  37. package/bundled/skills/refactor-planner/SKILL.md +20 -26
  38. package/bundled/skills/refactor-planner/references/fast-path.md +2 -2
  39. package/bundled/skills/refactor-planner/references/generated-plan-review.md +63 -0
  40. package/bundled/skills/refactor-workflow/SKILL.md +6 -5
  41. package/package.json +1 -1
  42. package/src/clean.js +60 -7
  43. package/src/config.js +61 -20
  44. package/src/gitignore-template.js +6 -3
  45. package/src/manifest.js +6 -2
  46. package/src/platforms.js +14 -0
  47. package/src/scaffold.js +198 -34
  48. package/src/upgrade.js +5 -2
@@ -13,7 +13,7 @@ STEPS:
13
13
  - HIERARCHY RULE: directory X inside top-level module M maps to .prizmkit/prizm-docs/<M>/<X>.prizm, never to .prizmkit/prizm-docs/<X>.prizm.
14
14
  - Exclude .git/, node_modules/, vendor/, build/, dist/, __pycache__/, target/, bin/, .claude/, .codebuddy/, .prizmkit/, .prizmkit/prizm-docs/, dev-pipeline/. If total module count > 30, ask user for include/exclude patterns.
15
15
  3. Create .prizmkit/prizm-docs/ directory structure mirroring the source tree exactly. For each top-level module M that has sub-modules, create the subdirectory .prizmkit/prizm-docs/<M>/.
16
- 4. Generate root.prizm (L0) with PROJECT, LANG, FRAMEWORK, BUILD, TEST, ENTRY, MODULE_INDEX with multi-level entries as needed for efficient navigation (constrained by 4KB limit), RULES extracted from CODEBUDDY.md/CLAUDE.md/README/linter configs, PATTERNS, and CROSS_CUTTING (cross-module concerns spanning 2+ modules). Set PRIZM_VERSION: 4. Max 4KB. No CHANGELOG sections/files, UPDATED/date metadata, feature/bug/refactor/task/session/run/pipeline/workflow IDs, branch names, absolute worktree paths, or `.prizmkit/specs` / `.prizmkit/dev-pipeline` artifact paths — git tracks history.
16
+ 4. Generate root.prizm (L0) with PROJECT, LANG, FRAMEWORK, BUILD, TEST, ENTRY, MODULE_INDEX with multi-level entries as needed for efficient navigation (constrained by 4KB limit), RULES extracted from user-facing main memory files (AGENTS.md, CLAUDE.md, CODEBUDDY.md), README, and linter configs. Do not extract RULES from AGENTS.private.md, CLAUDE.private.md, or CODEBUDDY.private.md because those files contain PrizmKit framework protocol text. Include PATTERNS and CROSS_CUTTING (cross-module concerns spanning 2+ modules). Set PRIZM_VERSION: 4. Max 4KB. No CHANGELOG sections/files, UPDATED/date metadata, feature/bug/refactor/task/session/run/pipeline/workflow IDs, branch names, absolute worktree paths, or `.prizmkit/specs` / `.prizmkit/dev-pipeline` artifact paths — git tracks history.
17
17
  - If `.prizmkit/plans/project-brief.md` exists: add `PROJECT_BRIEF: .prizmkit/plans/project-brief.md` to root.prizm (generated by prizmkit-init). If not present, skip — prizmkit-init Phase 7 will add it later.
18
18
  - If module count > 15: use MODULE_GROUPS format instead of MODULE_INDEX — group modules by functional domain (3-8 domains, inferred from directory structure and module responsibilities). See prizm-docs-format.md for MODULE_GROUPS format.
19
19
  - For each module entry, auto-generate 3-6 keyword tags by scanning the module's key source files for: exported function/class names, imported library names, domain-specific terms in file/directory names. Add tags in square brackets after the module name (e.g., `- auth [login, session, jwt]: ...`). Tags are optional but recommended for projects with 10+ modules.
@@ -21,8 +21,8 @@ STEPS:
21
21
  - Top-level module M → write .prizmkit/prizm-docs/<M>.prizm (include SUBDIRS section with pointers to sub-module docs)
22
22
  - Sub-module S inside M → write .prizmkit/prizm-docs/<M>/<S>.prizm
23
23
  Each L1 includes MODULE (full relative path), FILES count, RESPONSIBILITY, SUBDIRS with pointers, KEY_FILES (5-10 most important), DEPENDENCIES (imports, imported-by, external), RULES (1-3 most critical only). L1 does NOT include INTERFACES, DATA_FLOW, TRAPS, or DECISIONS (those are L2, generated lazily). Max 4KB each.
24
- 6. Skip L2 docs during init — L2 is created lazily on first file modification or when AI needs deep understanding (ON_DEEP_READ trigger). L2 contains behavioral detail: INTERFACES, DATA_FLOW, TRAPS, DECISIONS, full RULES, domain-specific sections.
25
- 7. Configure UserPromptSubmit hook in platform settings per ${SKILL_DIR}/assets/prizm-docs-format.md.md Section 11.
24
+ 6. Skip L2 docs during init — L2 docs are created after real context exists, not as placeholders. During implementation, if relevant L2 is missing, the implementing skill reads target source files as fallback and proceeds. `/prizmkit-retrospective` creates or updates L2 after the change only when durable structure, behavior, dependencies, interfaces, or TRAPS exist. Explicit `/prizmkit-prizm-docs` repair/rebuild may also create L2 when fixing out-of-band doc drift.
25
+ 7. Configure UserPromptSubmit hook in platform settings per ${SKILL_DIR}/assets/prizm-docs-format.md Section 11.
26
26
  8. Validate all generated docs: size limits (L0 <= 4KB, L1 <= 4KB), pointer resolution (every -> reference resolves), no circular dependencies, KEY: value format compliance, no anti-patterns (prose, code blocks, markdown headers), L1 does not contain INTERFACES/DATA_FLOW/TRAPS/DECISIONS, no CHANGELOG sections/files, no UPDATED/date metadata, no feature/bug/refactor/task/session/run/pipeline/workflow IDs, no branch names, no absolute worktree paths, and no `.prizmkit/specs` / `.prizmkit/dev-pipeline` artifact paths.
27
27
  9. Report summary: modules discovered, L1 docs generated, files excluded, warnings.
28
28
 
@@ -30,16 +30,14 @@ OUTPUT: List of generated files, module count, and validation results.
30
30
 
31
31
  ## Post-Init Behavior
32
32
 
33
- After initialization, L2 docs are created incrementally:
33
+ After initialization, L2 docs are created only when durable context exists:
34
34
 
35
- ON_MODIFY trigger:
36
- - First time AI modifies a file in sub-module S within module M:
37
- IF .prizmkit/prizm-docs/<M>/<S>.prizm does not exist:
38
- AI reads the source files in S, generates L2 doc, then proceeds with modification
39
- - This ensures L2 docs have real depth, written when AI has actual context
35
+ ON_MODIFY behavior:
36
+ - When an AI modifies a file in sub-module S within module M and `.prizmkit/prizm-docs/<M>/<S>.prizm` does not exist, the implementation reads the source files in S as fallback context and proceeds.
37
+ - Do not block implementation only to create a placeholder L2 doc.
38
+ - After the change, run `/prizmkit-retrospective` when structure, interfaces, dependencies, behavior, or durable TRAPS changed; retrospective creates or updates L2 then.
40
39
 
41
- ON_DEEP_READ trigger:
42
- - When AI needs to deeply understand a module but not modify it (e.g., code review, architecture analysis, dependency tracing, explaining complex logic):
43
- IF .prizmkit/prizm-docs/<M>/<S>.prizm does not exist:
44
- AI reads the source files in S, generates L2 doc for future reference
45
- - This ensures L2 docs are available for read-heavy analysis tasks, not just modifications
40
+ ON_DEEP_READ behavior:
41
+ - When an AI needs deep understanding but L2 is absent, read the relevant source files directly as fallback context.
42
+ - Create L2 through `/prizmkit-retrospective` after normal development work, or through explicit `/prizmkit-prizm-docs` repair/rebuild when fixing out-of-band doc drift.
43
+ - Do not create L2 merely because a module was read; L2 should capture durable knowledge, not transient investigation notes.
@@ -100,7 +100,7 @@ Interactive mode options:
100
100
 
101
101
  1. Full project
102
102
  2. Single module
103
- 3. Single feature/spec directory
103
+ 3. Single historical feature/spec directory
104
104
  4. Current change artifact when an artifact directory is available
105
105
 
106
106
  For `scope=this-change`, build the in-scope source set using this priority:
@@ -4,7 +4,7 @@ Use this protocol during `/prizmkit-test` Phase 4 and update it during Phase 5.
4
4
 
5
5
  ## Required Boundary Matrix
6
6
 
7
- Build this matrix before writing tests and update it after generated tests pass or produce `needs-review` findings. In `scope=this-change`, build the matrix only for in-scope feature interfaces/endpoints; unrelated interfaces are recorded under `Out of Scope Gaps` and do not trigger generated tests.
7
+ Build this matrix before writing tests and update it after generated tests pass or produce `needs-review` findings. In `scope=this-change`, build the matrix only for interfaces/endpoints in the reviewed change artifact or changed-file set; unrelated interfaces are recorded under `Out of Scope Gaps` and do not trigger generated tests.
8
8
 
9
9
  | Module | Interface | Service Type | Happy Path | Request Validation | Auth / Permission / Ownership | Domain Invariants | Collection / Pagination | Date / Time | State Transitions | Dependency Failure | Response Contract | N/A Reasons | Final Status |
10
10
  |--------|-----------|--------------|------------|--------------------|-------------------------------|-------------------|-------------------------|-------------|-------------------|-------------------|-------------------|-------------|--------------|
@@ -118,7 +118,7 @@ Do not report `user` as covered just because both endpoints have success tests.
118
118
 
119
119
  **Caller**: `/prizmkit-test scope=this-change artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`
120
120
 
121
- For non-feature changes, use the same command shape with any explicit change artifact directory that contains `spec.md` + `plan.md` and has a changed-files source.
121
+ For non-feature changes, use the same command shape with any explicit change artifact directory that contains `spec.md` + `plan.md` and has a changed-files source. The `{{FEATURE_SLUG}}` path below is a compatibility example for existing feature artifacts; it does not limit `scope=this-change` to feature work.
122
122
 
123
123
  **Expected behavior**:
124
124
  - Reads the change artifact's `spec.md`, `plan.md`, and optional `context-snapshot.md`.
@@ -136,7 +136,7 @@ For non-feature changes, use the same command shape with any explicit change art
136
136
  - Generation Policy: in-scope-only
137
137
 
138
138
  ## Out of Scope Gaps
139
- - payment: missing legacy tests, but this feature did not change payment code.
139
+ - payment: missing legacy tests, but this change did not affect payment code.
140
140
 
141
141
  ## Verdict
142
142
  PASS
@@ -169,7 +169,7 @@ Detect user intent from their message, then follow the corresponding workflow:
169
169
  - No (default) — Use defaults for critic review and failure behavior
170
170
  - Yes — Configure critic review, stop-on-failure, and reasoning effort options
171
171
 
172
- Note: Refactor filter defaults to all refactor items (by priority order). If the user selects "Other" on any option, handle their custom input.
172
+ Note: Refactor filter defaults to all refactor items. Runtime selects eligible refactors in stable list order after dependencies are completed; planners should order unrelated refactors by user priority before launch. If the user selects "Other" on any option, handle their custom input.
173
173
 
174
174
  **If user chose "Yes" to Advanced config**, run the advanced configuration round (a second `AskUserQuestion` round, plus a reasoning-effort follow-up). It applies to a minority of sessions, so the full question set lives in `${SKILL_DIR}/references/configuration.md` → **Advanced Configuration Round**. Default Critic to Off unless refactor items have `priority: "critical"` (in which case default to On).
175
175
 
@@ -225,6 +225,7 @@ Detect user intent from their message, then follow the corresponding workflow:
225
225
  - Summarize results: total refactors, succeeded, failed, skipped
226
226
  - If all succeeded: each refactor session has already run `prizmkit-retrospective` internally. Ask user what's next.
227
227
  - If some failed: show failed refactor IDs and suggest `python3 ./.prizmkit/dev-pipeline/cli.py reset refactor <R-XXX> --clean --run` for a fresh retry
228
+ - **Browser verification**: Refactor sessions with `browser_interaction` perform supplemental UI verification during execution. After completion, use `python3 ./.prizmkit/dev-pipeline/cli.py refactor status .prizmkit/plans/refactor-list.json` and per-refactor session logs as the source of truth before summarizing browser verification results.
228
229
 
229
230
  **If background daemon**:
230
231
  1. Verify launch:
@@ -328,7 +329,7 @@ Read the error-handling table in `${SKILL_DIR}/references/configuration.md` for
328
329
  ### Integration Notes
329
330
 
330
331
  - **After refactor-planner**: This is the natural next step. When user finishes refactor planning and has `.prizmkit/plans/refactor-list.json`, suggest launching the refactor pipeline.
331
- - **Session independence**: The pipeline runs completely detached. User can close the AI CLI session, open a new session later, and use this skill to check progress or stop the pipeline.
332
+ - **Session independence**: Only Background daemon mode runs detached. Foreground runs in the current AI CLI session, and Manual mode prints commands without launching.
332
333
  - **Single instance per family**: Only one refactor pipeline can run at a time. Different pipeline families may coexist because they use separate daemon metadata and state directories.
333
334
  - **Pipeline coexistence**: Refactor pipeline uses `.prizmkit/state/refactor/` separate from `.prizmkit/state/features/` (features) and `.prizmkit/state/bugfix/` (bugs), so all three pipelines can run simultaneously without conflict.
334
335
  - **State preservation**: Stopping and restarting the pipeline resumes from where it left off -- completed refactors are not re-run.
@@ -265,12 +265,12 @@ See `${SKILL_DIR}/references/planning-phases.md` for the full 5-step review chec
265
265
  ```
266
266
  The script fills in defaults (`$schema`, `created_at`, `created_by`), validates all fields, and writes the final file only if validation passes.
267
267
  3. If validation fails -> fix the draft and retry (max 3 attempts)
268
- 4. If validation passes -> 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
268
+ 4. If validation passes -> run the mandatory Local Generated-Plan Review Gate (see §Local Generated-Plan Review Gate below); apply accepted fixes to the draft/source plan, regenerate, and revalidate until pass
269
269
  5. If review and validation pass -> present final summary
270
270
 
271
271
  **CHECKPOINT CP-RP-6**: `.prizmkit/plans/refactor-list.json` generated and validated.
272
272
 
273
- **CHECKPOINT CP-RP-7**: `/prizmkit-code-review` reviewed only newly added/changed refactor entries; accepted fixes were regenerated and revalidated.
273
+ **CHECKPOINT CP-RP-7**: Local generated-plan review loaded `${SKILL_DIR}/references/generated-plan-review.md`, reviewed only newly added/changed refactor entries, applied accepted fixes through draft/source data, regenerated, and revalidated.
274
274
 
275
275
  ## Checkpoints (Mandatory Gates)
276
276
 
@@ -283,32 +283,26 @@ See `${SKILL_DIR}/references/planning-phases.md` for the full 5-step review chec
283
283
  | **CP-RP-4** | Items Confirmed | User confirmed/modified/skipped each item | 5 |
284
284
  | **CP-RP-5** | Completeness OK | DAG valid, preservation strategies declared, no gaps | 6 |
285
285
  | **CP-RP-6** | Output Valid | `.prizmkit/plans/refactor-list.json` passes validation script | 7 |
286
- | **CP-RP-7** | Plan Review Passed | `/prizmkit-code-review` reviewed only newly added/changed refactor entries; accepted fixes were regenerated and revalidated | 7 |
287
-
288
- ## Post-Generation Plan Review Gate
289
-
290
- User requirement preserved verbatim: `每次完成任务规划的时候,应该调用/prizmkit-code-review 对新增的计划内容进行review,确保生成新增的计划的正确行和完整性。`
291
-
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.
293
-
294
- 1. **Identify review scope**: compare the final validated refactor list against the pre-session list when one existed. Review only newly added or changed refactor entries. Do not re-review unchanged historical entries except when needed to verify dependency references or behavior-preservation interactions.
295
- 2. **Invoke `/prizmkit-code-review` as a planning-quality gate** with an explicit prompt that this is a refactor-plan-entry review, not an implementation review. The review must check:
296
- - schema correctness and compatibility with `dev-pipeline-refactor-list-v1`
297
- - dependency/DAG soundness, including safe behavior-preserving order
298
- - description completeness and headless execution readiness
299
- - acceptance criteria specificity and measurable behavior-preservation verification
300
- - `behavior_preservation` strategy quality and target scope consistency
301
- - preservation of user-provided wording in `description`, `acceptance_criteria`, and `user_context`
302
- - task-scoped `user_context` isolation: no unrelated sibling refactor goals, target files, constraints, or supplementary materials, and shared context appears on multiple items only when explicitly global
303
- - priority/complexity calibration: every reviewed refactor has a short priority rationale and complexity rationale, medium/low assignments are allowed when criteria fit, and high/high is not used merely because the work is cleanup, framework-related, multi-file, or user-requested
304
- 3. **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.
305
- 4. **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:
286
+ | **CP-RP-7** | Local Plan Review Passed | Local generated-plan review loaded `${SKILL_DIR}/references/generated-plan-review.md`, reviewed only newly added/changed refactor entries, applied accepted fixes through draft/source data, regenerated, and revalidated | 7 |
287
+
288
+ ## Local Generated-Plan Review Gate
289
+
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
+
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:
306
300
  ```bash
307
301
  python3 ${SKILL_DIR}/scripts/validate-and-generate-refactor.py generate --input .prizmkit/plans/refactor-list.draft.json --output .prizmkit/plans/refactor-list.json
308
302
  ```
309
303
  Do not hand-patch the final JSON as the source of truth; map final-output findings back to draft entries before regeneration.
310
- 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.
311
- 6. **Report the gate outcome** in the final summary: include `/prizmkit-code-review` verdict, reviewed refactor IDs, accepted fixes (or "none"), and final validation result.
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.
312
306
 
313
307
  ## Output Rules
314
308
 
@@ -444,10 +438,10 @@ Prevent accidental session exit without deliverable completion.
444
438
 
445
439
  ## Handoff Message Template
446
440
 
447
- After successful validation and the Post-Generation Plan Review Gate, report:
441
+ After successful validation and the Local Generated-Plan Review Gate, report:
448
442
  1. Output file path
449
443
  2. Total refactor items
450
444
  3. Dependency ordering highlights (which items must run first)
451
445
  4. Behavior preservation strategy distribution (N items with test-gate, M with snapshot, etc.)
452
- 5. Review result: `/prizmkit-code-review` verdict, reviewed refactor IDs, accepted fixes (or "none"), and final validation result
446
+ 5. Local generated-plan review result: verdict, reviewed refactor IDs, accepted fixes (or "none"), and final validation result
453
447
  6. Recommended next action: `refactor-pipeline-launcher`
@@ -34,7 +34,7 @@ For simple refactoring with minimal scope.
34
34
  ```bash
35
35
  python3 ${SKILL_DIR}/scripts/validate-and-generate-refactor.py generate --input .prizmkit/plans/refactor-list.draft.json --output .prizmkit/plans/refactor-list.json
36
36
  ```
37
- 5. If valid -> run the mandatory Post-Generation Plan Review Gate from the main `refactor-planner` skill before summarizing or recommending `refactor-pipeline-launcher`.
37
+ 5. If valid -> run the mandatory Local Generated-Plan Review Gate from the main `refactor-planner` skill before summarizing or recommending `refactor-pipeline-launcher`.
38
38
  6. If invalid -> apply fixes to the draft, re-run generate (max 2 attempts, then escalate to full workflow)
39
39
 
40
40
  ## When NOT to Use Fast Path
@@ -53,6 +53,6 @@ AI: [Uses AskUserQuestion with options: "Fast-path", "Full workflow"]
53
53
  User: [Selects "Fast-path"]
54
54
  AI: "Drafting R-001..."
55
55
  AI: [Validates immediately]
56
- AI: [Runs the Post-Generation Plan Review Gate on R-001 only]
56
+ AI: [Runs the Local Generated-Plan Review Gate on R-001 only]
57
57
  AI: "Ready to proceed to dev-pipeline."
58
58
  ```
@@ -0,0 +1,63 @@
1
+ # Generated Plan Review — Refactor Planner
2
+
3
+ Use this local review loop after `.prizmkit/plans/refactor-list.json` has been generated and validated. This is a planner-output review, not an implementation/code-diff review.
4
+
5
+ ## Trigger
6
+
7
+ Run only when the current `refactor-planner` 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.`
8
+
9
+ ## Direct Artifact Reads
10
+
11
+ Planning artifacts may be gitignored, untracked, or absent from staged and unstaged diffs. Read the actual files directly:
12
+
13
+ - Final list: `.prizmkit/plans/refactor-list.json`
14
+ - Draft/source list when present: `.prizmkit/plans/refactor-list.draft.json`
15
+ - Pre-session final list snapshot if captured in memory before edits
16
+ - In-memory draft object if the session has not written a draft file yet
17
+
18
+ Do not rely on `git status`, `git diff`, or `git diff --cached` to decide whether planner output exists or changed. Do not invoke `/prizmkit-code-review` for this planner-output gate; `/prizmkit-code-review` remains the implementation/code-diff review gate after `/prizmkit-implement`.
19
+
20
+ ## Review Scope
21
+
22
+ 1. If a pre-session final list exists, compare by stable refactor IDs (`R-*`).
23
+ 2. Treat refactors as changed only when item fields changed. Ignore root generator metadata and formatting-only differences such as `$schema`, `created_at`, and `created_by`.
24
+ 3. Review newly added refactor IDs and changed refactor IDs.
25
+ 4. Preserve unchanged historical refactors. Read unchanged entries only when needed to verify dependency references or behavior-preservation interactions with reviewed refactors.
26
+ 5. If no snapshot exists, review all refactor entries produced by the current generation flow.
27
+
28
+ ## Review Checklist
29
+
30
+ For every reviewed refactor entry, check:
31
+
32
+ - Schema compatibility with `dev-pipeline-refactor-list-v1` and `.prizmkit/dev-pipeline/templates/refactor-list-schema.json`
33
+ - Dependency/DAG soundness, including safe behavior-preserving order
34
+ - Description completeness, target scope clarity, and headless execution readiness
35
+ - Acceptance criteria specificity and measurable behavior-preservation verification
36
+ - `behavior_preservation` strategy quality and consistency with target scope and existing tests
37
+ - User-provided wording preservation in `description`, `acceptance_criteria`, and `user_context`
38
+ - Task-scoped `user_context` isolation: no unrelated sibling refactor goals, target files, constraints, desired end states, or supplementary materials; shared context appears on multiple items only when explicitly global
39
+ - Priority/complexity calibration: every reviewed refactor has short priority and complexity rationales, medium/low assignments are allowed when criteria fit, and high/high is not used merely because the work is cleanup, framework-related, multi-file, or user-requested
40
+
41
+ ## Fix Loop
42
+
43
+ 1. Present findings with IDs, severity, evidence, and suggested draft/source changes.
44
+ 2. Accept only findings that improve planner correctness, completeness, or downstream behavior-preserving execution readiness.
45
+ 3. Apply accepted fixes to `.prizmkit/plans/refactor-list.draft.json` or the in-memory draft object first.
46
+ 4. Regenerate the final list through the existing generator:
47
+
48
+ ```bash
49
+ python3 ${SKILL_DIR}/scripts/validate-and-generate-refactor.py generate --input .prizmkit/plans/refactor-list.draft.json --output .prizmkit/plans/refactor-list.json
50
+ ```
51
+
52
+ 5. Re-run validation/generation until valid. Do not hand-patch `.prizmkit/plans/refactor-list.json` as the source of truth.
53
+ 6. Repeat the local review only for entries changed by accepted fixes.
54
+
55
+ ## Report Format
56
+
57
+ Report in the final handoff summary:
58
+
59
+ - `Local generated-plan review: PASS` or `NEEDS_FIXES`
60
+ - Reviewed refactor IDs
61
+ - Accepted fixes, or `none`
62
+ - Final validation result
63
+ - Note when review was not applicable because no new final planning content was written
@@ -172,10 +172,11 @@ Use Fast Path only after explicit user selection.
172
172
  1. Invoke `/prizmkit-plan` with the handoff brief and behavior-preservation expectations.
173
173
  2. Invoke `/prizmkit-implement` after the plan is ready.
174
174
  3. Run behavior-preservation checks identified in the plan.
175
- 4. Run `/prizmkit-code-review` as the quality and behavior-preservation gate.
176
- 5. Run `/prizmkit-retrospective` before commit because refactors often change durable structure.
177
- 6. Run `/prizmkit-committer` with a `refactor(<scope>):` message.
178
- 7. End the workflow after commit; do not call `refactor-planner`, `refactor-pipeline-launcher`, or monitoring.
175
+ 4. Run `/prizmkit-test` only when risk triggers match: public contracts, data models, migration behavior, weak behavior-preservation evidence, or explicit user verification request.
176
+ 5. Run `/prizmkit-code-review` when the user requested review, behavior-preservation uncertainty is high, or Full-path-level risk appears during implementation.
177
+ 6. Run `/prizmkit-retrospective` only when structure, interfaces, dependencies, behavior, or durable project knowledge changed.
178
+ 7. Run `/prizmkit-committer` with a `refactor(<scope>):` message.
179
+ 8. End the workflow after commit; do not call `refactor-planner`, `refactor-pipeline-launcher`, or monitoring.
179
180
 
180
181
  If the refactor starts changing behavior or grows beyond Fast Path criteria, pause and ask whether to switch to `feature-workflow` or Pipeline Path.
181
182
 
@@ -241,5 +242,5 @@ For start/stop/logs/retry execution, hand off to `refactor-pipeline-launcher`; d
241
242
 
242
243
  ## Output
243
244
 
244
- - Fast Path: `spec.md`, `plan.md`, behavior-preserving code changes, behavior-check evidence, review result, Prizm docs sync, and one refactor commit.
245
+ - Fast Path: `spec.md`, `plan.md`, behavior-preserving code changes, behavior-check evidence, conditional test/review evidence when triggered, Prizm docs sync only when durable knowledge changed, and one refactor commit.
245
246
  - Pipeline Path: handoff brief, validated `.prizmkit/plans/refactor-list.json` from `refactor-planner`, and pipeline launch/status handled by `refactor-pipeline-launcher`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prizmkit",
3
- "version": "1.1.112",
3
+ "version": "1.1.114",
4
4
  "description": "Create a new PrizmKit-powered project with clean initialization — no framework dev files, just what you need.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/clean.js CHANGED
@@ -3,6 +3,19 @@ import path from 'path';
3
3
  import fs from 'fs-extra';
4
4
  import { loadMetadata, loadRulesMetadata } from './metadata.js';
5
5
  import { readManifest } from './manifest.js';
6
+ import { privateProjectMemoryFile, projectMemoryFile } from './platforms.js';
7
+
8
+ const PRIZMKIT_GITIGNORE_HEADERS = new Set([
9
+ '# PrizmKit',
10
+ '# PrizmKit 运行时全部产物(state/、prizm-docs/、.env、logs 等)',
11
+ ]);
12
+ const PRIZMKIT_GITIGNORE_ENTRIES = new Set([
13
+ '.prizmkit/',
14
+ '.prizmkit/*',
15
+ 'CLAUDE.private.md',
16
+ 'AGENTS.private.md',
17
+ 'CODEBUDDY.private.md',
18
+ ]);
6
19
 
7
20
  async function removePath(targetPath, dryRun) {
8
21
  if (!await fs.pathExists(targetPath)) {
@@ -54,11 +67,14 @@ async function cleanGitignore(projectRoot, dryRun) {
54
67
  }
55
68
 
56
69
  const content = await fs.readFile(gitignorePath, 'utf8');
57
- const next = content
58
- .replace(/\n\n# PrizmKit\n\.prizmkit\/\n?/g, '\n')
59
- .replace(/\n# PrizmKit\n\.prizmkit\/\n?/g, '\n');
60
-
61
- if (next === content) {
70
+ const nextLines = content.split(/\r?\n/).filter(line => {
71
+ const trimmed = line.trim();
72
+ return !PRIZMKIT_GITIGNORE_HEADERS.has(trimmed)
73
+ && !PRIZMKIT_GITIGNORE_ENTRIES.has(trimmed);
74
+ });
75
+ const next = nextLines.join('\n').replace(/\n{3,}/g, '\n\n').trimEnd();
76
+
77
+ if (`${next}\n` === content || next === content.trimEnd()) {
62
78
  return { updated: false, reason: 'no_prizmkit_section' };
63
79
  }
64
80
 
@@ -66,7 +82,7 @@ async function cleanGitignore(projectRoot, dryRun) {
66
82
  return { updated: true, reason: 'dry_run' };
67
83
  }
68
84
 
69
- await fs.writeFile(gitignorePath, next.trimEnd() + '\n');
85
+ await fs.writeFile(gitignorePath, next ? `${next}\n` : '');
70
86
  return { updated: true };
71
87
  }
72
88
 
@@ -100,6 +116,38 @@ async function cleanMarkedProjectMemory(projectRoot, fileName, dryRun) {
100
116
  return { path: filePath, removed: true, note: '(PrizmKit section)' };
101
117
  }
102
118
 
119
+ async function cleanProjectMemoryImport(projectRoot, fileName, privateFileName, dryRun) {
120
+ const filePath = path.join(projectRoot, fileName);
121
+ if (!await fs.pathExists(filePath)) {
122
+ return { path: filePath, removed: false, reason: 'not_found' };
123
+ }
124
+
125
+ const importPointer = `@./${privateFileName}`;
126
+ const content = await fs.readFile(filePath, 'utf8');
127
+ const next = content
128
+ .split(/\r?\n/)
129
+ .filter(line => line.trim() !== importPointer)
130
+ .join('\n')
131
+ .replace(/\n{3,}/g, '\n\n')
132
+ .trimEnd();
133
+
134
+ if (next === content.trimEnd()) {
135
+ return { path: filePath, removed: false, reason: 'no_prizmkit_import' };
136
+ }
137
+
138
+ if (dryRun) {
139
+ return { path: filePath, removed: false, reason: 'dry_run' };
140
+ }
141
+
142
+ if (!next) {
143
+ await fs.remove(filePath);
144
+ return { path: filePath, removed: true, note: '(PrizmKit import only)' };
145
+ }
146
+
147
+ await fs.writeFile(filePath, `${next}\n`);
148
+ return { path: filePath, removed: true, note: '(PrizmKit import)' };
149
+ }
150
+
103
151
  async function removeGeneratedCodexConfig(projectRoot, dryRun) {
104
152
  const configPath = path.join(projectRoot, '.codex', 'config.toml');
105
153
  if (!await fs.pathExists(configPath)) {
@@ -228,7 +276,12 @@ export async function runClean(directory, options = {}) {
228
276
  const legacyCodexRulesDir = path.join(projectRoot, '.codex', 'rules');
229
277
  results.push(...await removeKnownEntries(legacyCodexRulesDir, ruleFileNames.map(n => `${n}.md`), dryRun));
230
278
 
231
- for (const memoryFile of ['CODEBUDDY.md', 'CLAUDE.md', 'AGENTS.md']) {
279
+ for (const platform of ['codebuddy', 'claude', 'codex']) {
280
+ const memoryFile = projectMemoryFile(platform);
281
+ const privateMemoryFile = privateProjectMemoryFile(platform);
282
+ if (!memoryFile || !privateMemoryFile) continue;
283
+ results.push(await cleanProjectMemoryImport(projectRoot, memoryFile, privateMemoryFile, dryRun));
284
+ results.push(await cleanMarkedProjectMemory(projectRoot, privateMemoryFile, dryRun));
232
285
  results.push(await cleanMarkedProjectMemory(projectRoot, memoryFile, dryRun));
233
286
  }
234
287
 
package/src/config.js CHANGED
@@ -38,6 +38,7 @@ import {
38
38
  resolveRuleNamesForRuntime,
39
39
  findStaleManagedPipelineFiles,
40
40
  removeStaleManagedPipelineFiles,
41
+ normalizeMainProjectMemoryContent,
41
42
  } from './scaffold.js';
42
43
  import {
43
44
  removeSkillFiles,
@@ -54,7 +55,7 @@ import {
54
55
  confirmTeamMode,
55
56
  confirmPipeline,
56
57
  } from './prompts.js';
57
- import { isKnownPlatform, platformLabel, projectMemoryFile, resolvePayloadPlatforms } from './platforms.js';
58
+ import { isKnownPlatform, platformLabel, privateProjectMemoryFile, privateProjectMemoryFiles, projectMemoryFile, resolvePayloadPlatforms } from './platforms.js';
58
59
  import { normalizeRuntime, runtimeLabel } from './runtimes.js';
59
60
  import { applyAiCliLaunchToConfig, resolveAiCliLaunchSelection, storedAiCliLaunch } from './ai-cli-launch.js';
60
61
 
@@ -114,6 +115,50 @@ function getProjectMemoryFile(platform) {
114
115
  return projectMemoryFile(platform);
115
116
  }
116
117
 
118
+ function logManagedMemoryWarnings(mainFile, warnings) {
119
+ for (const warning of warnings) {
120
+ console.log(chalk.yellow(` ⚠ ${mainFile}: ${warning}; preserving unmatched marker content`));
121
+ }
122
+ }
123
+
124
+ async function removeProjectMemoryArtifacts(platform, projectRoot, dryRun) {
125
+ const mainFile = projectMemoryFile(platform);
126
+ const privateFile = privateProjectMemoryFile(platform);
127
+ if (!mainFile || !privateFile) return;
128
+
129
+ const privatePath = path.join(projectRoot, privateFile);
130
+ if (await fs.pathExists(privatePath)) {
131
+ if (dryRun) {
132
+ console.log(chalk.gray(` [dry-run] remove ${privateFile}`));
133
+ } else {
134
+ await fs.remove(privatePath);
135
+ console.log(chalk.red(` ✗ removed ${privateFile}`));
136
+ }
137
+ }
138
+
139
+ const mainPath = path.join(projectRoot, mainFile);
140
+ if (!await fs.pathExists(mainPath)) return;
141
+
142
+ const current = await fs.readFile(mainPath, 'utf-8');
143
+ const normalized = normalizeMainProjectMemoryContent(current, privateFile);
144
+ logManagedMemoryWarnings(mainFile, normalized.warnings);
145
+ const next = normalized.content.trim();
146
+ if (next === current.trim()) return;
147
+
148
+ if (dryRun) {
149
+ console.log(chalk.gray(` [dry-run] update ${mainFile} (remove PrizmKit import)`));
150
+ return;
151
+ }
152
+
153
+ if (!next) {
154
+ await fs.remove(mainPath);
155
+ console.log(chalk.red(` ✗ removed ${mainFile} (empty after PrizmKit import removal)`));
156
+ } else {
157
+ await fs.writeFile(mainPath, `${next}\n`, 'utf-8');
158
+ console.log(chalk.green(` ✓ updated ${mainFile} (removed PrizmKit import)`));
159
+ }
160
+ }
161
+
117
162
  async function migrateProjectMemoryOnPlatformDrop(droppedPlatform, newPlatforms, projectRoot, dryRun) {
118
163
  const sourceFile = getProjectMemoryFile(droppedPlatform);
119
164
  if (!sourceFile) return;
@@ -135,8 +180,13 @@ async function migrateProjectMemoryOnPlatformDrop(droppedPlatform, newPlatforms,
135
180
  return;
136
181
  }
137
182
 
138
- const sourceContent = await fs.readFile(sourcePath, 'utf-8');
139
- if (!sourceContent.trim()) return;
183
+ const normalized = normalizeMainProjectMemoryContent(
184
+ await fs.readFile(sourcePath, 'utf-8'),
185
+ privateProjectMemoryFile(droppedPlatform),
186
+ );
187
+ logManagedMemoryWarnings(sourceFile, normalized.warnings);
188
+ const sourceContent = normalized.content.trim();
189
+ if (!sourceContent) return;
140
190
 
141
191
  if (!await fs.pathExists(targetPath)) {
142
192
  const normalized = sourceContent.endsWith('\n') ? sourceContent : `${sourceContent}\n`;
@@ -244,18 +294,8 @@ async function removePlatformFiles(platform, projectRoot, manifest, dryRun) {
244
294
  }
245
295
  }
246
296
 
247
- // Project memory file
248
- const memoryFile = projectMemoryFile(platform);
249
- if (!memoryFile) return;
250
- const memoryPath = path.join(projectRoot, memoryFile);
251
- if (await fs.pathExists(memoryPath)) {
252
- if (dryRun) {
253
- console.log(chalk.gray(` [dry-run] remove ${memoryFile}`));
254
- } else {
255
- await fs.remove(memoryPath);
256
- console.log(chalk.red(` ✗ removed ${memoryFile}`));
257
- }
258
- }
297
+ // Project memory artifacts: remove only managed private file/imports, not user-owned main content.
298
+ await removeProjectMemoryArtifacts(platform, projectRoot, dryRun);
259
299
 
260
300
  // Command assets (Claude only)
261
301
  if (platform === 'claude') {
@@ -611,10 +651,8 @@ export async function runConfig(directory, options = {}) {
611
651
  console.log(chalk.blue('\n Settings & Rules:'));
612
652
  await installSettings(p, projectRoot, { pipeline: newConfig.pipeline, rules: newConfig.rules }, false, newConfig.runtime);
613
653
 
614
- if (isNew) {
615
- console.log(chalk.blue('\n Project Memory:'));
616
- await installProjectMemory(p, projectRoot, false);
617
- }
654
+ console.log(chalk.blue('\n Project Memory:'));
655
+ await installProjectMemory(p, projectRoot, false);
618
656
 
619
657
  if (newConfig.team) {
620
658
  console.log(chalk.blue('\n Team Config:'));
@@ -648,7 +686,10 @@ export async function runConfig(directory, options = {}) {
648
686
 
649
687
  // 5f. Update .gitignore
650
688
  console.log(chalk.blue('\n Gitignore:'));
651
- await installGitignore(projectRoot, { pipeline: newConfig.pipeline }, false);
689
+ await installGitignore(projectRoot, {
690
+ pipeline: newConfig.pipeline,
691
+ privateMemoryFiles: privateProjectMemoryFiles(newPlatforms),
692
+ }, false);
652
693
 
653
694
  // 5g. Runtime-aware git hook and PrizmKit helper scripts
654
695
  if (newConfig.runtime !== currentConfig.runtime || runtimeManifestNeedsNormalization || runtimeOptionNeedsNormalization) {
@@ -9,11 +9,14 @@
9
9
  * @returns {string}
10
10
  */
11
11
  export function generateGitignore(options = {}) {
12
- void options;
12
+ const privateMemoryFiles = Array.isArray(options.privateMemoryFiles)
13
+ ? options.privateMemoryFiles.filter(Boolean)
14
+ : [];
13
15
  const lines = [
14
- '# PrizmKit 运行时全部产物(state/、prizm-docs/、.env、logs 等)',
16
+ '# PrizmKit',
15
17
  '.prizmkit/*',
18
+ ...privateMemoryFiles,
16
19
  ];
17
20
 
18
- return lines.join('\n');
21
+ return [...new Set(lines)].join('\n');
19
22
  }
package/src/manifest.js CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  import fs from 'fs-extra';
11
11
  import path from 'path';
12
- import { projectMemoryFile, resolvePayloadPlatforms } from './platforms.js';
12
+ import { privateProjectMemoryFile, projectMemoryFile, resolvePayloadPlatforms } from './platforms.js';
13
13
  import { normalizeRuntime } from './runtimes.js';
14
14
 
15
15
  const MANIFEST_FILE = 'manifest.json';
@@ -100,7 +100,11 @@ export function buildManifest({
100
100
  pipeline: pipeline ? [...pipeline] : [],
101
101
  extras: extras ? [...extras] : [],
102
102
  payloadPlatforms: installedPayloadPlatforms,
103
- other: [...new Set(installedPayloadPlatforms.map(projectMemoryFile).filter(Boolean))],
103
+ memory: {
104
+ main: [...new Set(installedPayloadPlatforms.map(projectMemoryFile).filter(Boolean))],
105
+ private: [...new Set(installedPayloadPlatforms.map(privateProjectMemoryFile).filter(Boolean))],
106
+ },
107
+ other: [...new Set(installedPayloadPlatforms.map(privateProjectMemoryFile).filter(Boolean))],
104
108
  },
105
109
  };
106
110
  }
package/src/platforms.js CHANGED
@@ -62,6 +62,20 @@ export function projectMemoryFile(platform) {
62
62
  return null;
63
63
  }
64
64
 
65
+ export function privateProjectMemoryFile(platform) {
66
+ const mainFile = projectMemoryFile(platform);
67
+ if (!mainFile) return null;
68
+ return mainFile.replace(/\.md$/i, '.private.md');
69
+ }
70
+
71
+ export function projectMemoryFiles(platform) {
72
+ return [projectMemoryFile(platform), privateProjectMemoryFile(platform)].filter(Boolean);
73
+ }
74
+
75
+ export function privateProjectMemoryFiles(platforms) {
76
+ return [...new Set((platforms || []).map(privateProjectMemoryFile).filter(Boolean))];
77
+ }
78
+
65
79
  export function defaultCliForPlatform(platform) {
66
80
  if (platform === 'claude') return 'claude';
67
81
  if (platform === 'codebuddy') return 'cbc';