@cratis/pi 7.48.4 → 7.50.0

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 (112) hide show
  1. package/package/corpus/agents/screenplay-modeler.md +6 -2
  2. package/package/corpus/agents/screenplay-renderer.md +2 -2
  3. package/package/corpus/agents/screenplay-reviewer.md +2 -1
  4. package/package/corpus/agents/slice-implementer.md +13 -3
  5. package/package/corpus/harnesses/copilot/instructions/react.instructions.md +1 -0
  6. package/package/corpus/hooks/README.md +51 -1
  7. package/package/corpus/hooks/scripts/cratis-guard-writes.sh +75 -0
  8. package/package/corpus/hooks/scripts/cratis-pattern-scan.sh +1 -1
  9. package/package/corpus/hooks/scripts/cratis-patterns.json +8 -0
  10. package/package/corpus/hooks/scripts/cratis-quality-gate.sh +6 -0
  11. package/package/corpus/hooks/scripts/cratis-slice-scope-report.sh +54 -0
  12. package/package/corpus/rules/react.md +1 -0
  13. package/package/corpus/skills/cratis-application-slice-conformance/LICENSE +5 -0
  14. package/package/corpus/skills/cratis-application-slice-conformance/references/build-prompts.md +47 -20
  15. package/package/corpus/skills/cratis-application-slice-conformance/references/checklists.md +8 -1
  16. package/package/corpus/skills/cratis-application-slice-conformance/references/provenance.md +20 -0
  17. package/package/corpus/skills/cratis-application-slice-specifications/LICENSE +4 -0
  18. package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +27 -0
  19. package/package/corpus/skills/cratis-application-slice-specifications/references/provenance.md +15 -0
  20. package/package/corpus/skills/cratis-application-slice-specifications/references/query-and-decision-scenarios.md +8 -0
  21. package/package/corpus/skills/cratis-arc-react-page/LICENSE +4 -0
  22. package/package/corpus/skills/cratis-arc-react-page/references/from-screenplay.md +6 -0
  23. package/package/corpus/skills/cratis-arc-react-page/references/provenance.md +9 -0
  24. package/package/corpus/skills/cratis-chronicle-event-modeling/LICENSE +5 -0
  25. package/package/corpus/skills/cratis-chronicle-event-modeling/SKILL.md +16 -2
  26. package/package/corpus/skills/cratis-chronicle-reactor/LICENSE +4 -0
  27. package/package/corpus/skills/cratis-chronicle-reactor/references/provenance.md +16 -0
  28. package/package/corpus/skills/cratis-chronicle-reactor/references/slice-delivery-checklist.md +38 -0
  29. package/package/corpus/skills/cratis-chronicle-reactor/references/specifications.md +17 -1
  30. package/package/corpus/skills/cratis-chronicle-read-model-specifications/SKILL.md +2 -0
  31. package/package/corpus/skills/cratis-event-model-diagram/LICENSE +5 -0
  32. package/package/corpus/skills/cratis-event-model-diagram/SKILL.md +6 -1
  33. package/package/corpus/skills/cratis-event-model-diagram/references/provenance.md +9 -0
  34. package/package/corpus/skills/cratis-screenplay-automations-and-translations/LICENSE +5 -0
  35. package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +2 -2
  36. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/automation-patterns.md +24 -0
  37. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/integration-contracts.md +19 -0
  38. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/provenance.md +10 -0
  39. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/realization-and-gap-fill.md +1 -1
  40. package/package/corpus/skills/cratis-screenplay-discovery/LICENSE +5 -0
  41. package/package/corpus/skills/cratis-screenplay-discovery/SKILL.md +10 -9
  42. package/package/corpus/skills/cratis-screenplay-discovery/references/divergent-sweep.md +9 -0
  43. package/package/corpus/skills/cratis-screenplay-discovery/references/document-intake.md +123 -0
  44. package/package/corpus/skills/cratis-screenplay-discovery/references/domain-analysis-template.md +15 -1
  45. package/package/corpus/skills/cratis-screenplay-discovery/references/event-naming.md +49 -0
  46. package/package/corpus/skills/cratis-screenplay-discovery/references/facilitation.md +2 -0
  47. package/package/corpus/skills/cratis-screenplay-discovery/references/human-workshop.md +26 -1
  48. package/package/corpus/skills/cratis-screenplay-discovery/references/plotting-and-handoff.md +17 -0
  49. package/package/corpus/skills/cratis-screenplay-discovery/references/provenance.md +13 -0
  50. package/package/corpus/skills/cratis-screenplay-event-modeling/LICENSE +5 -0
  51. package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +7 -5
  52. package/package/corpus/skills/cratis-screenplay-event-modeling/references/nine-steps.md +7 -3
  53. package/package/corpus/skills/cratis-screenplay-event-modeling/references/provenance.md +12 -0
  54. package/package/corpus/skills/cratis-screenplay-legacy-extraction/LICENSE +5 -0
  55. package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +70 -102
  56. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/evidence-table-template.md +101 -4
  57. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/expert-verification.md +32 -1
  58. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/intent-example.md +31 -7
  59. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/interview-findings.md +13 -4
  60. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/loss-report-template.md +9 -0
  61. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/provenance.md +27 -1
  62. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/re-entry-and-passes.md +188 -0
  63. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/rule-modeling.md +9 -0
  64. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/side-car-migration.md +3 -1
  65. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/signal-to-intent.md +57 -1
  66. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/ui-observation.md +6 -1
  67. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/verified-sources.md +20 -0
  68. package/package/corpus/skills/cratis-screenplay-legacy-extraction/verification.json +4 -0
  69. package/package/corpus/skills/cratis-screenplay-model-review/LICENSE +5 -0
  70. package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +28 -50
  71. package/package/corpus/skills/cratis-screenplay-model-review/references/baseline-comparison.md +9 -0
  72. package/package/corpus/skills/cratis-screenplay-model-review/references/business-questions.md +6 -1
  73. package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +2 -2
  74. package/package/corpus/skills/cratis-screenplay-model-review/references/mode-compliance.md +5 -0
  75. package/package/corpus/skills/cratis-screenplay-model-review/references/model-inventory-report.md +51 -3
  76. package/package/corpus/skills/cratis-screenplay-model-review/references/provenance.md +13 -0
  77. package/package/corpus/skills/cratis-screenplay-model-review/references/quick-self-check.md +20 -0
  78. package/package/corpus/skills/cratis-screenplay-model-review/references/stressor-analysis.md +86 -0
  79. package/package/corpus/skills/cratis-screenplay-model-review/references/verified-sources.md +15 -0
  80. package/package/corpus/skills/cratis-screenplay-model-review/references/walkthrough.md +135 -0
  81. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/LICENSE +5 -0
  82. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/core-rules-digest.md +7 -0
  83. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/per-turn-protocol.md +6 -2
  84. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phases.md +16 -1
  85. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/provenance.md +21 -0
  86. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/LICENSE +5 -0
  87. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +13 -11
  88. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/delivery-protocol.md +2 -2
  89. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/{drift-and-ledger.md → drift-and-fallback-record.md} +34 -10
  90. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +12 -11
  91. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/hand-written-changes.md +150 -0
  92. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/provenance.md +11 -1
  93. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/renderability-gate.md +3 -3
  94. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/worked-example.md +2 -2
  95. package/package/corpus/skills/cratis-screenplay-scenario-coverage/LICENSE +5 -0
  96. package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +6 -6
  97. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/coverage-matrix.md +7 -0
  98. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/provenance.md +10 -0
  99. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-catalogue.md +46 -3
  100. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-examples.md +2 -0
  101. package/package/corpus/skills/cratis-screenplay-slice-design/LICENSE +5 -0
  102. package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +5 -4
  103. package/package/corpus/skills/cratis-screenplay-slice-design/references/command-inventory.md +70 -0
  104. package/package/corpus/skills/cratis-screenplay-slice-design/references/field-lineage.md +33 -1
  105. package/package/corpus/skills/cratis-screenplay-slice-design/references/provenance.md +16 -0
  106. package/package/corpus/skills/cratis-screenplay-slice-design/references/read-model-design.md +23 -6
  107. package/package/corpus/skills/cratis-screenplay-slice-design/references/review-questions.md +4 -0
  108. package/package/corpus/skills/cratis-screenplay-slice-design/references/slicing.md +69 -0
  109. package/package/corpus/skills/cratis-screenplay-slice-design/references/worked-example.md +4 -1
  110. package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +1 -0
  111. package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract-exceptions.json +0 -7
  112. package/package.json +1 -1
@@ -3,6 +3,7 @@
3
3
  ## Contents
4
4
 
5
5
  - Command card
6
+ - Values a rule reads
6
7
  - The inventory
7
8
  - Filled for `worked-example.md`
8
9
  - Common mistakes
@@ -26,6 +27,7 @@ Origins: <screen action / form / reaction invokes (event, clock or applic
26
27
  a reaction)
27
28
  Inputs: <property: Concept - who supplies it - why the caller decides it>
28
29
  Identifier: <property naming the instance, or "allocation" with the reason>
30
+ Reads: <per rule: each value it reads, as input | state | context>
29
31
  Rules by layer: <concept validate | command validate/require | authorize | claim policy
30
32
  | constraint | stored-state (NOT enforced, target named)>
31
33
  Success: <event(s) with for <identifier>, payload mapping>
@@ -57,6 +59,70 @@ issues no command; any later command is reached through a reaction. Design
57
59
  these in `cratis-screenplay-automations-and-translations`. Every automation-issued command states
58
60
  what happens when it fails or is retried.
59
61
 
62
+ ## Values a rule reads
63
+
64
+ Before placing a rule in a layer, list every value it reads and classify each one:
65
+
66
+ - **input**: a command property the caller decides.
67
+ - **state**: a `reads <View>` path, or the prior facts of the stream.
68
+ - **context**: the time the decision occurs, the caller, the tenant.
69
+
70
+ Decision state is the part of *state* a rule actually branches on. Derive it from the
71
+ specifications, not from the event's shape: a "given no prior activity" and "given already
72
+ {X}" pair means one flag for {X} (a presence check is a flag or a nullable instance); a
73
+ scenario that discriminates on a value means that value. A `reads` view carries exactly the facts the command's specifications branch on, one field
74
+ per fact. Add nothing because an event happens to carry it.
75
+
76
+ A value that fits none of the three is a gap: a missing input, a missing view or a hidden
77
+ dependency. Do not close it with prose in `description` or `handler`.
78
+
79
+ Context is never a command property. The pipeline supplies who is calling and when, because a
80
+ caller-supplied "who am I" or "what time is it" cannot be trusted, and a field the caller
81
+ fills is still an input. A date the person chooses (a start day, a requested slot) is an
82
+ input; "now" is context. A declarative `require` reads only command properties and read state,
83
+ so a rule over context is a named `rule` with a code body (its `RuleContext` carries
84
+ `Occurred`, `CausedBy` and `Tenant`), or an `authorize` policy when it concerns roles or
85
+ claims. The reference runner cannot execute an opaque body: record that, do not delete the
86
+ rule. When a rule depends on a local calendar day ("before midnight", "a business day"), state
87
+ whose timezone applies and where it comes from (an input, a setting read through a view, or an
88
+ open question).
89
+
90
+ Give each context-reading rule its own inventory row, and have its specification state the
91
+ context it relies on: `given clock` for time, `given caller` or `given caller as <Persona>`
92
+ for the actor. A time rule without `given clock` is not pinned.
93
+
94
+ ~~~screenplay test=unbound
95
+ domain Bikeshare.Rentals
96
+
97
+ concept ReservationId : Uuid
98
+ concept BikeId : Uuid
99
+
100
+ module Rentals
101
+ feature Reservations
102
+ slice StateChange ReserveBike
103
+ command ReserveBike
104
+ reservationId ReservationId identifier
105
+ bikeId BikeId
106
+ startTime DateTime
107
+ validate
108
+ startTime rule StartsAfterRequest message "The start time has already passed"
109
+ ```csharp
110
+ return (DateTimeOffset)context.Value > context.Occurred;
111
+ ```
112
+ produces event BikeReserved
113
+ bikeId BikeId = bikeId
114
+ startTime DateTime = startTime
115
+ reservedAt DateTime = $context.occurred
116
+
117
+ specification RejectingAStartTimeInThePast
118
+ given clock "2026-06-01T09:00:00Z"
119
+ when ReserveBike
120
+ reservationId = "6b2a5f0e-6d1c-4f4e-9f57-3a9a6d3c8b10"
121
+ bikeId = "0d7c3a34-5a43-4c1a-8f7e-9a1c2b3d4e5f"
122
+ startTime = "2026-06-01T08:00:00Z"
123
+ then error "The start time has already passed"
124
+ ~~~
125
+
60
126
  ## The inventory
61
127
 
62
128
  One row per outcome. The layer says where the refusal is enforced; the spec column says
@@ -79,6 +145,8 @@ Rules for filling it:
79
145
  available, including Stage 4.73.1's rendered package set for gap-fill, not emitted
80
146
  protection; Chronicle DCB, or a
81
147
  constraint). It still gets a spec row, because the intended behaviour is the contract.
148
+ - Every rule row names what the rule reads (input, state or context); a context read needs a
149
+ `given clock` or `given caller` in the spec that pins it.
82
150
  - A decided refusal never goes to open questions: it goes here, then to scenarios.
83
151
  - A refusal message is a fact of the design; keep the wording identical in the rule, the
84
152
  inventory and the spec.
@@ -122,6 +190,8 @@ not been asked the refusal questions.
122
190
  - A reaction invoking a gated command without `runs as system role "<Role>"`: the invocation has
123
191
  no caller and is refused; declare the trusted path with the role the gate admits
124
192
  (`cratis-screenplay-automations-and-translations`), never delete the gate.
193
+ - A time- or actor-dependent rule written as if it only read inputs: its specification passes
194
+ for the wrong reason, or cannot be reproduced.
125
195
  - Refusals recorded as prose in the `description` with no layer and no spec row.
126
196
  - Personal data or secrets as command input: values are by default recorded in the causation chain, so treat them as permanent
127
197
  (retention can be configured in newer Chronicle; verify it, never audit secrets).
@@ -2,7 +2,9 @@
2
2
 
3
3
  ## Contents
4
4
 
5
+ - Where information starts
5
6
  - Where values come from, per element
7
+ - Check as you edit
6
8
  - The matrix
7
9
  - The reason line per contributing event
8
10
  - Gap handling
@@ -12,6 +14,12 @@ Every value in the model has a place it comes from and a place it goes. If you c
12
14
  where a field comes from, the model is missing an input, an event field or a decision. If an
13
15
  event field goes nowhere, ask why it is recorded (audit and history are valid answers; say so).
14
16
 
17
+ ## Where information starts
18
+
19
+ Every value starts at one specific place and is carried by name from there: the person's
20
+ input on a screen, the runtime's context (caller, time, tenant), an identifier the runtime
21
+ allocates, or a view's own calculation. A value with no such start is a gap, not a default.
22
+
15
23
  ## Where values come from, per element
16
24
 
17
25
  **Command property**
@@ -23,6 +31,7 @@ event field goes nowhere, ask why it is recorded (audit and history are valid an
23
31
  | the instance being acted on | the `identifier` property, carried from the screen row or route | |
24
32
  | allocated by the runtime | `Type generated` on a required scalar generatable Uuid/String concept (implicit UUID is v7; explicit serialized strategy selects v15, Screenplay 4.147.0+ with strict fixtures and whole-source freshness). CLI 3.57.0 / Stage 4.89.1 render supported strategies; types/combinations retain -028/-038; no concept rules. See command-surface `references/generated-values-and-responses.md` | never a request input or form field; no policy, rule or requirement may read it (`PLAY0273`); return it with `returns`; where a tool cannot bind it, executable scope needs explicit allocation |
25
33
  | an outside party | capture field `$.x` or a reaction trigger value | `cratis-screenplay-automations-and-translations` |
34
+ | time of the decision | not an input: `$context.occurred` in `produces`; a rule reads it as `context.Occurred` in a named rule (`command-inventory.md` *Values a rule reads*) | a date the person chooses is an input; "now" is context |
26
35
  | the caller | not an input: `$context.identity.*` in `produces`; who may act in `authorize`; "acting on own X" is a claim policy matched to the identifier or a command property | never trust a caller-supplied "who am I" |
27
36
 
28
37
  **Event property** - set only in `produces` mappings, from:
@@ -44,6 +53,21 @@ duration, a sum of rows) is recorded as `derived: <expression>` with its origin
44
53
  condition in the matrix, then decide: two commands (two decisions) or one command with an
45
54
  implication rule. Never leave it implicit.
46
55
 
56
+ ## Check as you edit
57
+
58
+ After every edit that adds, renames or removes a field, run the opt-in structural checks on
59
+ the model root rather than waiting for the audit: `field-origins` (a read-model field with no
60
+ origin), `input-surfaces` (a command nothing issues), `data-bindings`, `query-keys` and
61
+ `event-consumers`. Use `--check` on the standalone tool or the MCP `diagnostics` `checks`;
62
+ flags and versions are in `cratis-screenplay-toolchain`. They run only when the whole model
63
+ has no source errors, so fix those first and never read a skipped check as clean.
64
+
65
+ - A finding is a prompt to look, not proof of a gap, and a clean result covers structure only.
66
+ It does not replace the matrix for command inputs, screen fields, reducers or performer views.
67
+ - An origin must be known, not just labeled. Calling an unknown value "allocated", "derived"
68
+ or "from context" to close a row is the same failure as leaving it blank: mark it `gap`
69
+ and ask.
70
+
47
71
  ## The matrix
48
72
 
49
73
  One row per field, per slice touched, built from the `.play` files, not from memory or an
@@ -118,8 +142,16 @@ hop before editing:
118
142
  An explicit mapping to a renamed-away target fails binding (V3, PLAY0273); a property AutoMap
119
143
  used to fill and no longer matches is **not reported** - the field silently stays empty.
120
144
 
145
+ Before an add, check the element one hop further upstream than the stated source. If it already
146
+ carries the value, the requested chain stops too early: extend it to where the value really
147
+ starts (an input, a context value, a generated identifier, a view calculation).
148
+
121
149
  Skip a hop and log why when the field already exists there (add) or is not found on that
122
- element (rename); never skip silently. Report the walk hop by hop: element, field, `updated`
150
+ element (rename); never skip silently. Skipping a hop is also safe when the value already
151
+ arrives there under its old name and an explicit mapping bridges it (hop 3 below). When a hop
152
+ that must carry the value cannot be applied (a persisted event, an accepted slice), do not apply
153
+ the rest as if it had been: stop and route the whole chain to the identity owner. The chain is
154
+ one logical edit. Report the walk hop by hop: element, field, `updated`
123
155
  or `skipped` with the reason (already present; not on this element); name the chain from
124
156
  the consuming element back to the source. Run V1 after the chain edit; if a hop cannot be applied, stop
125
157
  and report that hop. Rename only through the identity-aware path when any hop is persisted
@@ -39,3 +39,19 @@ by Martin Dilger and Nebulit GmbH (https://nebulit.de), used with the explicit c
39
39
  | `.build-kit/.slices/restaurant/*/slice.json` | none in this skill | patterns only; passed to scenario coverage (spec example values that vary one rule) |
40
40
  | `.claude/skills/eventmodeling-identifying-outputs/SKILL.md`, "Common Patterns": status, list, timeline and processor-decision view patterns | `references/read-model-design.md` "Common view patterns" | Adapted closely as a table over `readmodel`, projection and `query`; the pseudo-code blocks became prose |
41
41
  | `.claude/skills/eventmodeling-orchestrating-event-modeling/SKILL.md`, "Recognizing a dedicated business event behind a derived condition": the "is this fact worth a new event" test, producing it by automation, fold only redundant causes, display-only conditions stay projections | `references/derived-condition-events.md` | Adapted closely; the todo-list translation pattern became a `reaction` that `produces` (a pending-work view only when the work can wait, retry or fail); the >3-events heuristic stays in `read-model-design.md`; board placement, 0,0-node scans and `validate_model` batch calls not adopted |
42
+
43
+ ### Eventmodelers Build-Kits
44
+
45
+ Source: https://github.com/Nebulit-GmbH/Eventmodelers-Build-Kits, by Martin Dilger and Nebulit GmbH
46
+ (https://nebulit.de), used with the explicit consent of Martin Dilger and Nebulit GmbH.
47
+
48
+ | Source skill | Used in | How |
49
+ |---|---|---|
50
+ | `eventmodeling-identifying-inputs` | `references/command-inventory.md` *Values a rule reads*; `references/field-lineage.md` | adapted closely: list every value a rule reads and classify it as input, state or context; time, caller and tenant are context, never caller-supplied, and a date the person chooses stays an input; the worked reservation example restated in Screenplay; the upstream mechanism of putting time and the acting user on the command is not adopted |
51
+ | `eventmodeling-information-completeness` | `references/field-lineage.md` *Where information starts*, *Check as you edit* | adapted closely: every value starts at one specific place and is carried by name; an unknown origin is a gap, never labeled to close a row; checked as each field is edited |
52
+ | `eventmodeling-orchestrating-event-modeling` ("Place in narrative order, never type by type"; "Never stack read models at the end"; wide fan-in is the exception; every role has a screen) | `references/slicing.md` *Declare in story order*; `references/read-model-design.md` *Components*, *Fan-in per field*, *Checks before handing off* | copied and translated (story order, translated to declaration order and the `PLAY0516`/`PLAY0517` checks); adapted closely (mixed kinds of computation split by default, with a written reason to keep them; a persona reaches a screen, while a read-only persona stays legitimate) |
53
+ | `eventmodeling-identifying-outputs` (error states shown) and `eventmodeling-elaborating-scenarios` examples | `references/read-model-design.md` *Checks before handing off* | adapted closely: a failure a person must act on shows in a view, or its omission is a stated decision |
54
+ | `eventmodeling-validating-event-models` (deterministic read models, no side effects in a builder; command with several issuers) | `references/read-model-design.md` *Builder and freshness*; `references/review-questions.md` | adapted closely: a builder replays to the same view; several origins of one command are allowed when each makes the same decision (idea; the upstream single-issuer rule is not adopted) |
55
+ | `attributes` (chain edits start at the real origin; one logical edit) | `references/field-lineage.md` *Adding or renaming a field along a chain* | adapted closely |
56
+ | `add-next-slice` (a new screen matches its siblings) | `references/slicing.md` *The next slice* | adapted closely |
57
+ | `build-state-change` (axon, kurrent and umadb stacks): derive decision state from the specifications, one field per fact a scenario branches on | `references/command-inventory.md` *Values a rule reads* | copied and translated |
@@ -99,9 +99,10 @@ usually two views.
99
99
  list whose status is set by booking, cancellation and maintenance events). Do not use that
100
100
  as a reason to fold in fields without the same wide fan-in: a berth's name and pier (set by
101
101
  one or two events) and its live availability (derived across its whole lifecycle) are two
102
- kinds of computation even on one page. Split them when you can name the consequence; if
103
- you keep one view, note which field has the irreducible fan-in and why (in the slice
104
- `description`).
102
+ kinds of computation even on one page. Mixed kinds of computation split by default. Keep one
103
+ view only with a written reason in the slice `documentation` that names the field with the
104
+ irreducible fan-in and why. Fan-in alone, within one kind of computation, splits only for a
105
+ named consequence (next section).
105
106
  - A screen with several components has one `data` line per component, each
106
107
  `data <RM> via query <Q>` from its own read model (several `data` lines per screen are
107
108
  valid; `cratis-screenplay-read-surface`). A split component sits next to its own source
@@ -114,8 +115,10 @@ usually two views.
114
115
  For each read-model field, count the events that set it. More than about three is a signal to
115
116
  look at, not a rule: a status fed by a long lifecycle is normal. Ask whether the field mixes
116
117
  concerns that should be separate views, and whether every contributing event is genuinely a
117
- change to *this* value. Report a problem only when it has a consequence (coupling, a view that
118
- must change whenever unrelated facts change).
118
+ change to *this* value. Within one kind of computation, report a problem only when it has a
119
+ consequence (coupling, a view that must change whenever unrelated facts change). Fields set once
120
+ by one or two events that ride with a field derived across the whole lifecycle are mixed kinds,
121
+ and that case splits by default (Components).
119
122
 
120
123
  ## Builder and freshness
121
124
 
@@ -131,6 +134,12 @@ one read-model instance (compose queries across person-scoped views instead).
131
134
  Every `from` event must set or affect a field (AutoMap counts); otherwise drop it or record why
132
135
  it stays.
133
136
 
137
+ A builder is deterministic: replaying the same events gives the same view. A reducer body reads
138
+ only the event, the current state and the context members the reducer exposes (`context.Occurred`
139
+ for time, never the wall clock). It calls no service, reads no other view and causes no effect.
140
+ Work that needs any of those is an automation that records a fact, which the view then projects.
141
+ Stage admits only pure reducer bodies for the same reason (`cratis-screenplay-projections`).
142
+
134
143
  ## Query shape follows the business view
135
144
 
136
145
  | The person... | Design-mode query | Executable/renderable scope |
@@ -295,8 +304,16 @@ module Berths
295
304
  - Every consumer that needs state has its read model (a blank creation form and a direct reaction
296
305
  with a documented no-pending-work reason need none); every read model has a consumer.
297
306
  - Every field traced (`field-lineage.md`).
307
+ - Every failure, refusal-received or cancellation fact a person must act on shows in some view
308
+ (a status literal plus the reason), or the omission is a stated decision (see "Omissions are
309
+ decisions"). Pin it with a view specification (`cratis-screenplay-scenario-coverage`
310
+ `references/scenario-catalogue.md` section 9).
311
+ - Every persona's Reads line has a screen whose `data` shows it, and every persona's Does line
312
+ reaches a screen or form `action` for that decision. A persona with neither is missing screens
313
+ (add them) or is not part of this scope (revise its Does/Reads in discovery, or record why). A
314
+ read-only persona is legitimate.
298
315
  - Executable scope: one identity per read model: explicit `key`, else agreeing
299
316
  single-instance `by`, else unambiguous `*Id` only with an admitted list query and
300
317
  no single-instance identifier. Queryless views need explicit `key`. The identifier
301
318
  equals the projection's key (table above); check target renderer admission separately.
302
- - Design-only shapes listed with the V3 code they cause.
319
+ - Each design-only shape (one the renderer does not admit) is listed with the V3 diagnostic code it causes.
@@ -22,3 +22,7 @@ domain consequence.
22
22
  - Where is each invariant enforced atomically, and what happens if two people try at once or a
23
23
  command is retried (`cratis-screenplay-streams-and-consistency`)?
24
24
  - Who may see these rows, and is that enforced by scope/`from`, not by a caller filter?
25
+ - Does a command have several origins (a screen action and a reaction, or two personas)? That is
26
+ allowed. Confirm that each origin makes the same decision under the same rules, refusals and
27
+ gate. If one origin needs a different rule or a trusted actor the other must not have, split
28
+ the command.
@@ -3,6 +3,7 @@
3
3
  ## Contents
4
4
 
5
5
  - Slices are the authoring unit
6
+ - Declare in story order
6
7
  - Slice dependencies
7
8
  - State-transition table (per entity)
8
9
  - Generic edits
@@ -25,6 +26,70 @@ step at the end: design each behaviour as its slice, then audit the set.
25
26
  Screenplay allows several commands or read models in one slice; prefer splitting unless the
26
27
  behaviour is genuinely one (and say why in `documentation`).
27
28
 
29
+ ## Declare in story order
30
+
31
+ Deciding which slices exist is separate from deciding the order you write them. Write them left
32
+ to right as the story happens, one slice at a time: the `StateChange` slice that records a fact,
33
+ then the `StateView` slice (read model, projection, query, screen) that the fact feeds, then the
34
+ next `StateChange`. Never write all commands, then all views, or any other batch by kind. The
35
+ board draws authored declaration and import order, so a batch by kind shows a row of commands
36
+ with the views bunched at the end, cut off from the facts they come from, and no slice reads as
37
+ one self-contained step of the story. A list grouped by slice type is for counting and review
38
+ (`cratis-screenplay-delivery-planning`), never the declaration order.
39
+
40
+ The compiler checks the result against the presentation timeline. `PLAY0516` (information)
41
+ marks a projection, reducer rule or named reaction trigger that uses an event from a slice drawn
42
+ to its right, or a `reads` of a view whose builder is drawn later. `PLAY0517` marks a mutually
43
+ dependent sibling group that no order can fix. Neither fails `--warnaserror`, so read them after
44
+ each batch:
45
+
46
+ - Move the producer first. MCP and C# workspaces offer a typed repair that moves a sibling or
47
+ pins an import. It changes no executable bytes or identities.
48
+ - A view that legitimately reflects a later fact (a waiting list that drops a request once it
49
+ is assigned) may stay where its screen beat is. Say why in the slice `documentation`.
50
+ - Feedback reads (a command reading a summary built from facts its own side produces) are
51
+ excluded by the compiler and need nothing.
52
+
53
+ A folder model needs an ordering root (a sole root, an importing `application.play`, or a unique
54
+ importing root). Without one the check is skipped, which does not mean clean
55
+ (`cratis-screenplay-toolchain`). The `remove with BerthAssigned` line below is the kept case:
56
+ the waiting list legitimately drops a request when the later slice assigns it.
57
+
58
+ ```screenplay expect PLAY0516
59
+ domain Harbour.Moorings
60
+
61
+ concept BerthRequestId : Uuid
62
+ concept BoatName : String
63
+ concept BerthNumber : String
64
+
65
+ module Moorings
66
+ feature SeasonalBerths
67
+ slice StateChange RequestBerth
68
+ command RequestBerth
69
+ berthRequestId BerthRequestId identifier
70
+ boatName BoatName
71
+ produces event BerthRequested
72
+ boatName BoatName = boatName
73
+ slice StateView WaitingList
74
+ readmodel WaitingRequest
75
+ berthRequestId BerthRequestId
76
+ boatName BoatName
77
+ projection WaitingList => WaitingRequest
78
+ from BerthRequested
79
+ berthRequestId = $eventSourceId
80
+ remove with BerthAssigned
81
+ query WaitingRequests => WaitingRequest[]
82
+ screen WaitingListPage
83
+ data WaitingRequest via query WaitingRequests
84
+ action AssignBerth
85
+ slice StateChange AssignBerth
86
+ command AssignBerth
87
+ berthRequestId BerthRequestId identifier
88
+ berthNumber BerthNumber
89
+ produces event BerthAssigned
90
+ berthNumber BerthNumber = berthNumber
91
+ ```
92
+
28
93
  ## Slice dependencies
29
94
 
30
95
  Record, per slice, the events it consumes and which slice produces each. This is for
@@ -184,6 +249,10 @@ fully designed, read the slices in story order and choose, preferring in order:
184
249
  or reverses (`CorrectLockerVolume`), never `Update<Entity>`;
185
250
  4. a notification or follow-up the business expects.
186
251
 
252
+ If the new slice adds a screen in a model that already composes its UI (templates, layout), give
253
+ it the template its sibling screens use (`cratis-screenplay-ui-composition`). A new screen always
254
+ has `data` or an `action`, never a placeholder.
255
+
187
256
  Apply this heuristic only when the brief authorizes selecting another capability; when the
188
257
  requested scope is complete or no supported candidate remains, close the turn without inventing
189
258
  work (scope ownership: `cratis-screenplay-modeling-lifecycle`). Prefer what continues the
@@ -21,7 +21,10 @@ The historical source below stays unchanged; it is not the current placement rec
21
21
  The excerpt's Stage availability note is historical (Stage 4.24.x, Arc 22.25.0).
22
22
  Stage 4.73.1's scaffold pins an Arc/Chronicle set (see the Stage skill's `references/rendered-application.md`), so protected-read APIs are available
23
23
  to gap-fill (the compiled description below saying they are "not available in Stage-rendered apps" is superseded); this neither admits these `.play` rules nor proves target protection.
24
- The original compiled excerpt is retained unchanged.
24
+ The original compiled excerpt is retained unchanged. Its `expect PLAY0516` is the story-order
25
+ information (`slicing.md` "Declare in story order"): the `LockerBoard` view consumes
26
+ `LockerAssigned` from the feature declared after it. A new model declares the producing feature
27
+ first and carries no such information.
25
28
 
26
29
  ```screenplay expect PLAY0516 test=unbound
27
30
  domain Parcelpoint.Lockers
@@ -261,6 +261,7 @@ criterion.
261
261
  For every specification:
262
262
 
263
263
  - [ ] Concrete, realistic values — never "valid user" or "some amount".
264
+ - [ ] The values the outcome depends on are visible in the body, at the edge that matters.
264
265
  - [ ] Tests exactly one behavior, independent of other specifications.
265
266
  - [ ] Business language matching the event-model vocabulary.
266
267
 
@@ -48,13 +48,6 @@
48
48
  "value": "37",
49
49
  "reason": "Measured historical CLI 3.43.0 transcript, whose bundled Screenplay 4.127.0 exposes 37 tools. Current compiler and bundle versions are in Documentation/compatibility.md; this count describes only that transcript. Remove when the transcript is removed or replaced."
50
50
  },
51
- {
52
- "file": ".cratis/ai/skills/cratis-screenplay-model-review/SKILL.md",
53
- "text": "| Screenplay | `v4.66.0` (`c89198b`) | MCP catalog (29 tools: `describe-application`, `search-declarations`, `dependencies`, `find-assertion-gaps`, `read-workspace`, `declaration-details`) in `Source/DotNET/Screenplay.Mcp/McpToolCatalog.cs`; diagnostics PLAY0029, PLAY0191, PLAY0268, PLAY0271, PLAY0350, PLAY0381, PLAY0469 in `Source/DotNET/Screenplay/Diagnostics/DiagnosticCodes.cs`; decision 0008 (one data subject per event) |",
54
- "kind": "toolCount",
55
- "value": "29",
56
- "reason": "Source evidence explicitly pinned to v4.66.0. Remove when this older source vector is removed or replaced."
57
- },
58
51
  {
59
52
  "file": ".cratis/ai/skills/cratis-screenplay-toolchain/references/diagnostics.md",
60
53
  "text": "| PLAY0686 | Retired | Differing event pins travel as `storedName` in ESM v16. MCP's compatibility `eventPinWarnings` array is empty. Renderer admission is separate: a renderer that does not admit v16 must refuse the model rather than render it under the new name. |",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "7.48.4",
3
+ "version": "7.50.0",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [