prizmkit 1.0.45 → 1.0.58

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 (64) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/claude/agent-adapter.js +2 -1
  3. package/bundled/adapters/claude/command-adapter.js +4 -3
  4. package/bundled/agents/prizm-dev-team-dev.md +1 -1
  5. package/bundled/dev-pipeline/README.md +3 -4
  6. package/bundled/dev-pipeline/assets/prizm-dev-team-integration.md +2 -3
  7. package/bundled/dev-pipeline/launch-bugfix-daemon.sh +2 -2
  8. package/bundled/dev-pipeline/launch-daemon.sh +2 -2
  9. package/bundled/dev-pipeline/lib/branch.sh +76 -0
  10. package/bundled/dev-pipeline/run-bugfix.sh +58 -149
  11. package/bundled/dev-pipeline/run.sh +60 -153
  12. package/bundled/dev-pipeline/scripts/parse-stream-progress.py +1 -1
  13. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +8 -16
  14. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +10 -18
  15. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +20 -24
  16. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +6 -6
  17. package/bundled/dev-pipeline/tests/conftest.py +19 -131
  18. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +207 -0
  19. package/bundled/dev-pipeline/tests/test_utils.py +51 -110
  20. package/bundled/rules/prizm/prizm-commit-workflow.md +3 -3
  21. package/bundled/skills/_metadata.json +15 -16
  22. package/bundled/skills/app-planner/SKILL.md +8 -7
  23. package/bundled/skills/bug-fix-workflow/SKILL.md +174 -0
  24. package/bundled/skills/bug-planner/SKILL.md +20 -32
  25. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +3 -5
  26. package/bundled/skills/dev-pipeline-launcher/SKILL.md +4 -6
  27. package/bundled/skills/feature-workflow/SKILL.md +25 -42
  28. package/bundled/skills/prizm-kit/SKILL.md +57 -21
  29. package/bundled/skills/prizm-kit/assets/{claude-md-template.md → project-memory-template.md} +2 -2
  30. package/bundled/skills/prizmkit-analyze/SKILL.md +41 -29
  31. package/bundled/skills/prizmkit-clarify/SKILL.md +40 -30
  32. package/bundled/skills/prizmkit-code-review/SKILL.md +48 -43
  33. package/bundled/skills/prizmkit-committer/SKILL.md +30 -68
  34. package/bundled/skills/prizmkit-implement/SKILL.md +48 -26
  35. package/bundled/skills/prizmkit-init/SKILL.md +57 -66
  36. package/bundled/skills/prizmkit-plan/SKILL.md +46 -20
  37. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +60 -19
  38. package/bundled/skills/prizmkit-prizm-docs/assets/PRIZM-SPEC.md +23 -23
  39. package/bundled/skills/prizmkit-retrospective/SKILL.md +142 -65
  40. package/bundled/skills/prizmkit-retrospective/assets/retrospective-template.md +13 -0
  41. package/bundled/skills/prizmkit-specify/SKILL.md +63 -13
  42. package/bundled/skills/refactor-workflow/SKILL.md +105 -49
  43. package/bundled/team/prizm-dev-team.json +2 -2
  44. package/package.json +1 -1
  45. package/src/scaffold.js +3 -3
  46. package/bundled/dev-pipeline/lib/worktree.sh +0 -164
  47. package/bundled/dev-pipeline/tests/__init__.py +0 -0
  48. package/bundled/dev-pipeline/tests/test_check_session.py +0 -131
  49. package/bundled/dev-pipeline/tests/test_cleanup_logs.py +0 -119
  50. package/bundled/dev-pipeline/tests/test_detect_stuck.py +0 -207
  51. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +0 -181
  52. package/bundled/dev-pipeline/tests/test_generate_prompt.py +0 -190
  53. package/bundled/dev-pipeline/tests/test_init_bugfix_pipeline.py +0 -153
  54. package/bundled/dev-pipeline/tests/test_init_pipeline.py +0 -241
  55. package/bundled/dev-pipeline/tests/test_update_bug_status.py +0 -142
  56. package/bundled/dev-pipeline/tests/test_update_feature_status.py +0 -338
  57. package/bundled/dev-pipeline/tests/test_worktree.py +0 -236
  58. package/bundled/dev-pipeline/tests/test_worktree_integration.py +0 -796
  59. package/bundled/skills/prizm-kit/assets/codebuddy-md-template.md +0 -35
  60. package/bundled/skills/prizm-kit/assets/hooks/prizm-commit-hook.json +0 -15
  61. package/bundled/skills/prizmkit-summarize/SKILL.md +0 -51
  62. package/bundled/skills/prizmkit-summarize/assets/registry-template.md +0 -18
  63. package/bundled/templates/hooks/commit-intent-claude.json +0 -26
  64. /package/bundled/templates/hooks/{commit-intent-codebuddy.json → commit-intent.json} +0 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: "prizmkit-init"
3
- description: "Project takeover and bootstrap. Scans any project, generates Prizm docs, configures hooks. Use 'prizmkit.init' to start. (project)"
3
+ description: "Project takeover and bootstrap. Scans any project, generates Prizm docs, configures hooks. Use this skill whenever a user opens a new project for the first time, says 'initialize', 'set up PrizmKit', 'take over this project', 'bootstrap', 'scan this codebase', 'init', or when .prizm-docs/ doesn't exist yet. Also use when PrizmKit was just installed via npx but not yet initialized. (project)"
4
4
  ---
5
5
 
6
6
  # PrizmKit Init
@@ -11,11 +11,20 @@ Project takeover and bootstrap skill. Scans any project (brownfield or greenfiel
11
11
  - Taking over a new project (brownfield or greenfield)
12
12
  - User says "initialize PrizmKit", "set up PrizmKit", "take over this project"
13
13
  - First time using PrizmKit on a project
14
+ - After `npx prizmkit install` when project has no `.prizm-docs/`
14
15
 
15
- ### Commands
16
+ ### When NOT to Use
17
+ - `.prizm-docs/` already exists and is up to date → use `/prizmkit-prizm-docs` (Update) instead
18
+ - User just wants to update stale docs → use `/prizmkit-prizm-docs` (Update or Rebuild)
19
+ - User wants to start a feature → skip init if already initialized, go to `/prizmkit-specify`
16
20
 
17
- #### prizmkit.init
18
- Full project initialization.
21
+ ### Error Handling
22
+ - If `.prizm-docs/` already exists: ask user if they want to reinitialize (overwrites) or update (preserves)
23
+ - If no source files found in any directory: fall back to greenfield mode
24
+ - If platform cannot be detected: ask user explicitly which platform(s) to configure
25
+ - If `${SKILL_DIR}/../../../assets/project-memory-template.md` is missing: generate inline PrizmKit section instead of failing
26
+
27
+ ## Execution Steps
19
28
 
20
29
  **PLATFORM DETECTION (before anything else):**
21
30
  1. Check for platform indicators in the current environment:
@@ -34,89 +43,48 @@ BROWNFIELD WORKFLOW (existing project):
34
43
 
35
44
  **Step 1: Project Scanning**
36
45
  1. Detect tech stack from build files (`package.json`, `requirements.txt`, `go.mod`, `pom.xml`, `Cargo.toml`, etc.)
37
- 2. Map directory structure using a TWO-TIER model — do NOT flatten:
46
+ 2. Map directory structure using a TWO-TIER model — flat structures lose the nesting relationships that AI needs to navigate the codebase:
38
47
  - TOP-LEVEL modules: directories directly under project root that contain source files or sub-directories with source files (e.g. `dev-pipeline/`, `src/`, `internal/`)
39
48
  - SUB-MODULES: directories INSIDE a top-level module (e.g. `dev-pipeline/scripts/`, `dev-pipeline/lib/`)
40
- - A sub-module is NEVER treated as a top-level module, even if it has many files
49
+ - A sub-module maps to `.prizm-docs/<M>/<S>.prizm`, never to `.prizm-docs/<S>.prizm` flattening would create ambiguous paths when two modules have identically-named sub-modules
41
50
  - Exclude: `.git/`, `node_modules/`, `vendor/`, `build/`, `dist/`, `__pycache__/`, `.claude/`, `.codebuddy/`, `.prizmkit/`, `.prizm-docs/`
42
51
  3. Identify entry points by language convention
43
52
  4. Catalog dependencies (external packages)
44
53
  5. Count source files per directory
45
54
 
46
55
  **Step 2: Prizm Documentation Generation**
47
- 2a. Invoke prizmkit-prizm-docs `prizmkit.doc.init` algorithm, passing the two-tier module structure from Step 1:
56
+ Invoke prizmkit-prizm-docs (Init operation), passing the two-tier module structure from Step 1:
48
57
  - Create `.prizm-docs/` directory structure mirroring the source tree (sub-module dirs become subdirectories under `.prizm-docs/<top-level>/`)
49
- - Generate `root.prizm` (L0) with project meta and MODULE_INDEX listing ONLY top-level modules
58
+ - Generate `root.prizm` (L0) with project meta and MODULE_INDEX listing only top-level modules
50
59
  - Generate L1 docs for top-level modules at `.prizm-docs/<M>.prizm` and for sub-modules at `.prizm-docs/<M>/<S>.prizm`
51
60
  - Create `changelog.prizm`
52
- - Skip L2 (lazy generation)
53
-
54
- 2b. If project has existing `docs/AI_CONTEXT/`: suggest running `prizmkit.doc.migrate`
61
+ - Skip L2 (lazy generation) — L2 is generated on first file modification, saving tokens upfront
55
62
 
56
63
  **Step 3: PrizmKit Workspace Initialization**
57
64
  3a. Create `.prizmkit/` directory:
58
65
  - `.prizmkit/config.json` (adoption_mode, speckit_hooks_enabled, platform)
59
66
  - `.prizmkit/specs/` (empty)
60
67
 
61
- **Step 4: Hook & Settings Configuration (Platform-Specific)**
62
-
63
- **If platform is CodeBuddy (or both):**
64
- 4a-cb. Read or create `.codebuddy/settings.json`
65
- 4b-cb. Add UserPromptSubmit hook from `${SKILL_DIR}/../../../assets/hooks/prizm-commit-hook.json`
66
- 4c-cb. Preserve any existing hooks
67
-
68
- **If platform is Claude Code (or both):**
69
- 4a-cl. Read or create `.claude/settings.json`
70
- 4b-cl. Add `permissions` and `allowedTools` entries if needed
71
- 4c-cl. Create `.claude/rules/prizm-documentation.md` with glob-scoped rules:
72
- ```yaml
73
- ---
74
- description: PrizmKit documentation rules
75
- globs:
76
- - "**/*.ts"
77
- - "**/*.js"
78
- - "**/*.py"
79
- - "**/*.go"
80
- ---
81
- When modifying source files:
82
- 1. Read `.prizm-docs/root.prizm` to understand project structure
83
- 2. After changes, update affected `.prizm-docs/` files
84
- 3. Follow Prizm doc format (KEY: value, not prose)
85
- ```
86
- 4d-cl. Create `.claude/rules/prizm-commit-workflow.md` with commit-scoped rules:
87
- ```yaml
88
- ---
89
- description: PrizmKit commit workflow enforcement
90
- globs:
91
- - "**/*"
92
- ---
93
- Before any git commit:
94
- 1. Run git diff --cached --name-status
95
- 2. Map changed files to modules via root.prizm MODULE_INDEX
96
- 3. Update affected .prizm-docs/ files
97
- 4. Stage .prizm-docs/ changes
98
- 5. Use /prizmkit-committer for the complete workflow
99
- ```
100
- 4e-cl. Preserve any existing Claude settings and rules
101
-
102
- **Step 5: Project Memory Update (Platform-Specific)**
103
-
104
- **If platform is CodeBuddy (or both):**
105
- 5a-cb. Read existing `CODEBUDDY.md` (or create if missing)
106
- 5b-cb. Append PrizmKit section from `${SKILL_DIR}/../../../assets/codebuddy-md-template.md`
107
- 5c-cb. Do not duplicate if already present
108
-
109
- **If platform is Claude Code (or both):**
110
- 5a-cl. Read existing `CLAUDE.md` (or create if missing)
111
- 5b-cl. Append PrizmKit section from `${SKILL_DIR}/../../../assets/claude-md-template.md`
112
- 5c-cl. Adjust command references to use `/command-name` format (not `prizmkit.xxx`)
113
- 5d-cl. Do not duplicate if already present
68
+ **Step 4: Hook & Settings Configuration**
69
+
70
+ 4a. Read or create platform settings file (`.codebuddy/settings.json` or `.claude/settings.json`)
71
+ 4b. Add UserPromptSubmit and PostToolUse hooks for automatic prizm-docs reminders
72
+ 4c. For Claude Code: also add `permissions` entries and `.claude/rules/` for documentation enforcement:
73
+ - `.claude/rules/prizm-documentation.md` (glob-scoped source file rules)
74
+ - `.claude/rules/prizm-commit-workflow.md` (commit workflow enforcement)
75
+ 4d. Preserve any existing hooks and settings — never overwrite user's custom configuration
76
+
77
+ **Step 5: Project Memory Update**
78
+
79
+ 5a. Read existing project memory file (`CODEBUDDY.md` or `CLAUDE.md`) or create if missing
80
+ 5b. Append PrizmKit section from `${SKILL_DIR}/../../../assets/project-memory-template.md`
81
+ 5c. Do not duplicate if PrizmKit section already present
114
82
 
115
83
  **Step 6: Report**
116
84
  Output summary: platform detected, tech stack detected, modules discovered, L1 docs generated, platform-specific configuration applied, next recommended steps.
117
85
 
118
86
  Include platform-specific guidance:
119
- - CodeBuddy: "Use `prizmkit.specify` to start your first feature"
87
+ - CodeBuddy: "Use `/prizmkit-specify` to start your first feature"
120
88
  - Claude Code: "Use `/prizmkit-specify` to start your first feature"
121
89
 
122
90
  GREENFIELD WORKFLOW (new project):
@@ -137,7 +105,7 @@ User can change mode in `.prizmkit/config.json`: `"adoption_mode": "passive" | "
137
105
 
138
106
  | Concept | CodeBuddy | Claude Code |
139
107
  |---------|-----------|-------------|
140
- | Command invocation | `prizmkit.xxx` | `/prizmkit-xxx` |
108
+ | Command invocation | `/prizmkit-xxx` | `/prizmkit-xxx` |
141
109
  | Project memory | `CODEBUDDY.md` | `CLAUDE.md` |
142
110
  | Settings | `.codebuddy/settings.json` | `.claude/settings.json` |
143
111
  | Skills/Commands | `.codebuddy/skills/` | `.claude/commands/` |
@@ -145,4 +113,27 @@ User can change mode in `.prizmkit/config.json`: `"adoption_mode": "passive" | "
145
113
  | Rules | hooks in settings.json | `.claude/rules/*.md` |
146
114
  | CLI command | `cbc` | `claude` |
147
115
 
116
+ ## Example
117
+
118
+ **Brownfield init on a Node.js project:**
119
+ ```
120
+ $ /prizmkit-init
121
+
122
+ Platform detected: Claude Code
123
+ Tech stack: TypeScript, Node.js, Express
124
+ Mode: Brownfield (154 source files found)
125
+
126
+ Modules discovered:
127
+ src/routes/ → .prizm-docs/routes.prizm (12 files)
128
+ src/models/ → .prizm-docs/models.prizm (8 files)
129
+ src/services/ → .prizm-docs/services.prizm (15 files)
130
+ src/middleware/ → .prizm-docs/middleware.prizm (5 files)
131
+
132
+ Generated: root.prizm + 4 L1 docs + changelog.prizm
133
+ Configured: .claude/rules/ (2 files), hooks in settings.json
134
+ Updated: CLAUDE.md with PrizmKit section
135
+
136
+ Next: Use /prizmkit-specify to start your first feature
137
+ ```
138
+
148
139
  IMPORTANT: Use `${SKILL_DIR}` placeholder for all path references. Never hardcode absolute paths.
@@ -1,26 +1,31 @@
1
1
  ---
2
2
  name: "prizmkit-plan"
3
- description: "Generate technical implementation plan and executable task breakdown from feature spec. Produces plan.md with architecture, data model, API contracts, and a Tasks section. Invoke after 'specify' when ready to plan. (project)"
3
+ description: "Generate technical implementation plan and executable task breakdown from feature spec. Produces plan.md with architecture, data model, API contracts, and a Tasks section. Use this skill whenever the user wants to design how a feature will be built, break work into tasks, or think through architecture. Trigger on: 'plan', 'architect', 'how to build', 'design', 'break it down', 'break this into tasks', 'create tasks', 'implementation strategy', 'how should we implement'. Always use after /prizmkit-specify and before /prizmkit-implement. (project)"
4
4
  ---
5
5
 
6
6
  # PrizmKit Plan
7
7
 
8
8
  Generate a comprehensive technical implementation plan from a feature specification. Produces plan.md with architecture approach, component design, data model, API contracts, testing strategy, risk assessment, and an executable Tasks section.
9
9
 
10
- ## Commands
10
+ ### When to Use
11
+ - After `/prizmkit-specify` when ready to plan the implementation
12
+ - User says "plan", "architect", "how to build", "design", "break it down", "create tasks"
13
+ - Before `/prizmkit-implement` to create the task breakdown
14
+ - When user wants to understand the full implementation approach before coding
11
15
 
12
- ### prizmkit.plan
16
+ ### When NOT to Use
17
+ - No spec.md exists yet → run `/prizmkit-specify` first
18
+ - Simple bug fix or config change → use fast path, no plan needed
19
+ - User just wants to explore/research → answer directly, no plan artifact needed
13
20
 
14
- Create a technical implementation plan and task breakdown for a specified feature.
21
+ **PRECONDITION:** `spec.md` exists in `.prizmkit/specs/###-feature-name/`, `.prizm-docs/root.prizm` exists. If spec.md is missing, prompt the user: "No spec found — want me to run /prizmkit-specify first?"
15
22
 
16
- **PRECONDITION:** `spec.md` exists in `.prizmkit/specs/###-feature-name/`, `.prizm-docs/root.prizm` exists
17
-
18
- **STEPS:**
23
+ ## Execution Steps
19
24
 
20
25
  **Phase 0 — Research:**
21
26
  1. Read `spec.md` for feature requirements
22
27
  2. Load project context (use first available source):
23
- - If `.prizmkit/specs/###-feature-name/context-snapshot.md` exists → read it for all context (Section 3 'Prizm Context' for docs, Section 4 'Existing Source Files' for code). Do NOT re-read `.prizm-docs/` or individual source files.
28
+ - If `.prizmkit/specs/###-feature-name/context-snapshot.md` exists → read it for all context (Section 3 'Prizm Context' for docs, Section 4 'Existing Source Files' for code). The context-snapshot consolidates dozens of individual files into one read, saving significant tokens.
24
29
  - Otherwise → read `.prizm-docs/root.prizm` and relevant `.prizm-docs/` L1/L2 docs for affected modules
25
30
  3. Resolve any remaining `[NEEDS CLARIFICATION]` by proposing solutions
26
31
  4. Research technical approach based on project's tech stack
@@ -34,8 +39,8 @@ Create a technical implementation plan and task breakdown for a specified featur
34
39
  - Integration points (external services, internal modules)
35
40
  - Testing strategy (unit, integration, e2e)
36
41
  - Risk assessment
37
- 6. Cross-check plan against spec: every user story MUST map to plan components
38
- 7. Check alignment with project rules from `.prizm-docs/root.prizm` RULES section
42
+ 6. Cross-check plan against spec: every user story should map to plan components — unmapped stories mean the plan has coverage gaps that will surface during implementation
43
+ 7. Check alignment with project rules from `.prizm-docs/root.prizm` RULES section — violating project rules causes CRITICAL findings in the analyze phase
39
44
 
40
45
  **Phase 2 — Task Generation:**
41
46
  8. Ask user for implementation strategy (or infer from context): MVP-first / Incremental / Parallel
@@ -44,19 +49,40 @@ Create a technical implementation plan and task breakdown for a specified featur
44
49
  - Each task: `- [ ] [T-NNN] [P?] [US?] Description — file: path/to/file`
45
50
  - `[P]` marker for tasks that can run in parallel within their phase
46
51
  - Checkpoint tasks between phases for validation
47
- 10. Verify: every user story maps to at least one task; every task references a target file path
52
+ 10. Verify coverage and traceability:
53
+ - Every user story maps to at least one task — orphan stories become orphan features
54
+ - Every task references a target file path — pathless tasks leave implementers guessing where to write code
55
+ - Risk assessment includes at least one risk with mitigation — helps the implementer prepare for known challenges
48
56
  11. Output: `plan.md` path, summary of design decisions, and task count
49
57
 
50
- **KEY RULES:**
51
- - Every user story in spec.md MUST have a corresponding component AND task in the plan
52
- - Architecture decisions MUST align with existing project patterns from `.prizm-docs/`
53
- - Risk assessment MUST include at least one risk with mitigation strategy
54
- - Supporting details (data model, interface design) are included as sections within plan.md, not as separate files
55
- - Task IDs use zero-padded numbering: `[T-001]`, `[T-010]`, `[T-100]`
56
- - Every task MUST reference a target file path
57
- - Each user story section MUST be independently testable
58
+ **Task ID Conventions:**
59
+ - Task IDs use zero-padded numbering: `[T-001]`, `[T-010]`, `[T-100]` this ensures consistent sorting and visual alignment
60
+ - Each user story section should be independently testable this enables incremental verification during implementation
61
+
62
+ **HANDOFF:** `/prizmkit-analyze` or `/prizmkit-implement`
63
+
64
+ ## Example
65
+
66
+ **Input:** spec.md for "User Avatar Upload" feature
67
+
68
+ **Output:** plan.md excerpt:
69
+ ```markdown
70
+ ## Architecture Approach
71
+ Extend existing user profile module. Add S3 integration for file storage.
72
+ Reuse existing auth middleware for upload endpoint protection.
73
+
74
+ ## Tasks
75
+
76
+ ### Phase 1: Data Layer (T-010~T-019)
77
+ - [ ] [T-010] [US-1] Add avatar_url field to User model — file: src/models/user.ts
78
+ - [ ] [T-011] [US-1] Create S3 upload utility — file: src/lib/s3.ts
79
+ - [ ] [T-012] CP: Data layer checkpoint — run migrations + unit tests
58
80
 
59
- **HANDOFF:** `prizmkit.analyze` or `prizmkit.implement`
81
+ ### Phase 2: API [P] (T-100~T-109)
82
+ - [ ] [T-100] [P] [US-1] POST /api/avatar upload endpoint — file: src/routes/avatar.ts
83
+ - [ ] [T-101] [P] [US-2] DELETE /api/avatar endpoint — file: src/routes/avatar.ts
84
+ - [ ] [T-102] CP: API checkpoint — integration tests pass
85
+ ```
60
86
 
61
87
  ## Template
62
88
 
@@ -1,15 +1,28 @@
1
1
  ---
2
2
  name: "prizmkit-prizm-docs"
3
- description: "AI-only documentation framework for progressive context loading. Manages .prizm-docs/ with 3-level hierarchy (L0/L1/L2). Use 'prizmkit.doc.init' to bootstrap, 'prizmkit.doc.update' to sync, 'prizmkit.doc.status' to check freshness, 'prizmkit.doc.rebuild' to regenerate, 'prizmkit.doc.validate' to check compliance, 'prizmkit.doc.migrate' to convert existing docs."
3
+ description: "AI-only documentation framework for progressive context loading. Manages .prizm-docs/ with 3-level hierarchy (L0/L1/L2). Use this skill whenever docs need bootstrapping, syncing, checking, validating, rebuilding, or migrating. Trigger on: 'initialize docs', 'update docs', 'sync docs', 'check doc status', 'rebuild docs', 'validate docs', 'migrate docs', 'docs are stale', 'prizm docs'. Also invoke as part of /prizmkit-init for first-time setup, or before /prizmkit-committer to ensure docs are fresh. (project)"
4
4
  ---
5
5
 
6
6
  # Prizm Docs - AI Documentation Framework
7
7
 
8
8
  Full specification: ${SKILL_DIR}/assets/PRIZM-SPEC.md
9
9
 
10
- ## Commands
10
+ ## Intent Routing
11
11
 
12
- ### prizmkit.doc.init
12
+ This skill handles 6 operations. When invoked, determine the user's intent and execute the matching operation:
13
+
14
+ | User Intent | Operation | Trigger Phrases |
15
+ |---|---|---|
16
+ | Bootstrap new project docs | **Init** | "initialize docs", "set up prizm docs", "bootstrap documentation" |
17
+ | Sync docs after code changes | **Update** | "update docs", "sync documentation", "docs are stale" |
18
+ | Check doc freshness | **Status** | "check docs", "are docs up to date", "doc status" |
19
+ | Regenerate module docs | **Rebuild** | "rebuild docs for X", "regenerate module docs" |
20
+ | Check format compliance | **Validate** | "validate docs", "check doc format", "docs valid?" |
21
+ | Convert existing docs | **Migrate** | "migrate docs", "convert docs to prizm format" |
22
+
23
+ ---
24
+
25
+ ## Operation: Init
13
26
 
14
27
  Bootstrap .prizm-docs/ for the current project.
15
28
 
@@ -17,27 +30,27 @@ PRECONDITION: No .prizm-docs/ directory exists, or user confirms overwrite.
17
30
 
18
31
  STEPS:
19
32
  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.
20
- 2. Discover modules in TWO tiers — DO NOT FLATTEN the directory hierarchy:
33
+ 2. Discover modules in TWO tiers — flat structures lose nesting relationships, and when two modules share an identically-named sub-module (e.g., `utils/`), flattening creates ambiguous paths:
21
34
  - TOP-LEVEL modules: directories directly under project root (or under src/ for src-based layouts) that contain 3+ source files OR contain sub-directories with 3+ source files. These go into MODULE_INDEX.
22
- - SUB-MODULES: directories INSIDE a top-level module that contain 3+ source files. These are NOT top-level modules — they are listed in the parent L1 doc's SUBDIRS section only.
23
- - HIERARCHY RULE: if directory X lives inside top-level module M, it maps to .prizm-docs/<M>/<X>.prizm NEVER to .prizm-docs/<X>.prizm.
35
+ - SUB-MODULES: directories INSIDE a top-level module that contain 3+ source files. Listed in the parent L1 doc's SUBDIRS section only.
36
+ - HIERARCHY RULE: directory X inside top-level module M maps to .prizm-docs/<M>/<X>.prizm, never to .prizm-docs/<X>.prizm.
24
37
  - Exclude vendor/, node_modules/, .git/, build/, dist/, __pycache__/, target/, bin/. If top-level module count > 30, ask user for include/exclude patterns.
25
- 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>/. NEVER place a sub-module's .prizm file at the .prizm-docs/ root.
26
- 4. Generate root.prizm (L0) with PROJECT, LANG, FRAMEWORK, BUILD, TEST, ENTRY, MODULE_INDEX listing ONLY top-level modules with arrow pointers to .prizm-docs/<M>.prizm, RULES extracted from CODEBUDDY.md/CLAUDE.md/README/linter configs, and PATTERNS. Sub-modules must NOT appear in MODULE_INDEX. Set PRIZM_VERSION: 2, UPDATED: today's date. Max 4KB.
38
+ 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>/.
39
+ 4. Generate root.prizm (L0) with PROJECT, LANG, FRAMEWORK, BUILD, TEST, ENTRY, MODULE_INDEX listing only top-level modules with arrow pointers to .prizm-docs/<M>.prizm (sub-modules stay out of MODULE_INDEX to keep L0 compact and within the 4KB limit), RULES extracted from CODEBUDDY.md/CLAUDE.md/README/linter configs, and PATTERNS. Set PRIZM_VERSION: 2, UPDATED: today's date. Max 4KB.
27
40
  5. Generate L1 .prizm files for ALL modules (top-level and sub-modules), each at its correct mirrored path:
28
41
  - Top-level module M → write .prizm-docs/<M>.prizm (include SUBDIRS section with pointers to sub-module docs)
29
42
  - Sub-module S inside M → write .prizm-docs/<M>/<S>.prizm
30
43
  Each L1 includes MODULE (full relative path), FILES count, RESPONSIBILITY, SUBDIRS with pointers (for top-level only), KEY_FILES (5-10 most important), INTERFACES (public/exported only), DEPENDENCIES (imports, imported-by, external), RULES, DATA_FLOW. Max 3KB each.
31
- 6. DO NOT generate L2 docs during init. L2 is created lazily on first file modification in a sub-module, or when AI needs deep understanding of a module (ON_DEEP_READ trigger).
44
+ 6. Skip L2 docs during init L2 is created lazily on first file modification or when AI needs deep understanding (ON_DEEP_READ trigger). This saves significant upfront token cost on large projects.
32
45
  7. Create changelog.prizm with initial entry: `- YYYY-MM-DD | root | add: initialized prizm documentation framework`
33
- 8. Configure UserPromptSubmit hook in .codebuddy/settings.json per ${SKILL_DIR}/assets/PRIZM-SPEC.md Section 11.
34
- 9. Append Prizm protocol section to CODEBUDDY.md per ${SKILL_DIR}/assets/PRIZM-SPEC.md Section 12.
46
+ 8. Configure UserPromptSubmit hook in platform settings per ${SKILL_DIR}/assets/PRIZM-SPEC.md Section 11.
47
+ 9. Append Prizm protocol section to project memory file (CODEBUDDY.md or CLAUDE.md) per ${SKILL_DIR}/assets/PRIZM-SPEC.md Section 12.
35
48
  10. Validate all generated docs: size limits (L0 <= 4KB, L1 <= 3KB), pointer resolution (every -> reference resolves), no circular dependencies, UPDATED timestamps set, KEY: value format compliance, no anti-patterns (prose, code blocks, markdown headers).
36
49
  11. Report summary: modules discovered, L1 docs generated, files excluded, warnings.
37
50
 
38
51
  OUTPUT: List of generated files, module count, and validation results.
39
52
 
40
- ### prizmkit.doc.update
53
+ ## Operation: Update
41
54
 
42
55
  Update .prizm-docs/ to reflect recent code changes.
43
56
 
@@ -56,7 +69,7 @@ STEPS:
56
69
 
57
70
  OUTPUT: List of updated/created/skipped docs with reasons.
58
71
 
59
- ### prizmkit.doc.status
72
+ ## Operation: Status
60
73
 
61
74
  Check freshness of all .prizm docs.
62
75
 
@@ -71,9 +84,9 @@ STEPS:
71
84
 
72
85
  OUTPUT: Freshness report table with columns: DOC_PATH | LEVEL | STATUS | LAST_UPDATED | SOURCE_LAST_MODIFIED.
73
86
 
74
- ### prizmkit.doc.rebuild <module-path>
87
+ ## Operation: Rebuild
75
88
 
76
- Regenerate docs for a specific module from scratch.
89
+ Regenerate docs for a specific module from scratch. Requires a module path argument.
77
90
 
78
91
  PRECONDITION: .prizm-docs/ exists. Module path is valid.
79
92
 
@@ -88,7 +101,7 @@ STEPS:
88
101
 
89
102
  OUTPUT: Regenerated doc summary with before/after comparison.
90
103
 
91
- ### prizmkit.doc.validate
104
+ ## Operation: Validate
92
105
 
93
106
  Check format compliance and consistency of all .prizm docs.
94
107
 
@@ -105,7 +118,7 @@ STEPS:
105
118
 
106
119
  OUTPUT: Validation report with PASS/FAIL per check, list of issues with file paths and suggested fixes.
107
120
 
108
- ### prizmkit.doc.migrate
121
+ ## Operation: Migrate
109
122
 
110
123
  Convert existing documentation to .prizm-docs/ format.
111
124
 
@@ -122,6 +135,13 @@ STEPS:
122
135
 
123
136
  OUTPUT: Migration report with list of source docs processed, generated .prizm files, and any manual review items.
124
137
 
138
+ ## Error Handling
139
+
140
+ - **root.prizm is corrupted or invalid format**: Back up the existing file, then run Rebuild on all modules to regenerate from source code.
141
+ - **Broken pointers (-> references to non-existent files)**: Create the missing .prizm file if the source module exists; remove the pointer if the source module was deleted.
142
+ - **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.
143
+ - **No git history available**: Fall back to filesystem timestamps for freshness checks; warn user that accuracy may be reduced.
144
+
125
145
  ## Progressive Loading Protocol
126
146
 
127
147
  When working in a project with .prizm-docs/:
@@ -135,9 +155,9 @@ When working in a project with .prizm-docs/:
135
155
 
136
156
  ## Auto-Update Protocol
137
157
 
138
- - BEFORE EVERY COMMIT: Update affected .prizm-docs/ files per ${SKILL_DIR}/assets/PRIZM-SPEC.md Section 7.
158
+ - BEFORE EVERY COMMIT: Run `/prizmkit-retrospective` which is the **sole maintainer** of .prizm-docs/. It handles both structural sync and knowledge injection.
139
159
  - The UserPromptSubmit hook will remind you automatically when commit intent is detected.
140
- - If hook is not active, you MUST still follow the update protocol manually.
160
+ - `/prizmkit-committer` does NOT update .prizm-docs/ it only commits what is already staged.
141
161
  - NEVER rewrite entire .prizm files. Only update affected sections.
142
162
 
143
163
  ## RULES Hierarchy
@@ -145,3 +165,24 @@ When working in a project with .prizm-docs/:
145
165
  - root.prizm RULES are authoritative and apply project-wide.
146
166
  - L1/L2 RULES only supplement root.prizm with module-specific exceptions.
147
167
  - If L1/L2 RULES contradict root.prizm RULES, root.prizm takes precedence.
168
+
169
+ ## Examples
170
+
171
+ **Init output (Node.js project):**
172
+ ```
173
+ Generated .prizm-docs/:
174
+ root.prizm (L0) — 3 modules in MODULE_INDEX
175
+ routes.prizm (L1) — 12 files, 4 interfaces
176
+ models.prizm (L1) — 8 files, 3 interfaces
177
+ services.prizm (L1) — 15 files, 6 interfaces
178
+ changelog.prizm — initial entry
179
+ ```
180
+
181
+ **Update after adding new API endpoint:**
182
+ ```
183
+ Changed: src/routes/avatar.ts (A), src/models/user.ts (M)
184
+ Updated: .prizm-docs/routes.prizm — added avatar.ts to KEY_FILES, new POST /api/avatar interface
185
+ Updated: .prizm-docs/models.prizm — updated User interface with avatar_url field
186
+ Skipped: .prizm-docs/services.prizm — no changes in services module
187
+ Appended: changelog.prizm — "2026-03-18 | routes | add: avatar upload endpoint"
188
+ ```
@@ -294,7 +294,7 @@ FOR any source file at path P:
294
294
  1. Walk up directory tree to find the first ancestor D where .prizm-docs/<D>.prizm exists
295
295
  2. That file is the L1 doc for this source file
296
296
  3. If P is inside a subdirectory S of D, check if .prizm-docs/<D>/<S>.prizm exists for L2
297
- 4. If no .prizm doc found, the module is undocumented (may need prizmkit.doc.update)
297
+ 4. If no .prizm doc found, the module is undocumented (may need prizmkit-prizm-docs Update operation)
298
298
 
299
299
  ---
300
300
 
@@ -345,7 +345,7 @@ BUDGET: Typical task should consume 3000-5000 tokens of prizm docs total
345
345
 
346
346
  ## 7.1 Trigger
347
347
 
348
- WHEN: Before every commit (detected automatically via hook, or manually via prizmkit.doc.update)
348
+ WHEN: Before every commit (detected automatically via hook, or manually via prizmkit-prizm-docs Update operation)
349
349
  GOAL: Keep prizm docs synchronized with source code
350
350
 
351
351
  ## 7.2 Update Decision Logic
@@ -441,7 +441,7 @@ NEVER: Rewrite entire .prizm files on update (modify only affected sections)
441
441
 
442
442
  ## 9.1 Algorithm
443
443
 
444
- COMMAND: prizmkit.doc.init
444
+ OPERATION: Init (invoked via prizmkit-prizm-docs skill)
445
445
  PRECONDITION: No .prizm-docs/ directory exists (or user confirms overwrite)
446
446
 
447
447
  ALGORITHM: prizm_init
@@ -575,18 +575,18 @@ ON_DEEP_READ trigger:
575
575
 
576
576
  The Prizm skill is defined at: ${SKILL_DIR}/SKILL.md
577
577
 
578
- COMMANDS:
578
+ OPERATIONS (all invoked via the prizmkit-prizm-docs skill):
579
579
 
580
- prizmkit.doc.init - Bootstrap .prizm-docs/ for a new project (Section 9)
581
- prizmkit.doc.update - Sync docs with code changes (Section 7)
582
- prizmkit.doc.status - Check freshness of all docs
583
- prizmkit.doc.rebuild - Regenerate docs for a specific module
584
- prizmkit.doc.validate - Check format compliance and consistency (Section 10.2)
585
- prizmkit.doc.migrate - Convert existing docs to .prizm-docs/ format (Section 10.3)
580
+ Init - Bootstrap .prizm-docs/ for a new project (Section 9)
581
+ Update - Sync docs with code changes (Section 7)
582
+ Status - Check freshness of all docs
583
+ Rebuild - Regenerate docs for a specific module
584
+ Validate - Check format compliance and consistency (Section 10.2)
585
+ Migrate - Convert existing docs to .prizm-docs/ format (Section 10.3)
586
586
 
587
- ## 10.2 prizmkit.doc.validate
587
+ ## 10.2 Validate Operation
588
588
 
589
- COMMAND: prizmkit.doc.validate
589
+ OPERATION: Validate (invoked via prizmkit-prizm-docs skill)
590
590
  PRECONDITION: .prizm-docs/ directory exists
591
591
 
592
592
  ALGORITHM: prizm_validate
@@ -640,9 +640,9 @@ STEPS:
640
640
 
641
641
  OUTPUT: Validation report with PASS/FAIL per check category, issue list with file paths and line references, suggested fixes for common problems.
642
642
 
643
- ## 10.3 prizmkit.doc.migrate
643
+ ## 10.3 Migrate Operation
644
644
 
645
- COMMAND: prizmkit.doc.migrate
645
+ OPERATION: Migrate (invoked via prizmkit-prizm-docs skill)
646
646
  PRECONDITION: Existing documentation (docs/, docs/AI_CONTEXT/, README.md, ARCHITECTURE.md, etc.). No .prizm-docs/ directory (or user confirms overwrite).
647
647
 
648
648
  ALGORITHM: prizm_migrate
@@ -713,7 +713,7 @@ JSON:
713
713
  "hooks": [
714
714
  {
715
715
  "type": "command",
716
- "command": "echo 'PRIZMKIT_DOC_UPDATE_REQUIRED: Before committing, you MUST update .prizm-docs/ per Prizm auto-update protocol. Steps: 1) Run git diff --cached --name-status. 2) Map changed files to modules via root.prizm MODULE_INDEX. 3) Read and update affected .prizm files (only changed sections). 4) Append to changelog.prizm. 5) Stage .prizm files with git add .prizm-docs/. 6) Then proceed with commit. RULES: Never rewrite entire .prizm files. Never add prose. Only update affected sections.'"
716
+ "command": "echo 'PRIZMKIT_MEMORY_MAINTENANCE_REQUIRED: Before committing, you MUST run /prizmkit-retrospective to maintain .prizm-docs/ project memory. It handles both structural sync (KEY_FILES, INTERFACES, DEPENDENCIES) and knowledge injection (TRAPS, RULES, DECISIONS). After retrospective completes, proceed with /prizmkit-committer for the actual git commit.'"
717
717
  }
718
718
  ]
719
719
  }
@@ -749,7 +749,7 @@ The core requirement is: before any commit operation, AI must update affected .p
749
749
 
750
750
  ## 12.1 Template Section
751
751
 
752
- Append the following to any project's CODEBUDDY.md during prizmkit.doc.init:
752
+ Append the following to any project's CODEBUDDY.md during Init operation:
753
753
 
754
754
  TEXT:
755
755
 
@@ -835,8 +835,8 @@ FILES:
835
835
  This is enough to give AI a project overview and track changes.
836
836
  L1 and L2 docs can be added incrementally as AI works in specific areas.
837
837
 
838
- BOOTSTRAP_COMMAND:
839
- prizmkit.doc.init
838
+ BOOTSTRAP:
839
+ Invoke prizmkit-prizm-docs skill (Init operation)
840
840
 
841
841
  Or manually create these two files following the templates in Section 3.
842
842
 
@@ -854,8 +854,8 @@ V1 (2026-03-02): Initial specification
854
854
 
855
855
  V2 (2026-03-02): Enhanced specification
856
856
  - Added ON_DEEP_READ trigger for L2 generation (L2 created during deep analysis, not just modifications)
857
- - Added prizmkit.doc.validate command for format compliance and consistency checking
858
- - Added prizmkit.doc.migrate command for converting existing docs to .prizm-docs/ format
857
+ - Added Validate operation for format compliance and consistency checking
858
+ - Added Migrate operation for converting existing docs to .prizm-docs/ format
859
859
  - Added RULES hierarchy: root.prizm RULES authoritative, L1/L2 supplement only with module-specific exceptions
860
860
  - Added Section 16: Conflict Resolution for multi-person collaboration merge strategies
861
861
  - Added Section 17: Version Migration for upgrading between spec versions
@@ -916,7 +916,7 @@ ALGORITHM: prizm_merge_conflict
916
916
 
917
917
  ## 16.4 Prevention
918
918
 
919
- BEST_PRACTICE: Run prizmkit.doc.update immediately before committing to minimize drift
919
+ BEST_PRACTICE: Run prizmkit-prizm-docs Update operation immediately before committing to minimize drift
920
920
  BEST_PRACTICE: Keep .prizm doc changes small and focused (section-level, not file-level rewrites)
921
921
  BEST_PRACTICE: Coordinate on MODULE_INDEX changes (adding/removing modules) to avoid structural conflicts
922
922
 
@@ -932,7 +932,7 @@ MIGRATION_TRIGGER: AI detects PRIZM_VERSION in root.prizm and applies migration
932
932
 
933
933
  ## 17.2 V1 to V2 Migration
934
934
 
935
- COMMAND: Automatic on first prizmkit.doc.update or prizmkit.doc.validate after spec upgrade
935
+ TRIGGER: Automatic on first prizmkit-prizm-docs Update or Validate operation after spec upgrade
936
936
 
937
937
  ALGORITHM: prizm_migrate_v1_to_v2
938
938
 
@@ -947,7 +947,7 @@ ALGORITHM: prizm_migrate_v1_to_v2
947
947
  FLAG: Any L1/L2 RULES that contradict root.prizm RULES for manual review
948
948
 
949
949
  3. VALIDATE:
950
- Run full prizmkit.doc.validate
950
+ Run full Validate operation
951
951
  REPORT: Migration results and any issues found
952
952
 
953
953
  4. UPDATE_CHANGELOG: