prizmkit 1.1.77 → 1.1.79

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 (43) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/skills/_metadata.json +1 -1
  3. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +11 -3
  4. package/bundled/skills/feature-pipeline-launcher/SKILL.md +12 -4
  5. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +13 -3
  6. package/bundled/skills-windows/bugfix-pipeline-launcher/SKILL.md +12 -3
  7. package/bundled/skills-windows/feature-pipeline-launcher/SKILL.md +12 -3
  8. package/bundled/skills-windows/prizm-kit/SKILL.md +81 -0
  9. package/bundled/skills-windows/prizmkit-code-review/SKILL.md +225 -0
  10. package/bundled/skills-windows/prizmkit-committer/SKILL.md +81 -0
  11. package/bundled/skills-windows/prizmkit-deploy/SKILL.md +468 -0
  12. package/bundled/skills-windows/prizmkit-deploy/references/ci-cd-workflows.md +115 -0
  13. package/bundled/skills-windows/prizmkit-deploy/references/cloud-platform-deploy.md +93 -0
  14. package/bundled/skills-windows/prizmkit-deploy/references/database-setup.md +46 -0
  15. package/bundled/skills-windows/prizmkit-deploy/references/deploy-config-schema.md +148 -0
  16. package/bundled/skills-windows/prizmkit-deploy/references/deploy-history-schema.md +62 -0
  17. package/bundled/skills-windows/prizmkit-deploy/references/deployment-modes.md +50 -0
  18. package/bundled/skills-windows/prizmkit-deploy/references/direct-upload.md +26 -0
  19. package/bundled/skills-windows/prizmkit-deploy/references/dns-setup.md +42 -0
  20. package/bundled/skills-windows/prizmkit-deploy/references/docker-deploy.md +31 -0
  21. package/bundled/skills-windows/prizmkit-deploy/references/firewall-setup.md +37 -0
  22. package/bundled/skills-windows/prizmkit-deploy/references/live-validation-notes.md +21 -0
  23. package/bundled/skills-windows/prizmkit-deploy/references/nginx-blue-green.md +59 -0
  24. package/bundled/skills-windows/prizmkit-deploy/references/ssl-setup.md +56 -0
  25. package/bundled/skills-windows/prizmkit-implement/SKILL.md +65 -0
  26. package/bundled/skills-windows/prizmkit-plan/SKILL.md +184 -0
  27. package/bundled/skills-windows/prizmkit-plan/assets/plan-template.md +115 -0
  28. package/bundled/skills-windows/prizmkit-plan/assets/spec-template.md +73 -0
  29. package/bundled/skills-windows/prizmkit-plan/references/clarify-guide.md +67 -0
  30. package/bundled/skills-windows/prizmkit-plan/references/verification-checklist.md +60 -0
  31. package/bundled/skills-windows/prizmkit-prizm-docs/SKILL.md +115 -0
  32. package/bundled/skills-windows/prizmkit-prizm-docs/assets/prizm-docs-format.md +613 -0
  33. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-init.md +45 -0
  34. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-rebuild.md +15 -0
  35. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-status.md +14 -0
  36. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-update.md +19 -0
  37. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-validate.md +17 -0
  38. package/bundled/skills-windows/prizmkit-retrospective/SKILL.md +87 -0
  39. package/bundled/skills-windows/prizmkit-retrospective/references/knowledge-injection-steps.md +50 -0
  40. package/bundled/skills-windows/prizmkit-retrospective/references/structural-sync-steps.md +43 -0
  41. package/bundled/skills-windows/prizmkit-test/SKILL.md +281 -0
  42. package/bundled/skills-windows/refactor-pipeline-launcher/SKILL.md +11 -2
  43. package/package.json +1 -1
@@ -0,0 +1,613 @@
1
+ PRIZM_SPEC_VERSION: 4
2
+ PURPOSE: AI-only documentation framework for vibe coding projects
3
+ AUDIENCE: AI agents (not humans)
4
+ FORMAT: KEY: value pairs, ALL CAPS section headers, arrow pointers
5
+ FILE_EXT: .prizm
6
+ DOC_ROOT: .prizmkit/prizm-docs/
7
+ LICENSE: MIT
8
+
9
+ ---
10
+
11
+ ## Table of Contents
12
+
13
+ 1. Overview
14
+ 2. Architecture
15
+ 3. Document Format Specification
16
+ 4. Format Conventions
17
+ 5. Path Mapping Rules
18
+ 6. Progressive Loading Protocol
19
+ 7. Auto-Update Protocol
20
+ 8. Anti-Patterns
21
+ 9. Initialization Procedure
22
+ 10. Skill Definition
23
+ 11. Hook Configuration
24
+ 12. Language-Specific Initialization Hints
25
+
26
+ ---
27
+
28
+ # SECTION 1: OVERVIEW
29
+
30
+ WHAT: Prizm is a self-maintaining documentation system where AI reads, generates, updates, and loads project context progressively.
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 auto-update before every commit.
33
+
34
+ CORE_PRINCIPLES:
35
+ - Token efficiency over human readability
36
+ - Progressive disclosure (load only what is needed)
37
+ - Self-updating (docs stay fresh via commit-time hooks)
38
+ - Universal (language and framework agnostic)
39
+ - Durable project knowledge over auxiliary history (decisions, traps, interfaces, dependencies)
40
+ - 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)
43
+ - Rules hierarchy (root.prizm RULES are authoritative, module RULES supplement only)
44
+
45
+ ---
46
+
47
+ # SECTION 2: ARCHITECTURE
48
+
49
+ ## 2.1 Progressive Loading Levels
50
+
51
+ LEVELS:
52
+ - L0: Root index. ALWAYS loaded at session start. Max 4KB.
53
+ FILE: .prizmkit/prizm-docs/root.prizm
54
+ CONTAINS: project meta, module index with pointers, build commands, tech stack, top rules
55
+
56
+ - L1: Structural index. Loaded ON DEMAND when AI works in a module area. Max 4KB each.
57
+ 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)
60
+
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
64
+
65
+ ## 2.2 Directory Layout
66
+
67
+ STRUCTURE: Mirrors source tree under .prizmkit/prizm-docs/
68
+
69
+ EXAMPLE (Go project):
70
+ .prizmkit/prizm-docs/
71
+ root.prizm # L0
72
+ internal/
73
+ logic.prizm # L1 for internal/logic/
74
+ model.prizm # L1 for internal/model/
75
+ repo.prizm # L1 for internal/repo/
76
+ service.prizm # L1 for internal/service/
77
+ common.prizm # L1 for internal/common/
78
+ logic/
79
+ statemachine.prizm # L2 for internal/logic/statemachine/
80
+ session.prizm # L2 for internal/logic/session/
81
+ ivr.prizm # L2 for internal/logic/ivr/
82
+ repo/
83
+ rpc.prizm # L2 for internal/repo/rpc/
84
+ store.prizm # L2 for internal/repo/store/
85
+ service/
86
+ http.prizm # L2 for internal/service/http/
87
+ sso.prizm # L2 for internal/service/sso/
88
+
89
+ EXAMPLE (JS/TS project):
90
+ .prizmkit/prizm-docs/
91
+ root.prizm # L0
92
+ src/
93
+ components.prizm # L1 for src/components/
94
+ hooks.prizm # L1 for src/hooks/
95
+ services.prizm # L1 for src/services/
96
+ components/
97
+ auth.prizm # L2 for src/components/auth/
98
+ dashboard.prizm # L2 for src/components/dashboard/
99
+
100
+ EXAMPLE (Python project):
101
+ .prizmkit/prizm-docs/
102
+ root.prizm # L0
103
+ app/
104
+ models.prizm # L1 for app/models/
105
+ views.prizm # L1 for app/views/
106
+ services.prizm # L1 for app/services/
107
+ services/
108
+ payment.prizm # L2 for app/services/payment/
109
+ cross-cutting/ # Optional: cross-module concern details
110
+ auth.prizm # L2-style doc for cross-cutting auth concern
111
+
112
+ ## 2.3 Git Configuration
113
+
114
+ COMMIT: .prizmkit/prizm-docs/ MUST be committed to git alongside source code
115
+ RATIONALE: .prizmkit/prizm-docs/ is shared project knowledge that all team members (human and AI) benefit from.
116
+
117
+ ---
118
+
119
+ # SECTION 3: DOCUMENT FORMAT SPECIFICATION
120
+
121
+ ## 3.1 L0: root.prizm
122
+
123
+ TEMPLATE:
124
+
125
+ PRIZM_VERSION: 4
126
+ PROJECT: <name>
127
+ LANG: <primary language>
128
+ FRAMEWORK: <primary framework or "none">
129
+ BUILD: <build command>
130
+ TEST: <test command>
131
+ ENTRY: <entry point file(s)>
132
+
133
+ ARCHITECTURE: <layer1> -> <layer2> -> <layer3> -> ...
134
+ LAYERS:
135
+ - <layer-name>: <one-line description>
136
+
137
+ TECH_STACK:
138
+ - runtime: <list>
139
+ - deps: <key external dependencies>
140
+ - infra: <infrastructure: databases, queues, caches, etc.>
141
+
142
+ MODULE_INDEX:
143
+ - <source-path>: <file-count> files. <one-line description>. -> .prizmkit/prizm-docs/<mirrored-path>.prizm
144
+ (Multi-level entries allowed for efficient navigation. No hard depth limit — constrained by L0 4KB.
145
+ If navigating from L0 to a target module requires 3+ hops, add intermediate entries here.)
146
+
147
+ ENTRY_POINTS:
148
+ - <name>: <file-path> (<protocol/port if applicable>)
149
+
150
+ RULES:
151
+ - MUST: <project-wide mandatory rule>
152
+ - NEVER: <project-wide prohibition>
153
+ - PREFER: <project-wide preference>
154
+
155
+ PATTERNS:
156
+ - <pattern-name>: <one-line description of code pattern used across project>
157
+
158
+ CROSS_CUTTING:
159
+ - <concern-name>: <one-line description>. Modules: <affected-module-list>.
160
+ (Optional: -> .prizmkit/prizm-docs/cross-cutting/<name>.prizm for detailed cross-cutting doc.
161
+ Only record concerns spanning 2+ modules. Single-module patterns go in that module's RULES.)
162
+
163
+ DECISIONS:
164
+ - <project-level architectural decision and rationale>
165
+ - REJECTED: <rejected approach + why>
166
+
167
+ CONSTRAINTS:
168
+ - Max 4KB (roughly 100 lines)
169
+ - Every line must be a KEY: value pair or a list item
170
+ - MODULE_INDEX must have arrow pointer (->) for every entry
171
+ - MODULE_INDEX may list entries at any depth needed for efficient navigation (no hard depth limit)
172
+ - RULES limited to 5-10 most critical conventions
173
+ - No prose paragraphs
174
+ - root.prizm RULES are AUTHORITATIVE: they override any conflicting L1/L2 RULES
175
+
176
+ ### MODULE_GROUPS (alternative to MODULE_INDEX for projects with 15+ modules)
177
+
178
+ When MODULE_INDEX would exceed 15 entries, replace it with MODULE_GROUPS to stay within the 4KB limit. Group modules by functional domain:
179
+
180
+ MODULE_GROUPS:
181
+ <domain-name>:
182
+ - <module>: <file-count> files. <one-line description>. -> .prizmkit/prizm-docs/<module>.prizm
183
+ - <module>: <file-count> files. <one-line description>. -> .prizmkit/prizm-docs/<module>.prizm
184
+ <domain-name>:
185
+ - <module>: <file-count> files. <one-line description>. -> .prizmkit/prizm-docs/<module>.prizm
186
+
187
+ CONSTRAINTS for MODULE_GROUPS:
188
+ - Exactly ONE of MODULE_INDEX or MODULE_GROUPS must be present in root.prizm (not both)
189
+ - Domain names: lowercase, descriptive (e.g., api, frontend, infrastructure, shared, data)
190
+ - 3-8 domains is the ideal range
191
+ - Each module appears in exactly one domain
192
+ - Every entry must have an arrow pointer (->), same as MODULE_INDEX
193
+ - AI should load the relevant domain's modules when working on a task, not all domains
194
+
195
+ ### Optional Keyword Tags (applies to both MODULE_INDEX and MODULE_GROUPS)
196
+
197
+ Entries may include keyword tags for AI intent matching:
198
+
199
+ MODULE_INDEX:
200
+ - auth [login, session, jwt, oauth]: 12 files. Authentication and authorization. -> .prizmkit/prizm-docs/auth.prizm
201
+ - payments [stripe, billing, subscription]: 8 files. Payment processing. -> .prizmkit/prizm-docs/payments.prizm
202
+ - users: 6 files. User management. -> .prizmkit/prizm-docs/users.prizm
203
+
204
+ Tags are optional, enclosed in square brackets after the module name. They contain lowercase keywords that describe the module's domain concepts. AI matches user requirement descriptions against tags to identify relevant modules before loading L1. Tags are auto-generated during Init from module source content (function names, imports, domain terms) and refined during Rebuild.
205
+
206
+ ## 3.2 L1: module.prizm (Structural Index)
207
+
208
+ TEMPLATE:
209
+
210
+ MODULE: <source-path>
211
+ FILES: <count>
212
+ RESPONSIBILITY: <one-line>
213
+
214
+ SUBDIRS:
215
+ - <name>/: <one-line description>. -> .prizmkit/prizm-docs/<child-path>.prizm
216
+
217
+ KEY_FILES:
218
+ - <filename>: <role/purpose>
219
+
220
+ DEPENDENCIES:
221
+ - imports: <internal modules this module uses>
222
+ - imported-by: <internal modules that depend on this>
223
+ - external: <third-party packages used>
224
+
225
+ RULES:
226
+ - MUST: <1-3 most critical module-specific rules only — full list in L2>
227
+
228
+ CONSTRAINTS:
229
+ - Max 4KB
230
+ - 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)
232
+ - RULES: summary only, max 3 entries of the most critical constraints. Full rules in L2.
233
+ - 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)
236
+ - RULES may only SUPPLEMENT root.prizm RULES with module-specific exceptions, never contradict them
237
+
238
+ TRAPS_FORMAT_REFERENCE (spec-only — do NOT include this block in generated .prizm files):
239
+ - Severity levels: CRITICAL = data loss/security/financial/crash, HIGH = functional failure/silent error, LOW = naming/minor quality
240
+ - Temporary prefix: [REVIEW] may precede severity (e.g., `[REVIEW][HIGH]`) — signals the TRAP needs re-validation. Consumed by the next retrospective: verify and either remove [REVIEW] or delete the TRAP.
241
+ - REF: first 7 chars of the commit where the trap was discovered (optional, for traceability)
242
+ - STALE_IF: glob pattern — when matched files are deleted or heavily rewritten, this trap needs re-validation (optional)
243
+ - Minimal valid format: `- [SEVERITY] <description> | FIX: <approach>`
244
+ - Full format: `- [SEVERITY] <description> | FIX: <approach> | REF: <hash> | STALE_IF: <glob>`
245
+
246
+ ## 3.3 L2: detail.prizm (Behavioral Detail)
247
+
248
+ TEMPLATE:
249
+
250
+ MODULE: <source-path>
251
+ FILES: <comma-separated list of all files>
252
+ RESPONSIBILITY: <one-line>
253
+
254
+ INTERFACES:
255
+ - <function/method signature>: <what it does>
256
+
257
+ DATA_FLOW:
258
+ - <numbered step describing how data moves through this module>
259
+
260
+ <DOMAIN-SPECIFIC SECTIONS>
261
+ (AI generates these based on what the module does. Examples below.)
262
+
263
+ KEY_FILES:
264
+ - <filename>: <detailed description, line count, complexity notes>
265
+
266
+ DEPENDENCIES:
267
+ - uses: <external lib>: <why/how used>
268
+ - imports: <internal module>: <which interfaces consumed>
269
+
270
+ RULES:
271
+ - MUST: <module-specific mandatory rule>
272
+ - NEVER: <module-specific prohibition>
273
+ - PREFER: <module-specific preference>
274
+ (Full rules list — L1 only has a 1-3 item summary of these)
275
+
276
+ 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>
279
+
280
+ DECISIONS:
281
+ - <decision made within this module> — <rationale>
282
+ - REJECTED: <approach that was tried/considered and abandoned + why>
283
+
284
+ DOMAIN_SPECIFIC_SECTION_EXAMPLES:
285
+ - For state machines: STATES, TRIGGERS, TRANSITIONS
286
+ - For API handlers: ENDPOINTS, REQUEST_FORMAT, RESPONSE_FORMAT, ERROR_CODES
287
+ - For data stores: TABLES, QUERIES, INDEXES, CACHE_KEYS
288
+ - For config modules: CONFIG_KEYS, ENV_VARS, DEFAULTS
289
+ - For UI components: PROPS, EVENTS, SLOTS, STYLES
290
+
291
+ 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.
301
+ - TRAPS optional fields: append `| REF: <7-char-hash>` for traceability, `| STALE_IF: <glob>` for auto-expiry detection
302
+ - 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
305
+ - RULES may only SUPPLEMENT root.prizm RULES with module-specific exceptions, never contradict them
306
+
307
+ ## 3.4 Metadata Policy
308
+
309
+ TEMPORAL_INFO: Git history is the authoritative source for change timing and edit history.
310
+ AUXILIARY_FIELDS: Do not generate CHANGELOG or UPDATED fields in .prizm files.
311
+ 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.
312
+ RATIONALE: Keep project memory focused on durable architecture, interfaces, dependencies, traps, rules, and decisions.
313
+
314
+ ---
315
+
316
+ # SECTION 4: FORMAT CONVENTIONS
317
+
318
+ HEADERS: ALL CAPS followed by colon (MODULE:, FILES:, RESPONSIBILITY:, etc.)
319
+ VALUES: Single space after colon, value on same line (KEY: value)
320
+ LISTS: Dash-space prefix for items within a section (- item)
321
+ POINTERS: Arrow notation (->) to reference other .prizm files
322
+ NESTING: Indent 2 spaces for sub-keys within a section
323
+ COMMENTS: None. Every line carries information. No comments in .prizm files.
324
+ 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.
325
+
326
+ ---
327
+
328
+ # SECTION 5: PATH MAPPING RULES
329
+
330
+ ## 5.1 Mapping Algorithm
331
+
332
+ RULE: Mirror the source directory tree under .prizmkit/prizm-docs/
333
+ RULE: L1 file for directory D = .prizmkit/prizm-docs/<D>.prizm
334
+ RULE: L2 file for subdirectory D/S = .prizmkit/prizm-docs/<D>/<S>.prizm
335
+ RULE: Root index = .prizmkit/prizm-docs/root.prizm (always)
336
+
337
+ ## 5.2 Examples
338
+
339
+ SOURCE_PATH L1_PRIZM_FILE L2_PRIZM_FILES
340
+ internal/logic/ .prizmkit/prizm-docs/internal/logic.prizm .prizmkit/prizm-docs/internal/logic/*.prizm
341
+ internal/logic/session/ (described in L1 logic.prizm SUBDIRS) .prizmkit/prizm-docs/internal/logic/session.prizm
342
+ internal/repo/store/ (described in L1 repo.prizm SUBDIRS) .prizmkit/prizm-docs/internal/repo/store.prizm
343
+ src/components/ .prizmkit/prizm-docs/src/components.prizm .prizmkit/prizm-docs/src/components/*.prizm
344
+ src/components/auth/ (described in L1 components.prizm) .prizmkit/prizm-docs/src/components/auth.prizm
345
+ app/services/ .prizmkit/prizm-docs/app/services.prizm .prizmkit/prizm-docs/app/services/*.prizm
346
+
347
+ ## 5.3 Discovery Rule
348
+
349
+ FOR any source file at path P:
350
+ 1. Walk up directory tree to find the first ancestor D where .prizmkit/prizm-docs/<D>.prizm exists
351
+ 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 prizmkit-prizm-docs Update operation)
354
+
355
+ ---
356
+
357
+ # SECTION 6: PROGRESSIVE LOADING PROTOCOL
358
+
359
+ ## 6.1 When to Load
360
+
361
+ ON_SESSION_START:
362
+ ALWAYS: Read .prizmkit/prizm-docs/root.prizm (L0) if it exists
363
+ PURPOSE: Get the project map, understand architecture, know where to look
364
+
365
+ ON_TASK_RECEIVED:
366
+ IF task references specific file or directory:
367
+ LOAD: L1 for the containing module (structural index: files, deps, key rules)
368
+ IF task is broad (e.g., "refactor auth", "improve performance"):
369
+ LOAD: L1 for all matching modules from MODULE_INDEX
370
+ IF task is exploratory (e.g., "explain the codebase", "how does X work"):
371
+ LOAD: L0 only, then navigate via pointers as needed
372
+ IF task is cross-cutting (e.g., "add logging everywhere"):
373
+ LOAD: L1 for affected modules, check DEPENDENCIES.imported-by and CROSS_CUTTING in root.prizm
374
+
375
+ ON_FILE_MODIFICATION:
376
+ BEFORE editing any source file:
377
+ TARGETED LOAD from L2 (NEVER read the entire L2 file — use grep to extract only needed sections):
378
+ 1. Use Grep tool to search for "^TRAPS:" in the L2 doc, read that section (prevent known mistakes)
379
+ 2. Use Grep tool to search for "^DECISIONS:" and "^REJECTED:", read those sections (understand prior choices)
380
+ 3. Use Grep tool to search for "^INTERFACES:" if you need to understand the public API contract
381
+ Only load additional L2 sections if the task specifically requires them.
382
+ IF L2 does not exist: GENERATE L2 from source code analysis, then extract needed sections
383
+
384
+ ON_DEEP_READ:
385
+ WHEN AI needs deep understanding of a module WITHOUT modifying it:
386
+ TARGETED LOAD from L2 using grep (same approach as ON_FILE_MODIFICATION)
387
+ IF L2 does not exist: GENERATE L2 from source code analysis, then extract needed sections
388
+ USE_CASES: code review, architecture analysis, dependency tracing, explaining complex logic
389
+
390
+ ## 6.2 Loading Rules
391
+
392
+ NEVER: Load all L1 and L2 docs at session start (defeats progressive loading)
393
+ NEVER: Read entire L2 files — always use grep/search to extract only the sections you need
394
+ NEVER: Load L2 for modules not being modified or deeply analyzed (wastes context window)
395
+ NEVER: Skip L0 (it is the map for everything else)
396
+ PREFER: Load L1 before L2 (understand module context before diving into details)
397
+ PREFER: Load minimum docs and minimum sections needed for the task
398
+ BUDGET: Typical task should consume 3000-5000 tokens of prizm docs total
399
+
400
+ ## 6.3 L2 Targeted Loading Protocol
401
+
402
+ L2 docs can be up to 5KB. Loading them in full defeats the purpose of progressive loading.
403
+ Use targeted grep to extract only the sections relevant to your current task:
404
+
405
+ COMMAND_PATTERN:
406
+ Grep tool with pattern "^SECTION_NAME:" and context lines (-A flag) to read a specific section.
407
+ Stop reading at the next ALL-CAPS section header.
408
+
409
+ EXAMPLES:
410
+ - Before editing a file: grep for "^TRAPS:" and "^DECISIONS:" sections
411
+ - Before changing an API: grep for "^INTERFACES:" section
412
+ - Before modifying data handling: grep for "^DATA_FLOW:" section
413
+ - For full module understanding (rare): read the entire L2 (only when task explicitly requires comprehensive analysis)
414
+
415
+ ---
416
+
417
+ # SECTION 7: AUTO-UPDATE PROTOCOL
418
+
419
+ ## 7.1 Trigger
420
+
421
+ WHEN: Before every commit (detected automatically via hook, or manually via prizmkit-prizm-docs Update operation)
422
+ GOAL: Keep prizm docs synchronized with source code
423
+
424
+ ## 7.2 Update Decision Logic
425
+
426
+ SUMMARY: Get changed files → map to modules → classify (A/D/M/R) → update docs bottom-up (L2→L1→L0) → skip if no structural impact → enforce size limits → stage.
427
+
428
+ DETAILED_STEPS: → ${SKILL_DIR}/references/op-update.md
429
+
430
+ ## 7.3 Auxiliary Metadata Policy
431
+
432
+ NEVER: Add CHANGELOG sections or changelog.prizm during doc sync.
433
+ NEVER: Add UPDATED/date/time fields to .prizm files.
434
+ 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.
435
+ RATIONALE: Git already provides history; .prizm files should store only durable project memory.
436
+
437
+ ---
438
+
439
+ # SECTION 8: ANTI-PATTERNS
440
+
441
+ WHAT_NOT_TO_PUT_IN_PRIZM_DOCS:
442
+
443
+ NEVER: Prose paragraphs or explanatory text (use KEY: value or bullet lists)
444
+ NEVER: Code snippets longer than 1 line (reference file_path:line_number instead)
445
+ NEVER: Human-readable formatting (emoji, ASCII art, markdown tables, horizontal rules)
446
+ NEVER: Duplicate information across levels (L0 summarizes, L1 indexes structure, L2 details behavior)
447
+ NEVER: Implementation details or behavioral detail in L0 or L1 (INTERFACES, DATA_FLOW, TRAPS, DECISIONS belong in L2 only)
448
+ NEVER: Stale information (update or delete, never leave outdated entries)
449
+ NEVER: Full file contents or large code blocks (summarize purpose and interfaces)
450
+ NEVER: TODO items or future plans (those belong in issue trackers)
451
+ NEVER: Session-specific context or conversation history (docs are session-independent)
452
+ NEVER: 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
453
+ NEVER: CHANGELOG sections, changelog.prizm, or update-history sections
454
+ NEVER: Flowcharts, diagrams, mermaid blocks, or ASCII art (wastes tokens, AI cannot parse visually)
455
+ NEVER: Markdown headers (## / ###) inside .prizm files (use ALL CAPS KEY: format instead)
456
+ NEVER: Rewrite entire .prizm files on update (modify only affected sections)
457
+ NEVER: TRAPS entries without severity prefix ([CRITICAL], [HIGH], or [LOW])
458
+
459
+ ---
460
+
461
+ # SECTION 9: INITIALIZATION PROCEDURE
462
+
463
+ ## 9.1 Algorithm
464
+
465
+ OPERATION: Init (invoked via prizmkit-prizm-docs skill)
466
+ PRECONDITION: No .prizmkit/prizm-docs/ directory exists (or user confirms overwrite)
467
+
468
+ INPUT: Project root directory
469
+ OUTPUT: .prizmkit/prizm-docs/ with root.prizm and L1 docs for discovered modules
470
+
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.
472
+
473
+ DETAILED_STEPS: → ${SKILL_DIR}/references/op-init.md
474
+
475
+ KEY_CONCEPTS:
476
+
477
+ MODULE_DISCOVERY_CRITERIA — a directory qualifies as a module if ANY of the following is true:
478
+ - Contains source files that collectively form a logical unit (shared responsibility)
479
+ - Contains entry points, configuration files, or interface definitions
480
+ - Contains sub-directories that themselves qualify as modules
481
+ - Is referenced by multiple other modules as a dependency
482
+
483
+ A directory does NOT qualify if ALL of the following are true:
484
+ - Contains only generated/derived files (build output, compiled assets)
485
+ - Contains only vendored/third-party code
486
+ - Is in the EXCLUDE list
487
+
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.
489
+
490
+ EXCLUDE: .git/, node_modules/, vendor/, build/, dist/, __pycache__/, target/, bin/, .claude/, .codebuddy/, .prizmkit/, .prizmkit/prizm-docs/, dev-pipeline/
491
+
492
+ ## 9.2 Post-Init Behavior
493
+
494
+ After initialization, L2 docs are created incrementally:
495
+
496
+ ON_MODIFY trigger:
497
+ - First time AI modifies a file in sub-module S within module M:
498
+ IF .prizmkit/prizm-docs/<M>/<S>.prizm does not exist:
499
+ AI reads the source files in S, generates L2 doc, then proceeds with modification
500
+ - This ensures L2 docs have real depth, written when AI has actual context
501
+
502
+ ON_DEEP_READ trigger:
503
+ - When AI needs to deeply understand a module but not modify it (e.g., code review, architecture analysis, dependency tracing, explaining complex logic):
504
+ IF .prizmkit/prizm-docs/<M>/<S>.prizm does not exist:
505
+ AI reads the source files in S, generates L2 doc for future reference
506
+ - This ensures L2 docs are available for read-heavy analysis tasks, not just modifications
507
+ - RATIONALE: Some tasks require deep understanding without editing (reviewing PRs, answering architecture questions, tracing bugs). Generating L2 during these tasks captures valuable context.
508
+
509
+ ---
510
+
511
+ # SECTION 10: SKILL DEFINITION
512
+
513
+ ## 10.1 SKILL.md Reference
514
+
515
+ The Prizm skill is defined at: ${SKILL_DIR}/SKILL.md
516
+
517
+ OPERATIONS (all invoked via the prizmkit-prizm-docs skill):
518
+
519
+ Init - Bootstrap .prizmkit/prizm-docs/ for a new project. → ${SKILL_DIR}/references/op-init.md
520
+ Update - Sync docs with code changes. → ${SKILL_DIR}/references/op-update.md
521
+ Status - Check freshness of all docs. → ${SKILL_DIR}/references/op-status.md
522
+ Rebuild - Regenerate docs for a specific module. → ${SKILL_DIR}/references/op-rebuild.md
523
+ Validate - Check format compliance and consistency. → ${SKILL_DIR}/references/op-validate.md
524
+ Migrate - Convert existing docs to .prizmkit/prizm-docs/ format. Steps inline in SKILL.md.
525
+
526
+ ---
527
+
528
+ # SECTION 11: HOOK CONFIGURATION
529
+
530
+ ## 11.1 Mechanism
531
+
532
+ HOOK_TYPE: command (shell echo, fast and reliable)
533
+ EVENT: UserPromptSubmit
534
+ BEHAVIOR: When matcher detects commit-related keywords, echoes doc update reminder as stdout
535
+ INJECTION: stdout content is injected into AI's context as a system-reminder
536
+ NOTE: Previously used type: prompt (LLM-evaluated), but switched to type: command for reliability — prompt type is prone to timeout and JSON format errors
537
+
538
+ ## 11.2 Configuration Template
539
+
540
+ Place in: .codebuddy/settings.json (project-level)
541
+
542
+ JSON:
543
+ {
544
+ "hooks": {
545
+ "UserPromptSubmit": [
546
+ {
547
+ "matcher": "(?i)\\b(commit|push|finish|ship|merge|pull request|pr)\\b|提交|推送|收尾|完成任务|合并|发版|发布",
548
+ "hooks": [
549
+ {
550
+ "type": "command",
551
+ "command": "echo 'PRIZMKIT_MAINTENANCE_REQUIRED: Before committing, you MUST run /prizmkit-retrospective. It maintains .prizmkit/prizm-docs/ architecture index — structural sync (KEY_FILES, INTERFACES, DEPENDENCIES) + TRAPS/RULES/DECISIONS injection. After retrospective completes, proceed with /prizmkit-committer for the actual git commit.'"
552
+ }
553
+ ]
554
+ }
555
+ ]
556
+ }
557
+ }
558
+
559
+ ## 11.3 How It Works
560
+
561
+ FLOW:
562
+ 1. User types prompt (e.g., "commit these changes" or "push to main")
563
+ 2. UserPromptSubmit hook fires, matcher regex checks for commit-related keywords
564
+ 3. IF matcher matches: command hook runs echo, stdout is injected as system-reminder
565
+ - AI sees the update instructions and executes them before committing
566
+ 4. IF matcher does not match: hook does not fire, AI proceeds normally
567
+
568
+ KEYWORDS_DETECTED: commit, push, finish, done, ship, merge, PR, pull request, /commit, save changes
569
+
570
+ ## 11.4 Adapting for Other AI Tools
571
+
572
+ The hook configuration above is specific to CodeBuddy Code.
573
+ For other AI coding assistants:
574
+ - Cursor: Use .cursorrules file to add the auto-update protocol as a rule
575
+ - Aider: Use .aider.conf.yml conventions section
576
+ - Continue: Use .continue/config.json customInstructions
577
+ - Generic: Add the auto-update protocol text to whatever system prompt or rules file the tool supports
578
+
579
+ The core requirement is: before any commit operation, AI must update affected .prizmkit/prizm-docs/ files.
580
+
581
+ ---
582
+
583
+ # SECTION 12: LANGUAGE-SPECIFIC INITIALIZATION HINTS
584
+
585
+ ## 12.1 Module Boundary Detection
586
+
587
+ LANGUAGE MODULE_BOUNDARY ENTRY_POINT_DETECTION
588
+ Go Directories with .go files main.go, cmd/**/main.go
589
+ JavaScript/TS Directories with index.ts/js/tsx/jsx package.json main/bin
590
+ Python Directories with __init__.py __main__.py, manage.py, app.py, wsgi.py
591
+ Rust Directories with mod.rs main.rs, lib.rs
592
+ Java src/main/java/* package directories *Application.java, Main.java
593
+ C# Directories with *.cs files Program.cs, Startup.cs
594
+
595
+ ## 12.2 Interface Detection
596
+
597
+ LANGUAGE EXPORTED_INTERFACE_PATTERN
598
+ Go Capitalized function/type names (func Foo, type Bar)
599
+ JavaScript/TS export/export default declarations
600
+ Python Functions/classes without underscore prefix
601
+ Rust pub fn, pub struct, pub enum, pub trait
602
+ Java public class, public interface, public method
603
+ C# public class, public interface, public method
604
+
605
+ ## 12.3 Dependency Detection
606
+
607
+ LANGUAGE IMPORT_PATTERN
608
+ Go import "path/to/package"
609
+ JavaScript/TS import ... from "...", require("...")
610
+ Python import ..., from ... import ...
611
+ Rust use crate::..., use super::..., extern crate
612
+ Java import package.Class
613
+ C# using Namespace
@@ -0,0 +1,45 @@
1
+ # Operation: Init — Detailed Steps
2
+
3
+ Bootstrap .prizmkit/prizm-docs/ for the current project.
4
+
5
+ PRECONDITION: No .prizmkit/prizm-docs/ directory exists, or user confirms overwrite.
6
+
7
+ STEPS:
8
+ 1. Detect project type by scanning for build system files (go.mod, package.json, requirements.txt, Cargo.toml, pom.xml, *.csproj). Identify primary language, framework, build command, test command, and entry points.
9
+ 2. Discover modules using MODULE_DISCOVERY_CRITERIA:
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
+ - 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. Listed in the parent L1 doc's SUBDIRS section.
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.
15
+ 3. Create .prizmkit/prizm-docs/ directory structure mirroring the source tree exactly. For each top-level module M that has sub-modules, create the subdirectory .prizmkit/prizm-docs/<M>/.
16
+ 4. Generate root.prizm (L0) with PROJECT, LANG, FRAMEWORK, BUILD, TEST, ENTRY, MODULE_INDEX with multi-level entries as needed for efficient navigation (constrained by 4KB limit), RULES extracted from CODEBUDDY.md/CLAUDE.md/README/linter configs, PATTERNS, and CROSS_CUTTING (cross-module concerns spanning 2+ modules). Set PRIZM_VERSION: 4. Max 4KB. No CHANGELOG sections/files, UPDATED/date metadata, feature/bug/refactor/task/session/run/pipeline/workflow IDs, branch names, absolute worktree paths, or `.prizmkit/specs` / `.prizmkit/dev-pipeline` artifact paths — git tracks history.
17
+ - If `.prizmkit/plans/project-brief.md` exists: add `PROJECT_BRIEF: .prizmkit/plans/project-brief.md` to root.prizm (generated by prizmkit-init). If not present, skip — prizmkit-init Phase 7 will add it later.
18
+ - If module count > 15: use MODULE_GROUPS format instead of MODULE_INDEX — group modules by functional domain (3-8 domains, inferred from directory structure and module responsibilities). See prizm-docs-format.md for MODULE_GROUPS format.
19
+ - For each module entry, auto-generate 3-6 keyword tags by scanning the module's key source files for: exported function/class names, imported library names, domain-specific terms in file/directory names. Add tags in square brackets after the module name (e.g., `- auth [login, session, jwt]: ...`). Tags are optional but recommended for projects with 10+ modules.
20
+ 5. Generate L1 .prizm files (structural index only) for ALL modules, each at its correct mirrored path:
21
+ - Top-level module M → write .prizmkit/prizm-docs/<M>.prizm (include SUBDIRS section with pointers to sub-module docs)
22
+ - Sub-module S inside M → write .prizmkit/prizm-docs/<M>/<S>.prizm
23
+ Each L1 includes MODULE (full relative path), FILES count, RESPONSIBILITY, SUBDIRS with pointers, KEY_FILES (5-10 most important), DEPENDENCIES (imports, imported-by, external), RULES (1-3 most critical only). L1 does NOT include INTERFACES, DATA_FLOW, TRAPS, or DECISIONS (those are L2, generated lazily). Max 4KB each.
24
+ 6. Skip L2 docs during init — L2 is created lazily on first file modification or when AI needs deep understanding (ON_DEEP_READ trigger). L2 contains behavioral detail: INTERFACES, DATA_FLOW, TRAPS, DECISIONS, full RULES, domain-specific sections.
25
+ 7. Configure UserPromptSubmit hook in platform settings per ${SKILL_DIR}/assets/prizm-docs-format.md.md Section 11.
26
+ 8. Validate all generated docs: size limits (L0 <= 4KB, L1 <= 4KB), pointer resolution (every -> reference resolves), no circular dependencies, KEY: value format compliance, no anti-patterns (prose, code blocks, markdown headers), L1 does not contain INTERFACES/DATA_FLOW/TRAPS/DECISIONS, no CHANGELOG sections/files, no UPDATED/date metadata, no feature/bug/refactor/task/session/run/pipeline/workflow IDs, no branch names, no absolute worktree paths, and no `.prizmkit/specs` / `.prizmkit/dev-pipeline` artifact paths.
27
+ 9. Report summary: modules discovered, L1 docs generated, files excluded, warnings.
28
+
29
+ OUTPUT: List of generated files, module count, and validation results.
30
+
31
+ ## Post-Init Behavior
32
+
33
+ After initialization, L2 docs are created incrementally:
34
+
35
+ ON_MODIFY trigger:
36
+ - First time AI modifies a file in sub-module S within module M:
37
+ IF .prizmkit/prizm-docs/<M>/<S>.prizm does not exist:
38
+ AI reads the source files in S, generates L2 doc, then proceeds with modification
39
+ - This ensures L2 docs have real depth, written when AI has actual context
40
+
41
+ ON_DEEP_READ trigger:
42
+ - When AI needs to deeply understand a module but not modify it (e.g., code review, architecture analysis, dependency tracing, explaining complex logic):
43
+ IF .prizmkit/prizm-docs/<M>/<S>.prizm does not exist:
44
+ AI reads the source files in S, generates L2 doc for future reference
45
+ - This ensures L2 docs are available for read-heavy analysis tasks, not just modifications
@@ -0,0 +1,15 @@
1
+ # Operation: Rebuild — Detailed Steps
2
+
3
+ Regenerate docs for a specific module from scratch. Requires a module path argument.
4
+
5
+ PRECONDITION: .prizmkit/prizm-docs/ exists. Module path is valid.
6
+
7
+ STEPS:
8
+ 1. Delete existing L1 and all L2 docs for the specified module.
9
+ 2. Re-scan the module directory for files, interfaces, dependencies, subdirectories.
10
+ 3. Generate fresh L1 doc with full module analysis.
11
+ 4. Generate L2 docs for all sub-modules immediately (unlike init, rebuild generates L2 right away to capture current state).
12
+ 5. Update MODULE_INDEX (or MODULE_GROUPS) in root.prizm with new file counts and pointers. Re-evaluate grouping: if total module count > 15 and currently using MODULE_INDEX, convert to MODULE_GROUPS. Regenerate keyword tags for rebuilt modules. **Preserve** any `PROJECT_BRIEF:` line in root.prizm.
13
+ 6. Validate regenerated docs against size limits and format rules.
14
+
15
+ OUTPUT: Regenerated doc summary with before/after comparison.