@eventmodelers/cli 0.0.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 (220) hide show
  1. package/README.md +175 -0
  2. package/cli.js +676 -0
  3. package/package.json +35 -0
  4. package/shared/build-kit/code-export.mjs +560 -0
  5. package/shared/build-kit/lib/ollama-agent.js +147 -0
  6. package/shared/build-kit/package.json +11 -0
  7. package/shared/build-kit/ralph-ollama.js +39 -0
  8. package/shared/build-kit/realtime-agent.js +18 -0
  9. package/stacks/axon/templates/.claude/skills/build-automation/SKILL.md +407 -0
  10. package/stacks/axon/templates/.claude/skills/build-automation/references/feature-flag-patterns.md +114 -0
  11. package/stacks/axon/templates/.claude/skills/build-automation-workflow/SKILL.md +496 -0
  12. package/stacks/axon/templates/.claude/skills/build-automation-workflow/references/axon-workflow-api.md +279 -0
  13. package/stacks/axon/templates/.claude/skills/build-automation-workflow/references/feature-flag-patterns.md +114 -0
  14. package/stacks/axon/templates/.claude/skills/build-state-change/SKILL.md +396 -0
  15. package/stacks/axon/templates/.claude/skills/build-state-change/references/axon-test-fixture-patterns.md +162 -0
  16. package/stacks/axon/templates/.claude/skills/build-state-change/references/feature-flag-patterns.md +56 -0
  17. package/stacks/axon/templates/.claude/skills/build-state-change/references/rest-api-patterns.md +115 -0
  18. package/stacks/axon/templates/.claude/skills/build-state-view/SKILL.md +282 -0
  19. package/stacks/axon/templates/.claude/skills/connect/SKILL.md +178 -0
  20. package/stacks/axon/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +611 -0
  21. package/stacks/axon/templates/.claude/skills/load-slice/SKILL.md +141 -0
  22. package/stacks/axon/templates/.claude/skills/update-slice-status/SKILL.md +105 -0
  23. package/stacks/axon/templates/build-kit/lib/AGENT.md +47 -0
  24. package/stacks/axon/templates/build-kit/lib/agent.sh +20 -0
  25. package/stacks/axon/templates/build-kit/lib/backend-prompt.md +158 -0
  26. package/stacks/axon/templates/build-kit/lib/prompt.md +126 -0
  27. package/stacks/axon/templates/build-kit/lib/ralph.js +369 -0
  28. package/stacks/axon/templates/build-kit/ralph-claude.js +44 -0
  29. package/stacks/axon/templates/build-kit/ralph.sh +98 -0
  30. package/stacks/axon/templates/root/.env.example +5 -0
  31. package/stacks/axon/templates/root/CLAUDE.md +60 -0
  32. package/stacks/axon/templates/root/README.md +44 -0
  33. package/stacks/axon/templates/root/docker-compose.yml +64 -0
  34. package/stacks/axon/templates/root/mvnw +259 -0
  35. package/stacks/axon/templates/root/mvnw.cmd +149 -0
  36. package/stacks/axon/templates/root/pom.xml +125 -0
  37. package/stacks/axon/templates/root/src/main/java/io/axoniq/quickstart/QuickstartApplication.java +128 -0
  38. package/stacks/axon/templates/root/src/main/java/io/axoniq/quickstart/config/WebConfig.java +155 -0
  39. package/stacks/axon/templates/root/src/main/resources/application.properties +2 -0
  40. package/stacks/axon/templates/root/src/main/resources/static/bg-body.png +0 -0
  41. package/stacks/axon/templates/root/src/main/resources/static/bg-header.png +0 -0
  42. package/stacks/axon/templates/root/src/main/resources/static/index.html +596 -0
  43. package/stacks/cratis-csharp/templates/.claude/skills/_shared/cratis-conventions.md +251 -0
  44. package/stacks/cratis-csharp/templates/.claude/skills/build-automation/SKILL.md +99 -0
  45. package/stacks/cratis-csharp/templates/.claude/skills/build-automation/references/patterns.md +115 -0
  46. package/stacks/cratis-csharp/templates/.claude/skills/build-state-change/SKILL.md +163 -0
  47. package/stacks/cratis-csharp/templates/.claude/skills/build-state-change/references/patterns.md +234 -0
  48. package/stacks/cratis-csharp/templates/.claude/skills/build-state-view/SKILL.md +120 -0
  49. package/stacks/cratis-csharp/templates/.claude/skills/build-state-view/references/patterns.md +166 -0
  50. package/stacks/cratis-csharp/templates/.claude/skills/connect/SKILL.md +169 -0
  51. package/stacks/cratis-csharp/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +609 -0
  52. package/stacks/cratis-csharp/templates/.claude/skills/load-slice/SKILL.md +141 -0
  53. package/stacks/cratis-csharp/templates/.claude/skills/update-slice-status/SKILL.md +105 -0
  54. package/stacks/cratis-csharp/templates/build-kit/lib/AGENT.md +58 -0
  55. package/stacks/cratis-csharp/templates/build-kit/lib/agent.sh +20 -0
  56. package/stacks/cratis-csharp/templates/build-kit/lib/backend-prompt.md +129 -0
  57. package/stacks/cratis-csharp/templates/build-kit/lib/prompt.md +124 -0
  58. package/stacks/cratis-csharp/templates/build-kit/lib/ralph.js +302 -0
  59. package/stacks/cratis-csharp/templates/build-kit/ralph-claude.js +37 -0
  60. package/stacks/cratis-csharp/templates/build-kit/ralph.sh +98 -0
  61. package/stacks/cratis-csharp/templates/root/.frontend/index.css +29 -0
  62. package/stacks/cratis-csharp/templates/root/.frontend/index.html +17 -0
  63. package/stacks/cratis-csharp/templates/root/.frontend/main.tsx +18 -0
  64. package/stacks/cratis-csharp/templates/root/.frontend/tsconfig.json +42 -0
  65. package/stacks/cratis-csharp/templates/root/.frontend/tsconfig.node.json +11 -0
  66. package/stacks/cratis-csharp/templates/root/.frontend/vite.config.ts +56 -0
  67. package/stacks/cratis-csharp/templates/root/App.tsx +23 -0
  68. package/stacks/cratis-csharp/templates/root/CLAUDE.md +62 -0
  69. package/stacks/cratis-csharp/templates/root/CratisApp.csproj +25 -0
  70. package/stacks/cratis-csharp/templates/root/CratisApp.sln +18 -0
  71. package/stacks/cratis-csharp/templates/root/GlobalUsings.cs +3 -0
  72. package/stacks/cratis-csharp/templates/root/Home.tsx +102 -0
  73. package/stacks/cratis-csharp/templates/root/Program.cs +26 -0
  74. package/stacks/cratis-csharp/templates/root/README.md +192 -0
  75. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/AllListings.ts +47 -0
  76. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/Listing.cs +11 -0
  77. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/Listing.ts +12 -0
  78. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/ListingDataTable.tsx +17 -0
  79. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/index.ts +1 -0
  80. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/Register.ts +51 -0
  81. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/RegisterDialog.tsx +18 -0
  82. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/Registration.cs +27 -0
  83. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/index.ts +1 -0
  84. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/SomeFeature.tsx +22 -0
  85. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/SomeName.cs +3 -0
  86. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/index.ts +1 -0
  87. package/stacks/cratis-csharp/templates/root/appsettings.Development.json +9 -0
  88. package/stacks/cratis-csharp/templates/root/appsettings.json +26 -0
  89. package/stacks/cratis-csharp/templates/root/docker-compose.yml +23 -0
  90. package/stacks/cratis-csharp/templates/root/package.json +33 -0
  91. package/stacks/cratis-csharp/templates/root/tsconfig.json +3 -0
  92. package/stacks/modeling-kit/templates/.claude/settings.local.json +13 -0
  93. package/stacks/modeling-kit/templates/.claude/skills/analyze-existing-model/SKILL.md +215 -0
  94. package/stacks/modeling-kit/templates/.claude/skills/attributes/SKILL.md +176 -0
  95. package/stacks/modeling-kit/templates/.claude/skills/connect/SKILL.md +182 -0
  96. package/stacks/modeling-kit/templates/.claude/skills/discover-storyboard/SKILL.md +383 -0
  97. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-applying-conways-law/SKILL.md +465 -0
  98. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-brainstorming-events/SKILL.md +587 -0
  99. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-brainstorming-events/references/facilitating-event-modeling-workshops.md +626 -0
  100. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-checking-completeness/SKILL.md +542 -0
  101. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-designing-event-models/SKILL.md +497 -0
  102. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-elaborating-scenarios/SKILL.md +783 -0
  103. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-identifying-inputs/SKILL.md +604 -0
  104. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-identifying-outputs/SKILL.md +699 -0
  105. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-integrating-legacy-systems/SKILL.md +674 -0
  106. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/SKILL.md +231 -0
  107. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/references/domain-patterns.md +150 -0
  108. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/references/patterns.md +329 -0
  109. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/references/snapshotting.md +204 -0
  110. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-orchestrating-event-modeling/SKILL.md +352 -0
  111. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-orchestrating-event-modeling/references/project-planning-with-event-modeling.md +341 -0
  112. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-plotting-events/SKILL.md +153 -0
  113. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/SKILL.md +136 -0
  114. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/references/examples.md +78 -0
  115. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/references/patterns.md +85 -0
  116. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-storyboarding-events/SKILL.md +655 -0
  117. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-translating-external-events/SKILL.md +479 -0
  118. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-validating-event-models/SKILL.md +234 -0
  119. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-validating-event-models-checklist/SKILL.md +353 -0
  120. package/stacks/modeling-kit/templates/.claude/skills/examples/SKILL.md +200 -0
  121. package/stacks/modeling-kit/templates/.claude/skills/handle-comment/SKILL.md +94 -0
  122. package/stacks/modeling-kit/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +441 -0
  123. package/stacks/modeling-kit/templates/.claude/skills/place-element/SKILL.md +290 -0
  124. package/stacks/modeling-kit/templates/.claude/skills/storyboard/SKILL.md +212 -0
  125. package/stacks/modeling-kit/templates/.claude/skills/storyboard-screen/SKILL.md +123 -0
  126. package/stacks/modeling-kit/templates/.claude/skills/timeline/SKILL.md +353 -0
  127. package/stacks/modeling-kit/templates/.claude/skills/update-slice-status/SKILL.md +110 -0
  128. package/stacks/modeling-kit/templates/.claude/skills/wdyt/SKILL.md +134 -0
  129. package/stacks/modeling-kit/templates/kit/lib/agent.sh +20 -0
  130. package/stacks/modeling-kit/templates/kit/lib/ollama-agent.js +147 -0
  131. package/stacks/modeling-kit/templates/kit/lib/ralph.js +286 -0
  132. package/stacks/modeling-kit/templates/kit/package.json +12 -0
  133. package/stacks/modeling-kit/templates/kit/ralph-claude.js +50 -0
  134. package/stacks/modeling-kit/templates/kit/ralph-ollama.js +38 -0
  135. package/stacks/modeling-kit/templates/kit/ralph.sh +61 -0
  136. package/stacks/modeling-kit/templates/kit/realtime-agent.js +18 -0
  137. package/stacks/modeling-kit/templates/root/CLAUDE.md +56 -0
  138. package/stacks/node/templates/.claude/skills/build-automation/SKILL.md +266 -0
  139. package/stacks/node/templates/.claude/skills/build-state-change/SKILL.md +344 -0
  140. package/stacks/node/templates/.claude/skills/build-state-view/SKILL.md +412 -0
  141. package/stacks/node/templates/.claude/skills/connect/SKILL.md +178 -0
  142. package/stacks/node/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +628 -0
  143. package/stacks/node/templates/.claude/skills/load-slice/SKILL.md +143 -0
  144. package/stacks/node/templates/.claude/skills/update-slice-status/SKILL.md +110 -0
  145. package/stacks/node/templates/build-kit/README.md +86 -0
  146. package/stacks/node/templates/build-kit/lib/AGENT.md +47 -0
  147. package/stacks/node/templates/build-kit/lib/agent.sh +20 -0
  148. package/stacks/node/templates/build-kit/lib/backend-prompt.md +152 -0
  149. package/stacks/node/templates/build-kit/lib/prompt.md +122 -0
  150. package/stacks/node/templates/build-kit/lib/ralph.js +369 -0
  151. package/stacks/node/templates/build-kit/ralph-claude.js +44 -0
  152. package/stacks/node/templates/build-kit/ralph.sh +98 -0
  153. package/stacks/node/templates/root/.env.example +15 -0
  154. package/stacks/node/templates/root/CLAUDE.md +60 -0
  155. package/stacks/node/templates/root/docker-compose.yml +15 -0
  156. package/stacks/node/templates/root/flyway.conf +17 -0
  157. package/stacks/node/templates/root/migrations/V1__schema.sql.example +12 -0
  158. package/stacks/node/templates/root/package.json +50 -0
  159. package/stacks/node/templates/root/server.ts +130 -0
  160. package/stacks/node/templates/root/setup-env.sh +53 -0
  161. package/stacks/node/templates/root/src/common/assertions.ts +6 -0
  162. package/stacks/node/templates/root/src/common/db.ts +32 -0
  163. package/stacks/node/templates/root/src/common/loadPostgresEventstore.ts +23 -0
  164. package/stacks/node/templates/root/src/common/parseEndpoint.ts +51 -0
  165. package/stacks/node/templates/root/src/common/processorDlq.ts +28 -0
  166. package/stacks/node/templates/root/src/common/realtimeBroadcast.ts +12 -0
  167. package/stacks/node/templates/root/src/common/replay.ts +16 -0
  168. package/stacks/node/templates/root/src/common/routes.ts +19 -0
  169. package/stacks/node/templates/root/src/common/testHelpers.ts +44 -0
  170. package/stacks/node/templates/root/src/swagger.ts +34 -0
  171. package/stacks/node/templates/root/src/util/assertions.ts +6 -0
  172. package/stacks/node/templates/root/src/util/hash.ts +9 -0
  173. package/stacks/node/templates/root/src/util/sanitize.ts +23 -0
  174. package/stacks/node/templates/root/tsconfig.json +32 -0
  175. package/stacks/node/templates/root/vercel.json +8 -0
  176. package/stacks/supabase/templates/.claude/skills/build-automation/SKILL.md +266 -0
  177. package/stacks/supabase/templates/.claude/skills/build-state-change/SKILL.md +344 -0
  178. package/stacks/supabase/templates/.claude/skills/build-state-view/SKILL.md +390 -0
  179. package/stacks/supabase/templates/.claude/skills/build-webhook/SKILL.md +303 -0
  180. package/stacks/supabase/templates/.claude/skills/connect/SKILL.md +178 -0
  181. package/stacks/supabase/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +628 -0
  182. package/stacks/supabase/templates/.claude/skills/load-slice/SKILL.md +143 -0
  183. package/stacks/supabase/templates/.claude/skills/update-slice-status/SKILL.md +110 -0
  184. package/stacks/supabase/templates/build-kit/README.md +86 -0
  185. package/stacks/supabase/templates/build-kit/lib/AGENT.md +47 -0
  186. package/stacks/supabase/templates/build-kit/lib/agent.sh +20 -0
  187. package/stacks/supabase/templates/build-kit/lib/backend-prompt.md +152 -0
  188. package/stacks/supabase/templates/build-kit/lib/prompt.md +123 -0
  189. package/stacks/supabase/templates/build-kit/lib/ralph.js +369 -0
  190. package/stacks/supabase/templates/build-kit/ralph-claude.js +44 -0
  191. package/stacks/supabase/templates/build-kit/ralph.sh +98 -0
  192. package/stacks/supabase/templates/root/.env.example +22 -0
  193. package/stacks/supabase/templates/root/CLAUDE.md +61 -0
  194. package/stacks/supabase/templates/root/flyway.conf +17 -0
  195. package/stacks/supabase/templates/root/package.json +52 -0
  196. package/stacks/supabase/templates/root/server.ts +177 -0
  197. package/stacks/supabase/templates/root/setup-env.sh +53 -0
  198. package/stacks/supabase/templates/root/src/common/assertions.ts +6 -0
  199. package/stacks/supabase/templates/root/src/common/db.ts +32 -0
  200. package/stacks/supabase/templates/root/src/common/loadPostgresEventstore.ts +23 -0
  201. package/stacks/supabase/templates/root/src/common/parseEndpoint.ts +51 -0
  202. package/stacks/supabase/templates/root/src/common/processorDlq.ts +28 -0
  203. package/stacks/supabase/templates/root/src/common/realtimeBroadcast.ts +19 -0
  204. package/stacks/supabase/templates/root/src/common/replay.ts +16 -0
  205. package/stacks/supabase/templates/root/src/common/routes.ts +23 -0
  206. package/stacks/supabase/templates/root/src/common/testHelpers.ts +54 -0
  207. package/stacks/supabase/templates/root/src/supabase/README.md +141 -0
  208. package/stacks/supabase/templates/root/src/supabase/api.ts +56 -0
  209. package/stacks/supabase/templates/root/src/supabase/requireOrgaAdmin.ts +32 -0
  210. package/stacks/supabase/templates/root/src/supabase/requireSysUser.ts +40 -0
  211. package/stacks/supabase/templates/root/src/supabase/requireUser.ts +72 -0
  212. package/stacks/supabase/templates/root/src/swagger.ts +34 -0
  213. package/stacks/supabase/templates/root/src/util/assertions.ts +6 -0
  214. package/stacks/supabase/templates/root/src/util/hash.ts +9 -0
  215. package/stacks/supabase/templates/root/src/util/sanitize.ts +23 -0
  216. package/stacks/supabase/templates/root/supabase/config.toml +295 -0
  217. package/stacks/supabase/templates/root/supabase/migrations/V1__schema.sql.example +12 -0
  218. package/stacks/supabase/templates/root/supabase/seed.sql +1 -0
  219. package/stacks/supabase/templates/root/tsconfig.json +32 -0
  220. package/stacks/supabase/templates/root/vercel.json +8 -0
@@ -0,0 +1,674 @@
1
+ ---
2
+ name: eventmodeling-integrating-legacy-systems
3
+ description: "Apply Event Modeling to legacy systems using side-car pattern. Freeze old system, extract events, build new features without rewriting. Use when modernizing legacy applications. Do not use for: greenfield systems without existing legacy constraints (use eventmodeling-orchestrating-event-modeling) or translating inbound events from external APIs (use eventmodeling-translating-external-events)."
4
+ allowed-tools:
5
+ - AskUserQuestion
6
+ - Write
7
+ - Bash
8
+ ---
9
+
10
+ # Integrating Legacy Systems
11
+
12
+ > **Before doing anything else**, invoke the `connect` skill to resolve `TOKEN`, `BOARD_ID`, `ORG_ID`, and `BASE_URL`. Then invoke the `learn-eventmodelers-api` skill to load the full API reference. Do not proceed until both skills have been loaded.
13
+
14
+ ## Interview Phase (Critical - Not Optional)
15
+
16
+ **When to Interview**: This step is high-risk and often initiated prematurely. Always interview unless the user has explicit organizational buy-in for a freeze agreement AND has already assessed legacy system state and extraction feasibility.
17
+
18
+ **Interview Strategy**: Assess organizational readiness, understand legacy system constraints, and validate event extraction feasibility before designing the side-car. Poor planning here leads to costly integration failures.
19
+
20
+ ### Critical Questions
21
+
22
+ Always conduct this interview unless all context is provided:
23
+
24
+ 1. **Legacy System State & Documentation** (Impact: Determines how much reverse-engineering is needed; affects timeline dramatically)
25
+ - Question: "Tell me about the legacy system: (A) Technology stack, (B) Age/last major update, (C) Database size/complexity, (D) Current users/traffic, (E) Known documentation or audit trails?"
26
+ - Why it matters: Undocumented systems require exploration; modern systems may have better audit logs; scaling affects extraction approach
27
+ - Follow-up triggers: If documentation is incomplete → ask for at least data schema; if no audit trail → ask about update_at timestamps; if very large → ask about partitioning strategy
28
+
29
+ 2. **Organizational Freeze Agreement** (Impact: Most critical—determines if side-car is even feasible)
30
+ - Question: "Has business leadership agreed to FREEZE the legacy system? Specifically: (A) No new features in legacy, (B) Only bug fixes permitted, (C) No schema changes?"
31
+ - Why it matters: Without explicit freeze, teams keep modifying legacy → events become stale → side-car becomes incorrect → project fails
32
+ - Follow-up triggers: If not frozen → ask "What would get stakeholder buy-in for freeze?"; if partially frozen → clarify exact boundaries
33
+
34
+ 3. **Event Extraction Feasibility** (Impact: Determines if extraction is reverse-engineer-able or if it requires external data)
35
+ - Question: "For event extraction: (A) Can you query the legacy database directly, (B) Is there an audit log/change tracking, (C) Will you use CDC (Change Data Capture), (D) Can you modify the legacy system for hooks?"
36
+ - Why it matters: Direct query extraction is fastest but may be imperfect; CDC is cleaner but requires infrastructure; modified legacy defeats freeze
37
+ - Follow-up triggers: If (A) → ask about query access and schema understanding; if (B) → ask format of audit log; if (C) → discuss CDC tool selection
38
+
39
+ 4. **Integration Timeline & Staffing** (Impact: Determines realistic phase durations; affects approach choices)
40
+ - Question: "What's your timeline? (A) Need new features within 3 months (aggressive), (B) 6-12 months (standard), (C) 18+ months (gradual). And team capacity: (A) Full team on side-car, (B) Part of team, (C) Skeleton crew?"
41
+ - Why it matters: Aggressive timeline might skip historical extraction, reducing risk surface; team size affects whether extraction and side-car can happen in parallel
42
+ - Follow-up triggers: If aggressive → ask "What's the MVP scope?"; if skeleton crew → ask "Can you backfill?"
43
+
44
+ 5. **Risk Tolerance & Failure Recovery** (Impact: Determines safety margins and validation rigor)
45
+ - Question: "How critical is the system? (A) Revenue-critical/zero downtime tolerance, (B) Important but can tolerate brief outages, (C) Low-risk migration path acceptable?"
46
+ - Why it matters: Affects how much validation you need before user cutover; determines rollback strategy importance
47
+ - Follow-up triggers: If (A) → propose comprehensive testing and gradual rollout; if (C) → can be more aggressive
48
+
49
+ ### Interview Flow
50
+
51
+ **No Conditional Skip**: This interview is critical. Even if some context is provided, confirm all five dimensions.
52
+
53
+ **Phase 1: System Understanding** (Question 1)
54
+ - Document legacy system constraints
55
+ - Assess documentation gaps
56
+ - Plan information gathering
57
+
58
+ **Phase 2: Organizational Alignment** (Question 2) CRITICAL
59
+ - Confirm freeze agreement (required)
60
+ - Document boundaries
61
+ - Identify stakeholders
62
+
63
+ **Phase 3: Technical Feasibility** (Question 3)
64
+ - Validate extraction approach
65
+ - Identify data challenges
66
+ - Plan extraction strategy
67
+
68
+ **Phase 4: Timeline & Staffing** (Questions 4-5)
69
+ - Set realistic phases
70
+ - Identify team structure
71
+ - Plan rollout phases
72
+
73
+ ### Capturing Interview Findings
74
+
75
+ **REQUIRED**: Document findings in detail before proceeding:
76
+
77
+ ```markdown
78
+ ## Interview Findings: Legacy System Integration
79
+
80
+ **System Overview**:
81
+ - Name: [System name]
82
+ - Age: [X years]
83
+ - Tech: [Stack]
84
+ - Scale: [Users/Data size]
85
+ - Documentation: [State]
86
+
87
+ **Freeze Agreement** CRITICAL
88
+ - Status: [Agreed / Pending / Blocked]
89
+ - Boundaries: [What's frozen, what's allowed]
90
+ - Stakeholders signed off: [Yes/No - names if yes]
91
+
92
+ **Event Extraction Approach**:
93
+ - Method: [Direct query / CDC / Audit log / Hooks]
94
+ - Feasibility: [High / Medium / Low]
95
+ - Challenges: [List specific data challenges]
96
+
97
+ **Timeline & Staffing**:
98
+ - Target completion: [Date]
99
+ - Phase 1 duration: [Months]
100
+ - Team capacity: [% allocated to project]
101
+
102
+ **Risk Assessment**:
103
+ - Criticality: [High / Medium / Low]
104
+ - Acceptable downtime: [None / Minutes / Hours]
105
+ - Rollback strategy: [How to recover if side-car fails]
106
+
107
+ **Blockers or Concerns**:
108
+ - [Any showstoppers identified]
109
+ - [Questions for stakeholders]
110
+
111
+ **Green Light Status**:
112
+ - [ ] Freeze agreement obtained (REQUIRED)
113
+ - [ ] Extraction approach validated (REQUIRED)
114
+ - [ ] Team staffing confirmed (REQUIRED)
115
+ - [ ] Risk mitigation plan accepted (REQUIRED)
116
+
117
+ RECOMMENDATION: [Proceed with side-car / Resolve blockers first / Not recommended at this time - explain why]
118
+ ```
119
+
120
+ **CRITICAL**: Write findings to the project's event modeling file:
121
+
122
+ **File**: `.trogonai/interviews/[project-name]/EVENTMODELING.md`
123
+
124
+ Append this section (place it in "Additional Steps" or create new section if legacy integration is primary):
125
+
126
+ ```markdown
127
+ ## Legacy System Integration (eventmodeling-integrating-legacy-systems)
128
+
129
+ ### System Overview
130
+ [From Q1]
131
+ - Name: [System name]
132
+ - Age: [X years]
133
+ - Tech: [Stack]
134
+ - Scale: [Users/Data size]
135
+
136
+ ### Freeze Agreement CRITICAL
137
+ [From Q2]
138
+ - Status: [Agreed / Pending / Blocked]
139
+ - Boundaries: [What's frozen]
140
+ - Stakeholders: [Signed off: Yes/No]
141
+
142
+ ### Event Extraction Approach
143
+ [From Q3]
144
+ - Method: [Direct query / CDC / Audit log / Hooks]
145
+ - Feasibility: [High / Medium / Low]
146
+ - Challenges: [Data challenges]
147
+
148
+ ### Timeline & Staffing
149
+ [From Q4 & Q5]
150
+ - Target: [Date]
151
+ - Criticality: [High / Medium / Low]
152
+ - Rollback Strategy: [How to recover]
153
+
154
+ ### Green Light Checklist
155
+ - [ ] Freeze agreement obtained (REQUIRED)
156
+ - [ ] Extraction approach validated (REQUIRED)
157
+ - [ ] Team staffing confirmed (REQUIRED)
158
+ - [ ] Risk mitigation accepted (REQUIRED)
159
+
160
+ **RECOMMENDATION**: [Proceed / Resolve blockers / Not recommended - why]
161
+ ```
162
+
163
+ Update Interview Trail with integration-specific findings.
164
+
165
+ This section is the risk management document for high-risk integrations.
166
+
167
+ ---
168
+
169
+ ## The Side-Car Pattern
170
+
171
+ Instead of rewriting the legacy system, build new features alongside it:
172
+
173
+ ```text
174
+ Traditional Approach (Risky):
175
+ Legacy System → Rewrite everything from scratch → New System
176
+ Problem: Risk of losing functionality, expensive, long timeline
177
+
178
+ Side-Car Approach (Safe):
179
+
180
+ Legacy System (Frozen - no new changes)
181
+ - Still handles existing features
182
+ - Still processes existing users
183
+ - No modifications, no new bugs
184
+
185
+
186
+ > Database (Event Source)
187
+ Query existing data
188
+ Extract domain events
189
+
190
+ > Event Store (New)
191
+ Captured events
192
+ New event source of truth
193
+
194
+
195
+ Side-Car System (New Event-Modeled Features)
196
+ - New functionality using events
197
+ - New UI/APIs
198
+ - Runs in parallel with legacy
199
+
200
+ Contains:
201
+ Event Store (primary source of truth)
202
+ Commands/Handlers
203
+ Read Models
204
+ User-facing UIs/APIs
205
+
206
+
207
+ Result: Legacy system frozen, new features built safely alongside.
208
+ ```
209
+
210
+ ## Workflow
211
+
212
+ ### 1. Analyze the Legacy System
213
+
214
+ Document what the legacy system does:
215
+
216
+ ```text
217
+ Legacy System: Order Management (10-year-old monolith)
218
+
219
+ Current capabilities:
220
+ Create orders
221
+ Confirm orders
222
+ Track shipments
223
+ Process refunds
224
+ Generate invoices
225
+
226
+ Known issues:
227
+ No audit trail
228
+ Hard to modify order status
229
+ Performance degrades with large datasets
230
+ No clear separation of concerns
231
+ Tightly coupled to specific customer
232
+
233
+ Technology:
234
+ - Database: MySQL (20+ GB)
235
+ - Code: Monolithic Rails application
236
+ - API: XML-based SOAP
237
+ - Users: 500+ directly using legacy UI
238
+
239
+ Cost of rewrite:
240
+ - Effort: 6-12 months
241
+ - Risk: High (functionality gaps)
242
+ - Cost: $500k+
243
+ ```
244
+
245
+ ### 2. Define the Freeze
246
+
247
+ Establish what won't change in the legacy system:
248
+
249
+ ```text
250
+ Freeze Agreement with Business
251
+
252
+ We will NOT change:
253
+ Legacy UI (users continue using it)
254
+ Legacy database schema
255
+ Legacy business logic
256
+ Legacy APIs
257
+
258
+ We WILL do:
259
+ Maintain legacy system (bug fixes, support)
260
+ Extract events from legacy data
261
+ Build new features in side-car
262
+ Gradually migrate users to new features
263
+
264
+ Benefits:
265
+ Zero risk to existing operations
266
+ Can start immediately (no design cycle)
267
+ Old users continue with familiar UI
268
+ New users get modern features
269
+ Can integrate both systems gradually
270
+
271
+ Timeline:
272
+ Year 1: Side-car handles new functionality
273
+ Year 2-3: Gradually migrate users
274
+ Year 3-4: Phase out legacy system
275
+ ```
276
+
277
+ ### 3. Extract Domain Events from Legacy Data
278
+
279
+ The legacy database is your event source:
280
+
281
+ ```text
282
+ Legacy Database Schema:
283
+
284
+ Orders table:
285
+ id, customer_id, status, created_at, updated_at, items_json, total, ...
286
+
287
+ Payments table:
288
+ id, order_id, amount, status, gateway_ref, created_at, ...
289
+
290
+ Shipments table:
291
+ id, order_id, carrier, tracking_num, delivered_at, created_at, ...
292
+
293
+ Event Extraction Strategy:
294
+
295
+ For Orders table:
296
+ When status = 'draft' and record exists
297
+ → Extract: OrderCreated event (created_at, items_json, customer_id, ...)
298
+
299
+ When status = 'confirmed' and previous was 'draft'
300
+ → Extract: OrderConfirmed event
301
+
302
+ When status = 'shipped' and previous was 'confirmed'
303
+ → Extract: OrderShipped event
304
+
305
+ When status = 'cancelled'
306
+ → Extract: OrderCancelled event
307
+
308
+ For Payments table:
309
+ When status = 'authorized'
310
+ → Extract: PaymentAuthorized event (amount, gateway_ref, ...)
311
+
312
+ When status = 'failed'
313
+ → Extract: PaymentFailed event
314
+
315
+ For Shipments table:
316
+ When delivered_at is populated
317
+ → Extract: DeliveryConfirmed event
318
+
319
+ Key insight: Legacy tables contain the data that represents events that happened.
320
+ We reverse-engineer: State changes → Events.
321
+ ```
322
+
323
+ ### 4. Build Event Capture Pipeline
324
+
325
+ Create a process to extract events:
326
+
327
+ ```text
328
+ Option A: One-time Historical Extraction (Catch-up)
329
+
330
+ Script:
331
+ 1. Query legacy Orders: SELECT * WHERE id > last_extracted_id
332
+ 2. For each record, reverse-engineer what events happened
333
+ 3. Create events in new Event Store
334
+ 4. Continue polling for changes
335
+
336
+ Process:
337
+ order_id=123, status=confirmed, updated_at=2024-01-15
338
+ → Determine: OrderCreated happened at created_at
339
+ → Determine: OrderConfirmed happened at updated_at
340
+ → Persist: { OrderCreated, OrderConfirmed } to Event Store
341
+
342
+ --- Option B: Real-time Sync (Ongoing)
343
+
344
+ Trigger on legacy writes:
345
+ 1. When legacy system creates/updates record
346
+ 2. Database trigger OR Change Data Capture (CDC)
347
+ 3. Event generated and sent to new system
348
+ 4. Both systems stay in sync
349
+
350
+ Benefits:
351
+ - Zero delay between legacy action and event capture
352
+ - Can serve new features in real-time
353
+ - Cleaner integration
354
+
355
+ --- Option C: Hybrid (Start with historical, add real-time)
356
+
357
+ Year 1:
358
+ - Historical extract existing 10 years of orders
359
+ - New events captured in real-time
360
+
361
+ Advantage: Smooth onboarding, future-proof
362
+ ```
363
+
364
+ ### 5. Build the Side-Car System
365
+
366
+ Create new Event-Modeled system alongside legacy:
367
+
368
+ ```text
369
+ New Side-Car System Architecture:
370
+
371
+
372
+ Event Store (Source of Truth for new features)
373
+ - OrderCreated
374
+ - OrderConfirmed
375
+ - PaymentAuthorized
376
+ - OrderShipped
377
+ - DeliveryConfirmed
378
+ - CustomerCreated (new feature)
379
+ - ReturnRequested (new feature)
380
+
381
+
382
+ > Handlers (Process events)
383
+ PaymentProcessor
384
+ InventoryProcessor
385
+ NotificationProcessor
386
+
387
+ > Read Models (Projections)
388
+ OrderStatusView
389
+ CustomerDashboard (new!)
390
+ ReturnStatusView (new!)
391
+
392
+ > APIs & UIs (New user-facing)
393
+ REST API
394
+ GraphQL endpoint
395
+ New web UI
396
+ Mobile app
397
+ ```
398
+
399
+ ### 6. Handle Y-Valve User Traffic
400
+
401
+ Gradually redirect users from legacy to new:
402
+
403
+ ```text
404
+ Phase 1: New features only in side-car
405
+ User action → Legacy system handles
406
+
407
+ Phase 2: Read model shown alongside legacy
408
+ User views → Legacy UI + New dashboards
409
+
410
+ Phase 3: New features accessible, legacy still available
411
+ User can: Use legacy OR new features
412
+ Gradual migration as users opt-in
413
+
414
+ Phase 4: Deprecation period
415
+ New features required
416
+ Legacy features deprecated
417
+ Legacy system in read-only mode
418
+
419
+ --- Y-Valve Pattern (Traffic Routing):
420
+
421
+ User Request
422
+
423
+ Is this a NEW feature? → Route to Side-Car system
424
+
425
+ Is user opted-in to new UI? → Route to Side-Car system
426
+
427
+ Default → Route to Legacy system
428
+
429
+ Example code:
430
+ if (isNewFeature(request)) {
431
+ return sideCarSystem.handle(request);
432
+ } else if (user.preferNewUI) {
433
+ return sideCarSystem.handle(request);
434
+ } else {
435
+ return legacySystem.handle(request);
436
+ }
437
+ ```
438
+
439
+ ### 7. Develop New Features in Side-Car
440
+
441
+ Use Event Modeling for new functionality:
442
+
443
+ ```text
444
+ New Feature: Order Returns & Refunds
445
+
446
+ Legacy system has: Nothing (returns handled via email/phone)
447
+ New side-car feature: Self-service return management
448
+
449
+ Event Model for Returns:
450
+ Commands:
451
+ - RequestReturn (from customer)
452
+ - ApproveReturn (from support agent)
453
+ - ProcessRefund (from payment system)
454
+
455
+ Events:
456
+ - ReturnRequested
457
+ - ReturnApproved
458
+ - RefundInitiated
459
+ - RefundCompleted
460
+
461
+ Views:
462
+ - ReturnStatusView (by order)
463
+ - ReturnQueueView (pending approvals)
464
+ - RefundHistoryView (completed refunds)
465
+
466
+ Benefits:
467
+ Built with modern Event Modeling patterns
468
+ Clear contracts
469
+ Easy to test
470
+ Scalable architecture
471
+ No need to modify legacy code
472
+ ```
473
+
474
+ ## Output Format
475
+
476
+ Present as:
477
+
478
+ ```markdown
479
+ # Legacy System Integration: [Organization Name]
480
+
481
+ ## Current Legacy System
482
+
483
+ **System Name**: [Name]
484
+ **Age**: [Years]
485
+ **Technology**: [Tech stack]
486
+ **Users**: [Count]
487
+ **Database Size**: [Size]
488
+
489
+ **Current Capabilities**:
490
+ - [Feature 1]
491
+ - [Feature 2]
492
+
493
+ **Known Issues**:
494
+ - [Issue 1]
495
+ - [Issue 2]
496
+
497
+ **Rewrite Impact**:
498
+ - Effort: [Months/Years]
499
+ - Risk: [Low/Medium/High]
500
+ - Cost: [Estimate]
501
+
502
+ ---
503
+
504
+ ## The Freeze Agreement
505
+
506
+ **What we won't change**:
507
+ - [Legacy UI]
508
+ - [Legacy database]
509
+ - [Legacy APIs]
510
+
511
+ **What we will do**:
512
+ - [Maintain legacy]
513
+ - [Extract events]
514
+ - [Build new features]
515
+
516
+ **Timeline**:
517
+ - [Phase 1]
518
+ - [Phase 2]
519
+ - [Phase 3]
520
+
521
+ ---
522
+
523
+ ## Event Extraction Strategy
524
+
525
+ ### Source: [Legacy Table/System]
526
+
527
+ **Data available**:
528
+ - [Field 1]
529
+ - [Field 2]
530
+
531
+ **Events extracted**:
532
+ - [Event 1] when [condition]
533
+ - [Event 2] when [condition]
534
+
535
+ **Extraction logic**:
536
+ [Reverse-engineering approach]
537
+
538
+ ---
539
+
540
+ ## Side-Car System Architecture
541
+
542
+ ### Events Captured from Legacy
543
+ - OrderCreated
544
+ - OrderConfirmed
545
+ - [Other events...]
546
+
547
+ ### Events Generated by Side-Car
548
+ - CustomerCreated (new feature)
549
+ - ReviewSubmitted (new feature)
550
+ - [Other new events...]
551
+
552
+ ### New Features Built
553
+ - [Feature 1]: Commands → Handlers → Events → Views
554
+ - [Feature 2]: Commands → Handlers → Events → Views
555
+
556
+ ---
557
+
558
+ ## User Migration Plan
559
+
560
+ ### Phase 1: Read-Only Views
561
+ **Timeline**: [Duration]
562
+ **Users**: [Gradual rollout]
563
+ **Change**: New dashboards available alongside legacy
564
+
565
+ ### Phase 2: New Features
566
+ **Timeline**: [Duration]
567
+ **Users**: [% of user base]
568
+ **Change**: New functionality accessible, legacy still primary
569
+
570
+ ### Phase 3: Preference Switch
571
+ **Timeline**: [Duration]
572
+ **Users**: [Opt-in]
573
+ **Change**: Users choose new UI
574
+
575
+ ### Phase 4: Deprecation
576
+ **Timeline**: [Duration]
577
+ **Change**: Legacy system read-only
578
+
579
+ ---
580
+
581
+ ## Risks & Mitigations
582
+
583
+ | Risk | Mitigation |
584
+ |------|-----------|
585
+ | Data inconsistency | Event capture validation |
586
+ | User confusion | Gradual rollout, clear messaging |
587
+ | Operational overhead | Automated monitoring, alerts |
588
+ | Performance | Side-car scales independently |
589
+
590
+ ```
591
+
592
+ ## Quality Checklist
593
+
594
+ - [ ] Legacy system freeze agreement documented
595
+ - [ ] Freeze agreement signed by business stakeholders
596
+ - [ ] Event extraction strategy defined for all legacy data
597
+ - [ ] All legacy tables mapped to extractable events
598
+ - [ ] Event capture pipeline designed
599
+ - [ ] Side-car system architecture defined
600
+ - [ ] New features scoped clearly
601
+ - [ ] User migration plan documented
602
+ - [ ] Y-valve routing logic designed
603
+ - [ ] Parallel operation testing plan
604
+ - [ ] Deprecation timeline agreed
605
+ - [ ] Rollback plan in place
606
+
607
+ ## Common Integration Patterns
608
+
609
+ ### Pattern 1: Read Models from Legacy
610
+ ```text
611
+ Legacy Database → Query → Extract state → Create Read Model for side-car
612
+ Benefit: New UI shows unified data (legacy + new)
613
+ ```
614
+
615
+ ### Pattern 2: Event Stream from Audit Logs
616
+ ```text
617
+ Legacy audit log (if available) → Parse → Extract events → Event Store
618
+ Benefit: Complete history, less guesswork
619
+ ```
620
+
621
+ ### Pattern 3: Scheduled Sync
622
+ ```text
623
+ Every N minutes → Query legacy changes → Generate events → Event Store
624
+ Benefit: Simple to implement, eventual consistency
625
+ ```
626
+
627
+ ### Pattern 4: Mirror-Write via Integration Boundary (Use with Caution)
628
+ ```text
629
+ Default: Avoid dual-write. Keep side-car-only and sync via legacy events.
630
+
631
+ Exception: Dual-write is allowed only with an approved freeze exception.
632
+
633
+ Required controls when dual-write is approved:
634
+ - Route all writes through a controlled integration boundary (not direct DB access)
635
+ - Make every write idempotent (safe to replay on retry or failure)
636
+ - Add a reconciliation check and a documented rollback plan
637
+ - Document the owner, the sunset date, and the freeze exception approval
638
+
639
+ Without these controls: keep side-car-only.
640
+ ```
641
+
642
+ ## Key Principles
643
+
644
+ 1. **Freeze First**: Establish clear freeze agreement before starting
645
+ 2. **No Rewrites**: Side-car builds NEW features, doesn't duplicate legacy
646
+ 3. **Gradual Migration**: Don't force everyone at once
647
+ 4. **Dual Operation**: Both systems run in parallel indefinitely (your timeline)
648
+ 5. **Clear Ownership**: Legacy team maintains legacy, side-car team owns new
649
+ 6. **Event-Driven**: Use events as integration point
650
+ 7. **User Choice**: Where possible, let users choose when to migrate
651
+
652
+ ## When Side-Car Is Right
653
+
654
+ **Use side-car when**:
655
+ - Legacy system works but is hard to modify
656
+ - Business needs new features quickly
657
+ - Rewrite would take 6+ months
658
+ - High risk of rewrite failure
659
+ - Users are comfortable with both systems
660
+ - Clear separation of old vs. new features
661
+
662
+ **Don't use side-car when**:
663
+ - Legacy system is broken and needs fixes
664
+ - Complete integration required (tight coupling)
665
+ - Users only want one unified system
666
+ - Legacy holds critical IP that can't be replicated
667
+
668
+ ## Anti-Patterns to Avoid
669
+
670
+ **Hybrid approach**: Trying to modify legacy AND build side-car (confusion)
671
+ **Forced unification**: Requiring all users to switch at once (disruption)
672
+ **Incomplete event extraction**: Missing important legacy data in events
673
+ **Tight coupling**: Side-car depends on legacy database directly (defeats purpose)
674
+ **No clear separation**: Users don't know which system they're using (confusion)