prizmkit 1.1.155 → 1.1.159

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 (35) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/dev-pipeline/prizmkit_runtime/reset.py +1 -1
  3. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +20 -11
  4. package/bundled/dev-pipeline/scripts/update-feature-status.py +7 -0
  5. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +115 -4
  6. package/bundled/dev-pipeline/tests/test_reset_modes.py +137 -0
  7. package/bundled/dev-pipeline/tests/test_unified_cli.py +2 -1
  8. package/bundled/skills/_metadata.json +1 -1
  9. package/bundled/skills/prizmkit/SKILL.md +1 -13
  10. package/bundled/skills/prizmkit-code-review/SKILL.md +29 -10
  11. package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +5 -4
  12. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +15 -0
  13. package/bundled/skills/prizmkit-code-review/scripts/render_review_report.py +61 -0
  14. package/bundled/skills/prizmkit-committer/SKILL.md +22 -17
  15. package/bundled/skills/prizmkit-init/SKILL.md +21 -25
  16. package/bundled/skills/prizmkit-init/references/config-schema.md +11 -7
  17. package/bundled/skills/prizmkit-init/references/rules/layer-detection.md +3 -3
  18. package/bundled/skills/prizmkit-plan/SKILL.md +5 -4
  19. package/bundled/skills/prizmkit-plan/assets/plan-template.md +4 -1
  20. package/bundled/skills/prizmkit-plan/references/verification-checklist.md +3 -2
  21. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +64 -10
  22. package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +191 -56
  23. package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +18 -18
  24. package/bundled/skills/prizmkit-prizm-docs/references/op-rebuild.md +14 -8
  25. package/bundled/skills/prizmkit-prizm-docs/references/op-status.md +12 -5
  26. package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +23 -12
  27. package/bundled/skills/prizmkit-prizm-docs/references/op-validate.md +13 -9
  28. package/bundled/skills/prizmkit-retrospective/SKILL.md +72 -61
  29. package/bundled/skills/prizmkit-retrospective/references/knowledge-injection-steps.md +79 -37
  30. package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +109 -46
  31. package/bundled/skills/prizmkit-workflow/SKILL.md +35 -3
  32. package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +24 -5
  33. package/bundled/templates/hooks/validate-prizm-docs.py +124 -12
  34. package/package.json +1 -1
  35. package/bundled/skills/prizmkit/references/workflow-state-protocol.md +0 -178
@@ -19,6 +19,8 @@ Remote publication is outside this Skill.
19
19
  | `artifact_dir` | Yes | Exact caller-supplied artifact root for this commit stage. |
20
20
  | `operation` | Yes | `interactive-commit` or `prepare-runtime-commit`. |
21
21
  | `evidence_paths` | Yes | Exact caller-supplied project-relative artifacts that establish commit readiness. |
22
+ | `intended_paths` | Interactive only: Yes | Exact unique project-relative final paths approved by the caller for preview and staging. It is never inferred from `git add .` or workspace breadth. |
23
+ | `support_validation_evidence` | Interactive conditional | Required when `intended_paths` contains an explicit support path. Supply one exact record per support path with `path`, named semantic `contract`, completed `validation`, `result=PASS`, and an exact `evidence_path` also present in `evidence_paths`. |
22
24
  | `excluded_paths` | No | Exact caller-owned metadata paths that must remain outside the commit and are also excluded by the selected operation's consumer contract. It is not an allowlist for unrelated project changes. |
23
25
  | `request_path` | Preparation only | Must equal `{artifact_dir}/runtime-commit-request.json`. |
24
26
 
@@ -32,12 +34,14 @@ In preparation mode it must not stage, unstage, commit, amend, reset, merge, or
32
34
 
33
35
  ## Step 1: Validate Supplied Evidence and Final Change
34
36
 
35
- 1. Resolve `artifact_dir` and every `evidence_paths` entry exactly as supplied by the caller.
37
+ 1. Resolve `artifact_dir` and every `evidence_paths` entry exactly as supplied by the caller. For interactive operation, also resolve every exact `intended_paths` entry without broadening it.
36
38
  2. Reject missing, unreadable, stale, contradictory, blocked, or explicitly non-passing evidence.
37
39
  3. Inspect staged, unstaged, untracked, deleted, and renamed files with bounded Git status/diff commands.
38
- 4. Confirm every changed path belongs to the supplied change, a concrete dependency, its tests, durable documentation, or caller-required artifacts.
39
- 5. Reject unresolved merge state and sensitive files such as real environment files, credentials, secrets, private keys, certificates, or local settings.
40
- 6. Confirm no requested task output remains to be generated after this stage.
40
+ 4. Confirm every intended path belongs to the supplied change, a concrete dependency, its tests, durable documentation, or an explicitly caller-owned support artifact. Unknown or unrelated Git-visible changes block rather than entering the manifest.
41
+ 5. For every explicit support path, require one unique `support_validation_evidence` record whose `path` equals that manifest entry, whose `evidence_path` is supplied and readable, and whose named contract, completed validation, and `result=PASS` agree with that evidence. Missing, generic, self-asserted, or non-passing support evidence blocks admission.
42
+ 6. Reject unresolved merge state and sensitive files such as real environment files, credentials, secrets, private keys, certificates, or local settings.
43
+ 7. Confirm no requested task output remains to be generated after this stage.
44
+ 8. Never force-add an ignored file or modify Git/ignore policy. An intended durable documentation path that is not stageable under the project's existing policy blocks with the exact path and policy reason.
41
45
 
42
46
  The caller decides which evidence is required and how the returned commit-stage result is used. This Skill validates the supplied evidence but does not infer a larger stage sequence.
43
47
 
@@ -49,32 +53,33 @@ Generate one concise Conventional Commit message:
49
53
  <type>(<scope>): <description>
50
54
  ```
51
55
 
52
- Classify every observed change before constructing the request. All paths under `.prizmkit/` are framework-internal and remain outside automated task commits.
56
+ Classify every observed change before validating either operation.
53
57
 
54
58
  - **task-owned**: justified source, tests, product/project documentation, configuration, and dependency changes outside recognized support namespaces;
55
- - **PrizmKit-internal**: every path under `.prizmkit/`, including config, plans, Prizm docs, lifecycle Artifacts, installed Runtime files, and state;
56
- - **platform support**: `AGENTS.md`, `skills-lock.json`, installed platform directories, and local platform settings;
59
+ - **durable Prizm documentation**: exact stageable `.prizmkit/prizm-docs/**` paths listed by one supplied `retrospective-result.json` whose `outcome=RETRO_COMPLETE`, `result=DOCS_UPDATED`, non-empty `validation`, and `documentation_paths` exactly authorize those paths;
60
+ - **explicit interactive support**: `AGENTS.md`, `skills-lock.json`, or another support path named by the exact spec/plan, covered one-to-one by passing `support_validation_evidence`, labeled separately in the interactive preview, and included in the user's confirmation;
61
+ - **PrizmKit transient/internal**: `.prizmkit/specs/**`, `.prizmkit/state/**`, `.prizmkit/dev-pipeline/**`, config, plans/status, installed Runtime files, checkpoints, and other framework execution data;
62
+ - **generated platform support**: installed platform directories and local platform settings not explicitly owned by the interactive requirement;
57
63
  - **project transient**: data the project already excludes through Git ignore rules;
58
64
  - **unknown Git-visible**: any remaining path whose task ownership cannot be proven.
59
65
 
60
- Build a unique set of exact project-relative **task-owned** changed paths. Include intended tracked modifications, deletions, renames, new source/tests, and justified project documentation outside support namespaces. Exclude:
66
+ All paths under `.prizmkit/` are framework-internal and remain outside automated task commits.
61
67
 
62
- - `.git/`;
63
- - the complete `.prizmkit/` tree;
64
- - `AGENTS.md`, `skills-lock.json`, installed platform directories, and local platform settings;
65
- - sensitive or unrelated files.
68
+ For `operation=interactive-commit`, validate the caller-supplied `intended_paths` as the complete approved manifest. It may contain task-owned paths, evidence-backed durable Prizm documentation, and explicitly owned support paths. Every entry must be exact, unique, project-relative, currently changed, stageable without force, and covered by the applicable evidence above. An instruction support file contract must validate readable structure, referenced project paths, consistency with the exact requirement and applicable project conventions, and secret absence. A lockfile support contract must validate parse/schema integrity and owning-installer or deterministic-regeneration parity. Another support class requires the exact project-native semantic validator named by the spec/plan; if no applicable validator exists, support admission blocks. The following remain prohibited: `.git/**`, every PrizmKit transient/internal path, installed platform payloads, local settings, secrets, temporary files, and unrelated or unknown changes.
66
69
 
67
- Unknown Git-visible paths block the operation; do not silently classify them as transient. Project-specific transient data belongs in the project's Git ignore rules, not caller-provided exclusions. Do not use wildcard pathspecs, `git add .`, or `git add -A` as an intended-path description. In preparation mode, reject an `excluded_paths` entry unless the Python Runtime independently excludes that exact caller-owned metadata class; unrelated or user-authored project changes cannot be hidden from exact-path coverage.
70
+ For `operation=prepare-runtime-commit`, preserve the existing automated consumer boundary: construct a unique exact set of task-owned changed paths outside recognized support namespaces, and exclude the complete `.prizmkit/` tree plus platform support and sensitive/unrelated files. Preparation mode preserves the Python Runtime's exact path-coverage contract and does not admit the interactive durable-documentation or support exceptions.
71
+
72
+ Unknown Git-visible paths block the selected operation; do not silently classify them as transient. Project-specific transient data belongs in the project's Git ignore rules, not caller-provided exclusions. Do not use wildcard pathspecs, `git add .`, or `git add -A`. In preparation mode, reject an `excluded_paths` entry unless the Python Runtime independently excludes that exact caller-owned metadata class; unrelated or user-authored project changes cannot be hidden from exact-path coverage.
68
73
 
69
74
  ## Step 3A: Interactive Commit
70
75
 
71
76
  For `operation=interactive-commit`:
72
77
 
73
- 1. Present intended paths, change summary, sensitive-file warnings, diff statistics, proposed message, and intentionally excluded changes.
78
+ 1. Present the exact `intended_paths`, change summary, sensitive-file warnings, diff statistics, proposed message, intentionally excluded changes, and a separate label for each admitted durable Prizm documentation or explicit support path.
74
79
  2. Ask the current user to confirm that exact local commit.
75
- 3. Only after confirmation, stage tracked changes safely and new files explicitly.
76
- 4. Verify the staged diff exactly matches the confirmed path set.
77
- 5. Create the local commit and verify its hash, committed paths, and remaining workspace changes.
80
+ 3. Only after confirmation, stage with `git add -- <exact paths>` semantics: use exact pathspecs for tracked changes, deletions, and explicitly named new files; never stage workspace breadth.
81
+ 4. Verify the staged diff exactly matches the confirmed manifest and contains no path added by a hook or incidental operation.
82
+ 5. Create the local commit and verify its hash, message, committed paths, and remaining workspace changes against the confirmed manifest.
78
83
  6. Return `COMMITTED`, the commit hash/message, committed paths, and intentional remaining changes.
79
84
 
80
85
  If confirmation is declined, return `COMMIT_DECLINED` without Git mutation.
@@ -27,6 +27,12 @@ Recommended project initialization skill. Scans any brownfield or greenfield pro
27
27
 
28
28
  All paths under `.prizmkit/` are framework-internal and remain outside automated task commits. Initialization must not stage or commit them. Root instruction or platform-support files written during setup also remain support data rather than task-owned source.
29
29
 
30
+ ## Host-Neutral Interaction and Discovery
31
+
32
+ - Ask required questions through the current Host's available user-interaction capability. If no structured interaction capability exists, ask directly in ordinary conversation and wait for the user's answer.
33
+ - Describe required filesystem evidence and bounded discovery results semantically. Do not require a specific tool name, shell, command, or operating system.
34
+ - Platform-specific commands may be shown only as non-normative examples after the Host has established that they are available; an unavailable example never blocks an equivalent Host-native operation.
35
+
30
36
  ## Execution Steps
31
37
 
32
38
  **Phase 1: Platform Detection**
@@ -77,17 +83,7 @@ BROWNFIELD WORKFLOW (existing project):
77
83
  - SUB-MODULES: directories INSIDE a top-level module (e.g. `src/routes/`, `src/models/`)
78
84
  - A sub-module maps to `.prizmkit/prizm-docs/<M>/<S>.prizm`, never to `.prizmkit/prizm-docs/<S>.prizm` — flattening would create ambiguous paths when two modules have identically-named sub-modules
79
85
  - Exclude: `.git/`, `node_modules/`, `vendor/`, `build/`, `dist/`, `__pycache__/`, `target/`, `bin/`, `.agents/`, `.codex/`, `.claude/`, `.codebuddy/`, `.prizmkit/`
80
- - **Scan command** — run this to get a 2-level directory tree (excludes noise directories):
81
- ```bash
82
- find . -maxdepth 2 -type d \
83
- -not -path '*/node_modules/*' -not -path '*/.git/*' \
84
- -not -path '*/dist/*' -not -path '*/build/*' \
85
- -not -path '*/__pycache__/*' -not -path '*/vendor/*' \
86
- -not -path '*/.agents/*' -not -path '*/.codex/*' \
87
- -not -path '*/.claude/*' -not -path '*/.codebuddy/*' \
88
- -not -path '*/.prizmkit/*' -not -path '*/target/*' \
89
- | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
90
- ```
86
+ - **Bounded discovery contract** — use the current Host's available directory-listing or file-search capability to enumerate at most two directory levels, apply the exclusions above before analysis, preserve parent/child relationships, and report the resulting project-relative structure. Do not require a POSIX shell pipeline or any other operating-system-specific command.
91
87
  3. Identify entry points by language convention
92
88
  4. Catalog dependencies (external packages)
93
89
  5. Count source files per directory
@@ -106,7 +102,7 @@ After tech stack detection, determine which development layers exist in the proj
106
102
  - **backend**: Express/FastAPI/Gin/etc. in dependencies, or `routes/`/`controllers/` with server code
107
103
  - **database**: Prisma/TypeORM/SQLAlchemy/etc. in dependencies, or `migrations/`/`prisma/` directory
108
104
  - **mobile**: `pubspec.yaml` (Flutter), `react-native` in package.json, or simultaneous `ios/`+`android/` directories
109
- 3. For mobile signals — if ambiguous (e.g., monorepo with web + ios/android dirs), use `AskUserQuestion` to confirm: "Mobile platform signals detected. Is this project a mobile app?" Options: "Yes, this is a mobile app" / "No, these are for another purpose".
105
+ 3. For mobile signals — if ambiguous (e.g., monorepo with web + ios/android dirs), ask the user directly: "Mobile platform signals detected. Is this project a mobile app?" Offer "Yes, this is a mobile app" and "No, these are for another purpose" as clear choices, using the Host-neutral interaction contract above.
110
106
  4. Assemble `detected_layers` array (e.g., `["frontend", "backend", "database"]`). If no layers detected (library/CLI project), array is empty.
111
107
 
112
108
  **Phase 4.6: Infrastructure Quick Scan**
@@ -120,7 +116,7 @@ Detect database and deployment signals, then ask 1-2 brief questions. This phase
120
116
  - **Database signals**: ORM/database client dependencies in `package.json`, `requirements.txt`, `go.mod`, `Cargo.toml`, `pyproject.toml` (look for: prisma, typeorm, sequelize, mongoose, sqlalchemy, django, gorm, diesel, sqlx, pg, mysql2, etc.); directories named `migrations/`, `db/`, `schema/`, `prisma/`; environment variables `DATABASE_URL`, `DB_HOST`, `DB_NAME`, `MONGO_URI` in `.env*` files
121
117
  - **Deployment signals**: `Dockerfile`, `docker-compose.yml`, `vercel.json`, `fly.toml`, `railway.json`, `netlify.toml`, `cloudflare.json`, `.github/workflows/`, `Procfile`, `app.yaml`, `serverless.yml`, `terraform/`, `pulumi/`
122
118
 
123
- 2. **Brief inquiry** (using `AskUserQuestion`, max 2 questions):
119
+ 2. **Brief inquiry** (ask through the Host-neutral interaction contract, max 2 questions):
124
120
 
125
121
  **Question 1 — Database**:
126
122
  - If database signals detected: pre-fill with detected info
@@ -172,14 +168,14 @@ Detect database and deployment signals, then ask 1-2 brief questions. This phase
172
168
  After Infrastructure Quick Scan completes, check if `detected_layers` is non-empty (from Phase 4.5). If layers were detected, offer a lightweight entry point for rules configuration.
173
169
 
174
170
  1. If `detected_layers` is empty (library/CLI project) → skip this phase entirely, proceed to Phase 5.
175
- 2. If layers detected, use `AskUserQuestion`:
171
+ 2. If layers are detected, ask through the Host-neutral interaction contract:
176
172
 
177
173
  **Question**: "Detected **{list detected layers}** code. Would you like to set up custom development rules for AI to follow? This helps AI generate code that matches your conventions."
178
174
  - **Configure later (Recommended)** — Record layers and configure rules later
179
175
  - **Skip entirely** — no custom rules, AI uses general best practices
180
176
 
181
- 3. If user picked "Skip entirely" → clear `detected_layers` to empty array, proceed to Phase 5.
182
- 4. If user picked "Configure later" → keep `detected_layers`, proceed to Phase 5. The layers will be written to config.json in Phase 6.
177
+ 3. If the user picked "Skip entirely" → preserve `detected_layers` as observed project facts, set `enabled_rule_profiles` to an empty array, and proceed to Phase 5.
178
+ 4. If the user picked "Configure later" → preserve `detected_layers`, keep `enabled_rule_profiles` unchanged when already configured or initialize it to an empty array, and proceed to Phase 5. Detection never implies rule adoption.
183
179
 
184
180
  **Phase 5: Prizm Documentation Generation**
185
181
  Invoke prizmkit-prizm-docs (Init operation), passing the two-tier module structure from Phase 4:
@@ -192,18 +188,18 @@ Invoke prizmkit-prizm-docs (Init operation), passing the two-tier module structu
192
188
 
193
189
  **Phase 6: Workspace Initialization**
194
190
  6a. Create `.prizmkit/` directory structure (if missing):
195
- - `.prizmkit/config.json` (adoption_mode, speckit_hooks_enabled, platform)
191
+ - `.prizmkit/config.json` (adoption_mode, platform installation metadata, detected_layers, enabled_rule_profiles)
196
192
  - `.prizmkit/specs/` (empty)
197
193
  - `.prizmkit/plans/` (empty — needed by Phase 7 and future pipeline tasks)
198
194
 
199
195
  6b. Write detected tech stack to `.prizmkit/config.json`:
200
196
  → Read `${SKILL_DIR}/references/config-schema.md` for merge strategy, field definitions, and examples.
201
197
 
202
- 6c. Write `detected_layers` to `.prizmkit/config.json` (alongside `tech_stack`):
203
- - Field: `"detected_layers": ["frontend", "backend"]` the layers from Phase 4.5
204
- - If user chose "Skip entirely" in Phase 4.7, write empty array `[]`
205
- - For greenfield projects (Phase 4.5 skipped): write `[]` no code layers to configure rules for yet; user can configure rules later when code exists
206
- - This field indicates which development layers exist in the project and can be used to determine available rule configuration options.
198
+ 6c. Write observed layers and separate rule adoption to `.prizmkit/config.json` (alongside `tech_stack`):
199
+ - `"detected_layers": ["frontend", "backend"]` records only the observed layers from Phase 4.5 and is never cleared because the user declines rule configuration.
200
+ - `"enabled_rule_profiles": []` records rule adoption separately. Preserve valid existing entries; initialize an empty array when no profiles are enabled.
201
+ - For greenfield projects (Phase 4.5 skipped), write both fields as empty arrays until code exists or the user explicitly enables a rule profile.
202
+ - Future re-detection updates observed layers without silently enabling or disabling rule profiles.
207
203
 
208
204
  **Phase 7: Project Brief Generation**
209
205
 
@@ -301,7 +297,7 @@ Tech stack detected:
301
297
 
302
298
  Layer Detection:
303
299
  Detected layers: frontend, backend, database (from dependency + directory signals)
304
- Stored for config.json
300
+ Observed layers stored in config.json independently from rule-profile adoption
305
301
 
306
302
  Infrastructure Quick Scan:
307
303
  Database: PostgreSQL (Prisma) — detected from dependencies
@@ -309,7 +305,7 @@ Infrastructure Quick Scan:
309
305
  → Written to the detected main platform instruction file `### Infrastructure` (not `.private.md`)
310
306
 
311
307
  Rules Quick Entry:
312
- Matched layers: frontend (React), backend (Express.js), database (Prisma) → keeping default rules
308
+ Matched layers: frontend (React), backend (Express.js), database (Prisma) → no rule profiles enabled yet
313
309
 
314
310
  Modules discovered:
315
311
  src/routes/ → .prizmkit/prizm-docs/routes.prizm (12 files)
@@ -321,7 +317,7 @@ Project brief: inferred from codebase → confirmed by user
321
317
  → .prizmkit/plans/project-brief.md
322
318
 
323
319
  Generated: root.prizm + 4 L1 docs
324
- Saved: .prizmkit/config.json (tech_stack + detected_layers recorded)
320
+ Saved: .prizmkit/config.json (tech_stack + detected_layers + enabled_rule_profiles recorded)
325
321
 
326
322
  Next: Use /prizmkit-plan to start your first feature
327
323
  ```
@@ -7,11 +7,12 @@ Handles re-init without losing user edits:
7
7
  - Read existing `config.json` if present
8
8
  - If `tech_stack` field exists AND `_auto_detected` is `false` or absent:
9
9
  → **SKIP** — user has manually configured tech stack, preserve their settings
10
- - Always update `detected_layers` with new layer detection results on every init run — layer detection is based on code that exists, not user preference. This ensures greenfield projects that later gain code get their `detected_layers` populated correctly. Note: the final value written is still determined by Phase 6c (e.g., if user chose "Skip entirely" in Phase 4.7, Phase 6c writes `[]` regardless of detection results).
10
+ - Always update `detected_layers` with fresh observed layer-detection results on every init run — detection is based on code that exists, never on whether the user enables custom rules. A rule-configuration choice must not erase detected project facts.
11
+ - Preserve valid `enabled_rule_profiles` entries independently from detection. Initialize `[]` only when the field is absent or the user explicitly disables every rule profile.
11
12
  - If `tech_stack` field exists AND `_auto_detected` is `true`:
12
- → **MERGE** — overwrite auto-detected values with new detection results, but preserve any keys the user added manually (keys not in the new detection result). Overwrite `detected_layers` with new layer detection results.
13
+ → **MERGE** — overwrite auto-detected values with new detection results, but preserve any keys the user added manually (keys not in the new detection result). Overwrite `detected_layers` with new observed results and preserve `enabled_rule_profiles` independently.
13
14
  - If `tech_stack` field does NOT exist:
14
- → **WRITE** full detected tech stack with `"_auto_detected": true`, and write `detected_layers` from layer detection
15
+ → **WRITE** full detected tech stack with `"_auto_detected": true`, write `detected_layers` from observed layer detection, and initialize `enabled_rule_profiles` to `[]` unless the user explicitly enabled profiles
15
16
  - Only include fields that were actually detected (no empty/null values)
16
17
 
17
18
  ## Field Definitions
@@ -19,12 +20,13 @@ Handles re-init without losing user edits:
19
20
  | Field | Type | Description |
20
21
  |-------|------|-------------|
21
22
  | `adoption_mode` | string | `"passive"` \| `"advisory"` \| `"active"` |
22
- | `platform` | string | `"codebuddy"` \| `"claude"` \| `"codex"` \| `"all"` |
23
+ | `platform` | string | Installed payload metadata: `"codebuddy"` \| `"claude"` \| `"codex"` \| `"pi"` \| `"all"`. It records installation, not a canonical behavior allowlist. |
23
24
  | `tech_stack` | object | Detected or user-provided tech stack |
24
25
  | `tech_stack._auto_detected` | boolean | `true` if auto-detected, `false` if user-provided |
25
- | `detected_layers` | string[] | Development layers detected in the project. Written by prizmkit-init Phase 4.5. Used to determine available rule configuration options. Values: `frontend` / `backend` / `database` / `mobile`. Empty array when no layers detected or user skipped rules. Always updated on every init run based on fresh code detection not gated by `_auto_detected` (see Merge Strategy above). |
26
+ | `detected_layers` | string[] | Development layers observed in the project. Written by prizmkit-init Phase 4.5. Values: `frontend` / `backend` / `database` / `mobile`. Empty only when no layers are observed. Always refreshed from code and never cleared by rule-adoption choices. |
27
+ | `enabled_rule_profiles` | string[] | Rule profiles the user explicitly enabled. This is independent from `detected_layers`; an empty array means no custom profile is enabled, not that the project has no detected layers. |
26
28
 
27
- Legacy manifests may still contain `both` for read-only migration compatibility. New config writes must use `codebuddy`, `claude`, `codex`, or `all`.
29
+ Legacy manifests may still contain `both` for read-only migration compatibility. New config writes must use `codebuddy`, `claude`, `codex`, `pi`, or `all`.
28
30
 
29
31
  ## Examples
30
32
 
@@ -34,6 +36,7 @@ Fullstack project:
34
36
  "adoption_mode": "passive",
35
37
  "platform": "claude",
36
38
  "detected_layers": ["frontend", "backend", "database"],
39
+ "enabled_rule_profiles": [],
37
40
  "tech_stack": {
38
41
  "language": "TypeScript",
39
42
  "runtime": "Node.js 20",
@@ -65,6 +68,7 @@ Pure Python backend:
65
68
  "project_type": "backend",
66
69
  "_auto_detected": true
67
70
  },
68
- "detected_layers": ["backend", "database"]
71
+ "detected_layers": ["backend", "database"],
72
+ "enabled_rule_profiles": []
69
73
  }
70
74
  ```
@@ -28,7 +28,7 @@
28
28
 
29
29
  ## Mobile Confirmation
30
30
 
31
- When mobile signals are detected but ambiguous (e.g., a monorepo with web + mobile), use `AskUserQuestion`:
31
+ When mobile signals are detected but ambiguous (e.g., a monorepo with web + mobile), ask the user through the current Host's available interaction capability; use ordinary conversation when no structured interaction is available:
32
32
 
33
33
  > "Mobile platform signals detected (ios/ + android/ directories). Is this project
34
34
  > a mobile app, or are these directories for another purpose?"
@@ -37,5 +37,5 @@ When mobile signals are detected but ambiguous (e.g., a monorepo with web + mobi
37
37
  ## Output
38
38
 
39
39
  After detection (signals + your own judgment), assemble `detected_layers` array (e.g., `["frontend", "backend", "database"]`).
40
- Store in memory for Phase 6 config.json writing.
41
- If no layers detected (library/CLI project), array is empty.
40
+ Store the observed values in memory for Phase 6 config.json writing. Rule-profile adoption is recorded separately and never changes this detection result.
41
+ If no layers are detected (library/CLI project), the array is empty.
@@ -83,10 +83,11 @@ Precondition: `spec.md` exists with no unresolved blocker.
83
83
 
84
84
  1. Choose an MVP-first, incremental, or safe parallel task strategy.
85
85
  2. Append `## Tasks` to `plan.md` using `${SKILL_DIR}/assets/plan-template.md`.
86
- 3. Include setup, foundation, core, polish, and checkpoint tasks only when applicable.
87
- 4. Mark `[P]` only for tasks that can safely execute independently.
88
- 5. Include appropriate implementation-local and regression verification tasks without executing them during planning.
89
- 6. Run `${SKILL_DIR}/references/verification-checklist.md` and repair plan defects.
86
+ 3. Include setup, foundation, core, and polish phases only when applicable; do not manufacture empty phases for a small plan.
87
+ 4. Every formal plan must contain at least one concrete risk with mitigation and at least one verification checkpoint. A small plan may use one final checkpoint instead of artificial phase checkpoints.
88
+ 5. Mark `[P]` only for tasks that can safely execute independently.
89
+ 6. Include appropriate implementation-local and regression verification tasks without executing them during planning.
90
+ 7. Run `${SKILL_DIR}/references/verification-checklist.md` and repair plan defects.
90
91
 
91
92
  ## Phase 4: Plan/Spec Review Loop
92
93
 
@@ -61,6 +61,7 @@
61
61
  - E2E: [Approach]
62
62
 
63
63
  ## Risk Assessment
64
+ <!-- Every formal plan keeps at least one concrete risk and mitigation. Use a truthful low-impact risk for small changes rather than filler. -->
64
65
  | Risk | Impact | Mitigation |
65
66
  |------|--------|------------|
66
67
  | [Risk] | [H/M/L] | [Plan] |
@@ -107,12 +108,14 @@
107
108
 
108
109
  ### Phase: Polish
109
110
  - [ ] [T-900] Final verification
110
- - [ ] [T-901] Documentation update
111
+ - [ ] [T-901] Update required project/user-facing documentation <!-- Conditional; Prizm memory synchronization is Retrospective-owned, not an implementation task. -->
111
112
 
112
113
  ### Checkpoints
114
+ <!-- Every formal plan has at least one verification checkpoint. Keep only checkpoints for phases that actually exist; a small plan may use one final checkpoint. -->
113
115
  - [ ] [CP-1] After Setup: project builds and tests pass
114
116
  - [ ] [CP-2] After Foundation: base changes verified
115
117
  - [ ] [CP-3] After each Core group: acceptance criteria pass
118
+ - [ ] [CP-FINAL] Final: planned acceptance and regression verification passes
116
119
 
117
120
  ## Independent Plan Review
118
121
  <!-- Append this terminal audit record after the Main-Agent review and the optional independent-review attempt. -->
@@ -8,7 +8,8 @@ Run this checklist after generating the Tasks section in plan.md. Fix any issues
8
8
 
9
9
  - [ ] Every goal (G-N) in spec.md has at least one task in plan.md
10
10
  - [ ] Every task has a target file path (`— file: path/to/file`)
11
- - [ ] Risk assessment contains at least one risk with a mitigation plan
11
+ - [ ] Risk assessment contains at least one concrete risk with a mitigation plan
12
+ - [ ] The plan contains at least one verification checkpoint; a small plan may use one final checkpoint
12
13
  - [ ] If spec includes `## Behavior Preservation` → at least one verification task exists
13
14
  - [ ] If spec includes `## Root Cause` → at least one reproduction test task exists
14
15
 
@@ -36,7 +37,7 @@ Run this checklist after generating the Tasks section in plan.md. Fix any issues
36
37
 
37
38
  - [ ] No task references the output of a later task without an explicit dependency note
38
39
  - [ ] Foundation tasks precede Core tasks that depend on them
39
- - [ ] Checkpoint tasks exist between phases
40
+ - [ ] Checkpoints exist between dependent phases that are present; plans without multiple phases use one final checkpoint
40
41
 
41
42
  ## Rules Alignment
42
43
 
@@ -34,6 +34,54 @@ Do not route ordinary development-loop "update docs" or "sync docs" here. In nor
34
34
 
35
35
  Key principle: `/prizmkit-prizm-docs` defines and repairs the documentation system. `/prizmkit-retrospective` keeps docs in sync during ordinary development.
36
36
 
37
+ ## Governing Content Gates
38
+
39
+ These gates apply uniformly wherever this Skill generates, migrates, repairs, or rebuilds documentation. Operation references may add sequencing but must not weaken them.
40
+
41
+ ### Value Gate
42
+
43
+ Before retaining any candidate fact, ask exactly:
44
+
45
+ > Could a future AI that lacks this fact make an incorrect modification?
46
+
47
+ Retain the fact only when the answer is yes and the fact is current, durable, non-obvious, and stated at the lowest owning level. High-value knowledge includes:
48
+
49
+ - non-obvious public interfaces and wire contracts
50
+ - cross-module constraints and non-obvious dependencies
51
+ - traps and side effects that can cause an incorrect change
52
+ - durable decisions with only the rationale necessary to preserve the choice
53
+ - rejected alternatives that future sessions are likely to propose again, with the reason for rejection
54
+ - security, data-integrity, concurrency, transaction, and compatibility rules
55
+
56
+ Reject source-derivable structure or signatures, task/change history, test inventories, temporary conclusions, stale statements, duplicate meanings, long procedures, low-value file lists, and facts already owned by a child detail document. File names, counts, and summaries remain only when needed for navigation or ownership.
57
+
58
+ Critical-knowledge rule: a still-valid public or wire contract, cross-module constraint, non-obvious dependency, critical trap, durable decision, side effect, or safety/integrity rule must survive cleanup and capacity remediation. Never delete it merely to satisfy a byte check.
59
+
60
+ ### Cleanup Gate
61
+
62
+ Before Update or Rebuild writes an existing target:
63
+
64
+ 1. Read the target and its resolving parent/child pointers first.
65
+ 2. Build a protected set of still-valid critical knowledge under the Value Gate.
66
+ 3. Match facts by semantic meaning, not wording; update an equivalent entry in place and merge synonymous entries.
67
+ 4. Remove stale, duplicate, parent-copied, source-derivable, and otherwise low-value material.
68
+ 5. Add only genuinely new durable knowledge that has no equivalent entry.
69
+ 6. Keep L0 and L1 as concise structural summaries and pointers; do not copy L2 interfaces, data flow, traps, decisions, or full rules into a parent.
70
+
71
+ Append-only synchronization is prohibited. If protected knowledge cannot fit after safe cleanup, movement to the owning child, or an unambiguous semantic split, report the blocker instead of deleting knowledge.
72
+
73
+ ### Capacity and Sharding Invariants
74
+
75
+ Use the canonical capacity classifier: exact raw UTF-8 bytes; L0 `root.prizm` limit 4096B; direct-child L1 limit 4096B; nested L2 limit 5120B. Bands are normal below 80%, warning from 80% to below 90%, strong warning from 90% through 100%, and error above 100%.
76
+
77
+ - Natural content below 80% stays unchanged; do not pad it.
78
+ - Warning-range content remains valid and is reported without failure.
79
+ - A generated or rewritten target at 90% or above requires cleanup, movement, or a safe split. After automatic remediation, measure every affected parent and child: each must be within its hard limit and the operation targets 3277–3686B for L0/L1 or 4096–4607B for L2 (80% to below 90%), not one byte below the hard limit. A naturally concise result below 80% stays unpadded.
80
+ - Any target still above its hard limit blocks completion. A warning must never downgrade another format or hard-limit error.
81
+ - When L0 navigation cannot fit, use `MODULE_GROUPS`; never raise limits for project size.
82
+ - When one L2 cannot safely retain a flat module's multiple stable behavior concerns, use the semantic L2 policy in the format specification. Preserve mirrored L2 paths for real source submodules.
83
+ - Do not add a memory state machine, scoring system, project-size override, task-named or numbered shard, or a fourth documentation level.
84
+
37
85
  ### When to Use
38
86
  - First-time project documentation setup
39
87
  - Checking whether docs are fresh or valid
@@ -52,7 +100,7 @@ Bootstrap `.prizmkit/prizm-docs/` for the current project.
52
100
 
53
101
  Precondition: no `.prizmkit/prizm-docs/` directory exists, or user confirms overwrite.
54
102
 
55
- Read `${SKILL_DIR}/references/op-init.md` for detailed steps.
103
+ Read `${SKILL_DIR}/references/op-init.md` for detailed steps. Apply the Value Gate before retaining every generated fact.
56
104
 
57
105
  ## Operation: Update
58
106
 
@@ -70,7 +118,7 @@ Use Update only when docs drifted outside the normal development loop, such as:
70
118
 
71
119
  During normal feature/bugfix/refactor work, do not use Update; use `/prizmkit-retrospective` to avoid duplicate writers and conflicting edits.
72
120
 
73
- Read `${SKILL_DIR}/references/op-update.md` for detailed steps.
121
+ Read `${SKILL_DIR}/references/op-update.md` for detailed steps. Apply both the Value Gate and target-first Cleanup Gate to every written target.
74
122
 
75
123
  ## Operation: Status
76
124
 
@@ -86,7 +134,7 @@ Regenerate docs for a specific module from scratch.
86
134
 
87
135
  Precondition: `.prizmkit/prizm-docs/` exists and module path is valid.
88
136
 
89
- Read `${SKILL_DIR}/references/op-rebuild.md` for detailed steps.
137
+ Read `${SKILL_DIR}/references/op-rebuild.md` for detailed steps. Rebuild from current source analysis without delete-first loss: preserve the target-first inventory, then apply both governing gates.
90
138
 
91
139
  ## Operation: Validate
92
140
 
@@ -104,12 +152,14 @@ Precondition: existing `docs/`, `docs/AI_CONTEXT/`, README, or architecture docs
104
152
 
105
153
  Steps:
106
154
  1. Discover existing docs: `docs/`, `docs/AI_CONTEXT/`, `README.md`, `ARCHITECTURE.md`, and structured documentation files.
107
- 2. Extract project metadata, module descriptions, architecture patterns, rules, decisions, and dependencies.
108
- 3. Map project-wide info to L0, module structure to L1, and behavioral details to L2.
109
- 4. Convert prose to KEY: value format and strip markdown tables, diagrams, and decorative formatting.
110
- 5. Generate `.prizmkit/prizm-docs/` using init structure seeded with extracted information.
111
- 6. Validate migrated docs against format rules and size limits.
112
- 7. Report files processed, generated `.prizm` files, and manual review items.
155
+ 2. Treat every extracted statement as a candidate, verify it against current source, and apply the Value Gate. Do not migrate source-derivable structure, task/history material, test inventories, temporary conclusions, stale statements, duplicate meanings, long procedures, or low-value file lists.
156
+ 3. Map project-wide summaries and pointers to L0, module structure and pointers to L1, and retained behavioral knowledge to L2. When a child L2 owns complete knowledge, keep only a concise parent summary and resolving pointer.
157
+ 4. Preserve source-mirrored L2 paths for real submodules. For a flat module that needs multiple stable behavior concerns to retain required knowledge within 5120B, apply the deterministic semantic-detail identity, ownership, `DETAILS` pointer, and ambiguity-blocking contract in the format specification.
158
+ 5. Convert retained content to KEY: value format and strip markdown tables, diagrams, decorative formatting, and procedural prose. Merge semantically equivalent source statements before writing.
159
+ 6. Generate `.prizmkit/prizm-docs/` using the Init structure seeded only with retained content; use `MODULE_GROUPS` when the L0 map cannot fit within 4096B.
160
+ 7. Run the canonical capacity classifier. Warning-only results remain successful; remediate strong-warning/error generated targets toward 3277–3686B for L0/L1 or 4096–4607B for L2 without deleting protected knowledge. An unresolved hard-limit, ambiguous or unstable concern identity, ownership problem, or slug collision is blocking; never resolve it with a task-named or numbered shard.
161
+ 8. Validate format, required semantic L2 fields, source-file ownership, pointer resolution, hierarchy, capacity, and critical-knowledge preservation.
162
+ 9. Report files processed, generated `.prizm` files, omitted low-value categories, capacity results, and manual decisions required.
113
163
 
114
164
  ## Recovery Backup Contract
115
165
 
@@ -125,13 +175,17 @@ If that path exists, use the lowest available suffix `.001`, `.002`, and so on,
125
175
 
126
176
  - `root.prizm` corrupted or invalid: create the byte-for-byte recovery backup above, then rebuild affected docs from source.
127
177
  - Broken pointers: create the missing `.prizm` file if the source module exists; remove the pointer if the source module was deleted.
128
- - Size limit exceeded: consolidate L0, move L1 implementation detail to L2, trim L2 derived detail.
178
+ - Capacity warning or strong warning: report the exact classifier fields and clean/organize only when required by the governing capacity policy; automatic remediation targets 80% to below 90%.
179
+ - Size limit exceeded: fail validation until Value/Cleanup filtering, deduplication, movement to the owning child, or an unambiguous semantic split brings the target within its hard limit; never delete protected knowledge or raise the limit.
129
180
  - No git history: fall back to filesystem timestamps for freshness checks and warn that accuracy is reduced.
130
181
 
131
182
  ## Key Protocols
132
183
 
133
184
  For detailed protocol specifications, read `assets/prizm-docs-format.md`:
134
185
 
186
+ - Value and Cleanup Gates: Sections 1 and 7
187
+ - Semantic L2 identity and ownership: Sections 3.2, 3.3, and 5
188
+ - Capacity classification and remediation: Sections 2.1 and 7
135
189
  - Progressive Loading: Section 6.1
136
190
  - Update/repair protocol: Section 7
137
191
  - RULES hierarchy: Section 3.1