prizmkit 1.1.1 → 1.1.3

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 (99) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/claude/agent-adapter.js +18 -0
  3. package/bundled/adapters/claude/command-adapter.js +1 -27
  4. package/bundled/agents/prizm-dev-team-critic.md +2 -0
  5. package/bundled/agents/prizm-dev-team-dev.md +2 -0
  6. package/bundled/agents/prizm-dev-team-reviewer.md +2 -0
  7. package/bundled/dev-pipeline/README.md +63 -63
  8. package/bundled/dev-pipeline/assets/feature-list-example.json +1 -1
  9. package/bundled/dev-pipeline/assets/prizm-dev-team-integration.md +1 -1
  10. package/bundled/dev-pipeline/{launch-daemon.sh → launch-feature-daemon.sh} +33 -33
  11. package/bundled/dev-pipeline/launch-refactor-daemon.sh +454 -0
  12. package/bundled/dev-pipeline/lib/branch.sh +1 -1
  13. package/bundled/dev-pipeline/reset-feature.sh +3 -3
  14. package/bundled/dev-pipeline/reset-refactor.sh +312 -0
  15. package/bundled/dev-pipeline/{retry-bug.sh → retry-bugfix.sh} +47 -59
  16. package/bundled/dev-pipeline/retry-feature.sh +41 -54
  17. package/bundled/dev-pipeline/retry-refactor.sh +358 -0
  18. package/bundled/dev-pipeline/run-bugfix.sh +6 -0
  19. package/bundled/dev-pipeline/{run.sh → run-feature.sh} +31 -31
  20. package/bundled/dev-pipeline/run-refactor.sh +787 -0
  21. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +177 -10
  22. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +419 -0
  23. package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +393 -0
  24. package/bundled/dev-pipeline/scripts/update-refactor-status.py +726 -0
  25. package/bundled/dev-pipeline/templates/agent-prompts/critic-code-challenge.md +13 -0
  26. package/bundled/dev-pipeline/templates/agent-prompts/critic-plan-challenge.md +7 -0
  27. package/bundled/dev-pipeline/templates/agent-prompts/dev-fix.md +7 -0
  28. package/bundled/dev-pipeline/templates/agent-prompts/dev-implement.md +26 -0
  29. package/bundled/dev-pipeline/templates/agent-prompts/dev-resume.md +5 -0
  30. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-analyze.md +5 -0
  31. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-review.md +12 -0
  32. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +29 -2
  33. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +8 -7
  34. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +11 -10
  35. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +2 -3
  36. package/bundled/dev-pipeline/templates/feature-list-schema.json +1 -1
  37. package/bundled/dev-pipeline/templates/refactor-list-schema.json +159 -0
  38. package/bundled/dev-pipeline/templates/sections/ac-verification-checklist.md +13 -0
  39. package/bundled/dev-pipeline/templates/sections/feature-context.md +1 -1
  40. package/bundled/dev-pipeline/templates/sections/phase-analyze-agent.md +9 -8
  41. package/bundled/dev-pipeline/templates/sections/phase-analyze-full.md +9 -8
  42. package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +2 -1
  43. package/bundled/dev-pipeline/templates/sections/phase-critic-code.md +8 -10
  44. package/bundled/dev-pipeline/templates/sections/phase-critic-plan-full.md +9 -10
  45. package/bundled/dev-pipeline/templates/sections/phase-critic-plan.md +8 -9
  46. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +7 -10
  47. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +8 -15
  48. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +7 -12
  49. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +8 -19
  50. package/bundled/dev-pipeline/templates/sections/test-failure-recovery.md +75 -0
  51. package/bundled/skills/_metadata.json +33 -6
  52. package/bundled/skills/app-planner/SKILL.md +105 -320
  53. package/bundled/skills/app-planner/assets/app-design-guide.md +101 -0
  54. package/bundled/skills/app-planner/references/frontend-design-guide.md +1 -1
  55. package/bundled/skills/app-planner/references/project-brief-guide.md +49 -80
  56. package/bundled/skills/bug-fix-workflow/SKILL.md +2 -2
  57. package/bundled/skills/bug-planner/SKILL.md +68 -5
  58. package/bundled/skills/bug-planner/scripts/validate-bug-list.py +3 -2
  59. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +19 -5
  60. package/bundled/skills/{dev-pipeline-launcher → feature-pipeline-launcher}/SKILL.md +32 -32
  61. package/bundled/skills/feature-planner/SKILL.md +337 -0
  62. package/bundled/skills/{app-planner → feature-planner}/assets/evaluation-guide.md +4 -4
  63. package/bundled/skills/{app-planner → feature-planner}/assets/planning-guide.md +3 -171
  64. package/bundled/skills/{app-planner → feature-planner}/references/browser-interaction.md +6 -5
  65. package/bundled/skills/feature-planner/references/decomposition-patterns.md +75 -0
  66. package/bundled/skills/{app-planner → feature-planner}/references/error-recovery.md +8 -8
  67. package/bundled/skills/{app-planner → feature-planner}/references/incremental-feature-planning.md +1 -1
  68. package/bundled/skills/{app-planner/references/new-app-planning.md → feature-planner/references/new-project-planning.md} +1 -1
  69. package/bundled/skills/{app-planner → feature-planner}/scripts/validate-and-generate.py +4 -4
  70. package/bundled/skills/feature-workflow/SKILL.md +23 -23
  71. package/bundled/skills/prizm-kit/SKILL.md +1 -3
  72. package/bundled/skills/prizmkit-analyze/SKILL.md +2 -5
  73. package/bundled/skills/prizmkit-code-review/SKILL.md +2 -2
  74. package/bundled/skills/prizmkit-committer/SKILL.md +4 -8
  75. package/bundled/skills/prizmkit-deploy/SKILL.md +1 -5
  76. package/bundled/skills/prizmkit-implement/SKILL.md +3 -50
  77. package/bundled/skills/prizmkit-init/SKILL.md +5 -77
  78. package/bundled/skills/prizmkit-plan/SKILL.md +1 -12
  79. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +6 -24
  80. package/bundled/skills/prizmkit-prizm-docs/assets/PRIZM-SPEC.md +21 -0
  81. package/bundled/skills/prizmkit-retrospective/SKILL.md +12 -117
  82. package/bundled/skills/recovery-workflow/SKILL.md +166 -316
  83. package/bundled/skills/recovery-workflow/evals/evals.json +29 -13
  84. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +232 -274
  85. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +352 -0
  86. package/bundled/skills/refactor-planner/SKILL.md +436 -0
  87. package/bundled/skills/refactor-planner/assets/planning-guide.md +292 -0
  88. package/bundled/skills/refactor-planner/references/behavior-preservation.md +301 -0
  89. package/bundled/skills/refactor-planner/references/refactor-scoping-guide.md +221 -0
  90. package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +786 -0
  91. package/bundled/skills/refactor-workflow/SKILL.md +299 -319
  92. package/package.json +1 -1
  93. package/src/clean.js +3 -3
  94. package/src/scaffold.js +6 -6
  95. package/bundled/skills/prizmkit-plan/assets/spec-template.md +0 -56
  96. package/bundled/skills/prizmkit-plan/references/clarify-guide.md +0 -67
  97. package/src/config.js +0 -504
  98. package/src/prompts.js +0 -210
  99. /package/bundled/skills/{dev-pipeline-launcher → feature-pipeline-launcher}/scripts/preflight-check.py +0 -0
@@ -1,12 +1,10 @@
1
1
  ---
2
2
  name: "prizmkit-implement"
3
- description: "Execute implementation following plan.md tasks. Respects task ordering, dependencies, and TDD approach. Marks tasks complete as they finish. Use this skill whenever you're ready to write code for a planned feature, or for fast-path changes where the user describes a simple fix directly. Trigger on: 'implement', 'build', 'code it', 'start coding', 'develop', 'write the code'. (project)"
3
+ description: "Execute plan.md tasks with TDD approach. Respects task ordering and dependencies. Use after /prizmkit-plan (or /prizmkit-analyze). Trigger on: 'implement', 'build', 'code it', 'start coding', 'execute', 'write the code'. (project)"
4
4
  ---
5
5
 
6
6
  # PrizmKit Implement
7
7
 
8
- Execute implementation by following the task breakdown in plan.md. Respects task ordering, dependency constraints, and applies a TDD approach where applicable. Marks each task complete as it finishes.
9
-
10
8
  ### When to Use
11
9
  - After `/prizmkit-plan` (or `/prizmkit-analyze`) when ready to write code
12
10
  - User says "implement", "build", "code it", "start coding", "develop"
@@ -49,53 +47,8 @@ Execute implementation by following the task breakdown in plan.md. Respects task
49
47
  f. Error handling: sequential tasks stop on failure (later tasks may depend on this one). Parallel `[P]` tasks continue — report all failures at the end.
50
48
  5. At each checkpoint: verify build passes and tests pass. Checkpoints catch integration errors early — skipping them means cascading failures in later phases that are much harder to debug.
51
49
  6. After all tasks: run full test suite
52
- 7. **Deploy guide update** (only when new frameworks/tools were added):
53
- - Check if any dependency manifests were modified in this session:
54
- ```bash
55
- git diff --name-only HEAD -- package.json requirements*.txt Pipfile pyproject.toml go.mod Cargo.toml pom.xml build.gradle Gemfile composer.json docker-compose*.yml Dockerfile .tool-versions 2>/dev/null
56
- ```
57
- - If no manifest files changed → skip this step entirely
58
- - If manifest files changed, scan for **newly added** dependencies (not version bumps):
59
- ```bash
60
- git diff -U0 HEAD -- package.json requirements*.txt Pipfile pyproject.toml go.mod Cargo.toml pom.xml build.gradle Gemfile composer.json docker-compose*.yml Dockerfile .tool-versions 2>/dev/null | grep '^\+' | grep -v '^\+\+\+' | head -30
61
- ```
62
- - For each genuinely new framework/tool, record in `deploy_guide.md` at project root:
63
-
64
- | Field | Description | Source |
65
- |-------|-------------|--------|
66
- | **Name** | Framework/tool name | Package name from manifest |
67
- | **Version** | Installed version or constraint | Version spec from manifest |
68
- | **Purpose** | Why it was introduced | You just added it — you know why |
69
- | **Install Command** | How to install locally | Standard install command for the ecosystem |
70
- | **Key Config** | Config files or env vars needed | Config files you just created/modified |
71
- | **Notes** | Setup gotchas, required services | Docker services, manual steps, env vars |
72
-
73
- - Template for `deploy_guide.md`:
74
- ```markdown
75
- # Deploy Guide
76
-
77
- > Auto-maintained by PrizmKit. Manual edits are preserved.
78
- > Last updated: YYYY-MM-DD
79
-
80
- ## Frameworks & Tools
81
-
82
- ### <Framework Name>
83
-
84
- - **Version**: <version constraint>
85
- - **Purpose**: <why this framework is used>
86
- - **Install**:
87
- ```bash
88
- <install command>
89
- ```
90
- - **Key Config**:
91
- - `<config file or env var>`: <description>
92
- - **Notes**:
93
- - <any setup gotchas, required external services, manual steps>
94
- ```
95
-
96
- - **Update rules**: create file if absent; append new sections if file exists; update version if framework already documented; preserve manually added content; keep entries sorted alphabetically
97
- - **Filter out**: patch version bumps of existing deps, dev-only tools needing no setup (linters, formatters), transitive/lock-file-only changes
98
- - Stage the file: `git add deploy_guide.md`
50
+ 7. **Deploy guide update** only when dependency manifests (package.json, requirements.txt, etc.) changed during this task.
51
+ Read `${SKILL_DIR}/references/deploy-guide-protocol.md` and follow its protocol.
99
52
  8. Output implementation summary with pass/fail status
100
53
 
101
54
  ## Task Format in plan.md
@@ -63,16 +63,8 @@ BROWNFIELD WORKFLOW (existing project):
63
63
  3. Identify entry points by language convention
64
64
  4. Catalog dependencies (external packages)
65
65
  5. Count source files per directory
66
- 6. Detect detailed tech stack (adaptive — only include fields that apply to this project):
67
- - **Language & Runtime**: e.g. TypeScript + Node.js 20, Python 3.11, Go 1.22
68
- - **Frontend framework** (if applicable): React, Vue.js, Angular, Next.js, Svelte, etc.
69
- - **Frontend styling** (if applicable): Tailwind CSS, SCSS, Styled Components, Material UI, etc.
70
- - **Backend framework** (if applicable): Express.js, FastAPI, Django, NestJS, Gin, etc.
71
- - **Database** (if applicable): PostgreSQL, MySQL, MongoDB, Redis, SQLite — detected from deps or `docker-compose.yml`
72
- - **ORM** (if applicable): Prisma, Drizzle, TypeORM, SQLAlchemy, Mongoose, etc.
73
- - **Bundler** (if applicable): Vite, Webpack, esbuild, Rollup, Turborepo
74
- - **Testing**: Vitest, Jest, pytest, Go test, etc.
75
- - **Project type** (inferred): `frontend` | `backend` | `fullstack` | `library` | `cli` | `monorepo`
66
+ 6. Detect detailed tech stack (adaptive — only include fields that apply):
67
+ Read `${SKILL_DIR}/references/tech-stack-catalog.md` for the full field catalog.
76
68
 
77
69
  **IMPORTANT**: Not all projects have all fields. A pure backend API will have no `frontend_framework` or `frontend_styling`. A library may have no database. Only record what is actually detected — never generate empty or placeholder values.
78
70
 
@@ -90,55 +82,7 @@ Invoke prizmkit-prizm-docs (Init operation), passing the two-tier module structu
90
82
  - `.prizmkit/specs/` (empty)
91
83
 
92
84
  3b. Write detected tech stack to `.prizmkit/config.json`:
93
-
94
- **Merge strategy** (handles re-init without losing user edits):
95
- - Read existing `config.json` if present
96
- - If `tech_stack` field exists AND `_auto_detected` is `false` or absent:
97
- → **SKIP** — user has manually configured tech stack, preserve their settings
98
- - If `tech_stack` field exists AND `_auto_detected` is `true`:
99
- → **MERGE** — overwrite auto-detected values with new detection results, but preserve any keys the user added manually (keys not in the new detection result)
100
- - If `tech_stack` field does NOT exist:
101
- → **WRITE** full detected tech stack with `"_auto_detected": true`
102
- - Only include fields that were actually detected (no empty/null values)
103
-
104
- Example config.json after init (fullstack project):
105
- ```json
106
- {
107
- "adoption_mode": "passive",
108
- "platform": "claude",
109
- "tech_stack": {
110
- "language": "TypeScript",
111
- "runtime": "Node.js 20",
112
- "frontend_framework": "React",
113
- "frontend_styling": "Tailwind CSS",
114
- "backend_framework": "Express.js",
115
- "database": "PostgreSQL",
116
- "orm": "Prisma",
117
- "testing": "Vitest",
118
- "bundler": "Vite",
119
- "project_type": "fullstack",
120
- "_auto_detected": true
121
- }
122
- }
123
- ```
124
-
125
- Example config.json after init (pure Python backend):
126
- ```json
127
- {
128
- "adoption_mode": "passive",
129
- "platform": "claude",
130
- "tech_stack": {
131
- "language": "Python",
132
- "runtime": "Python >=3.11",
133
- "backend_framework": "FastAPI",
134
- "database": "PostgreSQL",
135
- "orm": "SQLAlchemy",
136
- "testing": "pytest",
137
- "project_type": "backend",
138
- "_auto_detected": true
139
- }
140
- }
141
- ```
85
+ → Read `${SKILL_DIR}/references/config-schema.md` for merge strategy, field definitions, and examples.
142
86
 
143
87
  **Step 4: Hook & Settings Configuration**
144
88
 
@@ -165,16 +109,7 @@ Tech stack detected:
165
109
  Project type: fullstack
166
110
  ```
167
111
 
168
- For a pure backend Python project, the report would show:
169
- ```
170
- Tech stack detected:
171
- Language: Python
172
- Runtime: Python >=3.11
173
- Backend: FastAPI
174
- Database: PostgreSQL (SQLAlchemy)
175
- Testing: pytest
176
- Project type: backend
177
- ```
112
+ Adapt fields to match project type only show detected fields.
178
113
 
179
114
  Saved to: `.prizmkit/config.json` → `tech_stack` field
180
115
 
@@ -243,12 +178,7 @@ Next: Use /prizmkit-plan to start your first feature
243
178
  ```
244
179
 
245
180
  UPDATE SUPPLEMENT (runs after tech stack merge in Update mode):
246
-
247
- 1. **Module scan**: Re-scan project directories using the same TWO-TIER model from Step 1. Compare discovered modules against existing MODULE_INDEX in root.prizm.
248
- 2. **Missing L1 check**: For any discovered module with no corresponding L1 `.prizm` doc → create L1 immediately and add to MODULE_INDEX.
249
- 3. **Missing L2 check**: For any module/sub-module that has source files with meaningful logic but no L2 `.prizm` doc → create L2 using the L2 GENERATION TEMPLATE. Judgment call: skip trivial wrapper directories or single-config modules.
250
- 4. **Stale L1 check**: For existing L1 docs, verify FILES count and KEY_FILES are still accurate. Update if source directory contents have changed significantly.
251
- 5. **Report**: Include in the Update report: modules added, L1 docs created, L2 docs created, stale docs refreshed.
181
+ → Read `${SKILL_DIR}/references/update-supplement.md` for the 5-step gap-fill procedure.
252
182
 
253
183
  **Re-init after PrizmKit upgrade (existing config preserved):**
254
184
  ```
@@ -270,5 +200,3 @@ Documentation gap-fill:
270
200
 
271
201
  Merged into .prizmkit/config.json (2 fields updated, user overrides preserved)
272
202
  ```
273
-
274
- IMPORTANT: Use `${SKILL_DIR}` placeholder for all path references. Never hardcode absolute paths.
@@ -1,12 +1,10 @@
1
1
  ---
2
2
  name: "prizmkit-plan"
3
- description: "Specify and plan features in one step. Transforms natural language into structured spec.md, then generates plan.md with architecture and executable tasks. Use this skill whenever the user wants to define a feature, write requirements, design implementation, or break work into tasks. Trigger on: 'specify', 'plan', 'new feature', 'I want to add...', 'I want to build...', 'architect', 'design', 'break it down', 'create tasks', 'how to build', 'let's add', 'feature idea'. Always use before /prizmkit-implement. Skip specify phase for bug fixes or simple refactors. (project)"
3
+ description: "Specify and plan features: natural language spec.md plan.md with architecture and executable tasks. Supports feature, refactor, and bugfix modes. Use before /prizmkit-implement. Trigger on: 'specify', 'plan', 'new feature', 'I want to add/build...', 'architect', 'design', 'break it down', 'create tasks'. (project)"
4
4
  ---
5
5
 
6
6
  # PrizmKit Plan
7
7
 
8
- Define WHAT to build, then design HOW to build it — in one continuous flow. Phase 0 produces `spec.md` (requirements), Phase 1-2 produce `plan.md` (architecture + tasks).
9
-
10
8
  ### When to Use
11
9
  - New feature — user says "specify", "plan", "new feature", "I want to add..."
12
10
  - Before `/prizmkit-implement` — to create the spec + task breakdown
@@ -99,15 +97,6 @@ If no input document exists, prompt user to describe the feature (triggers Phase
99
97
 
100
98
  **HANDOFF:** `/prizmkit-implement`
101
99
 
102
- ## Handling Vague Inputs
103
-
104
- When the user's description is vague:
105
- 1. Extract what IS clear and write it into the spec
106
- 2. Mark ambiguous parts with `[NEEDS CLARIFICATION]` + recommended default
107
- 3. Auto-clarification (Phase 0, step 9) resolves interactively before planning
108
-
109
- Never block progress — always produce a usable spec, even with open questions.
110
-
111
100
  ## Example
112
101
 
113
102
  **Input:** "I want users to upload avatars"
@@ -124,7 +124,7 @@ PRECONDITION: .prizm-docs/ exists.
124
124
 
125
125
  STEPS:
126
126
  1. FORMAT CHECK: Verify all .prizm files use KEY: value format. Flag any prose paragraphs, code blocks (```), markdown headers (##), emoji, ASCII art, or horizontal rules. Flag TRAPS entries missing severity prefix ([CRITICAL], [HIGH], or [LOW]). Note: [REVIEW] preceding severity (e.g., `[REVIEW][HIGH]`) is a valid temporary staleness marker, not a format violation.
127
- 2. SIZE CHECK: Verify size limits: L0 <= 4KB, L1 <= 3KB, L2 <= 5KB. Report files exceeding limits with current size.
127
+ 2. SIZE CHECK: Verify size limits: L0 <= 4KB, L1 <= 4KB, L2 <= 5KB. Report files exceeding limits with current size.
128
128
  3. POINTER CHECK: Verify all arrow (->) references resolve to existing .prizm files. Report broken pointers.
129
129
  4. STALENESS CHECK: Compare git modification time of each .prizm file against source directory. Flag docs where source was modified more recently.
130
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.
@@ -157,29 +157,11 @@ OUTPUT: Migration report with list of source docs processed, generated .prizm fi
157
157
  - **Size limit exceeded**: For L0, consolidate MODULE_INDEX entries. For L1, move implementation details to L2. For L2, archive CHANGELOG entries older than 90 days.
158
158
  - **No git history available**: Fall back to filesystem timestamps for freshness checks; warn user that accuracy may be reduced.
159
159
 
160
- ## Progressive Loading Protocol
161
-
162
- When working in a project with .prizm-docs/:
163
-
164
- - ON SESSION START: Always read .prizm-docs/root.prizm (L0). This is the project map.
165
- - ON TASK: Read L1 docs for relevant modules referenced in MODULE_INDEX.
166
- - ON FILE EDIT: Read L2 doc before modifying files. Check TRAPS and DECISIONS sections. If L2 does not exist and you are creating/modifying significant source files in this module → generate L2 using the L2 GENERATION TEMPLATE before proceeding.
167
- - ON DEEP READ: If you need deep understanding of a module without modifying it, generate L2 if it doesn't exist.
168
- - NEVER load all .prizm docs at once. Progressive loading saves tokens.
169
- - BUDGET: Typical task should consume 3000-5000 tokens of Prizm docs total.
170
-
171
- ## Auto-Update Protocol
172
-
173
- - BEFORE EVERY COMMIT: Run `/prizmkit-retrospective` which is the **sole maintainer** of .prizm-docs/. It handles structural sync and TRAPS/RULES/DECISIONS injection to `.prizm-docs/`.
174
- - The UserPromptSubmit hook will remind you automatically when commit intent is detected.
175
- - `/prizmkit-committer` does NOT update .prizm-docs/ — it only commits what is already staged.
176
- - NEVER rewrite entire .prizm files. Only update affected sections.
177
-
178
- ## RULES Hierarchy
179
-
180
- - root.prizm RULES are authoritative and apply project-wide.
181
- - L1/L2 RULES only supplement root.prizm with module-specific exceptions.
182
- - If L1/L2 RULES contradict root.prizm RULES, root.prizm takes precedence.
160
+ ### Key Protocols (reference)
161
+ For detailed protocol specifications, see PRIZM-SPEC:
162
+ - Progressive Loading: Section 6.1
163
+ - Auto-Update: Section 7.1
164
+ - RULES hierarchy: Section 3.1
183
165
 
184
166
  ## Examples
185
167
 
@@ -8,6 +8,27 @@ LICENSE: MIT
8
8
 
9
9
  ---
10
10
 
11
+ ## Table of Contents
12
+
13
+ 1. Overview (L32–49)
14
+ 2. Architecture (L50–127)
15
+ 3. Document Format Specification (L128–308)
16
+ 4. Format Conventions (L309–321)
17
+ 5. Path Mapping Rules (L322–351)
18
+ 6. Progressive Loading Protocol (L352–411)
19
+ 7. Auto-Update Protocol (L412–491)
20
+ 8. Anti-Patterns (L492–511)
21
+ 9. Initialization Procedure (L512–646)
22
+ 10. Skill Definition (L647–768)
23
+ 11. Hook Configuration (L769–823)
24
+ 12. Language-Specific Initialization Hints (L824–857)
25
+ 13. Minimal Viable Prizm (L858–875)
26
+ 14. Version History (L876–920)
27
+ 15. Conflict Resolution (L921–978)
28
+ 16. Version Migration (L979–1087)
29
+
30
+ ---
31
+
11
32
  # SECTION 1: OVERVIEW
12
33
 
13
34
  WHAT: Prizm is a self-maintaining documentation system where AI reads, generates, updates, and loads project context progressively.
@@ -5,18 +5,16 @@ description: "Incremental .prizm-docs/ maintainer. Performs two jobs: (1) struct
5
5
 
6
6
  # PrizmKit Retrospective
7
7
 
8
- All project knowledge is maintained in a single store:
9
-
10
8
  | Store | Location | Content | Purpose |
11
9
  |-------|----------|---------|---------|
12
10
  | **Architecture Index** | `.prizm-docs/` | MODULE, FILES, INTERFACES, DEPENDENCIES, TRAPS, RULES, DECISIONS | AI quickly locates code structure, interfaces, known pitfalls, and key design decisions |
13
11
 
14
- **This skill performs two jobs in one pass:**
12
+ **This skill handles both structural sync and knowledge injection in one pass:**
15
13
 
16
14
  1. **Structural Sync** — reflect what changed in code → `.prizm-docs/` (KEY_FILES, INTERFACES, DEPENDENCIES, file counts)
17
- 2. **Architecture Knowledge** — inject TRAPS, RULES, and DECISIONS → `.prizm-docs/`. All knowledge is consolidated in `.prizm-docs/`.
15
+ 2. **Architecture Knowledge** — inject TRAPS, RULES, and DECISIONS → `.prizm-docs/`
18
16
 
19
- No other skill writes to `.prizm-docs/`. This is the sole writer during ongoing development. For initial doc setup, validation, or migration, use `/prizmkit-prizm-docs` instead.
17
+ For initial doc setup, validation, or migration, use `/prizmkit-prizm-docs` instead.
20
18
 
21
19
  ## When to Use
22
20
 
@@ -34,122 +32,19 @@ No other skill writes to `.prizm-docs/`. This is the sole writer during ongoing
34
32
 
35
33
  ---
36
34
 
37
- ## Job 1: Structural Sync
38
-
39
- Reflect code changes in `.prizm-docs/` so the project map stays accurate.
40
-
41
- ### Steps
42
-
43
- **1a.** Get changed files:
44
- ```bash
45
- git diff --cached --name-status
46
- ```
47
- If nothing staged, fallback:
48
- ```bash
49
- git diff --name-status
50
- ```
51
-
52
- **1b.** Read `.prizm-docs/root.prizm` to get MODULE_INDEX. Map each changed file to its module.
53
-
54
- **1c.** Classify changes:
55
- - `A` (added) → add to KEY_FILES, check for new INTERFACES
56
- - `D` (deleted) → remove from KEY_FILES, update FILE count
57
- - `M` (modified) → check if public interfaces or dependencies changed
58
- - `R` (renamed) → update all path references
59
-
60
- **1d.** Update affected docs (bottom-up: L2 → L1 → L0):
61
-
62
- - **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.
63
- - **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.
64
- - **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).
65
-
66
- **1d-migrate.** Legacy TRAPS format migration (opportunistic):
67
- 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.
68
-
69
- **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:
70
- 1. Create L1 doc immediately, add to MODULE_INDEX.
71
- 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.
72
-
73
- **1f.** Enforce size limits:
74
- - L0 > 4KB → consolidate MODULE_INDEX
75
- - L1 > 4KB → trim KEY_FILES descriptions, ensure RULES <= 3 entries
76
- - L2 > 5KB → archive old CHANGELOG entries
77
-
78
- **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.
79
-
80
- **1g. TRAPS staleness check** (only when an L2 doc's TRAPS section has > 10 entries):
35
+ ### Job 1: Structural Sync (always runs)
36
+ Synchronize `.prizm-docs/` structure with actual codebase changes from this session.
37
+ Read `${SKILL_DIR}/references/structural-sync-steps.md` for the detailed 7-step procedure (1a–1g).
81
38
 
82
- Perform a quick staleness scan on existing TRAPS to prevent unbounded accumulation:
83
- 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>`
84
- 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
85
- 3. Process at most 5 of the oldest TRAPS per L2 doc per session (to bound context cost)
86
-
87
- This step is lightweight — it only triggers when TRAPS exceed 10 entries, and processes at most 5 per run.
39
+ **Key outputs**: Updated L1 file counts, L2 INTERFACES/DATA_FLOW, changelog entries, stale TRAPS cleanup.
88
40
 
89
41
  ---
90
42
 
91
- ## Job 2: Architecture Knowledge Injection `.prizm-docs/`
92
-
93
- Extract TRAPS, RULES, and DECISIONS from development work and inject into `.prizm-docs/`. All project knowledge lives in `.prizm-docs/` no external memory files.
94
-
95
- `.prizm-docs/` is the **single source of project knowledge**: it tells AI *what code exists, how it connects, what pitfalls to avoid, and why key design choices were made*.
96
-
97
- ### When to run Job 2
98
-
99
- - Feature completion (spec + plan + implementation done)
100
- - Bugfix that reveals a non-obvious failure mode (the root cause is itself a TRAP)
101
- - Refactor that revealed structural insights
102
- - **Skip for**: trivial fixes, config changes, dependency bumps
103
-
104
- ### Steps
105
-
106
- **2a.** Gather context — read the **actual code that was changed** plus any available artifacts:
107
-
108
- - `git diff HEAD` — the real source of truth for what happened
109
- - `.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.
110
- - `.prizmkit/specs/###-feature-name/plan.md` — if feature work, read planned vs actual
111
- - `.prizmkit/bugfix/<id>/fix-report.md` — if bugfix, read what was discovered
112
- - `.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/`
113
- - The relevant `.prizm-docs/` L1/L2 docs for affected modules
114
-
115
- **2b.** Extract knowledge from what was **observed in code**, not invented:
116
-
117
- **TRAPS** (highest priority) — things that look safe but break:
118
- - Minimal format: `- [SEVERITY] <description> | FIX: <approach>`
119
- - Full format: `- [SEVERITY] <description> | FIX: <approach> | REF: <hash> | STALE_IF: <glob>`
120
- - Source: actual bugs hit, surprising behavior discovered in code, non-obvious coupling
121
-
122
- **TRAPS severity classification**:
123
- - `[CRITICAL]`: data loss, security, financial error, system crash
124
- - `[HIGH]`: functional failure, silent error, interface incompatibility
125
- - `[LOW]`: misleading naming, non-intuitive API, minor performance issue
126
-
127
- When writing TRAPS:
128
- - Severity prefix is MANDATORY (e.g., `[CRITICAL]`, `[HIGH]`, `[LOW]`)
129
- - OPTIONAL: append `| REF: <7-char-hash>` when you know the relevant commit (for traceability)
130
- - OPTIONAL: append `| STALE_IF: <glob>` when the TRAP is tightly coupled to specific files (for auto-expiry detection)
131
-
132
- **Consuming [REVIEW] markers** (from staleness check 1g):
133
- - 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.
134
-
135
- **RULES** — conventions established or constraints discovered:
136
- - Format: `- MUST/NEVER/PREFER: <rule>`
137
- - Source: patterns that proved necessary during implementation
138
-
139
- **DECISIONS** — key design choices that affect future development:
140
- - Format: `- <what was decided> — <rationale>`
141
- - Source: non-obvious design choices, interface conventions, cross-module contracts
142
- - Only record decisions that a future AI session would benefit from knowing
143
- - Do NOT record obvious implementation details that can be derived by reading the code
144
-
145
- **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.
146
-
147
- **2c.** Inject into the correct `.prizm-docs/` file:
148
- - 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.)
149
- - Project-level RULES/PATTERNS → `root.prizm`
150
- - Cross-module concerns spanning 2+ modules → `root.prizm` CROSS_CUTTING section
43
+ ### Job 2: Knowledge Injection (conditional — skip for pure refactors)
44
+ Inject newly discovered project knowledge (TRAPS, RULES, DECISIONS) into architecture docs.
45
+ Read `${SKILL_DIR}/references/knowledge-injection-steps.md` for the detailed 3-step procedure (2a–2c).
151
46
 
152
- **RULE**: Only add genuinely new information. Never duplicate existing entries. Never rewrite entire files.
47
+ **Key outputs**: New TRAPS entries, RULES updates, DECISIONS records in relevant L1/L2 docs and root.prizm.
153
48
 
154
49
  ---
155
50
 
@@ -178,7 +73,7 @@ In the dev-pipeline, this skill is the **single doc maintenance step** before co
178
73
  implement → code-review → retrospective (architecture sync) → committer (pure commit)
179
74
  ```
180
75
 
181
- The pipeline enforces a **docs pass condition**: `.prizm-docs/` must show changes in the final commit. This skill is the sole satisfier of that requirement.
76
+ The pipeline enforces a **docs pass condition**: `.prizm-docs/` must show changes in the final commit. This skill satisfies that requirement.
182
77
 
183
78
  ## HANDOFF Chain
184
79