prizmkit 1.1.153 → 1.1.155

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 (178) 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 +120 -113
  6. package/bundled/dev-pipeline/assets/skill-subagent-integration.md +1 -1
  7. package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +355 -15
  8. package/bundled/dev-pipeline/prizmkit_runtime/cli.py +189 -110
  9. package/bundled/dev-pipeline/prizmkit_runtime/commands.py +146 -111
  10. package/bundled/dev-pipeline/prizmkit_runtime/daemon.py +4 -20
  11. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +48 -14
  12. package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +0 -1
  13. package/bundled/dev-pipeline/prizmkit_runtime/paths.py +0 -3
  14. package/bundled/dev-pipeline/prizmkit_runtime/reset.py +122 -15
  15. package/bundled/dev-pipeline/prizmkit_runtime/reset_preserve.py +1 -1
  16. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +50 -2
  17. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +1 -10
  18. package/bundled/dev-pipeline/prizmkit_runtime/runner_prompts.py +3 -3
  19. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +139 -74
  20. package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +482 -0
  21. package/bundled/dev-pipeline/prizmkit_runtime/status.py +106 -1
  22. package/bundled/dev-pipeline/prizmkit_runtime/test_result.py +64 -11
  23. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +145 -367
  24. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +91 -62
  25. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +105 -69
  26. package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +2 -2
  27. package/bundled/dev-pipeline/scripts/prompt_framework.py +36 -41
  28. package/bundled/dev-pipeline/scripts/update-bug-status.py +197 -71
  29. package/bundled/dev-pipeline/scripts/update-checkpoint.py +77 -16
  30. package/bundled/dev-pipeline/scripts/update-feature-status.py +46 -121
  31. package/bundled/dev-pipeline/scripts/update-refactor-status.py +46 -123
  32. package/bundled/dev-pipeline/scripts/utils.py +119 -0
  33. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +22 -27
  34. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +71 -104
  35. package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +3 -2
  36. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +59 -111
  37. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +37 -72
  38. package/bundled/dev-pipeline/templates/sections/artifact-manifest.md +39 -0
  39. package/bundled/dev-pipeline/templates/sections/bugfix-critical-paths.md +3 -1
  40. package/bundled/dev-pipeline/templates/sections/bugfix-phase-commit-report.md +8 -25
  41. package/bundled/dev-pipeline/templates/sections/bugfix-phase-diagnose-plan.md +3 -3
  42. package/bundled/dev-pipeline/templates/sections/bugfix-phase-implement.md +2 -2
  43. package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +3 -3
  44. package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +2 -2
  45. package/bundled/dev-pipeline/templates/sections/bugfix-reminders.md +4 -4
  46. package/bundled/dev-pipeline/templates/sections/bugfix-session-context.md +0 -1
  47. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +7 -4
  48. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +14 -27
  49. package/bundled/dev-pipeline/templates/sections/feature-completion-summary.md +20 -0
  50. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +8 -71
  51. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +7 -7
  52. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +3 -3
  53. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +4 -4
  54. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +5 -17
  55. package/bundled/dev-pipeline/templates/sections/refactor-critical-paths.md +3 -1
  56. package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +10 -23
  57. package/bundled/dev-pipeline/templates/sections/refactor-phase-implement.md +2 -2
  58. package/bundled/dev-pipeline/templates/sections/refactor-phase-plan.md +2 -2
  59. package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +3 -3
  60. package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +2 -2
  61. package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +7 -7
  62. package/bundled/dev-pipeline/templates/sections/refactor-session-context.md +0 -1
  63. package/bundled/dev-pipeline/templates/sections/retrospective.md +12 -0
  64. package/bundled/dev-pipeline/templates/sections/runtime-commit-handoff.md +35 -0
  65. package/bundled/dev-pipeline/templates/session-status-schema.json +45 -62
  66. package/bundled/dev-pipeline/tests/test_auto_skip.py +111 -32
  67. package/bundled/dev-pipeline/tests/test_checkpoint_state.py +617 -30
  68. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +262 -194
  69. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +62 -23
  70. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +76 -28
  71. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +281 -206
  72. package/bundled/dev-pipeline/tests/test_recovery_workflow.py +322 -0
  73. package/bundled/dev-pipeline/tests/test_reset_modes.py +935 -0
  74. package/bundled/dev-pipeline/tests/test_reset_preserve.py +5 -7
  75. package/bundled/dev-pipeline/tests/test_runtime_commit.py +608 -0
  76. package/bundled/dev-pipeline/tests/test_unified_cli.py +617 -188
  77. package/bundled/skills/_metadata.json +9 -9
  78. package/bundled/skills/app-planner/SKILL.md +3 -3
  79. package/bundled/skills/app-planner/references/generated-plan-review.md +2 -1
  80. package/bundled/skills/app-planner/references/rules/backend/derivation-rules.md +56 -64
  81. package/bundled/skills/app-planner/references/rules/backend/fixed-rules.md +85 -240
  82. package/bundled/skills/app-planner/references/rules/backend/question-bank.md +25 -25
  83. package/bundled/skills/app-planner/references/rules/backend/question-manifest.json +16 -7
  84. package/bundled/skills/app-planner/references/rules/backend/template.md +74 -92
  85. package/bundled/skills/app-planner/references/rules/database/derivation-rules.md +93 -93
  86. package/bundled/skills/app-planner/references/rules/database/fixed-rules.md +66 -173
  87. package/bundled/skills/app-planner/references/rules/database/question-bank.md +31 -26
  88. package/bundled/skills/app-planner/references/rules/database/question-manifest.json +13 -4
  89. package/bundled/skills/app-planner/references/rules/database/template.md +76 -98
  90. package/bundled/skills/app-planner/references/rules/frontend/derivation-rules.md +68 -95
  91. package/bundled/skills/app-planner/references/rules/frontend/fixed-rules.md +93 -166
  92. package/bundled/skills/app-planner/references/rules/frontend/question-bank.md +46 -36
  93. package/bundled/skills/app-planner/references/rules/frontend/question-manifest.json +11 -2
  94. package/bundled/skills/app-planner/references/rules/frontend/template.md +79 -257
  95. package/bundled/skills/app-planner/references/rules/mobile/derivation-rules.md +91 -99
  96. package/bundled/skills/app-planner/references/rules/mobile/fixed-rules.md +73 -246
  97. package/bundled/skills/app-planner/references/rules/mobile/question-bank.md +17 -17
  98. package/bundled/skills/app-planner/references/rules/mobile/question-manifest.json +17 -2
  99. package/bundled/skills/app-planner/references/rules/mobile/template.md +73 -85
  100. package/bundled/skills/app-planner/references/rules-configuration.md +133 -65
  101. package/bundled/skills/app-planner/scripts/validate-rules-configuration.py +291 -0
  102. package/bundled/skills/bug-planner/references/schema-validation.md +1 -1
  103. package/bundled/skills/bug-planner/scripts/validate-bug-list.py +1 -1
  104. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +21 -13
  105. package/bundled/skills/feature-pipeline-launcher/SKILL.md +22 -14
  106. package/bundled/skills/prizmkit/SKILL.md +17 -18
  107. package/bundled/skills/prizmkit/references/workflow-state-protocol.md +22 -18
  108. package/bundled/skills/prizmkit-code-review/SKILL.md +22 -58
  109. package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +6 -6
  110. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +2 -2
  111. package/bundled/skills/prizmkit-committer/SKILL.md +82 -132
  112. package/bundled/skills/prizmkit-deploy/SKILL.md +27 -11
  113. package/bundled/skills/prizmkit-deploy/assets/deploy-document-template.md +89 -0
  114. package/bundled/skills/prizmkit-deploy/references/ci-cd-workflows.md +44 -14
  115. package/bundled/skills/prizmkit-deploy/references/cloud-platform-deploy.md +19 -3
  116. package/bundled/skills/prizmkit-deploy/references/database-setup.md +22 -12
  117. package/bundled/skills/prizmkit-deploy/references/deploy-config-schema.md +3 -1
  118. package/bundled/skills/prizmkit-deploy/references/deploy-history-schema.md +22 -6
  119. package/bundled/skills/prizmkit-deploy/references/deploy-metadata-schema.json +49 -0
  120. package/bundled/skills/prizmkit-deploy/references/live-validation-notes.md +1 -1
  121. package/bundled/skills/prizmkit-deploy/references/pending-input-schema.json +164 -0
  122. package/bundled/skills/prizmkit-deploy/references/ssh-adapter-flow.md +9 -8
  123. package/bundled/skills/prizmkit-deploy/references/ssh-execution-flow.md +6 -6
  124. package/bundled/skills/prizmkit-implement/SKILL.md +30 -66
  125. package/bundled/skills/prizmkit-implement/references/implementation-subagent-procedure.md +4 -4
  126. package/bundled/skills/prizmkit-init/SKILL.md +4 -0
  127. package/bundled/skills/prizmkit-plan/SKILL.md +21 -64
  128. package/bundled/skills/prizmkit-plan/references/artifact-identity.md +38 -0
  129. package/bundled/skills/prizmkit-plan/references/independent-plan-review.md +4 -4
  130. package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +5 -5
  131. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +11 -1
  132. package/bundled/skills/prizmkit-retrospective/SKILL.md +63 -77
  133. package/bundled/skills/prizmkit-retrospective/references/knowledge-injection-steps.md +3 -3
  134. package/bundled/skills/prizmkit-retrospective/references/retrospective-result-schema.json +138 -0
  135. package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +17 -23
  136. package/bundled/skills/prizmkit-test/SKILL.md +64 -51
  137. package/bundled/skills/prizmkit-test/references/boundary-contract-and-test-double-guidance.md +206 -0
  138. package/bundled/skills/prizmkit-test/references/independent-test-review.md +17 -9
  139. package/bundled/skills/prizmkit-test/references/test-coverage-model.md +45 -21
  140. package/bundled/skills/prizmkit-test/references/test-report-template.md +20 -13
  141. package/bundled/skills/prizmkit-workflow/SKILL.md +35 -37
  142. package/bundled/skills/prizmkit-workflow/references/artifact-identity.md +34 -0
  143. package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +22 -18
  144. package/bundled/skills/recovery-workflow/SKILL.md +9 -6
  145. package/bundled/skills/recovery-workflow/evals/evals.json +2 -2
  146. package/bundled/skills/recovery-workflow/references/detection.md +7 -6
  147. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +16 -6
  148. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +21 -13
  149. package/bundled/templates/project-memory-template.md +19 -11
  150. package/package.json +1 -1
  151. package/src/scaffold.js +33 -22
  152. package/bundled/dev-pipeline/prizmkit_runtime/runner_recovery.py +0 -228
  153. package/bundled/dev-pipeline/scripts/generate-recovery-prompt.py +0 -767
  154. package/bundled/dev-pipeline/templates/sections/bugfix-artifacts.md +0 -16
  155. package/bundled/dev-pipeline/templates/sections/bugfix-session-status.md +0 -31
  156. package/bundled/dev-pipeline/templates/sections/critical-paths-agent.md +0 -7
  157. package/bundled/dev-pipeline/templates/sections/critical-paths-lite.md +0 -7
  158. package/bundled/dev-pipeline/templates/sections/directory-convention-agent.md +0 -9
  159. package/bundled/dev-pipeline/templates/sections/directory-convention-lite.md +0 -6
  160. package/bundled/dev-pipeline/templates/sections/headless-commit-authorization.md +0 -15
  161. package/bundled/dev-pipeline/templates/sections/phase-commit.md +0 -61
  162. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +0 -24
  163. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-lite-suffix.md +0 -12
  164. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +0 -44
  165. package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +0 -25
  166. package/bundled/dev-pipeline/templates/sections/phase-plan-agent.md +0 -20
  167. package/bundled/dev-pipeline/templates/sections/phase-plan-lite.md +0 -20
  168. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +0 -20
  169. package/bundled/dev-pipeline/templates/sections/refactor-artifacts.md +0 -17
  170. package/bundled/dev-pipeline/templates/sections/refactor-session-status.md +0 -28
  171. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-agent.md +0 -52
  172. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-lite.md +0 -52
  173. package/bundled/skills/prizmkit-code-review/references/workflow-state-protocol.md +0 -174
  174. package/bundled/skills/prizmkit-committer/references/workflow-state-protocol.md +0 -174
  175. package/bundled/skills/prizmkit-implement/references/workflow-state-protocol.md +0 -174
  176. package/bundled/skills/prizmkit-plan/references/workflow-state-protocol.md +0 -174
  177. package/bundled/skills/prizmkit-retrospective/references/workflow-state-protocol.md +0 -174
  178. package/bundled/skills/prizmkit-test/references/external-contract-mock-guidance.md +0 -119
@@ -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`.
@@ -111,9 +111,19 @@ Steps:
111
111
  6. Validate migrated docs against format rules and size limits.
112
112
  7. Report files processed, generated `.prizm` files, and manual review items.
113
113
 
114
+ ## Recovery Backup Contract
115
+
116
+ Before replacing a corrupted `root.prizm`, copy its exact bytes outside the managed documentation tree:
117
+
118
+ ```text
119
+ .prizmkit/backups/prizm-docs/root.prizm.bak
120
+ ```
121
+
122
+ 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.
123
+
114
124
  ## Error Handling
115
125
 
116
- - `root.prizm` corrupted or invalid: back it up, then rebuild affected docs from source.
126
+ - `root.prizm` corrupted or invalid: create the byte-for-byte recovery backup above, then rebuild affected docs from source.
117
127
  - Broken pointers: create the missing `.prizm` file if the source module exists; remove the pointer if the source module was deleted.
118
128
  - Size limit exceeded: consolidate L0, move L1 implementation detail to L2, trim L2 derived detail.
119
129
  - No git history: fall back to filesystem timestamps for freshness checks and warn that accuracy is reduced.
@@ -1,80 +1,76 @@
1
1
  ---
2
2
  name: "prizmkit-retrospective"
3
- description: "Mandatory retrospective stage after a formal requirement passes code review and testing. Synchronizes durable Prizm documentation or records that no documentation change is needed, updates workflow state, and hands off to prizmkit-committer. (project)"
3
+ description: "Synchronize durable Prizm documentation for one caller-supplied project change, or record that no documentation update is warranted. Writes retrospective-result.json and returns RETRO_COMPLETE or RETRO_BLOCKED. (project)"
4
4
  ---
5
5
 
6
6
  # PrizmKit Retrospective
7
7
 
8
- `/prizmkit-retrospective` is the mandatory documentation and durable-knowledge stage after `prizmkit-test` returns `TEST_PASS`.
8
+ `/prizmkit-retrospective` synchronizes durable project documentation for one explicitly supplied project change.
9
9
 
10
10
  It performs two jobs:
11
11
 
12
12
  1. **Structural Sync** — reflect changed code structure, interfaces, dependencies, and file mappings in `.prizmkit/prizm-docs/` when the documentation system exists.
13
- 2. **Knowledge Injection** — add durable TRAPS, RULES, and DECISIONS discovered during the task when such knowledge exists.
13
+ 2. **Knowledge Injection** — add durable TRAPS, RULES, and DECISIONS revealed by the supplied project change.
14
14
 
15
- The stage must always run for a formal requirement. When no documentation update is warranted, it records `NO_DOC_CHANGE` as a successful retrospective result rather than silently skipping the stage.
15
+ When no documentation update is warranted, it records `NO_DOC_CHANGE` rather than silently producing no result.
16
16
 
17
17
  For first-time documentation setup, validation, rebuild, migration, or out-of-band repair after docs drift, use `/prizmkit-prizm-docs` independently.
18
18
 
19
- ## Formal Lifecycle Position
19
+ ## Input
20
20
 
21
- ```text
22
- prizmkit-plan
23
- prizmkit-implement
24
- prizmkit-code-review
25
- prizmkit-test
26
- → prizmkit-retrospective
27
- prizmkit-committer
28
- ```
21
+ | Parameter | Required | Description |
22
+ |---|---|---|
23
+ | `artifact_dir` | Yes | Exact caller-supplied directory in which to write `retrospective-result.json`. |
24
+ | `change_paths` | Yes | Exact project-relative non-`.prizmkit/` paths whose current change is the documentation input. May be an explicit empty list only when the caller requests a no-change determination. |
25
+ | `change_summary` | No | Caller-supplied summary used only as context; source changes remain authoritative. |
26
+
27
+ Do not discover a different artifact directory, expand the path set, or infer prerequisite work.
29
28
 
30
- ## Atomic Stage Boundary
29
+ ## Atomic Boundary
31
30
 
32
- `prizmkit-retrospective` owns only structural documentation synchronization, durable knowledge injection, and retrospective result recording. It writes its truthful completion status and result plus `next_stage`, then returns control. It must not invoke `prizmkit-committer` itself; the active orchestrator owns the next-stage invocation.
31
+ `prizmkit-retrospective` owns only structural documentation synchronization, durable knowledge injection, and `retrospective-result.json` for the supplied paths. It returns `RETRO_COMPLETE` or `RETRO_BLOCKED` and stops.
33
32
 
34
33
  ## When to Use
35
34
 
36
- - After `/prizmkit-test` returns `TEST_PASS` for a formal requirement.
37
- - When workflow state resumes a previously interrupted retrospective.
38
- - When the user explicitly requests a retrospective or documentation synchronization outside a formal requirement.
35
+ - A caller supplies exact project change paths that may affect durable documentation.
36
+ - A previously interrupted documentation synchronization is resumed with the same explicit inputs.
37
+ - The user explicitly requests a retrospective or documentation synchronization for a named change.
39
38
 
40
39
  ## When NOT to Use
41
40
 
42
- - The requirement has not passed code review and testing.
43
- - `TEST_NEEDS_FIXES` or `TEST_BLOCKED` remains unresolved.
44
- - The request is a direct edit outside the formal requirement lifecycle, unless the user explicitly asks for documentation maintenance.
45
- - First-time docs initialization or out-of-band docs repair; use `/prizmkit-prizm-docs` instead.
41
+ - The requested change paths are missing, unsafe, contradictory, or cannot be inspected.
42
+ - The request asks this Skill to discover what work should be documented.
43
+ - First-time docs initialization or out-of-band docs repair is needed; use `/prizmkit-prizm-docs` instead.
46
44
 
47
- ## Preconditions and Artifact Identity
45
+ ## Input Validation and Scope
48
46
 
49
- 1. Reuse the caller's `artifact_dir`; do not select another requirement.
50
- 2. Confirm the latest review result is `PASS`.
51
- 3. Confirm the latest testing result is `TEST_PASS`.
52
- 4. Read the final source diff with `.prizmkit/` excluded, then use `spec.md`, `plan.md`, the final `review-report.md`, `test-report.md`, and `test-result.json` only as supporting context for the non-`.prizmkit/` changes.
53
- 5. If the workflow state is missing or stale, reconstruct it from those authoritative artifacts and report the reconstruction.
47
+ 1. Resolve `artifact_dir` and every `change_paths` entry exactly as supplied.
48
+ 2. Reject paths outside the checkout, paths under `.prizmkit/`, and paths that do not belong to the supplied project change.
49
+ 3. Inspect only the supplied non-`.prizmkit/` project changes and the Prizm docs necessary to synchronize them.
50
+ 4. Treat `change_summary` as supporting context only. Never infer durable facts from generated records or caller metadata when source/project files do not establish those facts.
51
+ 5. If the input cannot safely establish the documentation scope, return `RETRO_BLOCKED` with the exact blocker.
54
52
 
55
- `.prizmkit/` is always excluded from retrospective project-change input scope. Do not treat any file under `.prizmkit/`—including plans, artifacts, state, evidence, or existing Prizm docs—as a changed project file from which structural or durable knowledge is inferred. Required lifecycle state/evidence writes and targeted `.prizmkit/prizm-docs/` updates remain outputs; documentation changes must be justified only by observed non-`.prizmkit/` project changes.
53
+ Only targeted `.prizmkit/prizm-docs/` changes and `{artifact_dir}/retrospective-result.json` are outputs.
56
54
 
57
55
  ## Job 1: Structural Sync
58
56
 
59
- When `.prizmkit/prizm-docs/` exists, read `${SKILL_DIR}/references/structural-sync-steps.md` and synchronize documentation with the final codebase changes.
57
+ When `.prizmkit/prizm-docs/` exists, read `${SKILL_DIR}/references/structural-sync-steps.md` and synchronize documentation with the supplied project changes.
60
58
 
61
- Review only changed project files outside `.prizmkit/`:
59
+ Review only supplied project files outside `.prizmkit/`:
62
60
 
63
61
  - added, modified, deleted, and renamed source files;
64
62
  - structural module files, configuration, interfaces, and tests when they reveal durable project behavior;
65
- - documentation mappings affected by those non-`.prizmkit/` project changes;
63
+ - documentation mappings affected by those project changes;
66
64
  - stale pointers and stale traps implicated by those project changes;
67
65
  - format, pointer, size, and memory-hygiene constraints for any docs the retrospective updates.
68
66
 
69
- Never use `.prizmkit/` changes themselves as structural-sync input.
67
+ When `.prizmkit/prizm-docs/` does not exist, record `NO_DOC_CHANGE` with reason `PRIZM_DOCS_NOT_INITIALIZED` and recommend documentation initialization as a separate action.
70
68
 
71
- When `.prizmkit/prizm-docs/` does not exist, do not pretend structural sync occurred. Record `NO_DOC_CHANGE` with reason `PRIZM_DOCS_NOT_INITIALIZED` and recommend `/prizmkit-init` or `/prizmkit-prizm-docs` for a future setup. The formal lifecycle may still continue because initialization is a soft prerequisite.
72
-
73
- Do not create an L2 document merely because one was missing during implementation. Create it only when the final change contains meaningful durable module knowledge.
69
+ Create a detail document only when the supplied change contains meaningful durable module knowledge.
74
70
 
75
71
  ## Job 2: Knowledge Injection
76
72
 
77
- When the final project change outside `.prizmkit/` reveals durable knowledge, read `${SKILL_DIR}/references/knowledge-injection-steps.md` and inject only stable product/domain knowledge into Prizm docs.
73
+ When the supplied project change reveals durable knowledge, read `${SKILL_DIR}/references/knowledge-injection-steps.md` and inject only stable product/domain knowledge into Prizm docs.
78
74
 
79
75
  Candidate knowledge includes:
80
76
 
@@ -83,73 +79,63 @@ Candidate knowledge includes:
83
79
  - interface or contract changes;
84
80
  - dependencies affecting module behavior;
85
81
  - observable behavior changes;
86
- - test-discovered boundaries or regression rules.
82
+ - test-established boundaries or regression rules.
87
83
 
88
84
  Do not write transient artifact paths, task IDs, branch names, dates, session/run metadata, or changelog material into Prizm docs.
89
85
 
90
86
  When no durable structural or knowledge change exists, return `NO_DOC_CHANGE` and explain why.
91
87
 
92
- ## Verification and Staging
88
+ ## Verification
93
89
 
94
90
  1. Validate any updated docs using the project documentation rules.
95
- 2. Review the final diff and ensure only intended documentation changes are present.
96
- 3. Do not change the target project's Git or ignore policy. If the host or project workflow stages docs, report what was staged; otherwise leave staging to `/prizmkit-committer`.
91
+ 2. Review the final documentation diff and ensure only intended changes are present.
92
+ 3. Do not change the target project's Git/ignore policy and do not stage or commit documentation changes. All paths under `.prizmkit/` are framework-internal and remain outside automated task commits.
97
93
  4. Never claim documentation synchronization passed if validation failed.
98
94
 
99
- ## Retrospective Result
95
+ ## Result Artifact
100
96
 
101
- Write `{artifact_dir}/retrospective-result.json` for every formal requirement:
97
+ Read `${SKILL_DIR}/references/retrospective-result-schema.json` and write `{artifact_dir}/retrospective-result.json` atomically:
102
98
 
103
99
  ```json
104
100
  {
105
- "status": "completed",
106
- "stage_result": "RETRO_COMPLETE",
101
+ "schema_version": 1,
102
+ "outcome": "RETRO_COMPLETE",
107
103
  "result": "DOCS_UPDATED",
108
104
  "reason": "Durable module interfaces and traps changed",
109
- "review_verdict": "PASS",
110
- "test_verdict": "TEST_PASS"
105
+ "change_paths": ["src/example.py"],
106
+ "documentation_paths": [".prizmkit/prizm-docs/example/module.prizm"],
107
+ "validation": ["python3 core/templates/hooks/validate-prizm-docs.py --all"]
111
108
  }
112
109
  ```
113
110
 
114
- `status=completed` is the stable lifecycle status. `stage_result=RETRO_COMPLETE` marks successful retrospective completion; `result` must be exactly `DOCS_UPDATED` or `NO_DOC_CHANGE`. Use `result=NO_DOC_CHANGE` with a concrete reason when no documentation update is warranted. This artifact is the retrospective gate evidence consumed by the committer and external automation; workflow state alone does not prove completion.
115
-
116
- ## Workflow State and Handoff
111
+ Every retrospective artifact has exactly these seven keys: `schema_version`, `outcome`, `result`, `reason`, `change_paths`, `documentation_paths`, and `validation`. Do not add routing, checkpoint, or caller-state fields.
117
112
 
118
- Before reading or updating workflow state, read `${SKILL_DIR}/references/workflow-state-protocol.md`.
113
+ `outcome` is `RETRO_COMPLETE` for a valid `DOCS_UPDATED` or `NO_DOC_CHANGE` result. Use `NO_DOC_CHANGE` with a concrete reason and an empty or unchanged `documentation_paths` list.
119
114
 
120
- On successful completion, update `.prizmkit/state/workflows/<requirement-slug>.json`:
115
+ If documentation validation or synchronization cannot safely complete, atomically write the same seven-key shape with `result: null`:
121
116
 
122
117
  ```json
123
118
  {
124
- "stage": "retrospective",
125
- "status": "completed",
126
- "stage_result": "RETRO_COMPLETE",
127
- "completed_stages": ["plan", "implement", "code-review", "test", "retrospective"],
128
- "next_stage": "committer",
129
- "resume_from": "prizmkit-committer"
119
+ "schema_version": 1,
120
+ "outcome": "RETRO_BLOCKED",
121
+ "result": null,
122
+ "reason": "Exact validation or synchronization blocker",
123
+ "change_paths": ["src/example.py"],
124
+ "documentation_paths": [".prizmkit/prizm-docs/example/module.prizm"],
125
+ "validation": ["validation command or check that failed"]
130
126
  }
131
127
  ```
132
128
 
133
- Use `status=completed` and `stage_result=RETRO_COMPLETE` for both successful outcomes, with `result=DOCS_UPDATED` when durable docs changed or `result=NO_DOC_CHANGE` when the stage completed without a docs update. Both result values permit the commit stage.
129
+ For a blocked outcome, `reason` is the exact non-empty blocker, `change_paths` remains the exact supplied input, `documentation_paths` lists only files actually changed before blocking, and `validation` lists only checks actually attempted. Never use `DOCS_UPDATED`, `NO_DOC_CHANGE`, an empty success reason, or an invented validation command with `RETRO_BLOCKED`.
134
130
 
135
- If documentation validation or synchronization cannot safely complete, return `RETRO_BLOCKED`, do not commit, and provide the exact recovery entry.
131
+ ## Output
136
132
 
137
- ## Output and Handoff
133
+ Return only:
138
134
 
139
- Report:
140
-
141
- - `{artifact_dir}/retrospective-result.json` with `DOCS_UPDATED` or `NO_DOC_CHANGE`;
142
- - docs updated, created, or intentionally unchanged;
143
- - durable knowledge decisions;
144
- - validation evidence;
145
- - workflow state path and status;
146
- - the same `artifact_dir` for the next stage.
147
-
148
- After `RETRO_COMPLETE`:
149
-
150
- ```text
151
- RETRO_COMPLETE
152
- → /prizmkit-committer
153
- ```
135
+ - `artifact_dir` and `retrospective-result.json` path;
136
+ - `RETRO_COMPLETE` with `DOCS_UPDATED` or `NO_DOC_CHANGE`;
137
+ - documentation paths updated or intentionally unchanged;
138
+ - durable knowledge decisions and validation evidence;
139
+ - `RETRO_BLOCKED` with exact blockers when synchronization cannot complete.
154
140
 
155
- If workflow state names an active `orchestrator`, return `RETRO_COMPLETE`, `stage_result`, the retrospective/state paths, and `next_stage=committer` to it; do not invoke the committer independently. For direct stage use, provide the deterministic `/prizmkit-committer` invocation; a host may perform that semantic handoff on the user's behalf.
141
+ Return only the listed retrospective outputs. Do not invoke another Skill.
@@ -7,7 +7,7 @@
7
7
  - Targeted unchanged source, interfaces, callers, dependents, or tests only when an eligible diff raises a concrete ambiguity
8
8
  - The affected Prizm docs only as update targets and existing-knowledge checks, never as changed project input
9
9
 
10
- Do not scan or mine any `.prizmkit/` file for retrospective knowledge. Plans, review reports, test evidence, workflow state, and existing Prizm docs may describe transient or generated material; they must not create a retrospective fact independently of an observed non-`.prizmkit/` code or project-file change.
10
+ Do not scan or mine generated records for retrospective knowledge. Caller metadata and existing Prizm docs may describe transient or generated material; they must not create a retrospective fact independently of an observed change in the exact non-`.prizmkit/` project paths supplied as input.
11
11
 
12
12
  **2b.** Extract knowledge from what was **observed in code**, not invented:
13
13
 
@@ -41,10 +41,10 @@ When writing TRAPS:
41
41
 
42
42
  **QUALITY GATE**: Every item must answer: "If a new AI session reads only `.prizmkit/prizm-docs/` and this entry, does it gain actionable understanding?" If not, discard. Do not record trivially observable code patterns — the AI can read the code directly.
43
43
 
44
- **MEMORY HYGIENE GATE**: Before writing any `.prizmkit/prizm-docs/` entry, remove or translate workflow metadata. Never write 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. If source artifacts say "fixed in B-001" or "implemented in F-003", write only the durable product/domain fact.
44
+ **MEMORY HYGIENE GATE**: Before writing any `.prizmkit/prizm-docs/` entry, remove transient caller metadata. Never write CHANGELOG sections/files, UPDATED/date metadata, internal execution IDs, branch names, absolute worktree paths, or generated artifact paths. Write only durable product/domain facts established by the supplied project changes.
45
45
 
46
46
  **2c.** Inject into the correct `.prizmkit/prizm-docs/` file:
47
- - Module-level TRAPS/RULES/DECISIONS → the affected **L2** `.prizm` file. If the target L2 does not exist, create it first using the L2 GENERATION TEMPLATE before injecting knowledge. (TRAPS/DECISIONS/RULES belong in L2, not L1.)
47
+ - Module-level TRAPS/RULES/DECISIONS → the affected detail `.prizm` file. If the target detail document does not exist, create it from the detail-document generation template before injecting knowledge. These sections belong in detail documentation, not the module index.
48
48
  - Project-level RULES/PATTERNS → `root.prizm` (respect the current format — MODULE_INDEX or MODULE_GROUPS — do not convert between them during injection)
49
49
  - Cross-module concerns spanning 2+ modules → `root.prizm` CROSS_CUTTING section
50
50
 
@@ -0,0 +1,138 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "PrizmKit Retrospective Result",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": [
7
+ "schema_version",
8
+ "outcome",
9
+ "result",
10
+ "reason",
11
+ "change_paths",
12
+ "documentation_paths",
13
+ "validation"
14
+ ],
15
+ "properties": {
16
+ "schema_version": {
17
+ "const": 1
18
+ },
19
+ "outcome": {
20
+ "enum": ["RETRO_COMPLETE", "RETRO_BLOCKED"]
21
+ },
22
+ "result": {
23
+ "enum": ["DOCS_UPDATED", "NO_DOC_CHANGE", null]
24
+ },
25
+ "reason": {
26
+ "type": "string",
27
+ "minLength": 1
28
+ },
29
+ "change_paths": {
30
+ "type": "array",
31
+ "items": {
32
+ "type": "string",
33
+ "minLength": 1,
34
+ "allOf": [
35
+ {
36
+ "not": {
37
+ "pattern": "\\\\"
38
+ }
39
+ },
40
+ {
41
+ "not": {
42
+ "pattern": "^/"
43
+ }
44
+ },
45
+ {
46
+ "not": {
47
+ "pattern": "//"
48
+ }
49
+ },
50
+ {
51
+ "not": {
52
+ "pattern": "(?:^|/)\\.\\.?(?:/|$)"
53
+ }
54
+ },
55
+ {
56
+ "not": {
57
+ "pattern": "^\\.prizmkit(?:/|$)"
58
+ }
59
+ }
60
+ ]
61
+ }
62
+ },
63
+ "documentation_paths": {
64
+ "type": "array",
65
+ "items": {
66
+ "type": "string",
67
+ "pattern": "^\\.prizmkit/prizm-docs/.+\\.prizm$",
68
+ "allOf": [
69
+ {
70
+ "not": {
71
+ "pattern": "\\\\"
72
+ }
73
+ },
74
+ {
75
+ "not": {
76
+ "pattern": "//"
77
+ }
78
+ },
79
+ {
80
+ "not": {
81
+ "pattern": "(?:^|/)\\.\\.?(?:/|$)"
82
+ }
83
+ }
84
+ ]
85
+ }
86
+ },
87
+ "validation": {
88
+ "type": "array",
89
+ "items": {
90
+ "type": "string",
91
+ "minLength": 1
92
+ }
93
+ }
94
+ },
95
+ "oneOf": [
96
+ {
97
+ "properties": {
98
+ "outcome": {
99
+ "const": "RETRO_COMPLETE"
100
+ },
101
+ "result": {
102
+ "enum": ["DOCS_UPDATED", "NO_DOC_CHANGE"]
103
+ }
104
+ },
105
+ "allOf": [
106
+ {
107
+ "if": {
108
+ "properties": {
109
+ "result": {
110
+ "const": "DOCS_UPDATED"
111
+ }
112
+ }
113
+ },
114
+ "then": {
115
+ "properties": {
116
+ "documentation_paths": {
117
+ "minItems": 1
118
+ },
119
+ "validation": {
120
+ "minItems": 1
121
+ }
122
+ }
123
+ }
124
+ }
125
+ ]
126
+ },
127
+ {
128
+ "properties": {
129
+ "outcome": {
130
+ "const": "RETRO_BLOCKED"
131
+ },
132
+ "result": {
133
+ "type": "null"
134
+ }
135
+ }
136
+ }
137
+ ]
138
+ }
@@ -1,16 +1,10 @@
1
1
  # Structural Sync — Detailed Steps
2
2
 
3
- ## 1. Get changed files
3
+ ## 1. Validate supplied changed files
4
4
 
5
- Get changed project files from staged and unstaged changes relative to HEAD while excluding the entire `.prizmkit/` tree:
5
+ Use only the caller-supplied `change_paths`. Normalize each repository-relative path, reject paths outside the checkout or under `.prizmkit/`, and verify its current added/modified/deleted/renamed state with exact pathspecs.
6
6
 
7
- ```bash
8
- git diff HEAD --name-status -- . ':(exclude).prizmkit/**'
9
- ```
10
-
11
- If pathspec exclusion is unavailable, filter every result whose normalized repository-relative path is exactly `.prizmkit` or starts with `.prizmkit/` before classification. Do not infer project structure or durable knowledge from excluded files.
12
-
13
- If the caller supplied an explicit file list, apply the same `.prizmkit/` exclusion before using it and note the source in the report. If no files remain, structural sync is not needed.
7
+ Do not expand the path set through repository-wide status or diff discovery. If the validated list is empty, structural sync is not needed.
14
8
 
15
9
  ## 2. Map files to modules
16
10
 
@@ -42,11 +36,11 @@ Do not skip automatically just because the task is a bug fix or test change. Run
42
36
 
43
37
  ## 5. Update affected docs bottom-up
44
38
 
45
- ### L2
39
+ ### Detail documentation
46
40
 
47
- If L2 exists, update only sections affected by changed files in that module.
41
+ If a relevant detail document exists, update only sections affected by supplied changed files in that module.
48
42
 
49
- If L2 does not exist and the current diff includes Added or Modified source files with meaningful logic, create L2 with:
43
+ If detail documentation does not exist and the supplied changes include Added or Modified source files with meaningful logic, create it with:
50
44
 
51
45
  ```text
52
46
  MODULE
@@ -60,35 +54,35 @@ TRAPS
60
54
 
61
55
  Add DATA_FLOW, RULES, or DECISIONS only when the changed files provide durable information for those sections. Populate from the diff files and targeted source reads, not from an unbounded full-module rescan.
62
56
 
63
- ### L1
57
+ ### Module index
64
58
 
65
59
  Update FILES count, KEY_FILES, SUBDIRS, and DEPENDENCIES when module-level structure changes.
66
60
 
67
- L1 does not contain INTERFACES, DATA_FLOW, TRAPS, or DECISIONS; those belong in L2.
61
+ Module indexes do not contain INTERFACES, DATA_FLOW, TRAPS, or DECISIONS; those belong in detail documentation.
68
62
 
69
- ### L0
63
+ ### Root project map
70
64
 
71
- Update MODULE_INDEX or MODULE_GROUPS only when module structure changed. Preserve any `PROJECT_BRIEF:` line because it is managed by `/prizmkit-init`.
65
+ Update MODULE_INDEX or MODULE_GROUPS only when module structure changed. Preserve any `PROJECT_BRIEF:` line because it is managed separately.
72
66
 
73
67
  ## 6. New module handling
74
68
 
75
69
  If a new directory qualifies as a module and matches no existing module:
76
70
 
77
- 1. Create L1 immediately.
71
+ 1. Create its module index immediately.
78
72
  2. Add it to MODULE_INDEX or MODULE_GROUPS.
79
- 3. Create L2 only when the current diff includes meaningful Added or Modified source files for the module.
73
+ 3. Create detail documentation only when the supplied changes include meaningful Added or Modified source files for the module.
80
74
 
81
75
  ## 7. Size limits
82
76
 
83
- - L0 > 4KB → consolidate MODULE_INDEX or convert to MODULE_GROUPS when module count is high
84
- - L1 > 4KB → trim KEY_FILES descriptions and keep RULES concise
85
- - L2 > 5KB → remove derived detail or stale entries; keep durable knowledge only
77
+ - Root project map > 4KB → consolidate MODULE_INDEX or convert to MODULE_GROUPS when module count is high
78
+ - Module index > 4KB → trim KEY_FILES descriptions and keep RULES concise
79
+ - Detail document > 5KB → remove derived detail or stale entries; keep durable knowledge only
86
80
 
87
81
  ## 8. TRAPS staleness check
88
82
 
89
- Run only when an L2 doc's TRAPS section has more than 10 entries.
83
+ Run only when a detail document's TRAPS section has more than 10 entries.
90
84
 
91
- Process at most 5 oldest TRAPS per L2 doc:
85
+ Process at most 5 oldest TRAPS per detail document:
92
86
 
93
87
  1. If a TRAP has `STALE_IF:` and matched files no longer exist, delete the TRAP.
94
88
  2. If a TRAP has `REF:` and the referenced file is gone or the commit is older than the review horizon, mark it `[REVIEW]` for the next knowledge pass.