@llm-dev-ops/agentics-cli 1.4.4 → 1.4.7

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 (167) hide show
  1. package/dist/adapters/base-adapter.d.ts +117 -0
  2. package/dist/adapters/base-adapter.d.ts.map +1 -1
  3. package/dist/adapters/base-adapter.js +143 -0
  4. package/dist/adapters/base-adapter.js.map +1 -1
  5. package/dist/agents/cli-ux-agent.d.ts.map +1 -1
  6. package/dist/agents/cli-ux-agent.js +2 -1
  7. package/dist/agents/cli-ux-agent.js.map +1 -1
  8. package/dist/auth/identity-resolver.d.ts +21 -0
  9. package/dist/auth/identity-resolver.d.ts.map +1 -0
  10. package/dist/auth/identity-resolver.js +68 -0
  11. package/dist/auth/identity-resolver.js.map +1 -0
  12. package/dist/auth/index.d.ts +2 -0
  13. package/dist/auth/index.d.ts.map +1 -1
  14. package/dist/auth/index.js +2 -0
  15. package/dist/auth/index.js.map +1 -1
  16. package/dist/auth/role-permissions.d.ts +12 -0
  17. package/dist/auth/role-permissions.d.ts.map +1 -0
  18. package/dist/auth/role-permissions.js +43 -0
  19. package/dist/auth/role-permissions.js.map +1 -0
  20. package/dist/cli/index.js +162 -157
  21. package/dist/cli/index.js.map +1 -1
  22. package/dist/commands/deploy.d.ts +4 -4
  23. package/dist/commands/deploy.d.ts.map +1 -1
  24. package/dist/commands/deploy.js +83 -21
  25. package/dist/commands/deploy.js.map +1 -1
  26. package/dist/commands/erp.d.ts +1 -1
  27. package/dist/commands/erp.d.ts.map +1 -1
  28. package/dist/commands/erp.js +65 -5
  29. package/dist/commands/erp.js.map +1 -1
  30. package/dist/commands/export.d.ts +5 -5
  31. package/dist/commands/export.js +5 -5
  32. package/dist/commands/inspect.d.ts +28 -0
  33. package/dist/commands/inspect.d.ts.map +1 -1
  34. package/dist/commands/inspect.js +113 -0
  35. package/dist/commands/inspect.js.map +1 -1
  36. package/dist/commands/login.d.ts +8 -6
  37. package/dist/commands/login.d.ts.map +1 -1
  38. package/dist/commands/login.js +171 -89
  39. package/dist/commands/login.js.map +1 -1
  40. package/dist/commands/logout.d.ts.map +1 -1
  41. package/dist/commands/logout.js +4 -1
  42. package/dist/commands/logout.js.map +1 -1
  43. package/dist/commands/plan.d.ts +8 -5
  44. package/dist/commands/plan.d.ts.map +1 -1
  45. package/dist/commands/plan.js +88 -63
  46. package/dist/commands/plan.js.map +1 -1
  47. package/dist/commands/policy.d.ts +53 -0
  48. package/dist/commands/policy.d.ts.map +1 -1
  49. package/dist/commands/policy.js +201 -5
  50. package/dist/commands/policy.js.map +1 -1
  51. package/dist/commands/quantify.d.ts +1 -1
  52. package/dist/commands/quantify.d.ts.map +1 -1
  53. package/dist/commands/quantify.js +2 -4
  54. package/dist/commands/quantify.js.map +1 -1
  55. package/dist/commands/simulate.d.ts +3 -2
  56. package/dist/commands/simulate.d.ts.map +1 -1
  57. package/dist/commands/simulate.js +154 -37
  58. package/dist/commands/simulate.js.map +1 -1
  59. package/dist/commands/usage.d.ts +3 -3
  60. package/dist/commands/usage.js +7 -7
  61. package/dist/commands/usage.js.map +1 -1
  62. package/dist/commands/whoami.d.ts +6 -0
  63. package/dist/commands/whoami.d.ts.map +1 -1
  64. package/dist/commands/whoami.js +44 -7
  65. package/dist/commands/whoami.js.map +1 -1
  66. package/dist/contracts/adr-002-operational-enforcement.d.ts +684 -0
  67. package/dist/contracts/adr-002-operational-enforcement.d.ts.map +1 -0
  68. package/dist/contracts/adr-002-operational-enforcement.js +671 -0
  69. package/dist/contracts/adr-002-operational-enforcement.js.map +1 -0
  70. package/dist/contracts/adr-003-governance-architecture.d.ts +766 -0
  71. package/dist/contracts/adr-003-governance-architecture.d.ts.map +1 -0
  72. package/dist/contracts/adr-003-governance-architecture.js +773 -0
  73. package/dist/contracts/adr-003-governance-architecture.js.map +1 -0
  74. package/dist/contracts/adr-004-enterprise-integration-memory.d.ts +1150 -0
  75. package/dist/contracts/adr-004-enterprise-integration-memory.d.ts.map +1 -0
  76. package/dist/contracts/adr-004-enterprise-integration-memory.js +1158 -0
  77. package/dist/contracts/adr-004-enterprise-integration-memory.js.map +1 -0
  78. package/dist/contracts/adr-005-system-coherence-drift-self-governance.d.ts +1393 -0
  79. package/dist/contracts/adr-005-system-coherence-drift-self-governance.d.ts.map +1 -0
  80. package/dist/contracts/adr-005-system-coherence-drift-self-governance.js +1371 -0
  81. package/dist/contracts/adr-005-system-coherence-drift-self-governance.js.map +1 -0
  82. package/dist/contracts/adr-command-semantics.d.ts +150 -0
  83. package/dist/contracts/adr-command-semantics.d.ts.map +1 -0
  84. package/dist/contracts/adr-command-semantics.js +984 -0
  85. package/dist/contracts/adr-command-semantics.js.map +1 -0
  86. package/dist/contracts/index.d.ts +5 -0
  87. package/dist/contracts/index.d.ts.map +1 -1
  88. package/dist/contracts/index.js +16 -0
  89. package/dist/contracts/index.js.map +1 -1
  90. package/dist/enterprise/index.d.ts +16 -0
  91. package/dist/enterprise/index.d.ts.map +1 -0
  92. package/dist/enterprise/index.js +17 -0
  93. package/dist/enterprise/index.js.map +1 -0
  94. package/dist/enterprise/integration-registry.d.ts +73 -0
  95. package/dist/enterprise/integration-registry.d.ts.map +1 -0
  96. package/dist/enterprise/integration-registry.js +252 -0
  97. package/dist/enterprise/integration-registry.js.map +1 -0
  98. package/dist/enterprise/lineage.d.ts +73 -0
  99. package/dist/enterprise/lineage.d.ts.map +1 -0
  100. package/dist/enterprise/lineage.js +218 -0
  101. package/dist/enterprise/lineage.js.map +1 -0
  102. package/dist/gates/argument-guard.d.ts +39 -0
  103. package/dist/gates/argument-guard.d.ts.map +1 -0
  104. package/dist/gates/argument-guard.js +180 -0
  105. package/dist/gates/argument-guard.js.map +1 -0
  106. package/dist/gates/auth-session-gate.d.ts +47 -0
  107. package/dist/gates/auth-session-gate.d.ts.map +1 -0
  108. package/dist/gates/auth-session-gate.js +151 -0
  109. package/dist/gates/auth-session-gate.js.map +1 -0
  110. package/dist/gates/execution-gate.d.ts +12 -17
  111. package/dist/gates/execution-gate.d.ts.map +1 -1
  112. package/dist/gates/execution-gate.js +74 -46
  113. package/dist/gates/execution-gate.js.map +1 -1
  114. package/dist/gates/index.d.ts +25 -2
  115. package/dist/gates/index.d.ts.map +1 -1
  116. package/dist/gates/index.js +31 -2
  117. package/dist/gates/index.js.map +1 -1
  118. package/dist/gates/lineage-gate.d.ts +55 -0
  119. package/dist/gates/lineage-gate.d.ts.map +1 -0
  120. package/dist/gates/lineage-gate.js +127 -0
  121. package/dist/gates/lineage-gate.js.map +1 -0
  122. package/dist/gates/output-format-gate.d.ts +54 -0
  123. package/dist/gates/output-format-gate.d.ts.map +1 -0
  124. package/dist/gates/output-format-gate.js +136 -0
  125. package/dist/gates/output-format-gate.js.map +1 -0
  126. package/dist/gates/service-health-gate.d.ts +56 -0
  127. package/dist/gates/service-health-gate.d.ts.map +1 -0
  128. package/dist/gates/service-health-gate.js +179 -0
  129. package/dist/gates/service-health-gate.js.map +1 -0
  130. package/dist/modules/help-renderer.d.ts +25 -0
  131. package/dist/modules/help-renderer.d.ts.map +1 -0
  132. package/dist/modules/help-renderer.js +163 -0
  133. package/dist/modules/help-renderer.js.map +1 -0
  134. package/dist/modules/index.d.ts +1 -0
  135. package/dist/modules/index.d.ts.map +1 -1
  136. package/dist/modules/index.js +1 -0
  137. package/dist/modules/index.js.map +1 -1
  138. package/dist/server/index.d.ts +2 -0
  139. package/dist/server/index.d.ts.map +1 -1
  140. package/dist/server/index.js +16 -1
  141. package/dist/server/index.js.map +1 -1
  142. package/dist/server/routes/auth.d.ts.map +1 -1
  143. package/dist/server/routes/auth.js +45 -8
  144. package/dist/server/routes/auth.js.map +1 -1
  145. package/dist/server/routes/identity.d.ts +9 -0
  146. package/dist/server/routes/identity.d.ts.map +1 -0
  147. package/dist/server/routes/identity.js +100 -0
  148. package/dist/server/routes/identity.js.map +1 -0
  149. package/dist/server/routes/index.d.ts +2 -0
  150. package/dist/server/routes/index.d.ts.map +1 -1
  151. package/dist/server/routes/index.js +2 -0
  152. package/dist/server/routes/index.js.map +1 -1
  153. package/dist/server/routes/lineage.d.ts +15 -0
  154. package/dist/server/routes/lineage.d.ts.map +1 -0
  155. package/dist/server/routes/lineage.js +128 -0
  156. package/dist/server/routes/lineage.js.map +1 -0
  157. package/dist/types/index.d.ts +134 -0
  158. package/dist/types/index.d.ts.map +1 -1
  159. package/dist/utils/identity-store.d.ts +31 -0
  160. package/dist/utils/identity-store.d.ts.map +1 -0
  161. package/dist/utils/identity-store.js +97 -0
  162. package/dist/utils/identity-store.js.map +1 -0
  163. package/dist/utils/index.d.ts +2 -0
  164. package/dist/utils/index.d.ts.map +1 -1
  165. package/dist/utils/index.js +1 -0
  166. package/dist/utils/index.js.map +1 -1
  167. package/package.json +4 -4
@@ -0,0 +1,1158 @@
1
+ /**
2
+ * ADR-004: Enterprise Integration & Memory Architecture
3
+ *
4
+ * STATUS: Accepted
5
+ * DATE: 2026-01-28
6
+ * AUTHORS: Platform Engineering
7
+ * SUPERSEDES: None
8
+ * DEPENDS ON: ADR-003 (conceptual anchor), ADR-001 (command semantics)
9
+ * REFERENCED BY: Future implementation ADRs for Ruvector, Integrations, ERP Surface
10
+ *
11
+ * ============================================================================
12
+ * POSITIONING STATEMENT
13
+ * ============================================================================
14
+ *
15
+ * Enterprise integrations and ERP mappings in Agentics are outcomes of
16
+ * governed simulations, not ad-hoc automation.
17
+ *
18
+ * Every integration proposal, every ERP mapping, and every enterprise
19
+ * artifact in the Agentics platform originates from a simulation that
20
+ * was initiated through the governed CLI control plane, persisted into
21
+ * Ruvector as the authoritative memory layer, and surfaced as a
22
+ * proposed implementation — never as a live mutation.
23
+ *
24
+ * This ADR defines the conceptual architecture that governs how the
25
+ * Agentics CLI interacts with three enterprise-scale subsystems:
26
+ *
27
+ * - Ruvector (memory, persistence, lineage, replay)
28
+ * - The Integrations repository (approximately 75 enterprise systems)
29
+ * - The ERP Surface repository (enterprise-wide modeling abstraction)
30
+ *
31
+ * It establishes domain boundaries, ownership rules, and invariants
32
+ * that ensure enterprise simulations, proposed implementations, and
33
+ * integration artifacts remain coherent, traceable, and governable
34
+ * across the entire platform.
35
+ *
36
+ * This ADR introduces no new commands, schemas, middleware, tables,
37
+ * queries, or implementation details. It is a conceptual framing
38
+ * document that future implementation ADRs must reference and respect.
39
+ *
40
+ * ============================================================================
41
+ * CONTEXT
42
+ * ============================================================================
43
+ *
44
+ * The Agentics platform now includes:
45
+ *
46
+ * - A governed CLI control plane (ADR-003, Domain 1) with a 5-gate
47
+ * pipeline that enforces governance before any side effects occur.
48
+ *
49
+ * - Explicit synthesis vs execution boundaries (ADR-003, Domain 3)
50
+ * that control when LLM-powered generation may be invoked.
51
+ *
52
+ * - A command semantics model (ADR-001) that declares every command's
53
+ * argument contract, synthesis classification, and behavioral
54
+ * constraints.
55
+ *
56
+ * - Operational enforcement (ADR-002) that mechanically validates
57
+ * governance rules at runtime and in CI.
58
+ *
59
+ * What is missing is a DDD-level conceptual framing for the enterprise
60
+ * integration layer — the subsystems that exist downstream of CLI
61
+ * command execution and upstream of real-world enterprise effects.
62
+ *
63
+ * Without this framing:
64
+ *
65
+ * - Integrations risk becoming ad-hoc scripts rather than governed
66
+ * enterprise capabilities. A contributor might add a new integration
67
+ * that bypasses simulation entirely, producing artifacts with no
68
+ * lineage and no traceability.
69
+ *
70
+ * - Memory usage becomes inconsistent. Some commands might persist
71
+ * into Ruvector while others use local files or in-memory state.
72
+ * Without a clear rule, the platform loses its audit substrate.
73
+ *
74
+ * - ERP Surface evolution decouples from simulations. If ERP mappings
75
+ * can be created outside of the simulation lifecycle, they become
76
+ * untraceable assertions about enterprise state rather than
77
+ * derivable consequences of governed decisions.
78
+ *
79
+ * - Integration proposals and simulation artifacts exist in
80
+ * separate domains with no conceptual bridge. A reviewer cannot
81
+ * answer: "Where did this integration proposal come from?" without
82
+ * reading implementation code.
83
+ *
84
+ * - The distinction between "proposed" and "live" blurs. Without
85
+ * a clear conceptual boundary, future contributors may introduce
86
+ * integration flows that mutate enterprise state during what
87
+ * should be a simulation-only phase.
88
+ *
89
+ * This ADR fills that gap by defining the enterprise integration and
90
+ * memory domains, their relationships, and the invariants that bind
91
+ * them to the governed CLI control plane.
92
+ *
93
+ * ============================================================================
94
+ * DECISION
95
+ * ============================================================================
96
+ *
97
+ * The enterprise integration and memory architecture is organized into
98
+ * five bounded contexts (domains), each with clear responsibilities,
99
+ * ownership rules, and invariants. These domains exist downstream of
100
+ * the CLI Control Plane defined in ADR-003 and are subject to all
101
+ * governance rules established in ADRs 001-003.
102
+ *
103
+ * The five domains are:
104
+ *
105
+ * 1. Enterprise Simulation Domain
106
+ * 2. Memory & Lineage Domain (Ruvector)
107
+ * 3. Integration Domain
108
+ * 4. ERP Surface Domain
109
+ * 5. CLI as Orchestrator (Conceptual Role)
110
+ *
111
+ * ============================================================================
112
+ * DOMAIN 1: ENTERPRISE SIMULATION
113
+ * ============================================================================
114
+ *
115
+ * DEFINITION:
116
+ *
117
+ * The Enterprise Simulation domain defines what constitutes an
118
+ * enterprise simulation within the Agentics platform and what
119
+ * artifacts a simulation produces. A simulation is the fundamental
120
+ * unit of enterprise reasoning — a bounded, governed process that
121
+ * transforms natural language intent into structured enterprise
122
+ * decisions.
123
+ *
124
+ * WHAT CONSTITUTES AN ENTERPRISE SIMULATION:
125
+ *
126
+ * An enterprise simulation is a governed process that:
127
+ *
128
+ * - Originates from a CLI command classified as SYNTHESIS_REQUIRED
129
+ * (simulate create, plan create, quantify create)
130
+ *
131
+ * - Receives natural language input that seeds synthesis (per
132
+ * ADR-001, the argument type is NATURAL_LANGUAGE, not ID)
133
+ *
134
+ * - Produces structured artifacts that describe what WOULD happen
135
+ * in an enterprise context, without performing real-world
136
+ * state changes
137
+ *
138
+ * - Is assigned a stable identifier upon creation, through which
139
+ * all downstream artifacts are traceable
140
+ *
141
+ * A simulation is NOT:
142
+ *
143
+ * - A live execution against real enterprise systems
144
+ * - An ad-hoc query or exploratory conversation
145
+ * - A standalone report disconnected from a decision context
146
+ * - A batch job or background process without CLI initiation
147
+ *
148
+ * ARTIFACTS PRODUCED BY SIMULATIONS:
149
+ *
150
+ * An enterprise simulation produces one or more of the following
151
+ * artifact categories. All artifacts are inert proposals — they
152
+ * describe intent, not action.
153
+ *
154
+ * Plans:
155
+ * Structured descriptions of enterprise migration, deployment,
156
+ * or transformation strategies. Plans describe what will change,
157
+ * in what order, with what dependencies, and at what risk.
158
+ *
159
+ * Risk Assessments:
160
+ * Structured evaluations of what could go wrong. Risk assessments
161
+ * enumerate failure modes, estimate probabilities, and propose
162
+ * mitigations. They are derived from the simulation context.
163
+ *
164
+ * Cost Projections:
165
+ * Structured estimates of financial impact. Cost projections
166
+ * cover infrastructure, licensing, labor, and transition costs.
167
+ * They are derived from the simulation context.
168
+ *
169
+ * Integration Mappings:
170
+ * Structured descriptions of which enterprise systems are
171
+ * affected, what data flows change, and what integration
172
+ * points must be modified. These are proposals, not
173
+ * configurations.
174
+ *
175
+ * ERP Proposals:
176
+ * Structured descriptions of how ERP-surface entities
177
+ * (processes, data models, workflows) would be affected
178
+ * by the simulated change. These are downstream of the
179
+ * simulation, not inputs to it.
180
+ *
181
+ * WHY SIMULATIONS MUST BE TRACEABLE:
182
+ *
183
+ * Every artifact produced by the platform must trace back to the
184
+ * simulation that created it. This traceability is not optional
185
+ * because:
186
+ *
187
+ * - Audit: Enterprise decisions must be traceable to their origin.
188
+ * A deployment that cannot be traced to a simulation, plan, and
189
+ * approval is an ungoverned deployment.
190
+ *
191
+ * - Replay: Simulations must be replayable for comparison, review,
192
+ * and what-if analysis. Without traceability, replay is
193
+ * impossible because the original context is lost.
194
+ *
195
+ * - Accountability: Every enterprise artifact must have an author
196
+ * (via the identity system defined in the CLI), a timestamp,
197
+ * and a decision context. Traceability provides all three.
198
+ *
199
+ * - Coherence: Integration proposals and ERP mappings that exist
200
+ * without a simulation parent are orphaned artifacts. They
201
+ * cannot be validated because there is no context against
202
+ * which to validate them.
203
+ *
204
+ * ============================================================================
205
+ * DOMAIN 2: MEMORY & LINEAGE (RUVECTOR)
206
+ * ============================================================================
207
+ *
208
+ * DEFINITION:
209
+ *
210
+ * The Memory & Lineage domain defines Ruvector's conceptual role
211
+ * within the Agentics platform. Ruvector is the system of record
212
+ * for all enterprise memory — the authoritative persistence layer
213
+ * through which simulations, decisions, artifacts, and lineage
214
+ * relationships are stored, queried, and replayed.
215
+ *
216
+ * RUVECTOR'S CONCEPTUAL ROLE:
217
+ *
218
+ * System of Record:
219
+ *
220
+ * Ruvector is the single authoritative store for all enterprise
221
+ * simulation artifacts. When a simulation produces a plan, risk
222
+ * assessment, cost projection, or integration mapping, that
223
+ * artifact is persisted into Ruvector. No other storage system
224
+ * (local files, environment variables, in-memory caches, external
225
+ * databases) is authoritative.
226
+ *
227
+ * This does not mean Ruvector is the only storage. Transient
228
+ * caches, local identity stores, and session state may exist
229
+ * for performance or convenience. But when there is a conflict
230
+ * between a cached value and Ruvector's record, Ruvector wins.
231
+ *
232
+ * Lineage Store:
233
+ *
234
+ * Ruvector maintains the parent-child relationships between
235
+ * artifacts. Every plan traces to a simulation. Every integration
236
+ * proposal traces to a plan. Every ERP mapping traces to a
237
+ * simulation. These relationships are first-class data in
238
+ * Ruvector, not inferred from timestamps or naming conventions.
239
+ *
240
+ * Lineage enables:
241
+ * - Forward tracing: "What artifacts did this simulation produce?"
242
+ * - Backward tracing: "What simulation created this proposal?"
243
+ * - Impact analysis: "What would change if this simulation
244
+ * were re-run with different parameters?"
245
+ *
246
+ * Replay and Audit Substrate:
247
+ *
248
+ * Ruvector stores sufficient context to replay any simulation.
249
+ * Replay means re-executing the simulation's synthesis phase
250
+ * with the same inputs and comparing the outputs. This enables:
251
+ *
252
+ * - Drift detection: "Has the synthesis engine's behavior
253
+ * changed since this simulation was created?"
254
+ * - Comparison: "How do two simulations of the same scenario
255
+ * differ?"
256
+ * - Audit: "Reconstruct the decision trail that led to this
257
+ * deployment."
258
+ *
259
+ * Replay does not mean re-execution of state-mutating actions.
260
+ * Replay is always a read-only operation against Ruvector's
261
+ * stored context.
262
+ *
263
+ * WHAT MUST BE PERSISTED:
264
+ *
265
+ * The following categories of data must always be persisted into
266
+ * Ruvector as part of the simulation lifecycle:
267
+ *
268
+ * - Simulation metadata: identifier, creator (user_id, org_id),
269
+ * timestamp, input parameters, synthesis classification
270
+ *
271
+ * - Simulation artifacts: all plans, risk assessments, cost
272
+ * projections, integration mappings, and ERP proposals generated
273
+ * by the simulation
274
+ *
275
+ * - Lineage relationships: parent simulation for every artifact,
276
+ * derivation chain for compound artifacts
277
+ *
278
+ * - Decision context: the natural language input that seeded
279
+ * synthesis, the governance rules that were applied, the
280
+ * identity of the requester
281
+ *
282
+ * - Lifecycle transitions: when a plan was approved, when a
283
+ * deployment was initiated, when a rollback occurred —
284
+ * each transition is an immutable event
285
+ *
286
+ * WHAT MUST NOT BE PERSISTED IN RUVECTOR:
287
+ *
288
+ * - API keys, credentials, or authentication tokens
289
+ * - Live enterprise system state (Ruvector stores proposals,
290
+ * not the current state of SAP, Salesforce, or other systems)
291
+ * - Transient UI state or session preferences
292
+ * - Raw LLM inference responses (only structured artifacts
293
+ * derived from synthesis are persisted)
294
+ * - Debugging logs or developer-specific traces
295
+ *
296
+ * ============================================================================
297
+ * DOMAIN 3: INTEGRATION DOMAIN
298
+ * ============================================================================
299
+ *
300
+ * DEFINITION:
301
+ *
302
+ * The Integration domain defines the conceptual role of the
303
+ * Integrations repository (approximately 75 enterprise systems)
304
+ * within the Agentics platform. Integrations represent enterprise
305
+ * capabilities — they describe what an enterprise system can do,
306
+ * what data it manages, and how it participates in enterprise
307
+ * workflows.
308
+ *
309
+ * INTEGRATIONS ARE CAPABILITIES, NOT SCRIPTS:
310
+ *
311
+ * Each integration in the repository represents a named enterprise
312
+ * system (e.g., SAP, Salesforce, Workday, ServiceNow, Jira,
313
+ * NetSuite) and defines:
314
+ *
315
+ * - What the system is responsible for in an enterprise context
316
+ * - What data entities the system owns or participates in
317
+ * - What integration points exist (APIs, events, data feeds)
318
+ * - What constraints the system imposes (rate limits, data
319
+ * formats, authentication requirements)
320
+ *
321
+ * An integration is NOT:
322
+ *
323
+ * - A connector or adapter that makes live API calls
324
+ * - A script that automates data movement
325
+ * - A runtime dependency that must be available for the CLI
326
+ * to function
327
+ * - A configuration file that is deployed to an enterprise system
328
+ *
329
+ * Integrations are declarative descriptions of enterprise
330
+ * capabilities. They inform simulations about what is possible
331
+ * and what constraints apply. They do not perform actions.
332
+ *
333
+ * HOW INTEGRATIONS PARTICIPATE IN SIMULATIONS:
334
+ *
335
+ * During a simulation, the synthesis engine consults integration
336
+ * definitions to understand:
337
+ *
338
+ * - Which enterprise systems are relevant to the simulated scenario
339
+ * - What data flows would be affected by the proposed change
340
+ * - What constraints would apply to a proposed implementation
341
+ * - What integration points would need to be modified
342
+ *
343
+ * The integration definitions provide the enterprise context that
344
+ * makes simulations realistic and actionable. Without them,
345
+ * simulations would produce generic recommendations disconnected
346
+ * from the organization's actual technology landscape.
347
+ *
348
+ * Critically, integrations participate in simulations WITHOUT
349
+ * being executed. The synthesis engine reads integration definitions
350
+ * as reference material. It does not invoke integration APIs,
351
+ * query integration data sources, or trigger integration workflows.
352
+ * Integrations are consulted, not activated, during simulation.
353
+ *
354
+ * INTEGRATION PROPOSALS:
355
+ *
356
+ * When a simulation determines that an enterprise system would be
357
+ * affected by a proposed change, it generates an integration
358
+ * proposal. An integration proposal describes:
359
+ *
360
+ * - Which integration is affected
361
+ * - What changes would be required
362
+ * - What risks the change introduces
363
+ * - What dependencies exist between this change and others
364
+ *
365
+ * Integration proposals are simulation artifacts. They are persisted
366
+ * into Ruvector with full lineage tracing back to the parent
367
+ * simulation. They are never created outside of the simulation
368
+ * lifecycle.
369
+ *
370
+ * ============================================================================
371
+ * DOMAIN 4: ERP SURFACE DOMAIN
372
+ * ============================================================================
373
+ *
374
+ * DEFINITION:
375
+ *
376
+ * The ERP Surface domain defines the conceptual role of the ERP
377
+ * Surface repository within the Agentics platform. ERP Surface is
378
+ * an abstraction layer that models enterprise-wide processes, data
379
+ * structures, and workflows at a level above individual enterprise
380
+ * systems.
381
+ *
382
+ * ERP SURFACE IS AN ABSTRACTION, NOT AN ERP REPLACEMENT:
383
+ *
384
+ * ERP Surface does not replicate, replace, or proxy any real ERP
385
+ * system. It is a modeling abstraction that provides:
386
+ *
387
+ * - A unified vocabulary for enterprise processes that span
388
+ * multiple systems (e.g., "order-to-cash" spans CRM, ERP,
389
+ * billing, and logistics systems)
390
+ *
391
+ * - A structural model of how enterprise entities relate to
392
+ * each other across system boundaries
393
+ *
394
+ * - A surface onto which simulation-derived proposals can be
395
+ * mapped, visualized, and reviewed
396
+ *
397
+ * ERP Surface is the enterprise's conceptual map. It does not
398
+ * contain live data, does not maintain connections to real
399
+ * systems, and does not execute business logic.
400
+ *
401
+ * HOW ERP SURFACE RECEIVES PROPOSED IMPLEMENTATIONS:
402
+ *
403
+ * ERP Surface is a downstream consumer of simulation artifacts.
404
+ * The flow is:
405
+ *
406
+ * 1. A simulation produces enterprise-level decisions
407
+ * 2. Those decisions reference integration capabilities
408
+ * 3. Integration proposals describe system-level changes
409
+ * 4. ERP Surface receives structured proposed implementations
410
+ * that map those changes onto the enterprise-wide model
411
+ *
412
+ * ERP Surface never initiates a simulation. It never requests
413
+ * changes. It never drives the decision process. It receives
414
+ * proposals and presents them in the context of the enterprise
415
+ * model.
416
+ *
417
+ * WHY ERP SURFACE IS DOWNSTREAM, NOT A DRIVER:
418
+ *
419
+ * If ERP Surface drove simulations, it would become the de facto
420
+ * requirements system — the place where enterprise intent
421
+ * originates. This would create several problems:
422
+ *
423
+ * - The CLI's role as the governed entry point (ADR-003, Domain 1)
424
+ * would be undermined. Enterprise intent must enter through the
425
+ * CLI's 5-gate pipeline, not through ERP Surface.
426
+ *
427
+ * - Governance rules would need to be duplicated into ERP Surface.
428
+ * Every synthesis boundary, argument contract, and phase
429
+ * transition would need a parallel implementation in the ERP
430
+ * layer. This violates ADR-003, Invariant 6 (governance
431
+ * centralization).
432
+ *
433
+ * - Traceability would break. If proposals originate from ERP
434
+ * Surface rather than from simulations, there is no simulation
435
+ * parent to trace back to. The artifact lineage chain is severed.
436
+ *
437
+ * ERP Surface is a projection surface. It reflects the outcomes
438
+ * of governed simulations onto the enterprise model. It does not
439
+ * generate those outcomes.
440
+ *
441
+ * ERP SURFACE REFLECTS PROPOSED STATE, NOT LIVE MUTATION:
442
+ *
443
+ * ERP Surface never contains live enterprise state. It contains:
444
+ *
445
+ * - The enterprise model (structural abstraction of processes
446
+ * and data entities)
447
+ *
448
+ * - Proposed implementations mapped onto that model (derived
449
+ * from simulations, persisted in Ruvector)
450
+ *
451
+ * - Impact assessments showing how proposals would affect the
452
+ * enterprise model
453
+ *
454
+ * When a proposal is approved and executed (transitioning through
455
+ * ADR-003's Phase 2: Execution), the real-world changes happen
456
+ * outside of ERP Surface. ERP Surface is updated to reflect the
457
+ * new proposed state only when a new simulation produces new
458
+ * proposals.
459
+ *
460
+ * ============================================================================
461
+ * DOMAIN 5: CLI AS ORCHESTRATOR (CONCEPTUAL ROLE)
462
+ * ============================================================================
463
+ *
464
+ * DEFINITION:
465
+ *
466
+ * The CLI as Orchestrator domain defines the conceptual relationship
467
+ * between the CLI control plane (ADR-003, Domain 1) and the
468
+ * enterprise integration domains defined in this ADR. It clarifies
469
+ * what the CLI is and what it is not in the context of enterprise
470
+ * integration.
471
+ *
472
+ * CLI AS INITIATOR AND COORDINATOR:
473
+ *
474
+ * The CLI is the sole entry point for all enterprise simulation
475
+ * and integration workflows. Every simulation begins with a CLI
476
+ * command. Every artifact is created because a CLI command was
477
+ * executed. Every lifecycle transition (plan → approve → deploy →
478
+ * rollback) is initiated through the CLI.
479
+ *
480
+ * The CLI coordinates the flow between domains:
481
+ *
482
+ * - It accepts user intent and routes it to the simulation domain
483
+ * - It ensures simulation artifacts are persisted into Ruvector
484
+ * - It ensures integration proposals are derived from simulations
485
+ * - It ensures ERP Surface updates originate from simulation artifacts
486
+ *
487
+ * Coordination means sequencing and routing. The CLI ensures that
488
+ * the right domain receives the right data at the right time.
489
+ *
490
+ * CLI AS NOT THE OWNER OF BUSINESS LOGIC:
491
+ *
492
+ * The CLI does not contain enterprise business logic. It does not
493
+ * know what a "good" migration plan looks like, how to assess
494
+ * integration risk, or how ERP processes relate to each other.
495
+ *
496
+ * Business logic resides in:
497
+ *
498
+ * - The synthesis engine (which generates artifacts from natural
499
+ * language input using LLM-powered reasoning)
500
+ *
501
+ * - The integration definitions (which describe enterprise system
502
+ * capabilities and constraints)
503
+ *
504
+ * - The ERP Surface model (which defines enterprise-wide process
505
+ * structures and entity relationships)
506
+ *
507
+ * The CLI's role is to ensure that business logic is invoked in a
508
+ * governed, traceable, and auditable manner — not to implement or
509
+ * second-guess that logic.
510
+ *
511
+ * CLI AS BOUNDARY ENFORCER:
512
+ *
513
+ * The CLI enforces the boundaries between domains. Specifically:
514
+ *
515
+ * - It prevents integration proposals from being created outside
516
+ * of the simulation lifecycle (by requiring simulation IDs as
517
+ * inputs to integration-related commands)
518
+ *
519
+ * - It prevents ERP Surface mutations that do not originate from
520
+ * simulations (by requiring simulation-derived artifacts as
521
+ * inputs to ERP-related commands)
522
+ *
523
+ * - It prevents Ruvector from being used as a general-purpose
524
+ * database (by restricting what can be persisted to defined
525
+ * artifact categories)
526
+ *
527
+ * - It prevents simulations from being created without governance
528
+ * (by enforcing the 5-gate pipeline before any synthesis occurs)
529
+ *
530
+ * Boundary enforcement is the CLI's primary value in the
531
+ * enterprise integration architecture. Without it, the domains
532
+ * would collapse into an unstructured flow of data between
533
+ * subsystems.
534
+ *
535
+ * ============================================================================
536
+ * INVARIANTS (NON-NEGOTIABLE)
537
+ * ============================================================================
538
+ *
539
+ * The following are system-level truths that all implementations
540
+ * must preserve. These invariants extend — and do not replace —
541
+ * the invariants defined in ADR-003.
542
+ *
543
+ * INVARIANT 1: Every enterprise simulation has a memory footprint.
544
+ *
545
+ * When a simulation is created through the CLI, it must be
546
+ * persisted into Ruvector before any artifacts are generated.
547
+ * A simulation that exists only in memory, in a local file, or
548
+ * in a transient cache is not a simulation — it is an untracked
549
+ * computation. Untracked computations have no lineage, no audit
550
+ * trail, and no replay capability.
551
+ *
552
+ * INVARIANT 2: Every proposed integration or ERP mapping is derived
553
+ * from a simulation.
554
+ *
555
+ * Integration proposals and ERP mappings do not appear
556
+ * spontaneously. They are artifacts of a simulation that was
557
+ * initiated through the governed CLI. If a proposal exists, it
558
+ * must have a simulation parent. If a mapping exists, it must
559
+ * trace to a simulation that produced it.
560
+ *
561
+ * INVARIANT 3: No integration proposal exists without traceability.
562
+ *
563
+ * Every integration proposal must be traceable to:
564
+ *
565
+ * - A simulation: the process that generated it
566
+ * - A plan: the structured decision that includes it
567
+ * - A decision context: the natural language input, governance
568
+ * rules, and identity that authorized its creation
569
+ *
570
+ * An integration proposal without this traceability chain is an
571
+ * orphaned artifact. Orphaned artifacts must not exist in the
572
+ * platform because they cannot be audited, reviewed, or
573
+ * attributed.
574
+ *
575
+ * INVARIANT 4: Ruvector is the only authoritative memory layer.
576
+ *
577
+ * No other storage system — local files, environment variables,
578
+ * in-memory caches, external databases, or third-party services —
579
+ * is authoritative for enterprise simulation data. Transient
580
+ * caches may exist for performance. Local stores may exist for
581
+ * identity (as defined in the credential and identity stores).
582
+ * But when the question is "What did this simulation produce?",
583
+ * the answer comes from Ruvector and nowhere else.
584
+ *
585
+ * INVARIANT 5: Integrations are described and proposed, not executed,
586
+ * during simulation.
587
+ *
588
+ * During the simulation phase (ADR-003, Phase 1: Planning),
589
+ * integrations are reference material. The synthesis engine reads
590
+ * integration definitions to understand enterprise capabilities.
591
+ * It does not call integration APIs, query integration data
592
+ * sources, or trigger integration workflows. Simulation is a
593
+ * read-only process with respect to enterprise systems.
594
+ *
595
+ * INVARIANT 6: ERP Surface reflects proposed state, not live mutation.
596
+ *
597
+ * ERP Surface never contains the current state of real enterprise
598
+ * systems. It contains a structural model of the enterprise and
599
+ * the proposed changes derived from simulations. When users
600
+ * inspect ERP Surface, they see what WOULD change, not what HAS
601
+ * changed. Live mutation happens outside of ERP Surface, in the
602
+ * execution phase (ADR-003, Phase 2: Execution), which is
603
+ * governed by COMMITMENT_GRADE commands requiring explicit
604
+ * confirmation.
605
+ *
606
+ * INVARIANT 7: The CLI is the only path through which simulation
607
+ * artifacts enter the platform.
608
+ *
609
+ * No backend service, no cron job, no external webhook, and no
610
+ * direct Ruvector insertion may create simulation artifacts
611
+ * outside of the CLI's governed pipeline. This ensures that every
612
+ * artifact passes through the 5-gate pipeline (ADR-002), is
613
+ * subject to governance rules (ADR-001), and carries identity
614
+ * attribution (user_id, org_id).
615
+ *
616
+ * ============================================================================
617
+ * CONCEPTUAL INTERACTION MODEL
618
+ * ============================================================================
619
+ *
620
+ * The following describes, in prose, how the five domains interact
621
+ * during the lifecycle of an enterprise simulation. This is a
622
+ * conceptual description, not an implementation specification.
623
+ *
624
+ * PHASE 1: SIMULATION INITIATION
625
+ *
626
+ * An enterprise simulation begins when a user issues a CLI command
627
+ * that is classified as SYNTHESIS_REQUIRED (e.g., simulate create,
628
+ * plan create). The CLI's 5-gate pipeline validates the command,
629
+ * verifies the user's identity, and confirms that the argument is
630
+ * natural language (not an ID). The validated command is dispatched
631
+ * to the simulation domain.
632
+ *
633
+ * The simulation domain creates a simulation record in Ruvector.
634
+ * This record includes the simulation identifier, the creator's
635
+ * identity (user_id, org_id), the natural language input, and the
636
+ * governance context (which gate pipeline version was applied,
637
+ * which synthesis classification was used). From this moment, the
638
+ * simulation has a memory footprint — Invariant 1 is satisfied.
639
+ *
640
+ * PHASE 2: ENTERPRISE DECISION GENERATION
641
+ *
642
+ * The synthesis engine processes the simulation's input in the
643
+ * context of the organization's integration landscape. It consults
644
+ * integration definitions from the Integrations repository to
645
+ * understand which enterprise systems are relevant, what
646
+ * capabilities they provide, and what constraints they impose.
647
+ *
648
+ * The synthesis engine produces structured artifacts: plans, risk
649
+ * assessments, cost projections, and integration mappings. Each
650
+ * artifact is associated with the parent simulation and is
651
+ * persisted into Ruvector with full lineage metadata. Integration
652
+ * proposals are derived from the simulation's analysis of which
653
+ * systems would be affected — Invariant 2 is satisfied.
654
+ *
655
+ * At no point during this phase does the synthesis engine call
656
+ * real enterprise system APIs or modify real enterprise data.
657
+ * Integrations are consulted as reference material, not invoked
658
+ * as services — Invariant 5 is satisfied.
659
+ *
660
+ * PHASE 3: PERSISTENCE AND LINEAGE
661
+ *
662
+ * All artifacts generated by the simulation are persisted into
663
+ * Ruvector with explicit lineage relationships. Each integration
664
+ * proposal records its parent simulation, the integration it
665
+ * references, and the plan it belongs to. Each ERP mapping records
666
+ * the simulation that derived it and the integration proposals
667
+ * it depends on.
668
+ *
669
+ * Ruvector now contains sufficient context to answer any lineage
670
+ * question: "What simulation created this proposal?", "What
671
+ * integrations are affected by this plan?", "What would change
672
+ * if we re-ran this simulation?" — Invariant 3 and Invariant 4
673
+ * are satisfied.
674
+ *
675
+ * PHASE 4: ERP SURFACE PROJECTION
676
+ *
677
+ * Simulation-derived proposals are projected onto the ERP Surface
678
+ * model. The ERP Surface receives structured proposed
679
+ * implementations that describe how enterprise-wide processes
680
+ * would be affected by the simulated change.
681
+ *
682
+ * The ERP Surface does not initiate this projection. It receives
683
+ * it from the simulation lifecycle, mediated by the CLI. The
684
+ * proposed implementations are mapped onto the enterprise model,
685
+ * making them reviewable in the context of the organization's
686
+ * full process landscape — Invariant 6 is satisfied.
687
+ *
688
+ * PHASE 5: AUDIT AND REPLAY
689
+ *
690
+ * At any point, the platform can reconstruct the complete
691
+ * decision trail for any artifact. Starting from a deployed
692
+ * integration change, a reviewer can trace backward through
693
+ * the deployment, the approved plan, the simulation that generated
694
+ * it, and the natural language input that seeded the synthesis.
695
+ *
696
+ * Replay is possible because Ruvector stores the simulation's
697
+ * original context. Re-running the synthesis with the same inputs
698
+ * produces comparable outputs, enabling drift detection and
699
+ * comparison analysis.
700
+ *
701
+ * All of this is possible because every artifact entered through
702
+ * the CLI's governed pipeline — Invariant 7 is satisfied.
703
+ *
704
+ * ============================================================================
705
+ * RELATIONSHIP TO EXISTING ADRS
706
+ * ============================================================================
707
+ *
708
+ * ADR-004 extends the governance hierarchy established by ADR-003:
709
+ *
710
+ * ADR-003 → defines the CLI control plane conceptual model
711
+ * ↓
712
+ * ADR-004 → defines the enterprise integration conceptual model
713
+ * ↓
714
+ * ADR-001 → instantiates both models (command registry + types)
715
+ * ↓
716
+ * ADR-002 → enforces both models (gates + CI + regression tests)
717
+ *
718
+ * ADR-004 does NOT modify, replace, or conflict with any existing
719
+ * ADR. It extends the conceptual architecture into the enterprise
720
+ * integration space, which was not covered by ADR-003.
721
+ *
722
+ * Specifically:
723
+ *
724
+ * - ADR-003's five CLI domains (Control Plane, Command Semantics,
725
+ * Synthesis Governance, Execution & State Mutation, Governance
726
+ * Source of Truth) remain unchanged. ADR-004's five enterprise
727
+ * domains are complementary and downstream.
728
+ *
729
+ * - ADR-003's execution phases (Planning → Execution → Commitment →
730
+ * Rollback) govern the lifecycle of ADR-004's simulation
731
+ * artifacts. ADR-004 does not introduce new lifecycle phases.
732
+ *
733
+ * - ADR-001's command registry defines the CLI commands that
734
+ * initiate simulations, produce integration proposals, and
735
+ * interact with ERP Surface. ADR-004 does not introduce new
736
+ * commands; it defines the conceptual domains those commands
737
+ * operate within.
738
+ *
739
+ * - ADR-002's gate pipeline ensures that all simulation-initiating
740
+ * commands pass governance validation. ADR-004 relies on this
741
+ * enforcement and does not duplicate it.
742
+ *
743
+ * - ADR-003's invariants (1-7) remain in force. ADR-004's
744
+ * invariants (1-7) extend the system's invariant set into the
745
+ * enterprise integration space. There is no conflict because
746
+ * ADR-003 governs CLI behavior while ADR-004 governs enterprise
747
+ * integration behavior.
748
+ *
749
+ * No existing ADR needs to be edited as a result of ADR-004.
750
+ *
751
+ * ============================================================================
752
+ * CONSEQUENCES
753
+ * ============================================================================
754
+ *
755
+ * POSITIVE:
756
+ *
757
+ * - Integration contributors understand where proposals belong.
758
+ * Every integration proposal must trace to a simulation. The
759
+ * Integrations repository defines capabilities; it does not
760
+ * generate proposals independently.
761
+ *
762
+ * - ERP Surface evolution remains simulation-driven. ERP Surface
763
+ * receives proposed implementations from simulations; it does
764
+ * not originate or approve changes independently.
765
+ *
766
+ * - Ruvector is clearly positioned as the memory authority. All
767
+ * enterprise simulation data flows through Ruvector. Other
768
+ * storage systems are explicitly non-authoritative.
769
+ *
770
+ * - The distinction between "proposed" and "live" is
771
+ * architecturally enforced. Simulation artifacts are proposals.
772
+ * Real-world changes require COMMITMENT_GRADE commands with
773
+ * explicit confirmation, governed by ADR-003's phase model.
774
+ *
775
+ * - New contributors can read this ADR and understand the
776
+ * enterprise integration architecture without reading
777
+ * implementation code.
778
+ *
779
+ * - The document reads as enterprise architecture — appropriate
780
+ * for stakeholder review, compliance documentation, and
781
+ * onboarding material.
782
+ *
783
+ * NEGATIVE:
784
+ *
785
+ * - This document adds a second conceptual layer (in addition to
786
+ * ADR-003) that must be maintained. If the enterprise integration
787
+ * model changes, ADR-004 must be updated before implementation
788
+ * ADRs.
789
+ *
790
+ * - Contributors must understand four ADRs (003, 004, 001, 002)
791
+ * to fully comprehend the platform's governance model. However,
792
+ * ADR-003 and ADR-004 are complementary conceptual documents
793
+ * that frame different aspects of the architecture, reducing
794
+ * the cognitive burden compared to a single monolithic document.
795
+ *
796
+ * - The strict invariants (particularly Invariant 7, requiring
797
+ * CLI-initiated artifact creation) may constrain future
798
+ * integration patterns such as event-driven or webhook-based
799
+ * artifact creation. This is intentional — governance requires
800
+ * a controlled entry point.
801
+ *
802
+ * ============================================================================
803
+ * EXPLICIT NON-GOALS
804
+ * ============================================================================
805
+ *
806
+ * 1. This ADR does NOT introduce new CLI commands or modify
807
+ * existing command semantics. Command definitions belong in
808
+ * ADR-001.
809
+ *
810
+ * 2. This ADR does NOT define schemas, data models, or field
811
+ * definitions for Ruvector, Integrations, or ERP Surface.
812
+ * Those belong in implementation-level ADRs.
813
+ *
814
+ * 3. This ADR does NOT specify Ruvector tables, queries, indices,
815
+ * or storage formats. Ruvector's internal architecture is an
816
+ * implementation concern.
817
+ *
818
+ * 4. This ADR does NOT contain pseudocode, code, or
819
+ * implementation flows. It describes what IS, not how it WORKS.
820
+ *
821
+ * 5. This ADR does NOT define middleware interfaces, API
822
+ * endpoints, or wire protocols. Those belong in implementation
823
+ * ADRs.
824
+ *
825
+ * 6. This ADR does NOT redefine CLI semantics, governance rules,
826
+ * or enforcement mechanisms covered in ADRs 001-003.
827
+ *
828
+ * 7. This ADR does NOT describe the internal architecture of any
829
+ * individual integration. Integration internals are the
830
+ * concern of the Integrations repository.
831
+ *
832
+ * 8. This ADR does NOT describe ERP Surface's internal data model
833
+ * or rendering logic. ERP Surface internals are the concern
834
+ * of the ERP Surface repository.
835
+ *
836
+ * ============================================================================
837
+ * CONCEPTUAL ARCHITECTURE (TEXT DIAGRAM)
838
+ * ============================================================================
839
+ *
840
+ * The following describes the directional relationships between
841
+ * domains. Arrows indicate "produces," "persists into," or
842
+ * "projects onto."
843
+ *
844
+ * ┌─────────────────────────────────────────────────────────────┐
845
+ * │ CLI CONTROL PLANE (ADR-003, Domain 1) │
846
+ * │ │
847
+ * │ The governed entry point. All enterprise simulation │
848
+ * │ workflows begin here. 5-gate pipeline enforces │
849
+ * │ governance before any synthesis or persistence occurs. │
850
+ * │ │
851
+ * │ Identity attribution (user_id, org_id) is attached │
852
+ * │ to every command invocation. │
853
+ * └────────────────────────┬────────────────────────────────────┘
854
+ * │ initiates
855
+ * ▼
856
+ * ┌─────────────────────────────────────────────────────────────┐
857
+ * │ ENTERPRISE SIMULATION DOMAIN (ADR-004, Domain 1) │
858
+ * │ │
859
+ * │ Transforms natural language intent into structured │
860
+ * │ enterprise decisions: plans, risks, costs, mappings. │
861
+ * │ │
862
+ * │ Consults integration definitions as reference material. │
863
+ * │ Produces artifacts that are proposals, not actions. │
864
+ * └───────┬────────────────────┬────────────────────┬──────────┘
865
+ * │ persists │ references │ produces
866
+ * ▼ ▼ ▼
867
+ * ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
868
+ * │ MEMORY & LINEAGE │ │ INTEGRATION │ │ ERP SURFACE │
869
+ * │ (Ruvector) │ │ DOMAIN │ │ DOMAIN │
870
+ * │ ADR-004 Domain 2 │ │ ADR-004 Domain 3 │ │ ADR-004 Domain 4 │
871
+ * │ │ │ │ │ │
872
+ * │ System of record │ │ ~75 enterprise │ │ Enterprise-wide │
873
+ * │ Lineage store │ │ capabilities │ │ process model │
874
+ * │ Replay substrate │ │ (declarative) │ │ (abstraction) │
875
+ * │ Audit authority │ │ │ │ │
876
+ * │ │ │ Consulted during │ │ Receives │
877
+ * │ ALL artifacts │ │ simulation, NOT │ │ proposed state │
878
+ * │ persisted here │ │ executed │ │ from simulations │
879
+ * └──────────────────┘ └──────────────────┘ └──────────────────┘
880
+ *
881
+ * ┌─────────────────────────────────────────────────────────────┐
882
+ * │ CLI AS ORCHESTRATOR (ADR-004, Domain 5) │
883
+ * │ │
884
+ * │ Initiates simulations │ Does NOT own business logic │
885
+ * │ Coordinates domain flow │ Does NOT contain enterprise │
886
+ * │ Enforces boundaries │ knowledge or rules │
887
+ * │ Ensures traceability │ Does NOT bypass governance │
888
+ * └─────────────────────────────────────────────────────────────┘
889
+ *
890
+ * DIRECTIONAL RESPONSIBILITIES:
891
+ *
892
+ * CLI Control Plane → Enterprise Simulation:
893
+ * The CLI initiates simulations via governed commands.
894
+ *
895
+ * Enterprise Simulation → Ruvector:
896
+ * Simulations persist all artifacts and lineage into Ruvector.
897
+ *
898
+ * Enterprise Simulation → Integration Domain:
899
+ * Simulations consult integration definitions as read-only
900
+ * reference material during artifact generation.
901
+ *
902
+ * Enterprise Simulation → ERP Surface:
903
+ * Simulations produce proposed implementations that are
904
+ * projected onto the ERP Surface model.
905
+ *
906
+ * Ruvector → (all domains):
907
+ * Ruvector is the authoritative source for artifact retrieval,
908
+ * lineage queries, and replay operations.
909
+ *
910
+ * Integration Domain → Enterprise Simulation:
911
+ * Integration definitions inform simulation context. The
912
+ * relationship is informational, not transactional.
913
+ *
914
+ * ERP Surface → (none):
915
+ * ERP Surface is a terminal consumer. It receives proposed
916
+ * implementations and presents them. It does not produce
917
+ * artifacts or initiate workflows.
918
+ *
919
+ * ============================================================================
920
+ * ANTI-PATTERNS (WHAT FUTURE CONTRIBUTORS MUST NOT DO)
921
+ * ============================================================================
922
+ *
923
+ * ANTI-PATTERN 1: AD-HOC INTEGRATION CREATION
924
+ *
925
+ * What it looks like:
926
+ * A contributor adds a new integration that generates proposals
927
+ * directly, without going through the simulation lifecycle.
928
+ * The integration has its own "create proposal" function that
929
+ * writes to Ruvector independently of any simulation.
930
+ *
931
+ * Why it's wrong:
932
+ * Integration proposals without a simulation parent are orphaned
933
+ * artifacts. They cannot be audited because there is no decision
934
+ * context. They cannot be replayed because there is no original
935
+ * input. They cannot be attributed because no governed CLI
936
+ * command initiated them. This violates Invariants 2, 3, and 7.
937
+ *
938
+ * What to do instead:
939
+ * Integrations define capabilities. Simulations generate
940
+ * proposals. The simulation lifecycle is the only path through
941
+ * which integration proposals enter the platform.
942
+ *
943
+ * ANTI-PATTERN 2: DIRECT RUVECTOR INSERTION
944
+ *
945
+ * What it looks like:
946
+ * A backend service, a cron job, or a migration script writes
947
+ * simulation artifacts directly into Ruvector, bypassing the
948
+ * CLI's governed pipeline.
949
+ *
950
+ * Why it's wrong:
951
+ * Artifacts inserted without governance have no gate validation,
952
+ * no identity attribution, no synthesis classification, and no
953
+ * lineage chain. They are indistinguishable from corrupted data.
954
+ * This violates Invariants 4 and 7.
955
+ *
956
+ * What to do instead:
957
+ * All artifact creation flows through the CLI. If a bulk
958
+ * operation is needed, it is implemented as a CLI command that
959
+ * iterates through the governed pipeline for each artifact.
960
+ *
961
+ * ANTI-PATTERN 3: ERP SURFACE AS REQUIREMENTS SOURCE
962
+ *
963
+ * What it looks like:
964
+ * A contributor adds a feature where ERP Surface generates
965
+ * simulation requests — "the ERP model detected a gap, so it
966
+ * triggers a simulation to fill it."
967
+ *
968
+ * Why it's wrong:
969
+ * ERP Surface is a downstream projection surface, not an
970
+ * upstream requirements system. If ERP Surface initiates
971
+ * simulations, it becomes an ungoverned entry point — a
972
+ * backdoor that bypasses the CLI's 5-gate pipeline. This
973
+ * violates ADR-003's Invariant 3 (no state mutation without
974
+ * governance) and ADR-004's Invariant 7 (CLI is the only path).
975
+ *
976
+ * What to do instead:
977
+ * ERP Surface presents the current proposed state. If a gap
978
+ * exists, a user reviews it and initiates a simulation through
979
+ * the CLI. The human decision to simulate is the governance
980
+ * checkpoint.
981
+ *
982
+ * ANTI-PATTERN 4: INTEGRATION EXECUTION DURING SIMULATION
983
+ *
984
+ * What it looks like:
985
+ * A simulation "validates" its proposals by making live API
986
+ * calls to enterprise systems — "let's check if the SAP endpoint
987
+ * is actually available before we propose changes to it."
988
+ *
989
+ * Why it's wrong:
990
+ * Simulation is a planning phase (ADR-003, Phase 1). During
991
+ * planning, no real-world state changes should occur, and no
992
+ * live system dependencies should exist. Making API calls during
993
+ * simulation means: (a) simulations fail when systems are
994
+ * unavailable, (b) simulations may trigger unintended side
995
+ * effects in enterprise systems, (c) simulation results are
996
+ * non-deterministic because they depend on live system state.
997
+ * This violates Invariant 5.
998
+ *
999
+ * What to do instead:
1000
+ * Integration definitions describe enterprise capabilities
1001
+ * declaratively. Simulations consult these definitions, not live
1002
+ * systems. If validation against live systems is needed, it is
1003
+ * a separate COMMITMENT_GRADE command (e.g., deploy preview)
1004
+ * that occurs after simulation, not during it.
1005
+ *
1006
+ * ANTI-PATTERN 5: MEMORY FRAGMENTATION
1007
+ *
1008
+ * What it looks like:
1009
+ * Different commands persist artifacts into different stores.
1010
+ * Plan artifacts go to Ruvector, but simulation artifacts go to
1011
+ * a local SQLite database. Cost projections are stored in a JSON
1012
+ * file. Integration mappings are cached in Redis.
1013
+ *
1014
+ * Why it's wrong:
1015
+ * When memory is fragmented across stores, lineage queries
1016
+ * become impossible. "What simulation produced this plan?" requires
1017
+ * querying multiple systems with no guaranteed consistency.
1018
+ * Replay requires assembling context from disparate sources.
1019
+ * Audit requires checking every store for every artifact type.
1020
+ * This violates Invariant 4.
1021
+ *
1022
+ * What to do instead:
1023
+ * Ruvector is the single system of record. All enterprise
1024
+ * simulation artifacts are persisted into Ruvector. Transient
1025
+ * caches may exist for performance, but they are never
1026
+ * authoritative and are always derivable from Ruvector's records.
1027
+ *
1028
+ * ANTI-PATTERN 6: INTEGRATION DRIFT
1029
+ *
1030
+ * What it looks like:
1031
+ * The Integrations repository evolves independently of the
1032
+ * simulation lifecycle. New integration definitions are added
1033
+ * without considering how they participate in simulations.
1034
+ * Integration capabilities are described in formats that the
1035
+ * synthesis engine cannot consume. Integration definitions
1036
+ * contain implementation details (API endpoints, credentials)
1037
+ * rather than capability descriptions.
1038
+ *
1039
+ * Why it's wrong:
1040
+ * Integrations exist to inform simulations. If integration
1041
+ * definitions are not consumable by the synthesis engine, they
1042
+ * do not participate in simulations, and simulation results
1043
+ * are incomplete. If integration definitions contain
1044
+ * implementation details, they blur the boundary between
1045
+ * "what can this system do?" and "how do we connect to it?"
1046
+ * — a boundary that must remain clear.
1047
+ *
1048
+ * What to do instead:
1049
+ * Integration definitions describe capabilities: what the
1050
+ * system does, what data it manages, what constraints it
1051
+ * imposes. They do not describe how to connect, authenticate,
1052
+ * or invoke the system. Connection details belong in deployment
1053
+ * and execution configurations, not in capability descriptions.
1054
+ *
1055
+ * ANTI-PATTERN 7: ORPHANED ERP MAPPINGS
1056
+ *
1057
+ * What it looks like:
1058
+ * An ERP mapping exists in the platform without a traceable
1059
+ * path to a simulation. The mapping was created manually, or
1060
+ * imported from an external tool, or generated by a script
1061
+ * that did not use the CLI's governed pipeline.
1062
+ *
1063
+ * Why it's wrong:
1064
+ * Orphaned ERP mappings cannot be audited, replayed, or
1065
+ * attributed. They represent assertions about enterprise state
1066
+ * that have no decision context. A reviewer cannot determine
1067
+ * why the mapping exists, who authorized it, or what simulation
1068
+ * justified it. This violates Invariants 2 and 3.
1069
+ *
1070
+ * What to do instead:
1071
+ * All ERP mappings are derived from simulations. If a mapping
1072
+ * needs to be created, a user runs a simulation through the CLI.
1073
+ * The simulation produces the mapping as an artifact with full
1074
+ * lineage. There is no "import" path that bypasses simulation.
1075
+ *
1076
+ * ============================================================================
1077
+ * SUCCESS CRITERIA
1078
+ * ============================================================================
1079
+ *
1080
+ * This ADR is successful if:
1081
+ *
1082
+ * 1. Integration contributors understand where proposals belong.
1083
+ * A new contributor reading this document knows that integration
1084
+ * proposals are simulation artifacts, not standalone creations.
1085
+ *
1086
+ * 2. ERP Surface evolution remains simulation-driven. No future
1087
+ * implementation allows ERP Surface to initiate simulations or
1088
+ * generate proposals independently.
1089
+ *
1090
+ * 3. Ruvector is clearly positioned as the memory authority. No
1091
+ * future implementation introduces a competing authoritative
1092
+ * store for enterprise simulation data.
1093
+ *
1094
+ * 4. No existing ADR needs modification. ADR-004 complements
1095
+ * ADRs 001-003 without contradicting or duplicating them.
1096
+ *
1097
+ * 5. The document reads like enterprise architecture, not tooling
1098
+ * notes. It is appropriate for stakeholder review, compliance
1099
+ * documentation, and onboarding material.
1100
+ *
1101
+ * 6. The anti-patterns section prevents the most common integration
1102
+ * drift scenarios, keeping the platform coherent as it scales
1103
+ * to 75+ integrations.
1104
+ *
1105
+ * 7. The invariants are referenced by future implementation ADRs.
1106
+ * When a contributor builds a new integration feature, they
1107
+ * cite "ADR-004, Invariant N" to justify their architectural
1108
+ * choices.
1109
+ *
1110
+ * ============================================================================
1111
+ * ALTERNATIVES CONSIDERED
1112
+ * ============================================================================
1113
+ *
1114
+ * A. Embed integration architecture into ADR-003:
1115
+ * Rejected — ADR-003 defines the CLI control plane domains.
1116
+ * Enterprise integration is downstream of the control plane.
1117
+ * Combining them would produce a monolithic document that
1118
+ * conflates governance boundaries.
1119
+ *
1120
+ * B. Define separate ADRs for Ruvector, Integrations, and ERP Surface:
1121
+ * Rejected — the three subsystems are conceptually coupled. They
1122
+ * share invariants (traceability, simulation-derivation) and
1123
+ * interact through the simulation lifecycle. Splitting them would
1124
+ * require cross-references between three documents for concepts
1125
+ * that only make sense together.
1126
+ *
1127
+ * C. Skip the conceptual ADR and define implementation directly:
1128
+ * Rejected — implementation without conceptual framing produces
1129
+ * the exact anti-patterns this ADR documents: ad-hoc integrations,
1130
+ * memory fragmentation, orphaned mappings. The conceptual layer
1131
+ * prevents drift by establishing clear boundaries before code
1132
+ * is written.
1133
+ *
1134
+ * D. Use a separate enterprise architecture framework (TOGAF, Zachman):
1135
+ * Rejected — the ADR format is established in this codebase.
1136
+ * Introducing a second documentation framework would create
1137
+ * the duplication this ADR warns against. The ADR format is
1138
+ * sufficient to express the required concepts.
1139
+ *
1140
+ * E. Define Ruvector's schema and integration data models here:
1141
+ * Rejected — schema definitions are implementation concerns.
1142
+ * This ADR defines what Ruvector IS (system of record, lineage
1143
+ * store, replay substrate) and what it must preserve (invariants).
1144
+ * How it stores data is a future implementation ADR's concern.
1145
+ */
1146
+ // ============================================================================
1147
+ // ADR-004 Metadata
1148
+ // ============================================================================
1149
+ // This ADR is purely conceptual. It exports only its own metadata
1150
+ // for identification and cross-referencing by other ADRs.
1151
+ // It contains no schemas, no middleware, no tables, no queries,
1152
+ // no runtime code.
1153
+ // ============================================================================
1154
+ export const ADR_004_ID = 'ADR-004';
1155
+ export const ADR_004_TITLE = 'Enterprise Integration & Memory Architecture';
1156
+ export const ADR_004_STATUS = 'Accepted';
1157
+ export const ADR_004_DATE = '2026-01-28';
1158
+ //# sourceMappingURL=adr-004-enterprise-integration-memory.js.map