@milehimikey/em 1.13.1 → 1.14.1

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 (235) 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 +50 -11
  6. package/.claude/skills/event-modeling-conform/SKILL.md +1 -1
  7. package/.claude/skills/event-modeling-design/SKILL.md +127 -18
  8. package/.claude/skills/event-modeling-discover/SKILL.md +1 -1
  9. package/.claude/skills/event-modeling-engagement/SKILL.md +192 -0
  10. package/.claude/skills/event-modeling-engagement/reference/engagement.md +143 -0
  11. package/.claude/skills/event-modeling-implement/SKILL.md +1 -1
  12. package/.claude/skills/event-modeling-implement/reference/implement.md +38 -11
  13. package/.claude/skills/event-modeling-review/SKILL.md +2 -2
  14. package/.claude/skills/event-modeling-shared/reference/em-dsl.md +279 -189
  15. package/.claude/skills/event-modeling-shared/reference/operating-principles.md +61 -0
  16. package/.claude/skills/event-modeling-shared/reference/slice-doc-schema.md +116 -5
  17. package/.claude/skills/event-modeling-shared/templates/constitution.md +18 -1
  18. package/.claude/skills/event-modeling-shared/templates/slice.md +64 -39
  19. package/.claude/skills/event-modeling-shared/templates/state.md +5 -1
  20. package/.claude-plugin/marketplace.json +14 -0
  21. package/README.md +25 -11
  22. package/dist/catalog/apiFirst.d.ts +28 -0
  23. package/dist/catalog/apiFirst.js +49 -0
  24. package/dist/catalog/apiFirst.js.map +1 -0
  25. package/dist/catalog/docJoin.d.ts +13 -0
  26. package/dist/catalog/docJoin.js +11 -0
  27. package/dist/catalog/docJoin.js.map +1 -1
  28. package/dist/catalog/docModelConsistencyValidate.js +44 -4
  29. package/dist/catalog/docModelConsistencyValidate.js.map +1 -1
  30. package/dist/catalog/invariantsValidate.d.ts +4 -0
  31. package/dist/catalog/invariantsValidate.js +102 -0
  32. package/dist/catalog/invariantsValidate.js.map +1 -0
  33. package/dist/catalog/scenarios.d.ts +15 -0
  34. package/dist/catalog/scenarios.js +97 -0
  35. package/dist/catalog/scenarios.js.map +1 -0
  36. package/dist/catalog/sliceDoc.d.ts +8 -0
  37. package/dist/catalog/sliceDoc.js +9 -0
  38. package/dist/catalog/sliceDoc.js.map +1 -1
  39. package/dist/catalog/sliceReadyValidate.d.ts +31 -4
  40. package/dist/catalog/sliceReadyValidate.js +66 -8
  41. package/dist/catalog/sliceReadyValidate.js.map +1 -1
  42. package/dist/catalog/sliceSections.d.ts +55 -0
  43. package/dist/catalog/sliceSections.js +317 -0
  44. package/dist/catalog/sliceSections.js.map +1 -0
  45. package/dist/cli/agentsMd.js +7 -1
  46. package/dist/cli/agentsMd.js.map +1 -1
  47. package/dist/cli/api.d.ts +90 -0
  48. package/dist/cli/api.js +318 -0
  49. package/dist/cli/api.js.map +1 -0
  50. package/dist/cli/ciInit.d.ts +82 -21
  51. package/dist/cli/ciInit.js +468 -64
  52. package/dist/cli/ciInit.js.map +1 -1
  53. package/dist/cli/conformScope.d.ts +28 -0
  54. package/dist/cli/conformScope.js +67 -0
  55. package/dist/cli/conformScope.js.map +1 -1
  56. package/dist/cli/coverage.d.ts +9 -0
  57. package/dist/cli/coverage.js +60 -8
  58. package/dist/cli/coverage.js.map +1 -1
  59. package/dist/cli/defer.d.ts +55 -0
  60. package/dist/cli/defer.js +244 -0
  61. package/dist/cli/defer.js.map +1 -0
  62. package/dist/cli/engagement.d.ts +210 -0
  63. package/dist/cli/engagement.js +444 -0
  64. package/dist/cli/engagement.js.map +1 -0
  65. package/dist/cli/engagementFile.d.ts +86 -0
  66. package/dist/cli/engagementFile.js +255 -0
  67. package/dist/cli/engagementFile.js.map +1 -0
  68. package/dist/cli/metrics.d.ts +10 -0
  69. package/dist/cli/metrics.js +49 -1
  70. package/dist/cli/metrics.js.map +1 -1
  71. package/dist/cli/pluginPin.d.ts +55 -0
  72. package/dist/cli/pluginPin.js +188 -0
  73. package/dist/cli/pluginPin.js.map +1 -0
  74. package/dist/cli/ratify.d.ts +27 -2
  75. package/dist/cli/ratify.js +112 -13
  76. package/dist/cli/ratify.js.map +1 -1
  77. package/dist/cli/reratify.d.ts +4 -2
  78. package/dist/cli/reratify.js +41 -16
  79. package/dist/cli/reratify.js.map +1 -1
  80. package/dist/cli/scopeInputs.d.ts +48 -0
  81. package/dist/cli/scopeInputs.js +176 -0
  82. package/dist/cli/scopeInputs.js.map +1 -0
  83. package/dist/cli/skillCheck.d.ts +15 -1
  84. package/dist/cli/skillCheck.js +22 -1
  85. package/dist/cli/skillCheck.js.map +1 -1
  86. package/dist/cli/skillDirs.d.ts +5 -0
  87. package/dist/cli/skillDirs.js +13 -1
  88. package/dist/cli/skillDirs.js.map +1 -1
  89. package/dist/cli/skillSync.d.ts +4 -0
  90. package/dist/cli/skillSync.js +23 -0
  91. package/dist/cli/skillSync.js.map +1 -1
  92. package/dist/cli/sliceNew.d.ts +11 -7
  93. package/dist/cli/sliceNew.js +91 -18
  94. package/dist/cli/sliceNew.js.map +1 -1
  95. package/dist/cli/sliceSync.d.ts +50 -0
  96. package/dist/cli/sliceSync.js +170 -0
  97. package/dist/cli/sliceSync.js.map +1 -0
  98. package/dist/cli/status.d.ts +24 -1
  99. package/dist/cli/status.js +20 -1
  100. package/dist/cli/status.js.map +1 -1
  101. package/dist/cli/systemInputs.d.ts +53 -10
  102. package/dist/cli/systemInputs.js +186 -11
  103. package/dist/cli/systemInputs.js.map +1 -1
  104. package/dist/cli/upgrade.d.ts +16 -3
  105. package/dist/cli/upgrade.js +366 -30
  106. package/dist/cli/upgrade.js.map +1 -1
  107. package/dist/cli/usageLog.d.ts +4 -2
  108. package/dist/cli/usageLog.js +4 -2
  109. package/dist/cli/usageLog.js.map +1 -1
  110. package/dist/cli.js +599 -94
  111. package/dist/cli.js.map +1 -1
  112. package/dist/emit/api.d.ts +29 -0
  113. package/dist/emit/api.js +220 -0
  114. package/dist/emit/api.js.map +1 -0
  115. package/dist/emit/apiCheckJson.d.ts +3 -0
  116. package/dist/emit/apiCheckJson.js +21 -0
  117. package/dist/emit/apiCheckJson.js.map +1 -0
  118. package/dist/emit/codeownersJson.d.ts +3 -0
  119. package/dist/emit/codeownersJson.js +19 -0
  120. package/dist/emit/codeownersJson.js.map +1 -0
  121. package/dist/emit/diffJson.d.ts +1 -1
  122. package/dist/emit/diffJson.js +8 -1
  123. package/dist/emit/diffJson.js.map +1 -1
  124. package/dist/emit/engagementJson.d.ts +8 -0
  125. package/dist/emit/engagementJson.js +46 -0
  126. package/dist/emit/engagementJson.js.map +1 -0
  127. package/dist/emit/glossaryJson.d.ts +1 -1
  128. package/dist/emit/glossaryJson.js +4 -1
  129. package/dist/emit/glossaryJson.js.map +1 -1
  130. package/dist/emit/json.d.ts +17 -1
  131. package/dist/emit/json.js +30 -1
  132. package/dist/emit/json.js.map +1 -1
  133. package/dist/emit/metricsJson.d.ts +1 -1
  134. package/dist/emit/metricsJson.js +4 -1
  135. package/dist/emit/metricsJson.js.map +1 -1
  136. package/dist/emit/queryJson.d.ts +1 -1
  137. package/dist/emit/queryJson.js +7 -1
  138. package/dist/emit/queryJson.js.map +1 -1
  139. package/dist/emit/scopeJson.d.ts +12 -0
  140. package/dist/emit/scopeJson.js +26 -0
  141. package/dist/emit/scopeJson.js.map +1 -0
  142. package/dist/emit/skillCheckJson.d.ts +3 -2
  143. package/dist/emit/skillCheckJson.js +10 -2
  144. package/dist/emit/skillCheckJson.js.map +1 -1
  145. package/dist/emit/statusJson.d.ts +1 -1
  146. package/dist/emit/statusJson.js +15 -1
  147. package/dist/emit/statusJson.js.map +1 -1
  148. package/dist/emit/systemJson.d.ts +15 -8
  149. package/dist/emit/systemJson.js +28 -13
  150. package/dist/emit/systemJson.js.map +1 -1
  151. package/dist/emit/validateJson.d.ts +3 -3
  152. package/dist/emit/validateJson.js +10 -4
  153. package/dist/emit/validateJson.js.map +1 -1
  154. package/dist/mcp/server.d.ts +1 -1
  155. package/dist/mcp/server.js +163 -31
  156. package/dist/mcp/server.js.map +1 -1
  157. package/dist/model/diff.d.ts +4 -1
  158. package/dist/model/diff.js +44 -8
  159. package/dist/model/diff.js.map +1 -1
  160. package/dist/model/glossary.d.ts +2 -0
  161. package/dist/model/glossary.js +1 -0
  162. package/dist/model/glossary.js.map +1 -1
  163. package/dist/model/model.d.ts +55 -2
  164. package/dist/model/model.js +57 -0
  165. package/dist/model/model.js.map +1 -1
  166. package/dist/model/qualifiedRef.d.ts +18 -0
  167. package/dist/model/qualifiedRef.js +26 -0
  168. package/dist/model/qualifiedRef.js.map +1 -1
  169. package/dist/model/queryIndex.d.ts +9 -1
  170. package/dist/model/queryIndex.js +18 -2
  171. package/dist/model/queryIndex.js.map +1 -1
  172. package/dist/model/rules.d.ts +143 -2
  173. package/dist/model/rules.js +162 -3
  174. package/dist/model/rules.js.map +1 -1
  175. package/dist/model/validate.d.ts +40 -0
  176. package/dist/model/validate.js +147 -1
  177. package/dist/model/validate.js.map +1 -1
  178. package/dist/parser/ast.d.ts +31 -3
  179. package/dist/parser/parser.js +148 -14
  180. package/dist/parser/parser.js.map +1 -1
  181. package/dist/query/format.js +1 -1
  182. package/dist/query/format.js.map +1 -1
  183. package/dist/query/verbs.d.ts +6 -0
  184. package/dist/query/verbs.js +6 -2
  185. package/dist/query/verbs.js.map +1 -1
  186. package/dist/system/adaptation.d.ts +14 -0
  187. package/dist/system/adaptation.js +49 -0
  188. package/dist/system/adaptation.js.map +1 -0
  189. package/dist/system/codeowners.d.ts +77 -0
  190. package/dist/system/codeowners.js +242 -0
  191. package/dist/system/codeowners.js.map +1 -0
  192. package/dist/system/manifest.d.ts +10 -5
  193. package/dist/system/manifest.js +54 -26
  194. package/dist/system/manifest.js.map +1 -1
  195. package/dist/system/migrateManifest.d.ts +28 -0
  196. package/dist/system/migrateManifest.js +155 -0
  197. package/dist/system/migrateManifest.js.map +1 -0
  198. package/dist/system/scope.d.ts +46 -0
  199. package/dist/system/scope.js +132 -0
  200. package/dist/system/scope.js.map +1 -0
  201. package/dist/system/verify.d.ts +50 -13
  202. package/dist/system/verify.js +179 -58
  203. package/dist/system/verify.js.map +1 -1
  204. package/dist/templates.d.ts +2 -2
  205. package/dist/templates.js +23 -2
  206. package/dist/templates.js.map +1 -1
  207. package/package.json +5 -2
  208. package/plugin/.claude-plugin/plugin.json +18 -0
  209. package/plugin/agents/em-critic.md +27 -0
  210. package/plugin/agents/em-implementer.md +35 -0
  211. package/plugin/agents/em-reviewer.md +32 -0
  212. package/plugin/agents/em-validator.md +28 -0
  213. package/plugin/shared/reference/em-dsl.md +871 -0
  214. package/plugin/shared/reference/methodology.md +329 -0
  215. package/plugin/shared/reference/operating-principles.md +222 -0
  216. package/plugin/shared/reference/slice-doc-schema.md +574 -0
  217. package/plugin/shared/templates/conformance-report.md +85 -0
  218. package/plugin/shared/templates/constitution.md +136 -0
  219. package/plugin/shared/templates/model-readme.md +46 -0
  220. package/plugin/shared/templates/slice.md +251 -0
  221. package/plugin/shared/templates/state.md +77 -0
  222. package/plugin/skills/conform/SKILL.md +93 -0
  223. package/plugin/skills/conform/reference/conform.md +428 -0
  224. package/plugin/skills/design/SKILL.md +298 -0
  225. package/plugin/skills/discover/SKILL.md +90 -0
  226. package/plugin/skills/discover/reference/extract.md +147 -0
  227. package/plugin/skills/engagement/SKILL.md +193 -0
  228. package/plugin/skills/engagement/reference/engagement.md +144 -0
  229. package/plugin/skills/event-modeling/SKILL.md +132 -0
  230. package/plugin/skills/implement/SKILL.md +61 -0
  231. package/plugin/skills/implement/reference/implement.md +439 -0
  232. package/plugin/skills/review/SKILL.md +74 -0
  233. package/dist/emit/typespec.d.ts +0 -26
  234. package/dist/emit/typespec.js +0 -356
  235. package/dist/emit/typespec.js.map +0 -1
@@ -0,0 +1,193 @@
1
+ ---
2
+ name: engagement
3
+ em-version: 1.14.1
4
+ description: >-
5
+ Use when leading an engagement: building a named set of ratified event-modeling slices
6
+ (`em engagement`) into a stack of PRs by dispatching the em-implementer, em-validator,
7
+ em-reviewer and em-critic sub-agents, level by level, and handing the human the stack
8
+ bottom-first to merge. The lead session orchestrates and never writes slice code itself. To
9
+ build one slice by hand, use em:implement instead.
10
+ ---
11
+ <!-- GENERATED FILE from .claude/skills/event-modeling-engagement/SKILL.md by scripts/build-plugin.ts — do not hand-edit; run npm run docs:generate -->
12
+
13
+ # Event Modeling — engagement (lead session)
14
+
15
+ Goal: take an engagement (a named chunk of the model, `<model dir>/engagements/<slug>.md`) from
16
+ its plan to merged PRs. You are the **lead**: you cut worktrees, dispatch scoped sub-agents,
17
+ record every step in the Ledger with `em engagement set`, and hand the human a stack of PRs to
18
+ merge bottom-first. You never write slice code, never merge, and never rebase a slice branch.
19
+
20
+ **Read `reference/engagement.md` before the first dispatch.** It holds the Ledger state machine,
21
+ the evidence bundle format, the retarget check, the gap protocol and the model-selection rule
22
+ this file uses by name. Each sub-agent runs `em:implement`'s contract
23
+ (`${CLAUDE_PLUGIN_ROOT}/skills/implement/reference/implement.md`) for its one slice; that contract is
24
+ theirs, not yours.
25
+
26
+ The sub-agents are `em-implementer`, `em-validator`, `em-reviewer` and `em-critic`. Under the
27
+ plugin their dispatch names are `em:em-implementer`, `em:em-validator`, `em:em-reviewer` and
28
+ `em:em-critic`. In a vendored repo they live in `.claude/agents/`; if they are missing, STOP and
29
+ tell the user to run `em skill sync` (or `em upgrade`).
30
+
31
+ Throughout, `<model>.em` is the model file and `<slug>` the engagement's name. Every command
32
+ below is real; run it as written.
33
+
34
+ ## 1. Preconditions — STOP on each
35
+
36
+ Run the shared preconditions first (tool check, bundle currency, locate the model):
37
+ `${CLAUDE_PLUGIN_ROOT}/shared/reference/operating-principles.md` ("Preconditions"). Then:
38
+
39
+ 1. **Constitution ratified.** `em status <model>.em` names the constitution (`constitution.md`
40
+ beside the model, or `.specify/memory/constitution.md`). STOP if it is missing or its
41
+ `ratifiedBy:` is empty (spec-kit: no `**Ratified**:` footer). Say so and point at
42
+ `em:implement`'s §7; never draft house rules to get moving.
43
+ 2. **Foundation PR merged.** Ask the human for the foundation PR (implement.md §8) and confirm it
44
+ has merged into `main` (`gh pr view <n> --json state` shows `MERGED`). STOP if there is none
45
+ or it is still open. No slice branch is cut before it lands.
46
+ 3. **Merge strategy.** The constitution's "Review and merge norms" must carry the line
47
+ `- **Merge strategy:** merge-commits-when-stacked`. STOP if the line is absent or names any
48
+ other value: tell the human the engagement needs that norm and point at the constitution
49
+ template's "Review and merge norms" prompt
50
+ (`${CLAUDE_PLUGIN_ROOT}/shared/templates/constitution.md`). The constitution is the human's to
51
+ amend and ratify, never yours.
52
+ 4. **Agent models.** Read the line `- **Agent models:** implementer=<model>,
53
+ validator=<model>, reviewer=<model>, critic=<model|codex>`. If it is absent, say once:
54
+ "no Agent models line — using implementer=sonnet, validator=sonnet, reviewer=sonnet,
55
+ critic=opus", and proceed. Apply the model-selection rule in `reference/engagement.md`
56
+ (the critic never runs on the implementer's model).
57
+ 5. **Worktrees are ignored.** `git check-ignore -q .claude/worktrees/x` must succeed. If it
58
+ fails, STOP and ask the human to add `.claude/worktrees/` to `.gitignore` in its own commit
59
+ on `main`.
60
+ 6. **The engagement exists.** `em engagement status <model>.em <slug>`. If there is no such
61
+ engagement, ask the human which slices it covers (a list, a context, or "everything
62
+ downstream of X") and run `em engagement new <model>.em <slug> --slices a,b,c` (or
63
+ `--context <C>`, or `--downstream-of <ref>`) `--by "<their name>"`. When `new` warns that the
64
+ selection has several unconnected components, relay its suggestion (one engagement each)
65
+ and let the human decide before going on.
66
+
67
+ ## 2. Plan and confirm the ceiling once
68
+
69
+ Run `em engagement plan <model>.em <slug>` (`--json` when you need the fields). Present it in
70
+ plain terms: each level, its width against the ceiling (`parallel`), each slice's branch and
71
+ base, and every held slice with its reason (`not-ready`, `upstream-outside-engagement-unmerged`,
72
+ `multiple-unmerged-upstreams`, or `human`). Then ask exactly one question:
73
+
74
+ > "Ceiling N from the plan; proceed?"
75
+
76
+ Ask it once per engagement. If the human names a lower number, use it for this session. **Never
77
+ ask "which slice first"**: the levels decide the order, and the ceiling decides how many at once.
78
+ A held slice is never started; the plan releases it when its hold clears.
79
+
80
+ ## 3. Per level: cut the worktree, then dispatch the implementer
81
+
82
+ Work level by level, in order. A slice in level n+1 starts only when its upstream has reached
83
+ `awaiting-merge` or `merged`, so the base it is cut from no longer moves. Within a level, keep up
84
+ to the ceiling of slices in flight (`building`, `validating` or `review`) at once, dispatched in
85
+ parallel. For each slice the plan lists as not held:
86
+
87
+ 1. Take `base` from the plan for this slice: `main`, or `impl/<upstream>`. **Never the current
88
+ HEAD**, and never a branch you picked yourself.
89
+ 2. If `impl/<key>` already exists (`git rev-parse --verify --quiet impl/<key>`) or
90
+ `.claude/worktrees/<key>` already exists, STOP for that slice and report it. Never delete,
91
+ reuse or reset someone's branch.
92
+ 3. Cut the worktree yourself:
93
+ `git worktree add .claude/worktrees/<key> -b impl/<key> <base>`
94
+ 4. Record it:
95
+ `em engagement set <model>.em <slug> <key> --state building --branch impl/<key> --base <base>`
96
+ 5. Dispatch `em-implementer` (`em:em-implementer` under the plugin) on the implementer model.
97
+ Its prompt is ONLY the slice key and the absolute worktree path. It reads its own spec, the
98
+ constitution and the implement contract. Give it no plan, no other slice, and no merge or
99
+ stacking instructions.
100
+
101
+ ## 4. Validate, review, criticise
102
+
103
+ When the implementer returns a PR URL (and a per-invariant test map):
104
+
105
+ 1. `em engagement set <model>.em <slug> <key> --state validating --pr <url>`. Check the PR's
106
+ base: `gh pr view <url> --json baseRefName` must equal the Ledger's base. If not, fix it
107
+ with `gh pr edit <url> --base <base>`. That is a lead step; the implementer never changes a
108
+ base.
109
+ 2. Dispatch `em-validator` (`em:em-validator`) with the slice key and the worktree path. It
110
+ returns one PASS/FAIL line per check and `OVERALL: PASS` or a failure.
111
+ 3. On `OVERALL: PASS`: `em engagement set <model>.em <slug> <key> --state review`. Dispatch
112
+ `em-reviewer` (`em:em-reviewer`) with the slice key and the PR URL. Dispatch `em-critic`
113
+ (`em:em-critic`) with the same two inputs, on the critic model, in fresh context. **Never
114
+ show the critic the reviewer's findings.** When the critic is `codex`, run the
115
+ prerequisite checks and the `codex exec` invocation in `reference/engagement.md` ("Codex
116
+ critic") in a fresh `.claude/worktrees/review-<pr>`, treat its output file as the critic's findings, and
117
+ fall back to `em-critic` (saying so in the evidence bundle) if any prerequisite fails.
118
+ 4. Compare the two findings lists. A blocker or major finding raised by only one of the two is
119
+ itself a finding for the human (record it in the evidence bundle).
120
+ 5. **Findings go back to the SAME implementer.** On a validator FAIL, or any `blocker`/`major`
121
+ finding: `em engagement set <model>.em <slug> <key> --state building`, then continue the same
122
+ implementer agent (same session, same branch, same worktree) with the failing check lines or
123
+ the findings. Never start a fresh implementer for it, and never fix the code yourself. When
124
+ it reports back, go back to step 4.1: the validator always re-runs before review does. If the
125
+ same finding survives two rounds, stop the loop and put it in the evidence bundle for the
126
+ human.
127
+ 6. `minor` findings do not loop. They go in the evidence bundle.
128
+
129
+ ## 5. Hand the human the stack, bottom first
130
+
131
+ When a slice passes review: `em engagement set <model>.em <slug> <key> --state awaiting-merge`.
132
+ Hand the human the PRs bottom-first, lowest level first, each with its evidence bundle
133
+ (`reference/engagement.md`): the validator table, the reviewer's and critic's findings and any
134
+ disagreement, and the per-invariant test map. Tell them, every time:
135
+
136
+ - merge bottom-first, with a **merge commit** while any PR stacks on this one (implement.md §8
137
+ rule 2a). Squash is forbidden in that state;
138
+ - delete the head branch on merge, so GitHub retargets the PRs that stacked on it.
139
+
140
+ You never merge.
141
+
142
+ ## 6. After each human merge
143
+
144
+ 1. Update `main` in your own checkout: `git switch main && git pull --ff-only`.
145
+ 2. **Retarget check** (`reference/engagement.md`): `gh pr list --base impl/<key> --state open`
146
+ must be empty. For each PR still listed (the head branch was not deleted),
147
+ `gh pr edit <n> --base main`. Then record the new base on each dependent, keeping its state:
148
+ `em engagement set <model>.em <slug> <dependent> --state <its state> --base main`.
149
+ 3. `em engagement set <model>.em <slug> <key> --state merged`, then remove the worktree:
150
+ `git worktree remove .claude/worktrees/<key>`.
151
+ 4. When every slice of a level is `merged` or `gap`, open one follow-up PR for that level from
152
+ `main`: `git switch -c engagement/<slug>-level-<n> main`, run
153
+ `em slice mark-implemented <model>.em <key> <pr-url>` for each slice merged in the level,
154
+ then `em slice index <model>.em`, commit, and `gh pr create --base main`. The human merges it
155
+ like any other PR.
156
+ 5. Recompute: `em engagement plan <model>.em <slug>`. Merges release holds
157
+ (`multiple-unmerged-upstreams` drops to one upstream, a base moves to `main`). Continue with
158
+ step 3 for anything newly startable.
159
+
160
+ ## 7. Gaps
161
+
162
+ When the implementer stops on a gap (the doc is wrong, incomplete, or contradicts the
163
+ constitution), follow the gap protocol (`reference/engagement.md`):
164
+
165
+ 1. `em engagement set <model>.em <slug> <key> --state gap`.
166
+ 2. Add the question as a dated bullet under the model's `.event-modeling.md`
167
+ `## Open questions / parking lot`:
168
+ `- [ ] YYYY-MM-DD: <key> — <the question, citing the doc line> — source: engagement <slug>`.
169
+ 3. Continue with the other slices. Leave the gap slice's dependents unstarted, and tell the
170
+ human which they are. The doc is fixed in a design session, never in this one.
171
+
172
+ ## 8. End
173
+
174
+ 1. `em state log-usage <model>.em --phases engagement`.
175
+ 2. `em engagement status <model>.em <slug>`. When it reports `closable: true` (every slice
176
+ `merged` or `gap`), run `em engagement close <model>.em <slug>`. Otherwise leave it open: the
177
+ next lead session resumes from the Ledger.
178
+ 3. Report: what merged (PR links), what is awaiting merge, what is held and why, each gap with
179
+ its question, and every unresolved reviewer or critic disagreement.
180
+
181
+ ## Never do
182
+
183
+ | Rule | Because |
184
+ |---|---|
185
+ | Never hand-edit `engagements/<slug>.md` | `em engagement set` and `close` are the only write paths; the Ledger table is generated |
186
+ | Never restack or rebase a slice branch | Merge commits make restacking unnecessary; a rebase rewrites history a dependent was cut from |
187
+ | Never squash a PR with an open dependent | It strands the dependent's history (implement.md §8 rule 2a) |
188
+ | Never run the implementer's work yourself | The lead orchestrates; code comes from a scoped implementer working from its own read of the spec |
189
+ | Never dispatch beyond the ceiling | The ceiling was confirmed once for the engagement; exceeding it breaks that agreement |
190
+ | Never cut a slice branch from the current HEAD | The base comes from the plan; any other base stacks the PR on the wrong history |
191
+ | Never merge a PR | The human merges, bottom-first |
192
+ | Never show the critic the reviewer's findings | The critic's value is an independent view; disagreement is a finding |
193
+ | Never start a held slice, or ask "which slice first" | The plan decides order and holds; the human confirms only the ceiling |
@@ -0,0 +1,144 @@
1
+ <!-- GENERATED FILE from .claude/skills/event-modeling-engagement/reference/engagement.md by scripts/build-plugin.ts — do not hand-edit; run npm run docs:generate -->
2
+ # Engagement reference — the lead session's rules
3
+
4
+ The `em:engagement` skill's steps refer here by name. The commands are documented in
5
+ full in `docs/cli.md` (`em engagement`) and the file format in `docs/engagement-schema.md`;
6
+ neither is vendored, and this file repeats only what the lead needs mid-session.
7
+
8
+ ## The Ledger state machine
9
+
10
+ Every Ledger write is `em engagement set <model>.em <slug> <key> --state <state> [--branch <b>]
11
+ [--base <b>] [--pr <url>]`. The command accepts any state at any time, so the order below is the
12
+ skill's discipline, not something em enforces. The exceptions em does enforce: setting the same
13
+ state and values again is a no-op, `merged` is terminal (every later `set` is refused), and a
14
+ closed engagement refuses every `set`.
15
+
16
+ | State | Set at | Means | Next |
17
+ |---|---|---|---|
18
+ | `planned` | `em engagement new` | Selected; nothing cut yet | `building` (step 3) or `held` |
19
+ | `building` | step 3, after `git worktree add` (with `--branch impl/<key> --base <base>`); step 4.5 when findings go back | The implementer owns the worktree | `validating`, or `gap` |
20
+ | `validating` | step 4.1 (with `--pr <url>` the first time) | `em-validator` is running on the PR | `review` on PASS, `building` on FAIL |
21
+ | `review` | step 4.3 | `em-reviewer` and `em-critic` are reading the PR | `awaiting-merge`, or `building` on blocker/major findings |
22
+ | `awaiting-merge` | step 5 | Handed to the human with its evidence bundle | `merged` |
23
+ | `merged` | step 6.3, after the human merges (also inferred, never written, once the doc reads `status: implemented`) | Terminal | — |
24
+ | `held` | only when the human asks to park a slice (`heldBy: human`) | A human hold; the plan's own computed holds are separate (`planHeld`) and never written | `planned` when the human releases it |
25
+ | `gap` | step 7 | The implementer stopped on a question the doc must answer | Stays `gap`; the slice comes back in a later engagement once its doc is re-ratified |
26
+
27
+ `em engagement close <model>.em <slug>` succeeds only when every slice is `merged` (recorded or
28
+ inferred) or `gap`; `em engagement status` reports this as `closable`.
29
+
30
+ A dependent's base changes once, when its upstream merges: record it with the dependent's
31
+ current state and `--base main` (step 6.2), so the Ledger matches the PR's real base.
32
+
33
+ ## The evidence bundle (step 5)
34
+
35
+ Hand the human one block per PR, bottom-first, in this shape:
36
+
37
+ ```markdown
38
+ ### <level n> · `<key>` · <PR URL>
39
+ Base: `<base>` · Ledger: awaiting-merge · Stacked on it: <PR URLs of open dependents, or "none">
40
+ Merge with: a merge commit (<a dependent is open | squash allowed: no open dependent>)
41
+
42
+ Validator (em-validator, <model>):
43
+ | Check | Result |
44
+ |---|---|
45
+ | `em validate <model>.em --slice-ready <key>` | PASS |
46
+ | `em coverage <model>.em --slice <key> --tests <dir> --strict` | PASS |
47
+ | test command `<cmd>` | PASS |
48
+ | diff footprint inside the slice package | PASS |
49
+ | no diff under `slices/**`, `*.em`, `constitution.md`, `engagements/` | PASS |
50
+ | PR body cites the slice doc | PASS |
51
+
52
+ Reviewer (em-reviewer, <model>): <findings list verbatim, or NO FINDINGS>
53
+ Critic (em-critic, <model>): <findings list verbatim, or NO FINDINGS>
54
+ Disagreements: <each blocker/major raised by one and not the other, or "none">
55
+ Rounds: <how many times findings went back to the implementer>; unresolved: <findings that
56
+ survived two rounds, or "none">
57
+
58
+ Per-invariant tests (from em-implementer):
59
+ - INV-<id> -> <test file>::<test name>
60
+ ```
61
+
62
+ Copy the agents' lines verbatim; never summarise a finding away.
63
+
64
+ ## The retarget check (step 6.2)
65
+
66
+ GitHub retargets every open PR whose base was a merged head branch to the merged PR's base, but
67
+ only when that head branch is deleted. After each merge of `impl/<key>`:
68
+
69
+ 1. `gh pr list --base impl/<key> --state open --json number,headRefName` must return `[]`.
70
+ 2. For each PR it does list, run `gh pr edit <number> --base main`. Then record it:
71
+ `em engagement set <model>.em <slug> <dependent> --state <its current state> --base main`.
72
+ 3. Confirm with `gh pr view <number> --json baseRefName`.
73
+
74
+ Because the lower PR merged with a merge commit, the dependent's diff against `main` shrinks to
75
+ its own commits by itself. Never rebase it. If its diff still shows the upstream's commits, the
76
+ lower PR was squashed: STOP and tell the human. Restacking that PR is their decision.
77
+
78
+ ## The gap protocol (step 7)
79
+
80
+ A gap is a question only the model can answer: the doc is wrong, incomplete, or contradicts the
81
+ constitution. The implementer stops and reports it as the doc line plus the question.
82
+
83
+ 1. `em engagement set <model>.em <slug> <key> --state gap`. Leave the worktree and branch as they
84
+ are.
85
+ 2. Append one bullet to `.event-modeling.md` under `## Open questions / parking lot`:
86
+ `- [ ] YYYY-MM-DD: <key> — <question, citing the doc line> — source: engagement <slug>`
87
+ (today's local date).
88
+ 3. Every slice downstream of the gap stays unstarted. Name them to the human.
89
+ 4. Carry on with every other startable slice. Never answer the question yourself, never edit the
90
+ doc, and never let the implementer guess.
91
+
92
+ The question is answered in a design session (`em:design`), which re-ratifies the
93
+ doc. The slice is then built in a later engagement.
94
+
95
+ ## Model selection
96
+
97
+ Models come from the constitution's `- **Agent models:** implementer=<model>, validator=<model>,
98
+ reviewer=<model>, critic=<model|codex>` line, or from the defaults when the line is absent:
99
+ implementer=sonnet, validator=sonnet, reviewer=sonnet, critic=opus. Pass the model with each
100
+ dispatch; the agent definitions fix none.
101
+
102
+ **The critic never runs on the implementer's model.** If the line names the same model for both,
103
+ STOP before the first critic dispatch and tell the human. A critic on the implementer's model
104
+ shares its blind spots, which defeats its purpose. Proceed without a critic only if the human
105
+ says so, and record that choice in the final report.
106
+
107
+ ## Codex critic
108
+
109
+ When the constitution's agent-models line says `critic=codex`, the critic runs through Codex instead
110
+ of as the `em-critic` sub-agent. Its findings use the same list shape, and every rule above applies
111
+ to them unchanged: fresh context, no access to the reviewer's findings, and disagreement is a
112
+ finding. The Claude critic path is untouched.
113
+
114
+ **Prerequisites (check; never write).** Any miss is reported to the human, the Claude critic
115
+ (`em-critic`) runs for that PR instead, and the evidence bundle says "critic: codex unavailable
116
+ (<reason>), ran em-critic":
117
+
118
+ 1. `command -v codex` succeeds.
119
+ 2. The project is trusted in Codex: `~/.codex/config.toml` has a `[projects."<repo root>"]` table with
120
+ `trust_level = "trusted"`. Read it; never add it. Trust is the human's to grant.
121
+ 3. If the project keeps `.codex/rules`, it is present in the review checkout. A repo without
122
+ `.codex/` is fine: the invocation below needs no rules file, and the lead never creates one.
123
+
124
+ **Invocation** (flags verified against `codex exec --help`, codex-cli 0.159.1). Cut the review
125
+ worktree at the PR head, save the diff, then run Codex read-only:
126
+
127
+ ```
128
+ git worktree add --detach .claude/worktrees/review-<pr> <pr-head-sha>
129
+ gh pr diff <pr> > <scratch>/pr-<pr>.diff
130
+ codex exec --cd .claude/worktrees/review-<pr> --sandbox read-only --ephemeral \
131
+ --add-dir <scratch> -o <scratch>/critic-<pr>.txt "<prompt>" < /dev/null
132
+ ```
133
+
134
+ `< /dev/null` is required: without it `codex exec` waits on stdin ("Reading additional input from
135
+ stdin...") and hangs. `-o` (`--output-last-message`) writes only the final message to the file.
136
+ The prompt gives the slice doc path, the constitution path and the diff path, says it is read-only,
137
+ and asks for ONLY the `em-critic` list: `- [<severity>] <file:line or doc §> — <finding>`
138
+ (`blocker`|`major`|`minor`), every finding citing a slice doc line or constitution rule, or
139
+ `NO FINDINGS` naming what was checked. Do not pass the reviewer's findings.
140
+
141
+ **Parse.** The output file is the critic's findings: keep lines matching `^- \[(blocker|major|minor)\] `
142
+ or the `NO FINDINGS` line. If the file is missing, empty, or has neither, treat it as a failed run:
143
+ report it and fall back to `em-critic`. Then continue with step 4 onward exactly as for the Claude
144
+ critic. Remove the review worktree afterwards (`git worktree remove --force`).
@@ -0,0 +1,132 @@
1
+ ---
2
+ name: event-modeling
3
+ em-version: 1.14.1
4
+ description: >-
5
+ Use when the user runs `/em:event-modeling` (with or without a phase name), or wants to resume an
6
+ event-modeling session without specifying which part of the process applies. Reads the model's
7
+ `.event-modeling.md` state (or the given phase name) and routes to the right focused skill —
8
+ em:discover, em:design, em:implement, em:conform,
9
+ or em:review — or, for building a planned set of ready slices through scoped
10
+ sub-agents to a stack of PRs (an `em engagement`), em: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.
14
+ ---
15
+ <!-- GENERATED FILE from .claude/skills/event-modeling/SKILL.md by scripts/build-plugin.ts — do not hand-edit; run npm run docs:generate -->
16
+
17
+ # Event Modeling with `em` — resume / route
18
+
19
+ `em` drives Event Modeling through ten phases — `discover, extract, model, slice, implement,
20
+ conform, watch, review, validate, engagement` — split across six focused skills, one per stage of
21
+ the process. This router skill is the single entry point for `/em:event-modeling`: it figures out
22
+ which phase applies and hands off, so you never need to remember which of the six skills a given
23
+ phase lives in.
24
+
25
+ | These phases... | ...live in this skill |
26
+ |---|---|
27
+ | `discover`, `extract` | `em:discover` — starting a new model, or extracting a current-state model from an existing codebase |
28
+ | `model`, `slice` | `em:design` — structuring the model into swimlanes/patterns, writing deep slice specs |
29
+ | `implement` | `em:implement` — building one ratified slice into merged, tested code |
30
+ | `conform`, `validate` | `em:conform` — drift-checking a model against its codebase, walking validation diagnostics |
31
+ | `watch`, `review` | `em:review` — the live browser viewer, facilitated stakeholder walkthroughs |
32
+ | `engagement` | `em:engagement` — build a planned set of ready slices through scoped sub-agents to a stack of PRs |
33
+
34
+ ## Routing logic
35
+
36
+ 1. Check the tool: `em --version`. If missing, tell the user to run `npm i -g @milehimikey/em`
37
+ and stop until installed. Then check this vendored bundle's own currency against it — see
38
+ `${CLAUDE_PLUGIN_ROOT}/shared/reference/operating-principles.md`'s Preconditions step 2: a bundle
39
+ even one minor version behind the installed em is a STOP, not a warning — only a patch-only
40
+ gap proceeds normally.
41
+ 2. Parse `$ARGUMENTS` for a phase name.
42
+ - **A recognized phase name** (`discover`, `extract`, `model`, `slice`, `implement`,
43
+ `conform`, `validate`, `watch`, `review`, `engagement`): look it up in the table above and invoke that
44
+ skill directly (via the `Skill` tool), passing the phase name along so it knows exactly
45
+ where to start. Don't re-derive state first — the target skill's own preconditions handle
46
+ that.
47
+ - **No argument:** locate the model (an `.event-modeling.md`/`*.em` pair in the working
48
+ directory, or one level down under `models/<slug>/` for a multi-model project — see
49
+ `${CLAUDE_PLUGIN_ROOT}/shared/reference/operating-principles.md`). If found, run
50
+ `em state read <dir>` and read its `phase` field as JSON — don't parse the state file's
51
+ bullets by hand. Map that phase through the table above and invoke the matching skill,
52
+ telling it to resume at the recorded `step` too. If no model exists yet, ask the user
53
+ whether this is a new model (`em:discover`, `discover`) or an existing system to
54
+ extract from (`em:discover`, `extract`), then invoke that skill.
55
+ - **An unrecognized argument:** treat it as free-text intent and pick the best-matching skill
56
+ from the table's description, same as you would if the user had asked in plain language.
57
+ 3. **Steer late work to `em:review` (MIL-236).** When the phase resolves to `slice`
58
+ (recorded or requested), run `em status <model>.em --json` before handing off. Recommend
59
+ `em:review` to the user instead of `em:design` when either holds:
60
+ - no slice doc is left to write or deepen: `slices.byStatus.draft === 0`,
61
+ `slices.byStatus.noDoc === 0`, and `slices.byStatus.reviewed +
62
+ slices.byStatus.readyToImplement > 0`;
63
+ - the state file's `## Open questions / parking lot` section has an unchecked `- [ ]` item.
64
+ Say why: closing open questions and walking slices to the review gate is the review skill's
65
+ job, not broad consistency work. Invoke `em:review` when the user agrees;
66
+ otherwise hand off to `em:design` as the table says.
67
+ 4. **Never do the phase work here.** Recommend the focused skill by name and hand off. Never run
68
+ a cross-cutting "make everything consistent" pass from this skill: no sweeping edits across
69
+ slice docs, no regenerating or hand-editing derived artifacts, no reading implementation code
70
+ to settle a modeling question. The design-session write scope below applies to anything
71
+ started from here.
72
+ 5. Once you've handed off, this skill's job is done for the session — the target skill owns the
73
+ conversation from there, including re-invoking `em:event-modeling` (this skill) itself at the end
74
+ if the user wants to stop and resume later.
75
+
76
+ ## Design-session write scope (MIL-236)
77
+
78
+ These rules bind every `discover`/`model`/`slice` session, whichever skill runs it. The full
79
+ text is in `${CLAUDE_PLUGIN_ROOT}/shared/reference/operating-principles.md` ("Write scope and
80
+ evidence").
81
+
82
+ - **Bound to one model directory.** The session is bound to the model directory it started in
83
+ (`dirname(<model>.em)`). Never write under another model's directory or to its contract file.
84
+ A question that needs another model's `public` element changed becomes a **seam change
85
+ request**: a dated Decisions-log bullet in THIS model's `.event-modeling.md`, and the question
86
+ stays open as blocked-on-upstream.
87
+ - **Out of scope during design — never write:** generated contract artifacts
88
+ (`contracts/*.tsp`, any OpenAPI or JSON-schema output); SDD/spec artifacts (`specs/`,
89
+ `.specify/` — the constitution may be read, never written); implementation source (`src/`,
90
+ the model's `Code roots:`); `plugin/`; a draft slice doc's `version:`.
91
+ - **Evidence rule.** The `.em` model and the slice docs are the evidence for modeling
92
+ decisions. Code is consulted only in `extract` (`em:discover`) and `conform`
93
+ (`em:conform`).
94
+
95
+ ## Shared reference material
96
+
97
+ Every phase skill (and this one) points back to the same shared resources rather than
98
+ duplicating them — read them once, they apply everywhere:
99
+
100
+ - `${CLAUDE_PLUGIN_ROOT}/shared/reference/operating-principles.md` — the Socratic/validation discipline
101
+ every phase follows, the preconditions above in full, and the project layout these skills
102
+ create (including multi-model projects).
103
+ - `${CLAUDE_PLUGIN_ROOT}/shared/reference/methodology.md` — the 7 steps and 4 patterns (Event Modeling
104
+ methodology).
105
+ - `${CLAUDE_PLUGIN_ROOT}/shared/reference/em-dsl.md` — `em`'s DSL grammar, CLI reference, and the full
106
+ `em validate` rule catalog.
107
+ - `${CLAUDE_PLUGIN_ROOT}/shared/templates/*.md` — the slice/state/model-readme/conformance-report
108
+ templates every phase scaffolds from.
109
+
110
+ ## em command reference (quick)
111
+
112
+ <!-- GENERATED:cli-quick:start -- run `npm run docs:generate` to refresh, do not hand-edit -->
113
+ ```bash
114
+ em --version
115
+ em init <name>.em # optional starter scaffold
116
+ em scaffold <name> # full project: <slug>/<slug>.em, README.md, .event-modeling.md
117
+ em validate <name>.em # check rules; exit 0 if clean/warnings only
118
+ em render <name>.em -o <name>.svg # render (svg/png/pdf by extension)
119
+ em render <name>.em --emit-dot # inspect generated Graphviz DOT
120
+ em render <name>.em --slice "<slice-name>" -o slices/<slug>.svg # this slice's own diagram
121
+ em watch <name>.em -o <name>.svg # re-render on save (run in background)
122
+ em watch <name>.em -o <name>.svg --serve # + the live browser viewer: instant push-reload, pan/zoom (--port N)
123
+ # click "Review mode" for a slice-by-slice storyboard walkthrough
124
+ ```
125
+ <!-- GENERATED:cli-quick:end -->
126
+
127
+ Always finish a working session by: re-rendering, running `em validate`, and updating
128
+ `.event-modeling.md` — `em state set-phase <phase> [--step <n>]` for the current phase/step,
129
+ decisions and open questions by hand, and `em state log-usage <model>.em --phases <phases>` for
130
+ the Usage log entry. Before committing a design session, stage the files and run the pre-commit
131
+ check in `${CLAUDE_PLUGIN_ROOT}/shared/reference/operating-principles.md` ("Write scope and
132
+ evidence"): `em system scope --staged` plus `git diff --cached --name-only`; STOP on any finding.
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: implement
3
+ em-version: 1.14.1
4
+ description: >-
5
+ Use when building a single ratified event-modeling slice (status: ready-to-implement) into
6
+ merged, tested code — the one phase where the agent builds rather than facilitates. Gates on
7
+ readiness, treats the slice doc as the read-only spec, surfaces gaps instead of deciding them
8
+ silently, and requires tests traceable to the doc's invariants and scenarios.
9
+ ---
10
+ <!-- GENERATED FILE from .claude/skills/event-modeling-implement/SKILL.md by scripts/build-plugin.ts — do not hand-edit; run npm run docs:generate -->
11
+
12
+ # Event Modeling — implement
13
+
14
+ Goal: turn a single `ready-to-implement` slice into merged, verified code — the one phase where
15
+ the agent builds rather than facilitates.
16
+
17
+ **Read `reference/implement.md` before doing any implement work and follow it as the
18
+ contract.** In short: gate on `em validate <model>.em --slice-ready <key>` (stop and hand
19
+ back if it fails — never edit the doc to make the gate pass); read the project's implementation
20
+ constitution before writing code and stay inside its rules; before a project's first slice PR,
21
+ land a one-time foundation PR holding every model event (plus the shared interface shell) so
22
+ slices only ever import contracts, never invent or reach into a sibling's; build in dependency
23
+ order from `em query upstream`, not timeline order; treat the slice doc as
24
+ the spec (read-only, except the merge-time `status`/`implementedIn` flip); implement exactly one
25
+ slice doc per PR — a `covers:` doc's two keys ship together in that one PR, and an `again` view
26
+ instance is a continuation of its originating slice (no doc, status, or PR of its own — it
27
+ ships in the originating doc's PR); ship the endpoint a
28
+ `ui`-triggered command or `ui`-consumed view obligates, and surface — never invent — one the
29
+ model doesn't show; surface every gap to the user instead of deciding it silently; cover every
30
+ `INV-<MNEMONIC>-n` and every scenario with tests, proving the citations before merge with
31
+ `em coverage <model>.em --slice <key> --tests <dir> --strict` (the default form skips a
32
+ `ready-to-implement` slice); in spec-kit projects, allocate via
33
+ em-sdd-bridge (redirect mode) and never run `/speckit.specify`.
34
+
35
+ **Gate: no constitution, no first slice.** The constitution is the project's ratified house rules
36
+ — stack and architectural shape (including which implementation skill each slice pattern routes
37
+ to), code style, testing norms, NFR baselines, review/merge norms. It lives at
38
+ `.specify/memory/constitution.md` in a spec-kit project, otherwise `constitution.md` beside the
39
+ model; `em status` reports which, and whether it's there. If it's missing — or its `ratifiedBy:`
40
+ is empty, meaning nobody has signed it off — run `reference/implement.md` §7 ("Before the first
41
+ slice: the constitution") first: ask its questions conversationally, write the answers in, and
42
+ have a human ratify them. Don't decide the project's stack or style yourself to get moving.
43
+
44
+ That contract applies to any implementing agent, whether or not the session started from
45
+ `/em:event-modeling` — `em contract` prints it to stdout with no `.claude/` awareness required, for
46
+ an agent that can run a shell but isn't Claude Code.
47
+
48
+ If the project ships pattern-specific implementation skills (for example an Axon/DCB skill set
49
+ keyed on a slice doc's `pattern:` frontmatter), route by the slice's pattern and follow those —
50
+ `reference/implement.md` §2 explains where that hand-off happens, and the constitution's
51
+ routing table (§7) is what names the skill set for each pattern.
52
+
53
+ Preconditions (tool check, model location) are the same as every other phase — see
54
+ `${CLAUDE_PLUGIN_ROOT}/shared/reference/operating-principles.md` — but this phase additionally
55
+ requires the target slice to already be ratified; if it isn't, stop and say so rather than
56
+ starting on unratified work.
57
+
58
+ End of phase: PR merged, slice doc flipped to `status: implemented` with `implementedIn`
59
+ filled, `em slice index <model-name>.em` run to refresh `README.md`'s Slices table. Implement
60
+ doesn't chain to another phase — run it once per ratified slice; `em:conform`'s
61
+ `conform` phase later checks the result against the model.