@cratis/pi 7.48.4 → 7.49.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 (63) hide show
  1. package/package/corpus/agents/screenplay-modeler.md +2 -1
  2. package/package/corpus/agents/screenplay-renderer.md +2 -2
  3. package/package/corpus/agents/screenplay-reviewer.md +1 -1
  4. package/package/corpus/agents/slice-implementer.md +13 -3
  5. package/package/corpus/hooks/README.md +28 -1
  6. package/package/corpus/hooks/scripts/cratis-guard-writes.sh +75 -0
  7. package/package/corpus/skills/cratis-application-slice-conformance/LICENSE +5 -0
  8. package/package/corpus/skills/cratis-application-slice-conformance/references/build-prompts.md +38 -19
  9. package/package/corpus/skills/cratis-application-slice-conformance/references/checklists.md +4 -0
  10. package/package/corpus/skills/cratis-application-slice-conformance/references/provenance.md +17 -0
  11. package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +27 -0
  12. package/package/corpus/skills/cratis-application-slice-specifications/references/provenance.md +6 -0
  13. package/package/corpus/skills/cratis-chronicle-event-modeling/LICENSE +5 -0
  14. package/package/corpus/skills/cratis-chronicle-event-modeling/SKILL.md +4 -1
  15. package/package/corpus/skills/cratis-chronicle-reactor/references/provenance.md +6 -0
  16. package/package/corpus/skills/cratis-chronicle-reactor/references/slice-delivery-checklist.md +5 -0
  17. package/package/corpus/skills/cratis-chronicle-read-model-specifications/SKILL.md +2 -0
  18. package/package/corpus/skills/cratis-screenplay-discovery/LICENSE +5 -0
  19. package/package/corpus/skills/cratis-screenplay-discovery/SKILL.md +3 -0
  20. package/package/corpus/skills/cratis-screenplay-discovery/references/domain-analysis-template.md +26 -1
  21. package/package/corpus/skills/cratis-screenplay-discovery/references/provenance.md +9 -0
  22. package/package/corpus/skills/cratis-screenplay-event-modeling/LICENSE +5 -0
  23. package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +7 -5
  24. package/package/corpus/skills/cratis-screenplay-event-modeling/references/provenance.md +10 -0
  25. package/package/corpus/skills/cratis-screenplay-legacy-extraction/LICENSE +5 -0
  26. package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +31 -34
  27. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/evidence-table-template.md +64 -2
  28. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/expert-verification.md +18 -1
  29. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/interview-findings.md +5 -2
  30. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/loss-report-template.md +5 -0
  31. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/provenance.md +20 -0
  32. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/re-entry-and-passes.md +89 -0
  33. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/rule-modeling.md +9 -0
  34. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/signal-to-intent.md +28 -1
  35. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/ui-observation.md +4 -0
  36. package/package/corpus/skills/cratis-screenplay-legacy-extraction/verification.json +4 -0
  37. package/package/corpus/skills/cratis-screenplay-model-review/LICENSE +5 -0
  38. package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +5 -0
  39. package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +1 -1
  40. package/package/corpus/skills/cratis-screenplay-model-review/references/model-inventory-report.md +11 -0
  41. package/package/corpus/skills/cratis-screenplay-model-review/references/provenance.md +10 -0
  42. package/package/corpus/skills/cratis-screenplay-model-review/references/stressor-analysis.md +74 -0
  43. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/LICENSE +5 -0
  44. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +12 -11
  45. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/delivery-protocol.md +2 -2
  46. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/{drift-and-ledger.md → drift-and-fallback-record.md} +53 -6
  47. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +12 -11
  48. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/provenance.md +11 -1
  49. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/renderability-gate.md +3 -3
  50. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/worked-example.md +2 -2
  51. package/package/corpus/skills/cratis-screenplay-scenario-coverage/LICENSE +5 -0
  52. package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +6 -6
  53. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/coverage-matrix.md +7 -0
  54. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/provenance.md +9 -0
  55. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-catalogue.md +29 -3
  56. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-examples.md +2 -0
  57. package/package/corpus/skills/cratis-screenplay-slice-design/LICENSE +5 -0
  58. package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +5 -4
  59. package/package/corpus/skills/cratis-screenplay-slice-design/references/command-inventory.md +64 -0
  60. package/package/corpus/skills/cratis-screenplay-slice-design/references/field-lineage.md +24 -0
  61. package/package/corpus/skills/cratis-screenplay-slice-design/references/provenance.md +10 -0
  62. package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +1 -0
  63. package/package.json +1 -1
@@ -74,7 +74,8 @@ report and slice `documentation`, and continue.
74
74
  separate reasons change these values, then split (`references/slicing.md` *Generic edits*).
75
75
  One input per thing the caller decides or supplies; `identifier` on the property naming the
76
76
  instance (omit only for allocation); inline `produces event <Name>` (no `for`) when the command owns the event; plain `produces <Name>` needs `for <identifier>`. Trace each input
77
- (`references/field-lineage.md`). A conditional input is a granularity question: two
77
+ (`references/field-lineage.md`) and list the values each rule reads: input, state or context
78
+ (`references/command-inventory.md`). A conditional input is a granularity question: two
78
79
  decisions are two commands; one decision with a dependent rule is an implication
79
80
  (`require a == false or b > c`). Never a boolean attestation input (`confirmsX == true`)
80
81
  standing in for a rule. Place each rule in its layer (`references/rule-layers.md`). A rule
@@ -83,7 +84,7 @@ report and slice `documentation`, and continue.
83
84
  `[ProtectedDecision]` + `DecisionRead<T>` on Arc 22.39.0+ (available to gap-fill
84
85
  code with the Arc and Chronicle the Stage 4.73.1 scaffold pins); Chronicle DCB; or a constraint). Never copy state
85
86
  into the command as input or hide a rule in `handler` / hint prose; descriptions reach code
86
- only as XML comments (Stage#178). Fill the **refusal inventory**: success, each distinct refusal with
87
+ only as XML comments. Fill the **refusal inventory**: success, each distinct refusal with
87
88
  layer and message, and the denied persona.
88
89
  4. **Name and shape the event.** Past tense, the specific change that became true
89
90
  (`LockerRelocated`, `VolumeCorrected`); never `XUpdated`/`Changed`/`Edited`/`Saved`/
@@ -131,7 +132,7 @@ report and slice `documentation`, and continue.
131
132
  (`references/read-model-design.md`). One actor's point of view
132
133
  per screen, at a real beat of the story, not one per persona for symmetry; know where the
133
134
  actor sees each state change's result. Beyond Level 1: `cratis-screenplay-ui-composition`.
134
- 8. **Lineage pass.** Build the matrix in `references/field-lineage.md` from the `.play` files
135
+ 8. **Lineage pass.** After each field edit run `--check field-origins,input-surfaces`. Build the matrix in `references/field-lineage.md` from the `.play` files
135
136
  (read them), not from memory or an earlier summary. For each read model, write one line per
136
137
  contributing event in its StateView slice `documentation`: which fields it sets and why. An
137
138
  event with no reason does not belong in the view. A field without an origin is a gap: add
@@ -166,7 +167,7 @@ report and slice `documentation`, and continue.
166
167
  - A `unique` constraint names a property the event declares directly; the constraint name is
167
168
  its identity (renaming starts an empty index).
168
169
  - Unauthorized is `then denied`; a broken rule is `then error`; authorization runs first.
169
- - A mapping to an undeclared target fails only at binding (V3, PLAY0273); a declared property that nothing maps (for example after a one-sided rename that AutoMap relied on) is reported by no tool: check field lineage by hand.
170
+ - A mapping to an undeclared target fails only at binding (V3, PLAY0273); a declared property that nothing maps (for example after a one-sided rename that AutoMap relied on) is reported by `field-origins` only where coverage is known: trace by hand too.
170
171
 
171
172
  ### Modeling defaults (follow unless the domain gives a reason not to)
172
173
 
@@ -3,6 +3,7 @@
3
3
  ## Contents
4
4
 
5
5
  - Command card
6
+ - Values a rule reads
6
7
  - The inventory
7
8
  - Filled for `worked-example.md`
8
9
  - Common mistakes
@@ -26,6 +27,7 @@ Origins: <screen action / form / reaction invokes (event, clock or applic
26
27
  a reaction)
27
28
  Inputs: <property: Concept - who supplies it - why the caller decides it>
28
29
  Identifier: <property naming the instance, or "allocation" with the reason>
30
+ Reads: <per rule: each value it reads, as input | state | context>
29
31
  Rules by layer: <concept validate | command validate/require | authorize | claim policy
30
32
  | constraint | stored-state (NOT enforced, target named)>
31
33
  Success: <event(s) with for <identifier>, payload mapping>
@@ -57,6 +59,64 @@ issues no command; any later command is reached through a reaction. Design
57
59
  these in `cratis-screenplay-automations-and-translations`. Every automation-issued command states
58
60
  what happens when it fails or is retried.
59
61
 
62
+ ## Values a rule reads
63
+
64
+ Before placing a rule in a layer, list every value it reads and classify each one:
65
+
66
+ - **input**: a command property the caller decides.
67
+ - **state**: a `reads <View>` path, or the prior facts of the stream.
68
+ - **context**: the time the decision occurs, the caller, the tenant.
69
+
70
+ A value that fits none of the three is a gap: a missing input, a missing view or a hidden
71
+ dependency. Do not close it with prose in `description` or `handler`.
72
+
73
+ Context is never a command property. The pipeline supplies who is calling and when, because a
74
+ caller-supplied "who am I" or "what time is it" cannot be trusted, and a field the caller
75
+ fills is still an input. A date the person chooses (a start day, a requested slot) is an
76
+ input; "now" is context. A declarative `require` reads only command properties and read state,
77
+ so a rule over context is a named `rule` with a code body (its `RuleContext` carries
78
+ `Occurred`, `CausedBy` and `Tenant`), or an `authorize` policy when it concerns roles or
79
+ claims. The reference runner cannot execute an opaque body: record that, do not delete the
80
+ rule. When a rule depends on a local calendar day ("before midnight", "a business day"), state
81
+ whose timezone applies and where it comes from (an input, a setting read through a view, or an
82
+ open question).
83
+
84
+ Give each context-reading rule its own inventory row, and have its specification state the
85
+ context it relies on: `given clock` for time, `given caller` or `given caller as <Persona>`
86
+ for the actor. A time rule without `given clock` is not pinned.
87
+
88
+ ~~~screenplay test=unbound
89
+ domain Bikeshare.Rentals
90
+
91
+ concept ReservationId : Uuid
92
+ concept BikeId : Uuid
93
+
94
+ module Rentals
95
+ feature Reservations
96
+ slice StateChange ReserveBike
97
+ command ReserveBike
98
+ reservationId ReservationId identifier
99
+ bikeId BikeId
100
+ startTime DateTime
101
+ validate
102
+ startTime rule StartsAfterRequest message "The start time has already passed"
103
+ ```csharp
104
+ return (DateTimeOffset)context.Value > context.Occurred;
105
+ ```
106
+ produces event BikeReserved
107
+ bikeId BikeId = bikeId
108
+ startTime DateTime = startTime
109
+ reservedAt DateTime = $context.occurred
110
+
111
+ specification RejectingAStartTimeInThePast
112
+ given clock "2026-06-01T09:00:00Z"
113
+ when ReserveBike
114
+ reservationId = "6b2a5f0e-6d1c-4f4e-9f57-3a9a6d3c8b10"
115
+ bikeId = "0d7c3a34-5a43-4c1a-8f7e-9a1c2b3d4e5f"
116
+ startTime = "2026-06-01T08:00:00Z"
117
+ then error "The start time has already passed"
118
+ ~~~
119
+
60
120
  ## The inventory
61
121
 
62
122
  One row per outcome. The layer says where the refusal is enforced; the spec column says
@@ -79,6 +139,8 @@ Rules for filling it:
79
139
  available, including Stage 4.73.1's rendered package set for gap-fill, not emitted
80
140
  protection; Chronicle DCB, or a
81
141
  constraint). It still gets a spec row, because the intended behaviour is the contract.
142
+ - Every rule row names what the rule reads (input, state or context); a context read needs a
143
+ `given clock` or `given caller` in the spec that pins it.
82
144
  - A decided refusal never goes to open questions: it goes here, then to scenarios.
83
145
  - A refusal message is a fact of the design; keep the wording identical in the rule, the
84
146
  inventory and the spec.
@@ -122,6 +184,8 @@ not been asked the refusal questions.
122
184
  - A reaction invoking a gated command without `runs as system role "<Role>"`: the invocation has
123
185
  no caller and is refused; declare the trusted path with the role the gate admits
124
186
  (`cratis-screenplay-automations-and-translations`), never delete the gate.
187
+ - A time- or actor-dependent rule written as if it only read inputs: its specification passes
188
+ for the wrong reason, or cannot be reproduced.
125
189
  - Refusals recorded as prose in the `description` with no layer and no spec row.
126
190
  - Personal data or secrets as command input: values are by default recorded in the causation chain, so treat them as permanent
127
191
  (retention can be configured in newer Chronicle; verify it, never audit secrets).
@@ -2,7 +2,9 @@
2
2
 
3
3
  ## Contents
4
4
 
5
+ - Where information starts
5
6
  - Where values come from, per element
7
+ - Check as you edit
6
8
  - The matrix
7
9
  - The reason line per contributing event
8
10
  - Gap handling
@@ -12,6 +14,12 @@ Every value in the model has a place it comes from and a place it goes. If you c
12
14
  where a field comes from, the model is missing an input, an event field or a decision. If an
13
15
  event field goes nowhere, ask why it is recorded (audit and history are valid answers; say so).
14
16
 
17
+ ## Where information starts
18
+
19
+ Every value starts at one specific place and is carried by name from there: the person's
20
+ input on a screen, the runtime's context (caller, time, tenant), an identifier the runtime
21
+ allocates, or a view's own calculation. A value with no such start is a gap, not a default.
22
+
15
23
  ## Where values come from, per element
16
24
 
17
25
  **Command property**
@@ -23,6 +31,7 @@ event field goes nowhere, ask why it is recorded (audit and history are valid an
23
31
  | the instance being acted on | the `identifier` property, carried from the screen row or route | |
24
32
  | allocated by the runtime | `Type generated` on a required scalar generatable Uuid/String concept (implicit UUID is v7; explicit serialized strategy selects v15, Screenplay 4.147.0+ with strict fixtures and whole-source freshness). CLI 3.57.0 / Stage 4.89.1 render supported strategies; types/combinations retain -028/-038; no concept rules. See command-surface `references/generated-values-and-responses.md` | never a request input or form field; no policy, rule or requirement may read it (`PLAY0273`); return it with `returns`; where a tool cannot bind it, executable scope needs explicit allocation |
25
33
  | an outside party | capture field `$.x` or a reaction trigger value | `cratis-screenplay-automations-and-translations` |
34
+ | time of the decision | not an input: `$context.occurred` in `produces`; a rule reads it as `context.Occurred` in a named rule (`command-inventory.md` *Values a rule reads*) | a date the person chooses is an input; "now" is context |
26
35
  | the caller | not an input: `$context.identity.*` in `produces`; who may act in `authorize`; "acting on own X" is a claim policy matched to the identifier or a command property | never trust a caller-supplied "who am I" |
27
36
 
28
37
  **Event property** - set only in `produces` mappings, from:
@@ -44,6 +53,21 @@ duration, a sum of rows) is recorded as `derived: <expression>` with its origin
44
53
  condition in the matrix, then decide: two commands (two decisions) or one command with an
45
54
  implication rule. Never leave it implicit.
46
55
 
56
+ ## Check as you edit
57
+
58
+ After every edit that adds, renames or removes a field, run the opt-in structural checks on
59
+ the model root rather than waiting for the audit: `field-origins` (a read-model field with no
60
+ origin), `input-surfaces` (a command nothing issues), `data-bindings`, `query-keys` and
61
+ `event-consumers`. Use `--check` on the standalone tool or the MCP `diagnostics` `checks`;
62
+ flags and versions are in `cratis-screenplay-toolchain`. They run only when the whole model
63
+ has no source errors, so fix those first and never read a skipped check as clean.
64
+
65
+ - A finding is a prompt to look, not proof of a gap, and a clean result covers structure only.
66
+ It does not replace the matrix for command inputs, screen fields, reducers or performer views.
67
+ - An origin must be known, not just labeled. Calling an unknown value "allocated", "derived"
68
+ or "from context" to close a row is the same failure as leaving it blank: mark it `gap`
69
+ and ask.
70
+
47
71
  ## The matrix
48
72
 
49
73
  One row per field, per slice touched, built from the `.play` files, not from memory or an
@@ -39,3 +39,13 @@ by Martin Dilger and Nebulit GmbH (https://nebulit.de), used with the explicit c
39
39
  | `.build-kit/.slices/restaurant/*/slice.json` | none in this skill | patterns only; passed to scenario coverage (spec example values that vary one rule) |
40
40
  | `.claude/skills/eventmodeling-identifying-outputs/SKILL.md`, "Common Patterns": status, list, timeline and processor-decision view patterns | `references/read-model-design.md` "Common view patterns" | Adapted closely as a table over `readmodel`, projection and `query`; the pseudo-code blocks became prose |
41
41
  | `.claude/skills/eventmodeling-orchestrating-event-modeling/SKILL.md`, "Recognizing a dedicated business event behind a derived condition": the "is this fact worth a new event" test, producing it by automation, fold only redundant causes, display-only conditions stay projections | `references/derived-condition-events.md` | Adapted closely; the todo-list translation pattern became a `reaction` that `produces` (a pending-work view only when the work can wait, retry or fail); the >3-events heuristic stays in `read-model-design.md`; board placement, 0,0-node scans and `validate_model` batch calls not adopted |
42
+
43
+ ### Eventmodelers Build-Kits
44
+
45
+ Source: https://github.com/Nebulit-GmbH/Eventmodelers-Build-Kits, by Martin Dilger and Nebulit GmbH
46
+ (https://nebulit.de), used with the explicit consent of Martin Dilger and Nebulit GmbH.
47
+
48
+ | Source skill | Used in | How |
49
+ |---|---|---|
50
+ | `eventmodeling-identifying-inputs` | `references/command-inventory.md` *Values a rule reads*; `references/field-lineage.md` | adapted closely: list every value a rule reads and classify it as input, state or context; time, caller and tenant are context, never caller-supplied, and a date the person chooses stays an input; the worked reservation example restated in Screenplay; the upstream mechanism of putting time and the acting user on the command is not adopted |
51
+ | `eventmodeling-information-completeness` | `references/field-lineage.md` *Where information starts*, *Check as you edit* | adapted closely: every value starts at one specific place and is carried by name; an unknown origin is a gap, never labeled to close a row; checked as each field is edited |
@@ -261,6 +261,7 @@ criterion.
261
261
  For every specification:
262
262
 
263
263
  - [ ] Concrete, realistic values — never "valid user" or "some amount".
264
+ - [ ] The values the outcome depends on are visible in the body, at the edge that matters.
264
265
  - [ ] Tests exactly one behavior, independent of other specifications.
265
266
  - [ ] Business language matching the event-model vocabulary.
266
267
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "7.48.4",
3
+ "version": "7.49.0",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [