@milehimikey/em 1.13.0 → 1.14.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 (239) hide show
  1. package/.claude/agents/em-critic.md +26 -0
  2. package/.claude/agents/em-implementer.md +34 -0
  3. package/.claude/agents/em-reviewer.md +31 -0
  4. package/.claude/agents/em-validator.md +27 -0
  5. package/.claude/skills/event-modeling/SKILL.md +52 -12
  6. package/.claude/skills/event-modeling-conform/SKILL.md +1 -1
  7. package/.claude/skills/event-modeling-conform/reference/conform.md +1 -1
  8. package/.claude/skills/event-modeling-design/SKILL.md +140 -18
  9. package/.claude/skills/event-modeling-discover/SKILL.md +1 -1
  10. package/.claude/skills/event-modeling-engagement/SKILL.md +192 -0
  11. package/.claude/skills/event-modeling-engagement/reference/engagement.md +143 -0
  12. package/.claude/skills/event-modeling-implement/SKILL.md +7 -4
  13. package/.claude/skills/event-modeling-implement/reference/implement.md +51 -12
  14. package/.claude/skills/event-modeling-review/SKILL.md +1 -1
  15. package/.claude/skills/event-modeling-shared/reference/em-dsl.md +274 -188
  16. package/.claude/skills/event-modeling-shared/reference/operating-principles.md +61 -0
  17. package/.claude/skills/event-modeling-shared/reference/slice-doc-schema.md +116 -4
  18. package/.claude/skills/event-modeling-shared/templates/constitution.md +18 -1
  19. package/.claude/skills/event-modeling-shared/templates/slice.md +64 -39
  20. package/.claude/skills/event-modeling-shared/templates/state.md +5 -1
  21. package/.claude-plugin/marketplace.json +14 -0
  22. package/README.md +25 -11
  23. package/dist/catalog/apiFirst.d.ts +28 -0
  24. package/dist/catalog/apiFirst.js +49 -0
  25. package/dist/catalog/apiFirst.js.map +1 -0
  26. package/dist/catalog/docJoin.d.ts +13 -0
  27. package/dist/catalog/docJoin.js +11 -0
  28. package/dist/catalog/docJoin.js.map +1 -1
  29. package/dist/catalog/docModelConsistencyValidate.js +44 -4
  30. package/dist/catalog/docModelConsistencyValidate.js.map +1 -1
  31. package/dist/catalog/invariantsValidate.d.ts +4 -0
  32. package/dist/catalog/invariantsValidate.js +102 -0
  33. package/dist/catalog/invariantsValidate.js.map +1 -0
  34. package/dist/catalog/scenarios.d.ts +15 -0
  35. package/dist/catalog/scenarios.js +97 -0
  36. package/dist/catalog/scenarios.js.map +1 -0
  37. package/dist/catalog/sliceDoc.d.ts +8 -0
  38. package/dist/catalog/sliceDoc.js +9 -0
  39. package/dist/catalog/sliceDoc.js.map +1 -1
  40. package/dist/catalog/sliceReadyValidate.d.ts +31 -4
  41. package/dist/catalog/sliceReadyValidate.js +66 -8
  42. package/dist/catalog/sliceReadyValidate.js.map +1 -1
  43. package/dist/catalog/sliceSections.d.ts +55 -0
  44. package/dist/catalog/sliceSections.js +317 -0
  45. package/dist/catalog/sliceSections.js.map +1 -0
  46. package/dist/cli/agentsMd.js +7 -1
  47. package/dist/cli/agentsMd.js.map +1 -1
  48. package/dist/cli/api.d.ts +90 -0
  49. package/dist/cli/api.js +318 -0
  50. package/dist/cli/api.js.map +1 -0
  51. package/dist/cli/ciInit.d.ts +88 -3
  52. package/dist/cli/ciInit.js +507 -50
  53. package/dist/cli/ciInit.js.map +1 -1
  54. package/dist/cli/conformScope.d.ts +28 -0
  55. package/dist/cli/conformScope.js +67 -0
  56. package/dist/cli/conformScope.js.map +1 -1
  57. package/dist/cli/coverage.d.ts +25 -2
  58. package/dist/cli/coverage.js +86 -12
  59. package/dist/cli/coverage.js.map +1 -1
  60. package/dist/cli/engagement.d.ts +210 -0
  61. package/dist/cli/engagement.js +444 -0
  62. package/dist/cli/engagement.js.map +1 -0
  63. package/dist/cli/engagementFile.d.ts +86 -0
  64. package/dist/cli/engagementFile.js +255 -0
  65. package/dist/cli/engagementFile.js.map +1 -0
  66. package/dist/cli/metrics.d.ts +10 -0
  67. package/dist/cli/metrics.js +49 -1
  68. package/dist/cli/metrics.js.map +1 -1
  69. package/dist/cli/pluginPin.d.ts +55 -0
  70. package/dist/cli/pluginPin.js +188 -0
  71. package/dist/cli/pluginPin.js.map +1 -0
  72. package/dist/cli/ratify.d.ts +27 -2
  73. package/dist/cli/ratify.js +112 -13
  74. package/dist/cli/ratify.js.map +1 -1
  75. package/dist/cli/reratify.d.ts +11 -4
  76. package/dist/cli/reratify.js +89 -35
  77. package/dist/cli/reratify.js.map +1 -1
  78. package/dist/cli/scopeInputs.d.ts +48 -0
  79. package/dist/cli/scopeInputs.js +176 -0
  80. package/dist/cli/scopeInputs.js.map +1 -0
  81. package/dist/cli/skillCheck.d.ts +15 -1
  82. package/dist/cli/skillCheck.js +22 -1
  83. package/dist/cli/skillCheck.js.map +1 -1
  84. package/dist/cli/skillDirs.d.ts +5 -0
  85. package/dist/cli/skillDirs.js +13 -1
  86. package/dist/cli/skillDirs.js.map +1 -1
  87. package/dist/cli/skillSync.d.ts +4 -0
  88. package/dist/cli/skillSync.js +23 -0
  89. package/dist/cli/skillSync.js.map +1 -1
  90. package/dist/cli/sliceNew.d.ts +11 -7
  91. package/dist/cli/sliceNew.js +91 -18
  92. package/dist/cli/sliceNew.js.map +1 -1
  93. package/dist/cli/sliceSync.d.ts +50 -0
  94. package/dist/cli/sliceSync.js +170 -0
  95. package/dist/cli/sliceSync.js.map +1 -0
  96. package/dist/cli/status.d.ts +24 -1
  97. package/dist/cli/status.js +20 -1
  98. package/dist/cli/status.js.map +1 -1
  99. package/dist/cli/systemInputs.d.ts +53 -10
  100. package/dist/cli/systemInputs.js +186 -11
  101. package/dist/cli/systemInputs.js.map +1 -1
  102. package/dist/cli/upgrade.d.ts +30 -7
  103. package/dist/cli/upgrade.js +434 -50
  104. package/dist/cli/upgrade.js.map +1 -1
  105. package/dist/cli/usageLog.d.ts +4 -2
  106. package/dist/cli/usageLog.js +4 -2
  107. package/dist/cli/usageLog.js.map +1 -1
  108. package/dist/cli.js +631 -100
  109. package/dist/cli.js.map +1 -1
  110. package/dist/emit/api.d.ts +29 -0
  111. package/dist/emit/api.js +220 -0
  112. package/dist/emit/api.js.map +1 -0
  113. package/dist/emit/apiCheckJson.d.ts +3 -0
  114. package/dist/emit/apiCheckJson.js +21 -0
  115. package/dist/emit/apiCheckJson.js.map +1 -0
  116. package/dist/emit/codeownersJson.d.ts +3 -0
  117. package/dist/emit/codeownersJson.js +19 -0
  118. package/dist/emit/codeownersJson.js.map +1 -0
  119. package/dist/emit/coverageJson.d.ts +5 -2
  120. package/dist/emit/coverageJson.js +6 -2
  121. package/dist/emit/coverageJson.js.map +1 -1
  122. package/dist/emit/diffJson.d.ts +1 -1
  123. package/dist/emit/diffJson.js +8 -1
  124. package/dist/emit/diffJson.js.map +1 -1
  125. package/dist/emit/engagementJson.d.ts +8 -0
  126. package/dist/emit/engagementJson.js +46 -0
  127. package/dist/emit/engagementJson.js.map +1 -0
  128. package/dist/emit/glossaryJson.d.ts +1 -1
  129. package/dist/emit/glossaryJson.js +4 -1
  130. package/dist/emit/glossaryJson.js.map +1 -1
  131. package/dist/emit/json.d.ts +17 -1
  132. package/dist/emit/json.js +30 -1
  133. package/dist/emit/json.js.map +1 -1
  134. package/dist/emit/metricsJson.d.ts +1 -1
  135. package/dist/emit/metricsJson.js +4 -1
  136. package/dist/emit/metricsJson.js.map +1 -1
  137. package/dist/emit/queryJson.d.ts +1 -1
  138. package/dist/emit/queryJson.js +7 -1
  139. package/dist/emit/queryJson.js.map +1 -1
  140. package/dist/emit/scopeJson.d.ts +12 -0
  141. package/dist/emit/scopeJson.js +26 -0
  142. package/dist/emit/scopeJson.js.map +1 -0
  143. package/dist/emit/skillCheckJson.d.ts +3 -2
  144. package/dist/emit/skillCheckJson.js +10 -2
  145. package/dist/emit/skillCheckJson.js.map +1 -1
  146. package/dist/emit/statusJson.d.ts +1 -1
  147. package/dist/emit/statusJson.js +15 -1
  148. package/dist/emit/statusJson.js.map +1 -1
  149. package/dist/emit/systemJson.d.ts +15 -8
  150. package/dist/emit/systemJson.js +28 -13
  151. package/dist/emit/systemJson.js.map +1 -1
  152. package/dist/emit/upgradeJson.d.ts +1 -1
  153. package/dist/emit/upgradeJson.js +4 -1
  154. package/dist/emit/upgradeJson.js.map +1 -1
  155. package/dist/emit/validateJson.d.ts +3 -3
  156. package/dist/emit/validateJson.js +10 -4
  157. package/dist/emit/validateJson.js.map +1 -1
  158. package/dist/mcp/server.d.ts +1 -1
  159. package/dist/mcp/server.js +186 -37
  160. package/dist/mcp/server.js.map +1 -1
  161. package/dist/model/diff.d.ts +4 -1
  162. package/dist/model/diff.js +44 -8
  163. package/dist/model/diff.js.map +1 -1
  164. package/dist/model/glossary.d.ts +2 -0
  165. package/dist/model/glossary.js +1 -0
  166. package/dist/model/glossary.js.map +1 -1
  167. package/dist/model/model.d.ts +55 -2
  168. package/dist/model/model.js +57 -0
  169. package/dist/model/model.js.map +1 -1
  170. package/dist/model/qualifiedRef.d.ts +18 -0
  171. package/dist/model/qualifiedRef.js +26 -0
  172. package/dist/model/qualifiedRef.js.map +1 -1
  173. package/dist/model/queryIndex.d.ts +9 -1
  174. package/dist/model/queryIndex.js +18 -2
  175. package/dist/model/queryIndex.js.map +1 -1
  176. package/dist/model/rules.d.ts +143 -2
  177. package/dist/model/rules.js +162 -3
  178. package/dist/model/rules.js.map +1 -1
  179. package/dist/model/validate.d.ts +40 -0
  180. package/dist/model/validate.js +147 -1
  181. package/dist/model/validate.js.map +1 -1
  182. package/dist/parser/ast.d.ts +31 -3
  183. package/dist/parser/parser.js +148 -14
  184. package/dist/parser/parser.js.map +1 -1
  185. package/dist/query/format.js +1 -1
  186. package/dist/query/format.js.map +1 -1
  187. package/dist/query/verbs.d.ts +6 -0
  188. package/dist/query/verbs.js +6 -2
  189. package/dist/query/verbs.js.map +1 -1
  190. package/dist/system/adaptation.d.ts +14 -0
  191. package/dist/system/adaptation.js +49 -0
  192. package/dist/system/adaptation.js.map +1 -0
  193. package/dist/system/codeowners.d.ts +77 -0
  194. package/dist/system/codeowners.js +242 -0
  195. package/dist/system/codeowners.js.map +1 -0
  196. package/dist/system/manifest.d.ts +10 -5
  197. package/dist/system/manifest.js +54 -26
  198. package/dist/system/manifest.js.map +1 -1
  199. package/dist/system/migrateManifest.d.ts +28 -0
  200. package/dist/system/migrateManifest.js +155 -0
  201. package/dist/system/migrateManifest.js.map +1 -0
  202. package/dist/system/scope.d.ts +46 -0
  203. package/dist/system/scope.js +132 -0
  204. package/dist/system/scope.js.map +1 -0
  205. package/dist/system/verify.d.ts +50 -13
  206. package/dist/system/verify.js +179 -58
  207. package/dist/system/verify.js.map +1 -1
  208. package/dist/templates.d.ts +2 -2
  209. package/dist/templates.js +23 -2
  210. package/dist/templates.js.map +1 -1
  211. package/package.json +6 -3
  212. package/plugin/.claude-plugin/plugin.json +18 -0
  213. package/plugin/agents/em-critic.md +27 -0
  214. package/plugin/agents/em-implementer.md +35 -0
  215. package/plugin/agents/em-reviewer.md +32 -0
  216. package/plugin/agents/em-validator.md +28 -0
  217. package/plugin/shared/reference/em-dsl.md +866 -0
  218. package/plugin/shared/reference/methodology.md +329 -0
  219. package/plugin/shared/reference/operating-principles.md +222 -0
  220. package/plugin/shared/reference/slice-doc-schema.md +566 -0
  221. package/plugin/shared/templates/conformance-report.md +85 -0
  222. package/plugin/shared/templates/constitution.md +136 -0
  223. package/plugin/shared/templates/model-readme.md +46 -0
  224. package/plugin/shared/templates/slice.md +251 -0
  225. package/plugin/shared/templates/state.md +77 -0
  226. package/plugin/skills/conform/SKILL.md +93 -0
  227. package/plugin/skills/conform/reference/conform.md +428 -0
  228. package/plugin/skills/design/SKILL.md +297 -0
  229. package/plugin/skills/discover/SKILL.md +90 -0
  230. package/plugin/skills/discover/reference/extract.md +147 -0
  231. package/plugin/skills/engagement/SKILL.md +193 -0
  232. package/plugin/skills/engagement/reference/engagement.md +144 -0
  233. package/plugin/skills/event-modeling/SKILL.md +132 -0
  234. package/plugin/skills/implement/SKILL.md +61 -0
  235. package/plugin/skills/implement/reference/implement.md +439 -0
  236. package/plugin/skills/review/SKILL.md +74 -0
  237. package/dist/emit/typespec.d.ts +0 -26
  238. package/dist/emit/typespec.js +0 -356
  239. package/dist/emit/typespec.js.map +0 -1
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: em-critic
3
+ description: Gives an independent second review of a slice's pull request in fresh context on a different model and returns a findings list; the engagement skill dispatches it after the reviewer and never shares the reviewer's findings with it.
4
+ tools: Read, Grep, Glob, Bash
5
+ ---
6
+ <!-- managed by em — `em skill sync` overwrites; `Bash` cannot be partially allowed, so read-only agents rely on their instructions for Bash -->
7
+
8
+ You are the em critic. You are an independent second opinion. You run in fresh context, on a different model from the implementer, and you must not be shown the reviewer's findings. If any reviewer findings appear in your input, say so in your first line and ignore them.
9
+
10
+ ## Scope
11
+
12
+ Inputs: the slice doc, the project constitution, and the pull request. Review the same three things the reviewer does: spec fidelity, slice isolation, constitution conformance. Use Bash only for read-only commands such as `gh pr diff <pr>` and `git diff`. Do not write, edit, create, delete, commit, or push anything.
13
+
14
+ ## Hard lines
15
+
16
+ - Every finding cites a slice doc line or section, or a constitution rule. Drop anything you cannot cite.
17
+ - No edits. No patches beyond one sentence saying what is wrong.
18
+ - Form your own view first. Where the orchestrator later reports that your view differs from the reviewer's, that disagreement is itself a finding; do not soften your findings to match.
19
+
20
+ ## Output
21
+
22
+ A findings list, one per line, in exactly this shape:
23
+
24
+ `- [<severity>] <file:line or doc §> — <finding>`
25
+
26
+ Severity is `blocker`, `major`, or `minor`. If there are no findings, reply `NO FINDINGS` and name what you checked.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: em-implementer
3
+ description: Implements exactly one ratified event-modeling slice in an assigned worktree and branch and opens its pull request; the engagement skill dispatches it once per slice with only the slice key and the worktree path.
4
+ tools: Read, Write, Edit, Bash, Grep, Glob, Skill
5
+ ---
6
+ <!-- managed by em — `em skill sync` overwrites; `Bash` cannot be partially allowed, so read-only agents rely on their instructions for Bash -->
7
+
8
+ You are the em implementer. You build one slice, in one worktree, on one branch, and you stop.
9
+
10
+ ## Load first
11
+
12
+ 1. Load the `event-modeling-implement` skill (`/em:implement` under the plugin) and follow it. The slice doc is your read-only spec.
13
+ 2. Read the project constitution (`constitution.md` beside the model, or `.specify/memory/constitution.md`). Its routing table maps the slice's `Pattern:` to the pattern skills you load next; load those too.
14
+
15
+ ## Scope
16
+
17
+ - Exactly one slice: the key you were given. Work only in the worktree path you were given, on the branch that is already checked out there.
18
+ - Write code and tests inside that slice's package, as the constitution's layout rule describes it.
19
+ - Every invariant and scenario in the slice doc gets a test that cites its `INV-*` id.
20
+
21
+ ## Hard lines
22
+
23
+ - Never edit the slice doc, the `.em` model, another slice's package, shared infrastructure, or the engagement file.
24
+ - Never merge. Never rebase onto anything. Never change the branch's base.
25
+ - If the slice doc is wrong, incomplete, or contradicts the constitution, stop and report the gap. Do not decide it silently and do not edit the doc to fit your code.
26
+ - Do not dispatch other agents.
27
+
28
+ ## Output
29
+
30
+ Reply with:
31
+
32
+ - The pull request URL.
33
+ - A per-invariant test map: one line per `INV-*` id, `INV-<id> -> <test file>::<test name>`.
34
+ - Any gap you stopped on, stated as the doc line and the question.
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: em-reviewer
3
+ description: Reviews a slice's pull request for spec fidelity, slice isolation and constitution conformance and returns a findings list; the engagement skill dispatches it after the validator passes.
4
+ tools: Read, Grep, Glob, Bash
5
+ ---
6
+ <!-- managed by em — `em skill sync` overwrites; `Bash` cannot be partially allowed, so read-only agents rely on their instructions for Bash -->
7
+
8
+ You are the em reviewer. You read; you never edit.
9
+
10
+ ## Scope
11
+
12
+ Inputs: the slice doc, the project constitution, and the pull request. Use Bash only for read-only commands such as `gh pr diff <pr>` and `git diff`. Do not write, edit, create, delete, commit, or push anything.
13
+
14
+ Review three things:
15
+
16
+ - Spec fidelity: the code and tests do what each field, invariant, and scenario in the slice doc says, and nothing the doc does not say.
17
+ - Slice isolation: nothing outside this slice's package changed; no reach into another slice or shared infrastructure.
18
+ - Constitution conformance: layout, naming, testing, and branch norms.
19
+
20
+ ## Hard lines
21
+
22
+ - Every finding cites a slice doc line or section, or a constitution rule. A finding you cannot cite is not a finding; drop it.
23
+ - Make no edits and propose no patches beyond one sentence saying what is wrong.
24
+
25
+ ## Output
26
+
27
+ A findings list, one per line, in exactly this shape:
28
+
29
+ `- [<severity>] <file:line or doc §> — <finding>`
30
+
31
+ Severity is `blocker`, `major`, or `minor`. If there are no findings, reply `NO FINDINGS` and name what you checked.
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: em-validator
3
+ description: Runs the mechanical checks on a slice's pull request and reports pass or fail per check; the engagement skill dispatches it after the implementer opens the PR and before review.
4
+ tools: Read, Bash, Grep, Glob
5
+ ---
6
+ <!-- managed by em — `em skill sync` overwrites; `Bash` cannot be partially allowed, so read-only agents rely on their instructions for Bash -->
7
+
8
+ You are the em validator. You run checks and report what they say. You make no judgment beyond "the check says".
9
+
10
+ ## Scope
11
+
12
+ You were given a slice key and the worktree path of its pull request. You read output; you never change anything. Use Bash only to run the checks below and read-only git or `gh` commands. Do not write, edit, create, delete, commit, or push anything.
13
+
14
+ ## Checks
15
+
16
+ Run each one and record pass or fail:
17
+
18
+ 1. `em validate <model.em> --slice-ready <key>` passes.
19
+ 2. `em coverage <model.em> --slice <key> --tests <test dir> --strict` passes (take the test directory from the constitution's layout rule).
20
+ 3. The project test command. Read the constitution's line `- **Test command:** \`<cmd>\`` under "Testing norms" and run exactly that command. If the line is absent, report "no test command in the constitution", skip this check, and still run the others.
21
+ 4. Diff footprint: every changed path sits inside the slice's package, as the constitution's layout rule describes it. This is a judgment against that rule; quote the rule and list any path outside it.
22
+ 5. No diff under `slices/**`, `*.em`, `constitution.md`, or `engagements/`. Use `git diff --name-only <base>...HEAD`.
23
+ 6. The pull request body cites the slice doc.
24
+
25
+ ## Output
26
+
27
+ One line per check, `PASS` or `FAIL`, with the command run and, for a failure, the first lines of its output or the offending paths. End with `OVERALL: PASS` only if every check that ran passed.
@@ -1,22 +1,24 @@
1
1
  ---
2
2
  name: event-modeling
3
- em-version: 1.13.0
3
+ em-version: 1.14.0
4
4
  description: >-
5
5
  Use when the user runs `/event-modeling` (with or without a phase name), or wants to resume an
6
6
  event-modeling session without specifying which part of the process applies. Reads the model's
7
7
  `.event-modeling.md` state (or the given phase name) and routes to the right focused skill —
8
8
  event-modeling-discover, event-modeling-design, event-modeling-implement, event-modeling-conform,
9
- or event-modeling-review. If you already know which of those applies — starting a new model,
10
- extracting from existing code, slicing/writing specs, implementing a ratified slice, checking
11
- drift, or running a live/stakeholder view — invoke that skill directly instead of this one.
9
+ or event-modeling-review — or, for building a planned set of ready slices through scoped
10
+ sub-agents to a stack of PRs (an `em engagement`), event-modeling-engagement. If you already
11
+ know which of those applies — starting a new model, extracting from existing code,
12
+ slicing/writing specs, implementing a ratified slice, leading an engagement, checking drift, or
13
+ running a live/stakeholder view — invoke that skill directly instead of this one.
12
14
  ---
13
15
 
14
16
  # Event Modeling with `em` — resume / route
15
17
 
16
- `em` drives Event Modeling through nine phases — `discover, extract, model, slice, implement,
17
- conform, watch, review, validate` — split across five focused skills, one per stage of the
18
- process. This router skill is the single entry point for `/event-modeling`: it figures out which
19
- phase applies and hands off, so you never need to remember which of the five skills a given
18
+ `em` drives Event Modeling through ten phases — `discover, extract, model, slice, implement,
19
+ conform, watch, review, validate, engagement` — split across six focused skills, one per stage of
20
+ the process. This router skill is the single entry point for `/event-modeling`: it figures out
21
+ which phase applies and hands off, so you never need to remember which of the six skills a given
20
22
  phase lives in.
21
23
 
22
24
  | These phases... | ...live in this skill |
@@ -26,16 +28,18 @@ phase lives in.
26
28
  | `implement` | `event-modeling-implement` — building one ratified slice into merged, tested code |
27
29
  | `conform`, `validate` | `event-modeling-conform` — drift-checking a model against its codebase, walking validation diagnostics |
28
30
  | `watch`, `review` | `event-modeling-review` — the live browser viewer, facilitated stakeholder walkthroughs |
31
+ | `engagement` | `event-modeling-engagement` — build a planned set of ready slices through scoped sub-agents to a stack of PRs |
29
32
 
30
33
  ## Routing logic
31
34
 
32
35
  1. Check the tool: `em --version`. If missing, tell the user to run `npm i -g @milehimikey/em`
33
36
  and stop until installed. Then check this vendored bundle's own currency against it — see
34
37
  `../event-modeling-shared/reference/operating-principles.md`'s Preconditions step 2: a bundle
35
- more than a minor version stale is a STOP, not a warning.
38
+ even one minor version behind the installed em is a STOP, not a warning — only a patch-only
39
+ gap proceeds normally.
36
40
  2. Parse `$ARGUMENTS` for a phase name.
37
41
  - **A recognized phase name** (`discover`, `extract`, `model`, `slice`, `implement`,
38
- `conform`, `validate`, `watch`, `review`): look it up in the table above and invoke that
42
+ `conform`, `validate`, `watch`, `review`, `engagement`): look it up in the table above and invoke that
39
43
  skill directly (via the `Skill` tool), passing the phase name along so it knows exactly
40
44
  where to start. Don't re-derive state first — the target skill's own preconditions handle
41
45
  that.
@@ -49,10 +53,44 @@ phase lives in.
49
53
  extract from (`event-modeling-discover`, `extract`), then invoke that skill.
50
54
  - **An unrecognized argument:** treat it as free-text intent and pick the best-matching skill
51
55
  from the table's description, same as you would if the user had asked in plain language.
52
- 3. Once you've handed off, this skill's job is done for the session — the target skill owns the
56
+ 3. **Steer late work to `event-modeling-review` (MIL-236).** When the phase resolves to `slice`
57
+ (recorded or requested), run `em status <model>.em --json` before handing off. Recommend
58
+ `event-modeling-review` to the user instead of `event-modeling-design` when either holds:
59
+ - no slice doc is left to write or deepen: `slices.byStatus.draft === 0`,
60
+ `slices.byStatus.noDoc === 0`, and `slices.byStatus.reviewed +
61
+ slices.byStatus.readyToImplement > 0`;
62
+ - the state file's `## Open questions / parking lot` section has an unchecked `- [ ]` item.
63
+ Say why: closing open questions and walking slices to the review gate is the review skill's
64
+ job, not broad consistency work. Invoke `event-modeling-review` when the user agrees;
65
+ otherwise hand off to `event-modeling-design` as the table says.
66
+ 4. **Never do the phase work here.** Recommend the focused skill by name and hand off. Never run
67
+ a cross-cutting "make everything consistent" pass from this skill: no sweeping edits across
68
+ slice docs, no regenerating or hand-editing derived artifacts, no reading implementation code
69
+ to settle a modeling question. The design-session write scope below applies to anything
70
+ started from here.
71
+ 5. Once you've handed off, this skill's job is done for the session — the target skill owns the
53
72
  conversation from there, including re-invoking `event-modeling` (this skill) itself at the end
54
73
  if the user wants to stop and resume later.
55
74
 
75
+ ## Design-session write scope (MIL-236)
76
+
77
+ These rules bind every `discover`/`model`/`slice` session, whichever skill runs it. The full
78
+ text is in `../event-modeling-shared/reference/operating-principles.md` ("Write scope and
79
+ evidence").
80
+
81
+ - **Bound to one model directory.** The session is bound to the model directory it started in
82
+ (`dirname(<model>.em)`). Never write under another model's directory or to its contract file.
83
+ A question that needs another model's `public` element changed becomes a **seam change
84
+ request**: a dated Decisions-log bullet in THIS model's `.event-modeling.md`, and the question
85
+ stays open as blocked-on-upstream.
86
+ - **Out of scope during design — never write:** generated contract artifacts
87
+ (`contracts/*.tsp`, any OpenAPI or JSON-schema output); SDD/spec artifacts (`specs/`,
88
+ `.specify/` — the constitution may be read, never written); implementation source (`src/`,
89
+ the model's `Code roots:`); `plugin/`; a draft slice doc's `version:`.
90
+ - **Evidence rule.** The `.em` model and the slice docs are the evidence for modeling
91
+ decisions. Code is consulted only in `extract` (`event-modeling-discover`) and `conform`
92
+ (`event-modeling-conform`).
93
+
56
94
  ## Shared reference material
57
95
 
58
96
  Every phase skill (and this one) points back to the same shared resources rather than
@@ -88,4 +126,6 @@ em watch <name>.em -o <name>.svg --serve # + the live browser viewer: instant
88
126
  Always finish a working session by: re-rendering, running `em validate`, and updating
89
127
  `.event-modeling.md` — `em state set-phase <phase> [--step <n>]` for the current phase/step,
90
128
  decisions and open questions by hand, and `em state log-usage <model>.em --phases <phases>` for
91
- the Usage log entry.
129
+ the Usage log entry. Before committing a design session, stage the files and run the pre-commit
130
+ check in `../event-modeling-shared/reference/operating-principles.md` ("Write scope and
131
+ evidence"): `em system scope --staged` plus `git diff --cached --name-only`; STOP on any finding.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: event-modeling-conform
3
- em-version: 1.13.0
3
+ em-version: 1.14.0
4
4
  description: >-
5
5
  Use when checking a ratified event model (and its slice docs) for drift against the codebase
6
6
  that implements it — advisory only, never a gate, never an unprompted edit — or when walking
@@ -398,7 +398,7 @@ manifest exists yet, or if the model has drifted since the last bump (the certif
398
398
  otherwise name a version that isn't what conform actually walked). If the model changed during
399
399
  this conform run (a slice's `version:` moved, or the `.em` file itself changed), bump a new
400
400
  design version (`em model version bump --by <name>`) before the final `em state
401
- set-conformance` call. `--partial` never certifies. See `docs/model-versions.md`.
401
+ set-conformance` call. `--partial` never certifies. See `docs/process.md#model-versions`.
402
402
 
403
403
  Conform doesn't chain to another phase automatically — it's a recurring loop, not a step in
404
404
  building the model. Suggest running it again next time the target codebase has moved, at
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: event-modeling-design
3
- em-version: 1.13.0
3
+ em-version: 1.14.0
4
4
  description: >-
5
5
  Use when structuring a draft event model into swimlanes and the four patterns (State Change,
6
6
  State View, Automation, Translation), evaluating a model's structural completeness, or writing
@@ -23,6 +23,44 @@ layout, the Socratic/validation discipline every phase follows) and
23
23
  work — they are the source of truth. Run the preconditions there first: this phase expects a
24
24
  draft model already exists (from `event-modeling-discover`'s `discover` or `extract` phase).
25
25
 
26
+ ## Write scope, evidence, versions (MIL-236) — read before any edit
27
+
28
+ Full rules: `../event-modeling-shared/reference/operating-principles.md` ("Write scope and
29
+ evidence"). In short:
30
+
31
+ - **Bound to this model's directory.** The session is bound to the model directory it started
32
+ in (`dirname(<model>.em)`). Never write under another model's directory or to its contract
33
+ file. Read a neighbour only through its public surface (`public: true` elements in
34
+ `em export <neighbour>.em`, or its committed contract), read-only.
35
+ - **Seam change request, never a cross-model edit.** When an open question needs another
36
+ model's `public` element changed, add one dated bullet to THIS model's `.event-modeling.md`
37
+ `## Decisions log`:
38
+ `- YYYY-MM-DD: seam change request → <producerKey>:<kind>.<slug> — <what> — <why>`.
39
+ Keep the question open, `blocked on:` the producer's owners. Never edit the other side.
40
+ - **Out of scope during design — never write:** generated contract artifacts
41
+ (`contracts/*.tsp`, any OpenAPI or JSON-schema output), SDD/spec artifacts (`specs/`,
42
+ `.specify/` — read the constitution, never write it), implementation source (`src/`, the
43
+ model's `Code roots:`), `plugin/`, and a draft slice doc's `version:`. Exception: after
44
+ marking an element `public` or changing a field of a `public` element, run
45
+ `em api generate <model>.em` and commit the regenerated contract with the model edit — the
46
+ API-first gate (`em validate --slice-ready`) refuses a public-touching slice whose contract
47
+ is missing or stale. Never hand-edit the contract.
48
+ - **Slice docs: edit authored sections only.** Never hand-edit a generated region
49
+ (`<!-- GENERATED:em-slice-…:start -->` … `:end -->`: field tables, the Invariants list); after
50
+ any model edit run `em slice sync <model>.em` (see **Generated vs authored sections** below).
51
+ - **Evidence rule.** The `.em` model and the slice docs are the evidence for modeling
52
+ decisions. Never read implementation source, generated contracts or `specs/` to decide a
53
+ modeling question — ask the user. Code is read only in `extract` and `conform`.
54
+ - **Version rule.** Never bump a draft's `version:` on edit. Before any `em slice reratify`,
55
+ run `em status <model>.em --json`: pre-release = the model's `modelVersion` entry has
56
+ `design: null` **and** `slices.byStatus.implemented === 0`. Pre-release → never run
57
+ `reratify`; edit `draft`/`reviewed` docs in place. Released → the re-ratification path in
58
+ the `slice` phase below.
59
+ - **Pre-commit check.** Stage the session's files, run `em system scope --staged` (STOP on any
60
+ `seam-crossing`), then `git diff --cached --name-only` (STOP on any path outside this model's
61
+ directory, any out-of-scope path above, or a changed `version:` line on a draft doc).
62
+ Unstage the offending path and tell the user why.
63
+
26
64
  ## Phase: `model` — steps 5-7
27
65
 
28
66
  Goal: a structurally complete, **validated** model with correct patterns and swimlanes.
@@ -45,7 +83,8 @@ Goal: a structurally complete, **validated** model with correct patterns and swi
45
83
  `--wire` refuses it and names the originating slice holding `X`'s first declaration; its
46
84
  scenarios go into that doc instead. Then, for each freshly scaffolded doc, hold a first-pass
47
85
  Socratic pass and write the happy-path Given/When/Then into
48
- its `## Scenarios (Given / When / Then)` section and the obvious invariants known so far into
86
+ its `## Scenarios (Given / When / Then)` section (as `### Scenario:` blocks — see **Generated
87
+ vs authored sections** in the `slice` phase below) and the obvious invariants known so far into
49
88
  its `## Invariants / Business Rules` section — **into the doc, never into the state file.**
50
89
  Keep this pass shallow (no field tables, alternate/error flows, or NFRs yet — that's the full
51
90
  deep-dive in the `slice` phase below); the docs are the home for everything collected from
@@ -71,6 +110,19 @@ Goal: a structurally complete, **validated** model with correct patterns and swi
71
110
  that reads it; another model/system reads it → mark it `public`; only an automation reads
72
111
  it → nothing, it's internal by design. No new keyword — reachability is already what `ui` and
73
112
  `public` mean.
113
+ **Per translation fed from another model, declare what it consumes (MIL-235):** write
114
+ `translation Order Intake consumes checkout:event.order-submitted`. The ref is
115
+ `<modelKey>:<kind>.<slug>`, where kind is `event` or `view` and the target is marked `public`
116
+ in its own model. The consumer declares the seam; the producer never lists its consumers, and
117
+ the ref carries no version and no slice. Only a `translation` may carry `consumes`. If a
118
+ reaction reads another model, it is a translation. `em validate` checks only the ref's
119
+ grammar. Run `em system` from the repository (or on its `system.yaml`) to resolve it, and fix
120
+ any `consumes-unknown-model`/`consumes-unknown-element` error. Never edit the other model to
121
+ make a ref resolve. Ask its owner to publish the element instead, and record that ask as a
122
+ seam change request (see **Write scope** above).
123
+ **When you mark an element `public` here**, run `em api generate <model>.em` in the same
124
+ session and stage `contracts/<model key>.tsp` with the model edit — the one derived artifact
125
+ a design session produces, always by the command, never by hand.
74
126
 
75
127
  End of phase: render, update state (`em state set-phase slice` — the mechanical marker the state
76
128
  machine expects), and stop. Every slice already has a draft doc ready to receive the deep spec,
@@ -95,8 +147,14 @@ phases is the starting point, not the finished event set. **Every new event need
95
147
  real (someone has to see that the request was declined).
96
148
 
97
149
  For each slice:
98
- 0. **Check for re-ratification first.** If `slices/<slice-name>.md` already exists with
99
- `status: implemented`, this is a re-ratification, not fresh authoring: hold a Socratic
150
+ 0. **Check for re-ratification first.** A `draft` or `reviewed` doc is never re-ratified: edit
151
+ it in place and leave its `version:` alone. If `slices/<slice-name>.md` already exists with
152
+ `status: implemented` (or is ratified and needs a change), run `em status <model>.em --json`
153
+ first. **Pre-release** (the model's `modelVersion` entry has `design: null` and
154
+ `slices.byStatus.implemented === 0`): never run `em slice reratify`; a ratified doc holds a
155
+ human sign-off, so STOP, park the change as an open question, and let the ratifier decide.
156
+ **Released** (either condition false): a doc with `status: implemented` is a
157
+ re-ratification, not fresh authoring: hold a Socratic
100
158
  deep-dive on what changed (same rigor as step 1, scoped to the delta), update whichever
101
159
  sections actually changed, then express the change as the `## Delta` section — fixed heading,
102
160
  `### Added`/`Modified`/`Removed`/`Renamed` Requirement blocks each carrying its own scenarios
@@ -108,14 +166,51 @@ For each slice:
108
166
  schema doc). Otherwise, this is first-time authoring: continue at step 1.
109
167
  1. Hold a Socratic deep-dive to fill every section of `../event-modeling-shared/templates/slice.md`:
110
168
  intent, trigger/actor,
111
- command + field table (types & rules), event(s) + payload (mark immutable facts), invariants
112
- (give each a stable ID), Given/When/Then scenarios (happy path + rule boundaries + edge cases),
169
+ command fields (types & rules), event(s) + payload (mark immutable facts) — field names and
170
+ types go into the `.em`, the doc's tables are generated from it — invariants
171
+ (give each a stable ID — see **Invariants live in the model** below), Given/When/Then scenarios (happy path + rule boundaries + edge cases),
113
172
  alternate/error flows (retries, idempotency, compensations), non-functional requirements
114
173
  (security/authz, PII/compliance, performance/SLA), read models affected, open questions. Park
115
- anything unresolved rather than guessing. If the slice lives in an existing codebase, Grep/Read
116
- adjacent real sources (OpenAPI specs, DB migrations, existing DTOs/event classes in sibling
117
- contexts) before finalizing field names/types or invariants — don't guess a shape that's
118
- already defined elsewhere.
174
+ anything unresolved rather than guessing. Before finalizing field names/types or invariants,
175
+ check whether the shape is already defined in **this model** (`.em` and its slice docs) or in
176
+ a neighbour's public surface (read-only) — don't guess a shape that's already defined there.
177
+ Never Grep or Read implementation source, OpenAPI files, DB migrations or `specs/` to settle
178
+ it (evidence rule): if the user says the existing code is the source of truth, ask them for
179
+ the shape, or park the question for an `extract` or `conform` session. Before finalizing an
180
+ invariant, also compare it with the slices in
181
+ **this same model** — never another `.em` model — that make the same kind of change (other
182
+ `Archive*` or `Create*` state changes on different entities, say). If one of them already
183
+ states an analogous rule, either state the same rule here — written out in this doc under
184
+ this slice's own `INV-<MNEMONIC>-n` ID, not by pointing at the sibling's — or record why this
185
+ slice's case differs. If this slice has a rule those siblings lack, raise that with the user
186
+ as an open question against each of them; a ratified sibling changes only through its own
187
+ re-ratification, never as a side effect of this slice. Repeating a rule across slice docs is
188
+ correct: each doc is a self-contained spec, and whether the code behind those rules is shared
189
+ is the constitution's call, not this doc's.
190
+ **Invariants live in the model.** Write every NEW invariant into the `.em` as a standalone
191
+ `invariant INV-<MNEMONIC>-<n> "rule sentence"` line directly after the command (or event) it
192
+ guards — always with the rule sentence — then cite that ID in the doc's Invariants section as a
193
+ plain mention and elaborate there (`- INV-CHK-1 — why, edge cases, the error returned`); never
194
+ restate it as a `**INV-CHK-1:**` rule (`em validate` flags that as
195
+ `invariants/declared-in-both`). A `public` command needs at least one invariant
196
+ (`invariants/public-command-without-invariants`). A doc that already declares its own
197
+ invariants keeps working; migrate one only when you are editing that slice anyway — move the
198
+ ID and rule into the model, keep the doc's elaboration. Run `em validate` after the edit:
199
+ `invariants/malformed-id` and `invariants/duplicate-id` are errors.
200
+ **Generated vs authored sections.** A doc `em slice new` wrote has two kinds of section. The
201
+ GENERATED regions — each command's, event's and read model's field table and the Invariants
202
+ list, between `<!-- GENERATED:em-slice-…:start -->` / `:end -->` markers — restate the model:
203
+ **never hand-edit a generated region.** To change a field, a type, or an invariant, edit the
204
+ `.em`, then **after any model edit run `em slice sync <model>.em`**, which rewrites every
205
+ region in place and leaves everything else byte-for-byte (`em slice sync <model>.em --check`
206
+ reports a stale doc without writing). **Edit authored sections only**: Intent, Trigger &
207
+ Actor, `Triggered by`/`Read by`/`Consumed by`, the invariant elaborations below the generated
208
+ list, Scenarios, Alternate & Error Flows, NFRs, Dependencies, Open Questions. Scenarios use the
209
+ constrained shape `em` reads back: a `### Scenario: <title>` heading, then `- **Given:**`,
210
+ `- **When:**`, `- **Then:**` bullets with nested ` - ` items — all three in every block
211
+ (`em validate` flags a block missing one as `slice-doc/structured-section-malformed`, and
212
+ `--slice-ready` refuses it). A doc written before em 1.14 has no markers; leave it as it is
213
+ unless you are re-creating it (`em slice new … --wire --force`, carrying the prose across).
119
214
  2. **First-time authoring:** scaffold the doc mechanically rather than hand-writing the
120
215
  frontmatter — `em slice new "<slice name>" --pattern <state-change|state-view|automation|
121
216
  translation> --swimlane "<Persona> → <Context>" --wire <model>.em` writes `slices/<slice-name>.md`
@@ -131,20 +226,42 @@ For each slice:
131
226
  declaration — write this slice's scenarios into that doc instead of scaffolding a new one.
132
227
  Both `--pattern` and `--swimlane` are required; an invalid `--pattern` is refused with the
133
228
  valid choices listed. Never hand-type this block, and never fall back to a placeholder
134
- pattern/swimlane to dodge the flags. Then fill in every judgment section below the stub from
135
- step 1 (Intent, Command, Event(s), Invariants, Scenarios, ...) — the doc's prose is still
136
- entirely hand-authored, only the frontmatter/heading scaffold and the `.em` wiring are
137
- mechanized. Record the originating need (ticket/conversation link) in the Intent section when
138
- one exists. When this doc exists because of a split, merge, or rename, add the matching
229
+ pattern/swimlane to dodge the flags. It also writes every template section: the generated
230
+ regions already filled from the model (field tables, Invariants list), the authored sections
231
+ as placeholders. Then fill in the authored sections from step 1 (Intent, Trigger & Actor,
232
+ invariant elaborations, Scenarios, ...) — those stay hand-authored; the generated regions
233
+ follow the model through `em slice sync`. Record the originating need (ticket/conversation
234
+ link) in the Intent section when one exists. When this doc exists because of a split, merge, or rename, add the matching
139
235
  lineage key(s) by hand (`split-from`/`merged-from`/`superseded-by`, `<slice-key>@v<N>` grammar
140
236
  — see `../event-modeling-shared/reference/slice-doc-schema.md` for the full schema; `em validate` catches a malformed one
141
237
  after the fact, see the `lineage-*` rules below).
142
- **Re-ratification (step 0):** the doc already exists, so `em slice new` doesn't apply here
238
+ **Re-ratification (step 0) — released models only.** Confirm the model is released first
239
+ (`em status <model>.em --json`: the `modelVersion` entry's `design` is not `null`, or
240
+ `slices.byStatus.implemented > 0`); on a pre-release model never run `reratify`. The doc
241
+ already exists, so `em slice new` doesn't apply here
143
242
  (it refuses to overwrite an existing file without `--force`, and forcing would blow away the
144
243
  doc's authored body) — run `em slice reratify <model>.em <slice-key>` instead: it bumps
145
244
  `version` and flips `status` back to `ready-to-implement` in the existing frontmatter,
146
245
  clearing any stale `ratifiedBy:`/`ratifiedOn:` from the prior version so a follow-up
147
- `em slice ratify --by <name>` (if the team records that) applies cleanly.
246
+ `em slice ratify --by <name>` (if the team records that) applies cleanly. The same command
247
+ changes a ratified doc that **never shipped** (`ready-to-implement` with `ratifiedBy` set — a
248
+ gap answered mid-build, MIL-258): it bumps `version` and clears the sign-off but leaves
249
+ `status` alone. Either way the doc is not ratified until `em slice ratify --by <name>` records
250
+ the new sign-off. A `ready-to-implement` doc with no `ratifiedBy` is already awaiting that
251
+ sign-off and refuses a second `reratify`; a `draft`/`reviewed` doc is simply edited, and its
252
+ `version:` never moves.
253
+ **Public-touching slices (MIL-238).** On a slice that owns a `public` command, event or view,
254
+ `em slice ratify --by <name>` and `em slice reratify` refuse without one of two flags: pass
255
+ `--meaning-unchanged` when this version does not change what the public contract means, or
256
+ `--contract-change "<why>"` when a consumer must read the change differently. Without
257
+ either, both refuse with `slice "<key>" touches the public surface — pass
258
+ --meaning-unchanged, or --contract-change "<why>" if a consumer must read this change
259
+ differently`; passing both refuses too. Run
260
+ `em api generate <model>.em` first, so `em validate --slice-ready` sees a current contract
261
+ (otherwise it blocks with `slice-ready-contract-stale`).
262
+ Which flag applies is the ratifier's call, not yours: ask, never pick one to make the
263
+ command pass. Ratification itself stays a human gate outside this session; a review session
264
+ never ratifies (see `event-modeling-review`).
148
265
  3. Render the slice's own diagram: `em render <model>.em --slice "<slice name>" -o
149
266
  slices/<slice-name>.svg` (kebab-case, matching the doc's filename and the `![Diagram]` stub
150
267
  `em slice new` already wrote) — redraws just this slice in its own canonical pattern shape.
@@ -158,7 +275,12 @@ For each slice:
158
275
  5. Run `em slice index <model-name>.em` to regenerate `README.md`'s Slices table — the one
159
276
  canonical slice index — from the model and the doc frontmatter you just wrote (status,
160
277
  `implementedIn` once shipped). Never hand-edit the table; it's a generated block.
161
- 6. Re-render and `em validate`.
278
+ 6. Re-render, run `em slice sync <model-name>.em --check` (it must print `ok:` for every doc you
279
+ touched), and `em validate`.
280
+ 7. Before committing, stage the session's files and run the pre-commit check: `em system scope
281
+ --staged`, then `git diff --cached --name-only`. STOP on any `seam-crossing`, any path outside
282
+ this model's directory, any out-of-scope path (see **Write scope** above), or a changed
283
+ `version:` line on a draft doc.
162
284
 
163
285
  A finished draft doesn't become implementable here: it goes through the review gate and then the
164
286
  ratification gate, both human, both outside this phase — see
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: event-modeling-discover
3
- em-version: 1.13.0
3
+ em-version: 1.14.0
4
4
  description: >-
5
5
  Use when starting a brand-new event model from scratch — greenfield discovery: brainstorming
6
6
  past-tense events, storyboarding the happy path, finding the commands and read models — or when