prizmkit 1.1.155 → 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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "frameworkVersion": "1.1.155",
3
- "bundledAt": "2026-07-27T14:17:49.935Z",
4
- "bundledFrom": "330ce51"
2
+ "frameworkVersion": "1.1.156",
3
+ "bundledAt": "2026-07-27T23:46:04.550Z",
4
+ "bundledFrom": "6d92126"
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.155",
2
+ "version": "1.1.156",
3
3
  "skills": {
4
4
  "prizmkit": {
5
5
  "description": "Framework introduction and navigation for the formal single-requirement lifecycle, project initialization, Prizm docs, and independent deployment.",
@@ -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,12 +152,14 @@ 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.
113
163
 
114
164
  ## Recovery Backup Contract
115
165
 
@@ -125,13 +175,17 @@ If that path exists, use the lowest available suffix `.001`, `.002`, and so on,
125
175
 
126
176
  - `root.prizm` corrupted or invalid: create the byte-for-byte recovery backup above, then rebuild affected docs from source.
127
177
  - Broken pointers: create the missing `.prizm` file if the source module exists; remove the pointer if the source module was deleted.
128
- - 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.
129
180
  - No git history: fall back to filesystem timestamps for freshness checks and warn that accuracy is reduced.
130
181
 
131
182
  ## Key Protocols
132
183
 
133
184
  For detailed protocol specifications, read `assets/prizm-docs-format.md`:
134
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
135
189
  - Progressive Loading: Section 6.1
136
190
  - Update/repair protocol: Section 7
137
191
  - RULES hierarchy: Section 3.1
@@ -37,10 +37,16 @@ CORE_PRINCIPLES:
37
37
  - Self-updating (docs stay fresh via commit-time hooks)
38
38
  - Universal (language and framework agnostic)
39
39
  - Durable project knowledge over auxiliary history (decisions, traps, interfaces, dependencies)
40
+ - Value-gated retention: before keeping a candidate fact, ask `Could a future AI that lacks this fact make an incorrect modification?`; retain it only when yes, current, durable, non-obvious, and owned at this level
41
+ - Protected critical knowledge: preserve still-valid public/wire contracts, cross-module constraints, non-obvious dependencies, traps, decisions with necessary rationale, likely-to-recur rejected alternatives and reasons, side effects, and security/data-integrity/concurrency/transaction/compatibility rules
42
+ - Rejected low-value material: omit source-derivable structure, task/change history, test inventories, temporary conclusions, stale statements, duplicate meanings, long procedures, low-value file lists, and child-owned behavioral detail copied into parents
43
+ - Cleanup in place: Update and Rebuild read existing targets, update equivalent meanings in place, merge synonyms, remove stale/duplicate/derivable/parent-copied content, and add only genuinely new durable knowledge
40
44
  - Memory hygiene over traceability noise (no CHANGELOG sections/files, UPDATED/date metadata, feature/bug/refactor/task/session/run/pipeline/workflow IDs, branch names, absolute worktree paths, or `.prizmkit/specs` / `.prizmkit/dev-pipeline` artifact paths)
41
- - Size-enforced (hard limits per level prevent bloat)
42
- - Lazy L2 generation (detail docs created on first modification or deep read, not during init)
45
+ - Size-enforced (hard limits per level prevent bloat; no project-size override)
46
+ - Capacity-aware (raw UTF-8 byte bands drive warnings and safe remediation; critical knowledge is never deleted merely to meet a check)
47
+ - Lazy L2 generation (detail docs created when durable knowledge exists, not as placeholders during init)
43
48
  - Rules hierarchy (root.prizm RULES are authoritative, module RULES supplement only)
49
+ - Three levels only (semantic concern documents are L2, never a fourth level or memory state machine)
44
50
 
45
51
  ---
46
52
 
@@ -49,18 +55,20 @@ CORE_PRINCIPLES:
49
55
  ## 2.1 Progressive Loading Levels
50
56
 
51
57
  LEVELS:
52
- - L0: Root index. ALWAYS loaded at session start. Max 4KB.
58
+ - L0: Root index. ALWAYS loaded at session start. Hard limit 4096 raw UTF-8 bytes.
53
59
  FILE: .prizmkit/prizm-docs/root.prizm
54
- CONTAINS: project meta, module index with pointers, build commands, tech stack, top rules
60
+ CONTAINS: concise project meta, module summaries with pointers, build commands, tech stack, top rules
61
+ DOES NOT CONTAIN: child-owned interfaces, data flow, TRAPS, DECISIONS, full rules, or copied behavioral detail
55
62
 
56
- - L1: Structural index. Loaded ON DEMAND when AI works in a module area. Max 4KB each.
63
+ - L1: Structural index. Loaded ON DEMAND when AI works in a module area. Hard limit 4096 raw UTF-8 bytes each.
57
64
  FILE: .prizmkit/prizm-docs/<mirrored-path>.prizm (mirrors source directory structure)
58
- CONTAINS: module responsibility, subdirs with pointers, key files, dependency graph, critical rules summary (1-3 only)
59
- DOES NOT CONTAIN: interface signatures, data flow, TRAPS, DECISIONS (those belong in L2)
65
+ CONTAINS: concise module responsibility, source submodule pointers, semantic detail pointers, key navigation files, dependency summary, critical rules summary (1-3 only)
66
+ DOES NOT CONTAIN: interface signatures, data flow, TRAPS, DECISIONS, full rules, or content already complete in L2
60
67
 
61
- - L2: Behavioral detail. Loaded when AI modifies files in that module OR needs deep understanding. Max 5KB each.
62
- FILE: .prizmkit/prizm-docs/<mirrored-path>/<submodule>.prizm
63
- CONTAINS: interface signatures, data flow, full rules, TRAPS, DECISIONS, domain-specific sections, rejected approaches
68
+ - L2: Behavioral detail. Loaded when AI modifies files in that module OR needs deep understanding. Hard limit 5120 raw UTF-8 bytes each.
69
+ FILE: mirrored source submodule at .prizmkit/prizm-docs/<module>/<submodule>.prizm, or semantic concern at .prizmkit/prizm-docs/<module>/<concern-slug>.prizm for an eligible flat module
70
+ CONTAINS: Value-Gate-qualified public interfaces, data flow, rules, TRAPS, DECISIONS, domain-specific sections, and rejected approaches
71
+ IDENTITY: a real source submodule path takes precedence; a semantic concern remains an L2 document and never adds a level
64
72
 
65
73
  ## 2.2 Directory Layout
66
74
 
@@ -114,6 +122,33 @@ EXAMPLE (Python project):
114
122
  COMMIT: .prizmkit/prizm-docs/ MUST be committed to git alongside source code
115
123
  RATIONALE: .prizmkit/prizm-docs/ is shared project knowledge that all team members (human and AI) benefit from.
116
124
 
125
+ ## 2.4 Capacity Classification and Remediation
126
+
127
+ MEASUREMENT: exact raw UTF-8 bytes; never characters, lines, rounded kilobytes, or locale-dependent encoding
128
+ LEVEL_LIMITS:
129
+ - L0: exact `.prizmkit/prizm-docs/root.prizm` -> 4096B
130
+ - L1: direct `.prizm` child of `.prizmkit/prizm-docs/` -> 4096B
131
+ - L2: nested `.prizm` document -> 5120B, including mirrored and semantic concern details
132
+ BANDS:
133
+ - normal: size * 100 < limit * 80
134
+ - warning: size * 100 >= limit * 80 and size * 100 < limit * 90
135
+ - strong-warning: size * 100 >= limit * 90 and size <= limit
136
+ - error: size > limit
137
+ TARGET_RANGE:
138
+ - L0/L1 automatic remediation: 3277–3686B (80% to below 90%)
139
+ - L2 automatic remediation: 4096–4607B (80% to below 90%)
140
+ - Content naturally below 80% remains normal and is never padded to the target
141
+ ACTION_ORDER:
142
+ 1. trim stale, derivable, procedural, historical, and low-value wording
143
+ 2. deduplicate repeated meanings and merge synonyms
144
+ 3. move child-owned behavior out of L0/L1 to a resolving child pointer
145
+ 4. semantic-split an eligible flat module's unrelated stable concerns into deterministic L2 documents
146
+ PRESERVATION: establish protected critical knowledge before remediation; never remove still-valid contracts, constraints, dependencies, traps, decisions, side effects, or safety/integrity rules merely to reduce bytes
147
+ COMPLETION: after automatic cleanup or split, measure every affected parent and child; each stays within its hard limit and remediation aims for the target range without padding naturally concise output; warning-range targets remain valid and visible; unresolved hard-limit errors fail validation
148
+ REPORT_ORDER: non-normal entries sort by exact descending utilization using integer ratio comparison, then repository-relative path ascending for ties
149
+ REPORT_FIELDS: path, level, current raw bytes, hard limit, utilization band, target range, and actionable trim, deduplicate, move-to-child, or semantic-split guidance
150
+ EXIT: warning and strong-warning diagnostics alone do not fail Validate; hard-limit or format errors fail and cannot be downgraded
151
+
117
152
  ---
118
153
 
119
154
  # SECTION 3: DOCUMENT FORMAT SPECIFICATION
@@ -165,7 +200,7 @@ TEMPLATE:
165
200
  - REJECTED: <rejected approach + why>
166
201
 
167
202
  CONSTRAINTS:
168
- - Max 4KB (roughly 100 lines)
203
+ - Hard limit 4096 raw UTF-8 bytes; project size never raises it
169
204
  - Every line must be a KEY: value pair or a list item
170
205
  - MODULE_INDEX must have arrow pointer (->) for every entry
171
206
  - MODULE_INDEX may list entries at any depth needed for efficient navigation (no hard depth limit)
@@ -173,9 +208,9 @@ CONSTRAINTS:
173
208
  - No prose paragraphs
174
209
  - root.prizm RULES are AUTHORITATIVE: they override any conflicting L1/L2 RULES
175
210
 
176
- ### MODULE_GROUPS (alternative to MODULE_INDEX for projects with 15+ modules)
211
+ ### MODULE_GROUPS (capacity-safe alternative to MODULE_INDEX)
177
212
 
178
- When MODULE_INDEX would exceed 15 entries, replace it with MODULE_GROUPS to stay within the 4KB limit. Group modules by functional domain:
213
+ When MODULE_INDEX cannot retain the required concise module map within the L0 4096B hard limit, replace it with MODULE_GROUPS. More than 15 modules is a mandatory grouping trigger, but measured L0 capacity may require grouping earlier. Group modules by stable functional domain; never raise the L0 limit or add a project-size override:
179
214
 
180
215
  MODULE_GROUPS:
181
216
  <domain-name>:
@@ -186,6 +221,7 @@ When MODULE_INDEX would exceed 15 entries, replace it with MODULE_GROUPS to stay
186
221
 
187
222
  CONSTRAINTS for MODULE_GROUPS:
188
223
  - Exactly ONE of MODULE_INDEX or MODULE_GROUPS must be present in root.prizm (not both)
224
+ - Grouping changes navigation shape only; L0 remains a concise summary/pointer map and the 4096B hard limit is unchanged
189
225
  - Domain names: lowercase, descriptive (e.g., api, frontend, infrastructure, shared, data)
190
226
  - 3-8 domains is the ideal range
191
227
  - Each module appears in exactly one domain
@@ -212,7 +248,11 @@ TEMPLATE:
212
248
  RESPONSIBILITY: <one-line>
213
249
 
214
250
  SUBDIRS:
215
- - <name>/: <one-line description>. -> .prizmkit/prizm-docs/<child-path>.prizm
251
+ - <name>/: <one-line source-submodule summary>. -> .prizmkit/prizm-docs/<child-path>.prizm
252
+
253
+ DETAILS:
254
+ - <concern-slug>: <one-line stable behavior summary> -> .prizmkit/prizm-docs/<module>/<concern-slug>.prizm
255
+ (DETAILS is present only for semantic concern L2 documents in a flat module. SUBDIRS owns real source-submodule pointers.)
216
256
 
217
257
  KEY_FILES:
218
258
  - <filename>: <role/purpose>
@@ -226,13 +266,16 @@ TEMPLATE:
226
266
  - MUST: <1-3 most critical module-specific rules only — full list in L2>
227
267
 
228
268
  CONSTRAINTS:
229
- - Max 4KB
269
+ - Hard limit 4096 raw UTF-8 bytes; project size never raises it
230
270
  - L1 is a STRUCTURAL INDEX — it answers "what exists here" not "how it works"
231
- - DOES NOT CONTAIN: INTERFACES, DATA_FLOW, TRAPS, DECISIONS (those belong in L2)
271
+ - DOES NOT CONTAIN: INTERFACES, DATA_FLOW, TRAPS, DECISIONS, full RULES, or copied L2 behavioral content
232
272
  - RULES: summary only, max 3 entries of the most critical constraints. Full rules in L2.
233
273
  - DEPENDENCIES has 3 sub-categories (imports, imported-by, external)
234
- - SUBDIRS entries must have arrow pointer (->) if child doc exists
235
- - KEY_FILES lists only the most important files (max 10-15)
274
+ - SUBDIRS entries point only to mirrored real source-submodule details; each pointer must resolve
275
+ - DETAILS entries use exactly `- <concern-slug>: <one-line stable behavior summary> -> .prizmkit/prizm-docs/<module>/<concern-slug>.prizm`; each pointer must resolve to one semantic L2 whose MODULE and CONCERN match
276
+ - A real source-submodule path takes precedence over the same semantic slug; ambiguity or collision blocks semantic detail creation
277
+ - KEY_FILES lists only navigation-critical files that pass the Value Gate (max 10-15, often fewer); never use it as a file inventory
278
+ - If a child L2 contains the complete rule, interface, trap, decision, or data flow, L1 keeps only the shortest useful summary and pointer
236
279
  - RULES may only SUPPLEMENT root.prizm RULES with module-specific exceptions, never contradict them
237
280
 
238
281
  TRAPS_FORMAT_REFERENCE (spec-only — do NOT include this block in generated .prizm files):
@@ -245,63 +288,79 @@ TRAPS_FORMAT_REFERENCE (spec-only — do NOT include this block in generated .pr
245
288
 
246
289
  ## 3.3 L2: detail.prizm (Behavioral Detail)
247
290
 
248
- TEMPLATE:
291
+ COMMON_TEMPLATE:
249
292
 
250
- MODULE: <source-path>
251
- FILES: <comma-separated list of all files>
252
- RESPONSIBILITY: <one-line>
293
+ MODULE: <source-submodule path for mirrored detail, or flat parent module path for semantic detail>
294
+ CONCERN: <stable concern identity> | SLUG: <concern-slug>
295
+ (CONCERN is required only for semantic concern details and prohibited on mirrored source-submodule details.)
296
+ FILES: <comma-separated repository-relative source files owned by this detail>
297
+ RESPONSIBILITY: <one-line durable behavior boundary>
253
298
 
254
299
  INTERFACES:
255
- - <function/method signature>: <what it does>
300
+ - <non-obvious public/exported signature or wire contract>: <modification consequence>
256
301
 
257
302
  DATA_FLOW:
258
- - <numbered step describing how data moves through this module>
303
+ - <numbered non-obvious step, side effect, transaction, or cross-boundary flow>
259
304
 
260
305
  <DOMAIN-SPECIFIC SECTIONS>
261
- (AI generates these based on what the module does. Examples below.)
306
+ (AI generates these only when entries pass the Value Gate.)
262
307
 
263
308
  KEY_FILES:
264
- - <filename>: <detailed description, line count, complexity notes>
309
+ - <repository-relative source file>: <why a future modification needs this navigation pointer>
265
310
 
266
311
  DEPENDENCIES:
267
- - uses: <external lib>: <why/how used>
268
- - imports: <internal module>: <which interfaces consumed>
312
+ - uses: <external dependency>: <non-obvious contract or constraint>
313
+ - imports: <internal module>: <consumed public contract or coupling>
269
314
 
270
315
  RULES:
271
316
  - MUST: <module-specific mandatory rule>
272
317
  - NEVER: <module-specific prohibition>
273
318
  - PREFER: <module-specific preference>
274
- (Full rules list — L1 only has a 1-3 item summary of these)
275
319
 
276
320
  TRAPS:
277
- - [CRITICAL|HIGH|LOW] <gotcha: something that looks correct but is wrong or dangerous> | FIX: <correct approach>
278
- - [CRITICAL|HIGH|LOW] <non-obvious coupling, race condition, or side effect> | FIX: <approach>
321
+ - [CRITICAL|HIGH|LOW] <incorrect-looking-safe change or non-obvious side effect> | FIX: <correct approach>
279
322
 
280
323
  DECISIONS:
281
- - <decision made within this module> <rationale>
282
- - REJECTED: <approach that was tried/considered and abandoned + why>
324
+ - <durable decision> <only the rationale needed to preserve it>
325
+ - REJECTED: <alternative future sessions are likely to propose again> — <why it remains rejected>
326
+
327
+ REQUIRED_FIELDS:
328
+ - Mirrored source-submodule L2: MODULE, FILES, RESPONSIBILITY, INTERFACES, KEY_FILES, DEPENDENCIES, TRAPS. DATA_FLOW, RULES, DECISIONS, and domain-specific sections are present only when facts pass the Value Gate, preserving existing mirrored-document compatibility.
329
+ - Semantic concern L2 complete terminal shape: MODULE, CONCERN, FILES, RESPONSIBILITY, INTERFACES, DATA_FLOW, KEY_FILES, DEPENDENCIES, RULES, TRAPS, DECISIONS
330
+ - In a semantic concern L2, if a required behavioral section has no fact that passes the Value Gate, render the section as `<SECTION>: none`; never invent filler to populate it
331
+ - DOMAIN-SPECIFIC sections are optional and contain only Value-Gate-qualified facts
332
+
333
+ SEMANTIC_CONCERN_TERMINAL_SHAPE:
334
+ - Eligibility: a flat source module has multiple stable behavior concerns and required protected knowledge cannot fit one L2 within 5120B after Value/Cleanup filtering
335
+ - Path: `.prizmkit/prizm-docs/<module>/<concern-slug>.prizm`; it is L2, not a new documentation level
336
+ - MODULE: exact flat source module path
337
+ - CONCERN: stable source-evidenced product/domain behavior name plus its deterministic slug
338
+ - FILES: non-empty exhaustive list of repository-relative source files owned by this concern
339
+ - Ownership: sibling semantic concerns have explicit non-overlapping FILES; unclear or overlapping ownership blocks automatic creation
340
+ - Parent: exactly one L1 DETAILS entry using the Section 3.2 grammar resolves to the semantic file; the slug, path, MODULE, and CONCERN must agree
341
+ - Mirrored precedence: if a real source submodule maps to the same path, the mirrored submodule owns it and semantic creation is blocked pending a different unambiguous concern identity
342
+ - Terminal outcomes: write the complete required shape, or report the ambiguity/collision/ownership blocker and required manual decision; never emit a partial semantic file
283
343
 
284
344
  DOMAIN_SPECIFIC_SECTION_EXAMPLES:
285
- - For state machines: STATES, TRIGGERS, TRANSITIONS
345
+ - For state transition logic: STATES, TRIGGERS, TRANSITIONS
286
346
  - For API handlers: ENDPOINTS, REQUEST_FORMAT, RESPONSE_FORMAT, ERROR_CODES
287
347
  - For data stores: TABLES, QUERIES, INDEXES, CACHE_KEYS
288
348
  - For config modules: CONFIG_KEYS, ENV_VARS, DEFAULTS
289
349
  - For UI components: PROPS, EVENTS, SLOTS, STYLES
290
350
 
291
351
  CONSTRAINTS:
292
- - Max 5KB
293
- - L2 is the BEHAVIORAL DETAIL — it answers "how it works, what can go wrong, what was decided"
294
- - INTERFACES: lists only PUBLIC/EXPORTED signatures (moved here from L1 in V4)
295
- - DATA_FLOW: describes how data moves through the module (moved here from L1 in V4)
296
- - RULES: full module-specific rules list (L1 only has a 1-3 item summary)
297
- - DOMAIN-SPECIFIC SECTIONS are flexible, not prescribed
298
- - DECISIONS records durable rationale only; update or remove stale entries in place when code reality changes
299
- - TRAPS section is CRITICAL for preventing AI from making known mistakes
300
- - TRAPS entries MUST have severity prefix ([CRITICAL], [HIGH], or [LOW]). [REVIEW] may precede severity as a temporary staleness marker.
352
+ - Hard limit 5120 raw UTF-8 bytes; project size never raises it
353
+ - L2 is the BEHAVIORAL DETAIL — it answers only non-obvious "how it works, what can go wrong, what was decided" questions that pass the Value Gate
354
+ - INTERFACES lists only non-obvious PUBLIC/EXPORTED or wire contracts; omit source-derivable signatures as `INTERFACES: none`
355
+ - DATA_FLOW records only flows or side effects whose absence could cause an incorrect modification
356
+ - RULES contains the full retained module-specific rules list; L1 has at most a short summary
357
+ - DECISIONS records durable rationale only; keep it current by updating equivalent decisions in place and removing stale ones
358
+ - TRAPS entries MUST have severity prefix ([CRITICAL], [HIGH], or [LOW]); [REVIEW] may precede severity as a temporary staleness marker
301
359
  - TRAPS optional fields: append `| REF: <7-char-hash>` for traceability, `| STALE_IF: <glob>` for auto-expiry detection
302
360
  - TRAPS severity: CRITICAL = data loss/security/financial/crash, HIGH = functional failure/silent error, LOW = naming/minor quality (see TRAPS_FORMAT_REFERENCE in Section 3.2)
303
- - REJECTED entries prevent AI from re-proposing failed approaches
304
- - FILES lists all files, not just key ones
361
+ - REJECTED entries exist only for alternatives likely to recur and include the durable reason
362
+ - FILES is an ownership list, not a low-value repository inventory; mirrored details list files in their source boundary and semantic details list their explicitly owned files
363
+ - KEY_FILES contains only navigation-critical files and never line counts, complexity inventories, or derivable descriptions
305
364
  - RULES may only SUPPLEMENT root.prizm RULES with module-specific exceptions, never contradict them
306
365
 
307
366
  ## 3.4 Metadata Policy
@@ -349,8 +408,40 @@ app/services/ .prizmkit/prizm-docs/app/services.prizm
349
408
  FOR any source file at path P:
350
409
  1. Walk up directory tree to find the first ancestor D where .prizmkit/prizm-docs/<D>.prizm exists
351
410
  2. That file is the L1 doc for this source file
352
- 3. If P is inside a subdirectory S of D, check if .prizmkit/prizm-docs/<D>/<S>.prizm exists for L2
353
- 4. If no .prizm doc found, the module is undocumented (may need retrospective after development or prizmkit-prizm-docs Update for out-of-band repair)
411
+ 3. If P is inside a source subdirectory S of D, check `.prizmkit/prizm-docs/<D>/<S>.prizm` first; mirrored source-submodule identity has precedence
412
+ 4. For a flat module, resolve each L1 DETAILS pointer and select the one semantic L2 whose FILES ownership contains P
413
+ 5. If semantic FILES ownership is absent, overlaps, or disagrees with its parent pointer, report ambiguity instead of guessing
414
+ 6. If no .prizm doc found, the module is undocumented (may need retrospective after development or prizmkit-prizm-docs Update for out-of-band repair)
415
+
416
+ ## 5.4 Deterministic Semantic Concern Identity
417
+
418
+ ELIGIBILITY:
419
+ - The source module is flat: the concern is not already a real source submodule that can use mirrored identity
420
+ - Current source proves multiple stable product/domain behavior boundaries
421
+ - Required protected knowledge cannot fit one 5120B L2 after the Value Gate, Cleanup Gate, deduplication, and concise wording
422
+
423
+ SLUG_ALGORITHM:
424
+ 1. Choose one concise stable product/domain behavior concern name evidenced by current source responsibility; task, feature, bug, session, workflow, branch, temporary initiative, and file-count labels are invalid identities.
425
+ 2. Normalize the identity with Unicode NFKC.
426
+ 3. Apply Unicode lowercase.
427
+ 4. Replace each maximal run of characters that is neither a Unicode letter nor a Unicode decimal digit with one ASCII hyphen.
428
+ 5. Trim leading and trailing hyphens. The result must be non-empty, lowercase kebab-case and map unambiguously to exactly one stable concern.
429
+ 6. Compare the result with every sibling semantic CONCERN slug, sibling DETAILS entry, and mirrored source-submodule path before creating a file.
430
+
431
+ OWNERSHIP_RULES:
432
+ - FILES uses normalized repository-relative source paths and is non-empty.
433
+ - Each owned file belongs to exactly one sibling semantic concern. Do not silently duplicate or overlap ownership.
434
+ - Source files outside the flat module, unclear multi-concern files, unstable behavior boundaries, empty slugs, and one slug mapping to multiple concern meanings require a manual ownership/identity decision.
435
+
436
+ COLLISION_OUTCOME:
437
+ - If normalized identities collide, a semantic slug collides with a mirrored source-submodule path, or concern/FILES ownership is ambiguous, do not create or rename a detail arbitrarily.
438
+ - Report the candidate identities, colliding path or overlapping files, and the manual decision required.
439
+ - Never use task IDs, numeric suffixes (`-2`, `-003`), timestamps, branch names, or silent overlapping documents to resolve the collision.
440
+
441
+ POINTER_RESOLUTION:
442
+ - Semantic path = `.prizmkit/prizm-docs/<module>/<concern-slug>.prizm`.
443
+ - Parent L1 contains exactly one matching DETAILS entry; the target exists; target MODULE equals `<module>`; target CONCERN slug equals `<concern-slug>`; target FILES satisfies ownership rules.
444
+ - A semantic concern remains at L2. Do not create L3, a fourth level, a memory state machine, or a scoring system.
354
445
 
355
446
  ---
356
447
 
@@ -365,6 +456,7 @@ ON_SESSION_START:
365
456
  ON_TASK_RECEIVED:
366
457
  IF task references specific file or directory:
367
458
  LOAD: L1 for the containing module (structural index: files, deps, key rules)
459
+ RESOLVE: a mirrored SUBDIRS pointer first; for a flat module, use the one DETAILS pointer whose semantic L2 FILES ownership contains the source file
368
460
  IF task is broad (e.g., "refactor auth", "improve performance"):
369
461
  LOAD: L1 for all matching modules from MODULE_INDEX
370
462
  IF task is exploratory (e.g., "explain the codebase", "how does X work"):
@@ -399,7 +491,7 @@ BUDGET: Typical task should consume 3000-5000 tokens of prizm docs total
399
491
 
400
492
  ## 6.3 L2 Targeted Loading Protocol
401
493
 
402
- L2 docs can be up to 5KB. Loading them in full defeats the purpose of progressive loading.
494
+ L2 docs can be up to 5120 raw UTF-8 bytes. Loading them in full defeats the purpose of progressive loading.
403
495
  Use targeted grep to extract only the sections relevant to your current task:
404
496
 
405
497
  COMMAND_PATTERN:
@@ -421,13 +513,46 @@ EXAMPLES:
421
513
  WHEN: During normal development, run `/prizmkit-retrospective` before commits when structure, interfaces, dependencies, behavior, or durable project knowledge changed. Use `prizmkit-prizm-docs Update` only for out-of-band repair/resync after docs drifted outside the normal development loop.
422
514
  GOAL: Keep prizm docs synchronized with source code without creating multiple competing docs writers.
423
515
 
424
- ## 7.2 Update Decision Logic
425
-
426
- SUMMARY: For normal development, `/prizmkit-retrospective` gets changed files → maps modules → classifies (A/D/M/R) → updates docs bottom-up (L2→L1→L0) → skips if no structural or durable-knowledge impact → enforces size limits → stages. For out-of-band drift, `prizmkit-prizm-docs Update` runs the same repair shape after confirming the drift source.
516
+ ## 7.2 Value Gate
517
+
518
+ QUESTION: Before retaining a candidate fact, ask `Could a future AI that lacks this fact make an incorrect modification?`
519
+ PASS: yes, and the fact is current, durable, non-obvious, actionable for a future modification, and placed at the lowest owning level
520
+ KEEP:
521
+ - non-obvious public/exported interfaces and wire contracts
522
+ - cross-module constraints and non-obvious dependencies
523
+ - traps, side effects, and failure boundaries
524
+ - durable decisions with necessary rationale
525
+ - rejected alternatives likely to recur, with the reason they remain rejected
526
+ - security, data-integrity, concurrency, transaction, and compatibility rules
527
+ REJECT:
528
+ - structure/signatures directly and safely derivable from source
529
+ - task/change/session history and test inventories
530
+ - temporary investigation conclusions and future plans
531
+ - stale statements, duplicated meanings, and synonyms already represented
532
+ - long procedures, generic advice, low-value file lists, line counts, and complexity inventories
533
+ - behavioral content already complete in a child L2
534
+ APPLIES: Init, Update, Rebuild, and Migrate evaluate every candidate through this same gate
535
+
536
+ ## 7.3 Cleanup Gate
537
+
538
+ TRIGGER: Before Update or Rebuild writes an existing target
539
+ STEPS:
540
+ 1. Read the current target and its parent/child pointers; never use append-only synchronization or delete-first regeneration.
541
+ 2. Verify every current fact against source and build the protected set of still-valid contracts, constraints, dependencies, traps, decisions, side effects, and safety/integrity rules.
542
+ 3. Match candidate and existing facts by semantic meaning. Update one equivalent entry in place and merge synonyms instead of appending alternate wording.
543
+ 4. Remove stale, duplicate, source-derivable, low-value, and parent-copied material.
544
+ 5. Add only genuinely new durable facts that pass the Value Gate and have no equivalent entry.
545
+ 6. Reconcile bottom-up: L2 owns behavior; L1 owns concise structure and SUBDIRS/DETAILS pointers; L0 owns the concise project map.
546
+ 7. Measure raw UTF-8 capacity. If automatic remediation is required, follow Section 2.4 and preserve the protected set.
547
+ BLOCK: If protected knowledge cannot fit after safe movement or an unambiguous semantic split, report the blocker and required manual decision; never delete it for capacity.
548
+
549
+ ## 7.4 Update Decision Logic
550
+
551
+ SUMMARY: For normal development, `/prizmkit-retrospective` gets changed files → maps modules → classifies (A/D/M/R) → applies value-aware bottom-up reconciliation (L2→L1→L0) → skips if no structural or durable-knowledge impact → enforces capacity. For out-of-band drift, `prizmkit-prizm-docs Update` applies the governing Value and Cleanup Gates after confirming the drift source.
427
552
 
428
553
  DETAILED_STEPS: → ${SKILL_DIR}/references/op-update.md
429
554
 
430
- ## 7.3 Auxiliary Metadata Policy
555
+ ## 7.5 Auxiliary Metadata Policy
431
556
 
432
557
  NEVER: Add CHANGELOG sections or changelog.prizm during doc sync.
433
558
  NEVER: Add UPDATED/date/time fields to .prizm files.
@@ -444,6 +569,9 @@ NEVER: Prose paragraphs or explanatory text (use KEY: value or bullet lists)
444
569
  NEVER: Code snippets longer than 1 line (reference file_path:line_number instead)
445
570
  NEVER: Human-readable formatting (emoji, ASCII art, markdown tables, horizontal rules)
446
571
  NEVER: Duplicate information across levels (L0 summarizes, L1 indexes structure, L2 details behavior)
572
+ NEVER: Copy complete L2 interfaces, data flow, TRAPS, DECISIONS, or full RULES into L0/L1; keep a concise parent summary and resolving pointer
573
+ NEVER: Retain a candidate fact that fails the future-incorrect-modification Value Gate
574
+ NEVER: Append synonymous entries instead of updating one semantic meaning in place
447
575
  NEVER: Implementation details or behavioral detail in L0 or L1 (INTERFACES, DATA_FLOW, TRAPS, DECISIONS belong in L2 only)
448
576
  NEVER: Stale information (update or delete, never leave outdated entries)
449
577
  NEVER: Full file contents or large code blocks (summarize purpose and interfaces)
@@ -454,6 +582,10 @@ NEVER: CHANGELOG sections, changelog.prizm, or update-history sections
454
582
  NEVER: Flowcharts, diagrams, mermaid blocks, or ASCII art (wastes tokens, AI cannot parse visually)
455
583
  NEVER: Markdown headers (## / ###) inside .prizm files (use ALL CAPS KEY: format instead)
456
584
  NEVER: Rewrite entire .prizm files on update (modify only affected sections)
585
+ NEVER: Delete still-valid critical knowledge merely to cross a capacity threshold
586
+ NEVER: Raise 4096B/4096B/5120B hard limits for project size or trim only to one byte below a limit when automatic remediation is required
587
+ NEVER: Create task-named, numbered, timestamped, colliding, ambiguous, or silently overlapping semantic concern documents
588
+ NEVER: Add L3, a fourth documentation level, a memory state machine, or a fact scoring system
457
589
  NEVER: TRAPS entries without severity prefix ([CRITICAL], [HIGH], or [LOW])
458
590
 
459
591
  ---
@@ -468,7 +600,7 @@ PRECONDITION: No .prizmkit/prizm-docs/ directory exists (or user confirms overwr
468
600
  INPUT: Project root directory
469
601
  OUTPUT: .prizmkit/prizm-docs/ with root.prizm and L1 docs for discovered modules
470
602
 
471
- SUMMARY: Detect project type → discover modules (MODULE_DISCOVERY_CRITERIA) → create mirrored directory structure → generate root.prizm (L0) generate L1 docs → skip L2 (lazy) → configure hook → validate → report.
603
+ SUMMARY: Detect project type → discover modules (MODULE_DISCOVERY_CRITERIA) → apply Value Gate to every candidate → create mirrored directory structure → generate concise root.prizm (L0) and L1 pointer indexes → skip placeholder L2 (lazy) → configure hook → validate format/capacity/pointers → report.
472
604
 
473
605
  DETAILED_STEPS: → ${SKILL_DIR}/references/op-init.md
474
606
 
@@ -485,7 +617,9 @@ A directory does NOT qualify if ALL of the following are true:
485
617
  - Contains only vendored/third-party code
486
618
  - Is in the EXCLUDE list
487
619
 
488
- HIERARCHY RULE: if directory X lives inside top-level module M, X is a sub-module of M — NOT a separate top-level module.
620
+ HIERARCHY RULE: if directory X lives inside top-level module M, X is a sub-module of M — NOT a separate top-level module. Its durable behavioral detail uses the mirrored L2 path. Semantic concern identity is considered only for a flat module under Section 5.4.
621
+
622
+ CAPACITY RULE: use MODULE_GROUPS whenever MODULE_INDEX cannot fit L0 within 4096B. Do not change hard limits for project size. Init does not create semantic or mirrored L2 placeholders; later Update/Rebuild/Migrate may create complete L2 documents when durable knowledge and unambiguous identity exist.
489
623
 
490
624
  EXCLUDE: .git/, node_modules/, vendor/, build/, dist/, __pycache__/, target/, bin/, .claude/, .codebuddy/, .prizmkit/, .prizmkit/prizm-docs/, dev-pipeline/
491
625
 
@@ -499,8 +633,9 @@ ON_MODIFY trigger:
499
633
  AI reads the relevant L2 sections.
500
634
  ELSE:
501
635
  AI reads the target source files as fallback and proceeds with the modification.
502
- - After the change, `/prizmkit-retrospective` creates L2 if the changed files contain meaningful interfaces, data flow, traps, or decisions worth preserving.
503
- - This keeps initialization lightweight while still capturing L2 depth when real change context exists.
636
+ - After the change, `/prizmkit-retrospective` creates L2 only when candidate interfaces, data flow, traps, or decisions pass the Value Gate.
637
+ - Real source submodules retain mirrored paths. A flat-module semantic detail follows Sections 3.3 and 5.4 and blocks on ambiguous concern identity, slug collision, or overlapping ownership.
638
+ - This keeps initialization lightweight while still capturing L2 depth when real durable context exists.
504
639
 
505
640
  ON_DEEP_READ trigger:
506
641
  - When AI needs to deeply understand a module but not modify it (e.g., code review, architecture analysis, dependency tracing, explaining complex logic):