prizmkit 1.1.7 → 1.1.9

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 (132) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/codebuddy/skill-adapter.js +21 -7
  3. package/bundled/agents/prizm-dev-team-reviewer.md +53 -173
  4. package/bundled/dev-pipeline/.env.example +45 -0
  5. package/bundled/dev-pipeline/README.md +64 -64
  6. package/bundled/dev-pipeline/SCHEMA_ANALYSIS.md +535 -0
  7. package/bundled/dev-pipeline/assets/feature-list-example.json +0 -1
  8. package/bundled/dev-pipeline/launch-bugfix-daemon.sh +64 -18
  9. package/bundled/dev-pipeline/launch-feature-daemon.sh +15 -12
  10. package/bundled/dev-pipeline/launch-refactor-daemon.sh +64 -18
  11. package/bundled/dev-pipeline/lib/branch.sh +6 -1
  12. package/bundled/dev-pipeline/lib/common.sh +71 -0
  13. package/bundled/dev-pipeline/lib/heartbeat.sh +2 -2
  14. package/bundled/dev-pipeline/reset-bug.sh +10 -9
  15. package/bundled/dev-pipeline/reset-feature.sh +9 -8
  16. package/bundled/dev-pipeline/reset-refactor.sh +10 -9
  17. package/bundled/dev-pipeline/retry-bugfix.sh +67 -29
  18. package/bundled/dev-pipeline/retry-feature.sh +54 -18
  19. package/bundled/dev-pipeline/retry-refactor.sh +112 -29
  20. package/bundled/dev-pipeline/run-bugfix.sh +281 -59
  21. package/bundled/dev-pipeline/run-feature.sh +53 -18
  22. package/bundled/dev-pipeline/run-refactor.sh +392 -66
  23. package/bundled/dev-pipeline/scripts/check-session-status.py +24 -1
  24. package/bundled/dev-pipeline/scripts/cleanup-logs.py +2 -2
  25. package/bundled/dev-pipeline/scripts/detect-stuck.py +195 -85
  26. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +57 -33
  27. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +25 -9
  28. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +104 -17
  29. package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +34 -9
  30. package/bundled/dev-pipeline/scripts/init-pipeline.py +10 -10
  31. package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +19 -8
  32. package/bundled/dev-pipeline/scripts/parse-stream-progress.py +1 -5
  33. package/bundled/dev-pipeline/scripts/patch-completion-notes.py +191 -0
  34. package/bundled/dev-pipeline/scripts/update-bug-status.py +167 -22
  35. package/bundled/dev-pipeline/scripts/update-feature-status.py +104 -62
  36. package/bundled/dev-pipeline/scripts/update-refactor-status.py +351 -21
  37. package/bundled/dev-pipeline/templates/agent-prompts/dev-fix.md +1 -1
  38. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-review.md +7 -11
  39. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +41 -7
  40. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +27 -3
  41. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +43 -19
  42. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +54 -26
  43. package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +6 -15
  44. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +36 -25
  45. package/bundled/dev-pipeline/templates/feature-list-schema.json +109 -31
  46. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +270 -0
  47. package/bundled/dev-pipeline/templates/refactor-list-schema.json +11 -3
  48. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +3 -1
  49. package/bundled/dev-pipeline/templates/sections/critical-paths-agent.md +1 -0
  50. package/bundled/dev-pipeline/templates/sections/feature-context.md +2 -0
  51. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +29 -2
  52. package/bundled/dev-pipeline/templates/sections/phase-commit.md +22 -0
  53. package/bundled/dev-pipeline/templates/sections/phase-deploy-verification.md +2 -2
  54. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +8 -6
  55. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +7 -5
  56. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +3 -3
  57. package/bundled/skills/_metadata.json +5 -22
  58. package/bundled/skills/app-planner/SKILL.md +98 -72
  59. package/bundled/skills/app-planner/assets/app-design-guide.md +1 -1
  60. package/bundled/skills/app-planner/references/architecture-decisions.md +1 -1
  61. package/bundled/skills/app-planner/references/project-brief-guide.md +69 -66
  62. package/bundled/skills/bug-fix-workflow/SKILL.md +52 -9
  63. package/bundled/skills/bug-planner/SKILL.md +139 -197
  64. package/bundled/skills/bug-planner/assets/bug-confirmation-template.md +43 -0
  65. package/bundled/skills/bug-planner/references/critic-and-verification.md +44 -0
  66. package/bundled/skills/bug-planner/references/error-recovery.md +73 -0
  67. package/bundled/skills/bug-planner/references/input-formats.md +53 -0
  68. package/bundled/skills/bug-planner/references/schema-validation.md +25 -0
  69. package/bundled/skills/bug-planner/references/severity-rules.md +16 -0
  70. package/bundled/skills/bug-planner/scripts/validate-bug-list.py +4 -8
  71. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +34 -39
  72. package/bundled/skills/feature-pipeline-launcher/SKILL.md +49 -36
  73. package/bundled/skills/feature-pipeline-launcher/scripts/preflight-check.py +3 -3
  74. package/bundled/skills/feature-planner/SKILL.md +53 -142
  75. package/bundled/skills/feature-planner/assets/evaluation-guide.md +1 -1
  76. package/bundled/skills/feature-planner/assets/planning-guide.md +21 -5
  77. package/bundled/skills/feature-planner/references/browser-interaction.md +2 -4
  78. package/bundled/skills/feature-planner/references/completeness-review.md +57 -0
  79. package/bundled/skills/feature-planner/references/error-recovery.md +16 -35
  80. package/bundled/skills/feature-planner/references/incremental-feature-planning.md +1 -1
  81. package/bundled/skills/feature-planner/references/new-project-planning.md +2 -2
  82. package/bundled/skills/feature-planner/scripts/validate-and-generate.py +19 -20
  83. package/bundled/skills/feature-workflow/SKILL.md +24 -25
  84. package/bundled/skills/prizm-kit/SKILL.md +39 -49
  85. package/bundled/skills/prizmkit-code-review/SKILL.md +51 -64
  86. package/bundled/skills/prizmkit-code-review/rules/dimensions.md +85 -0
  87. package/bundled/skills/prizmkit-code-review/rules/fix-strategy.md +11 -11
  88. package/bundled/skills/prizmkit-committer/SKILL.md +3 -31
  89. package/bundled/skills/prizmkit-deploy/SKILL.md +34 -31
  90. package/bundled/skills/prizmkit-deploy/assets/deploy-template.md +1 -1
  91. package/bundled/skills/prizmkit-implement/SKILL.md +35 -68
  92. package/bundled/skills/prizmkit-init/SKILL.md +112 -65
  93. package/bundled/skills/prizmkit-init/assets/project-brief-template.md +82 -0
  94. package/bundled/skills/prizmkit-plan/SKILL.md +120 -79
  95. package/bundled/skills/prizmkit-plan/assets/plan-template.md +28 -18
  96. package/bundled/skills/prizmkit-plan/assets/spec-template.md +28 -11
  97. package/bundled/skills/prizmkit-plan/references/clarify-guide.md +3 -3
  98. package/bundled/skills/prizmkit-plan/references/verification-checklist.md +60 -0
  99. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +10 -81
  100. package/bundled/skills/prizmkit-prizm-docs/assets/{PRIZM-SPEC.md → prizm-docs-format.md} +41 -526
  101. package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +46 -0
  102. package/bundled/skills/prizmkit-prizm-docs/references/op-rebuild.md +16 -0
  103. package/bundled/skills/prizmkit-prizm-docs/references/op-status.md +14 -0
  104. package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +19 -0
  105. package/bundled/skills/prizmkit-prizm-docs/references/op-validate.md +17 -0
  106. package/bundled/skills/prizmkit-retrospective/SKILL.md +27 -65
  107. package/bundled/skills/prizmkit-retrospective/references/knowledge-injection-steps.md +3 -4
  108. package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +7 -25
  109. package/bundled/skills/recovery-workflow/SKILL.md +22 -22
  110. package/bundled/skills/recovery-workflow/evals/evals.json +5 -5
  111. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +43 -10
  112. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +48 -40
  113. package/bundled/skills/refactor-planner/SKILL.md +43 -61
  114. package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +17 -17
  115. package/bundled/skills/refactor-workflow/SKILL.md +23 -24
  116. package/bundled/team/prizm-dev-team.json +1 -1
  117. package/bundled/{skills/prizm-kit/assets → templates}/project-memory-template.md +1 -1
  118. package/package.json +1 -1
  119. package/src/clean.js +3 -4
  120. package/src/gitignore-template.js +7 -9
  121. package/src/scaffold.js +14 -5
  122. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-analyze.md +0 -5
  123. package/bundled/dev-pipeline/templates/sections/phase-analyze-agent.md +0 -19
  124. package/bundled/dev-pipeline/templates/sections/phase-analyze-full.md +0 -19
  125. package/bundled/skills/app-planner/references/project-conventions.md +0 -93
  126. package/bundled/skills/prizmkit-analyze/SKILL.md +0 -207
  127. package/bundled/skills/prizmkit-code-review/rules/dimensions-bugfix.md +0 -25
  128. package/bundled/skills/prizmkit-code-review/rules/dimensions-feature.md +0 -43
  129. package/bundled/skills/prizmkit-code-review/rules/dimensions-refactor.md +0 -25
  130. package/bundled/skills/prizmkit-implement/references/deploy-guide-protocol.md +0 -69
  131. package/bundled/skills/prizmkit-verify/SKILL.md +0 -281
  132. package/bundled/skills/prizmkit-verify/scripts/verify-light.py +0 -402
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: "prizmkit-init"
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)"
3
+ description: "Project takeover and bootstrap. Scans any project, generates Prizm docs and project brief. 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
7
7
 
8
- Project takeover and bootstrap skill. Scans any project (brownfield or greenfield), generates Prizm documentation, and configures platform-specific hooks for documentation sync. Supports CodeBuddy, Claude Code, and dual-platform installations.
8
+ Project takeover and bootstrap skill. Scans any project (brownfield or greenfield), generates Prizm documentation and project brief. Supports CodeBuddy, Claude Code, and dual-platform installations.
9
9
 
10
10
  ### When to Use
11
11
  - Taking over a new project (brownfield or greenfield)
@@ -14,35 +14,58 @@ Project takeover and bootstrap skill. Scans any project (brownfield or greenfiel
14
14
  - After `npx prizmkit install` when project has no `.prizm-docs/`
15
15
 
16
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-plan`
17
+ - All artifacts exist and are up to date → use `/prizmkit-prizm-docs` (Update) instead if you only want to resync docs
18
+ - User just wants to update stale docs → use `/prizmkit-prizm-docs` (Update or Rebuild) instead (faster, targeted)
19
+ - User wants to start a feature on an already-initialized project → skip init, go to `/prizmkit-plan`
20
20
 
21
21
  ### Error Handling
22
- - If `.prizm-docs/` already exists: ask user if they want to reinitialize (overwrites) or update (preserves)
22
+ - If artifacts already exist: idempotent status check offers regenerate/skip choices (see Phase 3: Idempotent Status Check)
23
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
24
 
26
25
  ## Execution Steps
27
26
 
28
- **PLATFORM DETECTION (before anything else):**
29
- 1. Check for platform indicators in the current environment:
30
- - CodeBuddy: `.codebuddy/` directory exists, or running inside `cbc` session
31
- - Claude Code: `.claude/` directory exists, or running inside `claude` session
32
- - Both: Both directories exist
33
- - Unknown: Neither exists — ask the user which platform(s) to configure
34
- 2. Store detected platform in `.prizmkit/config.json` as `"platform": "codebuddy" | "claude" | "both"`
35
-
36
- MODE DETECTION:
37
- - If `.prizm-docs/` exists: Ask user if they want to reinitialize or update
38
- - **Reinitialize**: overwrites `.prizm-docs/` and `config.json` tech_stack (fresh start)
39
- - **Update**: re-scans tech stack and merges changes into existing `config.json` (see Step 3b merge strategy); updates `root.prizm` TECH_STACK if changed; preserves existing `.prizm-docs/` L1/L2 docs; checks for missing L1/L2 docs and creates them for modules with source files (see Update Supplement below)
27
+ **Phase 1: Platform Detection**
28
+ 1. Detect which platform is running (CodeBuddy or Claude Code) via AI CLI environment.
29
+ 2. Hold detected platform value in memory written to disk in Phase 6 along with other config fields.
30
+
31
+ **Phase 2: Mode Detection**
40
32
  - If project has source code: brownfield mode
41
33
  - If project is nearly empty: greenfield mode
42
34
 
35
+ **Phase 3: Idempotent Status Check**
36
+
37
+ Scan all init artifacts and display their status:
38
+
39
+ | Artifact | Path | Check |
40
+ |----------|------|-------|
41
+ | Prizm docs | `.prizm-docs/` | Directory exists + `root.prizm` present |
42
+ | Runtime config | `.prizmkit/config.json` | File exists |
43
+ | Project brief | `.prizmkit/plans/project-brief.md` | File exists |
44
+
45
+ Display status table to user:
46
+ ```
47
+ Init Status Check:
48
+ [exists] .prizm-docs/ (N files)
49
+ [exists] .prizmkit/config.json
50
+ [missing] .prizmkit/plans/project-brief.md
51
+ ```
52
+
53
+ - **If all missing**: skip interaction, proceed to generate everything.
54
+ - **If some exist**: ask user once:
55
+ - **[A] Regenerate all** — overwrite all existing artifacts (fresh start)
56
+ - **[B] Only generate missing** — skip existing, fill gaps (default)
57
+ - **[C] Pick per item** — ask for each existing artifact: regenerate or skip
58
+
59
+ Each subsequent phase checks its artifact's action before executing:
60
+ - `action == skip` → output "Skipped (exists)" and move on
61
+ - `action == generate | regenerate` → run normally
62
+ - **Special case for `.prizm-docs/`**:
63
+ - `skip` = **Update** mode: preserve existing L1/L2 docs, re-scan tech stack, merge changes, check for missing docs (see `${SKILL_DIR}/references/update-supplement.md`)
64
+ - `regenerate` = **Reinitialize**: overwrite everything
65
+
43
66
  BROWNFIELD WORKFLOW (existing project):
44
67
 
45
- **Step 1: Project Scanning**
68
+ **Phase 4: Project Scanning**
46
69
  1. Detect tech stack from build files (`package.json`, `requirements.txt`, `go.mod`, `pom.xml`, `Cargo.toml`, etc.)
47
70
  2. Map directory structure using a TWO-TIER model — flat structures lose the nesting relationships that AI needs to navigate the codebase:
48
71
  - TOP-LEVEL modules: directories directly under project root that contain source files or sub-directories with source files (e.g. `src/`, `internal/`, `lib/`)
@@ -68,8 +91,8 @@ BROWNFIELD WORKFLOW (existing project):
68
91
 
69
92
  **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.
70
93
 
71
- **Step 2: Prizm Documentation Generation**
72
- Invoke prizmkit-prizm-docs (Init operation), passing the two-tier module structure from Step 1:
94
+ **Phase 5: Prizm Documentation Generation**
95
+ Invoke prizmkit-prizm-docs (Init operation), passing the two-tier module structure from Phase 4:
73
96
  - Create `.prizm-docs/` directory structure mirroring the source tree (sub-module dirs become subdirectories under `.prizm-docs/<top-level>/`)
74
97
  - Generate `root.prizm` (L0) with project meta and MODULE_INDEX listing only top-level modules. If module count > 15, use MODULE_GROUPS format instead (group by functional domain).
75
98
  - For each module entry in MODULE_INDEX/MODULE_GROUPS, include keyword tags extracted from the module's source files — scan for: exported symbols, imported packages, domain terms in file/directory names. Format: `- module-name [tag1, tag2, tag3]: ...`. Tags help AI match user intent to relevant modules.
@@ -77,25 +100,53 @@ Invoke prizmkit-prizm-docs (Init operation), passing the two-tier module structu
77
100
  - Create `changelog.prizm`
78
101
  - Skip L2 (lazy generation) — L2 is generated on first file modification, saving tokens upfront
79
102
 
80
- **Step 3: PrizmKit Workspace Initialization**
81
- 3a. Create `.prizmkit/` directory:
103
+ **Phase 6: Workspace Initialization**
104
+ 6a. Create `.prizmkit/` directory structure (if missing):
82
105
  - `.prizmkit/config.json` (adoption_mode, speckit_hooks_enabled, platform)
83
106
  - `.prizmkit/specs/` (empty)
107
+ - `.prizmkit/plans/` (empty — needed by Phase 7 and future pipeline tasks)
84
108
 
85
- 3b. Write detected tech stack to `.prizmkit/config.json`:
109
+ 6b. Write detected tech stack to `.prizmkit/config.json`:
86
110
  → Read `${SKILL_DIR}/references/config-schema.md` for merge strategy, field definitions, and examples.
87
111
 
88
- **Step 4: Hook & Settings Configuration**
89
-
90
- 4a. Read or create platform settings file (`.codebuddy/settings.json` or `.claude/settings.json`)
91
- 4b. Add UserPromptSubmit and PostToolUse hooks for automatic prizm-docs reminders
92
- 4c. For Claude Code: also add `permissions` entries and `.claude/rules/` for documentation enforcement:
93
- - `.claude/rules/prizm-documentation.md` (glob-scoped source file rules)
94
- - `.claude/rules/prizm-commit-workflow.md` (commit workflow enforcement)
95
- 4d. Preserve any existing hooks and settings — never overwrite user's custom configuration
96
-
97
- **Step 5: Report**
98
- Output summary: platform detected, tech stack detected (with detail), modules discovered, L1 docs generated, platform-specific configuration applied, next recommended steps.
112
+ **Phase 7: Project Brief Generation**
113
+
114
+ If action for project brief == skip, output "Project brief: skipped (exists)" and proceed to Phase 8 (Report).
115
+
116
+ Otherwise, generate a project brief to capture the user's overall product vision. This file is referenced by `root.prizm` so every new AI session understands the project goals.
117
+
118
+ Read `${SKILL_DIR}/assets/project-brief-template.md` for the brief format rules and checklist template.
119
+
120
+ **Brownfield** (existing codebase):
121
+ 1. Infer project goals from:
122
+ - Generated `root.prizm` (tech stack, module structure, module groups)
123
+ - `README.md` (if exists)
124
+ - Package metadata (`package.json` description, `pyproject.toml`, etc.)
125
+ - Quick scan of key entry points identified in L1 docs
126
+ 2. Generate a draft in the checklist format defined in the template
127
+ 3. Present the draft to the user and ask:
128
+ - Is this inference correct?
129
+ - Anything to add, remove, or modify?
130
+ 4. Apply user edits and write to `.prizmkit/plans/project-brief.md`
131
+
132
+ **Greenfield** (new/empty project):
133
+ 1. Use **progressive questioning** (defined in template) to fully understand the user's intent:
134
+ - Round 1: Problem & Vision → Round 2: Scope & Features → Round 3: Technical Constraints → Round 4: Clarification (adaptive)
135
+ - Stop when completion criteria are met: problem, users, core features, boundaries, and technical direction are all clear
136
+ - If answers are vague, probe deeper — don't accept shallow responses
137
+ 2. Generate brief from answers in checklist format
138
+ 3. Present to user for confirmation/editing
139
+ 4. Write to `.prizmkit/plans/project-brief.md`
140
+
141
+ **After writing the brief**:
142
+ - Check if `root.prizm` already contains a `PROJECT_BRIEF:` line
143
+ - If exact match `PROJECT_BRIEF: .prizmkit/plans/project-brief.md` exists: skip (already correct)
144
+ - If `PROJECT_BRIEF:` exists with a different path: warn user and ask to confirm update or keep old path
145
+ - If not present: add `PROJECT_BRIEF: .prizmkit/plans/project-brief.md` at the end of `root.prizm`, after all standard sections
146
+ - This ensures every AI session that loads L0 knows to read the project brief
147
+
148
+ **Phase 8: Report**
149
+ Output summary: platform detected, tech stack detected (with detail), modules discovered, L1 docs generated, project brief status, next recommended steps.
99
150
 
100
151
  Tech stack report format (only show detected fields, adapt to project type):
101
152
  ```
@@ -114,37 +165,16 @@ Adapt fields to match project type — only show detected fields.
114
165
 
115
166
  Saved to: `.prizmkit/config.json` → `tech_stack` field
116
167
 
117
- Include platform-specific guidance:
118
- - CodeBuddy: "Use `/prizmkit-plan` to start your first feature"
119
- - Claude Code: "Use `/prizmkit-plan` to start your first feature"
168
+ Next step: "Use `/prizmkit-plan` to start your first feature"
120
169
 
121
170
  GREENFIELD WORKFLOW (new project):
122
- - Skip Step 1 (no code to scan) — but ask the user about their intended tech stack:
171
+ - Skip Phase 4 (no code to scan) — but ask the user about their intended tech stack:
123
172
  - "What language/framework will you use?" (e.g. React + Node.js, Python + FastAPI, etc.)
124
173
  - Record answers in `config.json` `tech_stack` with `"_auto_detected": false` (user-provided, not auto-detected)
125
174
  - If user is unsure, skip tech_stack — it can be populated later on re-init after code exists
126
- - Step 2: Create minimal `.prizm-docs/` with just `root.prizm` skeleton (populate TECH_STACK from user answers if provided)
127
- - Steps 3-5: Same as brownfield (Step 5 Report recommends starting with specify for first feature)
128
-
129
- ### Gradual Adoption Path
130
- After init, PrizmKit operates in phases:
131
- - **Passive** (default): Generates docs, doesn't enforce workflow
132
- - **Advisory**: Suggests improvements, flags issues (enable in config)
133
- - **Active**: Enforces spec-driven workflow for new features (enable in config)
134
-
135
- User can change mode in `.prizmkit/config.json`: `"adoption_mode": "passive" | "advisory" | "active"`
136
-
137
- ### Platform Reference
138
-
139
- | Concept | CodeBuddy | Claude Code |
140
- |---------|-----------|-------------|
141
- | Command invocation | `/prizmkit-xxx` | `/prizmkit-xxx` |
142
- | Project knowledge | `.prizm-docs/` | `.prizm-docs/` |
143
- | Settings | `.codebuddy/settings.json` | `.claude/settings.json` |
144
- | Skills/Commands | `.codebuddy/skills/` | `.claude/commands/` |
145
- | Agents | `.codebuddy/agents/` | `.claude/agents/` |
146
- | Rules | hooks in settings.json | `.claude/rules/*.md` |
147
- | CLI command | `cbc` | `claude` |
175
+ - Phase 5: Create minimal `.prizm-docs/` with just `root.prizm` skeleton (populate TECH_STACK from user answers if provided)
176
+ - Phase 7: Generate project brief (greenfield flow ask user about project goals, see Phase 7 above)
177
+ - Phases 6, 8: Same as brownfield (Phase 8 Report recommends `/prizmkit-plan` for first feature)
148
178
 
149
179
  ## Example
150
180
 
@@ -153,6 +183,12 @@ User can change mode in `.prizmkit/config.json`: `"adoption_mode": "passive" | "
153
183
  $ /prizmkit-init
154
184
 
155
185
  Platform detected: Claude Code
186
+ Init Status Check:
187
+ [missing] .prizm-docs/
188
+ [missing] .prizmkit/config.json
189
+ [missing] .prizmkit/plans/project-brief.md
190
+ → All missing, generating everything.
191
+
156
192
  Mode: Brownfield (154 source files found)
157
193
 
158
194
  Tech stack detected:
@@ -171,8 +207,10 @@ Modules discovered:
171
207
  src/services/ → .prizm-docs/services.prizm (15 files)
172
208
  src/middleware/ → .prizm-docs/middleware.prizm (5 files)
173
209
 
210
+ Project brief: inferred from codebase → confirmed by user
211
+ → .prizmkit/plans/project-brief.md
212
+
174
213
  Generated: root.prizm + 4 L1 docs + changelog.prizm
175
- Configured: .claude/rules/ (2 files), hooks in settings.json
176
214
  Saved: .prizmkit/config.json (tech_stack recorded)
177
215
 
178
216
  Next: Use /prizmkit-plan to start your first feature
@@ -185,8 +223,14 @@ UPDATE SUPPLEMENT (runs after tech stack merge in Update mode):
185
223
  ```
186
224
  $ /prizmkit-init
187
225
 
188
- .prizm-docs/ already exists. Reinitialize or update?
189
- > Update (preserve existing docs)
226
+ Init Status Check:
227
+ [exists] .prizm-docs/ (12 files)
228
+ [exists] .prizmkit/config.json
229
+ [missing] .prizmkit/plans/project-brief.md
230
+
231
+ Missing items will be generated.
232
+ For existing items: [A] Regenerate all [B] Only generate missing (default) [C] Pick per item
233
+ > B (Only generate missing)
190
234
 
191
235
  Tech stack changes detected:
192
236
  + bundler: Vite (newly detected)
@@ -199,5 +243,8 @@ Documentation gap-fill:
199
243
  = routes.prizm (L1) — up to date
200
244
  ~ models.prizm (L1) — FILES count updated (8 → 10)
201
245
 
246
+ Project brief: inferred from codebase → confirmed by user
247
+ → .prizmkit/plans/project-brief.md (generated)
248
+
202
249
  Merged into .prizmkit/config.json (2 fields updated, user overrides preserved)
203
250
  ```
@@ -0,0 +1,82 @@
1
+ # Project Brief Template
2
+
3
+ > Capture the user's key product ideas as a simple checklist. Each line is one idea. This file is referenced by `root.prizm` (`PROJECT_BRIEF:`) so every new AI session automatically knows the project's goals.
4
+
5
+ ## File Location
6
+
7
+ `.prizmkit/plans/project-brief.md`
8
+
9
+ ## Format
10
+
11
+ ```markdown
12
+ # Project Brief
13
+
14
+ [ ] Core product idea or constraint
15
+ [ ] Another product idea
16
+ [ ] Third idea — one sentence, no sub-bullets
17
+ [x] Already implemented feature -> src/feature/, src/utils/helper.ts
18
+ ```
19
+
20
+ ## Rules
21
+
22
+ 1. **First line**: `# Project Brief`
23
+ 2. **Remaining lines**: One idea per line, prefixed with `[ ]` (pending) or `[x]` (done)
24
+ 3. Each line is **one sentence** — no paragraphs, no sub-bullets, no grouping headers
25
+ 4. Language: match the user's language (Chinese or English)
26
+ 5. **Size limit**: 500 words max (this file is injected into every session's context window)
27
+ 6. **Completion marking** (mandatory): When a brief item is implemented:
28
+ - Change `[ ]` to `[x]`
29
+ - Append `->` followed by the **key file or directory paths** that implement it
30
+ - List the most important 1-3 paths only (entry point, core module, or directory) — not every touched file
31
+ - Example: `[x] User authentication with OAuth -> src/auth/, src/middleware/auth.ts`
32
+ - This lets future AI sessions instantly locate the implementation without re-scanning
33
+
34
+ ## Brownfield Init
35
+
36
+ When initializing an existing project, AI infers the brief from:
37
+ - Generated `root.prizm` (tech stack, module structure)
38
+ - `README.md` (if exists)
39
+ - Package metadata (`package.json` description, `pyproject.toml`, etc.)
40
+
41
+ Then presents the draft to the user for confirmation and editing.
42
+
43
+ ## Greenfield Init
44
+
45
+ When initializing a new/empty project, use **progressive questioning** to fully understand the user's intent before generating the brief. Do NOT dump all questions at once — ask in rounds, adapting based on answers.
46
+
47
+ ### Round 1: Problem & Vision (required)
48
+ - What problem does this project solve? (or: what's the core idea?)
49
+ - Who is the target user / audience?
50
+
51
+ ### Round 2: Scope & Features (required)
52
+ - What are the 3-5 core features or capabilities? (ask user to list them)
53
+ - What is the MVP scope? (what's the minimum version that delivers value?)
54
+ - Are there any explicit non-goals? (things this project deliberately does NOT do)
55
+
56
+ ### Round 3: Technical Constraints (if user has preferences)
57
+ - Any preferred tech stack / language / framework?
58
+ - Any integration requirements? (third-party APIs, databases, auth providers)
59
+ - Deployment target? (web app, mobile, CLI, library, self-hosted, cloud)
60
+
61
+ ### Round 4: Clarification (adaptive — only if gaps remain)
62
+ If previous answers are vague or incomplete, probe deeper:
63
+ - "You mentioned X — can you give a concrete example of how a user would use it?"
64
+ - "Are there existing tools that do something similar? How is yours different?"
65
+ - "What does success look like for V1?"
66
+
67
+ ### Completion Criteria
68
+ Stop asking when ALL of these are clear:
69
+ 1. **Problem** — what pain point or opportunity this addresses
70
+ 2. **Users** — who will use it and in what context
71
+ 3. **Core features** — at least 3 concrete capabilities (not vague aspirations)
72
+ 4. **Boundaries** — what's in scope vs. out of scope for V1
73
+ 5. **Technical direction** — enough to populate `config.json` tech_stack (or explicitly deferred)
74
+
75
+ If the user gives short/vague answers, don't accept them — rephrase and ask again. A weak brief leads to weak specs downstream.
76
+
77
+ ### Generate & Confirm
78
+ Once all criteria are met:
79
+ 1. Generate brief in checklist format (see Format section above)
80
+ 2. Present to user with: "Here's what I captured — anything to add, remove, or change?"
81
+ 3. Apply edits and write to `.prizmkit/plans/project-brief.md`
82
+
@@ -1,111 +1,103 @@
1
1
  ---
2
2
  name: "prizmkit-plan"
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)"
3
+ description: "Specify and plan tasks: natural language → spec.md & plan.md with architecture and executable tasks. Use before /prizmkit-implement. Trigger on: 'specify', 'plan', 'new task', 'I want to add/build...', 'architect', 'design', 'break it down', 'create tasks'. (project)"
4
4
  ---
5
5
 
6
6
  # PrizmKit Plan
7
7
 
8
+ A universal spec + plan generator. Takes a natural-language description of ANY development task (new feature, refactoring, bug fix, migration, etc.) and produces `spec.md` (WHAT/WHY) and `plan.md` (HOW) with executable tasks.
9
+
8
10
  ### When to Use
9
- - New feature user says "specify", "plan", "new feature", "I want to add..."
11
+ - Any non-trivial development task that benefits from written specification and planning
10
12
  - Before `/prizmkit-implement` — to create the spec + task breakdown
11
- - When a feature idea needs to go from concept to executable plan
13
+ - User says "specify", "plan", "new task", "I want to add...", "architect", "design", "break it down"
12
14
 
13
15
  ### When NOT to Use
14
- - Bug fix with clear root cause fast path (skip Phase 0, simplified plan implement → commit)
15
- - Config tweaks, typo fixes edit directly
16
- - User already has a detailed spec → start from Phase 1
16
+ - Config tweaks, typo fixes, trivial one-line changesedit directly
17
+ - Simple changes where the developer already knows exactly what to do and the scope is ≤10 lines in a single file
18
+
19
+ ## Input
20
+
21
+ | Parameter | Required | Description |
22
+ |-----------|----------|-------------|
23
+ | `description` | Yes | Natural-language description of the task |
24
+ | `artifact_dir` | No | Directory to write spec.md + plan.md into. If omitted, auto-generates under `.prizmkit/specs/` (see Phase 0 Step 2). |
17
25
 
18
26
  ## Execution
19
27
 
20
- ### Phase 0: Specify (WHAT)
28
+ ### Phase 0: Specify (→ spec.md)
21
29
 
22
- Transforms natural language into a structured spec. Skip this phase when:
23
- - A `spec.md` already exists for this feature
24
- - Running in refactor mode (input is `refactor-analysis.md`)
25
- - Running in bugfix mode (input is `fix-plan.md` or caller-provided description)
30
+ **Skip condition**: If `spec.md` already exists in the artifact directory, skip to Phase 1.
26
31
 
27
32
  **Steps:**
28
33
 
29
- 1. Ask user for feature description (natural language)
30
- 2. Auto-generate 2-4 word feature slug from description
31
- 3. Determine next feature number by scanning `.prizmkit/specs/`:
32
- - List existing `###-*` directories, find highest numeric prefix
33
- - Next = highest + 1 (zero-padded to 3 digits)
34
- - If empty or doesn't exist, start at `001`
35
- 4. Create directory: `.prizmkit/specs/###-feature-name/`
36
- 5. Load project context (use first available):
37
- - If `context-snapshot.md` exists in the feature dir → read Section 3 'Prizm Context' (skip re-reading .prizm-docs/)
38
- - Otherwise → read `.prizm-docs/root.prizm` and relevant L1/L2 docs
39
- 6. Generate `spec.md` from template (`${SKILL_DIR}/assets/spec-template.md`):
40
- - Feature title and description
41
- - User stories (As a... I want... So that...) with acceptance criteria (Given/When/Then)
42
- - Scope boundaries (In scope / Out of scope)
43
- - Dependencies and constraints
34
+ 1. Gather input: read the task description. If no description is provided and interactive session is available, ask the user; otherwise abort with an error.
35
+ 2. Determine artifact directory:
36
+ - If `artifact_dir` is provided use it directly
37
+ - If not provided → scan `.prizmkit/specs/` for existing `###-*` directories, find highest numeric prefix, next = highest + 1 (zero-padded to 3 digits; start at `001` if empty). Create `.prizmkit/specs/###-task-slug/`
38
+ - Auto-generate 2-10 word task slug from description
39
+ 3. Load project context: read `.prizm-docs/root.prizm` and relevant L1/L2 docs
40
+ 4. Generate `spec.md` from template (`${SKILL_DIR}/assets/spec-template.md`):
41
+ - Fill sections based on the task description — all sections are optional, include only what is relevant
44
42
  - `[NEEDS CLARIFICATION]` markers for all ambiguous items
45
- 7. **Database design detection**: If feature involves data persistence (new entities, fields, schema changes), add a `## Data Model` section to spec.md — scan existing schema files to extract naming conventions, ID strategy, constraint patterns. Mark uncertain decisions with `[NEEDS CLARIFICATION]`.
46
- 8. Run quality validation (max 3 iterations): all stories have criteria? scope defined? DB conventions documented?
47
- 9. **Auto-clarification**: If any `[NEEDS CLARIFICATION]` markers remain, enter interactive clarification immediately.
43
+ 5. **Database design detection**: If changes involve data persistence (new entities, fields, schema changes), add `## Data Model` section — scan existing schema files to extract naming conventions, ID strategy, constraint patterns. Mark uncertain decisions with `[NEEDS CLARIFICATION]`.
44
+ 6. Run quality validation : all goals have criteria? scope defined? DB conventions documented (if applicable)?
45
+ 7. **Auto-clarification**: If any `[NEEDS CLARIFICATION]` markers remain and interactive session is available, enter interactive clarification.
48
46
  → Read `${SKILL_DIR}/references/clarify-guide.md` for question strategy and update rules.
47
+ If non-interactive, resolve ambiguities by choosing the most conservative option and annotating the decision.
49
48
  Resolve all markers before proceeding to Phase 1.
50
49
 
51
- **Writing principles**: Focus on WHAT and WHY, never HOW. Every user story needs acceptance criteria. Scope boundaries must be explicit. Mark all genuine ambiguities — the clarification phase resolves them.
50
+ **Writing principles**: Focus on WHAT and WHY, never HOW. Every goal needs acceptance criteria. Scope boundaries must be explicit. Mark all genuine ambiguities — the clarification phase resolves them.
52
51
 
53
- ### Phase 1: Design (HOW)
52
+ ### Phase 1: Design (spec.md → plan.md)
54
53
 
55
- **Precondition:**
56
-
57
- | Mode | Required Input | Directory |
58
- |---|---|---|
59
- | **Feature** (default) | `spec.md` (from Phase 0) + `.prizm-docs/root.prizm` | `.prizmkit/specs/###-feature-name/` |
60
- | **Refactor** | `refactor-analysis.md` | `.prizmkit/refactor/<refactor-slug>/` |
61
- | **Bugfix** | `fix-plan.md` or caller-provided description | `.prizmkit/bugfix/<BUG_ID>/` |
62
-
63
- If no input document exists, prompt user to describe the feature (triggers Phase 0).
54
+ **Precondition**: `spec.md` exists in the artifact directory.
64
55
 
65
56
  **Steps:**
66
57
 
67
- 1. Read the input document (spec.md / refactor-analysis.md / fix-plan.md)
68
- 2. Load project context if not already loaded in Phase 0:
69
- - If `context-snapshot.md` exists → read it for docs + code structure
70
- - Otherwise → read `.prizm-docs/root.prizm` and relevant L1/L2 docs
58
+ 1. Read `spec.md` from the artifact directory
59
+ 2. Load project context if not already loaded in Phase 0: read `.prizm-docs/root.prizm` and relevant L1/L2 docs
71
60
  3. Resolve any remaining `[NEEDS CLARIFICATION]` by proposing solutions
72
61
  4. Generate `plan.md` from template (`${SKILL_DIR}/assets/plan-template.md`):
73
- - Architecture approach, component design
62
+ - Change approach (how the changes integrate with existing system)
63
+ - Component / file changes
74
64
  - Data model changes (with **database design gate** — read ALL existing schema files, ensure new schema follows existing patterns, resolve all DB ambiguities inline before proceeding)
75
65
  - Interface design (API endpoints, request/response formats)
76
- - Integration points, testing strategy, risk assessment
77
- 5. Cross-check: every user story maps to plan components — unmapped stories = coverage gaps
66
+ - Testing strategy
67
+ - Risk assessment
68
+ - Behavior preservation strategy (if the task modifies existing behavior — include what must remain unchanged and how to verify)
69
+ 5. Cross-check: every goal in spec.md maps to plan components — unmapped goals = coverage gaps
78
70
  6. Check alignment with `.prizm-docs/root.prizm` RULES section
79
- 7. **Deployment strategy check:**
71
+ 7. **Deployment strategy check** (skip if no deployment impact):
80
72
  - Read `.prizmkit/config.json` `deploy_strategy` field
81
- - No strategy → ask user, write to config.json
82
- - Strategy exists + new tech stack detected → ask about new component only
83
- - Skipped in fast-path mode (bug fixes / simple refactors)
73
+ - No strategy and new infra needed → ask user, write to config.json
84
74
 
85
- ### Phase 2: Task Generation
75
+ ### Phase 2: Task Generation (plan.md → Tasks section)
86
76
 
87
- 1. Ask user for strategy (or infer): MVP-first / Incremental / Parallel
88
- 2. Append `## Tasks` section to `plan.md` using tasks template in `${SKILL_DIR}/assets/plan-template.md`:
89
- - Phases: Setup (T-001~T-009) → Foundational (T-010~T-099) → User Stories (T-100+) → Polish (T-900+)
90
- - Each task: `- [ ] [T-NNN] [P?] [US?] Description — file: path/to/file`
77
+ 1. If interactive session is available, ask user for strategy; otherwise infer automatically: MVP-first / Incremental / Parallel
78
+ 2. Append `## Tasks` section to `plan.md` using template in `${SKILL_DIR}/assets/plan-template.md`:
79
+ - Phases: Setup (T-001~T-009) → Foundation (T-010~T-099) → Core (T-100+) → Polish (T-900+)
80
+ - Each task: `- [ ] [T-NNN] [P?] [G-N?] Description — file: path/to/file`
91
81
  - Checkpoint tasks between phases for validation
92
- 3. Verify coverage:
93
- - Every user storyat least one task
94
- - Every task a target file path
95
- - Risk assessment → at least one risk with mitigation
96
- 4. Output: `plan.md` path, summary of design decisions, task count
82
+ - Organize Core tasks by goals (G-1, G-2, ...) or by logical grouping appropriate to the task
83
+ 3. Verify consistency and coverage read `${SKILL_DIR}/references/verification-checklist.md` and run all checks. Fix any issues inline before output.
84
+ 4. Output: `plan.md` path, summary of design decisions, task count.
97
85
 
98
86
  **HANDOFF:** `/prizmkit-implement`
99
87
 
100
- ## Example
88
+ ## Examples
89
+
90
+ ### Example 1: New Feature
101
91
 
102
92
  **Input:** "I want users to upload avatars"
103
93
 
104
94
  **Phase 0 output:** `.prizmkit/specs/003-user-avatar/spec.md`
105
95
  ```markdown
106
- # Feature: User Avatar Upload
107
- ## User Stories
108
- ### US-1: Upload Avatar
96
+ # User Avatar Upload
97
+ ## Overview
98
+ Allow registered users to upload and manage profile pictures.
99
+ ## Goals
100
+ ### G-1: Upload Avatar
109
101
  As a registered user, I want to upload a profile picture,
110
102
  so that other users can visually identify me.
111
103
  **Acceptance Criteria:**
@@ -119,26 +111,75 @@ so that other users can visually identify me.
119
111
 
120
112
  **Phase 1-2 output:** `plan.md` excerpt:
121
113
  ```markdown
122
- ## Architecture Approach
123
- Extend existing user profile module. Add S3 integration for file storage.
124
-
125
114
  ## Tasks
126
- ### Phase: Data Layer (T-010~T-019)
127
- - [ ] [T-010] [US-1] Add avatar_url field to User model — file: src/models/user.ts
128
- - [ ] [T-011] [US-1] Create S3 upload utility — file: src/lib/s3.ts
129
- ### Phase: API [P] (T-100~T-109)
130
- - [ ] [T-100] [P] [US-1] POST /api/avatar upload endpoint — file: src/routes/avatar.ts
115
+ ### Phase: Foundation (T-010~T-019)
116
+ - [ ] [T-010] [G-1] Add avatar_url field to User model — file: src/models/user.ts
117
+ - [ ] [T-011] [G-1] Create S3 upload utility — file: src/lib/s3.ts
118
+ ### Phase: Core [P] (T-100~T-109)
119
+ - [ ] [T-100] [P] [G-1] POST /api/avatar upload endpoint — file: src/routes/avatar.ts
120
+ ```
121
+
122
+ ### Example 2: Refactoring
123
+
124
+ **Input:** "Extract shared auth middleware from the API routes"
125
+
126
+ **Phase 0 output:** `.prizmkit/specs/004-extract-auth-middleware/spec.md`
127
+ ```markdown
128
+ # Extract Auth Middleware
129
+ ## Overview
130
+ Consolidate duplicated authentication logic scattered across route files into a single shared middleware.
131
+ ## Goals
132
+ ### G-1: Extract Shared Authentication Logic
133
+ Consolidate duplicated auth checks from 5 route files into a single middleware module.
134
+ **Acceptance Criteria:**
135
+ - All existing auth-related tests pass without modification
136
+ - Auth logic exists in exactly one file (src/middleware/auth.ts)
137
+ - No route file contains inline token verification
138
+ ## Scope
139
+ - **In scope:** src/routes/users.ts, orders.ts, admin.ts, payments.ts, profile.ts
140
+ - **Out of scope:** Authorization (role-based access), rate limiting
141
+ ## Behavior Preservation
142
+ - All 23 existing API tests must pass unchanged
143
+ - Response formats and HTTP status codes must not change
144
+ - Error message strings must remain identical
145
+ ```
146
+
147
+ ### Example 3: Bug Fix
148
+
149
+ **Input:** "Login page crashes when API returns 401"
150
+
151
+ **Phase 0 output:** `.prizmkit/specs/005-login-401-crash/spec.md`
152
+ ```markdown
153
+ # Fix: Login Crash on 401 Response
154
+ ## Overview
155
+ Login page throws unhandled exception when auth API returns 401, causing a white screen.
156
+ ## Goals
157
+ ### G-1: Handle 401 Response Gracefully
158
+ When the auth API returns 401, display an error message instead of crashing.
159
+ **Acceptance Criteria:**
160
+ - Given user submits invalid credentials, When API returns 401, Then error message "Invalid credentials" is displayed
161
+ - Given user submits invalid credentials, When API returns 401, Then no unhandled exception is thrown
162
+ ## Root Cause
163
+ - Error classification: Runtime
164
+ - Root cause: `AuthService.handleLogin()` at src/services/auth.ts:42 does not handle null token
165
+ - Affected files: src/services/auth.ts (L42), src/pages/login.tsx (L28)
166
+ ## Scope
167
+ - **In scope:** Null handling in auth service, error display in login page
168
+ - **Out of scope:** Other HTTP error codes (403, 500), auth flow redesign
169
+ ## Behavior Preservation
170
+ - All existing login success tests must pass unchanged
171
+ - Auth token flow for valid credentials must not change
131
172
  ```
132
173
 
133
- ## Templates
174
+ ## References
134
175
 
135
176
  - Spec template: `${SKILL_DIR}/assets/spec-template.md`
136
177
  - Plan template: `${SKILL_DIR}/assets/plan-template.md`
178
+ - Clarification guide: `${SKILL_DIR}/references/clarify-guide.md`
179
+ - Verification checklist: `${SKILL_DIR}/references/verification-checklist.md`
137
180
 
138
181
  ## Output
139
182
 
140
- | Mode | Directory | Files |
141
- |---|---|---|
142
- | Feature | `.prizmkit/specs/###-feature-name/` | `spec.md` + `plan.md` |
143
- | Refactor | `.prizmkit/refactor/<refactor-slug>/` | `plan.md` |
144
- | Bugfix | `.prizmkit/bugfix/<BUG_ID>/` | `plan.md` |
183
+ | Directory | Files |
184
+ |---|---|
185
+ | `artifact_dir` (provided or auto-generated `.prizmkit/specs/###-slug/`) | `spec.md` + `plan.md` |