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
@@ -12,6 +12,11 @@
12
12
 
13
13
  ---
14
14
 
15
+ ## SEMANTIC_FALLBACK_POLICY
16
+
17
+ Every confirmed option is valid input even when no pre-authored block exists. Render unmatched choices as complete datastore-specific rules using current official and detected project conventions, without borrowing a recommended alternative's SQL, topology, backup, or permission policy. Render `no cache`, `no audit`, deferred, development-only, and conditionally skipped decisions explicitly; never leave placeholders blank.
18
+
19
+ Validate all active blocks against the decision ledger. Datastore model, identifier strategy, normalization/document modeling, backup/availability, and AI execution permissions each have one owner. Incompatible combinations fail generation and return to clarification.
15
20
 
16
21
  ## Phase 2 Normalized Semantic Fill Table
17
22
 
@@ -49,6 +54,7 @@ Resolve each selected option or custom reply into the complete semantic value sh
49
54
  | Q1 = SQLite | `D-SQLITE-01` | `{{ tech_rules }}` |
50
55
  | Q2 = Redis | `D-REDIS-BACKEND-01` | `{{ cache_rules }}` |
51
56
  | Q2 = Memcached | `D-MEMCACHED-DB-01` | `{{ cache_rules }}` |
57
+ | Q3 = Native ObjectId | `D-MONGO-ID-01` | `{{ schema_rules }}` |
52
58
  | Q3 = UUID v7 | `D-UUID-01` | `{{ schema_rules }}` |
53
59
  | Q3 = ULID | `D-ULID-01` | `{{ schema_rules }}` |
54
60
  | Q3 = Auto-increment + UUID mapping | `D-AUTOINC-01` | `{{ schema_rules }}` |
@@ -142,6 +148,13 @@ Resolve each selected option or custom reply into the complete semantic value sh
142
148
  - No persistence — data lost on restart. Only cache data that can be regenerated from the database.
143
149
  - Client sharding across multiple memcached instances via consistent hashing.
144
150
 
151
+ ### D-MONGO-ID-01
152
+ **Trigger**: Q1 = MongoDB and Q3 = Native ObjectId | **Inject into**: `{{ schema_rules }}`
153
+
154
+ - Use MongoDB `_id` with native ObjectId semantics as the document identity unless a confirmed integration requires another stable public identifier.
155
+ - If public URLs must not expose `_id`, add an explicit opaque public identifier; do not imply relational auto-increment mapping.
156
+ - References and indexes use the selected identifier type consistently.
157
+
145
158
  ### D-UUID-01
146
159
  **Trigger**: Q3 = UUID v7 | **Inject into**: `{{ schema_rules }}`
147
160
 
@@ -160,25 +173,24 @@ Resolve each selected option or custom reply into the complete semantic value sh
160
173
  ### D-AUTOINC-01
161
174
  **Trigger**: Q3 = Auto-increment + UUID mapping | **Inject into**: `{{ schema_rules }}`
162
175
 
163
- - Primary keys use `BIGINT AUTO_INCREMENT`. Do not expose to API.
164
- - API layer uses UUID (ID mapping in service layer or an additional UUID column).
165
- - Strictly forbid exposing auto-increment IDs in URLs or responses.
176
+ - Use the selected datastore's monotonic numeric identity mechanism for the internal key and a separate UUID for external identity.
177
+ - Define one authoritative mapping between the two identifiers and index the external UUID uniquely.
178
+ - External contracts expose the UUID, not the internal sequence value.
166
179
 
167
180
  ### D-DIRECT-AUTOINC-01
168
181
  **Trigger**: Q3 = Direct auto-increment | **Inject into**: `{{ schema_rules }}`
169
182
 
170
- - Direct auto-increment IDs for internal use only.
171
- - Forbid exposing auto-increment IDs in URLs, API responses, or any client-facing layer.
172
- - Use UUIDs or opaque tokens for all external references.
173
- - Auto-increment IDs must be BIGINT (never INT for production tables expected to grow).
183
+ - Use the selected datastore's direct monotonic numeric identity mechanism.
184
+ - This option's declared external-reference limitation remains active: do not expose sequence values through public URLs or contracts; add an opaque identifier if an external reference is later required.
185
+ - Select numeric width from projected lifetime cardinality and datastore capability rather than a universal type name.
174
186
 
175
187
  ### D-SOFTDELETE-01
176
188
  **Trigger**: Q4 = deleted_at | **Inject into**: `{{ schema_rules }}`
177
189
 
178
- - Every table requiring soft delete adds `deleted_at TIMESTAMPTZ DEFAULT NULL`.
179
- - All queries default to filtering `WHERE deleted_at IS NULL`.
180
- - Unique indexes must include `deleted_at` (otherwise re-inserting the same unique key after deletion fails).
181
- - Periodically archive soft-deleted data older than N days (N based on business agreement).
190
+ - Persist a nullable deletion marker using the selected datastore's appropriate timestamp or state representation for models that participate in soft deletion.
191
+ - Default active-record access paths exclude deleted records, while authorized recovery/audit paths opt in explicitly.
192
+ - Uniqueness applies to active records. Use a partial unique index where supported; otherwise use the datastore's supported generated-key, scoped-key, or transactional strategy.
193
+ - Retention, restoration, legal erasure, and archival behavior come from the data lifecycle and sensitivity decisions.
182
194
 
183
195
  ### D-3NF-01
184
196
  **Trigger**: Q5 = Strict 3NF | **Inject into**: `{{ schema_rules }}`
@@ -189,134 +201,123 @@ Resolve each selected option or custom reply into the complete semantic value sh
189
201
  ### D-PARTIAL-DENORM-01
190
202
  **Trigger**: Q5 = Allow partial denormalization | **Inject into**: `{{ schema_rules }}`
191
203
 
192
- - Partial denormalization is permitted for OLAP, reporting, and performance-critical read paths.
193
- - Each denormalized field must: (a) be documented in the schema comment with 'DENORM:' prefix and the source table/column, (b) have a defined consistency maintenance strategy (application-level update, materialized view, periodic reconciliation), (c) be listed in a project-level denormalization-registry.md file.
194
- - Forbid denormalization on write-heavy OLTP paths.
204
+ - Permit denormalization only for a named access path with evidence that the normalized model does not meet it.
205
+ - Document the authoritative source, consistency mechanism, reconciliation behavior, and accepted staleness for each duplicated value.
206
+ - Keep write amplification and concurrency behavior within the selected workload objective.
195
207
 
196
208
  ### D-ORM-MIGRATE-01
197
209
  **Trigger**: Q6 = ORM built-in | **Inject into**: `{{ migration_rules }}`
198
210
 
199
- - Migrations managed by ORM's built-in tool.
200
- - Always generate via ORM CLI commands; never hand-edit auto-generated migration files.
201
- - Version-control all migration files.
202
- - Test migrations on a staging database before deployment.
211
+ - Use the selected ORM's supported migration workflow as the authoritative schema/model history.
212
+ - Follow that tool's rules for generated versus editable migrations; do not impose another tool's file convention.
213
+ - Version changes and verify forward compatibility plus the selected rollback/recovery path in an isolated representative environment before production.
203
214
 
204
215
  ### D-FLYWAY-01
205
216
  **Trigger**: Q6 = Standalone tool | **Inject into**: `{{ migration_rules }}`
206
217
 
207
- - Use Flyway (Java/Go) or Alembic (Python) as a standalone migration tool.
208
- - Migration file naming follows tool conventions. Each migration accompanied by a rollback file.
209
- - CI validates: migration file numbers are non-duplicate, non-regressing, previously executed migrations are not modified.
218
+ - Use the explicitly selected standalone migration tool and its native ordering, checksum, and recovery conventions.
219
+ - Keep applied migrations immutable and reject duplicate or regressing versions where the tool uses ordered versions.
220
+ - A down migration is required only when safe and supported; otherwise document forward repair or restore behavior.
210
221
 
211
222
  ### D-MANUAL-MIGRATE-01
212
223
  **Trigger**: Q6 = Manual SQL files | **Inject into**: `{{ migration_rules }}`
213
224
 
214
- - Migration files follow naming convention: `V{YYYYMMDD}{HHmm}__{description}.sql` (forward) paired with `U{YYYYMMDD}{HHmm}__{description}.sql` (rollback).
215
- - Each migration must have a matching rollback file.
216
- - SQL review checklist: all statements idempotent where possible, no data loss in forward migration, rollback restores exact prior state.
225
+ - Store ordered, immutable SQL migration files under one documented project convention.
226
+ - Each change states prerequisites, forward effect, compatibility window, data transformation, operational risk, and safe recovery behavior.
227
+ - Do not promise an exact rollback for destructive or irreversible transformations; use backup/restore or forward repair when that is the truthful strategy.
217
228
 
218
229
  ### D-OLTP-01
219
230
  **Trigger**: Q7 = OLTP | **Inject into**: `{{ performance_rules }}`
220
231
 
221
- - Slow query threshold set to 100ms.
222
- - Every query must be index-covered (EXPLAIN output shows no full table scan / full index scan).
223
- - Long transaction monitoring: transactions exceeding 5s trigger alerts.
224
- - Connection pool config: `pool_size = CPU cores × 2`. Max wait time ≤ 30s.
232
+ - Optimize for frequent bounded reads/writes and short atomic operations.
233
+ - Set slow-operation, transaction, and client-concurrency thresholds from the confirmed service objective and observed datastore capacity.
234
+ - Full scans are acceptable only for demonstrably bounded datasets or maintenance paths; verify critical access paths with the datastore profiler.
225
235
 
226
236
  ### D-OLAP-01
227
237
  **Trigger**: Q7 = OLAP | **Inject into**: `{{ performance_rules }}`
228
238
 
229
- - Slow query threshold relaxed to 500ms.
230
- - Pre-aggregation tables / materialized views used for accelerating large queries.
231
- - Batch ETL executed during low-traffic hours (2–6 AM).
232
- - Forbid running DDL during OLAP query execution.
239
+ - Optimize for analytical scans, aggregation, and batch throughput using capabilities of the selected datastore.
240
+ - Choose pre-aggregation, materialized views, columnar paths, or batch windows only from measured query patterns.
241
+ - Coordinate structural changes and heavy analytical work through documented resource and maintenance boundaries.
233
242
 
234
243
  ### D-MIXED-01
235
244
  **Trigger**: Q7 = Mixed | **Inject into**: `{{ performance_rules }}`
236
245
 
237
- - Dual slow query thresholds: OLTP queries <= 100ms, OLAP queries <= 500ms.
238
- - OLAP queries must use read replicas. Forbid running OLAP queries against the primary instance.
239
- - Pre-aggregation via materialized views for common reporting queries. Refresh during low-traffic hours (2-6 AM).
240
- - Forbid running DDL during OLAP query execution windows.
246
+ - Classify transactional and analytical access paths separately and give each a confirmed service objective.
247
+ - Isolate analytical load through replicas, warehouses, materialized data, or scheduling only when compatible with the selected availability topology and consistency needs.
248
+ - Document resource contention and refresh/staleness behavior for shared infrastructure.
241
249
 
242
250
  ### D-PARTITION-01
243
251
  **Trigger**: Q8 = > 10M rows | **Inject into**: `{{ performance_rules }}`
244
252
 
245
- - Large tables partitioned by time range (monthly or quarterly). Indexes per partition.
246
- - New data written to the latest partition. Queries should include the partition key when possible.
247
- - Expired partitions are auto-detached + archived without affecting online service.
253
+ - Evaluate partitioning or sharding from measured access paths, retention, write distribution, and operational support; scale alone does not force time partitioning.
254
+ - When partitioning is selected, choose a key that enables pruning without creating hotspots and test cross-partition operations.
255
+ - Archival and partition retirement follow the selected retention and backup rules.
248
256
 
249
257
  ### D-MEDIUM-SCALE-01
250
258
  **Trigger**: Q8 = 1M-10M rows | **Inject into**: `{{ performance_rules }}`
251
259
 
252
- - Plan partitioning strategy now even if not immediately needed. Reserve partition key columns.
253
- - Monitor table growth monthly. Trigger partition implementation at 5M rows.
254
- - Index maintenance: monthly reindex for fragmented indexes. Monitor index hit rates.
255
- - Archival strategy: identify cold data (> 90 days untouched) and plan archival path.
260
+ - Record projected growth and monitor size plus critical access paths.
261
+ - Reserve a partitioning strategy only when workload evidence identifies a viable key and benefit; do not add speculative columns or trigger at a universal row count.
262
+ - Run datastore-specific index maintenance and archival from observed health and selected retention policy.
256
263
 
257
264
  ### D-PII-01
258
265
  **Trigger**: Q9 = Contains PII | **Inject into**: `{{ security_rules }}`
259
266
 
260
- - Sensitive fields (password hashes, national IDs, bank card numbers, phone numbers, email) must be encrypted at rest.
261
- - Passwords use bcrypt/argon2 hashing. Irreversible info uses AES-256-GCM encryption.
262
- - Database logs / slow query logs are auto-desensitized.
263
- - Database backup files must be encrypted at rest.
264
- - GDPR "right to be forgotten": user data deletion must be true deletion (or irreversible anonymization), not soft delete.
267
+ - Classify sensitive fields and identify applicable legal, contractual, and product obligations before selecting controls.
268
+ - Passwords use a current password-hashing construction and are never reversibly encrypted; reversible sensitive fields use authenticated encryption or an approved managed boundary when required.
269
+ - Redact sensitive values from query/slow logs and protect exports and backups according to their classification.
270
+ - Erasure, anonymization, retention, and soft deletion follow the applicable obligation; do not claim one jurisdiction universally.
265
271
 
266
272
  ### D-AUDIT-01
267
273
  **Trigger**: Q10 = Audit tables | **Inject into**: `{{ audit_rules }}`
268
274
 
269
- - Every audited table gets a corresponding `<table>_audit` table recording all INSERT/UPDATE/DELETE.
270
- - Audit table fields: `audit_id`, `operation` (I/U/D), `changed_by`, `changed_at`, `old_values`(JSONB), `new_values`(JSONB).
271
- - Audit tables populated via triggers. Application code does not write directly to audit tables.
272
- - Audit tables are partitioned and periodically archived.
275
+ - Define audited entities, operations, actor attribution, before/after data policy, tamper resistance, access, and retention from the audit requirement.
276
+ - Implement through datastore audit features, append-only records, triggers, or the application boundary according to the selected technology and trust model.
277
+ - Use datastore-appropriate types; do not inject PostgreSQL JSONB or table-per-entity design into every datastore.
273
278
 
274
279
  ### D-CDC-01
275
280
  **Trigger**: Q10 = CDC | **Inject into**: `{{ audit_rules }}`
276
281
 
277
- - Use Debezium / Maxwell / PostgreSQL logical replication for CDC.
278
- - CDC events pushed to Kafka/message queue. Downstream consumers handle (sync to ES, data warehouse, cache invalidation).
279
- - CDC connectors must have dead letter queues configured. Failure must not obstruct primary database operation.
282
+ - Select a CDC mechanism supported by the datastore or managed service and state snapshot, ordering, schema-change, offset, and duplicate-delivery behavior.
283
+ - Route change events through the separately selected transport; CDC does not implicitly authorize Kafka or any message queue.
284
+ - Make connector failure observable and define recovery without corrupting or blocking the primary write path.
280
285
 
281
286
  ### D-CLOUD-01
282
287
  **Trigger**: Q11 = Cloud managed | **Inject into**: `{{ ops_rules }}`
283
288
 
284
- - Automated backup enabled (default: retain 7+ days). Multi-AZ deployment.
285
- - Security group: only whitelisted IPs can access the database port.
286
- - Connections enforce SSL/TLS.
287
- - Upgrade windows set during low-traffic periods.
289
+ - Use the selected managed service's private-network and identity controls and encrypt remote connections.
290
+ - Configure backup strictly from Q12 and availability/failover strictly from Q13; managed deployment alone enables neither policy implicitly.
291
+ - Choose upgrade and maintenance behavior from the confirmed availability objective and provider capability.
288
292
 
289
293
  ### D-SELFHOST-01
290
294
  **Trigger**: Q11 = Self-hosted | **Inject into**: `{{ ops_rules }}`
291
295
 
292
- - Database port not exposed to the public internet.
293
- - Monitoring must be set up: connections, slow queries, disk usage, replication lag.
294
- - Backup scripts run independently of application servers.
295
- - Regular recovery drills (at least quarterly).
296
+ - Keep the datastore off the public internet and restrict administrative and runtime identities separately.
297
+ - Monitor capacity, connections, and slow operations; monitor replication only when Q13 selected a replicated topology.
298
+ - Implement backups and recovery verification strictly from Q12 rather than enabling them as a hidden self-hosting default.
296
299
 
297
300
  ### D-DOCKER-DEV-01
298
301
  **Trigger**: Q11 = Development environment Docker Compose | **Inject into**: `{{ ops_rules }}`
299
302
 
300
- - Docker Compose for local development only. Production deployment handled separately.
301
- - Database data persisted via Docker volumes. Forbid losing data on container restart.
302
- - docker-compose.yml committed to repository. Includes database service + cache service definitions.
303
- - Health checks configured for all services. Startup order managed via depends_on + healthcheck conditions.
303
+ - Docker Compose is the selected local development boundary; production deployment remains a separate decision.
304
+ - Persist database data through an explicit development volume unless an ephemeral reset was requested.
305
+ - Commit the Compose definition when repository policy allows it. Include only selected services; a cache service appears only when Q2 selected one.
306
+ - Configure health checks and dependency readiness for services that participate in the selected topology.
304
307
 
305
308
  ### D-PITR-01
306
309
  **Trigger**: Q12 = Daily full + continuous incremental | **Inject into**: `{{ ops_rules }}`
307
310
 
308
- - PostgreSQL: enable WAL archiving + `pgBackRest` / `WAL-G`.
309
- - MySQL: enable binlog + `XtraBackup` / `mysqlbackup`.
310
- - PITR Recovery Time Objective (RTO) 1 hour. Recovery Point Objective (RPO) 5 minutes.
311
- - Backups retained for 30 days, stored offsite.
311
+ - Enable the selected datastore or managed service's continuous log/journal backup mechanism in addition to daily full backups.
312
+ - Record the required RPO, RTO, retention, encryption, and independent storage boundary before production generation; do not invent numeric objectives.
313
+ - Verify that one restore can reach a chosen point between full backups and capture the evidence.
312
314
 
313
315
  ### D-FULL-BACKUP-01
314
316
  **Trigger**: Q12 = Daily full backup only | **Inject into**: `{{ ops_rules }}`
315
317
 
316
- - Daily full backup via pg_dump/mysqldump/mongodump.
317
- - Backups retained for 7 days locally + 30 days offsite.
318
- - Warning: without continuous incremental/WAL archiving, PITR is not available. RPO = up to 24 hours.
319
- - Recovery drill: monthly restore test from latest backup.
318
+ - Run one full backup per day through the selected datastore or managed service mechanism.
319
+ - Record retention, encryption, storage independence, and restore-verification cadence from product and compliance needs.
320
+ - Without continuous change-log backup, the accepted recovery point may lose changes since the latest successful full backup; state that risk explicitly.
320
321
 
321
322
  ### D-NO-BACKUP-01
322
323
  **Trigger**: Q12 = No automatic backup needed | **Inject into**: `{{ ops_rules }}`
@@ -328,33 +329,32 @@ Resolve each selected option or custom reply into the complete semantic value sh
328
329
  ### D-REPLICA-01
329
330
  **Trigger**: Q13 = Primary-replica | **Inject into**: `{{ ops_rules }}`
330
331
 
331
- - Read-write split: writes go to primary, reads go to replicas. Application code must explicitly distinguish read/write data sources.
332
- - Replication lag monitoring: alert when exceeding 5s.
333
- - Failover drills at least quarterly.
334
- - Connection pool config: primary pool small (fewer writes), replica pool large (more reads).
332
+ - Configure the selected managed-failover or primary-replica topology and document its consistency behavior.
333
+ - Route reads to replicas only when stale reads are acceptable and the application has an explicit read-routing boundary; failover alone does not imply read/write splitting.
334
+ - Monitor replication/failover health against the selected availability objective and verify recovery at an approved cadence.
335
+ - Size client pools from topology and datastore capacity rather than a universal primary/replica ratio.
335
336
 
336
337
  ### D-SINGLE-01
337
338
  **Trigger**: Q13 = Single instance is sufficient | **Inject into**: `{{ ops_rules }}`
338
339
 
339
- - Single database instance. No replication or failover.
340
- - Acceptable downtime window: defined by business (default: off-hours maintenance).
341
- - Warning: single point of failure. Instance failure = full service outage until restored from backup.
342
- - Connection pool sized for one instance. No read/write split needed.
340
+ - Use one database instance with no database-level failover.
341
+ - Record the accepted outage and recovery risk; do not invent a default maintenance window.
342
+ - Size clients for one instance and do not create replica routing.
343
343
 
344
344
  ### D-MULTIMASTER-01
345
345
  **Trigger**: Q13 = Multi-master cluster | **Inject into**: `{{ ops_rules }}`
346
346
 
347
- - Multi-master replication. All nodes accept writes. Conflict resolution strategy must be explicitly chosen (last-write-wins / application-level merge / CRDT).
348
- - Auto-increment IDs must use offset-step allocation to avoid collisions across masters.
349
- - Application must handle replication lag (eventual consistency). Read-after-write may not see latest data.
350
- - Connection pool: separate pool per master. Load-balanced writes across all masters.
347
+ - Use only a datastore-supported multi-writer topology and state its consistency and partition behavior.
348
+ - Choose and test conflict resolution for the affected business invariants; do not assume last-write-wins is safe.
349
+ - The selected identifier strategy must remain collision-safe across writers; apply datastore-supported allocation only when auto-generated numeric IDs were selected.
350
+ - Route clients using the supported topology driver or service boundary rather than hand-built load balancing by default.
351
351
 
352
352
  ### D-AI-DDL-AUDIT-01
353
353
  **Trigger**: Q14 = Migration only | **Inject into**: `{{ ai_ddl_rule }}`
354
354
 
355
- - AI may generate migration files but must not execute them.
356
- - Each AI-generated migration must include: forward SQL + rollback SQL + EXPLAIN output + lock table analysis.
357
- - Migration files must be human-reviewed before execution.
355
+ - AI may generate changes through the selected migration mechanism but must not execute them.
356
+ - Each generated change states forward behavior, compatibility/rollback or recovery behavior, data transformation, and lock/rewrite or equivalent operational risk where applicable.
357
+ - The generated migration or model change must be reviewed before execution.
358
358
 
359
359
  ### D-AI-DDL-FORBID-01
360
360
  **Trigger**: Q14 = Fully forbid | **Inject into**: `{{ ai_ddl_rule }}`
@@ -366,9 +366,9 @@ Resolve each selected option or custom reply into the complete semantic value sh
366
366
  ### D-AI-DDL-FREE-01
367
367
  **Trigger**: Q14 = Free operation | **Inject into**: `{{ ai_ddl_rule }}`
368
368
 
369
- - AI may freely generate and execute DDL in development environments.
370
- - All DDL changes must still be version-controlled in migration files.
371
- - Warning: free DDL operation is suitable for development only. Restrict before production deployment.
369
+ - AI may generate DDL and may execute it only in an explicitly identified disposable development environment under the separately selected safety-confirmation policy.
370
+ - All DDL changes remain version-controlled through the selected migration mechanism.
371
+ - This permission never applies to shared, staging, or production data and must be narrowed before deployment.
372
372
 
373
373
  ### D-AI-SAFETY-STRICT-01
374
374
  **Trigger**: Q15 = Forbid destructive | **Inject into**: `{{ ai_safety_rule }}`