prizmkit 1.1.156 → 1.1.160

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 (92) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/codebuddy/settings-adapter.js +76 -25
  3. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +9 -2
  4. package/bundled/dev-pipeline/prizmkit_runtime/reset.py +1 -1
  5. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +20 -11
  6. package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +42 -15
  7. package/bundled/dev-pipeline/scripts/update-feature-status.py +7 -0
  8. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +1 -1
  9. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +1 -1
  10. package/bundled/dev-pipeline/templates/sections/runtime-commit-handoff.md +6 -6
  11. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +4 -3
  12. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +2 -2
  13. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +2 -2
  14. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +115 -4
  15. package/bundled/dev-pipeline/tests/test_reset_modes.py +137 -0
  16. package/bundled/dev-pipeline/tests/test_runtime_commit.py +68 -13
  17. package/bundled/dev-pipeline/tests/test_unified_cli.py +12 -7
  18. package/bundled/rules/prizm/prizm-commit-workflow.md +7 -7
  19. package/bundled/rules/prizm/prizm-documentation.md +24 -65
  20. package/bundled/rules/prizm/prizm-progressive-loading.md +9 -8
  21. package/bundled/skills/_metadata.json +1 -1
  22. package/bundled/skills/prizmkit/SKILL.md +1 -13
  23. package/bundled/skills/prizmkit-code-review/SKILL.md +29 -10
  24. package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +5 -4
  25. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +15 -0
  26. package/bundled/skills/prizmkit-code-review/scripts/render_review_report.py +61 -0
  27. package/bundled/skills/prizmkit-committer/SKILL.md +50 -38
  28. package/bundled/skills/prizmkit-deploy/SKILL.md +172 -198
  29. package/bundled/skills/prizmkit-deploy/references/capability-contract.md +137 -0
  30. package/bundled/skills/prizmkit-deploy/references/deploy-record-schema.json +1053 -0
  31. package/bundled/skills/prizmkit-deploy/references/deployment-declaration-schema.json +291 -0
  32. package/bundled/skills/prizmkit-deploy/references/legacy-migration.md +90 -0
  33. package/bundled/skills/prizmkit-deploy/references/policy-and-execution.md +170 -0
  34. package/bundled/skills/prizmkit-deploy/references/real-resource-test-policy.md +73 -0
  35. package/bundled/skills/prizmkit-deploy/references/verification-and-recovery.md +164 -0
  36. package/bundled/skills/prizmkit-deploy/scripts/validate-deploy-artifact.py +371 -0
  37. package/bundled/skills/prizmkit-implement/SKILL.md +2 -2
  38. package/bundled/skills/prizmkit-init/SKILL.md +38 -42
  39. package/bundled/skills/prizmkit-init/references/config-schema.md +11 -7
  40. package/bundled/skills/prizmkit-init/references/rules/layer-detection.md +3 -3
  41. package/bundled/skills/prizmkit-init/references/update-supplement.md +5 -5
  42. package/bundled/skills/prizmkit-plan/SKILL.md +5 -4
  43. package/bundled/skills/prizmkit-plan/assets/plan-template.md +4 -1
  44. package/bundled/skills/prizmkit-plan/references/verification-checklist.md +3 -2
  45. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +17 -11
  46. package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +95 -155
  47. package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +6 -5
  48. package/bundled/skills/prizmkit-prizm-docs/references/op-rebuild.md +4 -2
  49. package/bundled/skills/prizmkit-prizm-docs/references/op-status.md +9 -10
  50. package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +6 -5
  51. package/bundled/skills/prizmkit-prizm-docs/references/op-validate.md +13 -12
  52. package/bundled/skills/prizmkit-retrospective/SKILL.md +3 -3
  53. package/bundled/skills/prizmkit-test/SKILL.md +26 -13
  54. package/bundled/skills/prizmkit-test/references/boundary-contract-and-test-double-guidance.md +8 -4
  55. package/bundled/skills/prizmkit-test/references/independent-test-review.md +7 -3
  56. package/bundled/skills/prizmkit-test/references/test-coverage-model.md +33 -10
  57. package/bundled/skills/prizmkit-test/references/test-report-template.md +33 -11
  58. package/bundled/skills/prizmkit-workflow/SKILL.md +33 -3
  59. package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +23 -5
  60. package/bundled/templates/hooks/commit-intent-status.py +9 -41
  61. package/bundled/templates/hooks/commit-intent.json +3 -3
  62. package/bundled/templates/hooks/diff-prizm-docs.py +3 -1
  63. package/bundled/templates/hooks/prizm-pre-commit.py +32 -6
  64. package/bundled/templates/hooks/run-python-hook.cjs +44 -0
  65. package/bundled/templates/hooks/validate-prizm-docs.py +399 -173
  66. package/bundled/templates/project-memory-template.md +19 -19
  67. package/package.json +1 -1
  68. package/src/clean.js +6 -7
  69. package/src/gitignore-template.js +8 -12
  70. package/src/scaffold.js +125 -71
  71. package/bundled/skills/prizmkit/references/workflow-state-protocol.md +0 -178
  72. package/bundled/skills/prizmkit-deploy/assets/deploy-document-template.md +0 -89
  73. package/bundled/skills/prizmkit-deploy/references/ci-cd-workflows.md +0 -145
  74. package/bundled/skills/prizmkit-deploy/references/cloud-platform-deploy.md +0 -109
  75. package/bundled/skills/prizmkit-deploy/references/data-safety-examples.md +0 -120
  76. package/bundled/skills/prizmkit-deploy/references/database-setup.md +0 -65
  77. package/bundled/skills/prizmkit-deploy/references/deploy-config-schema.md +0 -150
  78. package/bundled/skills/prizmkit-deploy/references/deploy-history-schema.md +0 -78
  79. package/bundled/skills/prizmkit-deploy/references/deploy-metadata-schema.json +0 -49
  80. package/bundled/skills/prizmkit-deploy/references/deployment-modes.md +0 -50
  81. package/bundled/skills/prizmkit-deploy/references/direct-upload.md +0 -26
  82. package/bundled/skills/prizmkit-deploy/references/dns-setup.md +0 -42
  83. package/bundled/skills/prizmkit-deploy/references/docker-deploy.md +0 -31
  84. package/bundled/skills/prizmkit-deploy/references/firewall-setup.md +0 -37
  85. package/bundled/skills/prizmkit-deploy/references/live-validation-notes.md +0 -21
  86. package/bundled/skills/prizmkit-deploy/references/nginx-blue-green.md +0 -59
  87. package/bundled/skills/prizmkit-deploy/references/pending-input-schema.json +0 -164
  88. package/bundled/skills/prizmkit-deploy/references/ssh-adapter-flow.md +0 -221
  89. package/bundled/skills/prizmkit-deploy/references/ssh-bootstrap-flow.md +0 -49
  90. package/bundled/skills/prizmkit-deploy/references/ssh-execution-flow.md +0 -41
  91. package/bundled/skills/prizmkit-deploy/references/ssh-takeover.md +0 -20
  92. package/bundled/skills/prizmkit-deploy/references/ssl-setup.md +0 -56
@@ -29,12 +29,12 @@ LICENSE: MIT
29
29
 
30
30
  WHAT: Prizm is a self-maintaining documentation system where AI reads, generates, updates, and loads project context progressively.
31
31
  WHY: Reduce AI hallucinations, minimize token waste, ensure AI has accurate project knowledge at all times.
32
- HOW: Three-level progressive loading (L0 -> L1 -> L2) with conditional retrospective before commits when code changes affect structure, interfaces, dependencies, behavior, or durable project knowledge.
32
+ HOW: Three-level progressive loading (L0 -> L1 -> L2) with task-scoped retrospective when code changes affect structure, interfaces, dependencies, behavior, or durable project knowledge.
33
33
 
34
34
  CORE_PRINCIPLES:
35
35
  - Token efficiency over human readability
36
36
  - Progressive disclosure (load only what is needed)
37
- - Self-updating (docs stay fresh via commit-time hooks)
37
+ - Self-maintaining (framework owners reconcile managed docs without owning project Git policy)
38
38
  - Universal (language and framework agnostic)
39
39
  - Durable project knowledge over auxiliary history (decisions, traps, interfaces, dependencies)
40
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
@@ -56,71 +56,59 @@ CORE_PRINCIPLES:
56
56
 
57
57
  LEVELS:
58
58
  - L0: Root index. ALWAYS loaded at session start. Hard limit 4096 raw UTF-8 bytes.
59
- FILE: .prizmkit/prizm-docs/root.prizm
59
+ FILE: exact .prizmkit/prizm-docs/root.prizm only
60
60
  CONTAINS: concise project meta, module summaries with pointers, build commands, tech stack, top rules
61
61
  DOES NOT CONTAIN: child-owned interfaces, data flow, TRAPS, DECISIONS, full rules, or copied behavioral detail
62
62
 
63
63
  - L1: Structural index. Loaded ON DEMAND when AI works in a module area. Hard limit 4096 raw UTF-8 bytes each.
64
- FILE: .prizmkit/prizm-docs/<mirrored-path>.prizm (mirrors source directory structure)
64
+ FILE: direct .prizm child of .prizmkit/prizm-docs/, excluding exact root.prizm
65
65
  CONTAINS: concise module responsibility, source submodule pointers, semantic detail pointers, key navigation files, dependency summary, critical rules summary (1-3 only)
66
66
  DOES NOT CONTAIN: interface signatures, data flow, TRAPS, DECISIONS, full rules, or content already complete in L2
67
67
 
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
68
+ - L2: Behavioral detail. Loaded completely before modifying its owned source or when deep understanding is required. Hard limit 5120 raw UTF-8 bytes each.
69
+ FILE: every nested .prizm document below .prizmkit/prizm-docs/, whether mirrored source detail or semantic concern
70
70
  CONTAINS: Value-Gate-qualified public interfaces, data flow, rules, TRAPS, DECISIONS, domain-specific sections, and rejected approaches
71
71
  IDENTITY: a real source submodule path takes precedence; a semantic concern remains an L2 document and never adds a level
72
72
 
73
+ PATH_CLASSIFICATION: Classification depends only on the repository-relative document path: exact root is L0, direct document children are L1, and nested documents are L2. Source depth, filename, module size, and Git state never change the level.
74
+
73
75
  ## 2.2 Directory Layout
74
76
 
75
- STRUCTURE: Mirrors source tree under .prizmkit/prizm-docs/
77
+ STRUCTURE: Direct L1 documents index top-level source modules; nested L2 documents mirror owned source submodules or stable semantic concerns.
76
78
 
77
79
  EXAMPLE (Go project):
78
80
  .prizmkit/prizm-docs/
79
81
  root.prizm # L0
82
+ internal.prizm # L1 for internal/
80
83
  internal/
81
- logic.prizm # L1 for internal/logic/
82
- model.prizm # L1 for internal/model/
83
- repo.prizm # L1 for internal/repo/
84
- service.prizm # L1 for internal/service/
85
- common.prizm # L1 for internal/common/
86
- logic/
87
- statemachine.prizm # L2 for internal/logic/statemachine/
88
- session.prizm # L2 for internal/logic/session/
89
- ivr.prizm # L2 for internal/logic/ivr/
90
- repo/
91
- rpc.prizm # L2 for internal/repo/rpc/
92
- store.prizm # L2 for internal/repo/store/
93
- service/
94
- http.prizm # L2 for internal/service/http/
95
- sso.prizm # L2 for internal/service/sso/
84
+ logic.prizm # L2 for internal/logic/
85
+ model.prizm # L2 for internal/model/
86
+ repo.prizm # L2 for internal/repo/
87
+ service.prizm # L2 for internal/service/
96
88
 
97
89
  EXAMPLE (JS/TS project):
98
90
  .prizmkit/prizm-docs/
99
91
  root.prizm # L0
92
+ src.prizm # L1 for src/
100
93
  src/
101
- components.prizm # L1 for src/components/
102
- hooks.prizm # L1 for src/hooks/
103
- services.prizm # L1 for src/services/
104
- components/
105
- auth.prizm # L2 for src/components/auth/
106
- dashboard.prizm # L2 for src/components/dashboard/
94
+ components.prizm # L2 for src/components/
95
+ hooks.prizm # L2 for src/hooks/
96
+ services.prizm # L2 for src/services/
107
97
 
108
98
  EXAMPLE (Python project):
109
99
  .prizmkit/prizm-docs/
110
100
  root.prizm # L0
101
+ app.prizm # L1 for app/
111
102
  app/
112
- models.prizm # L1 for app/models/
113
- views.prizm # L1 for app/views/
114
- services.prizm # L1 for app/services/
115
- services/
116
- payment.prizm # L2 for app/services/payment/
117
- cross-cutting/ # Optional: cross-module concern details
118
- auth.prizm # L2-style doc for cross-cutting auth concern
103
+ models.prizm # L2 for app/models/
104
+ views.prizm # L2 for app/views/
105
+ services.prizm # L2 for app/services/
119
106
 
120
- ## 2.3 Git Configuration
107
+ ## 2.3 Framework Directory and Git Neutrality
121
108
 
122
- COMMIT: .prizmkit/prizm-docs/ MUST be committed to git alongside source code
123
- RATIONALE: .prizmkit/prizm-docs/ is shared project knowledge that all team members (human and AI) benefit from.
109
+ FRAMEWORK_DIRECTORY: `.prizmkit/**` contains PrizmKit-managed capabilities and artifacts; an owning framework capability may read or write its exact managed paths.
110
+ GIT_POLICY: The project alone decides whether `.prizmkit/**` paths are ignored, untracked, or tracked. Documentation generation, reconciliation, and validation do not add, remove, force-add, stage, commit, or interpret `.gitignore` entries and do not treat tracking state as a documentation error.
111
+ CONSISTENCY: Managed documentation behavior is identical across ignored, untracked, and tracked states apart from ordinary Git visibility.
124
112
 
125
113
  ## 2.4 Capacity Classification and Remediation
126
114
 
@@ -175,9 +163,8 @@ TEMPLATE:
175
163
  - infra: <infrastructure: databases, queues, caches, etc.>
176
164
 
177
165
  MODULE_INDEX:
178
- - <source-path>: <file-count> files. <one-line description>. -> .prizmkit/prizm-docs/<mirrored-path>.prizm
179
- (Multi-level entries allowed for efficient navigation. No hard depth limit constrained by L0 4KB.
180
- If navigating from L0 to a target module requires 3+ hops, add intermediate entries here.)
166
+ - <top-level-source-module>: <file-count> files. <one-line description>. -> .prizmkit/prizm-docs/<module>.prizm
167
+ (Every root pointer resolves to one direct-child L1. L1 then resolves only the relevant nested L2 pointers.)
181
168
 
182
169
  ENTRY_POINTS:
183
170
  - <name>: <file-path> (<protocol/port if applicable>)
@@ -203,7 +190,7 @@ CONSTRAINTS:
203
190
  - Hard limit 4096 raw UTF-8 bytes; project size never raises it
204
191
  - Every line must be a KEY: value pair or a list item
205
192
  - MODULE_INDEX must have arrow pointer (->) for every entry
206
- - MODULE_INDEX may list entries at any depth needed for efficient navigation (no hard depth limit)
193
+ - MODULE_INDEX and MODULE_GROUPS entries point to direct-child L1 documents only
207
194
  - RULES limited to 5-10 most critical conventions
208
195
  - No prose paragraphs
209
196
  - root.prizm RULES are AUTHORITATIVE: they override any conflicting L1/L2 RULES
@@ -365,7 +352,7 @@ CONSTRAINTS:
365
352
 
366
353
  ## 3.4 Metadata Policy
367
354
 
368
- TEMPORAL_INFO: Git history is the authoritative source for change timing and edit history.
355
+ TEMPORAL_INFO: Change timing and edit history are outside Prizm memory; use project history when the project provides it.
369
356
  AUXILIARY_FIELDS: Do not generate CHANGELOG or UPDATED fields in .prizm files.
370
357
  WORKFLOW_METADATA: Do not write feature/bug/refactor/task/session/run/pipeline/workflow IDs, branch names, absolute worktree paths, or `.prizmkit/specs` / `.prizmkit/dev-pipeline` artifact paths into .prizm files.
371
358
  RATIONALE: Keep project memory focused on durable architecture, interfaces, dependencies, traps, rules, and decisions.
@@ -380,7 +367,7 @@ LISTS: Dash-space prefix for items within a section (- item)
380
367
  POINTERS: Arrow notation (->) to reference other .prizm files
381
368
  NESTING: Indent 2 spaces for sub-keys within a section
382
369
  COMMENTS: None. Every line carries information. No comments in .prizm files.
383
- TIMESTAMPS: No date/time fields in .prizm files. Git is the authoritative source for temporal information. Use `git log` or `git blame` on .prizm files when needed.
370
+ TIMESTAMPS: No date/time fields in .prizm files. Temporal history is outside Prizm memory and is never required for documentation operation.
384
371
 
385
372
  ---
386
373
 
@@ -388,30 +375,31 @@ TIMESTAMPS: No date/time fields in .prizm files. Git is the authoritative source
388
375
 
389
376
  ## 5.1 Mapping Algorithm
390
377
 
391
- RULE: Mirror the source directory tree under .prizmkit/prizm-docs/
392
- RULE: L1 file for directory D = .prizmkit/prizm-docs/<D>.prizm
393
- RULE: L2 file for subdirectory D/S = .prizmkit/prizm-docs/<D>/<S>.prizm
394
- RULE: Root index = .prizmkit/prizm-docs/root.prizm (always)
378
+ RULE: Root index = exact .prizmkit/prizm-docs/root.prizm (L0)
379
+ RULE: L1 for top-level source module M = direct child .prizmkit/prizm-docs/<M>.prizm
380
+ RULE: Mirrored L2 for source submodule M/S = nested .prizmkit/prizm-docs/<M>/<S>.prizm
381
+ RULE: Semantic L2 for a stable flat-module concern = nested .prizmkit/prizm-docs/<M>/<concern-slug>.prizm
382
+ RULE: Nested source depth never creates L3; the owning nested document remains L2 and uses explicit MODULE/FILES identity
395
383
 
396
384
  ## 5.2 Examples
397
385
 
398
- SOURCE_PATH L1_PRIZM_FILE L2_PRIZM_FILES
399
- internal/logic/ .prizmkit/prizm-docs/internal/logic.prizm .prizmkit/prizm-docs/internal/logic/*.prizm
400
- internal/logic/session/ (described in L1 logic.prizm SUBDIRS) .prizmkit/prizm-docs/internal/logic/session.prizm
401
- internal/repo/store/ (described in L1 repo.prizm SUBDIRS) .prizmkit/prizm-docs/internal/repo/store.prizm
402
- src/components/ .prizmkit/prizm-docs/src/components.prizm .prizmkit/prizm-docs/src/components/*.prizm
403
- src/components/auth/ (described in L1 components.prizm) .prizmkit/prizm-docs/src/components/auth.prizm
404
- app/services/ .prizmkit/prizm-docs/app/services.prizm .prizmkit/prizm-docs/app/services/*.prizm
386
+ SOURCE_PATH L1_PRIZM_FILE L2_PRIZM_FILE
387
+ internal/ .prizmkit/prizm-docs/internal.prizm none until durable detail exists
388
+ internal/logic/ (parent L1 SUBDIRS pointer) .prizmkit/prizm-docs/internal/logic.prizm
389
+ src/ .prizmkit/prizm-docs/src.prizm none until durable detail exists
390
+ src/components/ (parent L1 SUBDIRS pointer) .prizmkit/prizm-docs/src/components.prizm
391
+ app/ .prizmkit/prizm-docs/app.prizm none until durable detail exists
392
+ app/services/ (parent L1 SUBDIRS pointer) .prizmkit/prizm-docs/app/services.prizm
405
393
 
406
394
  ## 5.3 Discovery Rule
407
395
 
408
396
  FOR any source file at path P:
409
- 1. Walk up directory tree to find the first ancestor D where .prizmkit/prizm-docs/<D>.prizm exists
410
- 2. That file is the L1 doc for this source file
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)
397
+ 1. Resolve its top-level source module M through the root MODULE_INDEX or MODULE_GROUPS pointer to direct-child L1 `.prizmkit/prizm-docs/<M>.prizm`
398
+ 2. Read that complete L1 and resolve the one mirrored SUBDIRS or semantic DETAILS pointer that owns P
399
+ 3. Mirrored source-submodule identity has precedence; for a flat module, semantic FILES ownership selects the detail
400
+ 4. Before modifying P, read the complete selected L2 and complete resolving parent/child pointer documents
401
+ 5. If ownership is absent, overlaps, or disagrees with its pointer, report ambiguity instead of guessing
402
+ 6. If no relevant L2 exists, inspect only the bounded source files needed for P and proceed without creating a placeholder; documentation creation remains an owning retrospective/repair operation
415
403
 
416
404
  ## 5.4 Deterministic Semantic Concern Identity
417
405
 
@@ -450,59 +438,42 @@ POINTER_RESOLUTION:
450
438
  ## 6.1 When to Load
451
439
 
452
440
  ON_SESSION_START:
453
- ALWAYS: Read .prizmkit/prizm-docs/root.prizm (L0) if it exists
441
+ ALWAYS: Read exact .prizmkit/prizm-docs/root.prizm (L0) if it exists
454
442
  PURPOSE: Get the project map, understand architecture, know where to look
455
443
 
456
444
  ON_TASK_RECEIVED:
457
445
  IF task references specific file or directory:
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
460
- IF task is broad (e.g., "refactor auth", "improve performance"):
461
- LOAD: L1 for all matching modules from MODULE_INDEX
462
- IF task is exploratory (e.g., "explain the codebase", "how does X work"):
463
- LOAD: L0 only, then navigate via pointers as needed
464
- IF task is cross-cutting (e.g., "add logging everywhere"):
465
- LOAD: L1 for affected modules, check DEPENDENCIES.imported-by and CROSS_CUTTING in root.prizm
446
+ LOAD_COMPLETE: direct-child L1 for the containing top-level module
447
+ RESOLVE: the mirrored SUBDIRS pointer first; for a flat module, use the one DETAILS pointer whose semantic L2 FILES ownership contains the source file
448
+ IF task is broad:
449
+ LOAD_COMPLETE: only matching direct-child L1 documents from MODULE_INDEX or MODULE_GROUPS
450
+ IF task is exploratory:
451
+ LOAD: L0 only, then navigate through resolving pointers as needed
452
+ IF task is cross-cutting:
453
+ LOAD_COMPLETE: direct-child L1 documents for affected modules and only their relevant L2 details
466
454
 
467
455
  ON_FILE_MODIFICATION:
468
456
  BEFORE editing any source file:
469
- TARGETED LOAD from L2 (NEVER read the entire L2 file use grep to extract only needed sections):
470
- 1. Use Grep tool to search for "^TRAPS:" in the L2 doc, read that section (prevent known mistakes)
471
- 2. Use Grep tool to search for "^DECISIONS:" and "^REJECTED:", read those sections (understand prior choices)
472
- 3. Use Grep tool to search for "^INTERFACES:" if you need to understand the public API contract
473
- Only load additional L2 sections if the task specifically requires them.
474
- IF L2 does not exist: GENERATE L2 from source code analysis, then extract needed sections
457
+ 1. Read the complete relevant L2 document when it exists; partial grep fragments cannot establish all traps, decisions, interfaces, and ownership constraints.
458
+ 2. Read the complete direct L1 and any complete parent/child documents needed to resolve the selected SUBDIRS or DETAILS pointer in both directions.
459
+ 3. Do not load unrelated L1/L2 documents.
460
+ 4. If relevant L2 is absent, inspect only the bounded target source files and narrowly implicated callers/contracts needed for the modification. Proceed without creating a placeholder.
475
461
 
476
462
  ON_DEEP_READ:
477
- WHEN AI needs deep understanding of a module WITHOUT modifying it:
478
- TARGETED LOAD from L2 using grep (same approach as ON_FILE_MODIFICATION)
479
- IF L2 does not exist: GENERATE L2 from source code analysis, then extract needed sections
480
- USE_CASES: code review, architecture analysis, dependency tracing, explaining complex logic
463
+ WHEN deep understanding is required without modification:
464
+ READ_COMPLETE: the relevant L2 and resolving pointer documents
465
+ IF L2 is absent: inspect bounded relevant source without creating documentation merely because it was read
481
466
 
482
467
  ## 6.2 Loading Rules
483
468
 
484
- NEVER: Load all L1 and L2 docs at session start (defeats progressive loading)
485
- NEVER: Read entire L2 files always use grep/search to extract only the sections you need
486
- NEVER: Load L2 for modules not being modified or deeply analyzed (wastes context window)
487
- NEVER: Skip L0 (it is the map for everything else)
488
- PREFER: Load L1 before L2 (understand module context before diving into details)
489
- PREFER: Load minimum docs and minimum sections needed for the task
490
- BUDGET: Typical task should consume 3000-5000 tokens of prizm docs total
491
-
492
- ## 6.3 L2 Targeted Loading Protocol
493
-
494
- L2 docs can be up to 5120 raw UTF-8 bytes. Loading them in full defeats the purpose of progressive loading.
495
- Use targeted grep to extract only the sections relevant to your current task:
496
-
497
- COMMAND_PATTERN:
498
- Grep tool with pattern "^SECTION_NAME:" and context lines (-A flag) to read a specific section.
499
- Stop reading at the next ALL-CAPS section header.
500
-
501
- EXAMPLES:
502
- - Before editing a file: grep for "^TRAPS:" and "^DECISIONS:" sections
503
- - Before changing an API: grep for "^INTERFACES:" section
504
- - Before modifying data handling: grep for "^DATA_FLOW:" section
505
- - For full module understanding (rare): read the entire L2 (only when task explicitly requires comprehensive analysis)
469
+ NEVER: Load all L1 and L2 docs at session start
470
+ NEVER: Use grep-only fragments as modification context for a relevant L2
471
+ NEVER: Load L2 for unrelated modules
472
+ NEVER: Skip exact root when it exists
473
+ NEVER: Create placeholder L2 during context loading
474
+ MUST: Read relevant L2 and resolving pointer documents completely before source modification
475
+ PREFER: Navigate root -> direct L1 -> nested L2
476
+ PREFER: Keep source fallback bounded to the target and concrete dependency ambiguity
506
477
 
507
478
  ---
508
479
 
@@ -510,7 +481,7 @@ EXAMPLES:
510
481
 
511
482
  ## 7.1 Trigger
512
483
 
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.
484
+ WHEN: During the normal formal lifecycle, run `/prizmkit-retrospective` after validated source changes 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.
514
485
  GOAL: Keep prizm docs synchronized with source code without creating multiple competing docs writers.
515
486
 
516
487
  ## 7.2 Value Gate
@@ -557,7 +528,7 @@ DETAILED_STEPS: → ${SKILL_DIR}/references/op-update.md
557
528
  NEVER: Add CHANGELOG sections or changelog.prizm during doc sync.
558
529
  NEVER: Add UPDATED/date/time fields to .prizm files.
559
530
  NEVER: Add workflow metadata such as feature/bug/refactor/task/session/run/pipeline/workflow IDs, branch names, absolute worktree paths, or `.prizmkit/specs` / `.prizmkit/dev-pipeline` artifact paths.
560
- RATIONALE: Git already provides history; .prizm files should store only durable project memory.
531
+ RATIONALE: Temporal and workflow history is outside Prizm memory; .prizm files store only durable project knowledge regardless of Git tracking policy.
561
532
 
562
533
  ---
563
534
 
@@ -621,7 +592,8 @@ HIERARCHY RULE: if directory X lives inside top-level module M, X is a sub-modul
621
592
 
622
593
  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.
623
594
 
624
- EXCLUDE: .git/, node_modules/, vendor/, build/, dist/, __pycache__/, target/, bin/, .claude/, .codebuddy/, .prizmkit/, .prizmkit/prizm-docs/, dev-pipeline/
595
+ EXCLUDE: .git/, node_modules/, vendor/, build/, dist/, __pycache__/, target/, bin/, .claude/, .codebuddy/, .codex/, .agents/, .pi/, .prizmkit/
596
+ SOURCE_BOUNDARY: Excluding `.prizmkit/` excludes the installed Runtime at `.prizmkit/dev-pipeline/`; never exclude a repository's canonical top-level `dev-pipeline/` source module by basename.
625
597
 
626
598
  ## 9.2 Post-Init Behavior
627
599
 
@@ -630,9 +602,9 @@ After initialization, L2 docs are created incrementally by retrospective when ch
630
602
  ON_MODIFY trigger:
631
603
  - Before editing a file in sub-module S within module M:
632
604
  IF .prizmkit/prizm-docs/<M>/<S>.prizm exists:
633
- AI reads the relevant L2 sections.
605
+ AI reads the complete L2 plus complete resolving pointer documents.
634
606
  ELSE:
635
- AI reads the target source files as fallback and proceeds with the modification.
607
+ AI reads bounded relevant source files as fallback, creates no placeholder, and proceeds with the modification.
636
608
  - After the change, `/prizmkit-retrospective` creates L2 only when candidate interfaces, data flow, traps, or decisions pass the Value Gate.
637
609
  - 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
610
  - This keeps initialization lightweight while still capturing L2 depth when real durable context exists.
@@ -666,54 +638,22 @@ OPERATIONS (all invoked via the prizmkit-prizm-docs skill):
666
638
 
667
639
  ## 11.1 Mechanism
668
640
 
669
- HOOK_TYPE: command (shell echo, fast and reliable)
670
- EVENT: UserPromptSubmit
671
- BEHAVIOR: When matcher detects commit-related keywords, echoes doc update reminder as stdout
672
- INJECTION: stdout content is injected into AI's context as a system-reminder
673
- NOTE: Previously used type: prompt (LLM-evaluated), but switched to type: command for reliability — prompt type is prone to timeout and JSON format errors
674
-
675
- ## 11.2 Configuration Template
676
-
677
- Place in: .codebuddy/settings.json (project-level)
678
-
679
- JSON:
680
- {
681
- "hooks": {
682
- "UserPromptSubmit": [
683
- {
684
- "matcher": "(?i)\\b(commit|push|finish|ship|merge|pull request|pr)\\b",
685
- "hooks": [
686
- {
687
- "type": "command",
688
- "command": "echo 'PRIZMKIT_MAINTENANCE_CHECK: Before committing, check whether /prizmkit-retrospective applies. Run it when this change affects structure, interfaces, dependencies, behavior, or durable TRAPS/RULES/DECISIONS. Skip it for direct edits with no docs impact. Then proceed with /prizmkit-committer for the actual git commit.'"
689
- }
690
- ]
691
- }
692
- ]
693
- }
694
- }
695
-
696
- ## 11.3 How It Works
697
-
698
- FLOW:
699
- 1. User types prompt (e.g., "commit these changes" or "push to main")
700
- 2. UserPromptSubmit hook fires, matcher regex checks for commit-related keywords
701
- 3. IF matcher matches: command hook runs echo, stdout is injected as system-reminder
702
- - AI sees the update instructions and executes them before committing
703
- 4. IF matcher does not match: hook does not fire, AI proceeds normally
704
-
705
- KEYWORDS_DETECTED: commit, push, finish, done, ship, merge, PR, pull request, /commit, save changes
706
-
707
- ## 11.4 Adapting for Other AI Tools
708
-
709
- The hook configuration above is specific to CodeBuddy Code.
710
- For other AI coding assistants:
711
- - Cursor: Use .cursorrules file to add the conditional retrospective protocol as a rule
712
- - Aider: Use .aider.conf.yml conventions section
713
- - Continue: Use .continue/config.json customInstructions
714
- - Generic: Add the conditional retrospective protocol text to whatever system prompt or rules file the tool supports
715
-
716
- The core requirement is: before commit, AI must check whether affected `.prizmkit/prizm-docs/` files need retrospective updates. Run `/prizmkit-retrospective` when the change affects structure, interfaces, dependencies, behavior, or durable TRAPS/RULES/DECISIONS; skip it for direct edits with no docs impact.
641
+ VALIDATION_HOOK: The installed pre-commit hook invokes the canonical Python validator through host-neutral interpreter resolution only when staged Prizm documents exist.
642
+ FAILURE: If staged Prizm documents require validation, unavailable validator/interpreter and nonzero validation are fail-closed. With no staged Prizm documents, the hook is a no-op.
643
+ SNAPSHOT: `--staged` validates index blobs and complete index pointer context; it never substitutes unstaged working bytes.
644
+ MAINTENANCE_HOOK: Commit-intent and post-command hooks may remind about the owning retrospective/repair capability, but never stage, force-add, commit, modify ignore policy, require tracking, or append changelog content.
645
+ INSTALLATION: Upgrade replaces only deterministic PrizmKit-managed hook entries/blocks and preserves user-owned settings and hook behavior.
646
+
647
+ ## 11.2 Host-Neutral Invocation
648
+
649
+ COMMAND: Installed settings invoke `.prizmkit/scripts/run-python-hook.cjs`, which resolves an available Python 3 launcher and propagates the real script exit status.
650
+ PORTABILITY: Platform/provider names and direct `python3` assumptions are not protocol identifiers. A missing candidate may fall through to another supported Python 3 launcher; a real validation failure is never retried as if the interpreter were missing.
651
+
652
+ ## 11.3 Git Neutrality
653
+
654
+ RULE: Hooks validate only Git-visible staged documentation already selected by the project/user. They never make ignored files visible and never infer that `.prizmkit/**` must be tracked or ignored.
655
+ RULE: Commit-intent output is maintenance guidance, not staging or commit authorization.
656
+ RULE: No hook adds CHANGELOG content or invokes broad `git add .`, `git add -A`, or force-add.
717
657
 
718
658
  ---
719
659
 
@@ -9,9 +9,9 @@ STEPS:
9
9
  2. Discover modules using MODULE_DISCOVERY_CRITERIA:
10
10
  - A directory qualifies as a module if it contains source files forming a logical unit, contains entry/config/interface files, contains qualifying sub-modules, or is referenced by multiple modules as a dependency.
11
11
  - TOP-LEVEL modules: directories directly under project root (or under src/ for src-based layouts) that qualify.
12
- - SUB-MODULES: directories INSIDE a top-level module that qualify. Record them as source structure in the parent L1; if durable L2 is created later, its path mirrors the sub-module.
13
- - HIERARCHY RULE: directory X inside top-level module M maps to `.prizmkit/prizm-docs/<M>/<X>.prizm`, never to `.prizmkit/prizm-docs/<X>.prizm`.
14
- - Exclude .git/, node_modules/, vendor/, build/, dist/, __pycache__/, target/, bin/, .claude/, .codebuddy/, .prizmkit/, .prizmkit/prizm-docs/, dev-pipeline/. If total module count > 30, ask user for include/exclude patterns.
12
+ - SUB-MODULES: directories INSIDE a top-level module that qualify. Record them as source structure in the direct-child parent L1; if durable L2 is created later, its nested path mirrors the sub-module.
13
+ - HIERARCHY RULE: exact `root.prizm` is L0; top-level module M maps to direct-child `.prizmkit/prizm-docs/<M>.prizm` (L1); directory X inside M maps to nested `.prizmkit/prizm-docs/<M>/<X>.prizm` (L2). Deeper source ownership remains L2 and never creates L3.
14
+ - Exclude .git/, node_modules/, vendor/, build/, dist/, __pycache__/, target/, bin/, .claude/, .codebuddy/, .codex/, .agents/, .pi/, and the complete `.prizmkit/` framework directory. This excludes installed `.prizmkit/dev-pipeline/` artifacts but never excludes a repository's canonical top-level `dev-pipeline/` source module by basename. If total module count > 30, ask user for include/exclude patterns.
15
15
  3. Apply the Value Gate from SKILL.md and the format specification to every metadata, rule, pattern, dependency, file, and summary candidate. Keep navigational structure only when needed to locate ownership. Reject source-derivable signatures, history, test inventories, temporary conclusions, stale/duplicate meanings, procedures, and low-value file lists.
16
16
  4. Create `.prizmkit/prizm-docs/` and only the mirrored directories needed by documents that will exist. Do not create placeholder detail files.
17
17
  5. Generate `root.prizm` (L0) with concise PROJECT, LANG, FRAMEWORK, BUILD, TEST, ENTRY, navigation pointers, and only Value-Gate-qualified global RULES/PATTERNS/CROSS_CUTTING facts. Set `PRIZM_VERSION: 4`. Keep L0 a summary/pointer map; never copy child interfaces, data flow, traps, decisions, or full rules. 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.
@@ -23,7 +23,8 @@ STEPS:
23
23
  8. Measure every generated file with the canonical raw UTF-8 capacity classifier: L0/L1 4096B, L2 5120B. Report warning-range files without failing. If a generated L0/L1 reaches 90% or above, clean or reorganize it toward 3277-3686B without deleting protected knowledge. Any unresolved hard-limit error blocks Init.
24
24
  9. Configure UserPromptSubmit hook in platform settings per `${SKILL_DIR}/assets/prizm-docs-format.md` Section 11.
25
25
  10. Validate all generated docs: Value Gate, size/band reporting, pointer resolution, no circular dependencies, KEY: value format, parent-summary boundary, no anti-patterns, and no prohibited metadata. Warning-only capacity results pass; hard-limit or format errors fail.
26
- 11. Report modules discovered, L1 docs generated, files/categories omitted by the Value Gate, files excluded, capacity diagnostics in descending utilization, and any required manual decisions.
26
+ 11. Write only complete validated candidates bottom-up, compare bytes before replacement, re-read actual bytes, and restore exact pre-write bytes or remove invalid new targets if a post-write check fails.
27
+ 12. Report modules discovered, L1 docs generated, files/categories omitted by the Value Gate, files excluded, capacity diagnostics in descending utilization, and any required manual decisions. Do not stage, commit, force-add, change ignore policy, require history, or report tracking state as documentation health.
27
28
 
28
29
  OUTPUT: List of generated files, module count, Value-Gate omissions by category, capacity results, and validation results.
29
30
 
@@ -32,7 +33,7 @@ OUTPUT: List of generated files, module count, Value-Gate omissions by category,
32
33
  After initialization, L2 docs are created only when durable context exists:
33
34
 
34
35
  ON_MODIFY behavior:
35
- - When an AI modifies a file in sub-module S within module M and `.prizmkit/prizm-docs/<M>/<S>.prizm` does not exist, the implementation reads the source files in S as fallback context and proceeds.
36
+ - Before modification, read the complete relevant L2 plus complete resolving parent/child pointer documents. When `.prizmkit/prizm-docs/<M>/<S>.prizm` does not exist, inspect only the bounded relevant source files in S and narrowly implicated contracts as fallback context, create no placeholder, and proceed.
36
37
  - Do not block implementation only to create a placeholder L2 doc.
37
38
  - After the change, run `/prizmkit-retrospective` when structure, interfaces, dependencies, behavior, or durable TRAPS changed; retrospective creates or updates L2 then only for facts that pass the future-incorrect-modification Value Gate.
38
39
  - Preserve the mirrored source-submodule path. For a flat module with multiple stable concerns under repeated L2 capacity pressure, use deterministic semantic L2 identity and explicit non-overlapping FILES ownership; block ambiguous creation.
@@ -5,7 +5,7 @@ Regenerate docs for a specific module from scratch. Requires a module path argum
5
5
  PRECONDITION: .prizmkit/prizm-docs/ exists. Module path is valid.
6
6
 
7
7
  STEPS:
8
- 1. Read the existing module L1, every pointed L2, and the relevant root entry before changing anything. Do not delete first. Snapshot semantic meanings, pointers, paths, and a protected set of still-valid public/wire contracts, cross-module constraints, non-obvious dependencies, traps, decisions with necessary rationale, likely-to-recur rejected alternatives, side effects, and security/data-integrity/concurrency/transaction/compatibility rules.
8
+ 1. Read the complete existing direct-child module L1, every complete pointed nested L2, and the complete relevant root pointer context before changing anything. Do not delete first. Snapshot semantic meanings, pointers, paths, and a protected set of still-valid public/wire contracts, cross-module constraints, non-obvious dependencies, traps, decisions with necessary rationale, likely-to-recur rejected alternatives, side effects, and security/data-integrity/concurrency/transaction/compatibility rules.
9
9
  2. Re-scan the current module source for files, public/wire behavior, dependencies, flows, stable concerns, and real source submodules. Treat each observation and each old entry as a candidate under the future-incorrect-modification Value Gate; source-derived, transient, historical, test-inventory, stale, duplicate, procedural, and low-value material is omitted.
10
10
  3. Reconstruct the module map in memory, then apply the Cleanup Gate to each existing target: update equivalent meanings in place, merge synonyms, remove stale/derivable/parent-copied content, and add only genuinely new durable knowledge. Append-only growth and delete-first regeneration are prohibited.
11
11
  4. Reconcile detail identity:
@@ -16,6 +16,8 @@ STEPS:
16
16
  5. Rewrite the existing L1 as a concise structural summary and pointer index only. Preserve SUBDIRS pointers for real source-submodule L2 and DETAILS pointers for semantic L2. Never copy child interfaces, data flow, traps, decisions, or full rules into L1. Remove an obsolete detail only after all still-valid protected knowledge has been preserved in its current owner and its source/concern identity no longer exists.
17
17
  6. Update only the equivalent root MODULE_INDEX or MODULE_GROUPS entry in place. Preserve concise pointer-only parent behavior, existing project-wide knowledge, and `PROJECT_BRIEF:`. Use MODULE_GROUPS whenever MODULE_INDEX cannot fit within the unchanged 4096B L0 limit; more than 15 modules is a mandatory grouping trigger, not permission for a larger root.
18
18
  7. Measure exact raw UTF-8 bytes using hard limits L0/L1 4096B and L2 5120B. Report warning-range results without failing. For any rewritten target at 90% or above, trim low-value material, deduplicate, move child-owned behavior, or safely semantic-split toward 3277-3686B for L0/L1 or 4096-4607B for L2. Never delete protected knowledge for size; unresolved hard-limit or unsafe-split pressure blocks Rebuild.
19
- 8. Validate Value/Cleanup compliance, complete semantic fields, FILES ownership, pointer resolution, hierarchy, parent-summary boundaries, capacity, and format. Warning-only results pass; hard-limit or format errors fail.
19
+ 8. Build and validate the complete affected candidate set before replacement, then write bottom-up. Compare candidate/current bytes and do not rewrite byte-identical targets.
20
+ 9. Re-read actual bytes and validate Value/Cleanup compliance, complete semantic fields, FILES ownership, pointer resolution in both directions, hierarchy, parent-summary boundaries, capacity, and format. Warning-only results pass; hard-limit or format errors fail.
21
+ 10. If any post-write check fails, restore every replaced target to exact pre-write bytes and remove invalid new targets before returning a blocker. Rebuild never stages, commits, force-adds, changes or interprets ignore policy, requires Git history, or treats tracking state as health.
20
22
 
21
23
  OUTPUT: Rebuilt-document before/after summary listing entries updated in place, merged, removed, added, and protected; sorted capacity diagnostics; semantic identity/ownership decisions; and any blocking ambiguity.
@@ -5,17 +5,16 @@ Check freshness of all .prizm docs.
5
5
  PRECONDITION: .prizmkit/prizm-docs/ exists with root.prizm.
6
6
 
7
7
  STEPS:
8
- 1. Get the last git modification time of `root.prizm` via `git log -1 --format="%ai" -- .prizmkit/prizm-docs/root.prizm`. If history is unavailable, use filesystem timestamps and report reduced freshness accuracy.
9
- 2. Count commits since that time via `git log --since="<timestamp>" --oneline | wc -l`.
10
- 3. For each L1/L2 document, compare its git modification time with the latest source modification in its mapped module. Resolve real source submodules through SUBDIRS and flat semantic concerns through DETAILS plus their authoritative FILES ownership.
11
- 4. Classify freshness as FRESH (doc updated after source), STALE (source newer), or MISSING (durable module/concern exists without a document). An absent placeholder with no Value-Gate-qualified knowledge is not MISSING.
12
- 5. Measure every `.prizm` file from its actual raw UTF-8 bytes and classify the exact path: only `.prizmkit/prizm-docs/root.prizm` is L0 with 4096B; direct children are L1 with 4096B; nested mirrored or semantic documents are L2 with 5120B. Never infer capacity from project size, line count, character count, or filename alone.
13
- 6. Classify capacity as normal (<80%), warning (80% to <90%), strong-warning (90% through 100%), or error (>100%). Sort every non-normal capacity entry by exact descending utilization using integer ratio comparison, then repository-relative path ascending for ties.
14
- 7. For each non-normal entry report `DOC_PATH | LEVEL | BYTES | LIMIT | BAND | TARGET_RANGE | ACTIONS`. Target is 3277-3686B for L0/L1 or 4096-4607B for L2. ACTIONS must include concrete level-appropriate trim, deduplicate, move-to-child, and semantic-split guidance consistent with the canonical F-063 classifier.
15
- 8. Status is read-only. A warning or strong warning is not "oversize" and does not force a split. An error is over the hard limit. Recommend semantic split only for an eligible flat module with multiple stable concerns after Value/Cleanup filtering; otherwise recommend the applicable non-destructive actions or manual decision.
16
- 9. When inspecting representative or named documents, use their current measured bytes and detected level. Do not special-case paths or repeat stale measurements in guidance.
8
+ 1. Read exact `root.prizm` and resolve registered direct-child L1 and nested L2 pointers from current filesystem content. Status never requires Git history and never inspects whether managed paths are ignored, untracked, or tracked.
9
+ 2. For each L1/L2 document, compare its filesystem modification time with current mapped source files only as an advisory freshness signal. Resolve real source submodules through SUBDIRS and flat semantic concerns through DETAILS plus authoritative FILES ownership.
10
+ 3. Classify freshness as FRESH (doc not older than source), STALE (source newer), or MISSING (a required resolving pointer or Value-Gate-qualified documented concern lacks a complete target). An absent placeholder with no Value-Gate-qualified knowledge is not MISSING.
11
+ 4. Measure every `.prizm` file from its actual raw UTF-8 bytes and classify the exact path: only `.prizmkit/prizm-docs/root.prizm` is L0 with 4096B; direct children are L1 with 4096B; nested mirrored or semantic documents are L2 with 5120B. Never infer capacity from project size, line count, character count, filename, source depth, or Git state.
12
+ 5. Classify capacity as normal (<80%), warning (80% to <90%), strong-warning (90% through 100%), or error (>100%). Sort every non-normal capacity entry by exact descending utilization using integer ratio comparison, then repository-relative path ascending for ties.
13
+ 6. For each non-normal entry report `DOC_PATH | LEVEL | BYTES | LIMIT | BAND | TARGET_RANGE | ACTIONS`. Target is 3277-3686B for L0/L1 or 4096-4607B for L2. ACTIONS include concrete level-appropriate trim, deduplicate, move-to-child, and semantic-split guidance.
14
+ 7. Status is read-only. A warning or strong warning is not "oversize" and does not force a split. An error is over the hard limit. Recommend semantic split only for an eligible flat module with multiple stable concerns after Value/Cleanup filtering; otherwise recommend the applicable non-destructive actions or manual decision.
15
+ 8. When inspecting representative or named documents, use their current measured bytes and detected level. Do not special-case paths or repeat stale measurements in guidance.
17
16
 
18
17
  OUTPUT:
19
- - Freshness table: `DOC_PATH | LEVEL | STATUS | PRIZM_LAST_MOD | SOURCE_LAST_MOD`.
18
+ - Freshness table: `DOC_PATH | LEVEL | STATUS | PRIZM_FILESYSTEM_MOD | SOURCE_FILESYSTEM_MOD` (advisory; no Git-history requirement).
20
19
  - Capacity table: non-normal entries in descending utilization with `DOC_PATH | LEVEL | BYTES | LIMIT | BAND | TARGET_RANGE | ACTIONS`.
21
20
  - Summary counts for normal, warning, strong-warning, and error. Status reports errors but does not mutate documents.
@@ -7,10 +7,10 @@ PRECONDITION: `.prizmkit/prizm-docs/` exists with `root.prizm`.
7
7
  Use this operation for manual edits, merges, rebases, branch switches, generated code movement, or other changes that did not pass through `/prizmkit-retrospective`. During ordinary feature/bugfix/refactor work, use `/prizmkit-retrospective` instead.
8
8
 
9
9
  STEPS:
10
- 1. Identify drift source. Prefer explicit user context; otherwise inspect git changes with `git diff --cached --name-status`, then `git diff --name-status`. If no git changes exist, run a bounded rescan comparing code structure against existing docs.
10
+ 1. Identify drift source from explicit user context when supplied; otherwise run a bounded source/document rescan over registered modules and concrete missing/stale pointers. Do not require Git history, inspect tracking state, or change behavior because managed files are ignored, untracked, or tracked.
11
11
  2. Map changed files to modules through MODULE_INDEX or MODULE_GROUPS in `root.prizm`, then resolve mirrored SUBDIRS or flat-module DETAILS ownership from the relevant L1.
12
12
  3. Classify each source change as A, D, M, or R, but do not mechanically turn changes into documentation. Treat every possible file, interface, dependency, flow, trap, decision, rule, and summary as a candidate and apply the future-incorrect-modification Value Gate.
13
- 4. Before writing any existing L2, L1, or L0 target, read that target and its resolving parent/child pointers. Build a protected set of still-valid public/wire contracts, cross-module constraints, non-obvious dependencies, traps, decisions with necessary rationale, likely-to-recur rejected alternatives, side effects, and security/data-integrity/concurrency/transaction/compatibility rules.
13
+ 4. Before writing any existing L2, L1, or L0 target, read that complete target and complete resolving parent/child pointer documents. Build a protected set of still-valid public/wire contracts, cross-module constraints, non-obvious dependencies, traps, decisions with necessary rationale, likely-to-recur rejected alternatives, side effects, and security/data-integrity/concurrency/transaction/compatibility rules.
14
14
  5. Apply the Cleanup Gate by semantic meaning:
15
15
  - update an equivalent entry in place rather than appending alternate wording
16
16
  - merge synonymous entries into one shortest complete meaning
@@ -27,8 +27,9 @@ STEPS:
27
27
  - semantic details require the complete CONCERN terminal shape, explicit non-empty/non-overlapping FILES ownership, and one resolving L1 DETAILS entry
28
28
  - ambiguous concern identity, empty normalization, mirrored-path/slug collision, or overlapping ownership blocks creation and reports the manual decision; never use task IDs or numeric suffixes
29
29
  11. Measure all affected targets by exact raw UTF-8 bytes with L0/L1 4096B and L2 5120B limits. Natural content below 80% remains unchanged; warning-range content is valid and reported. Clean, move, or safely split rewritten targets at 90% or above toward 3277-3686B for L0/L1 or 4096-4607B for L2. If a hard-limit error or repeated pressure cannot be resolved without deleting protected knowledge, block the write.
30
- 12. Validate Value/Cleanup compliance, parent-summary boundaries, semantic ownership/identity, pointers, hierarchy, capacity, memory hygiene, and format. Warning-only capacity results pass; hard-limit or format errors fail.
31
- 13. Report updated, created, removed, merged, protected, and skipped facts/docs with reasons plus capacity diagnostics ordered by descending utilization.
32
- 14. Stage updated `.prizm` files with `git add .prizmkit/prizm-docs/` only after reviewing the repair summary.
30
+ 12. Preflight complete candidate bytes, write validated targets bottom-up, compare each candidate with current bytes, and skip byte-identical replacements.
31
+ 13. Re-read actual bytes and validate Value/Cleanup compliance, parent-summary boundaries, semantic ownership/identity, pointers in both directions, hierarchy, capacity, memory hygiene, and format. Warning-only capacity results pass; hard-limit or format errors fail.
32
+ 14. If any post-write check fails, restore every existing target to its exact pre-write bytes and remove invalid new targets before returning a blocker.
33
+ 15. Report updated, created, removed, merged, protected, and skipped facts/docs with reasons plus capacity diagnostics ordered by descending utilization. Do not stage, commit, force-add, modify or interpret ignore policy, or require Git history.
33
34
 
34
35
  OUTPUT: List updated, created, removed, merged, protected, and skipped docs/facts with reasons; sorted capacity diagnostics; ambiguity blockers; and an explicit statement that this was out-of-band repair/resync, not a normal development retrospective.