prizmkit 1.1.154 → 1.1.156

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 (164) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/codex/skill-adapter.js +1 -1
  3. package/bundled/adapters/pi/skill-adapter.js +2 -1
  4. package/bundled/dev-pipeline/.env.example +2 -6
  5. package/bundled/dev-pipeline/README.md +21 -27
  6. package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +341 -15
  7. package/bundled/dev-pipeline/prizmkit_runtime/cli.py +0 -3
  8. package/bundled/dev-pipeline/prizmkit_runtime/daemon.py +1 -15
  9. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +48 -14
  10. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +50 -2
  11. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +0 -9
  12. package/bundled/dev-pipeline/prizmkit_runtime/runner_prompts.py +3 -3
  13. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +120 -22
  14. package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +482 -0
  15. package/bundled/dev-pipeline/prizmkit_runtime/test_result.py +64 -11
  16. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +145 -367
  17. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +91 -62
  18. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +105 -69
  19. package/bundled/dev-pipeline/scripts/prompt_framework.py +36 -41
  20. package/bundled/dev-pipeline/scripts/update-bug-status.py +1 -4
  21. package/bundled/dev-pipeline/scripts/update-checkpoint.py +61 -13
  22. package/bundled/dev-pipeline/scripts/update-feature-status.py +1 -4
  23. package/bundled/dev-pipeline/scripts/update-refactor-status.py +1 -4
  24. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +22 -27
  25. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +71 -104
  26. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +59 -111
  27. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +37 -72
  28. package/bundled/dev-pipeline/templates/sections/artifact-manifest.md +39 -0
  29. package/bundled/dev-pipeline/templates/sections/bugfix-critical-paths.md +3 -1
  30. package/bundled/dev-pipeline/templates/sections/bugfix-phase-commit-report.md +8 -25
  31. package/bundled/dev-pipeline/templates/sections/bugfix-phase-diagnose-plan.md +3 -3
  32. package/bundled/dev-pipeline/templates/sections/bugfix-phase-implement.md +2 -2
  33. package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +3 -3
  34. package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +2 -2
  35. package/bundled/dev-pipeline/templates/sections/bugfix-reminders.md +4 -4
  36. package/bundled/dev-pipeline/templates/sections/bugfix-session-context.md +0 -1
  37. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +7 -4
  38. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +14 -27
  39. package/bundled/dev-pipeline/templates/sections/feature-completion-summary.md +20 -0
  40. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +8 -71
  41. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +7 -7
  42. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +3 -3
  43. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +4 -4
  44. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +5 -17
  45. package/bundled/dev-pipeline/templates/sections/refactor-critical-paths.md +3 -1
  46. package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +10 -23
  47. package/bundled/dev-pipeline/templates/sections/refactor-phase-implement.md +2 -2
  48. package/bundled/dev-pipeline/templates/sections/refactor-phase-plan.md +2 -2
  49. package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +3 -3
  50. package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +2 -2
  51. package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +7 -7
  52. package/bundled/dev-pipeline/templates/sections/refactor-session-context.md +0 -1
  53. package/bundled/dev-pipeline/templates/sections/retrospective.md +12 -0
  54. package/bundled/dev-pipeline/templates/sections/runtime-commit-handoff.md +35 -0
  55. package/bundled/dev-pipeline/templates/session-status-schema.json +45 -62
  56. package/bundled/dev-pipeline/tests/test_checkpoint_state.py +469 -18
  57. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +262 -175
  58. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +62 -23
  59. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +76 -28
  60. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +168 -18
  61. package/bundled/dev-pipeline/tests/test_recovery_workflow.py +111 -0
  62. package/bundled/dev-pipeline/tests/test_reset_preserve.py +0 -2
  63. package/bundled/dev-pipeline/tests/test_runtime_commit.py +608 -0
  64. package/bundled/dev-pipeline/tests/test_unified_cli.py +167 -25
  65. package/bundled/skills/_metadata.json +9 -9
  66. package/bundled/skills/app-planner/SKILL.md +3 -3
  67. package/bundled/skills/app-planner/references/generated-plan-review.md +2 -1
  68. package/bundled/skills/app-planner/references/rules/backend/derivation-rules.md +56 -64
  69. package/bundled/skills/app-planner/references/rules/backend/fixed-rules.md +85 -240
  70. package/bundled/skills/app-planner/references/rules/backend/question-bank.md +25 -25
  71. package/bundled/skills/app-planner/references/rules/backend/question-manifest.json +16 -7
  72. package/bundled/skills/app-planner/references/rules/backend/template.md +74 -92
  73. package/bundled/skills/app-planner/references/rules/database/derivation-rules.md +93 -93
  74. package/bundled/skills/app-planner/references/rules/database/fixed-rules.md +66 -173
  75. package/bundled/skills/app-planner/references/rules/database/question-bank.md +31 -26
  76. package/bundled/skills/app-planner/references/rules/database/question-manifest.json +13 -4
  77. package/bundled/skills/app-planner/references/rules/database/template.md +76 -98
  78. package/bundled/skills/app-planner/references/rules/frontend/derivation-rules.md +68 -95
  79. package/bundled/skills/app-planner/references/rules/frontend/fixed-rules.md +93 -166
  80. package/bundled/skills/app-planner/references/rules/frontend/question-bank.md +46 -36
  81. package/bundled/skills/app-planner/references/rules/frontend/question-manifest.json +11 -2
  82. package/bundled/skills/app-planner/references/rules/frontend/template.md +79 -257
  83. package/bundled/skills/app-planner/references/rules/mobile/derivation-rules.md +91 -99
  84. package/bundled/skills/app-planner/references/rules/mobile/fixed-rules.md +73 -246
  85. package/bundled/skills/app-planner/references/rules/mobile/question-bank.md +17 -17
  86. package/bundled/skills/app-planner/references/rules/mobile/question-manifest.json +17 -2
  87. package/bundled/skills/app-planner/references/rules/mobile/template.md +73 -85
  88. package/bundled/skills/app-planner/references/rules-configuration.md +133 -65
  89. package/bundled/skills/app-planner/scripts/validate-rules-configuration.py +291 -0
  90. package/bundled/skills/prizmkit/SKILL.md +17 -18
  91. package/bundled/skills/prizmkit/references/workflow-state-protocol.md +22 -18
  92. package/bundled/skills/prizmkit-code-review/SKILL.md +22 -58
  93. package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +6 -6
  94. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +2 -2
  95. package/bundled/skills/prizmkit-committer/SKILL.md +82 -132
  96. package/bundled/skills/prizmkit-deploy/SKILL.md +27 -11
  97. package/bundled/skills/prizmkit-deploy/assets/deploy-document-template.md +89 -0
  98. package/bundled/skills/prizmkit-deploy/references/ci-cd-workflows.md +44 -14
  99. package/bundled/skills/prizmkit-deploy/references/cloud-platform-deploy.md +19 -3
  100. package/bundled/skills/prizmkit-deploy/references/database-setup.md +22 -12
  101. package/bundled/skills/prizmkit-deploy/references/deploy-config-schema.md +3 -1
  102. package/bundled/skills/prizmkit-deploy/references/deploy-history-schema.md +22 -6
  103. package/bundled/skills/prizmkit-deploy/references/deploy-metadata-schema.json +49 -0
  104. package/bundled/skills/prizmkit-deploy/references/live-validation-notes.md +1 -1
  105. package/bundled/skills/prizmkit-deploy/references/pending-input-schema.json +164 -0
  106. package/bundled/skills/prizmkit-deploy/references/ssh-adapter-flow.md +9 -8
  107. package/bundled/skills/prizmkit-deploy/references/ssh-execution-flow.md +6 -6
  108. package/bundled/skills/prizmkit-implement/SKILL.md +30 -66
  109. package/bundled/skills/prizmkit-implement/references/implementation-subagent-procedure.md +4 -4
  110. package/bundled/skills/prizmkit-init/SKILL.md +4 -0
  111. package/bundled/skills/prizmkit-plan/SKILL.md +21 -64
  112. package/bundled/skills/prizmkit-plan/references/artifact-identity.md +38 -0
  113. package/bundled/skills/prizmkit-plan/references/independent-plan-review.md +4 -4
  114. package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +5 -5
  115. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +75 -11
  116. package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +191 -56
  117. package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +18 -18
  118. package/bundled/skills/prizmkit-prizm-docs/references/op-rebuild.md +14 -8
  119. package/bundled/skills/prizmkit-prizm-docs/references/op-status.md +12 -5
  120. package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +23 -12
  121. package/bundled/skills/prizmkit-prizm-docs/references/op-validate.md +13 -9
  122. package/bundled/skills/prizmkit-retrospective/SKILL.md +94 -97
  123. package/bundled/skills/prizmkit-retrospective/references/knowledge-injection-steps.md +79 -37
  124. package/bundled/skills/prizmkit-retrospective/references/retrospective-result-schema.json +138 -0
  125. package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +111 -54
  126. package/bundled/skills/prizmkit-test/SKILL.md +64 -51
  127. package/bundled/skills/prizmkit-test/references/boundary-contract-and-test-double-guidance.md +206 -0
  128. package/bundled/skills/prizmkit-test/references/independent-test-review.md +17 -9
  129. package/bundled/skills/prizmkit-test/references/test-coverage-model.md +45 -21
  130. package/bundled/skills/prizmkit-test/references/test-report-template.md +20 -13
  131. package/bundled/skills/prizmkit-workflow/SKILL.md +35 -37
  132. package/bundled/skills/prizmkit-workflow/references/artifact-identity.md +34 -0
  133. package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +22 -18
  134. package/bundled/skills/recovery-workflow/SKILL.md +2 -1
  135. package/bundled/skills/recovery-workflow/references/detection.md +4 -3
  136. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +15 -5
  137. package/bundled/templates/hooks/validate-prizm-docs.py +124 -12
  138. package/package.json +1 -1
  139. package/src/scaffold.js +33 -22
  140. package/bundled/dev-pipeline/templates/sections/bugfix-artifacts.md +0 -16
  141. package/bundled/dev-pipeline/templates/sections/bugfix-session-status.md +0 -31
  142. package/bundled/dev-pipeline/templates/sections/critical-paths-agent.md +0 -7
  143. package/bundled/dev-pipeline/templates/sections/critical-paths-lite.md +0 -7
  144. package/bundled/dev-pipeline/templates/sections/directory-convention-agent.md +0 -9
  145. package/bundled/dev-pipeline/templates/sections/directory-convention-lite.md +0 -6
  146. package/bundled/dev-pipeline/templates/sections/headless-commit-authorization.md +0 -15
  147. package/bundled/dev-pipeline/templates/sections/phase-commit.md +0 -61
  148. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +0 -24
  149. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-lite-suffix.md +0 -12
  150. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +0 -44
  151. package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +0 -25
  152. package/bundled/dev-pipeline/templates/sections/phase-plan-agent.md +0 -20
  153. package/bundled/dev-pipeline/templates/sections/phase-plan-lite.md +0 -20
  154. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +0 -20
  155. package/bundled/dev-pipeline/templates/sections/refactor-artifacts.md +0 -17
  156. package/bundled/dev-pipeline/templates/sections/refactor-session-status.md +0 -28
  157. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-agent.md +0 -52
  158. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-lite.md +0 -52
  159. package/bundled/skills/prizmkit-code-review/references/workflow-state-protocol.md +0 -174
  160. package/bundled/skills/prizmkit-committer/references/workflow-state-protocol.md +0 -174
  161. package/bundled/skills/prizmkit-implement/references/workflow-state-protocol.md +0 -174
  162. package/bundled/skills/prizmkit-plan/references/workflow-state-protocol.md +0 -174
  163. package/bundled/skills/prizmkit-retrospective/references/workflow-state-protocol.md +0 -174
  164. package/bundled/skills/prizmkit-test/references/external-contract-mock-guidance.md +0 -119
@@ -29,8 +29,8 @@ Do not create worktrees, copied repositories, remote checkouts, or branch switch
29
29
  1. Read `context-snapshot.md` first when it exists.
30
30
  2. Use Section 3 for relevant Prizm rules/traps and Section 4 File Manifest for file summaries.
31
31
  3. Do not re-read files already summarized in the File Manifest unless a specific implementation detail is missing.
32
- 4. If no context snapshot exists, read `.prizmkit/prizm-docs/root.prizm`, relevant L1/L2 docs, then targeted source files.
33
- 5. If a relevant L2 doc is missing, use source fallback and note that retrospective may create or update docs later.
32
+ 4. If no context snapshot exists, read `.prizmkit/prizm-docs/root.prizm`, follow only relevant module/detail pointers, then read targeted source files.
33
+ 5. If relevant detail documentation is missing, use source fallback and note the missing context without creating documentation.
34
34
 
35
35
  ## Implementation Rules
36
36
 
@@ -41,7 +41,7 @@ Do not create worktrees, copied repositories, remote checkouts, or branch switch
41
41
  - Do not execute git `add`, `commit`, `reset`, `push`, branch checkout, rebase, merge, or stash operations.
42
42
  - Do not spawn further agents.
43
43
  - Do not perform broad repository rediscovery. Read only delegated files and targeted dependencies needed for correctness.
44
- - Do not write PrizmKit feature/bug/refactor/task/session/run IDs, pipeline IDs, workflow IDs, branch names, absolute worktree paths, or `.prizmkit/specs` / `.prizmkit/dev-pipeline` artifact paths into `.prizmkit/prizm-docs/`, user-visible UI text, API responses, emails, notifications, or expected product-copy tests.
44
+ - Do not write internal execution IDs, branch names, absolute worktree paths, or runtime artifact paths into `.prizmkit/prizm-docs/`, user-visible UI text, API responses, emails, notifications, or expected product-copy tests.
45
45
  - If creating a new sub-module, note the durable facts needed for retrospective; do not overwrite existing `.prizmkit/prizm-docs/` files in full.
46
46
 
47
47
  ## Output Format
@@ -61,7 +61,7 @@ Report exactly:
61
61
  - command/check: result
62
62
 
63
63
  ### Notes for Main Agent
64
- - durable decisions, missing L2 docs, or blockers
64
+ - durable decisions, missing detail documentation, or blockers
65
65
  ```
66
66
 
67
67
  For `WRONG_CHECKOUT`, include only the checkout mismatch evidence and do not include normal implementation findings.
@@ -23,6 +23,10 @@ Recommended project initialization skill. Scans any brownfield or greenfield pro
23
23
  - If artifacts already exist: idempotent status check offers regenerate/skip choices (see Phase 3: Idempotent Status Check)
24
24
  - If no source files found in any directory: fall back to greenfield mode
25
25
 
26
+ ### Artifact Ownership
27
+
28
+ All paths under `.prizmkit/` are framework-internal and remain outside automated task commits. Initialization must not stage or commit them. Root instruction or platform-support files written during setup also remain support data rather than task-owned source.
29
+
26
30
  ## Execution Steps
27
31
 
28
32
  **Phase 1: Platform Detection**
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: "prizmkit-plan"
3
- description: "Start the formal PrizmKit requirement lifecycle by turning a natural-language change into spec.md and plan.md artifacts, running mandatory Main-Agent planning review plus optional capability-gated independent correctness review, initializing workflow state, and handing off to prizmkit-implement. Works for features, bug fixes, refactors, migrations, tests, and other formal requirements. (project)"
3
+ description: "Create and review spec.md and plan.md artifacts for one supplied software requirement. Covers features, bug fixes, refactors, migrations, tests, and other scoped changes; returns PLAN_READY or PLAN_BLOCKED. (project)"
4
4
  ---
5
5
 
6
6
  # PrizmKit Plan
7
7
 
8
- `/prizmkit-plan` is the entry point for one formal requirement. It converts a natural-language change into a reviewed change artifact: `spec.md` defines WHAT and WHY; `plan.md` defines HOW and executable tasks.
8
+ `/prizmkit-plan` converts one caller-supplied natural-language change into a reviewed change artifact: `spec.md` defines WHAT and WHY; `plan.md` defines HOW and executable tasks.
9
9
 
10
10
  A change artifact can describe a feature, bug fix, refactor, migration, test improvement, or another scoped requirement.
11
11
 
@@ -19,47 +19,34 @@ A change artifact can describe a feature, bug fix, refactor, migration, test imp
19
19
  ## When NOT to Use
20
20
 
21
21
  - Direct edit: typo, pure formatting, small documentation edit, or another explicitly low-risk non-requirement change.
22
- - The active artifact directory already has an adequate reviewed `spec.md` and `plan.md`; resume from the workflow state instead.
23
-
24
- ## Formal Lifecycle
25
-
26
- A successful plan starts this fixed lifecycle:
27
-
28
- ```text
29
- plan → implement → code-review → test → retrospective → committer
30
- ```
31
-
32
- Planning depth may be concise or comprehensive, but no later formal lifecycle stage may be silently skipped.
22
+ - The supplied artifact directory already has an adequate reviewed `spec.md` and `plan.md`; return the existing stage result instead of regenerating them.
33
23
 
34
24
  ## Input
35
25
 
36
26
  | Parameter | Required | Description |
37
27
  |---|---|---|
38
28
  | `description` | Yes | Natural-language description of the requirement. |
39
- | `artifact_dir` | No | Directory for the change artifact. If omitted, create a numbered slug under `.prizmkit/specs/`. |
29
+ | `artifact_dir` | No | Exact caller-supplied directory for the change artifact. If omitted, create a deterministic numbered directory under `.prizmkit/specs/` using `${SKILL_DIR}/references/artifact-identity.md`. |
40
30
 
41
31
  ## Atomic Stage Boundary
42
32
 
43
- `prizmkit-plan` owns only specification, plan, task generation, and planning-quality review. It writes its truthful terminal result and `next_stage`, then returns control. It must not invoke `prizmkit-implement` itself, including when an external orchestrator is active. The active orchestrator owns the next-stage invocation.
33
+ `prizmkit-plan` owns specification, plan, task generation, and planning-quality review for one supplied requirement. Its terminal outputs are `PLAN_READY` or `PLAN_BLOCKED`; it stops after producing that result.
44
34
 
45
35
  ## Phase 0: Initialization Check and Context
46
36
 
47
37
  1. Check whether project context such as `.prizmkit/prizm-docs/root.prizm`, `.prizmkit/config.json`, or a project brief exists.
48
- 2. If initialization context is missing:
49
- - recommend `/prizmkit-init` and explain that it improves project context and cross-session continuity;
50
- - do not block planning;
51
- - if the user continues, load the README, manifests, project instruction files, source structure, and relevant source files as fallback.
52
- 3. If Prizm docs exist, read `root.prizm`, relevant L1 docs, relevant L2 docs when present, and source fallback when L2 is absent.
53
- 4. Resolve `artifact_dir` once and reuse it for every later lifecycle handoff. Do not re-detect another artifact during the same requirement.
38
+ 2. If initialization context is missing, do not block planning; load the README, manifests, project instruction files, source structure, and relevant source files as fallback.
39
+ 3. If Prizm docs exist, read `root.prizm`, follow only its relevant module/detail pointers, and use source fallback when detailed documentation is absent.
40
+ 4. Read `${SKILL_DIR}/references/artifact-identity.md`, validate or generate `artifact_dir` exactly once, and keep it stable throughout this planning invocation.
54
41
 
55
42
  ## Phase 1: Specify (`spec.md`)
56
43
 
57
44
  Skip regeneration when `spec.md` already exists and still matches the requested requirement.
58
45
 
59
46
  1. Gather the requirement description. If it is missing in an interactive run, ask the user; otherwise return a clear blocked result.
60
- 2. Determine the artifact directory:
61
- - use the caller-provided `artifact_dir` when present;
62
- - otherwise scan `.prizmkit/specs/` for existing numbered directories and create `.prizmkit/specs/###-task-slug/`.
47
+ 2. Determine the artifact directory through `${SKILL_DIR}/references/artifact-identity.md`:
48
+ - validate and preserve the exact caller-provided `artifact_dir` when present;
49
+ - otherwise derive the normalized title slug, allocate the next collision-safe number, and create `.prizmkit/specs/<number>-<slug>/`.
63
50
  3. Generate `spec.md` from `${SKILL_DIR}/assets/spec-template.md`:
64
51
  - focus on WHAT and WHY, not HOW;
65
52
  - include only relevant sections;
@@ -86,7 +73,7 @@ Precondition: `spec.md` exists with no unresolved blocker.
86
73
  - component and file changes;
87
74
  - data migration approach when relevant;
88
75
  - interface/API contract design when relevant;
89
- - test strategy for the mandatory `/prizmkit-test` stage;
76
+ - project-native test strategy appropriate to the requirement;
90
77
  - risks and mitigations;
91
78
  - behavior-preservation strategy for refactors.
92
79
  5. Cross-check every spec goal against the plan.
@@ -98,7 +85,7 @@ Precondition: `spec.md` exists with no unresolved blocker.
98
85
  2. Append `## Tasks` to `plan.md` using `${SKILL_DIR}/assets/plan-template.md`.
99
86
  3. Include setup, foundation, core, polish, and checkpoint tasks only when applicable.
100
87
  4. Mark `[P]` only for tasks that can safely execute independently.
101
- 5. Include implementation-local verification where useful, while preserving the later full code-review and test stages.
88
+ 5. Include appropriate implementation-local and regression verification tasks without executing them during planning.
102
89
  6. Run `${SKILL_DIR}/references/verification-checklist.md` and repair plan defects.
103
90
 
104
91
  ## Phase 4: Plan/Spec Review Loop
@@ -113,7 +100,7 @@ Run every time `spec.md` or `plan.md` is created or changed. This is the mandato
113
100
  6. If a `BLOCKER` remains, ask targeted questions in interactive mode; otherwise record `PLAN_BLOCKED` and stop.
114
101
  7. Continue only when no unresolved blocker remains.
115
102
 
116
- The planning review must not implement code, run the full test stage, or launch external orchestration.
103
+ The planning review must not modify product/source code or execute the planned verification strategy.
117
104
 
118
105
  ## Phase 5: Independent Plan Review
119
106
 
@@ -127,47 +114,17 @@ Run only after the Main-Agent Plan/Spec review converges. This optional check ne
127
114
  6. If neither compliant continuation nor replacement is available after modification, record downgrade and rerun the Main-Agent local Plan/Spec review over that modification as specified by the reference.
128
115
  7. If the final allowed response causes a modification, run targeted verification, record that the final state was not independently rechecked, and do not exceed the response budget.
129
116
  8. Append the terminal `## Independent Plan Review` record. Appending that audit record does not trigger another response.
130
- 9. Any unresolved correction produces `PLAN_BLOCKED`; otherwise independent convergence or strict downgrade may continue to handoff from the valid completed Main-Agent review.
131
-
132
- ## Phase 6: Workflow State and Handoff
133
-
134
- Read `${SKILL_DIR}/references/workflow-state-protocol.md` and create or update:
135
-
136
- ```text
137
- .prizmkit/state/workflows/<requirement-slug>.json
138
- ```
139
-
140
- Follow the bundled protocol. At minimum record:
141
-
142
- ```json
143
- {
144
- "schema_version": 1,
145
- "artifact_dir": ".prizmkit/specs/001-example",
146
- "stage": "plan",
147
- "status": "completed",
148
- "stage_result": "PLAN_READY",
149
- "completed_stages": ["plan"],
150
- "repair_round": 0,
151
- "repair_scope": null,
152
- "next_stage": "implement",
153
- "resume_from": "prizmkit-implement"
154
- }
155
- ```
156
-
157
- The state file is runtime metadata. Do not change the target project's Git or ignore policy.
117
+ 9. Any unresolved correction produces `PLAN_BLOCKED`; otherwise independent convergence or strict downgrade produces `PLAN_READY`.
158
118
 
159
119
  ## Output
160
120
 
161
- - `spec.md` and `plan.md` in the resolved artifact directory.
162
- - Workflow state with `PLAN_READY` or a truthful blocked result.
163
- - Planning depth, key decisions, task count, and checkpoint summary.
164
- - The same `artifact_dir` for every downstream stage.
165
-
166
- ## Handoff
121
+ Return only planning-stage outputs:
167
122
 
168
- On `PLAN_READY`:
123
+ - the resolved `artifact_dir`;
124
+ - `spec.md` and `plan.md` paths;
125
+ - planning depth, key decisions, and task count;
126
+ - `PLAN_READY` when artifacts pass planning review, otherwise `PLAN_BLOCKED` with unresolved planning blockers.
169
127
 
170
- 1. If workflow state names an active `orchestrator`, return `PLAN_READY`, `stage_result=PLAN_READY`, `next_stage=implement`, the state path, and the same `artifact_dir` to that orchestrator; do not invoke the next stage independently.
171
- 2. For direct stage use with no active orchestrator, report exactly one deterministic next action: `/prizmkit-implement`, with `stage_result=PLAN_READY`, the state-file path, and `artifact_dir`; a host may perform that semantic handoff on the user's behalf.
128
+ Return only the listed planning outputs. Do not invoke another Skill.
172
129
 
173
130
  Read `${SKILL_DIR}/references/examples.md` only when a worked planning example is needed.
@@ -0,0 +1,38 @@
1
+ # Planning Artifact Identity
2
+
3
+ Use one stable, project-relative artifact directory for the entire planning invocation.
4
+
5
+ ## Generated Directory
6
+
7
+ When the caller does not provide `artifact_dir`:
8
+
9
+ 1. Inspect only direct child directories of `.prizmkit/specs/` whose basenames match `<number>-<slug>`, where `<number>` is at least three decimal digits.
10
+ 2. Choose one greater than the highest valid number, starting at `001`, and zero-pad to at least three digits. Numbers above `999` retain all digits.
11
+ 3. Derive `<slug>` from the concise requirement title:
12
+ - normalize text with Unicode NFKC and lowercase where the script has a lowercase form;
13
+ - retain Unicode letters and decimal digits;
14
+ - replace every run of other characters with one ASCII hyphen;
15
+ - trim leading/trailing hyphens;
16
+ - truncate without splitting a Unicode code point until the slug is at most 64 code points and the complete `<number>-<slug>` basename is at most 200 UTF-8 bytes, then trim a trailing hyphen;
17
+ - use `requirement` if no letter or digit remains.
18
+ 4. Create `.prizmkit/specs/<number>-<slug>/` without overwriting an existing path. If it appeared concurrently, rescan and retry with the next number; after three collisions, return `PLAN_BLOCKED`.
19
+
20
+ Examples:
21
+
22
+ ```text
23
+ .prizmkit/specs/001-user-login/
24
+ .prizmkit/specs/070-skill-generated-artifact-contracts/
25
+ .prizmkit/specs/1000-支付回调/
26
+ ```
27
+
28
+ ## Caller-Supplied Directory
29
+
30
+ An explicit `artifact_dir` is preserved exactly; never slugify or relocate it. Before writing:
31
+
32
+ - require a project-relative path that resolves inside the active checkout;
33
+ - reject `.`/`..` components, control characters, symlink escape, and an empty basename;
34
+ - require a basename of 1-96 Unicode code points and at most 200 UTF-8 bytes, containing only letters, decimal digits, ASCII hyphens, or ASCII underscores, with a letter or digit at both ends;
35
+ - if existing `spec.md` or `plan.md` belongs to a different requirement, return `PLAN_BLOCKED` rather than overwrite it;
36
+ - if the directory already contains the same requirement, reuse it and preserve its identity.
37
+
38
+ The directory basename is the requirement identity exposed to callers. `spec.md` and `plan.md` are the only planning filenames in that directory.
@@ -54,7 +54,7 @@ spec_path: [EXACT_SPEC_PATH]
54
54
  plan_path: [EXACT_PLAN_PATH]
55
55
  ```
56
56
 
57
- The paths come from the current workflow state or explicit handoff even when ignored by Git. Never ask the Reviewer to discover a latest artifact or guess among multiple `spec.md` and `plan.md` files.
57
+ The caller supplies these exact paths as planning-stage input even when ignored by Git. Never ask the Reviewer to discover a latest artifact or guess among multiple `spec.md` and `plan.md` files.
58
58
 
59
59
  The Plan Reviewer receives only:
60
60
 
@@ -90,7 +90,7 @@ Execution boundaries:
90
90
  - Complete this review personally.
91
91
  - Do not create, schedule, resume, continue, request, or coordinate another execution unit.
92
92
  - Do not ask the Main Agent to create a helper.
93
- - Do not re-enter orchestration, delegation, another review workflow, or an equivalent process.
93
+ - Do not re-enter delegation or another review process.
94
94
  - Do not modify, create, delete, rename, stage, commit, or otherwise mutate files.
95
95
  - Do not execute shell, Git, tests, builds, network calls, external processes, or any operation that can change state.
96
96
  - Read only the supplied planning input at the exact paths and contents identified above.
@@ -133,7 +133,7 @@ All initial execution boundaries and the Reviewer Output Protocol remain mandato
133
133
 
134
134
  ## Reviewer Output Protocol
135
135
 
136
- Return exactly one of these forms. Do not add severity, confidence, dimension, workflow impact, or acceptance fields.
136
+ Return exactly one of these forms. Do not add severity, confidence, dimension, caller-routing impact, or acceptance fields.
137
137
 
138
138
  ### No Correction Needed
139
139
 
@@ -181,7 +181,7 @@ Every correction contains only `Target`, `Problem`, `Evidence`, and `Correction`
181
181
  No review verdict was produced.
182
182
  ```
183
183
 
184
- `REVIEW_BLOCKED` is an internal independent-review result, not a lifecycle result.
184
+ `REVIEW_BLOCKED` is an internal independent-review result, not the planning-stage result.
185
185
 
186
186
  ## Main-Agent Adjudication
187
187
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Purpose
4
4
 
5
- Run this local planning-quality gate after `spec.md` and `plan.md` are drafted or updated, before handing off to `/prizmkit-implement`.
5
+ Run this local planning-quality gate after `spec.md` and `plan.md` are drafted or updated, before returning `PLAN_READY`.
6
6
 
7
7
  This is not a separate skill and it does not use a Critic agent. It is the mandatory Main-Agent baseline executed inside `prizmkit-plan` to improve the planning artifacts only. Its maximum of two local rounds remains independent of the optional Reviewer described in `independent-plan-review.md`.
8
8
 
@@ -12,7 +12,7 @@ Do not do any of the following from this guide:
12
12
 
13
13
  - Start implementation or edit product/source code.
14
14
  - Run tests, builds, lint, or package commands.
15
- - Launch a feature, bugfix, or refactor pipeline.
15
+ - Start implementation or any other execution process.
16
16
  - Spawn or require a Critic agent inside this Main-Agent loop. The separate optional independent review is considered only after this loop converges and only through `independent-plan-review.md`.
17
17
  - Create a separate review-loop skill.
18
18
  - Expand scope beyond improving `spec.md` and `plan.md`.
@@ -75,7 +75,7 @@ Examples:
75
75
  - Alternative task grouping with no correctness impact.
76
76
  - A lower-risk cleanup suggestion outside current scope.
77
77
 
78
- Optional findings do not block handoff.
78
+ Optional findings do not block planning completion.
79
79
 
80
80
  ## Loop Algorithm
81
81
 
@@ -92,10 +92,10 @@ Optional findings do not block handoff.
92
92
 
93
93
  ## Output Summary
94
94
 
95
- At handoff, include a short summary:
95
+ At completion, include a short summary:
96
96
 
97
97
  - Review rounds run: `1` or `2`.
98
98
  - Fixes applied to `spec.md`: short list or `none`.
99
99
  - Fixes applied to `plan.md`: short list or `none`.
100
100
  - Optional findings deferred: short list or `none`.
101
- - Unresolved blockers: `none` before handoff.
101
+ - Unresolved blockers: `none` before `PLAN_READY`.
@@ -34,6 +34,54 @@ Do not route ordinary development-loop "update docs" or "sync docs" here. In nor
34
34
 
35
35
  Key principle: `/prizmkit-prizm-docs` defines and repairs the documentation system. `/prizmkit-retrospective` keeps docs in sync during ordinary development.
36
36
 
37
+ ## Governing Content Gates
38
+
39
+ These gates apply uniformly wherever this Skill generates, migrates, repairs, or rebuilds documentation. Operation references may add sequencing but must not weaken them.
40
+
41
+ ### Value Gate
42
+
43
+ Before retaining any candidate fact, ask exactly:
44
+
45
+ > Could a future AI that lacks this fact make an incorrect modification?
46
+
47
+ Retain the fact only when the answer is yes and the fact is current, durable, non-obvious, and stated at the lowest owning level. High-value knowledge includes:
48
+
49
+ - non-obvious public interfaces and wire contracts
50
+ - cross-module constraints and non-obvious dependencies
51
+ - traps and side effects that can cause an incorrect change
52
+ - durable decisions with only the rationale necessary to preserve the choice
53
+ - rejected alternatives that future sessions are likely to propose again, with the reason for rejection
54
+ - security, data-integrity, concurrency, transaction, and compatibility rules
55
+
56
+ Reject source-derivable structure or signatures, task/change history, test inventories, temporary conclusions, stale statements, duplicate meanings, long procedures, low-value file lists, and facts already owned by a child detail document. File names, counts, and summaries remain only when needed for navigation or ownership.
57
+
58
+ Critical-knowledge rule: a still-valid public or wire contract, cross-module constraint, non-obvious dependency, critical trap, durable decision, side effect, or safety/integrity rule must survive cleanup and capacity remediation. Never delete it merely to satisfy a byte check.
59
+
60
+ ### Cleanup Gate
61
+
62
+ Before Update or Rebuild writes an existing target:
63
+
64
+ 1. Read the target and its resolving parent/child pointers first.
65
+ 2. Build a protected set of still-valid critical knowledge under the Value Gate.
66
+ 3. Match facts by semantic meaning, not wording; update an equivalent entry in place and merge synonymous entries.
67
+ 4. Remove stale, duplicate, parent-copied, source-derivable, and otherwise low-value material.
68
+ 5. Add only genuinely new durable knowledge that has no equivalent entry.
69
+ 6. Keep L0 and L1 as concise structural summaries and pointers; do not copy L2 interfaces, data flow, traps, decisions, or full rules into a parent.
70
+
71
+ Append-only synchronization is prohibited. If protected knowledge cannot fit after safe cleanup, movement to the owning child, or an unambiguous semantic split, report the blocker instead of deleting knowledge.
72
+
73
+ ### Capacity and Sharding Invariants
74
+
75
+ Use the canonical capacity classifier: exact raw UTF-8 bytes; L0 `root.prizm` limit 4096B; direct-child L1 limit 4096B; nested L2 limit 5120B. Bands are normal below 80%, warning from 80% to below 90%, strong warning from 90% through 100%, and error above 100%.
76
+
77
+ - Natural content below 80% stays unchanged; do not pad it.
78
+ - Warning-range content remains valid and is reported without failure.
79
+ - A generated or rewritten target at 90% or above requires cleanup, movement, or a safe split. After automatic remediation, measure every affected parent and child: each must be within its hard limit and the operation targets 3277–3686B for L0/L1 or 4096–4607B for L2 (80% to below 90%), not one byte below the hard limit. A naturally concise result below 80% stays unpadded.
80
+ - Any target still above its hard limit blocks completion. A warning must never downgrade another format or hard-limit error.
81
+ - When L0 navigation cannot fit, use `MODULE_GROUPS`; never raise limits for project size.
82
+ - When one L2 cannot safely retain a flat module's multiple stable behavior concerns, use the semantic L2 policy in the format specification. Preserve mirrored L2 paths for real source submodules.
83
+ - Do not add a memory state machine, scoring system, project-size override, task-named or numbered shard, or a fourth documentation level.
84
+
37
85
  ### When to Use
38
86
  - First-time project documentation setup
39
87
  - Checking whether docs are fresh or valid
@@ -52,7 +100,7 @@ Bootstrap `.prizmkit/prizm-docs/` for the current project.
52
100
 
53
101
  Precondition: no `.prizmkit/prizm-docs/` directory exists, or user confirms overwrite.
54
102
 
55
- Read `${SKILL_DIR}/references/op-init.md` for detailed steps.
103
+ Read `${SKILL_DIR}/references/op-init.md` for detailed steps. Apply the Value Gate before retaining every generated fact.
56
104
 
57
105
  ## Operation: Update
58
106
 
@@ -70,7 +118,7 @@ Use Update only when docs drifted outside the normal development loop, such as:
70
118
 
71
119
  During normal feature/bugfix/refactor work, do not use Update; use `/prizmkit-retrospective` to avoid duplicate writers and conflicting edits.
72
120
 
73
- Read `${SKILL_DIR}/references/op-update.md` for detailed steps.
121
+ Read `${SKILL_DIR}/references/op-update.md` for detailed steps. Apply both the Value Gate and target-first Cleanup Gate to every written target.
74
122
 
75
123
  ## Operation: Status
76
124
 
@@ -86,7 +134,7 @@ Regenerate docs for a specific module from scratch.
86
134
 
87
135
  Precondition: `.prizmkit/prizm-docs/` exists and module path is valid.
88
136
 
89
- Read `${SKILL_DIR}/references/op-rebuild.md` for detailed steps.
137
+ Read `${SKILL_DIR}/references/op-rebuild.md` for detailed steps. Rebuild from current source analysis without delete-first loss: preserve the target-first inventory, then apply both governing gates.
90
138
 
91
139
  ## Operation: Validate
92
140
 
@@ -104,24 +152,40 @@ Precondition: existing `docs/`, `docs/AI_CONTEXT/`, README, or architecture docs
104
152
 
105
153
  Steps:
106
154
  1. Discover existing docs: `docs/`, `docs/AI_CONTEXT/`, `README.md`, `ARCHITECTURE.md`, and structured documentation files.
107
- 2. Extract project metadata, module descriptions, architecture patterns, rules, decisions, and dependencies.
108
- 3. Map project-wide info to L0, module structure to L1, and behavioral details to L2.
109
- 4. Convert prose to KEY: value format and strip markdown tables, diagrams, and decorative formatting.
110
- 5. Generate `.prizmkit/prizm-docs/` using init structure seeded with extracted information.
111
- 6. Validate migrated docs against format rules and size limits.
112
- 7. Report files processed, generated `.prizm` files, and manual review items.
155
+ 2. Treat every extracted statement as a candidate, verify it against current source, and apply the Value Gate. Do not migrate source-derivable structure, task/history material, test inventories, temporary conclusions, stale statements, duplicate meanings, long procedures, or low-value file lists.
156
+ 3. Map project-wide summaries and pointers to L0, module structure and pointers to L1, and retained behavioral knowledge to L2. When a child L2 owns complete knowledge, keep only a concise parent summary and resolving pointer.
157
+ 4. Preserve source-mirrored L2 paths for real submodules. For a flat module that needs multiple stable behavior concerns to retain required knowledge within 5120B, apply the deterministic semantic-detail identity, ownership, `DETAILS` pointer, and ambiguity-blocking contract in the format specification.
158
+ 5. Convert retained content to KEY: value format and strip markdown tables, diagrams, decorative formatting, and procedural prose. Merge semantically equivalent source statements before writing.
159
+ 6. Generate `.prizmkit/prizm-docs/` using the Init structure seeded only with retained content; use `MODULE_GROUPS` when the L0 map cannot fit within 4096B.
160
+ 7. Run the canonical capacity classifier. Warning-only results remain successful; remediate strong-warning/error generated targets toward 3277–3686B for L0/L1 or 4096–4607B for L2 without deleting protected knowledge. An unresolved hard-limit, ambiguous or unstable concern identity, ownership problem, or slug collision is blocking; never resolve it with a task-named or numbered shard.
161
+ 8. Validate format, required semantic L2 fields, source-file ownership, pointer resolution, hierarchy, capacity, and critical-knowledge preservation.
162
+ 9. Report files processed, generated `.prizm` files, omitted low-value categories, capacity results, and manual decisions required.
163
+
164
+ ## Recovery Backup Contract
165
+
166
+ Before replacing a corrupted `root.prizm`, copy its exact bytes outside the managed documentation tree:
167
+
168
+ ```text
169
+ .prizmkit/backups/prizm-docs/root.prizm.bak
170
+ ```
171
+
172
+ If that path exists, use the lowest available suffix `.001`, `.002`, and so on, for example `root.prizm.bak.001`. Never overwrite an earlier backup, never place backup files under `.prizmkit/prizm-docs/`, and never normalize or partially parse the backup content. Report the backup path before rebuilding. Backups are recovery copies, not Prizm documents or sources of durable knowledge.
113
173
 
114
174
  ## Error Handling
115
175
 
116
- - `root.prizm` corrupted or invalid: back it up, then rebuild affected docs from source.
176
+ - `root.prizm` corrupted or invalid: create the byte-for-byte recovery backup above, then rebuild affected docs from source.
117
177
  - Broken pointers: create the missing `.prizm` file if the source module exists; remove the pointer if the source module was deleted.
118
- - Size limit exceeded: consolidate L0, move L1 implementation detail to L2, trim L2 derived detail.
178
+ - Capacity warning or strong warning: report the exact classifier fields and clean/organize only when required by the governing capacity policy; automatic remediation targets 80% to below 90%.
179
+ - Size limit exceeded: fail validation until Value/Cleanup filtering, deduplication, movement to the owning child, or an unambiguous semantic split brings the target within its hard limit; never delete protected knowledge or raise the limit.
119
180
  - No git history: fall back to filesystem timestamps for freshness checks and warn that accuracy is reduced.
120
181
 
121
182
  ## Key Protocols
122
183
 
123
184
  For detailed protocol specifications, read `assets/prizm-docs-format.md`:
124
185
 
186
+ - Value and Cleanup Gates: Sections 1 and 7
187
+ - Semantic L2 identity and ownership: Sections 3.2, 3.3, and 5
188
+ - Capacity classification and remediation: Sections 2.1 and 7
125
189
  - Progressive Loading: Section 6.1
126
190
  - Update/repair protocol: Section 7
127
191
  - RULES hierarchy: Section 3.1