@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
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  agent: agent
3
- description: Write comprehensive BDD specs for an existing vertical slice command, query, projection, or reactor.
3
+ description: Write comprehensive BDD specs for an existing vertical slice command, query, projection, or reactor, starting from the slice's contract.
4
4
  ---
5
5
 
6
6
  # Write Specs
@@ -9,14 +9,20 @@ Write **comprehensive specs** for an existing slice. Invoke the **cratis-applica
9
9
 
10
10
  ## What to provide
11
11
 
12
- The slice file (`.cs`) to cover.
12
+ The slice file (`.cs`) **and its contract**: the `.play` slice with its specifications when the slice is modeled (search the model root, default `.cratis/screenplay/`), otherwise the agreed slice outline.
13
+
14
+ If no contract can be found, decide once:
15
+
16
+ - **An accepted model under the model root covers the scope, or the repository is opted in** (the model root (default `.cratis/screenplay/`) holds a committed `.play` file (`git ls-tree -r --name-only HEAD -- <root>` lists it) or the project explicitly set `mcpServers.screenplay.root` in `.cratis/ai.json`; an empty directory, install output, an installed skill, a `.play` file outside the root or an untracked or uncommitted draft is not opt-in (master: `cratis-screenplay-modeling-lifecycle`)): do not write code-derived specs in its place. Route to the `cratis-screenplay-*` skills (`cratis-screenplay-specifications`, `cratis-screenplay-scenario-coverage`) to add the slice's specifications to the model first. If those skills are not installed, say so and stop; do not author `.play` from memory.
17
+ - **No model coverage and no opt-in:** stay code-first. Write from the code, report every case as a proposal rather than as agreed behavior. A model is proposed only by the entry-point session, at most once per session, and not for trivial, bug-fix, infrastructure, client, framework or brownfield-maintenance work.
13
18
 
14
19
  ## Coverage (every slice type)
15
20
 
16
- Lead with the in-process scenario family — `CommandScenario<T>` (state change), `EventScenario` (constraints), `ReadModelScenario<T>` (projections/reducers), `ReactorScenario<T>` (reactors). Reserve out-of-process Chronicle integration specs for host/transport boundaries.
21
+ Lead with the in-process scenario family: `CommandScenario<T>` (state change), `EventScenario` (constraints), `ReadModelScenario<T>` (projections/reducers), `ReactorScenario<T>` (reactors). Reserve out-of-process Chronicle integration specs for host/transport boundaries.
17
22
 
18
- - Happy path with each appended event asserted.
19
- - One spec per validator rule, asserting **both** `ShouldNotBeSuccessful()` and `ShouldHaveValidationErrors()`.
20
- - One spec per constraint (`ShouldHaveConstraintViolationFor(name)`); authorization via `ShouldNotBeAuthorized()`.
23
+ 0. **Every contract specification first**, one spec each, named after it, using the contract's example values (fresh values only where uniqueness requires). Then add the code-derived cases below that the contract lacks, and report them as proposals for the contract (the `.play` model when one covers the slice, otherwise the agreed outline); never leave them as silent coverage.
24
+ 1. Happy path with each appended event asserted.
25
+ 2. One spec per validator rule, asserting **both** `ShouldNotBeSuccessful()` and `ShouldHaveValidationErrors()`. Build the command valid in every other respect so the spec violates only the rule it is named after.
26
+ 3. One spec per constraint (`ShouldHaveConstraintViolationFor(name)`); authorization via `ShouldNotBeAuthorized()`.
21
27
 
22
28
  Spec files are wrapped in `#if DEBUG`. Run the specs and fix failures before completing. The skill carries the detail; don't duplicate it here.
@@ -19,8 +19,8 @@ Pick exactly one type per slice folder — determined by what the slice *does*.
19
19
  | --- | --- | --- |
20
20
  | **State Change** | Accepts a command, appends events | Command + validator + event(s); optional `[Passive]` read model for command-side decisions |
21
21
  | **State View** | Projects events into a queryable read model | `[ReadModel]` + model-bound projection + static query method(s) |
22
- | **Automation** | Reacts to events, calls external systems / `ICommandPipeline` | Reactor only |
23
- | **Translation** | Reacts to events and appends follow-up events to another stream | Reactor only |
22
+ | **Automation** | Reacts to events, calls external systems / `ICommandPipeline`, or returns follow-up commands/events (including to another stream) | Reactor only |
23
+ | **Translation** | Takes data from outside our own facts (an external system or another service) and records it as our facts | An adapter at the boundary, often a reactor |
24
24
 
25
25
  ## Slice Naming (convention)
26
26
 
@@ -52,7 +52,11 @@ Tagged **[contract]** (framework-enforced) or **[convention]** (house default).
52
52
 
53
53
  ## Implementation Workflow
54
54
 
55
- - **Phase 0 — Model.** Confirm Module/Feature, slice name, slice type, domain rules; for new behavior or unclear event vocabulary run the **cratis-chronicle-event-modeling** skill first.
55
+ - **Phase 0 — Find the contract / choose the level.** Before writing slice code, find what the code must match, and choose the level once for the whole scope.
56
+ 1. **Look for a Screenplay model** under the model root (default `.cratis/screenplay/`, or the root set by `mcpServers.screenplay.root` in `.cratis/ai.json`; search `**/*.play`) for the slice, command, event and read-model names. A `.play` file outside the root, an untracked or uncommitted draft, an empty directory, or an installed profile or skill is not opt-in; the repository is opted in only when the root holds a committed `.play` file (`git ls-tree -r --name-only HEAD -- <root>` lists it) or the project set that root explicitly (master definition: **cratis-screenplay-modeling-lifecycle**, "Decide the level first").
57
+ 2. **Model level** — an accepted model under the root covers the scope, or the repository is opted in and this scope has no model yet. The `.play` slice and its specs are the contract: change the model first (new behavior starts in discovery), verify it (V1–V3), get an independent review, then render with Stage or gap-fill by hand only what the renderer rejects. Hand-written code stays checked against the model (**cratis-application-slice-conformance**). Never edit Stage-managed output, never implement behavior the model does not state, never change the model to match existing code, never weaken protection to make it compile or render. Start with **cratis-screenplay-event-modeling** (decision rule), then **cratis-screenplay-modeling-lifecycle**. If the Screenplay skills are not installed, say so; do not author `.play` from memory.
58
+ 3. **Code level** — infrastructure (hosting, DI composition, identity wiring, CI, deployment), clients, Screenplay code attachments and handlers, adapters in the render's customization area, and scope Stage cannot render yet (the model remains the contract). Framework repositories and brownfield work that is not opted in also stay code-first. Only the entry-point session may propose a model, at most once per session and never for trivial, bug-fix, infrastructure, client, framework or brownfield-maintenance work; if declined, do not ask again. Confirm Module/Feature, slice name, slice type and domain requirements as before; for new behavior or unclear event vocabulary run **cratis-chronicle-event-modeling** first, and record the agreed outline (fields, events, rules, scenarios) where the team tracks work, if anywhere. If you write code first where a model exists, say the model now lags.
59
+ 4. **Trivial changes** keep the proportional-delegation policy; Phases 1–3 below apply to code you write at either level.
56
60
  - **Phase 1 — Backend.** Implement a coherent slice change. **Gate:** incremental Debug build of the affected project (regenerates proxies, compiles `#if DEBUG` spec code).
57
61
  - **Phase 2 — Specs.** Mandatory for every slice type, in-process scenario family first (`CommandScenario<T>`, `EventScenario`, `ReadModelScenario<T>`, `ReactorScenario<T>`). **Gate:** tests pass.
58
62
  - **Phase 3 — Frontend.** Build from the generated proxies, register in the composition page, wire routing. **Gate:** lint, conditional test, build.
@@ -104,6 +104,8 @@ A claim is only as good as the signal behind it — a build result, a test run,
104
104
 
105
105
  > **Building an application on Cratis?** Project layout, slice types, slice naming, the seventeen slice rules, the implementation workflow and the application quality gates are in [application-profile.md](./application-profile.md), which loads only for repositories that select an application profile. If you are contributing to a Cratis framework repo, see **Framework profile** below.
106
106
 
107
+ **Model first.** When an accepted `.play` model covers the scope, or the repository has opted in, the `.play` model is the source of truth for behavior: change the model first, verify it, then render it or gap-fill from it, and never edit Stage-managed output, take code as a shortcut around the model, or weaken protection (authorization, `@pii`, rules) to make a model compile or render. Opted in means the model root (default `.cratis/screenplay/`) holds a committed `.play` file (`git ls-tree -r --name-only HEAD -- <root>` lists it), or the project explicitly set `mcpServers.screenplay.root` in `.cratis/ai.json`; an empty directory, install output, an installed profile or skill, a `.play` file outside the root or an untracked or uncommitted draft is not opt-in, and a behavior is a contract only when an accepted model under the root covers it (accepted means committed: staged or untracked files under the root are drafts; a committed file with uncommitted working-tree edits is a model change in progress, and its HEAD version is the contract until the change is committed; committing a model under the root is the team's act of acceptance and opts the repository in; an explicitly configured but empty root also counts as opted in). Otherwise stay code-first; the entry-point session may propose a model at most once per session (never for trivial, bug-fix, infrastructure, client, framework or brownfield-maintenance work), and infrastructure, client and adapter work stays in code at any level. Trivial changes keep the proportional-delegation policy. The master decision rule is in **cratis-screenplay-modeling-lifecycle** (router: **cratis-screenplay-event-modeling**); if the Screenplay skills are not installed, say so and do not author `.play` from memory.
108
+
107
109
  ---
108
110
 
109
111
  # Framework profile
@@ -147,9 +149,12 @@ A claim is only as good as the signal behind it — a build result, a test run,
147
149
  | Exit-code meaning and wrappers that lose a verdict | `exit-codes-and-wrappers.md` |
148
150
  | Writing a scan, allowlist or destructive pass that cannot pass vacuously | `guards-and-fuses.md` |
149
151
  | How the shared corpus is installed, updated and rolled back | `ai-distribution.md` |
150
- | Event modeling / schema migration / calling commands from code / paging / cross-cutting metadata / multi-tenancy | the matching skills |
151
- | Designing an information system, business process or information flow as a **Screenplay** `.play` model | the **cratis-screenplay-event-modeling** skill, then the per-surface `cratis-screenplay-*` skills |
152
- | Rendering a settled `.play` model into an application | the **cratis-stage-rendering-and-sandbox** skill |
152
+ | Code-level event modeling / schema migration / calling commands from code / paging / cross-cutting metadata / multi-tenancy | the matching skills |
153
+ | Building or changing behavior in an opted-in repository (see Model first above), or designing an information system, business process or information flow: **model first** | the **cratis-screenplay-event-modeling** skill (decision rule), then **cratis-screenplay-modeling-lifecycle** and one phase skill; per-surface `cratis-screenplay-*` skills for syntax |
154
+ | Building or changing behavior in a Cratis application that is not opted in | `application-profile.md` Phase 0, then the code skills (**cratis-arc-command**, **cratis-chronicle-projection**, ...) |
155
+ | Reviewing or explaining a `.play` model | the **cratis-screenplay-model-review** skill |
156
+ | Turning an existing system into a model | the **cratis-screenplay-legacy-extraction** skill |
157
+ | Rendering or gap-filling an accepted model | the **cratis-screenplay-render-and-gap-fill** skill, then **cratis-stage-rendering-and-sandbox** for renderer facts |
153
158
  | Step-by-step recipes | `.cratis/ai/skills/` |
154
159
 
155
160
  ## Source-of-Truth Discipline
@@ -42,7 +42,7 @@ One precise line per load-bearing term, so the same word means the same thing ev
42
42
  ## Structure & types
43
43
 
44
44
  - **Slice** — the vertical unit of one behavior (command + events + projection + read model + component + specs), created/changed/deleted together.
45
- - **Slice types** — **State Change** (command → events), **State View** (events → read model), **Automation** (events → side effect), **Translation** (events → follow-up events).
45
+ - **Slice types** — **State Change** (command → events), **State View** (events → read model), **Automation** (events → side effect, including a follow-up command or event — a Screenplay `produces` / `invokes`), **Translation** (data from *outside* the model's own facts → our own facts: an external system's or another service's data recorded as events we own, keeping the external fact distinct from the local one). A reactor that turns our own event into a follow-up event or command is an Automation, not a Translation.
46
46
  - **Concept** — a `ConceptAs<T>`, a strongly-typed wrapper over a primitive domain value (never raw `Guid`/`string`/`int`).
47
47
  - **EventSourceId<T>** — the strongly-typed event-source identity; derive entity identities from this, not `ConceptAs<Guid>`.
48
48
  - **Proxy** — the generated TypeScript command/query client, produced from C# on a **Debug** build; carries a `// @generated by Cratis` header and is never hand-edited.
@@ -71,6 +71,7 @@ The complete list of available profiles is defined in [profile-catalog.json](../
71
71
  | `cratis/components` | React component library | (no child profiles) |
72
72
  | `cratis/fundamentals` | Core primitives (`ConceptAs<T>`, `EventSourceId<T>`) | (no child profiles) |
73
73
  | `cratis/specifications` | Specification framework | (no child profiles) |
74
+ | `cratis/specifications/dotnet` | C# specifications and application slice conformance (`cratis-application-slice-conformance`), alongside slice specifications | `cratis/specifications` |
74
75
 
75
76
  ### Engineering Profiles
76
77
 
@@ -143,18 +144,47 @@ Standalone Chronicle client usage (no Arc) in TypeScript is
143
144
  | `cratis/studio` | Studio MCP safety guidance |
144
145
  | `cratis/cli` | CLI operations |
145
146
  | `cratis/lens` | Lens browser extension |
146
- | `cratis/screenplay` | Event modeling and information-system design with Screenplay — the method and the whole `.play` language |
147
+ | `cratis/screenplay` | Model-first event modeling: lifecycle, phase skills, toolchain, review, render and gap-fill, plus the whole `.play` language |
147
148
  | `cratis/stage` | Stage rendering and sandbox |
148
149
  | `cratis/modeling/screenplay-stage` | Screenplay + Stage together |
149
150
 
150
151
  ### Event modeling with Screenplay
151
152
 
152
- `cratis/screenplay` carries the **method** and the **language**, split one skill
153
- per surface so only the relevant one loads:
153
+ **Model first.** A repository is opted in only when its model root (default
154
+ `.cratis/screenplay/`) holds a committed `.play` file (`git ls-tree -r --name-only HEAD -- <root>` lists it) or the project explicitly set
155
+ `mcpServers.screenplay.root` in `.cratis/ai.json`; an empty directory, install output, an
156
+ installed profile or skill, a `.play` file outside the root or an untracked or uncommitted draft is not
157
+ opt-in. An accepted model under the root covering the scope is the contract and the source
158
+ of truth for behavior. Change the model, verify and independently review it, then render
159
+ or gap-fill from its contract; never edit Stage-managed output or weaken protection.
160
+ Otherwise stay code-first; only the entry-point session may propose a model, at most once
161
+ per session. Master definition: `cratis-screenplay-modeling-lifecycle`. Framework and non-opted-in brownfield work remain
162
+ code-first; infrastructure, clients, adapters and code attachments stay in code.
163
+ Application profiles do not automatically compose `cratis/screenplay`.
164
+
165
+ `cratis/screenplay` carries the **method** and the **language**. Load the lifecycle
166
+ and one phase skill, then the construct skill needed for syntax.
167
+
168
+ #### Method
169
+
170
+ | Skill | Covers |
171
+ | --- | --- |
172
+ | `cratis-screenplay-event-modeling` | Entry point, model-first routing, four slice types and nine-step map |
173
+ | `cratis-screenplay-modeling-lifecycle` | Decision rule, P0–P9 phases, V1–V5 evidence, identity ownership and handoffs |
174
+ | `cratis-screenplay-discovery` | Personas, domain discovery, event timeline and rules register |
175
+ | `cratis-screenplay-slice-design` | Commands, refusals, views, field lineage and slice boundaries |
176
+ | `cratis-screenplay-streams-and-consistency` | Business identities, atomic invariants, concurrency, evolution and ownership |
177
+ | `cratis-screenplay-automations-and-translations` | Follow-up work, external data to our facts, recovery and deduplication |
178
+ | `cratis-screenplay-scenario-coverage` | Coverage matrix, rejection, denial, lifecycle and external-failure scenarios |
179
+ | `cratis-screenplay-model-review` | Independent critique, evidence checklist and business-question explanation |
180
+ | `cratis-screenplay-legacy-extraction` | Evidence-led extraction, expert verification and loss report |
181
+ | `cratis-screenplay-toolchain` | Compiler and CLI versions, verdict commands, diagnostics and executable subsets |
182
+ | `cratis-screenplay-render-and-gap-fill` | Admission, publication, target verification and contract-led hand-written delivery |
183
+
184
+ #### Language
154
185
 
155
186
  | Skill | Covers |
156
187
  | --- | --- |
157
- | `cratis-screenplay-event-modeling` | Domain discovery, the nine-step workflow, the four slice types, model validation |
158
188
  | `cratis-screenplay-command-surface` | `command`, `event`, `validate`, `authorize`, `produces`, `concurrency`, `constraint`, `concept`, `$context` |
159
189
  | `cratis-screenplay-projections` | The Projection Declaration Language and the `reducer` escape hatch |
160
190
  | `cratis-screenplay-read-surface` | `readmodel`, `query`, `screen`, name resolution |
@@ -163,6 +193,14 @@ per surface so only the relevant one loads:
163
193
  | `cratis-screenplay-specifications` | Given/when/then and the reference execution |
164
194
  | `cratis-screenplay-model-authoring` | Typed MCP authoring, model navigation/refactoring, compiler diagnostics, and source-versus-executable readiness |
165
195
 
196
+ The canonical agents are **Screenplay Modeler** (`screenplay-modeler.md`) for
197
+ modeling and legacy extraction, **Screenplay Reviewer** (`screenplay-reviewer.md`)
198
+ for read-only critique or explanation, and **Screenplay Renderer**
199
+ (`screenplay-renderer.md`) for render probes and gap-fill handoffs. Hand-written
200
+ scope uses `cratis-application-slice-conformance`, available wherever
201
+ `cratis-application-slice-specifications` is selected through
202
+ `cratis/specifications/dotnet`, to check code against the model and its specs.
203
+
166
204
  The profile also selects the corpus-owned Screenplay MCP declaration from
167
205
  `mcp-servers.json`. The Cratis CLI hosts the server as `cratis screenplay mcp`
168
206
  and registers a scoped entry for supported clients without replacing their other
@@ -9,20 +9,22 @@ profile: application
9
9
 
10
10
  Reactors are the "if this then that" of event sourcing — they observe events and produce side effects. Unlike projections (which build state), reactors *do things*: send emails, trigger commands in other slices, call external APIs.
11
11
 
12
+ **Model first:** when an accepted model under the model root covers this scope (or the repository is opted in: the root holds a committed `.play` file (`git ls-tree -r --name-only HEAD -- <root>` lists it) or the project explicitly set `mcpServers.screenplay.root` in `.cratis/ai.json`; master definition in `cratis-screenplay-modeling-lifecycle`), a reactor implements an automation that the model owns (`produces` / `invokes`); read the modeled slice first and keep the reactor to what the model leaves to code (gap-fill). Otherwise (not opted in) stay code-first: this file and the **cratis-chronicle-reactor** skill are the guide, and the entry-point session may propose a model at most once per session. A `.play` file outside the root, an untracked or uncommitted draft or an empty directory is not consent.
13
+
12
14
  ## IReactor — Marker Interface
13
15
 
14
16
  `IReactor` is a **marker interface** with no methods to implement. Method dispatch is entirely by convention: the first parameter type of each public method determines which event it handles.
15
17
 
16
18
  ```csharp
17
- public class ProjectRegisteredNotifier(INotificationService notifications) : IReactor
19
+ public class InvoiceIssuedNotifier(INotificationService notifications) : IReactor
18
20
  {
19
21
  /// <summary>
20
- /// Reacts to <see cref="ProjectRegistered"/> events by sending a notification.
22
+ /// Reacts to <see cref="InvoiceIssued"/> events by sending a notification.
21
23
  /// </summary>
22
24
  /// <param name="event">The event.</param>
23
25
  /// <param name="context">The event context.</param>
24
- public async Task ProjectRegistered(ProjectRegistered @event, EventContext context) =>
25
- await notifications.Notify($"Project '{@event.Name}' was registered.");
26
+ public async Task InvoiceIssued(InvoiceIssued @event, EventContext context) =>
27
+ await notifications.Notify($"Invoice '{@event.Number}' was issued.");
26
28
  }
27
29
  ```
28
30
 
@@ -164,11 +166,11 @@ public Task<IEnumerable<EventForEventSourceId>> Handle(AnEvent @event, EventCont
164
166
  When the follow-up belongs to **another slice**, return its `[Command]` instead of an event — the same idiom as returning events, applied to intent. Arc's Chronicle integration executes a returned command through the full pipeline (validation, authorization, `Handle()`) in its own service scope; a collection is executed in order when **every** element is a command (events and commands do not mix in one return). An unauthorized, invalid or throwing result is a **side-effect failure** — it fails the partition like a failed append, so it is never silently dropped.
165
167
 
166
168
  ```csharp
167
- public class StockKeeping : IReactor
169
+ public class RenewalBilling : IReactor
168
170
  {
169
171
  [OnceOnly]
170
- public Task<DecreaseStock> BookReserved(BookReserved @event, EventContext context) =>
171
- Task.FromResult(new DecreaseStock(@event.Isbn, @event.Quantity));
172
+ public Task<IssueRenewalInvoice> MembershipRenewed(MembershipRenewed @event, EventContext context) =>
173
+ Task.FromResult(new IssueRenewalInvoice(@event.MemberId, @event.Amount));
172
174
  }
173
175
  ```
174
176
 
@@ -216,43 +218,49 @@ between domain failure and an observer's operational failure.
216
218
 
217
219
  | Slice type | Pattern |
218
220
  |------------|---------|
219
- | **Automation** | Reacts to events, makes decisions, triggers side effects |
220
- | **Translation** | Adapts events from one slice/system by triggering commands in another |
221
+ | **Automation** | Reacts to our own events, makes decisions, triggers side effects: an external call, a follow-up event (`produces`), or a follow-up command in another slice (`invokes`) |
222
+ | **Translation** | Takes data from outside the model's own facts (an external system or another service) and records it as our own facts. A reactor is only its adapter code; a reactor that turns our own event into a follow-up event or command is an Automation |
221
223
 
222
224
  ### Automation Example
223
225
 
224
226
  ```csharp
225
- public class ProjectRegisteredNotifier(INotificationService notifications) : IReactor
227
+ public class InvoiceIssuedNotifier(INotificationService notifications) : IReactor
226
228
  {
227
229
  /// <summary>
228
- /// Sends a notification when a project is registered.
230
+ /// Sends a notification when an invoice is issued.
229
231
  /// </summary>
230
232
  /// <param name="event">The event.</param>
231
233
  /// <param name="context">The event context.</param>
232
- public async Task ProjectRegistered(ProjectRegistered @event, EventContext context) =>
233
- await notifications.Notify($"Project '{@event.Name}' was registered.");
234
+ public async Task InvoiceIssued(InvoiceIssued @event, EventContext context) =>
235
+ await notifications.Notify($"Invoice '{@event.Number}' was issued.");
234
236
  }
235
237
  ```
236
238
 
237
- ### Translation Example
239
+ ### Automation Example — Returning a Command
238
240
 
239
241
  ```csharp
240
- [ExecuteCommandsAsSystem("inventory")]
241
- public class StockKeeping : IReactor
242
+ [ExecuteCommandsAsSystem("invoicing")]
243
+ public class RenewalBilling : IReactor
242
244
  {
243
245
  /// <summary>
244
- /// Reacts to a book reservation by decreasing stock in the inventory slice.
246
+ /// Reacts to a membership renewal by invoking the invoice issuing in the invoicing slice.
245
247
  /// </summary>
246
248
  /// <param name="event">The event.</param>
247
249
  /// <param name="context">The event context.</param>
248
250
  /// <returns>The command Arc executes as this reactor's side effect.</returns>
249
251
  [OnceOnly]
250
- public Task<DecreaseStock> BookReserved(BookReserved @event, EventContext context) =>
251
- Task.FromResult(new DecreaseStock(@event.Isbn, @event.Quantity));
252
+ public Task<IssueRenewalInvoice> MembershipRenewed(MembershipRenewed @event, EventContext context) =>
253
+ Task.FromResult(new IssueRenewalInvoice(@event.MemberId, @event.Amount));
252
254
  }
253
255
  ```
254
256
 
255
- The command is returned, not executed: Arc runs it through validation and authorization under the roles the class opts into, and a rejected command fails the partition instead of vanishing. `[OnceOnly]` keeps a replay from decreasing stock twice.
257
+ The command is returned, not executed: Arc runs it through validation and authorization under the roles the class opts into, and a rejected command fails the partition instead of vanishing. `[OnceOnly]` keeps a replay from issuing the renewal invoice twice.
258
+
259
+ ## Contract checks for a reactor
260
+
261
+ - **Field lineage:** every field of a returned command or event comes from the trigger event, an injected read model, or a mapping the contract states. Nothing is invented or defaulted.
262
+ - **Contract-authorized filtering:** every condition that skips an event is stated in the contract; do not add a skip the contract does not name.
263
+ - **Repeated delivery:** write a specification for the same event arriving again. Recovery re-delivers even with `[OnceOnly]`.
256
264
 
257
265
  ## Testing Reactors
258
266
 
@@ -265,9 +273,9 @@ void Establish()
265
273
  _scenario = new(new ServiceCollection().AddSingleton(_notifications).BuildServiceProvider());
266
274
  }
267
275
 
268
- async Task Because() => await _scenario.Given.ForEventSource(_id).Events(new ProjectRegistered("Acme"));
276
+ async Task Because() => await _scenario.Given.ForEventSource(_id).Events(new InvoiceIssued("INV-1001"));
269
277
 
270
- [Fact] async Task should_notify() => await _notifications.Received(1).Notify("Project 'Acme' was registered.");
278
+ [Fact] async Task should_notify() => await _notifications.Received(1).Notify("Invoice 'INV-1001' was issued.");
271
279
  ```
272
280
 
273
281
  For reactors that return side-effect events, assert the resulting appends through the scenario's event store; for non-event side effects, assert on the mocked services (as above). See [specs.scenarios.csharp.md](./specs.scenarios.csharp.md) for the full `*Scenario` family.
@@ -14,6 +14,8 @@ A vertical slice owns a single behavior: the command or query, the events it pro
14
14
 
15
15
  This file is the reference for *what* goes in each part of a slice. Layout, slice types, workflow, and quality gates are in [general.md](./general.md).
16
16
 
17
+ **Model-first check.** Before changing a slice, look for it in the accepted `.play` model (in the committed tree: `git ls-tree -r --name-only HEAD -- <root>` lists it; its HEAD version remains the contract until working-tree edits are committed) under the model root (default `.cratis/screenplay/`, or the root set by `mcpServers.screenplay.root` in `.cratis/ai.json`). A `.play` file outside the root or an untracked or uncommitted draft is not a contract. If an accepted model covers it, change the model and render or gap-fill from it; never edit Stage-managed files. See Phase 0 in [application-profile.md](./application-profile.md).
18
+
17
19
  ## Technical stack
18
20
 
19
21
  - .NET / C# (ASP.NET Core) — **Cratis Arc** for CQRS / model-bound commands and queries, **Cratis Chronicle** for event sourcing, MongoDB or EF Core for read models.
@@ -312,7 +314,7 @@ Group multi-event constraints under a shared name constant (`<Module>ConstraintN
312
314
 
313
315
  ## Reactors **[contract]**
314
316
 
315
- `IReactor` is a marker interface; dispatch is by the first parameter type. Reactors live only in Automation/Translation slices. See [reactors.md](./reactors.md) for full rules, or invoke the **cratis-chronicle-reactor** skill.
317
+ `IReactor` is a marker interface; dispatch is by the first parameter type. Reactors live in Automation slices (reacting to events, calling external systems, returning follow-up commands/events) and in Translation slices that record outside data as our facts. See [reactors.md](./reactors.md) for full rules, or invoke the **cratis-chronicle-reactor** skill.
316
318
 
317
319
  ```csharp
318
320
  public Task AuthorRegistered(AuthorRegistered @event, EventContext context) => ...
@@ -178,6 +178,19 @@ Run the project's frontend test gate (typically `yarn test`) plus lint and the
178
178
  TypeScript build. Specifications complement lint and build; they do not replace
179
179
  them.
180
180
 
181
+ ## Route near misses
182
+
183
+ - An accepted `.play` model under the model root covers the behavior, or the
184
+ repository is opted in (the root holds a committed `.play` file (`git ls-tree -r --name-only HEAD -- <root>` lists it), or the project set
185
+ `mcpServers.screenplay.root` in `.cratis/ai.json`; an empty directory, install
186
+ output, an uncommitted `.play` draft or a `.play` file outside the root does not count; master definition:
187
+ `cratis-screenplay-modeling-lifecycle`): change the model first with
188
+ `cratis-screenplay-event-modeling`. If the Screenplay skills are not installed,
189
+ say so and do not author `.play` from memory.
190
+ Edit code here only for infrastructure, clients, adapters, Screenplay code
191
+ attachments, or gap-fill scope (`cratis-screenplay-render-and-gap-fill`);
192
+ never edit Stage-managed output.
193
+
181
194
  ## Verify
182
195
 
183
196
  - Files sit in `for_<Subject>/when_<context>/` beside the unit, in snake_case.
@@ -0,0 +1,2 @@
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.
@@ -0,0 +1,173 @@
1
+ ---
2
+ name: cratis-application-slice-conformance
3
+ description: "Reconcile a Cratis slice's hand-written or gap-filled code and specifications with its contract (the `.play` slice and its specifications, else the agreed slice outline) in both directions: every contracted field, rule, event, read-model property and specification has a realization, and nothing in code lacks authority. Use when implementing a slice, re-delivering after a model change, finishing gap-fill after a render, or reviewing slice code. Not for: deciding what the slice should do (use `cratis-chronicle-event-modeling` or `cratis-screenplay-slice-design`), writing the specifications themselves (use `cratis-application-slice-specifications`), or rendering (use `cratis-screenplay-render-and-gap-fill`)."
4
+ license: MIT
5
+ ---
6
+
7
+ # Slice conformance: the code matches its contract, element by element
8
+
9
+ ## Purpose
10
+
11
+ Hand-written code drifts from what was agreed in two directions: something agreed is
12
+ missing, or something nobody agreed is there. This skill is the check that closes both, plus
13
+ the rules for specifications, re-delivery and the final status. It does not decide what a
14
+ slice should do; the contract does.
15
+
16
+ Model-first rule: when a `.play` model covers the slice, the model is the contract and
17
+ the code is derived. Code is written only for scope the renderer rejects, adapters and
18
+ other infrastructure. Change behaviour in the model first, never in managed output.
19
+
20
+ ## When to use / when not
21
+
22
+ - Use: implementing or finishing a slice by hand; gap-fill after a render; re-delivery after a
23
+ model or outline change; reviewing slice code; a hand-over where "done" must mean something.
24
+ - Not for: the choice of behaviour (`cratis-screenplay-slice-design`,
25
+ `cratis-chronicle-event-modeling`); how to write specifications
26
+ (`cratis-application-slice-specifications`); the render workflow itself
27
+ (`cratis-screenplay-render-and-gap-fill`).
28
+
29
+ ## Verified product sources
30
+
31
+ This skill is a method: it names no API of its own. Product facts it relies on are pinned
32
+ to these tags; when the Screenplay skills are installed their `references/versions.md`
33
+ (in `cratis-screenplay-toolchain`) holds the full table.
34
+
35
+ | Fact used here | Source |
36
+ | --- | --- |
37
+ | Where each rule lives (validator, `Provide()`, handler result, constraint, exception) | `rules/vertical-slices.md` "The decision matrix" (Arc `v22.50.5` behaviour verified there) |
38
+ | A customization never makes a rejected model renderable; managed output is never hand-edited | Stage `v4.24.0` (`Customizations/` is the unmanaged seam; managed output is regenerated) |
39
+ | A command `handler` never binds (PLAY0268), so that slice is gap-fill with the model as contract | Screenplay `v4.64.0` (diagnostic PLAY0268) |
40
+
41
+ ## Procedure
42
+
43
+ ### 1. Name the contract and its precedence
44
+ Find the contract before touching code; say which one you are using. These steps are enough on
45
+ their own when the Screenplay skills are not installed; the master decision rule, when they
46
+ are, is `cratis-screenplay-modeling-lifecycle` ("Decide the level first").
47
+ 1. An accepted `.play` model under the model root (default `.cratis/screenplay/`, or the root
48
+ set by `mcpServers.screenplay.root` in `.cratis/ai.json`) covers the slice (search
49
+ `**/*.play` for the slice, command, event and read-model names): the `.play` slice and its
50
+ specifications are the contract. "Accepted" means the `.play` file is in the committed tree
51
+ (`git ls-tree -r --name-only HEAD -- <root>` lists it). Staged or untracked files under the
52
+ root are drafts, not contracts; a file outside the root is not a contract. A committed file
53
+ with uncommitted working-tree edits is a model change in progress: its HEAD version is the
54
+ contract until the change is committed.
55
+ 2. The repository is opted in (the root holds a committed `.play` file, or the project
56
+ explicitly set that root, even if it is empty; an empty unconfigured directory, install
57
+ output, an installed skill or an uncommitted draft does not count) but this
58
+ scope has no model yet: new behaviour starts in discovery and slice design
59
+ (`cratis-screenplay-discovery`, `cratis-screenplay-slice-design`); do not code first. If those
60
+ skills are not installed, say so and do not author `.play` from memory.
61
+ 3. Not opted in: never force a model. The agreed slice outline (fields, events, rules,
62
+ scenarios), confirmed as before and recorded where the team tracks work, if anywhere, is the
63
+ contract. Only the entry-point session proposes a model, at most once per session.
64
+ 4. Existing code has no authority over the contract.
65
+
66
+ Precedence inside the contract. Executable parts of the contract beat prose: specifications,
67
+ mappings, constraints and authorization first; then the `description` and realization notes;
68
+ then issue text. If prose contradicts an executable part, that is a model defect: stop that
69
+ scope, return an **edit request** (address, change, reason) and do not pick a side silently.
70
+ Reading a question is not resolving it. Details: `references/contract-and-precedence.md`.
71
+
72
+ ### 2. Inventory per element (a working list, not a deliverable)
73
+
74
+ | Slice type | List |
75
+ | --- | --- |
76
+ | State Change | each command property and its authorization; each event with its properties; each rule, with the mechanism that enforces it |
77
+ | State View | each read-model property and its source event; subscribed events; removal and update events; query cardinality, filters and caller scope |
78
+ | Automation / Translation | trigger event(s); each field of the produced command or event with its source (trigger, injected read model, contract mapping); filter conditions; repeat behaviour |
79
+
80
+ Slice-type checklists and the Chronicle runtime guarantees: `references/checklists.md`.
81
+
82
+ ### 3. Reconcile in both directions
83
+ - Contract to code: every listed element has a realization; list each gap.
84
+ - Code to contract: every business field, default, rule, filter or outcome in code has
85
+ contract authority. Anything else is invented: remove it, or if it is a real need, propose it
86
+ for the contract (the `.play` model when one covers the slice, otherwise the agreed outline)
87
+ and stop that scope. Framework metadata (stream type, concurrency scope,
88
+ `[OnceOnly]`) is infrastructure and never changes the domain contract.
89
+ - A rule that lives only in code but is modeled elsewhere is a defect, not a convenience.
90
+ - Unrelated contracts stay as they were. Identity-affecting changes (renames, moves, removal of
91
+ persisted names) go to the identity owner (`cratis-screenplay-modeling-lifecycle`
92
+ `references/identity-and-edits.md`); a non-owner returns an edit request.
93
+
94
+ ### 4. Map specifications one to one
95
+ Each contract specification gets one executable specification whose name reads as that
96
+ specification's name; split it only if every assertion survives. Report the mapping
97
+ (contract specification, spec class, result). Rejections map to the rule they name: build the
98
+ command valid in every other respect so a neighbouring rule cannot make it pass. Use the
99
+ contract's example values except where uniqueness needs fresh ones. Code-derived cases the
100
+ contract lacks are extra, and reported as proposals for the contract (the `.play` model when
101
+ one covers the slice, otherwise the agreed outline).
102
+
103
+ **Never edit, skip or delete a specification derived from the contract to make code pass.**
104
+ Change the code, or return an edit request. Do not touch test files outside the slice unless
105
+ told to.
106
+
107
+ ### 5. Delta delivery
108
+ After a model or outline change, the work list is every element and specification that
109
+ changed since the last delivery, including a delivery of only added specifications. Then run
110
+ steps 3 and 4 over the whole slice once more, because a change often invalidates a neighbour.
111
+
112
+ ### 6. Conflicting evidence
113
+ Contract against code, prose against a mapping, or a specification against its own
114
+ description: stop that scope, record both readings with their addresses, ask one specific
115
+ question or return an edit request. Finish unaffected scope only if it stands alone. Do not
116
+ build anyway. Template against repository: the repository's established pattern wins
117
+ over a skill's generic template; note the mismatch as a learning.
118
+
119
+ ### 7. Status
120
+ End every delivery with `Status: done | partial | blocked`:
121
+
122
+ | Status | Meaning |
123
+ | --- | --- |
124
+ | `done` | everything maps, nothing invented, the slice's specifications pass, unrelated gates green |
125
+ | `partial` | listed gaps remain (each named); the rest conforms |
126
+ | `blocked` | one specific question or edit request is open; nothing guessed |
127
+
128
+ Worked reconciliation and report shape: `references/worked-example.md`.
129
+
130
+ ## Gate
131
+
132
+ Before reporting `done`, all hold:
133
+ - The contract is named and its specification list is in hand.
134
+ - Every contracted element has a realization and nothing invented remains in code.
135
+ - Every contract specification maps to an executed spec; none was weakened, skipped or deleted
136
+ to accommodate code; changes follow only an approved contract revision and keep unaffected
137
+ assertions; skipped or unexecuted specs are listed.
138
+ - The runner and per-specification outcomes are reported apart from any integration result.
139
+ - Deliberate divergences are listed with who approved them; none is called equivalent.
140
+ - Unresolved conflicts are `blocked`, never absorbed.
141
+
142
+ Passing specs are the evidence; the inventory is an aid, never a receipt.
143
+
144
+ ## Verify
145
+
146
+ - Run the slice's own specifications with the repository's runner and report the real result.
147
+ - Re-read the inventory against the code once more, looking only for invented content.
148
+ - For a `.play` contract, run the repository's Screenplay model check (the compiler named in
149
+ `cratis-screenplay-toolchain` when installed) after any edit request is applied, never before.
150
+
151
+ ## Route near misses
152
+
153
+ - What should the slice do or which events exist: `cratis-chronicle-event-modeling`,
154
+ `cratis-screenplay-slice-design`.
155
+ - How to write or place specifications: `cratis-application-slice-specifications`,
156
+ `cratis-chronicle-read-model-specifications`, `cratis-specification-by-example`.
157
+ - Which scenarios the model itself must have: `cratis-screenplay-scenario-coverage`.
158
+ - Rendering, rejections and gap-fill workflow: `cratis-screenplay-render-and-gap-fill`,
159
+ `cratis-stage-rendering-and-sandbox`.
160
+ - Where a business rule lives in code: `cratis-arc-command-validation`, `cratis-arc-command`.
161
+ - General review of a diff: `cratis-code-review`.
162
+
163
+ ## References (load on demand)
164
+
165
+ - `references/contract-and-precedence.md` - sources, precedence, conflicting evidence.
166
+ - `references/checklists.md` - State Change, State View, Automation final checklists; Chronicle runtime guarantees; evidence.
167
+ - `references/worked-example.md` - a marina slice reconciled and re-delivered, with the report.
168
+ - `references/provenance.md` - sources and attribution.
169
+
170
+ ## Lineage
171
+
172
+ Merges the fallback-conformance checklist of the render workflow with the final-verification
173
+ idea of Nebulit's slice build instructions (own words); see `references/provenance.md`.
@@ -0,0 +1,66 @@
1
+ # Final checklists
2
+
3
+ Reconcile in both directions with each list. Moved here from the render workflow; it gives
4
+ the renderer no right to browse managed output or implement rejected semantics.
5
+
6
+ ## Contract reconciliation
7
+ - Every modeled command field, event and payload field, rule, authorization gate, projection
8
+ dependency, query behaviour and specification has a realization.
9
+ - Every business field, default, rule, filter or outcome in code has contract authority;
10
+ otherwise stop and ask. Framework metadata is infrastructure and must not change the domain
11
+ contract.
12
+ - Unrelated contracts stay as they were.
13
+ - Descriptions explain intent; they do not license contradictions or undocumented defaults.
14
+
15
+ ## State Change
16
+ - Keep event-source identity and production destinations; add no duplicate identity payload
17
+ unless the model needs it.
18
+ - Derive decision state from authoritative facts, no larger than the rules need; replay and
19
+ decisions are deterministic and free of external effects.
20
+ - Name where each invariant is enforced atomically, including claims spanning sources. A stale
21
+ view or a caller-supplied status is not enforcement; a state-dependent rule the model marks
22
+ not enforced today needs a protected read or concurrency scope in code (where each rule
23
+ belongs: `rules/vertical-slices.md`, "The decision matrix").
24
+ - Keep validation messages; separate validation rejection from authorization denial.
25
+ - Test the specified repeat behaviour: once-only occurrence, rejected retry, idempotent
26
+ success and external-effect delivery are different guarantees.
27
+ - Verify command registration, transport mapping and inherited authorization against
28
+ repository conventions, not a copied route template.
29
+ - No business rule in code that the contract does not state.
30
+
31
+ ## State View
32
+ - Keep field types, precision, optionality, identity and key selection; add no
33
+ processing-time values or business defaults absent from the model.
34
+ - Every read-model property has a source, and the subscribed events equal the modeled
35
+ events; do not subscribe to every nearby event. Honour the actual sources, joins, removals
36
+ and auto-mapping.
37
+ - Keep population, later updates and removal; a partial update leaves other fields unchanged.
38
+ - Verify query cardinality, filters, caller scope and authorization; do not turn a list into
39
+ a keyed lookup or the reverse.
40
+ - Verify registration and event consumption in the target runtime, and replay or rebuild
41
+ behaviour; state any consistency limitation.
42
+
43
+ ## Automation and Translation
44
+ - Each field of the produced command or event maps from the trigger event, an injected read
45
+ model or a contract mapping, and from nothing else.
46
+ - No filter condition the contract does not state.
47
+ - The repeated-delivery behaviour in the contract has a specification: what happens when the
48
+ trigger arrives twice.
49
+ - Outside calls follow `cratis-engineering-effect-boundaries`; the reaction side is
50
+ `cratis-chronicle-reactor`.
51
+
52
+ ## Chronicle runtime guarantees
53
+ Follow the owning corpus skill. Verify the actual namespace, subject, constraint scope,
54
+ guarded-read admission, migrations and replay. A passing generated specification suite proves
55
+ none of these. Unsupported semantics remain gap-fill scope, never hidden customizations.
56
+
57
+ ## Evidence
58
+ - Map every accepted specification to its executed test or test family (name and qualified
59
+ address kept; splitting is fine if all assertions survive).
60
+ - Passing all existing tests cannot show that missing denial, competing-claim, branch or
61
+ removal cases are covered; check applicability upstream with `cratis-screenplay-scenario-coverage`.
62
+ - Use isolated fixture state; tests never depend on another test's writes.
63
+ - For storage, transaction, registration or migration claims, use the repository's integration
64
+ route with real configuration. Report runner, configuration and per-specification outcomes
65
+ apart from integration results; skipped and unexecuted cases stay visible.
66
+ - Record deliberate divergences and their approval; never call them equivalent behaviour.