@cratis/pi 7.14.2 → 7.14.4

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 (186) hide show
  1. package/package/corpus/skills/cratis-application-slice-conformance/SKILL.md +11 -2
  2. package/package/corpus/skills/cratis-application-slice-conformance/references/build-prompts.md +8 -0
  3. package/package/corpus/skills/cratis-application-slice-conformance/references/checklists.md +10 -6
  4. package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +1 -1
  5. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/SKILL.md +11 -7
  6. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authentication.md +12 -2
  7. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authorization.md +16 -1
  8. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/frontend.md +7 -0
  9. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/observable-emission-guards.md +9 -0
  10. package/package/corpus/skills/cratis-arc-command/SKILL.md +20 -15
  11. package/package/corpus/skills/cratis-arc-command/references/command-result.md +7 -0
  12. package/package/corpus/skills/cratis-arc-command/references/handler-shapes.md +10 -3
  13. package/package/corpus/skills/cratis-arc-command-execution/SKILL.md +1 -1
  14. package/package/corpus/skills/cratis-arc-command-operation/SKILL.md +5 -1
  15. package/package/corpus/skills/cratis-arc-command-operation/references/execution-and-recovery.md +12 -0
  16. package/package/corpus/skills/cratis-arc-command-operation/references/testing.md +10 -3
  17. package/package/corpus/skills/cratis-arc-command-typescript/SKILL.md +20 -116
  18. package/package/corpus/skills/cratis-arc-command-typescript/references/chronicle-events.md +11 -8
  19. package/package/corpus/skills/cratis-arc-command-typescript/references/command-specifications.md +63 -0
  20. package/package/corpus/skills/cratis-arc-command-typescript/references/hosting-and-storage.md +10 -0
  21. package/package/corpus/skills/cratis-arc-command-typescript/references/proxy-generation.md +38 -0
  22. package/package/corpus/skills/cratis-arc-command-typescript/references/slice-layout.md +19 -0
  23. package/package/corpus/skills/cratis-arc-command-typescript/verification.json +1 -1
  24. package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +1 -1
  25. package/package/corpus/skills/cratis-arc-query-paging/SKILL.md +11 -10
  26. package/package/corpus/skills/cratis-arc-react-page/SKILL.md +30 -19
  27. package/package/corpus/skills/cratis-arc-react-page/references/data-page.md +11 -0
  28. package/package/corpus/skills/cratis-arc-react-page/references/data-tables.md +10 -0
  29. package/package/corpus/skills/cratis-arc-react-page/references/dialogs.md +12 -10
  30. package/package/corpus/skills/cratis-arc-react-page/references/from-screenplay.md +10 -0
  31. package/package/corpus/skills/cratis-arc-react-page/references/mvvm.md +11 -0
  32. package/package/corpus/skills/cratis-arc-react-page/references/queries-and-commands.md +7 -0
  33. package/package/corpus/skills/cratis-chronicle-client-dotnet/SKILL.md +58 -122
  34. package/package/corpus/skills/cratis-chronicle-client-dotnet/references/compatibility-check.md +26 -0
  35. package/package/corpus/skills/cratis-chronicle-client-dotnet/references/discovery.md +22 -0
  36. package/package/corpus/skills/cratis-chronicle-client-dotnet/references/hosting.md +31 -0
  37. package/package/corpus/skills/cratis-chronicle-client-elixir/SKILL.md +52 -131
  38. package/package/corpus/skills/cratis-chronicle-client-elixir/references/append-api.md +19 -0
  39. package/package/corpus/skills/cratis-chronicle-client-elixir/references/variants.md +73 -0
  40. package/package/corpus/skills/cratis-chronicle-client-kotlin/SKILL.md +29 -232
  41. package/package/corpus/skills/cratis-chronicle-client-kotlin/references/connection-lifecycle.md +20 -0
  42. package/package/corpus/skills/cratis-chronicle-client-kotlin/references/discovery-and-registration.md +44 -0
  43. package/package/corpus/skills/cratis-chronicle-client-kotlin/references/java-api.md +33 -0
  44. package/package/corpus/skills/cratis-chronicle-client-kotlin/references/spring-boot.md +54 -0
  45. package/package/corpus/skills/cratis-chronicle-client-kotlin/references/variants.md +77 -0
  46. package/package/corpus/skills/cratis-chronicle-client-typescript/SKILL.md +26 -102
  47. package/package/corpus/skills/cratis-chronicle-client-typescript/references/read-models-and-projections.md +23 -0
  48. package/package/corpus/skills/cratis-chronicle-client-typescript/references/variants.md +63 -0
  49. package/package/corpus/skills/cratis-chronicle-event-type-migration/SKILL.md +13 -13
  50. package/package/corpus/skills/cratis-chronicle-mcp-inspection/SKILL.md +1 -1
  51. package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +13 -4
  52. package/package/corpus/skills/cratis-chronicle-projection/references/fluent-builder.md +10 -0
  53. package/package/corpus/skills/cratis-chronicle-projection/references/model-bound-attributes.md +14 -6
  54. package/package/corpus/skills/cratis-chronicle-projection/references/variants.md +9 -0
  55. package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +7 -49
  56. package/package/corpus/skills/cratis-chronicle-reactor/references/domain-failures.md +19 -0
  57. package/package/corpus/skills/cratis-chronicle-reactor/references/specifications.md +33 -0
  58. package/package/corpus/skills/cratis-chronicle-read-model/SKILL.md +2 -2
  59. package/package/corpus/skills/cratis-chronicle-read-model/references/queries.md +11 -0
  60. package/package/corpus/skills/cratis-chronicle-read-model-specifications/SKILL.md +1 -0
  61. package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +1 -1
  62. package/package/corpus/skills/cratis-chronicle-web-workbench/SKILL.md +24 -24
  63. package/package/corpus/skills/cratis-content-length/SKILL.md +1 -1
  64. package/package/corpus/skills/cratis-content-length/references/length-evidence.md +12 -0
  65. package/package/corpus/skills/cratis-developer-marketing/SKILL.md +19 -19
  66. package/package/corpus/skills/cratis-developer-marketing/references/measurement.md +10 -0
  67. package/package/corpus/skills/cratis-developer-marketing/references/playbook-evidence.md +10 -0
  68. package/package/corpus/skills/cratis-engineering-csharp-conventions/SKILL.md +5 -0
  69. package/package/corpus/skills/cratis-engineering-csharp-conventions/references/code-style.md +15 -0
  70. package/package/corpus/skills/cratis-engineering-csharp-conventions/references/exceptions-logging-and-di.md +9 -4
  71. package/package/corpus/skills/cratis-engineering-decision-record/SKILL.md +1 -2
  72. package/package/corpus/skills/cratis-engineering-decision-record/references/record-format.md +8 -0
  73. package/package/corpus/skills/cratis-engineering-docs-authoring/SKILL.md +1 -2
  74. package/package/corpus/skills/cratis-engineering-effect-boundaries/references/failure-archetypes.md +10 -0
  75. package/package/corpus/skills/cratis-fundamentals-concept/SKILL.md +1 -1
  76. package/package/corpus/skills/cratis-fundamentals-type-discovery/SKILL.md +1 -1
  77. package/package/corpus/skills/cratis-lens-browser-extension/SKILL.md +18 -18
  78. package/package/corpus/skills/cratis-performance-review/SKILL.md +1 -1
  79. package/package/corpus/skills/cratis-release-notes/SKILL.md +1 -0
  80. package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +29 -4
  81. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/automation-patterns.md +16 -4
  82. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/effects-and-idempotency.md +4 -15
  83. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/todo-list-example.md +6 -2
  84. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translation-patterns.md +1 -6
  85. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +45 -245
  86. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/capture-map-and-example.md +42 -0
  87. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/complete-examples.md +155 -0
  88. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/specifying-triggers-and-clock.md +27 -0
  89. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/trigger-reads-example.md +21 -0
  90. package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +69 -227
  91. package/package/corpus/skills/cratis-screenplay-command-surface/references/context.md +10 -0
  92. package/package/corpus/skills/cratis-screenplay-command-surface/references/generated-values-and-responses.md +51 -0
  93. package/package/corpus/skills/cratis-screenplay-command-surface/references/inline-events.md +62 -0
  94. package/package/corpus/skills/cratis-screenplay-command-surface/references/policy-persona-seed.md +46 -0
  95. package/package/corpus/skills/cratis-screenplay-command-surface/references/validate-rules.md +36 -0
  96. package/package/corpus/skills/cratis-screenplay-command-surface/verification.json +11 -11
  97. package/package/corpus/skills/cratis-screenplay-discovery/SKILL.md +10 -3
  98. package/package/corpus/skills/cratis-screenplay-discovery/references/facilitation.md +1 -6
  99. package/package/corpus/skills/cratis-screenplay-discovery/references/human-workshop.md +13 -0
  100. package/package/corpus/skills/cratis-screenplay-discovery/references/personas-and-causes.md +8 -0
  101. package/package/corpus/skills/cratis-screenplay-discovery/references/plotting-and-handoff.md +11 -0
  102. package/package/corpus/skills/cratis-screenplay-discovery/references/storming-loop.md +7 -0
  103. package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +75 -198
  104. package/package/corpus/skills/cratis-screenplay-event-modeling/references/file-layout.md +89 -0
  105. package/package/corpus/skills/cratis-screenplay-event-modeling/references/naming-primitives.md +26 -0
  106. package/package/corpus/skills/cratis-screenplay-event-modeling/references/nine-steps.md +14 -1
  107. package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +8 -0
  108. package/package/corpus/skills/cratis-screenplay-event-modeling/references/provenance.md +10 -0
  109. package/package/corpus/skills/cratis-screenplay-event-modeling/references/slice-type-rules.md +12 -0
  110. package/package/corpus/skills/cratis-screenplay-event-modeling/verification.json +12 -6
  111. package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +5 -6
  112. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/candidate-inventory.md +11 -0
  113. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/prologue-safety.md +8 -0
  114. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/side-car-migration.md +11 -0
  115. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/ui-observation.md +1 -1
  116. package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +33 -10
  117. package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +8 -0
  118. package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-loop.md +13 -17
  119. package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +11 -0
  120. package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +9 -9
  121. package/package/corpus/skills/cratis-screenplay-model-review/references/business-questions.md +9 -0
  122. package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +15 -0
  123. package/package/corpus/skills/cratis-screenplay-model-review/references/report-template.md +9 -0
  124. package/package/corpus/skills/cratis-screenplay-model-review/references/worked-example.md +9 -0
  125. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/SKILL.md +17 -8
  126. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/handoff-template.md +8 -0
  127. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/identity-and-edits.md +1 -6
  128. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phases.md +19 -0
  129. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/safety.md +1 -1
  130. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/verdicts-and-modes.md +11 -1
  131. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md +2 -2
  132. package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +3 -4
  133. package/package/corpus/skills/cratis-screenplay-projections/references/pdl-grammar.md +8 -0
  134. package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +2 -2
  135. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +3 -3
  136. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +1 -1
  137. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/worked-example.md +8 -0
  138. package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +10 -10
  139. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/coverage-matrix.md +8 -0
  140. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/invoicing-dues-example.md +4 -0
  141. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-catalogue.md +17 -0
  142. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-examples.md +10 -0
  143. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-workshop.md +11 -0
  144. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/view-and-story-specs.md +12 -0
  145. package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +2 -2
  146. package/package/corpus/skills/cratis-screenplay-slice-design/references/command-inventory.md +7 -0
  147. package/package/corpus/skills/cratis-screenplay-slice-design/references/field-lineage.md +8 -0
  148. package/package/corpus/skills/cratis-screenplay-slice-design/references/read-model-design.md +16 -0
  149. package/package/corpus/skills/cratis-screenplay-slice-design/references/slicing.md +10 -0
  150. package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +52 -360
  151. package/package/corpus/skills/cratis-screenplay-specifications/references/actions-beyond-commands.md +34 -0
  152. package/package/corpus/skills/cratis-screenplay-specifications/references/concept-rules.md +77 -0
  153. package/package/corpus/skills/cratis-screenplay-specifications/references/generated-fixtures.md +39 -0
  154. package/package/corpus/skills/cratis-screenplay-specifications/references/reactions-and-cascades.md +72 -0
  155. package/package/corpus/skills/cratis-screenplay-specifications/references/worked-example.md +110 -0
  156. package/package/corpus/skills/cratis-screenplay-specifications/verification.json +6 -6
  157. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +21 -1
  158. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md +13 -0
  159. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/chronicle-boundaries.md +1 -1
  160. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/consistency-and-concurrency.md +16 -20
  161. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-patterns.md +16 -0
  162. package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +13 -7
  163. package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +10 -0
  164. package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +10 -0
  165. package/package/corpus/skills/cratis-screenplay-toolchain/references/generated-responses-example.md +1 -1
  166. package/package/corpus/skills/cratis-screenplay-toolchain/references/traps.md +1 -1
  167. package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +10 -0
  168. package/package/corpus/skills/cratis-screenplay-toolchain/references/versions.md +12 -0
  169. package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +11 -13
  170. package/package/corpus/skills/cratis-screenplay-ui-composition/references/flow-review.md +1 -1
  171. package/package/corpus/skills/cratis-social-feed-post/SKILL.md +10 -10
  172. package/package/corpus/skills/cratis-social-feed-post/references/engagement-evidence.md +12 -0
  173. package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +13 -2
  174. package/package/corpus/skills/cratis-specifications-csharp/references/application-scenarios.md +10 -10
  175. package/package/corpus/skills/cratis-specifications-csharp/references/csharp-patterns.md +10 -0
  176. package/package/corpus/skills/cratis-specifications-csharp/references/integration-specs.md +9 -0
  177. package/package/corpus/skills/cratis-specifications-typescript/SKILL.md +1 -2
  178. package/package/corpus/skills/cratis-specifications-typescript/references/typescript-patterns.md +11 -1
  179. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +30 -21
  180. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +9 -0
  181. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/render-example.md +5 -0
  182. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/sandbox-and-specrunner.md +2 -4
  183. package/package/corpus/skills/cratis-studio-mcp-safety-guidance/SKILL.md +2 -2
  184. package/package/corpus/skills/cratis-writing-voice-and-cadence/SKILL.md +39 -39
  185. package/package/corpus/skills/cratis-writing-voice-and-cadence/references/ai-tells.md +10 -0
  186. package/package.json +1 -1
@@ -1,5 +1,13 @@
1
1
  # Complete examples for the excerpts in SKILL.md
2
2
 
3
+ ## Contents
4
+
5
+ - Capture with `source`, `map`, `append` and `children`
6
+ - Reaction on a declared trigger with `where` and `invokes`
7
+ - Reaction with `produces` and `invokes`
8
+ - Trigger `reads` on an event and on the clock
9
+ - Complete example (ESM v6)
10
+
3
11
  Each document below is complete and compiles with the standalone `screenplay` 4.68.0
4
12
  (`--warnaserror`). The SKILL.md excerpts show the reaction, capture or trigger part of
5
13
  these documents. Documents marked ESM v6 need Screenplay 4.61 or later: the standalone tool and `cratis` 3.28.2
@@ -181,3 +189,150 @@ module Collections
181
189
  reads OverdueInvoice
182
190
  file Reactions/SweepOverdueInvoices.cs
183
191
  ```
192
+
193
+ ## Complete example (ESM v6)
194
+
195
+ One document with every construct below: an application trigger, a reaction on an
196
+ event, on a trigger (with `where` and `invokes`), on a view read and on the clock, and
197
+ a capture with its specifications. The excerpts later in this skill have their own
198
+ complete parent documents in `references/complete-examples.md`.
199
+
200
+ ```screenplay
201
+ concept InvoiceId : Uuid
202
+ trigger PaymentFileArrived
203
+ description "The bank's payment file listed a payment for an invoice"
204
+ invoiceId InvoiceId
205
+ amount Decimal
206
+ module Collections
207
+ feature Invoices
208
+ slice StateChange SendInvoice
209
+ command SendInvoice
210
+ invoiceId InvoiceId identifier
211
+ amount Decimal
212
+ produces InvoiceSent
213
+ for invoiceId
214
+ invoiceId = invoiceId
215
+ amount = amount
216
+ sentAt = $context.occurred
217
+ event InvoiceSent
218
+ invoiceId InvoiceId
219
+ amount Decimal
220
+ sentAt DateTime
221
+ slice StateChange CloseInvoice
222
+ command CloseInvoice
223
+ invoiceId InvoiceId identifier
224
+ reason String
225
+ validate
226
+ reason not empty message "A reason is required"
227
+ produces InvoiceClosed
228
+ for invoiceId
229
+ reason = reason
230
+ event InvoiceClosed
231
+ reason String
232
+ constraint OnlyClosedOnce
233
+ unique event InvoiceClosed
234
+ slice StateView InvoiceBalances
235
+ readmodel InvoiceBalance
236
+ invoiceId InvoiceId
237
+ outstanding Decimal
238
+ query InvoiceBalanceById => InvoiceBalance optional
239
+ by invoiceId InvoiceId
240
+ projection InvoiceBalances => InvoiceBalance
241
+ from InvoiceSent
242
+ invoiceId = $eventSourceId
243
+ outstanding = amount
244
+ slice StateChange SendPaymentReminder
245
+ command SendPaymentReminder
246
+ invoiceId InvoiceId identifier
247
+ produces PaymentReminderSent
248
+ for invoiceId
249
+ reminderNumber = 1
250
+ event PaymentReminderSent
251
+ reminderNumber Int
252
+ slice Automation Reminders
253
+ reaction RemindOnDueDate
254
+ description "Reminds the customer when an invoice falls due unpaid"
255
+ when InvoiceFellDue
256
+ invoiceId
257
+ reads InvoiceBalance as balance by invoiceId
258
+ invokes SendPaymentReminder
259
+ invoiceId = invoiceId
260
+ reaction ReminderScheduler
261
+ description "Schedules a reminder when an invoice is sent"
262
+ when InvoiceSent
263
+ invoiceId
264
+ produces ReminderScheduled
265
+ scheduledAt = $context.occurred
266
+ reaction PaymentImporter
267
+ description "Closes an invoice the bank file shows as paid"
268
+ when PaymentFileArrived
269
+ invoiceId
270
+ amount
271
+ invokes CloseInvoice
272
+ invoiceId = invoiceId
273
+ reason = "paid"
274
+ where amount > 0
275
+ reaction WeeklyDigest
276
+ description "Issues the collections digest every Monday morning"
277
+ at 07:30 on Monday
278
+ produces DigestIssued
279
+ for "weekly"
280
+ issuedAt = $context.occurred
281
+ event InvoiceFellDue
282
+ invoiceId InvoiceId
283
+ event ReminderScheduled
284
+ scheduledAt DateTime
285
+ event DigestIssued
286
+ issuedAt DateTime
287
+ specification SchedulingAReminderWhenAnInvoiceIsSent
288
+ given clock "2026-10-02T09:00:00Z"
289
+ when append InvoiceSent
290
+ for "9c858901-8a57-4791-81fe-4c455b099bc9"
291
+ invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
292
+ amount = 120
293
+ sentAt = "2026-10-02T09:00:00Z"
294
+ then ReminderScheduled
295
+ for "9c858901-8a57-4791-81fe-4c455b099bc9"
296
+ scheduledAt = "2026-10-02T09:00:00Z"
297
+ specification ClosingAPaidInvoice
298
+ when trigger PaymentFileArrived
299
+ invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
300
+ amount = 120
301
+ then InvoiceClosed
302
+ for "9c858901-8a57-4791-81fe-4c455b099bc9"
303
+ reason = "paid"
304
+ specification IssuingTheWeeklyDigest
305
+ given clock "2026-10-05T07:00:00Z"
306
+ when clock "2026-10-05T07:30:00Z"
307
+ then DigestIssued
308
+ for "weekly"
309
+ issuedAt = "2026-10-05T07:30:00Z"
310
+ slice Translate LegacyInvoiceSync
311
+ capture LegacyInvoiceCapture
312
+ source api
313
+ api LegacyInvoicingApi
314
+ route /invoices
315
+ poll 5m
316
+ key id
317
+ map
318
+ status = status translate
319
+ "sendt" => sent
320
+ "betalt" => paid
321
+ append LegacyInvoicePaid
322
+ tag legacy
323
+ when status from "sent" to "paid"
324
+ paidAt = $context.occurred
325
+ event LegacyInvoicePaid
326
+ paidAt DateTime
327
+ specification SeeingALegacyPayment
328
+ given clock "2026-10-02T12:00:00Z"
329
+ given capture LegacyInvoiceCapture
330
+ id = "inv-42"
331
+ status = "sendt"
332
+ when capture LegacyInvoiceCapture
333
+ id = "inv-42"
334
+ status = "betalt"
335
+ then LegacyInvoicePaid
336
+ for "inv-42"
337
+ paidAt = "2026-10-02T12:00:00Z"
338
+ ```
@@ -0,0 +1,27 @@
1
+ # Specifying triggers and the clock
2
+
3
+ **Specify what sets them off** (v4.48.0, checked at tag `v4.48.0`, commit
4
+ `3baf4a4`; execution from ESM v6, checked at `v4.66.0`): `when clock "<instant>"`
5
+ for a reaction on `every` or `at`, `when trigger <Trigger>` with its values for one
6
+ on an application trigger, and `given capture` / `when capture <Capture>` with the
7
+ source record's fields for a capture, then the events that should follow.
8
+ `given clock` fixes the occurrence time, so values mapped from `$context.occurred`
9
+ can be asserted. Excerpt of the complete example in [complete-examples.md](complete-examples.md):
10
+
11
+ ```screenplay excerpt
12
+ specification IssuingTheWeeklyDigest
13
+ given clock "2026-10-05T07:00:00Z"
14
+ when clock "2026-10-05T07:30:00Z"
15
+ then DigestIssued
16
+ for "weekly"
17
+ issuedAt = "2026-10-05T07:30:00Z"
18
+ ```
19
+
20
+ Under `cratis` before 3.28.2 these actions parsed and were checked against the application
21
+ but bound to nothing (`PLAY0268` names ESM v6, decision 0022); on 3.28.2 they bind. Either way
22
+ no command runs them: report such a specification as authored, not executed. Clock rules: the clock is UTC and exact; an
23
+ occurrence fires once when it is **due after `given clock` and at or before
24
+ `when clock`**, in time order; intervals count from the Unix epoch; `when clock`
25
+ needs `given clock`, so equal instants fire nothing. Limits: 10,000 occurrences per
26
+ advance, 1,000 new facts per scenario. Spec grammar and outcome comparison:
27
+ `cratis-screenplay-specifications`.
@@ -0,0 +1,21 @@
1
+ # Trigger reads example
2
+
3
+ ## Trigger `reads` excerpt
4
+
5
+ ```screenplay excerpt
6
+ slice Automation ChaseOverdueInvoices
7
+ reaction RemindOnDueDate
8
+ description "Reminds the customer when an invoice falls due unpaid"
9
+ when InvoiceFellDue
10
+ invoiceId
11
+ reads InvoiceBalance as balance by invoiceId
12
+ invokes SendPaymentReminder
13
+ invoiceId = invoiceId
14
+ channel = "email"
15
+ file Reactions/RemindOnDueDate.cs
16
+ reaction SweepOverdueInvoices
17
+ description "Re-checks every overdue invoice each morning"
18
+ at 08:00
19
+ reads OverdueInvoice
20
+ file Reactions/SweepOverdueInvoices.cs
21
+ ```
@@ -46,6 +46,55 @@ use the newer main commit above; do not attribute their verification to the old
46
46
  each construct binds to, is in the `cratis-screenplay-model-authoring` language
47
47
  reference.
48
48
 
49
+ ## `concept` and `type`
50
+
51
+ ```screenplay
52
+ concept InvoiceId : Uuid
53
+ concept DiscountPercentage : Decimal
54
+ validate
55
+ >= 0 message "A discount cannot be negative"
56
+ <= 100 message "A discount cannot exceed 100 percent"
57
+ concept PersonName : String @pii
58
+ pii reason "Billing contact name; lawful basis: contract performance."
59
+ concept InvoiceStatus : Enum
60
+ draft
61
+ sent
62
+ paid
63
+ ```
64
+
65
+ The seven primitives are `Uuid`, `String`, `Int`, `Decimal`, `Bool`, `Date` and
66
+ `DateTime`. `Enum` is **not** one of them — it is a separate concept kind, which
67
+ is why the compiler says *expected … or Enum* rather than listing it among them.
68
+ Attributes `@pii` and `@sensitive`, each with at most one `reason`; a
69
+ reason for an attribute the concept does not declare is an error. **Compliance is
70
+ inherited** — a property typed with a `@pii` concept is PII everywhere. The
71
+ executable model does not bind compliance attributes (`PLAY0268`, "compliance attributes
72
+ require portable data-subject semantics"), so a `@pii` model stops at authorable (V1);
73
+ keep the attribute, because the classification is the point, and never drop it to bind
74
+ or render.
75
+
76
+ `@pii` is personal data (erasable); `@sensitive` is an **operational secret** (API key,
77
+ token, a company's bank account number): encrypted at rest without erasure and withheld
78
+ from the causation chain (Screenplay decision 0034, Screenplay#384). C# providers render
79
+ `@sensitive` as `[Encrypted]` + `[NotAudited]`, `@pii` as `[PII]`, and `@pii @sensitive`
80
+ as `[PII]` only, because Chronicle rejects `[PII]` with `[Encrypted]` (`CHR0053`); Stage
81
+ renders this from v4.29.0. The executable model still stops at `PLAY0268` for either.
82
+
83
+ ⚠️ **Identifiers are neither `@pii` nor `@sensitive`.** Chronicle rejects `[PII]` on an
84
+ event source id (`CHR0034`) and `[Encrypted]` on one (`CHR0052`); Screenplay reports
85
+ `PLAY0515` for `@pii` from Screenplay 4.69.1 and for `@sensitive` from 4.84.1, on a
86
+ command identifier, an explicit `for` destination or an event source identifier; earlier
87
+ versions compile it silently and only Chronicle catches it. Keep the stream identity a surrogate `Uuid`
88
+ concept and carry the personal value (name, email) as a separate `@pii` property and a
89
+ secret as a `@sensitive` property.
90
+
91
+ ⚠️ **Enum trap.** A value literally named `validate` is read as an empty validate
92
+ block. Write `@validate` for the value; the compiler warns when it sees the
93
+ ambiguity.
94
+
95
+ Use `type <Name>` for a composite shape (several properties) that events and
96
+ commands reference; use `concept` for a single wrapped primitive.
97
+
49
98
  ## The command block
50
99
 
51
100
  Excerpt: the concepts, the `InvoiceLine` type, the policy and the event are
@@ -140,17 +189,8 @@ Do not use `reads` to fetch data the caller could supply.
140
189
  Each rule takes an optional `severity information|warning|error` and then an
141
190
  optional `message "<text>"` (or `$strings.<key>`). The default severity is `error`.
142
191
 
143
- | Rule | Example |
144
- | --- | --- |
145
- | `not empty` | `name not empty` |
146
- | `max <n>` / `min <n>` | `reason max 500` (length on text), `quantity min 1` (value on numbers) |
147
- | `> <v>` / `>= <v>` / `< <v>` / `<= <v>` | `quantity > 0`, `discountPct <= 100` |
148
- | `== <v>` / `!= <v>` | `currency == "NOK"`, `status != draft` |
149
- | `length == <n>` | `currency length == 3` |
150
- | `matches email` | the only named pattern; any other name is `PLAY0366` |
151
- | `matches "<regex>"` | ECMAScript; matches **any substring** unless anchored with `^…$`; an invalid pattern is `PLAY0367` |
152
- | `all > <v>` / `all >= <v>` | `lines.quantity all > 0` |
153
- | `rule <Name>` | `orgNumber rule BeAValidOrganizationNumber` |
192
+ The rule vocabulary (`not empty`, `min`/`max`, comparisons, `length`, `matches`, `all`, `rule <Name>`) is in
193
+ [references/validate-rules.md](references/validate-rules.md): read it when choosing or writing a rule form.
154
194
 
155
195
  ⚠️ **Validation severity is not compiler severity.** Every failed rule and
156
196
  `require` rejects the command, at `information` and `warning` too; severity only
@@ -161,24 +201,9 @@ optional `severity`, sharing the condition grammar with `produces … when`:
161
201
  `and` binds tighter than `or`, parentheses group. A conditional rule is an
162
202
  implication: `require isExtension == false or newEndDate > endDate`.
163
203
 
164
- **Rules whose logic is code.** A bare `rule <Name>` records that a rule exists but
165
- has no portable meaning (`PLAY0268`). Give it a body when the logic can live in the
166
- model — a `file` or a tagged ` ```csharp ` fence indented under the rule, or a
167
- fenced `validate` block for cross-field rules. Excerpt, inside a command:
168
-
169
- ```screenplay
170
- validate
171
- orgNumber rule BeAValidOrganizationNumber message "Must be a valid organization number"
172
- file Validations/BeAValidOrganizationNumber.cs
173
- ```
174
-
175
- A bodied rule or fenced block on a validation, rule or policy binds as opaque code
176
- (ESM v3): the reference runner reports it unsupported, and a target must supply the
177
- implementation. Two exceptions never bind: the command `handler`, and a `file`
178
- constraint (the binder records the requirement, then rejects it with `PLAY0268`;
179
- only `unique` constraints bind).
180
- Stage 4.24 admits only pure reducer bodies, so such a body is gap-fill code there. Prefer a
181
- declarative rule when one can say it.
204
+ **Rules whose logic is code.** A bare `rule <Name>` has no portable meaning (`PLAY0268`) and a bodied rule binds only as
205
+ opaque code. Read [references/validate-rules.md](references/validate-rules.md) when a rule's logic must live in a `file`
206
+ or fenced code body.
182
207
 
183
208
  **Put format rules on the `concept`, not the command.** A concept carries its own
184
209
  `validate` block and every use inherits it — that is Screenplay's type system, and
@@ -211,65 +236,10 @@ A continuation line extends the clause.
211
236
 
212
237
  ## Inline events and destinations
213
238
 
214
- Use `produces event` when the command introduces a new, generation-1 event.
215
- This complete example declares its payload and mappings together:
216
-
217
- ````screenplay
218
- concept ProjectId : Uuid
219
- concept ProjectName : String
220
- module Projects
221
- feature Naming
222
- slice StateChange RenameProject
223
- command RenameProject
224
- projectId ProjectId identifier
225
- name ProjectName
226
- produces event ProjectRenamed
227
- description "A project received a new name"
228
- documentation
229
- ```markdown
230
- Existing links retain the project's identity.
231
- ```
232
- tag audit
233
- name ProjectName = name
234
- ````
235
-
236
- The omitted `for` means the command's required scalar identifier **only for
237
- inline productions**, when every production targets that same source. Once a
238
- production targets another source, every production must state `for`. Mixing
239
- omitted inline and plain destinations also fails (`PLAY0470`); there is no
240
- verified MCP repair for that diagnostic. Explicit syntax does not make cross-source
241
- execution supported.
242
-
243
- Plain `produces X` references a declared event; omitting `for` does not infer
244
- the command's identifier. In ESM v2+, it inherits a sibling production's resolved
245
- destination through the command destination default. An allocated identity is
246
- used only when no production resolves a destination. State `for` explicitly on
247
- every production targeting the identifier. `PLAY0478` offers advice and a
248
- reviewed repair, not permission to silently retarget an append. Supply an
249
- allocated identity to the executable model when allocation is intentional.
250
-
251
- Inline declarations are slice-owned contracts, usable by other consumers.
252
- Their `tag` lines are event-type tags; plain production tags apply at that one
253
- append site. Both inline and standalone events accept a quoted description or
254
- text/Markdown description fence, and one nonempty fenced Markdown `documentation`.
255
- New events omit `id`. Only a rename preserving an old stored name needs
256
- `id "<old name>"`; it does not replace the catalog's `EventContractId`.
257
-
258
- | Diagnostic | What to change |
259
- | --- | --- |
260
- | `PLAY0469` | Do not copy the same-source command identifier into payload. Inline copies warn; plain copies with explicit `for` are information. Review persistence before changing a contract. |
261
- | `PLAY0471` / `PLAY0472` | Remove a redundant name-equal `id`; an id must be one nonempty quoted value. |
262
- | `PLAY0473` / `PLAY0474` | Avoid declaration/import collisions; inline events belong only in commands, never reactions. |
263
- | `PLAY0475` | Extract the inline event before adding generations. |
264
- | `PLAY0476` | Inline `origin` and unescaped system-assigned production metadata are forbidden. |
265
- | `PLAY0477` | Use one nonempty Markdown documentation fence. |
266
-
267
- MCP can declare a missing produced event (`PLAY0166`), add explicit routing
268
- (`PLAY0478`), remove a redundant pin (`PLAY0471`), or remove an inline identifier
269
- copy (`PLAY0469`). The last **changes the event contract**, retires a property,
270
- refuses affected consumers/opaque implementations and is not fix-all. It does
271
- not establish that stored data is safe to migrate. Use
272
- `cratis-screenplay-model-authoring` for discovery, preview, extraction and rename.
239
+ `produces event` introduces a new generation-1 event. Plain `produces X` without `for` does not infer the identifier:
240
+ state `for` explicitly on every production targeting it.
241
+ Read [references/inline-events.md](references/inline-events.md) when declaring an event inline in `produces event`,
242
+ choosing or omitting `for` on a production, or fixing `PLAY0469`-`PLAY0478`.
273
243
 
274
244
  ## `produces`
275
245
 
@@ -322,54 +292,12 @@ to the routed scope. This does not make command `reads` protected.
322
292
 
323
293
  ## Generated values and responses (ESM v7)
324
294
 
325
- A `generated` command property and a `returns` response bind and execute from the standalone
326
- `screenplay` 4.68.0 (ESM v7, decision 0026; `commands.md` "Generated values and responses" at
327
- `v4.68.0`). The cratis CLI 3.28.3 bundles 4.66.0 and reports `PLAY0268` for them, and Stage 4.24.2
328
- refuses ESM v7 with `STAGE-ESM-016` (tracked in Stage#201), so a command that uses them is
329
- **not rendered yet**: hand-write it (gap-fill) with the model as the contract. Complete compiled example:
330
- `cratis-screenplay-toolchain` `references/generated-responses-example.md`.
331
-
332
- ```screenplay excerpt
333
- command RegisterProject
334
- projectId ProjectId generated identifier
335
- receiptId ReceiptId generated
336
- name ProjectName
337
- returns
338
- projectId = projectId
339
- receiptId ReceiptId = receiptId
340
- ```
341
-
342
- Rules (all read at `v4.68.0`):
343
-
344
- - `generated` is command-only and needs a required, scalar concept backed by `Uuid` (not bare `Uuid`, not
345
- optional, not a collection). Modifier order is `Type optional generated identifier`.
346
- - A generated value is not a request input, form field, invocation argument or ordinary specification value.
347
- The command runs authorization and validation first, then generates, then productions and the response, so
348
- authorization policies (also inherited and the implicit `subject` of a generated identifier), property rules
349
- and requirements cannot reference one (`PLAY0273`), and a concept with any validation rule cannot back a
350
- generated property (`PLAY0268`). Reactions map request inputs only.
351
- - `returns <property>` is a scalar response; bare `returns` opens an ordered record of `<name> [<Type>] = <property>`
352
- fields over direct properties of this command. A type annotation must equal the source's type and
353
- optionality. Collections, read aliases, arithmetic and whole read models are not supported. At most one
354
- unconditional response, as a command sibling.
355
- - A two-token `returns name` is a response when `name` is another property of this command; otherwise it is a
356
- property named `returns`. `returns @name` forces a response, `@returns Type` a property.
357
- - A response exists only on acceptance. Rejection, denial or an unsupported outcome has none; a later reaction or
358
- scenario-query failure keeps the accepted facts and clears the response. A response-only command records no
359
- facts. Field names are an external contract: renaming one changes the revision.
360
- - A generated identifier is the implicit destination of inline productions. A plain `produces` without `for` keeps
361
- its own allocation channel and a generation fixture never satisfies it.
362
- - Generated values give no idempotency, retry or deduplication guarantee. Specifications supply fixtures and assert
363
- the response: `cratis-screenplay-specifications`.
364
-
365
- Other decision 0023 constructs are still **authorable, never executable** (binding reports `PLAY0268`, so
366
- they stop a model at V1): operations, and named event sources and streams with command routes
367
- (`eventsource`, `stream`, `streamId`). **No supported ESM version admits them**, and they have no version number
368
- yet (decision 0025 numbers a version only at its release-ready admission). Syntax or MCP acceptance is not proof of
369
- execution. A model using sources, streams or routes can be authored and validated, but
370
- not bound, run or rendered; hand-write the code with the model as contract
371
- (`cratis-screenplay-toolchain` `references/sources-and-streams.md`). `derive` and `provide` have no documented syntax at that tag; treat them as
372
- planned and do not write them.
295
+ A `generated` property and a `returns` response need standalone `screenplay` 4.68.0; the cratis CLI reports
296
+ `PLAY0268` and Stage refuses them, so such a command is **not rendered yet**: hand-write it.
297
+ Read [references/generated-values-and-responses.md](references/generated-values-and-responses.md) when adding or
298
+ reviewing `generated` properties, `returns` responses, or decision 0023 constructs.
299
+ Read `cratis-screenplay-toolchain/references/generated-responses-example.md` when adding generated command values or response assertions and you need a complete compiled example.
300
+ Read `cratis-screenplay-toolchain/references/sources-and-streams.md` when authoring named event sources, streams or command routes that require hand-written realization.
373
301
 
374
302
  ## `constraint` — uniqueness at append time
375
303
 
@@ -407,102 +335,14 @@ hand-written Chronicle `IConstraint`, which can only declare uniqueness; it warn
407
335
  belongs in `validate`/`require`. Use a constraint when two concurrent appends must
408
336
  not both win — a `validate` rule cannot do that.
409
337
 
410
- ## `concept` and `type`
411
-
412
- ```screenplay
413
- concept InvoiceId : Uuid
414
- concept DiscountPercentage : Decimal
415
- validate
416
- >= 0 message "A discount cannot be negative"
417
- <= 100 message "A discount cannot exceed 100 percent"
418
- concept PersonName : String @pii
419
- pii reason "Billing contact name; lawful basis: contract performance."
420
- concept InvoiceStatus : Enum
421
- draft
422
- sent
423
- paid
424
- ```
425
-
426
- The seven primitives are `Uuid`, `String`, `Int`, `Decimal`, `Bool`, `Date` and
427
- `DateTime`. `Enum` is **not** one of them — it is a separate concept kind, which
428
- is why the compiler says *expected … or Enum* rather than listing it among them.
429
- Attributes `@pii` and `@sensitive`, each with at most one `reason`; a
430
- reason for an attribute the concept does not declare is an error. **Compliance is
431
- inherited** — a property typed with a `@pii` concept is PII everywhere. The
432
- executable model does not bind compliance attributes (`PLAY0268`, "compliance attributes
433
- require portable data-subject semantics"), so a `@pii` model stops at authorable (V1);
434
- keep the attribute, because the classification is the point, and never drop it to bind
435
- or render.
436
-
437
- `@pii` is personal data (erasable); `@sensitive` is an **operational secret** (API key,
438
- token, a company's bank account number): encrypted at rest without erasure and withheld
439
- from the causation chain (Screenplay decision 0034, Screenplay#384). C# providers render
440
- `@sensitive` as `[Encrypted]` + `[NotAudited]`, `@pii` as `[PII]`, and `@pii @sensitive`
441
- as `[PII]` only, because Chronicle rejects `[PII]` with `[Encrypted]` (`CHR0053`); Stage
442
- renders this from v4.29.0. The executable model still stops at `PLAY0268` for either.
443
-
444
- ⚠️ **Identifiers are neither `@pii` nor `@sensitive`.** Chronicle rejects `[PII]` on an
445
- event source id (`CHR0034`) and `[Encrypted]` on one (`CHR0052`); Screenplay reports
446
- `PLAY0515` for `@pii` from Screenplay 4.69.1 and for `@sensitive` from 4.84.1, on a
447
- command identifier, an explicit `for` destination or an event source identifier; earlier
448
- versions compile it silently and only Chronicle catches it. Keep the stream identity a surrogate `Uuid`
449
- concept and carry the personal value (name, email) as a separate `@pii` property and a
450
- secret as a `@sensitive` property.
451
-
452
- ⚠️ **Enum trap.** A value literally named `validate` is read as an empty validate
453
- block. Write `@validate` for the value; the compiler warns when it sees the
454
- ambiguity.
455
-
456
- Use `type <Name>` for a composite shape (several properties) that events and
457
- commands reference; use `concept` for a single wrapped primitive.
458
-
459
338
  ## `policy` and `persona`
460
339
 
461
- ```screenplay
462
- policy IsAuthenticated
463
- require authenticated
464
- policy IsAccountant
465
- require role "Accountant"
466
- policy CanManageInvoice
467
- require role "InvoiceManager"
468
- or role "Accountant"
469
- policy OwnsInvoice
470
- require claim "sub" matches subject
471
- policy IsAdultCustomer
472
- file Policies/IsAdultCustomer.cs
473
-
474
- persona Accountant
475
- description "Handles invoicing and collections"
476
- policy IsAccountant
477
- ```
478
-
479
- Three condition forms: `authenticated`, `role "<name>"`, and
480
- `claim "<name>" matches subject | "<value>" | <path>`. A policy has **exactly one**
481
- `require` line — continue the condition on deeper-indented lines instead of adding
482
- a second (`PLAY0441`) — **or** one implementation (a tagged ` ```csharp ` block or
483
- `file`), never both (`PLAY0440`). Declarative policies run in the reference
484
- runner; a code policy binds as opaque ESM v3 and needs a target to evaluate it.
485
- A `persona` is authoring metadata: the binder reports it as information `PLAY0270`
486
- (report-only) and it does not block binding; an unknown policy it lists is an error.
487
-
488
- ## `seed`
489
-
490
- Excerpt: `CustomerRegistered` is declared in a slice.
491
-
492
- ```screenplay
493
- seed
494
- for "3fa85f64-5717-4562-b3fc-2c963f66afa6"
495
- CustomerRegistered
496
- name = "Acme Corp"
497
- ```
498
-
499
- Events append to that event source in declaration order, using the same mapping
500
- expression grammar as `produces`. Several `seed` blocks accumulate. Seeding is
501
- operational metadata, not part of executable behavior (`PLAY0270`).
340
+ A policy has **exactly one** `require` line (`PLAY0441`) **or** one implementation, never both (`PLAY0440`). Read [references/policy-persona-seed.md](references/policy-persona-seed.md) when
341
+ declaring a policy, a persona, or a `seed` block.
502
342
 
503
343
  ## `$context`
504
344
 
505
- Four contexts, and **what each omits is load-bearing** — read
345
+ Four contexts, and **what each omits is load-bearing** — when writing a code body or a context/expression mapping, read
506
346
  [context.md](references/context.md) for the full member lists, the declarative
507
347
  `$context.` paths, and `$causedBy` / `$env` / `$strings`.
508
348
 
@@ -533,6 +373,8 @@ Four contexts, and **what each omits is load-bearing** — read
533
373
  runnable or renderable without saying which tool admits it.
534
374
  - [ ] No event carries an optional property covering two situations.
535
375
 
376
+ Read `cratis-screenplay-toolchain/references/versions.md` when selecting a compiler or determining which executable or renderable subset admits a construct.
377
+
536
378
  Versions, tool capabilities and the executable and renderable subsets: `cratis-screenplay-toolchain` (`references/versions.md`). Where a construct sits in the
537
379
  method: `cratis-screenplay-modeling-lifecycle` and `cratis-screenplay-slice-design`.
538
380
 
@@ -1,5 +1,15 @@
1
1
  # Contexts and context expressions
2
2
 
3
+ ## Contents
4
+
5
+ - The four contexts
6
+ - The values they carry
7
+ - Reaching the context declaratively
8
+ - Production metadata is not a context expression
9
+ - The other expression roots
10
+ - Templates and literals
11
+ - Escaping
12
+
3
13
  Four contexts, one per job. What each **omits** is as deliberate as what it
4
14
  carries: a validation rule cannot see the caller's roles, and a policy cannot see
5
15
  the causation chain.
@@ -0,0 +1,51 @@
1
+ ## Generated values and responses (ESM v7)
2
+
3
+ A `generated` command property and a `returns` response bind and execute from the standalone
4
+ `screenplay` 4.68.0 (ESM v7, decision 0026; `commands.md` "Generated values and responses" at
5
+ `v4.68.0`). The cratis CLI 3.28.3 bundles 4.66.0 and reports `PLAY0268` for them, and Stage 4.24.2
6
+ refuses ESM v7 with `STAGE-ESM-016` (tracked in Stage#201), so a command that uses them is
7
+ **not rendered yet**: hand-write it (gap-fill) with the model as the contract. Complete compiled example:
8
+ `cratis-screenplay-toolchain` `references/generated-responses-example.md`.
9
+
10
+ ```screenplay excerpt
11
+ command RegisterProject
12
+ projectId ProjectId generated identifier
13
+ receiptId ReceiptId generated
14
+ name ProjectName
15
+ returns
16
+ projectId = projectId
17
+ receiptId ReceiptId = receiptId
18
+ ```
19
+
20
+ Rules (all read at `v4.68.0`):
21
+
22
+ - `generated` is command-only and needs a required, scalar concept backed by `Uuid` (not bare `Uuid`, not
23
+ optional, not a collection). Modifier order is `Type optional generated identifier`.
24
+ - A generated value is not a request input, form field, invocation argument or ordinary specification value.
25
+ The command runs authorization and validation first, then generates, then productions and the response, so
26
+ authorization policies (also inherited and the implicit `subject` of a generated identifier), property rules
27
+ and requirements cannot reference one (`PLAY0273`), and a concept with any validation rule cannot back a
28
+ generated property (`PLAY0268`). Reactions map request inputs only.
29
+ - `returns <property>` is a scalar response; bare `returns` opens an ordered record of `<name> [<Type>] = <property>`
30
+ fields over direct properties of this command. A type annotation must equal the source's type and
31
+ optionality. Collections, read aliases, arithmetic and whole read models are not supported. At most one
32
+ unconditional response, as a command sibling.
33
+ - A two-token `returns name` is a response when `name` is another property of this command; otherwise it is a
34
+ property named `returns`. `returns @name` forces a response, `@returns Type` a property.
35
+ - A response exists only on acceptance. Rejection, denial or an unsupported outcome has none; a later reaction or
36
+ scenario-query failure keeps the accepted facts and clears the response. A response-only command records no
37
+ facts. Field names are an external contract: renaming one changes the revision.
38
+ - A generated identifier is the implicit destination of inline productions. A plain `produces` without `for` keeps
39
+ its own allocation channel and a generation fixture never satisfies it.
40
+ - Generated values give no idempotency, retry or deduplication guarantee. Specifications supply fixtures and assert
41
+ the response: `cratis-screenplay-specifications`.
42
+
43
+ Other decision 0023 constructs are still **authorable, never executable** (binding reports `PLAY0268`, so
44
+ they stop a model at V1): operations, and named event sources and streams with command routes
45
+ (`eventsource`, `stream`, `streamId`). **No supported ESM version admits them**, and they have no version number
46
+ yet (decision 0025 numbers a version only at its release-ready admission). Syntax or MCP acceptance is not proof of
47
+ execution. A model using sources, streams or routes can be authored and validated, but
48
+ not bound, run or rendered; hand-write the code with the model as contract
49
+ (`cratis-screenplay-toolchain` `references/sources-and-streams.md`). `derive` and `provide` have no documented syntax at that tag; treat them as
50
+ planned and do not write them.
51
+