prizmkit 1.1.3 → 1.1.5

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 (57) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/dev-pipeline/run-bugfix.sh +35 -0
  3. package/bundled/dev-pipeline/run-feature.sh +33 -0
  4. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +221 -0
  5. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +124 -0
  6. package/bundled/dev-pipeline/templates/agent-prompts/dev-implement.md +2 -1
  7. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +4 -0
  8. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +5 -2
  9. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +5 -2
  10. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +20 -1
  11. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +36 -0
  12. package/bundled/dev-pipeline/templates/sections/failure-log-check.md +2 -1
  13. package/bundled/dev-pipeline/templates/sections/phase-analyze-agent.md +3 -0
  14. package/bundled/dev-pipeline/templates/sections/phase-analyze-full.md +3 -0
  15. package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +3 -0
  16. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +3 -0
  17. package/bundled/dev-pipeline/templates/sections/phase-commit.md +3 -0
  18. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +3 -0
  19. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-lite-suffix.md +3 -0
  20. package/bundled/dev-pipeline/templates/sections/phase-critic-code.md +3 -0
  21. package/bundled/dev-pipeline/templates/sections/phase-critic-plan-full.md +3 -0
  22. package/bundled/dev-pipeline/templates/sections/phase-critic-plan.md +3 -0
  23. package/bundled/dev-pipeline/templates/sections/phase-deploy-verification.md +3 -0
  24. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +3 -0
  25. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +3 -0
  26. package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +3 -0
  27. package/bundled/dev-pipeline/templates/sections/phase-plan-agent.md +3 -0
  28. package/bundled/dev-pipeline/templates/sections/phase-plan-lite.md +3 -0
  29. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +3 -0
  30. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +3 -0
  31. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +3 -0
  32. package/bundled/dev-pipeline/templates/sections/phase0-init.md +3 -0
  33. package/bundled/dev-pipeline/templates/sections/phase0-test-baseline.md +3 -0
  34. package/bundled/dev-pipeline/templates/sections/resume-header.md +4 -1
  35. package/bundled/rules/prizm/prizm-commit-workflow.md +1 -0
  36. package/bundled/rules/prizm/prizm-documentation.md +15 -15
  37. package/bundled/rules/prizm/prizm-progressive-loading.md +2 -1
  38. package/bundled/skills/_metadata.json +1 -1
  39. package/bundled/skills/prizm-kit/assets/project-memory-template.md +4 -2
  40. package/bundled/skills/prizmkit-committer/SKILL.md +28 -0
  41. package/bundled/skills/prizmkit-implement/SKILL.md +2 -1
  42. package/bundled/skills/prizmkit-implement/references/deploy-guide-protocol.md +69 -0
  43. package/bundled/skills/prizmkit-init/SKILL.md +2 -1
  44. package/bundled/skills/prizmkit-init/references/config-schema.md +64 -0
  45. package/bundled/skills/prizmkit-init/references/tech-stack-catalog.md +13 -0
  46. package/bundled/skills/prizmkit-init/references/update-supplement.md +9 -0
  47. package/bundled/skills/prizmkit-plan/assets/spec-template.md +56 -0
  48. package/bundled/skills/prizmkit-plan/references/clarify-guide.md +67 -0
  49. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +7 -4
  50. package/bundled/skills/prizmkit-prizm-docs/assets/PRIZM-SPEC.md +31 -1
  51. package/bundled/skills/prizmkit-retrospective/references/knowledge-injection-steps.md +49 -0
  52. package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +63 -0
  53. package/bundled/skills/recovery-workflow/SKILL.md +4 -2
  54. package/bundled/team/prizm-dev-team.json +1 -1
  55. package/package.json +1 -1
  56. package/src/config.js +504 -0
  57. package/src/prompts.js +210 -0
@@ -0,0 +1,67 @@
1
+ # Clarification Phase — Execution Guide
2
+
3
+ Invoked automatically during `/prizmkit-plan` Phase 0 (specify) when `[NEEDS CLARIFICATION]` markers exist, or during Phase 1 (design) when data model ambiguities arise.
4
+
5
+ ---
6
+
7
+ ## Question Strategy
8
+
9
+ **Ask one question at a time.** Batching questions produces lower-quality answers.
10
+
11
+ For each question:
12
+ 1. Cite the exact location in spec.md (e.g., "§3.2 says...")
13
+ 2. State what is ambiguous and why it matters for implementation
14
+ 3. Provide a **recommended answer** with rationale — gives the user a concrete starting point to accept, modify, or reject
15
+
16
+ **Prioritize by implementation impact** (highest first):
17
+ 1. Data model (entities, relationships, field types, constraints, naming) — **hardest to change after code is written**
18
+ 2. Functional scope boundaries
19
+ 3. UX flow and error handling
20
+ 4. Non-functional requirements (performance, security)
21
+ 5. Edge cases and integration points
22
+
23
+ ## Update Discipline
24
+
25
+ After **each** user answer:
26
+ - Immediately update `spec.md` (do not batch at the end)
27
+ - Remove the resolved `[NEEDS CLARIFICATION]` marker
28
+ - Re-evaluate for new ambiguities exposed by the answer
29
+
30
+ ## No Limits Policy
31
+
32
+ **There is no cap on rounds or questions.** Keep asking until:
33
+ - All `[NEEDS CLARIFICATION]` markers are removed, AND
34
+ - No vague or underspecified areas remain, AND
35
+ - You are fully confident about the requirements
36
+
37
+ If the user's answer raises new questions — ask those too. If a previously-resolved item needs revisiting due to new context — go back.
38
+
39
+ ## Early Termination
40
+
41
+ If the user says "done", "stop", or "enough" — end immediately and output a summary of:
42
+ - What was resolved
43
+ - What remains unclear (list any open `[NEEDS CLARIFICATION]` items)
44
+
45
+ ## Example Exchange
46
+
47
+ **Question:**
48
+ > §3.2 says "User can upload files" but doesn't specify file types or size limits.
49
+ >
50
+ > **Recommended:** Accept JPEG, PNG, PDF up to 10MB — covers common use cases without straining storage.
51
+ >
52
+ > Do you agree, or different constraints?
53
+
54
+ **User:** "Also allow SVG, make it 25MB"
55
+
56
+ **Action:** Update spec.md §3.2 → `File upload: JPEG, PNG, PDF, SVG. Max 25MB per file.` Remove marker.
57
+
58
+ **Follow-up question triggered by answer:**
59
+ > SVGs can contain embedded scripts (XSS risk). Should uploaded SVGs be sanitized (strip `<script>` + event handlers), or restricted to trusted users only?
60
+ >
61
+ > **Recommended:** Sanitize all SVG uploads — allows all users to upload safely.
62
+
63
+ ## Guidelines
64
+
65
+ - Stay at WHAT/WHY level — no implementation details (HOW) in spec
66
+ - If an answer contradicts an existing requirement, surface the conflict and ask which takes precedence
67
+ - If the user seems fatigued: "I have N more questions — continue now or later?" — but never silently stop with unresolved ambiguities
@@ -52,6 +52,8 @@ STEPS:
52
52
  - Exclude .git/, node_modules/, vendor/, build/, dist/, __pycache__/, target/, bin/, .claude/, .codebuddy/, .prizmkit/, .prizm-docs/, dev-pipeline/. If total module count > 30, ask user for include/exclude patterns.
53
53
  3. Create .prizm-docs/ directory structure mirroring the source tree exactly. For each top-level module M that has sub-modules, create the subdirectory .prizm-docs/<M>/.
54
54
  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 UPDATED timestamp — git tracks modification times.
55
+ - 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-SPEC for MODULE_GROUPS format.
56
+ - 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.
55
57
  5. Generate L1 .prizm files (structural index only) for ALL modules, each at its correct mirrored path:
56
58
  - Top-level module M → write .prizm-docs/<M>.prizm (include SUBDIRS section with pointers to sub-module docs)
57
59
  - Sub-module S inside M → write .prizm-docs/<M>/<S>.prizm
@@ -72,9 +74,9 @@ PRECONDITION: .prizm-docs/ exists with root.prizm.
72
74
 
73
75
  STEPS:
74
76
  1. Get changed files via `git diff --cached --name-status`. If nothing staged, use `git diff --name-status`. If no git changes at all, do full rescan comparing code against existing docs — this includes checking for modules that have source files but no L2 doc.
75
- 2. Map changed files to modules by matching against MODULE_INDEX in root.prizm. Group changes by module.
77
+ 2. Map changed files to modules by matching against MODULE_INDEX or MODULE_GROUPS in root.prizm. Group changes by module.
76
78
  3. Classify each change: A (added) -> new KEY_FILES entries. D (deleted) -> remove entries, update counts. M (modified) -> check dependency changes. R (renamed) -> update all path references.
77
- 4. Update affected docs: L2 first (KEY_FILES, INTERFACES, DATA_FLOW, DEPENDENCIES, TRAPS, CHANGELOG), then L1 (FILES count, KEY_FILES, DEPENDENCIES — L1 does NOT contain INTERFACES/DATA_FLOW/TRAPS/DECISIONS), then L0 (MODULE_INDEX counts, CROSS_CUTTING) only if structural change. No UPDATED timestamps — git tracks modification times.
79
+ 4. Update affected docs: L2 first (KEY_FILES, INTERFACES, DATA_FLOW, DEPENDENCIES, TRAPS, CHANGELOG), then L1 (FILES count, KEY_FILES, DEPENDENCIES — L1 does NOT contain INTERFACES/DATA_FLOW/TRAPS/DECISIONS), then L0 (MODULE_INDEX or MODULE_GROUPS counts, CROSS_CUTTING) only if structural change. No UPDATED timestamps — git tracks modification times.
78
80
  5. Skip updates if: only internal implementation changed (no interface/dependency change), only comments/whitespace/formatting, only .prizm files changed. DO NOT skip test file changes or bug fixes — they may reveal TRAPS worth capturing in L2.
79
81
  6. If new directory qualifies as a module (per MODULE_DISCOVERY_CRITERIA) and matches no existing module: create L1 immediately, add to MODULE_INDEX. If the current diff includes Added or Modified source files in this module → also create L2 immediately using the L2 GENERATION TEMPLATE. Otherwise defer L2.
80
82
  6a. **L2 gap check** (runs during full rescan mode only — when no git changes detected): For each existing module in MODULE_INDEX, check if L2 doc exists. If L2 is missing and the module has source files with meaningful logic (not trivial config/wrapper) → create L2 using the L2 GENERATION TEMPLATE. This ensures Update fills documentation gaps left by previous sessions.
@@ -110,7 +112,7 @@ STEPS:
110
112
  2. Re-scan the module directory for files, interfaces, dependencies, subdirectories.
111
113
  3. Generate fresh L1 doc with full module analysis.
112
114
  4. Generate L2 docs for all sub-modules immediately (unlike init, rebuild generates L2 right away to capture current state).
113
- 5. Update MODULE_INDEX in root.prizm with new file counts and pointers.
115
+ 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.
114
116
  6. Append rebuild entry to changelog.prizm: `- YYYY-MM-DD | <module-path> | refactor: rebuilt module documentation from scratch`
115
117
  7. Validate regenerated docs against size limits and format rules.
116
118
 
@@ -127,9 +129,10 @@ STEPS:
127
129
  2. SIZE CHECK: Verify size limits: L0 <= 4KB, L1 <= 4KB, L2 <= 5KB. Report files exceeding limits with current size.
128
130
  3. POINTER CHECK: Verify all arrow (->) references resolve to existing .prizm files. Report broken pointers.
129
131
  4. STALENESS CHECK: Compare git modification time of each .prizm file against source directory. Flag docs where source was modified more recently.
130
- 5. COMPLETENESS CHECK: Verify root.prizm has all required fields (PRIZM_VERSION, PROJECT, LANG, MODULE_INDEX). Verify L1 docs have MODULE, FILES, RESPONSIBILITY, DEPENDENCIES (no INTERFACES/TRAPS/DECISIONS). Verify L2 docs have MODULE, FILES, KEY_FILES, DEPENDENCIES, INTERFACES, TRAPS.
132
+ 5. COMPLETENESS CHECK: Verify root.prizm has all required fields (PRIZM_VERSION, PROJECT, LANG, MODULE_INDEX or MODULE_GROUPS). Verify L1 docs have MODULE, FILES, RESPONSIBILITY, DEPENDENCIES (no INTERFACES/TRAPS/DECISIONS). Verify L2 docs have MODULE, FILES, KEY_FILES, DEPENDENCIES, INTERFACES, TRAPS.
131
133
  6. ANTI-PATTERN CHECK: Flag duplicate information across levels, implementation details in L0/L1, TODO items, session-specific context.
132
134
  7. RULES HIERARCHY CHECK: Verify L1/L2 RULES do not contradict root.prizm RULES. L1/L2 may only supplement with module-specific exceptions.
135
+ 8. TRAPS STALENESS CHECK: For each L2 doc where TRAPS section has more than 8 entries, verify that TRAPS include staleness metadata (`STALE_IF:` or `REF:` fields). Flag TRAPS without any staleness metadata as `NEEDS_METADATA` — these are not auto-removed, but flagged for the next `/prizmkit-retrospective` to enrich with `STALE_IF:` globs or `REF:` hashes.
133
136
 
134
137
  OUTPUT: Validation report with PASS/FAIL per check, list of issues with file paths and suggested fixes.
135
138
 
@@ -182,6 +182,36 @@ CONSTRAINTS:
182
182
  - No prose paragraphs
183
183
  - root.prizm RULES are AUTHORITATIVE: they override any conflicting L1/L2 RULES
184
184
 
185
+ ### MODULE_GROUPS (alternative to MODULE_INDEX for projects with 15+ modules)
186
+
187
+ When MODULE_INDEX would exceed 15 entries, replace it with MODULE_GROUPS to stay within the 4KB limit. Group modules by functional domain:
188
+
189
+ MODULE_GROUPS:
190
+ <domain-name>:
191
+ - <module>: <file-count> files. <one-line description>. -> .prizm-docs/<module>.prizm
192
+ - <module>: <file-count> files. <one-line description>. -> .prizm-docs/<module>.prizm
193
+ <domain-name>:
194
+ - <module>: <file-count> files. <one-line description>. -> .prizm-docs/<module>.prizm
195
+
196
+ CONSTRAINTS for MODULE_GROUPS:
197
+ - Exactly ONE of MODULE_INDEX or MODULE_GROUPS must be present in root.prizm (not both)
198
+ - Domain names: lowercase, descriptive (e.g., api, frontend, infrastructure, shared, data)
199
+ - 3-8 domains is the ideal range
200
+ - Each module appears in exactly one domain
201
+ - Every entry must have an arrow pointer (->), same as MODULE_INDEX
202
+ - AI should load the relevant domain's modules when working on a task, not all domains
203
+
204
+ ### Optional Keyword Tags (applies to both MODULE_INDEX and MODULE_GROUPS)
205
+
206
+ Entries may include keyword tags for AI intent matching:
207
+
208
+ MODULE_INDEX:
209
+ - auth [login, session, jwt, oauth]: 12 files. Authentication and authorization. -> .prizm-docs/auth.prizm
210
+ - payments [stripe, billing, subscription]: 8 files. Payment processing. -> .prizm-docs/payments.prizm
211
+ - users: 6 files. User management. -> .prizm-docs/users.prizm
212
+
213
+ 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.
214
+
185
215
  ## 3.2 L1: module.prizm (Structural Index)
186
216
 
187
217
  TEMPLATE:
@@ -582,7 +612,7 @@ STEPS:
582
612
 
583
613
  4. GENERATE_ROOT (L0):
584
614
  Fill: PROJECT, LANG, FRAMEWORK, BUILD, TEST, ENTRY from step 1
585
- Build: MODULE_INDEX — list modules at the depth needed for efficient navigation, with arrow pointers
615
+ Build: MODULE_INDEX (or MODULE_GROUPS if 15+ modules see Section 3.1) — list modules at the depth needed for efficient navigation, with arrow pointers
586
616
  Extract: RULES from existing README, .editorconfig, linter configs
587
617
  Extract: PATTERNS from common code patterns observed in step 2
588
618
  Extract: CROSS_CUTTING — identify patterns/constraints that span 2+ modules
@@ -0,0 +1,49 @@
1
+ # Knowledge Injection — Detailed Steps (2a–2c)
2
+
3
+ **2a.** Gather context — read the **actual code that was changed** plus any available artifacts:
4
+
5
+ - `git diff HEAD` — the real source of truth for what happened
6
+ - `.prizmkit/specs/###-feature-name/context-snapshot.md` — read the '## Implementation Log' section (Dev's changes, decisions, discoveries) and '## Review Notes' section (Reviewer's findings). These are the **preferred source** for pre-categorized decisions and findings. If these sections exist, prefer them over re-extracting from git diff.
7
+ - `.prizmkit/specs/###-feature-name/plan.md` — if feature work, read planned vs actual
8
+ - `.prizmkit/bugfix/<id>/fix-report.md` — if bugfix, read what was discovered
9
+ - `.prizmkit/specs/###-feature-name/failure-log.md` — if a previous session failed, read DISCOVERED_TRAPS. These are high-value TRAPS because they come from actual failures — prioritize injecting them into `.prizm-docs/`
10
+ - The relevant `.prizm-docs/` L1/L2 docs for affected modules
11
+
12
+ **2b.** Extract knowledge from what was **observed in code**, not invented:
13
+
14
+ **TRAPS** (highest priority) — things that look safe but break:
15
+ - Minimal format: `- [SEVERITY] <description> | FIX: <approach>`
16
+ - Full format: `- [SEVERITY] <description> | FIX: <approach> | REF: <hash> | STALE_IF: <glob>`
17
+ - Source: actual bugs hit, surprising behavior discovered in code, non-obvious coupling
18
+
19
+ **TRAPS severity classification**:
20
+ - `[CRITICAL]`: data loss, security, financial error, system crash
21
+ - `[HIGH]`: functional failure, silent error, interface incompatibility
22
+ - `[LOW]`: misleading naming, non-intuitive API, minor performance issue
23
+
24
+ When writing TRAPS:
25
+ - Severity prefix is MANDATORY (e.g., `[CRITICAL]`, `[HIGH]`, `[LOW]`)
26
+ - OPTIONAL: append `| REF: <7-char-hash>` when you know the relevant commit (for traceability)
27
+ - OPTIONAL: append `| STALE_IF: <glob>` when the TRAP is tightly coupled to specific files (for auto-expiry detection)
28
+
29
+ **Consuming [REVIEW] markers** (from staleness check 1g):
30
+ - If you encounter a TRAP prefixed with `[REVIEW]` (e.g., `[REVIEW][HIGH] ...`), verify whether the trap is still valid by checking the current code. If still valid: remove the `[REVIEW]` prefix, keeping the severity. If no longer relevant: delete the TRAP entry and append CHANGELOG.
31
+
32
+ **RULES** — conventions established or constraints discovered:
33
+ - Format: `- MUST/NEVER/PREFER: <rule>`
34
+ - Source: patterns that proved necessary during implementation
35
+
36
+ **DECISIONS** — key design choices that affect future development:
37
+ - Format: `- <what was decided> — <rationale>`
38
+ - Source: non-obvious design choices, interface conventions, cross-module contracts
39
+ - Only record decisions that a future AI session would benefit from knowing
40
+ - Do NOT record obvious implementation details that can be derived by reading the code
41
+
42
+ **QUALITY GATE**: Every item must answer: "If a new AI session reads only `.prizm-docs/` and this entry, does it gain actionable understanding?" If not, discard. Do not record trivially observable code patterns — the AI can read the code directly.
43
+
44
+ **2c.** Inject into the correct `.prizm-docs/` file:
45
+ - Module-level TRAPS/RULES/DECISIONS → the affected **L2** `.prizm` file. If the target L2 does not exist, create it first using the L2 GENERATION TEMPLATE before injecting knowledge. (TRAPS/DECISIONS/RULES belong in L2, not L1.)
46
+ - Project-level RULES/PATTERNS → `root.prizm` (respect the current format — MODULE_INDEX or MODULE_GROUPS — do not convert between them during injection)
47
+ - Cross-module concerns spanning 2+ modules → `root.prizm` CROSS_CUTTING section
48
+
49
+ **RULE**: Only add genuinely new information. Never duplicate existing entries. Never rewrite entire files.
@@ -0,0 +1,63 @@
1
+ # Structural Sync — Detailed Steps (1a–1g)
2
+
3
+ **1a.** Get changed files:
4
+ ```bash
5
+ git diff --cached --name-status
6
+ ```
7
+ If nothing staged, fallback:
8
+ ```bash
9
+ git diff --name-status
10
+ ```
11
+
12
+ **1b.** Read `.prizm-docs/root.prizm` to get MODULE_INDEX (or MODULE_GROUPS). Map each changed file to its module.
13
+
14
+ **1c.** Classify changes:
15
+ - `A` (added) → add to KEY_FILES, check for new INTERFACES
16
+ - `D` (deleted) → remove from KEY_FILES, update FILE count
17
+ - `M` (modified) → check if public interfaces or dependencies changed
18
+ - `R` (renamed) → update all path references
19
+
20
+ **1d.** Update affected docs (bottom-up: L2 → L1 → L0):
21
+
22
+ - **L2**: If L2 exists → update KEY_FILES, INTERFACES, DATA_FLOW, DEPENDENCIES, CHANGELOG, TRAPS, DECISIONS. If L2 does NOT exist AND the module has Added or Modified source files in the current diff with meaningful logic (not trivial config) → create L2 using the L2 GENERATION TEMPLATE, then populate from source.
23
+ - **L1**: Update FILES count, KEY_FILES (if major files added/removed), DEPENDENCIES (if module-level deps changed). **L1 does NOT contain INTERFACES, DATA_FLOW, TRAPS, or DECISIONS** — those belong in L2 only.
24
+ - **L0 root.prizm**: Update MODULE_INDEX file counts only if counts changed. Update CROSS_CUTTING if cross-module concerns changed. Update only if structural change (module added/removed).
25
+
26
+ **1d-migrate.** Legacy TRAPS format migration (opportunistic):
27
+ While updating an affected L1/L2 doc, if you encounter TRAPS entries **without** a severity prefix (e.g., `- foo | FIX: bar` instead of `- [LOW] foo | FIX: bar`), prepend `[LOW]` as a conservative default. This clears legacy format debt incrementally — only in files already being touched, never as a bulk operation.
28
+
29
+ **1e.** If new directory qualifies as a module (per MODULE_DISCOVERY_CRITERIA in PRIZM-SPEC Section 9.1 Step 2) and matches no existing module:
30
+ 1. Create L1 doc immediately, add to MODULE_INDEX.
31
+ 2. If the current diff includes Added or Modified source files with meaningful logic in this module → create L2 immediately using the L2 GENERATION TEMPLATE. Otherwise defer L2 to the next session that touches this module.
32
+
33
+ **1f.** Enforce size limits:
34
+ - L0 > 4KB → if using MODULE_INDEX with > 15 entries, convert to MODULE_GROUPS format (group by functional domain). Otherwise, consolidate MODULE_INDEX descriptions.
35
+ - L1 > 4KB → trim KEY_FILES descriptions, ensure RULES <= 3 entries
36
+ - L2 > 5KB → archive old CHANGELOG entries
37
+
38
+ **SKIP structural sync if**: only internal implementation changed (no interface/dependency impact), only comments/whitespace, only .prizm files. **DO NOT skip** test file changes or bug fixes — they may reveal TRAPS worth capturing in L2.
39
+
40
+ **1g. TRAPS staleness check** (only when an L2 doc's TRAPS section has > 10 entries):
41
+
42
+ (Note: `/prizmkit-prizm-docs` Validate uses a lower threshold of > 8 entries to flag TRAPS needing staleness metadata. This step uses > 10 because it performs actual cleanup, which is more expensive. Validate warns early; this step acts later.)
43
+
44
+ Perform a quick staleness scan on existing TRAPS to prevent unbounded accumulation:
45
+ 1. If a TRAP has `STALE_IF:` and the glob-matched files no longer exist (verified via `ls`) → delete the TRAP entry, append CHANGELOG: `remove: archived stale TRAP - <summary>`
46
+ 2. If a TRAP has `REF:` → check if the referenced file still exists and the REF commit is less than 180 days old (via `git log --since="180 days ago" <hash> 2>/dev/null`). If the file is deleted OR the REF commit is older than 180 days → prepend `[REVIEW]` to the severity, signaling it needs verification during the next retrospective Job 2
47
+ 3. Process at most 5 of the oldest TRAPS per L2 doc per session (to bound context cost)
48
+
49
+ This step is lightweight — it only triggers when TRAPS exceed 10 entries, and processes at most 5 per run.
50
+
51
+ **1h. Periodic full TRAPS audit** (runs approximately once every 10 retrospective sessions):
52
+
53
+ Check `.prizm-docs/changelog.prizm` for the marker `audit: traps-audit full-scan`. If the marker does not exist, OR the most recent `audit: traps-audit full-scan` entry has 10+ other changelog entries after it:
54
+
55
+ 1. Scan ALL L2 `.prizm` files (not just ones touched this session)
56
+ 2. For each L2 doc with TRAPS entries:
57
+ - Verify referenced file paths still exist (via `ls`)
58
+ - If `STALE_IF:` glob matches zero files → delete the TRAP, append CHANGELOG: `remove: archived stale TRAP - <summary>`
59
+ - If `REF:` commit is older than 180 days AND the referenced file was significantly refactored (>50% lines changed since REF commit) → prepend `[REVIEW]`
60
+ 3. Process at most 3 TRAPS per L2 doc to bound context cost (total max ~15 TRAPS per audit)
61
+ 4. Append to `.prizm-docs/changelog.prizm`: `- root | audit: traps-audit full-scan — checked N docs, removed M stale, marked K for review`
62
+
63
+ This is a lightweight background pass. If the project has fewer than 5 L2 docs, skip this step (not enough accumulation to warrant auditing).
@@ -159,8 +159,10 @@ If the user declines, suggest alternatives:
159
159
  ### 2.0 Read Target Workflow
160
160
 
161
161
  1. **Read the workflow's SKILL.md** from `core/skills/orchestration-skill/workflows/{workflow-type}/SKILL.md`
162
- 2. **Read existing artifacts** to restore context (spec, plan, code diffs, bug descriptions, etc.)
163
- 3. **Read relevant `.prizm-docs/`** load project context (L0 root, relevant L1)
162
+ 2. **Read existing artifacts** to restore context check in this order for the most efficient recovery:
163
+ - If `session-summary.md` exists in the artifact directory read it first. It provides a lightweight summary of completed tasks, key decisions, active TRAPS, and remaining work from the interrupted session.
164
+ - Then read remaining artifacts: spec, plan, code diffs, bug descriptions, etc.
165
+ 3. **Read relevant `.prizm-docs/`** — load project context (L0 root, relevant L1). If `session-summary.md` was found, use its "Files Changed" section to focus L1/L2 loading on affected modules only.
164
166
 
165
167
  This step replaces the context that was lost when the AI session was interrupted.
166
168
 
@@ -11,7 +11,7 @@
11
11
  "members": [
12
12
  {
13
13
  "name": "dev",
14
- "role": "developer",
14
+ "role": "developer",
15
15
  "agentDefinition": "prizm-dev-team-dev",
16
16
  "prompt": "You are a Dev Agent of the prizm-dev-team. Follow /prizmkit-implement workflow with TDD. Read plan.md/spec.md, implement task-by-task, mark completed tasks [x]. Check .prizm-docs/ TRAPS before implementing.",
17
17
  "subscriptions": ["*"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prizmkit",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Create a new PrizmKit-powered project with clean initialization — no framework dev files, just what you need.",
5
5
  "type": "module",
6
6
  "bin": {