@cratis/pi 7.6.4 → 7.7.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 (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 +95 -54
  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 +45 -5
  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 -7
  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
@@ -27,11 +27,22 @@ source is the single flow model.
27
27
  | --- | --- | --- |
28
28
  | `Cratis.Screenplay` | `4.31.0` | Original parser, binder and reference execution evidence |
29
29
  | `Cratis.Screenplay` | main `fd18129` | Inline facts, `optional` and clock spelling; changed examples compiled |
30
+ | `Cratis.Screenplay` | `4.64.0` (`7e16162`) | ESM v6 specification actions and reaction cascades, `then no readmodel`, `$strings` rejections, `invokes` caller rule; probed with the standalone tool and its MCP server |
30
31
 
31
32
  The update follows `commands.md`, `events.md`, `types.md` and
32
33
  `specifications.md` at that main commit (after v4.52.0). This pass compiles the
33
34
  changed examples; it does not rerun the reference runner.
34
35
 
36
+ **Which tool says what.** The standalone `screenplay` tool 4.64.0 admits ESM v1-v6.
37
+ The `cratis` CLI 3.27.1 bundles Screenplay 4.60.1, which admits ESM v1-v5 only and
38
+ reports a false `PLAY0285` on reaction cascades (see "Version skew"). Facts below
39
+ marked **ESM v6** hold for the standalone tool from 4.61.0 and for `cratis` only
40
+ after it bundles a newer compiler. The full table is in `cratis-screenplay-toolchain`
41
+ (`references/versions.md`). Neither tool runs specifications: `screenplay` and
42
+ `cratis screenplay validate` parse and check consistency, the MCP server also binds,
43
+ and spec outcomes come only from the reference runner as a library, Stage's
44
+ specification runner or a rendered application's tests.
45
+
35
46
  Checked against the Screenplay repository at tag `v4.31.0` (commit `355dffb`):
36
47
  `Documentation/screenplay/{specifications,policies,constraints,readmodels,diagnostics}.md`.
37
48
  The original worked example had reference-runner evidence at that tag. The
@@ -52,7 +63,7 @@ decision 0022. They do not exist before v4.48.0.
52
63
  | `given readmodel <ReadModelType>` | prior read-model state, established directly — a **complete** instance including its identifier |
53
64
  | `given caller` | the caller: `authenticated`, `role "<r>"`, repeatable `claim "<type>" = "<value>"`; empty means unauthenticated |
54
65
  | `when <CommandType>` | run a command |
55
- | `when append <EventType>` | append one event: constraints and projections run, the command and reactions do not |
66
+ | `when append <EventType>` | append one event: constraints and projections run, the command does not; reactions run only from ESM v6, where `then` lists what followed |
56
67
  | `when query <Query>` | perform a query with the argument values beneath it (v4.48.0) |
57
68
  | `then result [exactly]` | one expected row of the performed query; repeat for several (v4.48.0) |
58
69
  | `then no result` | the performed query returns nothing (v4.48.0) |
@@ -63,8 +74,9 @@ decision 0022. They do not exist before v4.48.0.
63
74
  | `then <EventType>` | an expected new event |
64
75
  | `then events in any order` | compare the new events without regard to order |
65
76
  | `then readmodel <ReadModelType> [exactly]` | read-model state afterwards — must state the identifier |
77
+ | `then no readmodel <ReadModelType> for <key>` | exactly that keyed instance is absent (v4.64.0); the key is concrete and typed |
66
78
  | `then query <Query> [exactly]` | query results for explicit `arguments`; one `result` per row; none means empty |
67
- | `then error "<message>"` | a validation or constraint rejection, for that reason |
79
+ | `then error "<message>"` | a validation or constraint rejection, for that reason; a localized rule is pinned by its quoted key, `then error "$strings.<key>"` |
68
80
  | `then error` | a validation or constraint rejection, reason unnamed |
69
81
  | `then denied` | an authorization denial (`Unauthorized`) |
70
82
  | `for <value>` | the event source of a `given`/`then` event, or of the `when` command or appended event |
@@ -81,7 +93,7 @@ Rules the binder enforces:
81
93
 
82
94
  - **At most one action** — a command, `when append`, `when clock`, `when trigger`,
83
95
  `when capture` or `when query` (`PLAY0097`, `PLAY0358`). Without an action,
84
- assert only `then readmodel` or `then query` (`PLAY0352`).
96
+ assert only `then readmodel`, `then no readmodel` or `then query` (`PLAY0352`).
85
97
  - **`then result` and `then no result` need `when query`**, and `when query`
86
98
  needs one of them or `then denied` (`PLAY0465`). Each argument is a `by` or
87
99
  `filter` parameter of the query (`PLAY0468`).
@@ -105,13 +117,19 @@ the one-rejection rule (`PLAY0273`) are reported only when the model binds, so
105
117
  ## How outcomes are compared
106
118
 
107
119
  - **Events:** the complete set of new events, in authored order, unless
108
- `then events in any order` is stated. The count is always exact.
120
+ `then events in any order` is stated. The count is always exact. After
121
+ `when append`, a model before ESM v6 expects the appended fact itself; from
122
+ ESM v6 the appended event is the action and `then` lists only what followed it.
109
123
  - **Read models and query rows:** only the asserted properties must match
110
124
  (subset); add `exactly` to require every property. Row count and order are
111
125
  always exact. A missing property does not match an asserted `null`.
112
126
  - **Rejections:** `then error "<message>"` matches the message whatever the rule's
113
127
  validation severity; no form asserts severity. Bare `then error` never matches
114
128
  a denial. Quote a localized key: `then error "$strings.invoices.reasonRequired"`.
129
+ The grammar takes only quoted messages here, never an unquoted `$strings` token
130
+ (unlike a rule's `message` operand). The reference runner compares the symbolic key
131
+ and requires the rejection to carry the string-key marker; it never loads
132
+ translated text; resolving the key is the realization's job.
115
133
 
116
134
  ## Worked example
117
135
 
@@ -211,8 +229,11 @@ module Invoicing
211
229
  event lands on the command's own event source, and re-claiming your own value
212
230
  is not a violation.
213
231
  - `ProjectingAnAppendedInvoice` exercises the projection without running the
214
- command. Put `for`-bearing specifications in the slice whose command produces
215
- the event; placed in the view slice, binding fails with `PLAY0273`.
232
+ command. A `when append` specification may sit in a `StateView` slice, even for an
233
+ event another slice declares, as long as the event's producer gives it one
234
+ unambiguous destination type (binding resolves it from commands in other slices);
235
+ otherwise `for` fails with `PLAY0273`. Only `when <Command>` needs the command's
236
+ own slice.
216
237
  - `LookingUpAnExistingInvoice` performs the query as its action. It binds to
217
238
  exactly what `then query` with `arguments` and `result` would, so on a version
218
239
  before v4.48.0 write it that way instead.
@@ -229,15 +250,101 @@ A slice is not always set off by a command. Name what does:
229
250
  | A translation driven by a capture | `given capture <Capture>` (the record as it was), `when capture <Capture>` (as it is now) |
230
251
 
231
252
  Use `given clock`, never `given time`, to state the scenario occurrence time and
232
- assert a value mapped from `$context.occurred`. The clock fixture is documented
233
- on main, but its executable admission is still deferred as described below.
253
+ assert a value mapped from `$context.occurred`. In a command's `produces`, that
254
+ mapping executes when the scenario has `given clock`. It is not the same as
255
+ `$eventContext.occurred` in a projection, which the execution plan refuses (below).
256
+
257
+ **Which tools bind these actions** (probed: the standalone `screenplay mcp` 4.64.0
258
+ reports the complete example below `executableReady` with no executable error, in
259
+ `open-workspace` readiness and `read-workspace` view `executable-diagnostics`;
260
+ `cratis` 3.27.1 bundles 4.60.1 and does not):
261
+
262
+ - **Standalone tool, Screenplay 4.64.0 (ESM v6, from 4.61.0):** the clock, trigger
263
+ and capture actions, and the `Automation` and `Translate` slices, reactions and
264
+ captures they drive, bind. The reference runner executes them as library code, with
265
+ the semantics in "Reactions and cascades" below.
266
+ - **`cratis` 3.27.1 (Screenplay 4.60.1, ESM v1-v5):**
267
+ **`when query` executes today. The clock, trigger and capture actions do not.** They parse, print and are
268
+ checked against the application, but binding reports `PLAY0268` naming the
269
+ proposed ESM v6 (decision 0022), and an `Automation` or `Translate` slice reports
270
+ *is not admitted by ESM v1*. Only binding shows this: `cratis screenplay validate`
271
+ does not bind, so it stays green.
272
+
273
+ Write the actions either way - they state what sets the slice off. Report each as
274
+ bound and not executed, or as parsed only, naming the tool that said so.
275
+
276
+ ## Reactions and cascades (ESM v6)
277
+
278
+ From ESM v6 every action sets reactions off: after a command, an append, a clock
279
+ tick, a trigger or a capture record, each new fact runs the reactions to its event,
280
+ and what those append or invoke runs more, until nothing is left. `then` events
281
+ compare every new fact, the action's and the reactions'.
234
282
 
235
- **`when query` executes today. The clock, trigger and capture actions do not.**
236
- They parse, print and are checked against the application, but binding reports
237
- `PLAY0268` naming the proposed ESM v6 (decision 0022): the executable model does
238
- not yet admit automation or translate slices, nor the reactions and captures these
239
- actions drive. Write them - they state what sets the slice off - and report them
240
- as parsed, not executed.
283
+ ```screenplay
284
+ // Needs the standalone screenplay compiler (ESM v6)
285
+ concept InvoiceId : Uuid
286
+ module Collections
287
+ feature Invoices
288
+ slice StateChange SendInvoice
289
+ command SendInvoice
290
+ invoiceId InvoiceId identifier
291
+ produces InvoiceSent
292
+ for invoiceId
293
+ invoiceId = invoiceId
294
+ event InvoiceSent
295
+ invoiceId InvoiceId
296
+ specification SendingAnInvoiceSchedulesAReminder
297
+ given clock "2026-10-02T09:00:00Z"
298
+ when SendInvoice
299
+ invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
300
+ then InvoiceSent
301
+ for "9c858901-8a57-4791-81fe-4c455b099bc9"
302
+ invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
303
+ then ReminderScheduled
304
+ for "9c858901-8a57-4791-81fe-4c455b099bc9"
305
+ scheduledAt = "2026-10-02T09:00:00Z"
306
+ slice Automation Reminders
307
+ reaction ReminderScheduler
308
+ description "Schedules a reminder when an invoice is sent"
309
+ when InvoiceSent
310
+ invoiceId
311
+ produces ReminderScheduled
312
+ for invoiceId
313
+ scheduledAt = $context.occurred
314
+ event ReminderScheduled
315
+ scheduledAt DateTime
316
+ ```
317
+
318
+ - A specification whose action is a command goes in the slice that declares that
319
+ command, here `SendInvoice`, not in the `Automation` slice that reacts: a command
320
+ from another slice is `PLAY0273` "command is unresolved in its slice" at binding.
321
+ - A command a reaction `invokes` runs through its full pipeline **with no caller**.
322
+ A command that needs one rejects, and that rejection ends the scenario. Each
323
+ invoked command is atomic; the cascade is not, so earlier accepted facts stay.
324
+ There is no syntax for an identity (Screenplay#383). See
325
+ `cratis-screenplay-automations-and-translations` and
326
+ `cratis-screenplay-captures-and-reactions`.
327
+ - The clock is UTC and exact. An `every` or `at` occurrence fires once when it is
328
+ due after `given clock` and at or before `when clock`; `when clock` needs
329
+ `given clock`, so the same instant twice fires nothing.
330
+ - A reached reaction with a code body (`file` or inline) returns unsupported, as
331
+ does a reaction that never settles. The reference stops at 1,000 new facts per
332
+ scenario and 10,000 due occurrences per clock advance.
333
+ - A model that uses these forms selects ESM v6 (`schemaVersion: 6`). Stage 4.24.0
334
+ admits ESM v1-v3 and renders no `Automation` or `Translate` slice, so the whole
335
+ automation is gap-fill against this contract: `cratis-screenplay-render-and-gap-fill`.
336
+
337
+ ### Version skew: cascades and the false `PLAY0285`
338
+
339
+ `PLAY0285` (a specification's expected event contradicts every producer of its
340
+ `when` command) runs in the syntax pass, with no binding. Reachability through
341
+ reactions and `invokes` was added after Screenplay 4.60.1. So the example above
342
+ passes `screenplay` 4.64.0 (and is executable-ready over its MCP server) and fails `cratis screenplay
343
+ validate` 3.27.1 with `PLAY0285` "Specification outcome 'ReminderScheduled' cannot be
344
+ produced by 'SendInvoice'", exit 5 (Cratis/cli#242, open). It is a tool skew, not a
345
+ modeling error: do not delete the `then` line or move the event to make `cratis`
346
+ green. Validate with the standalone tool, record which tool gave which verdict, and
347
+ see `cratis-screenplay-toolchain`.
241
348
 
242
349
  ## Rejections and denials say different things
243
350
 
@@ -251,24 +358,83 @@ validation runs. Write the bare form rather than `then error ""`.
251
358
  error cases for one. (A `when append` can still be refused by an append-time
252
359
  constraint — that is the constraint speaking, not the view.)
253
360
 
254
- ## Business rule or type system?
361
+ ## Business rule or concept rule?
255
362
 
256
- Before writing an error specification, apply this test:
363
+ Before writing an error specification, sort the rule:
257
364
 
258
- 1. Does the error depend on **existing system state** — what events occurred?
365
+ 1. Does the error depend on **existing system state** - what events occurred?
366
+ → business rule → write the specification.
367
+ 2. Would a different business plausibly have a different rule here?
259
368
  → business rule → write the specification.
260
- 2. Can the type system make the invalid state unrepresentable?
261
- → in Screenplay that means a `concept` with its own `validate` block, and the
262
- rule travels with every use → **not** a specification.
263
- 3. Would a different business plausibly have a different rule here?
264
- → business rule → specification.
369
+ 3. Is it a format, range or presence rule on a single value?
370
+ → put it on the **concept** with its own `validate` block, so the rule travels
371
+ with every use, and write **one rejection specification per concept rule**,
372
+ through **one** command that uses the concept. Not one per command or property
373
+ that uses it.
265
374
 
266
375
  **Write specifications for:** *"Cannot cancel an already-paid invoice"*,
267
- *"Cannot withdraw more than the balance"*, *"Maximum 100 lines per invoice"*.
376
+ *"Cannot withdraw more than the balance"*, *"Maximum 100 lines per invoice"*, and,
377
+ once per concept rule, *"Discount cannot exceed 100 percent"*.
268
378
 
269
- **Do not write specifications for:** *"Invoice number must match INV-000000"*,
270
- *"Name cannot be empty"*, *"Discount must be between 0 and 100"* — those belong on
271
- the concept.
379
+ **Do not write** one specification per use of a concept, or one per format variant
380
+ of the same rule.
381
+
382
+ **Why this differs from earlier guidance.** This skill used to say not to write
383
+ specifications for rules like *"Name cannot be empty"* because the type system
384
+ makes them unrepresentable. In Screenplay a concept `validate` is a runtime rule the
385
+ reference runner executes, not a type-level guarantee . Without a
386
+ rejection specification nothing proves the rule is wired to the command, and a
387
+ rule moved or deleted by an edit goes unnoticed. The cost is one specification per
388
+ rule; the rule stays on the concept, never copied into each command.
389
+
390
+ A complete example: the rule lives on the concept, one command exercises it, and
391
+ each concept rule has a rejection (the boundary above the limit and the rule below
392
+ zero), plus an acceptance at the limit.
393
+
394
+ ```screenplay
395
+ concept InvoiceId : Uuid
396
+ concept DiscountPercentage : Int
397
+ validate
398
+ min 0 message "Discount cannot be negative"
399
+ max 100 message "Discount cannot exceed 100 percent"
400
+ module Invoicing
401
+ feature Discounts
402
+ slice StateChange GrantDiscount
403
+ command GrantDiscount
404
+ invoiceId InvoiceId identifier
405
+ discount DiscountPercentage
406
+ produces event DiscountGranted
407
+ discount DiscountPercentage = discount
408
+ specification GrantingAValidDiscount
409
+ when GrantDiscount
410
+ invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
411
+ discount = 15
412
+ then DiscountGranted
413
+ for "9c858901-8a57-4791-81fe-4c455b099bc9"
414
+ discount = 15
415
+ specification AcceptingTheUpperBoundary
416
+ when GrantDiscount
417
+ invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
418
+ discount = 100
419
+ then DiscountGranted
420
+ for "9c858901-8a57-4791-81fe-4c455b099bc9"
421
+ discount = 100
422
+ specification RejectingADiscountAboveTheUpperBoundary
423
+ when GrantDiscount
424
+ invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
425
+ discount = 101
426
+ then error "Discount cannot exceed 100 percent"
427
+ specification RejectingANegativeDiscount
428
+ when GrantDiscount
429
+ invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
430
+ discount = -1
431
+ then error "Discount cannot be negative"
432
+ ```
433
+
434
+ Which scenarios a command needs (denial, duplicates, competing claims, ordering,
435
+ external failure, compensation) and which form fits a mode: coverage-matrix and
436
+ workshop method in `cratis-screenplay-scenario-coverage`. This skill stays the
437
+ grammar and the reference-execution facts.
272
438
 
273
439
  ## Application-boundary coverage
274
440
 
@@ -295,20 +461,27 @@ target has one normalized behavior to match.
295
461
  `nested`; and any `$eventContext.<path>` other than `eventSourceId`, such as
296
462
  `$eventContext.occurred`. The limits apply at every ESM version.
297
463
  - A specification that needs **opaque code** — a bodied reducer, a rule with a
298
- body, a fenced `validate` block, a code policy — returns **unsupported** and
464
+ body, a fenced `validate` block, a code policy, or (ESM v6) a reached reaction
465
+ body — returns **unsupported** and
299
466
  never passes. Authorization is evaluated first, so a `then denied` case still
300
467
  runs when a portable policy decides it. Other specifications in the model run
301
468
  normally.
302
469
  - Unsupported reachable declarative constructs block the whole execution plan
303
470
  rather than running partially: no specification in the model runs, including
304
471
  the ones that never touch the refused construct.
305
- - Reactions never run, not even after `when append`. `when clock`,
306
- `when trigger` and `when capture` fail binding until ESM v6 is accepted and
307
- built.
308
- - A rejection leaves the world unchanged; an accepted action commits once, then
309
- the read models and queries are compared.
310
-
311
- Unsupported is not passed. Report it as "needs a target", not as green.
472
+ - Reactions: before ESM v6 they never run, not even after `when append`. From ESM
473
+ v6 (standalone tool from 4.61.0) they run after every action, as in "Reactions and
474
+ cascades". Under `cratis` 3.27.1 (Screenplay 4.60.1) `when clock`, `when trigger`
475
+ and `when capture` fail binding with `PLAY0268`, and so do reactions and captures.
476
+ - A rejected individual command or append leaves the world unchanged; an accepted
477
+ one commits once, then the read models and queries are compared. There is no
478
+ scenario-wide transaction in v6: when a later effect of a cascade or capture
479
+ rejects, the earlier accepted facts and their projections remain.
480
+
481
+ Unsupported is not passed. Report it as "needs a target", not as green. "Specified"
482
+ and "bound" are never "passing": no command-line tool runs these specifications, so a
483
+ pass is claimed only from the reference runner, Stage's specification runner or a
484
+ rendered application's tests, and named as such.
312
485
 
313
486
  ## Quality checklist
314
487
 
@@ -325,7 +498,9 @@ For command specifications:
325
498
  `then denied` case for a caller who must be refused.
326
499
  - [ ] `then` contains **either** events **or** an error, never both.
327
500
  - [ ] A collision between two event sources uses `for` on the `given` event.
328
- - [ ] Error cases test business rules, not format validation.
501
+ - [ ] Error cases test business rules; each concept rule has one rejection
502
+ specification through one command, not one per use.
503
+ - [ ] A localized rejection is pinned by its quoted `$strings` key.
329
504
 
330
505
  For view specifications:
331
506
 
@@ -338,7 +513,9 @@ For view specifications:
338
513
 
339
514
  ## Verify
340
515
 
341
- - [ ] `screenplay <model> --warnaserror` reports zero errors and zero warnings.
516
+ - [ ] `screenplay <model> --warnaserror` reports zero errors and zero warnings
517
+ (standalone 4.64.0; under `cratis` 3.27.1 expect the false `PLAY0285` on
518
+ reaction cascades and record that it is skew).
342
519
  - [ ] Executable diagnostics are clean too: `PLAY0350`, `PLAY0352`, `PLAY0388`,
343
520
  `PLAY0389` and `PLAY0273` are only reported at binding.
344
521
  - [ ] Every slice has at least one boundary specification.
@@ -348,6 +525,10 @@ For view specifications:
348
525
 
349
526
  ## Route near misses
350
527
 
528
+ - Which scenarios a slice needs and how to run a scenario workshop: `cratis-screenplay-scenario-coverage`.
529
+ - Reviewing a model's specifications and verdicts: `cratis-screenplay-model-review`.
530
+ - Automation and translation slices the clock, trigger and capture actions drive: `cratis-screenplay-automations-and-translations`.
531
+ - Which tool says what, and the versions: `cratis-screenplay-toolchain`.
351
532
  - The rules being specified: `cratis-screenplay-command-surface`.
352
533
  - The projections being asserted on: `cratis-screenplay-projections`.
353
534
  - Naming and scoping specifications generally: `cratis-specification-by-example`.
@@ -3,10 +3,22 @@
3
3
  "input": "Write given/when/then specifications for a Screenplay slice.",
4
4
  "fixtures": [],
5
5
  "assertions": [
6
- { "kind": "skill-contains", "value": "main `fd18129`" },
7
- { "kind": "skill-contains", "value": "Inline events are ordinary named facts" },
8
- { "kind": "skill-contains", "value": "Use `given clock`, never `given time`" },
9
- { "kind": "skill-contains", "value": "query InvoiceById => InvoiceSummary optional" },
6
+ {
7
+ "kind": "skill-contains",
8
+ "value": "main `fd18129`"
9
+ },
10
+ {
11
+ "kind": "skill-contains",
12
+ "value": "Inline events are ordinary named facts"
13
+ },
14
+ {
15
+ "kind": "skill-contains",
16
+ "value": "Use `given clock`, never `given time`"
17
+ },
18
+ {
19
+ "kind": "skill-contains",
20
+ "value": "query InvoiceById => InvoiceSummary optional"
21
+ },
10
22
  {
11
23
  "kind": "skill-contains",
12
24
  "value": ".cratis/screenplay/"
@@ -50,6 +62,18 @@
50
62
  {
51
63
  "kind": "skill-contains",
52
64
  "value": "A clock instant is ISO 8601 with an offset or `Z`"
65
+ },
66
+ {
67
+ "kind": "skill-contains",
68
+ "value": "one rejection specification per concept rule"
69
+ },
70
+ {
71
+ "kind": "skill-contains",
72
+ "value": "Version skew: cascades and the false `PLAY0285`"
73
+ },
74
+ {
75
+ "kind": "skill-contains",
76
+ "value": "Cratis/cli#242"
53
77
  }
54
78
  ]
55
79
  }
@@ -0,0 +1,33 @@
1
+ Copyright (c) Cratis. All rights reserved.
2
+ Licensed under the MIT license. See LICENSE file in the canonical Cratis/AI repository for the full license text.
3
+
4
+ Third-party notices
5
+
6
+ Parts of this skill (the ownership interview, the interface and processor
7
+ inventory, the cross-boundary walkthrough, and the event-by-event stream
8
+ identity check) are adapted from the skills `eventmodeling-applying-conways-law`
9
+ and `eventmodeling-optimizing-stream-design` in TrogonStack/agentskills
10
+ (plugins/trogonstack-eventmodeling, commit 7b249d3ee42d8b7e11fa564141ebd5fbc37aadf1),
11
+ which are distributed under the following licence:
12
+
13
+ MIT License
14
+
15
+ Copyright (c) 2025 Straw Hat, LLC
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ of this software and associated documentation files (the "Software"), to deal
19
+ in the Software without restriction, including without limitation the rights
20
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ copies of the Software, and to permit persons to whom the Software is
22
+ furnished to do so, subject to the following conditions:
23
+
24
+ The above copyright notice and this permission notice shall be included in all
25
+ copies or substantial portions of the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ SOFTWARE.
@@ -0,0 +1,191 @@
1
+ ---
2
+ name: cratis-screenplay-streams-and-consistency
3
+ description: "Decide Screenplay stream identity and consistency: one business identity per event source, where each invariant is enforced atomically, constraints versus recorded state-dependent rules, races, retries and dedup scope, event granularity, evolution (generations, id pins, new events) and module or team boundaries. Use for identifier/for, constraints, splitting streams or modules, ownership of interfaces, or changing persisted events. Not for: projection or query syntax (use `cratis-screenplay-projections`), reactions and captures (use `cratis-screenplay-automations-and-translations`)."
4
+ license: MIT
5
+ ---
6
+
7
+ # Streams and consistency
8
+
9
+ Decide what each stream *is*, which rules hold atomically and where, and how events may change
10
+ later; then express that in `.play` truthfully. The model must say which invariants it protects,
11
+ which it only records, and what a retry, a race or a replay does. Grammar lives in the construct
12
+ skills; this skill owns the decisions. The `.play` model is the source of truth: a rule that
13
+ lives only in code, or only in a description, is a finding, not a solution.
14
+
15
+ ## Verified product sources
16
+
17
+ | Product | Pin | Used for |
18
+ | --- | --- | --- |
19
+ | Screenplay | v4.64.0 (`7e16162`) | `identifier`, `for`, constraints, generations, `id` pins, diagnostics PLAY0019/0135/0268/0271/0273/0391-0393/0446-0449/0469/0471 |
20
+ | Chronicle | v19.32.0 (`f17a2ff`) | CHR0012, CHR0034; open defects #3744, #4123, #4131 |
21
+ | Arc | v22.50.5 | `[ProtectedDecision]` and `DecisionRead<T>` (since v22.39.0) |
22
+ | Stage | v4.24.0 | rendered apps pin Arc 22.25.0 and Chronicle client 19.8.1 |
23
+
24
+ Full pin table: `references/versions.md` in `cratis-screenplay-toolchain`. Re-check the three
25
+ Chronicle issues before relying on a constraint in a later release.
26
+
27
+ ## When / when not
28
+ - Use: choosing `identifier` and `for`; adding or naming a `constraint`; a rule that depends on
29
+ earlier state; "can two people do this at once?"; retries and duplicate requests; splitting or
30
+ merging streams, events or modules; adding, renaming or re-meaning an event; who owns which
31
+ interface; reviewing collection- or log-shaped streams.
32
+ - Not for: projection and query syntax, reactions and captures, writing the specifications
33
+ themselves (`cratis-screenplay-scenario-coverage`), Chronicle C# mechanics
34
+ (`cratis-chronicle-event-modeling`). See Route near misses.
35
+ - Model-first applies: when an accepted model covers the scope, change the model and its
36
+ specifications, not code. Do not weaken authorization, `@pii` or rules to make a model compile.
37
+
38
+ ## Interview phase
39
+ **Skip if** the user or the model already states the stream identities, who owns each module, how
40
+ much autonomy each side has, the external systems, and rough growth. Otherwise ask only what is
41
+ missing, one question at a time, with options. **Unattended:** assume the most conservative
42
+ option, mark it `ASSUMED` in the slice or module `description` and in the session `STATE.md`
43
+ (`.ai-work/screenplay/<model-slug>/STATE.md`), and continue.
44
+
45
+ 1. **Instance.** "What is the real-world thing this stream is about, and when does it start and
46
+ end?" Follow-up: if the answer needs "and" for two lifecycles, ask which facts live
47
+ independently of the other.
48
+ 2. **Competition.** "Can two people do this at once, and what must never happen then?" Follow-up:
49
+ for each answer ask whether it is a uniqueness, a count or a state rule.
50
+ 3. **Retry.** "If the reply is lost and the client sends the request again, what should the
51
+ second request see?" Follow-up: is the identifier chosen before the first attempt?
52
+ 4. **Ownership** (full protocol and options in `references/boundaries.md`). Who decides these
53
+ rules and operates them when they fail; how much can each side move alone; which external
54
+ systems take part and who owns each adapter; what delay or disagreement the business
55
+ tolerates. Follow-up on technical-function teams: which business capability does each serve?
56
+ 5. **Growth.** "Roughly how many events per instance per year, over how many years, and which
57
+ commands read the stream versus a view?" Follow-up: if the estimate is large, check the
58
+ identity before anything else (`references/stream-patterns.md`, Growth and snapshots).
59
+ 6. **Change.** "Has this event ever been stored in a running system?" It decides whether an edit
60
+ is ordinary or contract evolution.
61
+
62
+ ## Procedure
63
+ 1. **Establish identity and membership.** For every `concept XId` used as an `identifier`, write
64
+ one sentence: "one business identity per stream: one stream per <business thing>; it answers
65
+ <question>". Run the event-by-event check in `references/stream-patterns.md`: inspect every
66
+ producer and destination that can write its history (commands, reactions, captures), say why
67
+ each event belongs, and decide retain, split, view instead, or unresolved, by lifecycle and
68
+ invariant consequences, not names or length. For Chronicle keep event-source identity,
69
+ namespace, process-stream routing and concurrency scope apart
70
+ (`references/chronicle-boundaries.md`).
71
+ 2. **Account for every invariant.** One row per rule in the table from
72
+ `references/consistency-and-concurrency.md`: rule, authoritative inputs, all paths that can
73
+ affect it, intended atomic decision point, exact construct, status (`enforced` / `recorded` /
74
+ `eventual by choice`). Placement:
75
+ - only the command's own inputs: concept `validate`, command `validate`/`require`;
76
+ - supported uniqueness and exclusion/release rules: a named `constraint` (`unique ... on`,
77
+ `unique event`, `released by`); list every event that sets the claimed value;
78
+ - a state-dependent rule not reducible to those: write `reads <View>` + `require <expr>
79
+ message "..."` as stated intent (PLAY0268/0271 at binding are expected in design mode) and
80
+ mark it **NOT enforced in the model today** in the slice `description`, with requirement,
81
+ missing guarantee, race consequence and the named target enforcement. Add a `STATE.md` row
82
+ with an owner. A general "some rules are unsupported" note is not enough.
83
+ - Forbidden: a caller-supplied copy of state in `require`, a boolean attestation input
84
+ (`confirmsX == true`) standing in for a rule, and rules hidden in `handler` or
85
+ implementation-hint prose. An unguarded materialized read is unsafe for a protected
86
+ decision; that is not "read models never drive decisions".
87
+ 3. **Play the races and retries.** For each enforced or recorded rule write the concurrent case
88
+ (two commands at once), the retry case (same request again after a lost reply) and the
89
+ duplicate case (same intent, new id). State the outcome and which construct produces it.
90
+ Check the **retry identity**: the identifier is chosen before the first attempt and reused on
91
+ retry, or the retry creates a second stream.
92
+ 4. **Set granularity.** One decision usually records one event; several facts are fine when each
93
+ is a fact the business recognises. Different meanings get different events, not a flag with
94
+ nullable siblings. Event properties are required by default (CHR0012, PLAY0350): an optional
95
+ detail is a separate event, and any deviation is justified in the description. One data
96
+ subject per event and stream; never personal data or a `@pii` concept as the identifier (CHR0034):
97
+ use a surrogate `Uuid` and a `@pii` property.
98
+ 5. **Plan evolution** with `references/evolution.md`: classify each event change (additive,
99
+ meaning change, rename, removal, split or merge) and write its compatibility scenarios before
100
+ editing. Renames and other identity-affecting edits are made by the identity owner (the
101
+ identity procedure in `cratis-screenplay-modeling-lifecycle`).
102
+ 6. **Test ownership and interfaces** with `references/boundaries.md`: ownership interview,
103
+ interface and processor inventory, one real interaction walked across each boundary, coupling
104
+ check. Keep team, module, stream and deployment boundaries distinct; inbound facts via
105
+ Translate; unresolved decisions stay visible.
106
+ 7. **Record and gate.** Durable rationale in feature and slice `description`; open consistency
107
+ decisions and capability gaps in `STATE.md`. Then the gate below.
108
+
109
+ ## Rules
110
+ **Compiler contracts** (diagnostics at Screenplay v4.64.0; capability per tool in `versions.md`)
111
+ - `identifier` on an event property is PLAY0019; the source id is never payload by declaration.
112
+ Copying it as a payload value is PLAY0469 (information, warning for inline events).
113
+ - In the executable model a production's `for` must resolve to the command's scalar identifier:
114
+ one command writes one stream declaratively (a handler is never admitted).
115
+ - Constraint names are application-wide identities (PLAY0392); properties must be declared
116
+ directly on the event (PLAY0391); never mix event and property rules under one name (PLAY0135);
117
+ `ignore casing` is not allowed on `unique event` (PLAY0393).
118
+ - Generations are declared in full, numbered 1..N without gaps, in the same slice
119
+ (PLAY0446-0448). Referencing a removed property is PLAY0273; a `given` needing a historical
120
+ shape is PLAY0449. An `id` pin equal to the event's current name is PLAY0471 (information).
121
+ - `reads` is PLAY0271 and `require` over read-model paths is PLAY0268 at binding. A `concurrency`
122
+ block compiles but is PLAY0271 at binding. Keep both when they state real intent; they are not
123
+ protection. `description` text never reaches rendered code: a rule that lives only in prose is
124
+ unenforced there.
125
+ - `@pii` and `@sensitive` block binding (PLAY0268). Never remove them to pass a tool.
126
+ - Chronicle (open at v19.32.0): the SQL and InMemory providers do not settle unique claims
127
+ (#3744); index updates run after commit and may fail silently (#4123); composite values can
128
+ collide on the separator (#4131). A declared constraint is a declaration, not a runtime test.
129
+ - `[ProtectedDecision]` is available in Arc v22.39.0 or later, **not** in Stage-rendered apps
130
+ (Arc 22.25.0). In a rendered app, record the rule as NOT enforced and choose the stream or
131
+ identity redesign (`references/consistency-and-concurrency.md`, section 3).
132
+
133
+ **Modeling defaults** (deviate with a recorded reason)
134
+ - One business identity per stream; cross-stream references are payload properties.
135
+ - Copy the source id into the payload only when a consumer needs it as a value.
136
+ - Give each invariant an authoritative atomic decision point and inspect every path that could
137
+ violate it. A constraint violation rejects that command's whole append set; a reaction cascade
138
+ is not one transaction. Declared semantics are not a passed concurrency test.
139
+ - Match duplicate protection to scope. A property constraint lets a source re-claim its own
140
+ value; use `unique event` for a fact that is genuinely once-only in its lifecycle, without
141
+ blocking legitimate repeated operations just to make retries safe.
142
+ - Prefer short business lifecycles (a new stream per period, case or attempt) over an eternal
143
+ stream, when the business has natural ends.
144
+ - Compatible change is a new generation; changed meaning is a new event. Corrections are new
145
+ facts, never an edit of history. Redaction and crypto-erasure are compliance operations.
146
+ - Team and system often align, but not by law: decide modules on ownership, language and change
147
+ cadence, and record where they differ.
148
+
149
+ **Review questions** (findings only with a domain consequence)
150
+ - What single question does this stream answer? Does it grow for the right reason?
151
+ - What happens when two people do this at the same moment? When the reply is lost?
152
+ - Does an optional property cover two situations that the business names differently?
153
+ - Does a consumer in another module depend on an event we treat as internal?
154
+ - Could this calculated value matter historically (price, assessment)? Then it may be a fact.
155
+ - Is "eventually consistent" here a business choice, or an unexamined gap?
156
+
157
+ ## Gate
158
+ Do not report done until all hold; otherwise report what is open:
159
+ - Every identifier has its identity sentence, the event-membership table and a justified decision.
160
+ - Every rule has an invariant-table row with an exact construct or limitation reference.
161
+ - Every `recorded` rule is in its slice `description` and `STATE.md` with requirement, missing
162
+ guarantee, race consequence and intended enforcement owner.
163
+ - Every changed event has compatibility scenarios; identity changes were made by the identity owner.
164
+ - Every changed boundary has a named owner (or `ASSUMED`), callers, processors and contracts.
165
+ - Verdicts are stated V1-V5 per `cratis-screenplay-modeling-lifecycle`, each a result or "not run".
166
+
167
+ ## Verify
168
+ - Run the compile check on the model (V1, warnings as errors) and state the tool and version;
169
+ say what was not run. Parsing and binding do not execute specifications, and sequential
170
+ specifications do not prove race safety.
171
+ - Value uniqueness: a competing-claim spec (another source, `when <Command>`, earlier fact as
172
+ `given`); once-only facts: the same source repeating; release and reclaim when declared. Pin the
173
+ fixed message with `then error`. Report target-side concurrency evidence separately.
174
+ - Retry answers cover a lost acknowledgement, reuse of the operation identity, conflicting
175
+ payloads and duplicate intent under a new identity, where applicable.
176
+ - Examples that compile (`references/streams-example.md`, `references/evolution-example.md`):
177
+ `bash` the repository's compile check over this skill folder.
178
+
179
+ ## Route near misses
180
+ - Construct grammar: `cratis-screenplay-command-surface` (identifier, `for`, constraints),
181
+ `cratis-screenplay-projections`; compiler facts and traps: `cratis-screenplay-toolchain`.
182
+ - Chronicle C# compliance and event-source ids: `cratis-chronicle-event-modeling`.
183
+ - Reactions, todo lists, captures, external facts: `cratis-screenplay-automations-and-translations`.
184
+ - Commands, read models and lineage: `cratis-screenplay-slice-design`. Specs:
185
+ `cratis-screenplay-scenario-coverage`.
186
+ - Reviewing someone else's model: `cratis-screenplay-model-review`.
187
+ - Rendering and the code left to write after it: `cratis-screenplay-render-and-gap-fill`.
188
+
189
+ ## Lineage
190
+ Adapted in part from TrogonStack/agentskills (MIT); attribution and provenance entries are in
191
+ `references/provenance.md`; the notice is in `LICENSE`.