prizmkit 1.1.154 → 1.1.156

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 (164) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/codex/skill-adapter.js +1 -1
  3. package/bundled/adapters/pi/skill-adapter.js +2 -1
  4. package/bundled/dev-pipeline/.env.example +2 -6
  5. package/bundled/dev-pipeline/README.md +21 -27
  6. package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +341 -15
  7. package/bundled/dev-pipeline/prizmkit_runtime/cli.py +0 -3
  8. package/bundled/dev-pipeline/prizmkit_runtime/daemon.py +1 -15
  9. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +48 -14
  10. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +50 -2
  11. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +0 -9
  12. package/bundled/dev-pipeline/prizmkit_runtime/runner_prompts.py +3 -3
  13. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +120 -22
  14. package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +482 -0
  15. package/bundled/dev-pipeline/prizmkit_runtime/test_result.py +64 -11
  16. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +145 -367
  17. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +91 -62
  18. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +105 -69
  19. package/bundled/dev-pipeline/scripts/prompt_framework.py +36 -41
  20. package/bundled/dev-pipeline/scripts/update-bug-status.py +1 -4
  21. package/bundled/dev-pipeline/scripts/update-checkpoint.py +61 -13
  22. package/bundled/dev-pipeline/scripts/update-feature-status.py +1 -4
  23. package/bundled/dev-pipeline/scripts/update-refactor-status.py +1 -4
  24. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +22 -27
  25. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +71 -104
  26. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +59 -111
  27. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +37 -72
  28. package/bundled/dev-pipeline/templates/sections/artifact-manifest.md +39 -0
  29. package/bundled/dev-pipeline/templates/sections/bugfix-critical-paths.md +3 -1
  30. package/bundled/dev-pipeline/templates/sections/bugfix-phase-commit-report.md +8 -25
  31. package/bundled/dev-pipeline/templates/sections/bugfix-phase-diagnose-plan.md +3 -3
  32. package/bundled/dev-pipeline/templates/sections/bugfix-phase-implement.md +2 -2
  33. package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +3 -3
  34. package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +2 -2
  35. package/bundled/dev-pipeline/templates/sections/bugfix-reminders.md +4 -4
  36. package/bundled/dev-pipeline/templates/sections/bugfix-session-context.md +0 -1
  37. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +7 -4
  38. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +14 -27
  39. package/bundled/dev-pipeline/templates/sections/feature-completion-summary.md +20 -0
  40. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +8 -71
  41. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +7 -7
  42. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +3 -3
  43. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +4 -4
  44. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +5 -17
  45. package/bundled/dev-pipeline/templates/sections/refactor-critical-paths.md +3 -1
  46. package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +10 -23
  47. package/bundled/dev-pipeline/templates/sections/refactor-phase-implement.md +2 -2
  48. package/bundled/dev-pipeline/templates/sections/refactor-phase-plan.md +2 -2
  49. package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +3 -3
  50. package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +2 -2
  51. package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +7 -7
  52. package/bundled/dev-pipeline/templates/sections/refactor-session-context.md +0 -1
  53. package/bundled/dev-pipeline/templates/sections/retrospective.md +12 -0
  54. package/bundled/dev-pipeline/templates/sections/runtime-commit-handoff.md +35 -0
  55. package/bundled/dev-pipeline/templates/session-status-schema.json +45 -62
  56. package/bundled/dev-pipeline/tests/test_checkpoint_state.py +469 -18
  57. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +262 -175
  58. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +62 -23
  59. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +76 -28
  60. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +168 -18
  61. package/bundled/dev-pipeline/tests/test_recovery_workflow.py +111 -0
  62. package/bundled/dev-pipeline/tests/test_reset_preserve.py +0 -2
  63. package/bundled/dev-pipeline/tests/test_runtime_commit.py +608 -0
  64. package/bundled/dev-pipeline/tests/test_unified_cli.py +167 -25
  65. package/bundled/skills/_metadata.json +9 -9
  66. package/bundled/skills/app-planner/SKILL.md +3 -3
  67. package/bundled/skills/app-planner/references/generated-plan-review.md +2 -1
  68. package/bundled/skills/app-planner/references/rules/backend/derivation-rules.md +56 -64
  69. package/bundled/skills/app-planner/references/rules/backend/fixed-rules.md +85 -240
  70. package/bundled/skills/app-planner/references/rules/backend/question-bank.md +25 -25
  71. package/bundled/skills/app-planner/references/rules/backend/question-manifest.json +16 -7
  72. package/bundled/skills/app-planner/references/rules/backend/template.md +74 -92
  73. package/bundled/skills/app-planner/references/rules/database/derivation-rules.md +93 -93
  74. package/bundled/skills/app-planner/references/rules/database/fixed-rules.md +66 -173
  75. package/bundled/skills/app-planner/references/rules/database/question-bank.md +31 -26
  76. package/bundled/skills/app-planner/references/rules/database/question-manifest.json +13 -4
  77. package/bundled/skills/app-planner/references/rules/database/template.md +76 -98
  78. package/bundled/skills/app-planner/references/rules/frontend/derivation-rules.md +68 -95
  79. package/bundled/skills/app-planner/references/rules/frontend/fixed-rules.md +93 -166
  80. package/bundled/skills/app-planner/references/rules/frontend/question-bank.md +46 -36
  81. package/bundled/skills/app-planner/references/rules/frontend/question-manifest.json +11 -2
  82. package/bundled/skills/app-planner/references/rules/frontend/template.md +79 -257
  83. package/bundled/skills/app-planner/references/rules/mobile/derivation-rules.md +91 -99
  84. package/bundled/skills/app-planner/references/rules/mobile/fixed-rules.md +73 -246
  85. package/bundled/skills/app-planner/references/rules/mobile/question-bank.md +17 -17
  86. package/bundled/skills/app-planner/references/rules/mobile/question-manifest.json +17 -2
  87. package/bundled/skills/app-planner/references/rules/mobile/template.md +73 -85
  88. package/bundled/skills/app-planner/references/rules-configuration.md +133 -65
  89. package/bundled/skills/app-planner/scripts/validate-rules-configuration.py +291 -0
  90. package/bundled/skills/prizmkit/SKILL.md +17 -18
  91. package/bundled/skills/prizmkit/references/workflow-state-protocol.md +22 -18
  92. package/bundled/skills/prizmkit-code-review/SKILL.md +22 -58
  93. package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +6 -6
  94. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +2 -2
  95. package/bundled/skills/prizmkit-committer/SKILL.md +82 -132
  96. package/bundled/skills/prizmkit-deploy/SKILL.md +27 -11
  97. package/bundled/skills/prizmkit-deploy/assets/deploy-document-template.md +89 -0
  98. package/bundled/skills/prizmkit-deploy/references/ci-cd-workflows.md +44 -14
  99. package/bundled/skills/prizmkit-deploy/references/cloud-platform-deploy.md +19 -3
  100. package/bundled/skills/prizmkit-deploy/references/database-setup.md +22 -12
  101. package/bundled/skills/prizmkit-deploy/references/deploy-config-schema.md +3 -1
  102. package/bundled/skills/prizmkit-deploy/references/deploy-history-schema.md +22 -6
  103. package/bundled/skills/prizmkit-deploy/references/deploy-metadata-schema.json +49 -0
  104. package/bundled/skills/prizmkit-deploy/references/live-validation-notes.md +1 -1
  105. package/bundled/skills/prizmkit-deploy/references/pending-input-schema.json +164 -0
  106. package/bundled/skills/prizmkit-deploy/references/ssh-adapter-flow.md +9 -8
  107. package/bundled/skills/prizmkit-deploy/references/ssh-execution-flow.md +6 -6
  108. package/bundled/skills/prizmkit-implement/SKILL.md +30 -66
  109. package/bundled/skills/prizmkit-implement/references/implementation-subagent-procedure.md +4 -4
  110. package/bundled/skills/prizmkit-init/SKILL.md +4 -0
  111. package/bundled/skills/prizmkit-plan/SKILL.md +21 -64
  112. package/bundled/skills/prizmkit-plan/references/artifact-identity.md +38 -0
  113. package/bundled/skills/prizmkit-plan/references/independent-plan-review.md +4 -4
  114. package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +5 -5
  115. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +75 -11
  116. package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +191 -56
  117. package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +18 -18
  118. package/bundled/skills/prizmkit-prizm-docs/references/op-rebuild.md +14 -8
  119. package/bundled/skills/prizmkit-prizm-docs/references/op-status.md +12 -5
  120. package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +23 -12
  121. package/bundled/skills/prizmkit-prizm-docs/references/op-validate.md +13 -9
  122. package/bundled/skills/prizmkit-retrospective/SKILL.md +94 -97
  123. package/bundled/skills/prizmkit-retrospective/references/knowledge-injection-steps.md +79 -37
  124. package/bundled/skills/prizmkit-retrospective/references/retrospective-result-schema.json +138 -0
  125. package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +111 -54
  126. package/bundled/skills/prizmkit-test/SKILL.md +64 -51
  127. package/bundled/skills/prizmkit-test/references/boundary-contract-and-test-double-guidance.md +206 -0
  128. package/bundled/skills/prizmkit-test/references/independent-test-review.md +17 -9
  129. package/bundled/skills/prizmkit-test/references/test-coverage-model.md +45 -21
  130. package/bundled/skills/prizmkit-test/references/test-report-template.md +20 -13
  131. package/bundled/skills/prizmkit-workflow/SKILL.md +35 -37
  132. package/bundled/skills/prizmkit-workflow/references/artifact-identity.md +34 -0
  133. package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +22 -18
  134. package/bundled/skills/recovery-workflow/SKILL.md +2 -1
  135. package/bundled/skills/recovery-workflow/references/detection.md +4 -3
  136. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +15 -5
  137. package/bundled/templates/hooks/validate-prizm-docs.py +124 -12
  138. package/package.json +1 -1
  139. package/src/scaffold.js +33 -22
  140. package/bundled/dev-pipeline/templates/sections/bugfix-artifacts.md +0 -16
  141. package/bundled/dev-pipeline/templates/sections/bugfix-session-status.md +0 -31
  142. package/bundled/dev-pipeline/templates/sections/critical-paths-agent.md +0 -7
  143. package/bundled/dev-pipeline/templates/sections/critical-paths-lite.md +0 -7
  144. package/bundled/dev-pipeline/templates/sections/directory-convention-agent.md +0 -9
  145. package/bundled/dev-pipeline/templates/sections/directory-convention-lite.md +0 -6
  146. package/bundled/dev-pipeline/templates/sections/headless-commit-authorization.md +0 -15
  147. package/bundled/dev-pipeline/templates/sections/phase-commit.md +0 -61
  148. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +0 -24
  149. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-lite-suffix.md +0 -12
  150. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +0 -44
  151. package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +0 -25
  152. package/bundled/dev-pipeline/templates/sections/phase-plan-agent.md +0 -20
  153. package/bundled/dev-pipeline/templates/sections/phase-plan-lite.md +0 -20
  154. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +0 -20
  155. package/bundled/dev-pipeline/templates/sections/refactor-artifacts.md +0 -17
  156. package/bundled/dev-pipeline/templates/sections/refactor-session-status.md +0 -28
  157. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-agent.md +0 -52
  158. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-lite.md +0 -52
  159. package/bundled/skills/prizmkit-code-review/references/workflow-state-protocol.md +0 -174
  160. package/bundled/skills/prizmkit-committer/references/workflow-state-protocol.md +0 -174
  161. package/bundled/skills/prizmkit-implement/references/workflow-state-protocol.md +0 -174
  162. package/bundled/skills/prizmkit-plan/references/workflow-state-protocol.md +0 -174
  163. package/bundled/skills/prizmkit-retrospective/references/workflow-state-protocol.md +0 -174
  164. package/bundled/skills/prizmkit-test/references/external-contract-mock-guidance.md +0 -119
@@ -1,175 +1,163 @@
1
1
  # Mobile Rules — {{ project_name }}
2
2
 
3
- > This document was generated by the `mobile-rules` skill on {{ generated_at }}
4
- > Audience: All mobile developers + all AI coding assistants on this project
5
- >
6
- > **Usage**:
7
- > 1. All AI coding assistants must read this file before generating or modifying any mobile code
8
- > 2. This document takes precedence over "general best practices" in AI training data
9
- > 3. Code conflicting with this document must not be committed
3
+ > Generated by app-planner Rules Configuration
4
+ > Audience: project contributors and AI coding assistants working on mobile applications
10
5
 
11
- ---
6
+ This document contains confirmed mobile decisions. In dual-native mode, platform-specific rules belong to their named profile and never become an unqualified cross-platform requirement.
12
7
 
13
- ## 0. TL;DR — Key Decisions at a Glance
8
+ ## 1. Decision Ledger
14
9
 
15
- | Dimension | Decision |
16
- |-----------|----------|
10
+ | Domain | Selected Decision |
11
+ |---|---|
17
12
  | Platform | {{ platform }} |
18
- | Min OS Version | {{ min_os_version }} |
19
- | Architecture Pattern | {{ architecture }} |
20
- | UI Framework | {{ ui_framework }} |
13
+ | Minimum OS support | {{ min_os_version }} |
14
+ | Architecture | {{ architecture }} |
15
+ | UI framework | {{ ui_framework }} |
21
16
  | Navigation | {{ navigation }} |
22
- | State Management | {{ state_management }} |
17
+ | State management | {{ state_management }} |
23
18
  | Networking | {{ networking }} |
24
- | Local Persistence | {{ persistence }} |
25
- | Push Notifications | {{ push_notifications }} |
26
- | Background Tasks | {{ background_tasks }} |
27
- | Permissions Strategy | {{ permissions_strategy }} |
28
- | Test Coverage | {{ test_coverage }} |
29
- | Unit Test Framework | {{ unit_test_framework }} |
30
- | E2E Test Framework | {{ e2e_framework }} |
19
+ | Persistence | {{ persistence }} |
20
+ | Push notifications | {{ push_notifications }} |
21
+ | Background work | {{ background_tasks }} |
22
+ | Permission timing | {{ permissions_strategy }} |
23
+ | Test depth | {{ test_coverage }} |
24
+ | Unit test framework | {{ unit_test_framework }} |
25
+ | UI/E2E framework | {{ e2e_framework }} |
31
26
  | Distribution | {{ distribution }} |
32
- | Performance Target | {{ performance_target }} |
33
- | Accessibility Target | {{ a11y_target }} |
27
+ | Performance | {{ performance_target }} |
28
+ | Accessibility | {{ a11y_target }} |
34
29
 
35
- ---
30
+ For dual-native projects, scalar cells summarize the profiles below; they do not replace profile-specific choices.
36
31
 
37
- ## 1. Project Structure
32
+ ## 2. Platform Profiles
33
+
34
+ {{ platform_profiles }}
35
+
36
+ Single-platform projects render one profile. Dual-native projects render separate `iOS` and `Android` profiles containing UI framework, state management, networking, persistence, unit testing, and UI/E2E testing decisions.
37
+
38
+ ## 3. Project Structure and Architecture
39
+
40
+ ### 3.1 Platform ownership invariants
38
41
 
39
42
  {{ FIXED_RULES_STRUCTURE }}
40
43
 
44
+ ### 3.2 Selected platform and OS rules
45
+
41
46
  {{ tech_stack_rules }}
42
47
 
43
- ---
48
+ ### 3.3 Selected architecture
49
+
50
+ {{ arch_rules }}
44
51
 
45
- ## 2. UI Development
52
+ ## 4. UI and Navigation
53
+
54
+ ### 4.1 UI invariants and selected framework
46
55
 
47
56
  {{ FIXED_RULES_UI }}
48
57
 
49
58
  {{ ui_rules }}
50
59
 
51
- ---
52
-
53
- ## 3. Navigation & Deep Linking
60
+ ### 4.2 Navigation
54
61
 
55
62
  {{ FIXED_RULES_NAVIGATION }}
56
63
 
57
64
  {{ navigation_rules }}
58
65
 
59
- ---
66
+ A no-deep-link selection suppresses deep-link setup rules and records the accepted limitation explicitly.
67
+
68
+ ## 5. State, Networking, and Persistence
60
69
 
61
- ## 4. State Management
70
+ ### 5.1 State
62
71
 
63
72
  {{ FIXED_RULES_STATE }}
64
73
 
65
74
  {{ state_rules }}
66
75
 
67
- ---
68
-
69
- ## 5. Networking
76
+ ### 5.2 Networking
70
77
 
71
78
  {{ FIXED_RULES_NETWORKING }}
72
79
 
73
80
  {{ networking_rules }}
74
81
 
75
- ---
76
-
77
- ## 6. Data Persistence
82
+ ### 5.3 Persistence
78
83
 
79
84
  {{ FIXED_RULES_PERSISTENCE }}
80
85
 
81
86
  {{ persistence_rules }}
82
87
 
83
- ---
88
+ In dual-native mode, each derived block is assigned to its platform profile before rendering.
84
89
 
85
- ## 7. Platform Features
90
+ ## 6. Platform Features
86
91
 
87
92
  {{ FIXED_RULES_PLATFORM_FEATURES }}
88
93
 
89
94
  {{ platform_features_rules }}
90
95
 
91
- ---
96
+ Push and background sections are explicit `not applicable` statements when those capabilities are not selected. Permission behavior follows the selected timing decision.
97
+
98
+ ## 7. Performance and Accessibility
92
99
 
93
- ## 8. Performance
100
+ ### 7.1 Performance
94
101
 
95
102
  {{ FIXED_RULES_PERFORMANCE }}
96
103
 
97
104
  {{ performance_rules }}
98
105
 
99
- ---
100
-
101
- ## 9. Accessibility
106
+ ### 7.2 Accessibility
102
107
 
103
108
  {{ FIXED_RULES_A11Y }}
104
109
 
105
110
  {{ a11y_rules }}
106
111
 
107
- ---
108
-
109
- ## 10. Security
112
+ ## 8. Security
110
113
 
111
114
  {{ FIXED_RULES_SECURITY }}
112
115
 
113
- ---
114
-
115
- ## 11. Testing
116
+ ## 9. Testing
116
117
 
117
118
  {{ FIXED_RULES_TEST }}
118
119
 
119
120
  {{ test_rules }}
120
121
 
121
- ---
122
+ Only selected test tiers are mandatory. Dual-native test frameworks are stated per profile.
122
123
 
123
- ## 12. App Distribution
124
+ ## 10. Distribution
124
125
 
125
126
  {{ FIXED_RULES_DISTRIBUTION }}
126
127
 
127
128
  {{ distribution_rules }}
128
129
 
129
- ---
130
+ Public-store, enterprise, and undecided distribution rules are mutually exclusive unless the user explicitly selects multiple channels.
130
131
 
131
- ## 13. AI Vibecoding Behavior Constraints
132
+ ## 11. AI Change Permissions
132
133
 
133
- ### 13.1 Baseline Constraints (project-agnostic, always active)
134
+ ### 11.1 Invariant change safety
134
135
 
135
136
  {{ FIXED_RULES_AI_BASE }}
136
137
 
137
- ### 13.2 Project-Specific Hard Constraints
138
-
139
- - **Adding dependencies**: {{ ai_dependency_rule }}
140
- - **Modifying shared code**: {{ ai_breaking_change_rule }}
141
- - **Platform-specific code**: {{ ai_platform_rule }}
142
-
143
- ### 13.3 Mandatory Pre-Actions (before every code generation)
144
-
145
- AI must complete the following in order before generating or modifying any mobile code:
138
+ ### 11.2 Selected permissions
146
139
 
147
- 1. Read this file (`mobile-rules.md`)
148
- 2. Read existing files in the target feature's directory to confirm whether similar functionality already exists
149
- 3. If modifying shared widgets/components/services, search all callers and assess platform impact
150
- 4. If modifying navigation routes or deep link schemes, assess all entry points
140
+ - Dependency changes: {{ ai_dependency_rule }}
141
+ - Shared-code impact analysis: {{ ai_breaking_change_rule }}
142
+ - Platform-specific flexibility: {{ ai_platform_rule }}
151
143
 
152
- ---
144
+ These decisions own their domains for each applicable platform profile.
153
145
 
154
- ## 14. Architecture
155
-
156
- {{ arch_rules }}
157
-
158
- ---
159
-
160
- ## Appendix A: Deny List (Quick Reference)
161
-
162
- > This appendix is auto-generated by AI in Phase 4 by extracting all forbidden entries from each section.
146
+ ## Appendix A: Active Deny List
163
147
 
164
148
  {{ deny_list_summary }}
165
149
 
166
- ## Appendix B: Recommended Libraries & Tools
150
+ Include only prohibitions from active invariant and selected blocks.
167
151
 
168
- > This appendix is auto-generated by AI in Phase 4 to recommend the supporting ecosystem based on platform and framework choices.
152
+ ## Appendix B: Compatible Recommendations
169
153
 
170
154
  {{ recommended_libs }}
171
155
 
172
- ---
156
+ Recommendations must match the active platform profile and dependency-permission decision.
157
+
158
+ ## Source Contract
173
159
 
174
- **Version**: v1.0 Generated on {{ generated_at }}
175
- **Next review recommended**: before tech stack changes or platform migration
160
+ - Owner: app-planner Rules Configuration
161
+ - Resource family: `references/rules/mobile/`
162
+ - Regenerate after a decision or source-contract change.
163
+ - Generation metadata value: {{ generated_at }}
@@ -1,77 +1,145 @@
1
- # Rules Configuration — Full Procedure
1
+ # Rules Configuration — Contract and Procedure
2
2
 
3
- Procedure for configuring per-layer development rules during app planning.
3
+ Configure optional per-layer development rules during app planning without mixing unconditional invariants with user-owned technology or workflow decisions.
4
+
5
+ ## Design Contract
6
+
7
+ Rules Configuration uses four resource roles per layer:
8
+
9
+ 1. `question-manifest.json` — structural contract: question order, conditions, placeholders, fallback policy, and multi-profile behavior.
10
+ 2. `question-bank.md` — user-facing decision wording and recommended options.
11
+ 3. `fixed-rules.md` — invariant safety and correctness principles only.
12
+ 4. `derivation-rules.md` — rules owned by selected technologies, practices, permissions, and explicit defaults.
13
+ 5. `template.md` — output layout; it contains no hidden decision that can override a confirmed answer.
14
+
15
+ **Selected-decision precedence:** when a selected or explicitly authorized default conflicts with an unconditional rule, the selected decision wins and the unconditional content is invalid. Fix the source resources and rerun validation; never emit both rules.
16
+
17
+ **Fixed-rule boundary:** a rule is invariant only when it remains correct for every option the layer exposes. Framework choice, architecture, API style, database model, test depth, dependency permission, deployment topology, localization strategy, navigation capability, and performance target are decision-owned and must not be placed in `fixed-rules.md`.
4
18
 
5
19
  ## Step 1: Detect Layers
6
20
 
7
21
  - Prefer `.prizmkit/config.json` `tech_stack` when present.
8
22
  - Otherwise infer layers from project files:
9
- - frontend: `package.json` plus React/Vue/Svelte/Next/Vite indicators
10
- - backend: Express/FastAPI/Django/Go/Java service indicators
11
- - database: migrations, ORM config, schema files, or DB dependencies
12
- - mobile: Flutter/React Native/iOS/Android indicators
13
- - Present detected layers with `AskUserQuestion`; include "Skip rules configuration" as a non-blocking option.
23
+ - frontend: browser UI framework, bundler, or frontend package indicators;
24
+ - backend: service framework, API entrypoint, or server runtime indicators;
25
+ - database: schema, migrations, ORM, query, or database dependency indicators;
26
+ - mobile: Flutter, React Native, iOS, Android, or native project indicators.
27
+ - Present detected layers through the current host's structured-choice capability when available; otherwise ask the same concise question in chat and wait for explicit input.
28
+ - Include `Skip rules configuration` as a non-blocking option.
14
29
 
15
30
  ## Step 2: Choose Configuration Mode
16
31
 
17
- - Quick mode asks only manifest groups marked `quick_mode: true`.
18
- - Full mode asks every manifest group in order.
19
- - Skip mode records no rules file for that layer and continues without reminders.
32
+ Present three modes:
20
33
 
21
- ## Step 3: Ask Questions with AskUserQuestion
34
+ - **Quick** — ask only manifest groups marked `quick_mode: true`; use the question bank's recommended option for every remaining applicable question.
35
+ - **Full** — ask every applicable manifest group in order.
36
+ - **Skip** — create no rule file for that layer and continue without reminders.
22
37
 
23
- - Convert each question-bank option group into selectable `AskUserQuestion` options.
24
- - Do not ask users to type letter shortcuts such as `A` or `1`; those shortcuts are legacy notation in question banks only.
25
- - Every non-essential question includes a skip/defer option.
38
+ Quick mode is explicit authorization to apply the concrete recommended meanings for unasked applicable questions. Record the resulting decisions, not the phrase `use recommendations`. If a question has no single recommendation for the selected technology or prior answer, Quick mode must ask it rather than guess.
26
39
 
27
- ## Step 4: Configure Each Selected Layer — Full Q&A Workflow
28
-
29
- For each selected layer, run the 4-phase rule generation pattern:
30
-
31
- ### Phase A — Load Layer Resources
32
-
33
- - Read `${SKILL_DIR}/references/rules/<layer>/fixed-rules.md` — industry-consensus rules injected without asking
34
- - Read `${SKILL_DIR}/references/rules/<layer>/question-bank.md` — interactive questions organized in groups (G1->G10): authoritative source for question text, options, "Recommended" markers, and Notes
35
- - Read `${SKILL_DIR}/references/rules/<layer>/question-manifest.json` — machine-readable structure for this layer. This is the asking checklist. It lists, per question: `group`, `required`, `maps_to`, `required_if`, `auto_derived_when`, and `options_vary_by`. Its `groups[]` carries each group's `quick_mode` flag, and `template_placeholders` is the expected-set for the Phase D self-check. Use the manifest to track coverage; use question-bank.md for the actual wording you present to the user. If a question id in one file is absent from the other, trust question-bank.md for content and note the drift.
36
-
37
- ### Phase B Interactive Q&A
38
-
39
- - Ask questions one group at a time (max 3 questions per message), as defined in question-bank.md.
40
- - Each question shows a "Recommended" option to reduce decision cost.
41
- - Quick mode: ask only the groups whose `quick_mode` is `true` in `question-manifest.json`. All other groups adopt recommended defaults silently.
42
- - Full mode: ask all groups in manifest order (`groups[]`).
43
- - Conditional questions:
44
- - `required_if: "<expr>"` ask this question only when the expression over prior answers holds. If false, the question is legitimately skipped.
45
- - `auto_derived_when: "<expr>"` — when true, fill the mapped placeholder(s) from the prior answer without asking. Count as satisfied, not skipped.
46
- - `options_vary_by: "<Qid>"` the question is still asked; only its option list depends on that prior answer.
47
- - Legacy shortcut labels in question banks such as `recommended`, `default`, or `skip` are converted into selectable options in `AskUserQuestion`.
48
- - Do not ask the user to type these commands manually; selectable options prevent merged or missed decisions.
49
- - Resolve each response to a complete semantic choice and record only that normalized internal value after each group. Track which manifest questions are answered, auto-derived, or conditionally skipped so Phase D can verify coverage; raw turns and answer tokens are never writer input.
50
-
51
- ### Phase C Auto-derivation
52
-
53
- - Read `${SKILL_DIR}/references/rules/<layer>/derivation-rules.md`.
54
- - Match user answers against the trigger map using keyword matching.
55
- - Derive platform-specific rules without asking the user.
56
-
57
- ### Phase D Render and Write
58
-
59
- - Read `${SKILL_DIR}/references/rules/<layer>/template.md`.
60
- - Fill all template placeholders with accumulated content from Phases A+B+C.
61
- - Never copy raw answer text into a rendered rule. Convert option labels, custom replies, recommended/default shortcuts, and internal Q&A state into normalized semantic values that name the selected technology, behavior, constraint, or deferral.
62
- - Internal question IDs, answer tokens, `answers[Qx]`, dialogue-role labels, recommendation markers, and planning chronology must not appear in generated rules, TL;DR tables, headers, appendices, comments, or metadata prose.
63
- - Apply the same source durability rule during rendering: inline relevant meaning from non-code planning/evidence files and omit their transient paths; retain only purpose-tagged stable execution-time references.
64
- - Post-render self-check driven by `question-manifest.json` -> `template_placeholders`:
65
- 1. Coverage pass — for every placeholder in `from_questions`, confirm it traces to an answered question OR an `auto_derived_when` path OR a conditionally-skipped question (`required_if` false). If a `from_questions` placeholder has no source, go back and ask it before writing.
66
- 2. Residual pass scan the rendered document for any residual `{{ ` or ` }}`; count must be 0. Placeholders in `from_fixed_rules`, `auto_generated`, and `metadata` are filled from fixed rules, Phase D generation, and project metadata.
67
- 3. AI-readability pass — scan all AI-visible fields and sections. Every generated natural-language value must stand alone without the planning conversation; reject raw turns, Q&A provenance, unresolved relative wording, or transient source dependencies before writing.
68
- - Generate Appendix A (Deny List) and Appendix B (Recommended Tools) per template instructions.
69
- - Create `.prizmkit/rules/` directory if it doesn't exist.
70
- - Write `.prizmkit/rules/<layer>-rules.md`.
71
-
72
- ## Step 5: Update root.prizm RULES Pointer
73
-
74
- - Ensure `.prizmkit/prizm-docs/root.prizm` has a concise `RULES:` pointer to configured rules.
75
- - If root.prizm exists, update only the `RULES:` line.
76
- - If root.prizm is absent, create a minimal valid root.prizm with required fields and a `RULES:` pointer.
77
- - Do not write architecture decisions, project brief content, or changelog metadata into root.prizm.
40
+ ## Step 3: Load and Validate Resources
41
+
42
+ For each selected layer:
43
+
44
+ 1. Read:
45
+ - `${SKILL_DIR}/references/rules/<layer>/question-manifest.json`
46
+ - `${SKILL_DIR}/references/rules/<layer>/question-bank.md`
47
+ - `${SKILL_DIR}/references/rules/<layer>/fixed-rules.md`
48
+ - `${SKILL_DIR}/references/rules/<layer>/derivation-rules.md`
49
+ - `${SKILL_DIR}/references/rules/<layer>/template.md`
50
+ 2. Run the deterministic resource validator before asking questions:
51
+ ```bash
52
+ python3 ${SKILL_DIR}/scripts/validate-rules-configuration.py \
53
+ --rules-root ${SKILL_DIR}/references/rules
54
+ ```
55
+ 3. If the manifest, question bank, fixed injection map, derivation fallback contract, or template placeholders drift, fail generation. Do not trust one source and continue because an incomplete rule document is worse than no rule document.
56
+
57
+ ## Step 4: Ask and Normalize Decisions
58
+
59
+ - Ask one manifest group at a time, with at most three questions per interaction.
60
+ - Use the current host's structured-choice capability when available. A named platform tool is an implementation example, not part of this protocol.
61
+ - Every non-essential question includes a skip/defer option.
62
+ - Do not require letter shortcuts. Question-bank labels such as `A` and `B` are internal matching aids only.
63
+ - Resolve every answer to a complete semantic decision immediately.
64
+ - Track each question as one of:
65
+ - `answered`;
66
+ - `quick_default_authorized`;
67
+ - `auto_derived`;
68
+ - `conditionally_not_applicable`;
69
+ - `explicitly_deferred`.
70
+ - Never copy raw answer text, turns, question IDs, option labels, recommendation markers, or answer-map syntax into secondary outputs. Pass only normalized semantic values to rendering and review.
71
+
72
+ ### Conditional Questions
73
+
74
+ - `required_if` false means the question is not applicable.
75
+ - `auto_derived_when` true means the complete semantic answer is derived from an earlier decision.
76
+ - `options_vary_by` changes the option set but never authorizes guessing.
77
+ - For Mobile `Q1 == E`, follow `multi_profile_contract`: collect the listed dimensions separately for iOS and Android and render both profiles. A scalar answer must never overwrite the other platform's decision.
78
+
79
+ ## Step 5: Derive Rule Blocks
80
+
81
+ Apply derivation rules after all applicable decisions are normalized:
82
+
83
+ 1. Match a normalized decision to a named derivation block.
84
+ 2. If a pre-authored block exists, use it only for the matching option and compatible prior decisions.
85
+ 3. If no pre-authored block exists, apply `SEMANTIC_FALLBACK_POLICY`:
86
+ - state the selected technology or practice;
87
+ - require consistency with its official/current project conventions;
88
+ - preserve detected brownfield behavior unless the user explicitly chose migration;
89
+ - do not import a recommended option's rules;
90
+ - do not leave the placeholder blank.
91
+ 4. For `No`, `None`, `Not required`, deferred, or conditionally skipped choices, render an explicit not-applicable or deferred statement. Never leave unexplained empty sections.
92
+
93
+ ## Step 6: Conflict Gate
94
+
95
+ Before rendering, build a decision ledger with one owner per policy domain, such as:
96
+
97
+ - frontend localization, dependency permission, caller analysis, config permission, testing depth;
98
+ - backend architecture, API style, authentication, data technology, cache/queue/deployment, observability, testing, AI permissions;
99
+ - database model, identifier strategy, normalization, cache, audit, backup/HA, DDL permission;
100
+ - mobile platform profile, navigation, platform features, testing, distribution, performance, AI permissions.
101
+
102
+ Check every fixed and derived rule against the ledger:
103
+
104
+ - Fixed content may constrain only invariant safety/correctness.
105
+ - Derived content may constrain only the option that owns the domain.
106
+ - A selected `none` or `not required` decision suppresses incompatible requirement blocks.
107
+ - Cross-layer references must agree on shared decisions; report disagreement instead of choosing silently.
108
+ - If two active rules require incompatible behavior, fail generation, identify both source blocks, repair the source/decision state, and rerun the gate.
109
+
110
+ ## Step 7: Render and Validate
111
+
112
+ 1. Fill every template placeholder from the manifest categories:
113
+ - `from_questions` — normalized decisions and compatible derivation blocks;
114
+ - `from_fixed_rules` — invariant-only blocks;
115
+ - `auto_generated` — bounded summaries, deny lists, recommendations, and platform profiles;
116
+ - `metadata` — project identity and scope.
117
+ 2. Recommendations are non-binding and must not contradict the decision ledger.
118
+ 3. Scan the rendered document:
119
+ - no residual `{{ ... }}`;
120
+ - no raw answer tokens or dialogue provenance;
121
+ - no blank policy section without an explicit not-applicable statement;
122
+ - no duplicate policy domain with conflicting requirements;
123
+ - no platform-specific source-of-truth path;
124
+ - no reference to a retired independent layer-rules skill.
125
+ 4. Run the app-planner Pre-Generation Headless Context Completeness Gate on every generated rule.
126
+ 5. Write `.prizmkit/rules/<layer>-rules.md` only after all checks pass.
127
+
128
+ ## Step 8: Update `root.prizm`
129
+
130
+ - Ensure `.prizmkit/prizm-docs/root.prizm` has a concise `RULES:` pointer to configured rule files.
131
+ - If `root.prizm` exists, update only the `RULES:` line.
132
+ - If absent, create only the minimal valid root plus the `RULES:` pointer allowed by the parent Skill.
133
+ - Do not write architecture decisions, project brief content, temporal metadata, or changelog content into `root.prizm`.
134
+
135
+ ## Completion Evidence
136
+
137
+ Report:
138
+
139
+ - configured and skipped layers;
140
+ - mode used per layer;
141
+ - explicitly selected, quick-authorized, deferred, and not-applicable decisions;
142
+ - deterministic resource validation result;
143
+ - conflict-gate result;
144
+ - rendered files and residual-placeholder check;
145
+ - `root.prizm` pointer result.