@cratis/pi 7.6.5 → 7.7.1

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 (212) hide show
  1. package/package/corpus/agents/backend-developer.md +14 -0
  2. package/package/corpus/agents/code-reviewer.md +16 -0
  3. package/package/corpus/agents/coordinator.md +17 -0
  4. package/package/corpus/agents/frontend-developer.md +17 -0
  5. package/package/corpus/agents/orchestrator.md +18 -0
  6. package/package/corpus/agents/planner.md +24 -0
  7. package/package/corpus/agents/screenplay-modeler.md +57 -0
  8. package/package/corpus/agents/screenplay-renderer.md +42 -0
  9. package/package/corpus/agents/screenplay-reviewer.md +45 -0
  10. package/package/corpus/agents/slice-implementer.md +32 -5
  11. package/package/corpus/agents/spec-writer.md +16 -3
  12. package/package/corpus/prompts/add-reactor.prompt.md +5 -3
  13. package/package/corpus/prompts/new-vertical-slice.prompt.md +16 -5
  14. package/package/corpus/prompts/write-specs.prompt.md +12 -6
  15. package/package/corpus/rules/application-profile.md +7 -3
  16. package/package/corpus/rules/general.md +8 -3
  17. package/package/corpus/rules/glossary.md +1 -1
  18. package/package/corpus/rules/profiles.md +42 -4
  19. package/package/corpus/rules/reactors.md +30 -22
  20. package/package/corpus/rules/vertical-slices.md +3 -1
  21. package/package/corpus/skills/cratis-application-react-specifications/SKILL.md +13 -0
  22. package/package/corpus/skills/cratis-application-slice-conformance/LICENSE +2 -0
  23. package/package/corpus/skills/cratis-application-slice-conformance/SKILL.md +173 -0
  24. package/package/corpus/skills/cratis-application-slice-conformance/references/checklists.md +66 -0
  25. package/package/corpus/skills/cratis-application-slice-conformance/references/contract-and-precedence.md +49 -0
  26. package/package/corpus/skills/cratis-application-slice-conformance/references/provenance.md +23 -0
  27. package/package/corpus/skills/cratis-application-slice-conformance/references/worked-example.md +91 -0
  28. package/package/corpus/skills/cratis-application-slice-conformance/verification.json +14 -0
  29. package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +57 -1
  30. package/package/corpus/skills/cratis-application-slice-specifications/references/provenance.md +16 -0
  31. package/package/corpus/skills/cratis-arc-command/SKILL.md +10 -0
  32. package/package/corpus/skills/cratis-arc-command-execution/SKILL.md +10 -0
  33. package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +10 -0
  34. package/package/corpus/skills/cratis-arc-observable-query-http/SKILL.md +10 -0
  35. package/package/corpus/skills/cratis-arc-query-paging/SKILL.md +10 -0
  36. package/package/corpus/skills/cratis-arc-react-page/SKILL.md +68 -8
  37. package/package/corpus/skills/cratis-arc-react-page/references/from-screenplay.md +199 -0
  38. package/package/corpus/skills/cratis-arc-react-page/references/provenance.md +13 -0
  39. package/package/corpus/skills/cratis-chronicle-event-constraints/SKILL.md +10 -0
  40. package/package/corpus/skills/cratis-chronicle-event-modeling/SKILL.md +38 -10
  41. package/package/corpus/skills/cratis-chronicle-event-type-migration/SKILL.md +13 -0
  42. package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +13 -0
  43. package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +58 -6
  44. package/package/corpus/skills/cratis-chronicle-reactor/references/provenance.md +9 -0
  45. package/package/corpus/skills/cratis-chronicle-read-model/SKILL.md +13 -0
  46. package/package/corpus/skills/cratis-chronicle-read-model-specifications/SKILL.md +47 -0
  47. package/package/corpus/skills/cratis-chronicle-read-model-specifications/references/provenance.md +11 -0
  48. package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +13 -0
  49. package/package/corpus/skills/cratis-components-stepper-command-dialog/SKILL.md +13 -0
  50. package/package/corpus/skills/cratis-event-model-diagram/SKILL.md +35 -16
  51. package/package/corpus/skills/cratis-screenplay-automations-and-translations/LICENSE +28 -0
  52. package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +166 -0
  53. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/audit-format.md +31 -0
  54. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/automation-patterns.md +139 -0
  55. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/cases-to-specify.md +69 -0
  56. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/effects-and-idempotency.md +88 -0
  57. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/integration-contracts.md +64 -0
  58. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/provenance.md +37 -0
  59. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/realization-and-gap-fill.md +34 -0
  60. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/todo-list-example.md +208 -0
  61. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translate-example.md +126 -0
  62. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translation-patterns.md +93 -0
  63. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/worked-integration.md +98 -0
  64. package/package/corpus/skills/cratis-screenplay-automations-and-translations/verification.json +15 -0
  65. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +267 -50
  66. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/complete-examples.md +185 -0
  67. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/verification.json +60 -12
  68. package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +42 -12
  69. package/package/corpus/skills/cratis-screenplay-discovery/LICENSE +30 -0
  70. package/package/corpus/skills/cratis-screenplay-discovery/SKILL.md +229 -0
  71. package/package/corpus/skills/cratis-screenplay-discovery/references/divergent-sweep.md +37 -0
  72. package/package/corpus/skills/cratis-screenplay-discovery/references/event-naming.md +64 -0
  73. package/package/corpus/skills/cratis-screenplay-discovery/references/facilitation.md +62 -0
  74. package/package/corpus/skills/cratis-screenplay-discovery/references/human-workshop.md +222 -0
  75. package/package/corpus/skills/cratis-screenplay-discovery/references/interview-questions.md +66 -0
  76. package/package/corpus/skills/cratis-screenplay-discovery/references/personas-and-causes.md +152 -0
  77. package/package/corpus/skills/cratis-screenplay-discovery/references/plotting-and-handoff.md +111 -0
  78. package/package/corpus/skills/cratis-screenplay-discovery/references/provenance.md +37 -0
  79. package/package/corpus/skills/cratis-screenplay-discovery/references/storming-loop.md +119 -0
  80. package/package/corpus/skills/cratis-screenplay-discovery/references/worked-session.md +87 -0
  81. package/package/corpus/skills/cratis-screenplay-discovery/verification.json +15 -0
  82. package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +140 -77
  83. package/package/corpus/skills/cratis-screenplay-event-modeling/references/invoicing-example.md +51 -0
  84. package/package/corpus/skills/cratis-screenplay-event-modeling/references/nine-steps.md +114 -28
  85. package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +50 -0
  86. package/package/corpus/skills/cratis-screenplay-event-modeling/verification.json +28 -3
  87. package/package/corpus/skills/cratis-screenplay-legacy-extraction/LICENSE +31 -0
  88. package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +239 -0
  89. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/chronicle-observations.md +25 -0
  90. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/evidence-table-template.md +79 -0
  91. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/expert-verification.md +48 -0
  92. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/generate-notes.md +75 -0
  93. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/intent-example.md +164 -0
  94. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/interview-findings.md +88 -0
  95. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/loss-report-template.md +47 -0
  96. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/prologue-safety.md +147 -0
  97. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/provenance.md +10 -0
  98. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/rule-modeling.md +36 -0
  99. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/side-car-migration.md +126 -0
  100. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/signal-to-intent.md +57 -0
  101. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/ui-observation.md +52 -0
  102. package/package/corpus/skills/cratis-screenplay-legacy-extraction/verification.json +17 -0
  103. package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +77 -57
  104. package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +50 -20
  105. package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-loop.md +211 -0
  106. package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +44 -6
  107. package/package/corpus/skills/cratis-screenplay-model-authoring/references/provenance.md +13 -0
  108. package/package/corpus/skills/cratis-screenplay-model-authoring/verification.json +64 -10
  109. package/package/corpus/skills/cratis-screenplay-model-review/LICENSE +34 -0
  110. package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +209 -0
  111. package/package/corpus/skills/cratis-screenplay-model-review/references/anti-patterns.md +89 -0
  112. package/package/corpus/skills/cratis-screenplay-model-review/references/business-questions.md +128 -0
  113. package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +176 -0
  114. package/package/corpus/skills/cratis-screenplay-model-review/references/provenance.md +36 -0
  115. package/package/corpus/skills/cratis-screenplay-model-review/references/report-template.md +149 -0
  116. package/package/corpus/skills/cratis-screenplay-model-review/references/review-questions.md +59 -0
  117. package/package/corpus/skills/cratis-screenplay-model-review/references/worked-example.md +255 -0
  118. package/package/corpus/skills/cratis-screenplay-model-review/verification.json +13 -0
  119. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/LICENSE +32 -0
  120. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/SKILL.md +239 -0
  121. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/code-reading-and-tokens.md +55 -0
  122. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/handoff-template.md +124 -0
  123. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/identity-and-edits.md +84 -0
  124. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/opt-in.md +48 -0
  125. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phase-report-inventories.md +25 -0
  126. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phases.md +162 -0
  127. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/principles.md +53 -0
  128. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/provenance.md +63 -0
  129. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/reasoning-notes.md +31 -0
  130. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/safety.md +31 -0
  131. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/stop-or-assume.md +46 -0
  132. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/verdicts-and-modes.md +204 -0
  133. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md +55 -0
  134. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/worked-example.md +86 -0
  135. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/verification.json +16 -0
  136. package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +14 -3
  137. package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +15 -1
  138. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/LICENSE +2 -0
  139. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +179 -0
  140. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/delivery-protocol.md +99 -0
  141. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/drift-and-ledger.md +67 -0
  142. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +72 -0
  143. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/provenance.md +27 -0
  144. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/renderability-gate.md +56 -0
  145. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/worked-example.md +124 -0
  146. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/verification.json +14 -0
  147. package/package/corpus/skills/cratis-screenplay-scenario-coverage/LICENSE +31 -0
  148. package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +200 -0
  149. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/berth-reservations.md +579 -0
  150. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/chronicle-verification.md +24 -0
  151. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/coverage-matrix.md +102 -0
  152. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/provenance.md +41 -0
  153. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-catalogue.md +196 -0
  154. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-workshop.md +102 -0
  155. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/spec-forms-by-mode.md +71 -0
  156. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/view-and-story-specs.md +91 -0
  157. package/package/corpus/skills/cratis-screenplay-scenario-coverage/verification.json +13 -0
  158. package/package/corpus/skills/cratis-screenplay-slice-design/LICENSE +30 -0
  159. package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +236 -0
  160. package/package/corpus/skills/cratis-screenplay-slice-design/references/command-inventory.md +107 -0
  161. package/package/corpus/skills/cratis-screenplay-slice-design/references/field-lineage.md +130 -0
  162. package/package/corpus/skills/cratis-screenplay-slice-design/references/provenance.md +20 -0
  163. package/package/corpus/skills/cratis-screenplay-slice-design/references/read-model-design.md +201 -0
  164. package/package/corpus/skills/cratis-screenplay-slice-design/references/review-questions.md +23 -0
  165. package/package/corpus/skills/cratis-screenplay-slice-design/references/rule-layers.md +41 -0
  166. package/package/corpus/skills/cratis-screenplay-slice-design/references/slicing.md +122 -0
  167. package/package/corpus/skills/cratis-screenplay-slice-design/references/worked-example.md +305 -0
  168. package/package/corpus/skills/cratis-screenplay-slice-design/verification.json +43 -0
  169. package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +217 -36
  170. package/package/corpus/skills/cratis-screenplay-specifications/verification.json +28 -4
  171. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/LICENSE +33 -0
  172. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +191 -0
  173. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md +154 -0
  174. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/chronicle-boundaries.md +54 -0
  175. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/consistency-and-concurrency.md +191 -0
  176. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/evolution-example.md +70 -0
  177. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/evolution.md +65 -0
  178. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/provenance.md +13 -0
  179. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-patterns.md +128 -0
  180. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/streams-example.md +378 -0
  181. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/verification.json +14 -0
  182. package/package/corpus/skills/cratis-screenplay-toolchain/LICENSE +2 -0
  183. package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +177 -0
  184. package/package/corpus/skills/cratis-screenplay-toolchain/references/automation-translate-example.md +121 -0
  185. package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet-example.md +319 -0
  186. package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet.md +96 -0
  187. package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +107 -0
  188. package/package/corpus/skills/cratis-screenplay-toolchain/references/doc-contradictions.md +48 -0
  189. package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-example.md +113 -0
  190. package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +148 -0
  191. package/package/corpus/skills/cratis-screenplay-toolchain/references/pdl-example.md +267 -0
  192. package/package/corpus/skills/cratis-screenplay-toolchain/references/provenance.md +51 -0
  193. package/package/corpus/skills/cratis-screenplay-toolchain/references/renderable-subset.md +88 -0
  194. package/package/corpus/skills/cratis-screenplay-toolchain/references/traps.md +51 -0
  195. package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +134 -0
  196. package/package/corpus/skills/cratis-screenplay-toolchain/references/versions.md +134 -0
  197. package/package/corpus/skills/cratis-screenplay-toolchain/verification.json +15 -0
  198. package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +53 -5
  199. package/package/corpus/skills/cratis-screenplay-ui-composition/references/flow-review.md +56 -0
  200. package/package/corpus/skills/cratis-screenplay-ui-composition/references/provenance.md +13 -0
  201. package/package/corpus/skills/cratis-screenplay-ui-composition/references/worked-flow.md +65 -0
  202. package/package/corpus/skills/cratis-screenplay-ui-composition/verification.json +4 -1
  203. package/package/corpus/skills/cratis-specification-by-example/SKILL.md +44 -1
  204. package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +10 -0
  205. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +186 -219
  206. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +177 -0
  207. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/render-example.md +150 -0
  208. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/rendered-application.md +87 -0
  209. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/sandbox-and-specrunner.md +98 -0
  210. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/verification.json +19 -0
  211. package/package/profile-catalog.json +11 -0
  212. package/package.json +1 -1
@@ -0,0 +1,201 @@
1
+ # Read-model design
2
+
3
+ ## Start from the consumer
4
+
5
+ List every consumer before designing any read model: each screen area a person looks at, and
6
+ each automation that needs to decide something. A read model exists for a consumer; a read
7
+ model nobody uses is a question.
8
+
9
+ For each consumer: what does it show or decide, for which instance or set, and for whom? How
10
+ stale may it be, and what does a stale answer cost? For each field: what does the person decide
11
+ or do with it? A field with no decision behind it is a question, not a requirement.
12
+
13
+ A screen that acts on an existing instance needs a view: it supplies the identifier the command
14
+ needs and the state the person decides on. Only a creation screen with nothing to show is
15
+ exempt; state the exemption.
16
+
17
+ ## Components
18
+
19
+ - A component is an area of a screen a person would describe as one thing ("the locker list",
20
+ "my request status"). Most screens have one.
21
+ - One read model per component. Split when a person would point at two areas and name them
22
+ differently, or when one area needs facts from many events and another needs only one or
23
+ two - they change for different reasons and at different speeds.
24
+ - A homogeneous list is one component.
25
+
26
+ ## Fan-in per field
27
+
28
+ For each read-model field, count the events that set it. More than about three is a signal to
29
+ look at, not a rule: a status fed by a long lifecycle is normal. Ask whether the field mixes
30
+ concerns that should be separate views, and whether every contributing event is genuinely a
31
+ change to *this* value. Report a problem only when it has a consequence (coupling, a view that
32
+ must change whenever unrelated facts change).
33
+
34
+ ## Builder and freshness
35
+
36
+ Observable delivery does not make a materialized projection decision-consistent; a protected
37
+ decision needs a guarded read (`rule-layers.md`, `cratis-screenplay-streams-and-consistency`). Prefer a
38
+ declarative projection (mappings, event joins, counters, bounded children, removals); a join
39
+ consumes event facts, not another read model. Use a reducer when prior-state, attempt or
40
+ ordering guards cannot be expressed declaratively. Review every writer of a property: AutoMap
41
+ can introduce updates from other events. Use variants only when lifecycle stages have different
42
+ shapes. Keep growing histories in a separate view; never combine several people's PII under
43
+ one read-model instance (compose queries across person-scoped views instead).
44
+
45
+ Every `from` event must set or affect a field (AutoMap counts); otherwise drop it or record why
46
+ it stays.
47
+
48
+ ## Query shape follows the business view
49
+
50
+ | The person... | Design-mode query | Executable/renderable scope |
51
+ |---|---|---|
52
+ | opens one thing | `XById => RM optional` + `by xId XId` | same (the only shape that binds today) |
53
+ | scans a list | `ListX => RM[]` (optionally `observable`, `filter`) | keep the list for design; add the keyed query; record V3 blocked by the list |
54
+ | sees their own rows | list with scope/`from` on the caller | as above; access rules are part of the view, enforced by the target |
55
+ | sees a site-wide figure | singleton read model, `from <Event> key literal "global"` on every `from` (a projection-level `key` routes nothing, PLAY0381; example in Screenplay `projections/keys.md`, "Literal keys") | check the binding (V3, `cratis-screenplay-toolchain`) |
56
+
57
+ - `observable` when people are expected to see others' or automation's changes while looking
58
+ (worklists, status awaiting an outside answer); one-shot otherwise. Design mode only
59
+ (PLAY0268). If access can be revoked mid-session, record that the target re-checks per emission.
60
+ - Never model paging or page size (no syntax, Screenplay#140). State the order in the query
61
+ `description` ("oldest first"); an unbounded list is a review question.
62
+ - A gated keyed query needs its own denial spec.
63
+
64
+ Never drop a list query from a design model just to make it bind; record the capability gap.
65
+ The keyed query also defines the read model's identity: its `by` property must be a read-model
66
+ property. The identifier always equals the projection's effective key:
67
+
68
+ | Effective key | Executable model | Renderable model (Stage) |
69
+ |---|---|---|
70
+ | event source (default or `key $eventSourceId`) | `xId = $eventSourceId`, or leave it unmapped in a scoped projection | scoped: leave it unmapped; the event must not carry a same-named, same-typed property unless `no automap` |
71
+ | event property (`key invoiceId`) | `xId = invoiceId` (never `$eventSourceId`) | if it binds **flat** (exact condition: `admission.md`, "Identity and key rule" 3), Stage admits it only with one `from`, every property mapped from an event property (no literals) and the key an identifier concept filled by each producing command's `for`; any other flat-bound shape is refused (`STAGE-ESM-008`/`-009`), it does not fall back to scoped. Any other shape is scoped (for example a `remove with`, a `= null` clear, or another `from` keyed by the event source); then leave the identifier unmapped or map it only from the key's own property |
72
+ | literal (`key literal "global"`) | leave it unmapped (scoped seeds it from the key) | refused: Stage keys are an event property or the event source (`STAGE-ESM-017`); keep the singleton in design or executable scope and record the gap |
73
+
74
+ The full rule, with the sources, is in `cratis-stage-rendering-and-sandbox`
75
+ `references/admission.md` ("Identity and key rule").
76
+
77
+ ## No clock-relative state
78
+
79
+ "Overdue", "expired", "due in 3 days" are true now and false later; a view changes only when a
80
+ fact arrives. Store the deadline (business-supplied) and compare at the query or screen edge.
81
+ Record a fact only when passing the deadline is itself a business fact (a fee charged, a
82
+ reminder sent): a clock-triggered reaction (`cratis-screenplay-automations-and-translations`).
83
+
84
+ ## Who may see what
85
+
86
+ - `by` and `filter` are values the caller chooses. Anything the caller must not choose (their
87
+ own identity, the tenant) comes from context (`from $context...`), never from a filter.
88
+ - `scoped to global` reaches past the tenant; treat it as a review question.
89
+ - A compiling query is not access control; the target realises it.
90
+
91
+ ## Collections and many-at-once
92
+
93
+ Ask for each field: can there be more than one at the same time? If yes, the view is a list or
94
+ has children, not a single value.
95
+
96
+ ## Building it
97
+
98
+ - Event properties fill read-model properties of the same name automatically (AutoMap), but the
99
+ match differs by binding: a scoped projection matches names case-insensitively and only for
100
+ the same type (Screenplay v4.64.0 `ProjectionValues.cs` `AutoMapped`); a flat-bound projection
101
+ matches exact names only and does not check the type, so a same-named property of another
102
+ type makes the model invalid (`Projections.cs` `BindFlatTransition`). Do not rely on AutoMap
103
+ where it matters: map explicitly when names or types differ, and use `no automap` where an
104
+ event property would land on the identifier.
105
+ - Status words are literals per event (`state = "waiting"` on the request event).
106
+ - Removal is a fact: `remove with <Event>` when the business ends the instance's visibility.
107
+ - Projection mechanics (keys, joins, children, counters): `cratis-screenplay-projections`.
108
+ - A read model that is not built from events uses a query `performer`; its data is outside the
109
+ model's lineage - say where it comes from.
110
+
111
+ ## Omissions are decisions
112
+
113
+ If a view must stop showing cancelled items, use `remove with <Event>` and pin it with
114
+ `then no readmodel <RM> for "<key>"`. If it keeps them, map a status literal from that event
115
+ instead. The slice `description`, the projection and every spec of the view must agree.
116
+ A complete example (marina berths; the `then no readmodel` assertion needs the keyed
117
+ query, which is why the view has one):
118
+
119
+ ```screenplay
120
+ domain Harbourlight.Berths
121
+
122
+ concept BookingId : Uuid
123
+ concept BerthName : String
124
+ validate
125
+ not empty message "A berth needs a name"
126
+ concept BookingState : Enum
127
+ open
128
+ cancelled
129
+
130
+ policy IsAuthenticated
131
+ require authenticated
132
+
133
+ module Berths
134
+ description "Berth bookings for one marina"
135
+ authorize IsAuthenticated
136
+ feature Bookings
137
+ slice StateChange BookBerth
138
+ description "A skipper books a berth"
139
+ command BookBerth
140
+ bookingId BookingId identifier
141
+ berth BerthName
142
+ produces BerthBooked
143
+ for bookingId
144
+ berth = berth
145
+ event BerthBooked
146
+ berth BerthName
147
+ specification BookingABerth
148
+ given caller
149
+ authenticated
150
+ when BookBerth
151
+ bookingId = "3b0c7a14-5d2e-4f61-8a9b-0c1d2e3f4a01"
152
+ berth = "Pier 2, berth 14"
153
+ then BerthBooked
154
+ for "3b0c7a14-5d2e-4f61-8a9b-0c1d2e3f4a01"
155
+ berth = "Pier 2, berth 14"
156
+
157
+ slice StateChange CancelBooking
158
+ description "A skipper cancels a booking they no longer need"
159
+ command CancelBooking
160
+ bookingId BookingId identifier
161
+ produces BookingCancelled
162
+ for bookingId
163
+ event BookingCancelled
164
+
165
+ slice StateView OpenBookings
166
+ description "The harbour office lists bookings that still hold a berth. BerthBooked sets berth: the booking enters the list. BookingCancelled removes it: a cancelled booking never shows."
167
+ readmodel OpenBooking
168
+ bookingId BookingId
169
+ berth BerthName
170
+ query OpenBookingById => OpenBooking optional
171
+ by bookingId BookingId
172
+ projection OpenBookings => OpenBooking
173
+ from BerthBooked
174
+ bookingId = $eventSourceId
175
+ berth = berth
176
+ remove with BookingCancelled
177
+ screen OpenBooking
178
+ title "Open booking"
179
+ data OpenBooking via query OpenBookingById
180
+ action CancelBooking
181
+ specification CancelledBookingLeavesTheList
182
+ given caller
183
+ authenticated
184
+ given BerthBooked
185
+ for "3b0c7a14-5d2e-4f61-8a9b-0c1d2e3f4a01"
186
+ berth = "Pier 2, berth 14"
187
+ given BookingCancelled
188
+ for "3b0c7a14-5d2e-4f61-8a9b-0c1d2e3f4a01"
189
+ then no readmodel OpenBooking for "3b0c7a14-5d2e-4f61-8a9b-0c1d2e3f4a01"
190
+ ```
191
+
192
+ ## Checks before handing off
193
+
194
+ - The StateView slice `description` gives, per contributing event, the fields it sets and why
195
+ (see `LockerBoard` in `worked-example.md`); extend it whenever a `from` is added.
196
+ - Every consumer has its read model; every read model has a consumer.
197
+ - Every field traced (`field-lineage.md`).
198
+ - Executable/renderable scope: one unambiguous key per read model (one or more keyed queries,
199
+ all with the same `by` property), identifier equal to the projection's key (table above);
200
+ no list queries.
201
+ - Design-only shapes listed with the V3 code they cause.
@@ -0,0 +1,23 @@
1
+ # Review questions
2
+
3
+ Ask these while designing and again before the Gate. Report a finding only when it has a
4
+ domain consequence.
5
+
6
+ - Can the persona who should do this reach the command, and may they? Does every persona have
7
+ a screen with data (and an action unless it is a read-only role with a stated purpose)? Can
8
+ someone act for another: role policy, ownership claim, or a separate command?
9
+ - Does this command apply in every state and set most of the entity's fields? That is a form:
10
+ which business reasons hide behind it? What does a person decide with each field?
11
+ - Does a command input carry a secret or personal value (by default the causation chain keeps it; retention is configurable, verify it)?
12
+ Mark the concept `@pii` or record the need for a not-audited marking.
13
+ - Does this optional event property hide two situations, or is it an optional detail?
14
+ - Does an event exist for a derived condition? Only when a domain expert names it and something
15
+ reacts to it; merge causes only when they mean the same to the business.
16
+ - Does a read model or component draw on many events (fan-in)? Split only for a named
17
+ consequence: different owners, change reasons or consistency needs, or a harder screen. High
18
+ fan-in alone is not a finding.
19
+ - Does one screen fire several commands for one intent (one decision)? Can there be more than
20
+ one of these at once (a collection)?
21
+ - Where is each invariant enforced atomically, and what happens if two people try at once or a
22
+ command is retried (`cratis-screenplay-streams-and-consistency`)?
23
+ - Who may see these rows, and is that enforced by scope/`from`, not by a caller filter?
@@ -0,0 +1,41 @@
1
+ # Rule layers
2
+
3
+ Put each rule in the lowest layer where it is true for every caller. Descriptions never reach
4
+ rendered code (Stage#178): a rule that exists only in prose is unenforced in rendered scope.
5
+
6
+ | Rule is about | Layer | Notes |
7
+ |---|---|---|
8
+ | format or meaning of a value, true wherever used | `concept` `validate` | travels with every use; a value some use must accept unchecked is a different concept. One rejection spec per concept (through one command), not per use |
9
+ | a predicate that is not a comparison (checksum, registry format) | `rule <Name>` on the property or concept | design mode; blocks V3 (PLAY0268) |
10
+ | this command's own inputs | command `validate` / `require` | a rule that applies only sometimes is an implication: `require a == false or b > c` |
11
+ | who may ask | `authorize` with a policy (role, claim, authenticated) | enclosing gates combine with AND and run first. Gates every command and query in a feature shares go on the feature or module so a new path inherits them |
12
+ | whose instance | policy `claim "x" matches subject` (the command identifier) or `matches <command property>` | executable; renders only for text-backed subjects (Uuid: STAGE-ESM-015) |
13
+ | uniqueness, once-only facts | `constraint` (`unique ... on`, `unique event`) | append-time; the constraint name is its identity |
14
+ | stored state (record exists, balance, current status) | `reads <View>` + `require <expr> message "..."` | stated intent, **NOT enforced in the model today** (PLAY0268/0271 at binding are expected in design mode; Screenplay#129/#209). Name the target: Arc `[ProtectedDecision]` + `DecisionRead<T>` (Arc 22.39.0 or later), Chronicle DCB (`concurrency` scope), or a constraint |
15
+
16
+ An unguarded materialized read is unsafe for a protected decision; a guarded read is the
17
+ supported route. Availability: `[ProtectedDecision]` and `DecisionRead<T>` need Arc 22.39.0 or
18
+ later and are **not available in Stage-rendered apps**, whose scaffold pins Arc 22.25.0 (Stage
19
+ 4.24.0); never edit the managed dependency files to get them. For rendered scope, record a
20
+ capability gap (or a separately verified compatible enforcement path, such as a constraint or
21
+ a Chronicle DCB scope) and keep the rule as NOT enforced. Forbidden: caller-supplied copies of state in `require`, boolean attestation
22
+ inputs (`confirmsX == true`), rules in `handler` / implementation-hint prose.
23
+
24
+ ## Authorization is executable
25
+
26
+ Persona Does/Reads/Cannot text is intent. Every Cannot line resolves to an `authorize` gate
27
+ (policy or ownership claim) plus a `then denied` spec whose `given caller` carries the roles
28
+ and claims standing for that persona; otherwise record a gap. Every command and query under an
29
+ inherited module/feature `authorize` gets its own `then denied` spec. Ownership gates need a
30
+ second caller with another claim value.
31
+
32
+ ## Secrets and personal data
33
+
34
+ Command property values are, by default, recorded in the causation chain of the events they
35
+ produce, so treat them as permanent. Newer Chronicle versions can omit causation properties
36
+ (`CausationPropertyRetention.Omit`, Chronicle v19.32.0); rendered apps pin Chronicle 19.8.1.
37
+ Verify the actual auditing and retention configuration before relying on omission, and never
38
+ audit secrets. Never mark the identifier's
39
+ concept `@pii`; use a surrogate `Uuid` identity and carry the personal value as a `@pii`
40
+ property. Bearer tokens, magic links and signed URLs are never facts (record a keyed hash or
41
+ reference).
@@ -0,0 +1,122 @@
1
+ # Slicing, state transitions and the next slice
2
+
3
+ ## Slices are the authoring unit
4
+
5
+ In Screenplay every construct already lives in a typed slice, so slicing is not a separate
6
+ step at the end: design each behaviour as its slice, then audit the set.
7
+
8
+ | Slice | Holds | Named after | Default |
9
+ |---|---|---|---|
10
+ | `StateChange` | command, its events, its constraints, specs | the command (`AssignLocker`) | one command per slice; renderable: required |
11
+ | `StateView` | read model, queries, projection/reducer, screen, specs | the view (`LockerBoard`) | one read model per slice |
12
+ | `Automation` | reactions, the events they produce | the behaviour (`RemindUncollectedParcels`) | see `cratis-screenplay-automations-and-translations` |
13
+ | `Translate` | captures, translated events | the integration (`CarrierManifests`) | see `cratis-screenplay-automations-and-translations` |
14
+
15
+ Screenplay allows several commands or read models in one slice; prefer splitting unless the
16
+ behaviour is genuinely one (and say why in the `description`).
17
+
18
+ ## Slice dependencies
19
+
20
+ Record, per slice, the events it consumes and which slice produces each. This is for
21
+ orientation, not a build order: view specifications use synthetic `given` events, so slices
22
+ are built and checked independently. A command or reaction may consult another slice's view
23
+ (`reads`; unprotected in `.play`, see `rule-layers.md`). A slice never calls another slice's
24
+ command except through `invokes`. Dependencies run in one direction; a cycle through events
25
+ means the story is a feedback loop that belongs in an `Automation` slice.
26
+
27
+ For `worked-example.md`:
28
+
29
+ | Slice | Consumes | Produced by | Also reads |
30
+ |---|---|---|---|
31
+ | InstallLocker | none | | |
32
+ | RequestLocker | none | | |
33
+ | AssignLocker | none (appends `LockerAssigned`) | | views LockerSummary, RequestStatus (intent, not enforced) |
34
+ | LockerBoard | LockerInstalled, LockerAssigned | InstallLocker, AssignLocker | |
35
+ | RequestProgress | LockerRequested, LockerAssigned | RequestLocker, AssignLocker | |
36
+
37
+ ## State-transition table (per entity)
38
+
39
+ Rows are states (named after the fact that put the entity there); columns are commands. Each
40
+ cell: the resulting event, or the refusal and where it is enforced. Fill every cell; blank
41
+ cells hide missing decisions.
42
+
43
+ For the locker in `worked-example.md`:
44
+
45
+ | State \ command | InstallLocker | AssignLocker |
46
+ |---|---|---|
47
+ | (none) | LockerInstalled; refused by UniqueLockerNumber if another locker holds the number | refused: `reads` + `require` (the locker is not free / the request is not waiting) - intent, NOT enforced today |
48
+ | installed | refused: LockerInstalledOnce | LockerAssigned; refused by OneLockerPerRequest if the request already has a locker |
49
+ | assigned | refused: LockerInstalledOnce | refused: OneRequestPerLocker |
50
+
51
+ The trap this table caught: `UniqueLockerNumber` alone does not stop the same locker being
52
+ installed twice, because an event source may re-claim its own value. The `unique event`
53
+ constraint closes that hole. Releasing a locker (a later slice) would add `released by` lines
54
+ to both assignment constraints.
55
+
56
+ Mark how each refusal is enforced: `authorize`, `validate`/`require` (inputs only),
57
+ `constraint` (append-time), or **target-enforced** (stored-state; recorded in the slice
58
+ `description` and the handoff as NOT enforced today, see `rule-layers.md`). Terminal states have
59
+ refusals in every column. Add one line per gated command: the caller fixture that must be
60
+ denied (it needs its `then denied` spec).
61
+
62
+ ## Generic edits
63
+
64
+ A command or event named for a form (`UpdateLocker`, `LockerDetailsUpdated`) records that data
65
+ changed, not why. Rules, reactions and history lose their meaning, and the edit path usually
66
+ skips rules the install path enforces. Detect it in the state table: a command with the same
67
+ result in every row and no refusal anywhere, whose event restates most of the entity.
68
+
69
+ 1. List the values the form can change; for each, ask who changes it and why.
70
+ 2. Group values that change together for one reason; each group is a command and an event named
71
+ for that reason (`RelocateLocker` -> `LockerRelocated`; `CorrectLockerVolume` ->
72
+ `LockerVolumeCorrected`). Values nobody changes after installation need no command.
73
+ 3. Give each new command its own state-table column, and fill its cell for every state, with refusals (an assigned locker cannot be
74
+ relocated).
75
+ 4. Apply rule coverage (below) to each new path.
76
+ 5. If the business treats a multi-value data-entry correction as one act, keep one correction
77
+ command named for the correction (never `Update`), with the reason in the slice
78
+ `description`; rule coverage still applies.
79
+
80
+ A repeated-field event is a review signal; it is major only when business meaning is lost, a
81
+ rule is bypassed or consumers become ambiguous. Historical generations repeat prior shape on
82
+ purpose and are exempt.
83
+
84
+ ## Rule coverage
85
+
86
+ For each value that carries a rule, list every path that can set it:
87
+
88
+ | Value | Rule and layer | Paths that set it | Covered? |
89
+ |---|---|---|---|
90
+ | locker number | unique (constraint `UniqueLockerNumber`) | InstallLocker -> LockerInstalled; RenumberLocker -> LockerRenumbered | add `unique number on LockerRenumbered` to the same constraint |
91
+ | volume | at least one litre (concept `validate`) | InstallLocker; CorrectLockerVolume | covered: the concept travels |
92
+ | attendant gate | `authorize` on the feature | every command in the feature | covered: inherited |
93
+
94
+ A constraint covers another event by repeating its `unique` line under the same constraint name
95
+ (the claim is shared) - only when the events set the **same claim**. Command-level
96
+ `validate` / `require` and `produces when` branches do not travel: review each path and copy a
97
+ rule only where that decision needs it; move a format rule into the concept so it travels.
98
+
99
+ ## Slice audit
100
+
101
+ - Every event belongs to exactly one `StateChange` (or `Automation`/`Translate`) slice.
102
+ - Every command has a reachable, authorized origin.
103
+ - Every read model has a consumer and a keyed query when the scope is executable.
104
+ - Every slice has a `description` that states its business purpose.
105
+ - No slice exists only for technical reasons ("set up storage").
106
+
107
+ ## The next slice
108
+
109
+ If the request names the capability, build that one. Otherwise, when the current timeline is
110
+ fully designed, read the slices in story order and choose, preferring in order:
111
+
112
+ 1. the next stage of an existing lifecycle (a locker can be assigned; can it be released?);
113
+ 2. an action a screen implies but nothing implements, or a state change with no confirmation
114
+ view (in the example, the attendant needs a waiting-request view to pick a request);
115
+ 3. a missing ending, correction or reversal - a correction or reversal names what it corrects
116
+ or reverses (`CorrectLockerVolume`), never `Update<Entity>`;
117
+ 4. a notification or follow-up the business expects.
118
+
119
+ Prefer what continues the current story over a new thread. In a modeling session, act: write
120
+ the slice, note the assumption that chose it, and ask for correction afterwards. A wrong guess
121
+ costs one edit; an empty turn costs a round-trip. Record why the slice was chosen in the
122
+ handoff.