@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,1371 @@
1
+ /**
2
+ * ADR-005: System Coherence, Drift Detection, and Self-Governance
3
+ *
4
+ * STATUS: Accepted
5
+ * DATE: 2026-01-28
6
+ * AUTHORS: Platform Engineering
7
+ * SUPERSEDES: None
8
+ * DEPENDS ON: ADR-003 (governance architecture), ADR-004 (enterprise integration & memory)
9
+ * REFERENCED BY: Future implementation ADRs for drift detection, coherence monitoring
10
+ *
11
+ * ============================================================================
12
+ * POSITIONING STATEMENT
13
+ * ============================================================================
14
+ *
15
+ * Agentics does not self-correct decisions — it preserves coherence so
16
+ * humans can govern change safely.
17
+ *
18
+ * As simulations accumulate, integrations evolve, ERP proposals multiply,
19
+ * and memory grows, the Agentics platform must remain structurally
20
+ * coherent. Coherence is not a feature to be built — it is an
21
+ * architectural property that emerges from governed processes and is
22
+ * eroded by ungoverned ones.
23
+ *
24
+ * This ADR defines the conceptual architecture for how the platform:
25
+ *
26
+ * - Detects incoherence and drift across simulations, integrations,
27
+ * ERP Surface, and memory
28
+ *
29
+ * - Preserves long-term structural consistency without relying on
30
+ * autonomous correction
31
+ *
32
+ * - Supports governed self-management — the ability of the system
33
+ * to observe its own state and surface findings to humans who
34
+ * make the decisions
35
+ *
36
+ * This ADR introduces no new commands, schemas, middleware, tables,
37
+ * APIs, algorithms, or implementation details. It is a conceptual
38
+ * framing document that establishes the domains, invariants, and
39
+ * responsibility boundaries for coherence and drift within the
40
+ * Agentics platform.
41
+ *
42
+ * ============================================================================
43
+ * CONTEXT
44
+ * ============================================================================
45
+ *
46
+ * The Agentics platform now has:
47
+ *
48
+ * - Governed CLI semantics and synthesis rules (ADR-001) that define
49
+ * what every command accepts and when LLM synthesis may occur.
50
+ *
51
+ * - Executable governance via schema, middleware, and CI (ADR-002)
52
+ * that mechanically enforces ADR-001's rules at runtime.
53
+ *
54
+ * - A DDD framing for the CLI control plane (ADR-003) that defines
55
+ * five bounded contexts, seven invariants, and the governance
56
+ * hierarchy that all implementations must respect.
57
+ *
58
+ * - A defined enterprise integration and memory architecture
59
+ * (ADR-004) centered on Ruvector, Integrations, and ERP Surface,
60
+ * with seven additional invariants governing traceability,
61
+ * simulation derivation, and memory authority.
62
+ *
63
+ * What is still missing is an explicit architectural model explaining:
64
+ *
65
+ * - How the system detects drift over time. As simulations are
66
+ * re-run, as integration definitions evolve, and as ERP Surface
67
+ * accumulates proposals, the platform must be able to observe
68
+ * whether its state remains internally consistent.
69
+ *
70
+ * - How coherence is preserved as the platform grows. A platform
71
+ * with 10 simulations and 5 integrations is easy to reason about.
72
+ * A platform with 10,000 simulations, 75 integrations, and
73
+ * thousands of ERP proposals is not. Coherence must be
74
+ * architectural, not accidental.
75
+ *
76
+ * - How the platform "manages itself" structurally. Self-management
77
+ * does not mean autonomous correction. It means the platform can
78
+ * observe, compare, and surface — but never unilaterally act.
79
+ *
80
+ * Without this model:
81
+ *
82
+ * - Drift accumulates silently. Integration definitions change but
83
+ * existing simulations that referenced earlier versions are not
84
+ * flagged. ERP proposals derived from outdated simulations remain
85
+ * without any indication of staleness.
86
+ *
87
+ * - Contributors build autonomous correction. Without a clear
88
+ * statement that the platform does not self-correct, future
89
+ * contributors will build "auto-fix" and "auto-heal" features
90
+ * that violate the governance model.
91
+ *
92
+ * - Long-term consistency becomes a manual burden. Without
93
+ * architectural support for coherence observation, operators
94
+ * must manually audit every artifact to determine if the
95
+ * platform's state is internally consistent.
96
+ *
97
+ * - The distinction between observation and action blurs. Without
98
+ * an explicit boundary, detecting a problem and fixing it
99
+ * collapse into a single automated step — removing human
100
+ * judgment from enterprise decisions.
101
+ *
102
+ * This ADR fills that gap.
103
+ *
104
+ * ============================================================================
105
+ * DECISION
106
+ * ============================================================================
107
+ *
108
+ * The system coherence and self-governance architecture is organized
109
+ * into five conceptual domains. Each domain has clear responsibilities,
110
+ * boundaries, and invariants. Together, they describe how the platform
111
+ * maintains structural integrity over time without autonomous action.
112
+ *
113
+ * The five domains are:
114
+ *
115
+ * 1. System Coherence
116
+ * 2. Drift Detection
117
+ * 3. Governed Self-Management
118
+ * 4. Memory-Anchored Reality
119
+ * 5. Human Oversight Boundary
120
+ *
121
+ * ============================================================================
122
+ * DOMAIN 1: SYSTEM COHERENCE
123
+ * ============================================================================
124
+ *
125
+ * DEFINITION:
126
+ *
127
+ * System coherence is the property that all artifacts, relationships,
128
+ * and derivation chains within the Agentics platform are internally
129
+ * consistent with respect to the governance rules and invariants
130
+ * defined in ADRs 001-004.
131
+ *
132
+ * Coherence is not the same as correctness. A simulation may produce
133
+ * a plan that is factually wrong about enterprise costs. That plan is
134
+ * still coherent if it was created through the governed pipeline, is
135
+ * traceable to a simulation, and is persisted in Ruvector with full
136
+ * lineage. Coherence is a structural property. Correctness is a
137
+ * judgment that only humans can make.
138
+ *
139
+ * WHAT COHERENCE MEANS IN AGENTICS:
140
+ *
141
+ * Coherence means:
142
+ *
143
+ * - Every artifact traces to its origin. A plan traces to a
144
+ * simulation. An integration proposal traces to a plan and a
145
+ * simulation. An ERP mapping traces to a simulation that produced
146
+ * it. If any artifact exists without a traceable origin, the
147
+ * platform is incoherent.
148
+ *
149
+ * - Every derivation chain is intact. If Simulation A produced
150
+ * Plan B, and Plan B was approved to produce Deployment C, then
151
+ * the chain A → B → C must be reconstructable from Ruvector.
152
+ * If any link is missing, the platform is incoherent.
153
+ *
154
+ * - Every artifact was created through governance. If an artifact
155
+ * exists in Ruvector without having passed through the 5-gate
156
+ * pipeline (ADR-002), the platform is incoherent — regardless
157
+ * of whether the artifact's content is "correct."
158
+ *
159
+ * - Every reference resolves. If a plan references Simulation X,
160
+ * Simulation X must exist in Ruvector. If an integration proposal
161
+ * references Integration Y, Integration Y must exist in the
162
+ * Integrations repository. Dangling references are incoherence.
163
+ *
164
+ * WHY COHERENCE IS ARCHITECTURAL, NOT BEHAVIORAL:
165
+ *
166
+ * Coherence is not a behavior that the system performs. It is a
167
+ * property that the system either has or lacks. The system does not
168
+ * "do coherence" — it is coherent (or not) based on whether its
169
+ * artifacts satisfy the invariants.
170
+ *
171
+ * This distinction matters because:
172
+ *
173
+ * - Behavioral coherence ("the system behaves consistently") is
174
+ * impossible to guarantee in a system that involves LLM synthesis.
175
+ * The same natural language input may produce different plans on
176
+ * different runs. This is not incoherence — it is the nature of
177
+ * synthesis.
178
+ *
179
+ * - Structural coherence ("the system's artifacts satisfy their
180
+ * invariants") is verifiable. Every artifact either traces to a
181
+ * simulation or it does not. Every derivation chain is either
182
+ * intact or it is not. These are binary properties that can be
183
+ * checked mechanically.
184
+ *
185
+ * The platform guarantees structural coherence. It does not and
186
+ * cannot guarantee that synthesis outputs are consistent across
187
+ * time. The distinction between "same inputs, same structure" and
188
+ * "same inputs, same outputs" is fundamental to how Agentics works.
189
+ *
190
+ * DIFFERENCE BETWEEN LOCAL CORRECTNESS AND SYSTEM COHERENCE:
191
+ *
192
+ * Local correctness means a single artifact is valid in isolation.
193
+ * A plan has all required fields. A simulation has a valid identifier.
194
+ * An integration proposal has a non-empty description. These checks
195
+ * are handled by ADR-002's schema validation and contract enforcement.
196
+ *
197
+ * System coherence means the entire platform's state is internally
198
+ * consistent. All derivation chains are intact. All references
199
+ * resolve. All artifacts trace to governed origins. No orphaned or
200
+ * dangling artifacts exist.
201
+ *
202
+ * A platform can have locally correct artifacts and still be
203
+ * incoherent. If a plan is valid but its parent simulation was
204
+ * deleted, the plan is locally correct but the system is incoherent.
205
+ * If an integration proposal references an integration that no
206
+ * longer exists, the proposal is locally correct but the system
207
+ * is incoherent.
208
+ *
209
+ * Local correctness is necessary but not sufficient for coherence.
210
+ *
211
+ * ============================================================================
212
+ * DOMAIN 2: DRIFT DETECTION
213
+ * ============================================================================
214
+ *
215
+ * DEFINITION:
216
+ *
217
+ * Drift is the gradual divergence of the platform's state from its
218
+ * intended coherent state. Drift is not a failure — it is an
219
+ * inevitable consequence of a living system where integrations evolve,
220
+ * simulations accumulate, and the enterprise landscape changes.
221
+ *
222
+ * CATEGORIES OF DRIFT:
223
+ *
224
+ * Semantic Drift:
225
+ *
226
+ * The meaning of terms, categories, or classifications changes
227
+ * over time without explicit acknowledgment. A simulation created
228
+ * when "cloud migration" meant "lift-and-shift to AWS" may still
229
+ * exist when the organization has redefined "cloud migration" to
230
+ * mean "multi-cloud Kubernetes." The simulation is structurally
231
+ * coherent but semantically stale.
232
+ *
233
+ * Semantic drift is the hardest to detect because it requires
234
+ * understanding context, not just structure. The platform cannot
235
+ * detect semantic drift autonomously — it can only surface
236
+ * temporal and contextual information that enables humans to
237
+ * recognize it.
238
+ *
239
+ * Structural Drift:
240
+ *
241
+ * The structure of artifacts, schemas, or integration definitions
242
+ * changes in ways that invalidate existing artifacts. A new
243
+ * required field is added to integration definitions, but existing
244
+ * simulations that referenced the old structure are not updated.
245
+ * The derivation chain is intact, but the referenced integration
246
+ * now has a different shape than what the simulation consumed.
247
+ *
248
+ * Structural drift is detectable by comparing the structure of
249
+ * referenced artifacts against the structure that existed when
250
+ * the reference was created.
251
+ *
252
+ * Lineage Drift:
253
+ *
254
+ * The derivation chain between artifacts becomes incomplete or
255
+ * inconsistent. A simulation is deleted but its child plans and
256
+ * proposals remain. An integration is removed from the repository
257
+ * but proposals referencing it persist in Ruvector. A plan's
258
+ * parent simulation is re-run with different parameters, but the
259
+ * plan still references the original simulation version.
260
+ *
261
+ * Lineage drift is detectable by traversing derivation chains
262
+ * and verifying that every link resolves to a valid artifact.
263
+ *
264
+ * Integration Drift:
265
+ *
266
+ * The Integrations repository evolves independently of existing
267
+ * simulations. New integrations are added. Existing integrations
268
+ * are modified. Integration capabilities change. But simulations
269
+ * that were created against an earlier version of the integration
270
+ * landscape are not flagged as potentially stale.
271
+ *
272
+ * Integration drift is detectable by comparing the integration
273
+ * landscape at simulation creation time against the current
274
+ * landscape and identifying differences that affect the
275
+ * simulation's assumptions.
276
+ *
277
+ * WHY DRIFT IS INEVITABLE IN LARGE SYSTEMS:
278
+ *
279
+ * Drift is inevitable because the platform is a living system.
280
+ * Integrations evolve as enterprise systems are upgraded. ERP
281
+ * processes change as the business transforms. Simulations
282
+ * accumulate and their assumptions become outdated. The enterprise
283
+ * context that justified a decision six months ago may no longer
284
+ * apply.
285
+ *
286
+ * The platform cannot prevent drift because it cannot prevent the
287
+ * world from changing. What it can do is make drift observable —
288
+ * and that is a fundamentally different design goal than preventing
289
+ * it.
290
+ *
291
+ * WHY DETECTION MATTERS MORE THAN PREVENTION:
292
+ *
293
+ * Prevention assumes that the system can identify and block all
294
+ * sources of drift at the point of occurrence. This is impossible
295
+ * in a system where external factors (enterprise system upgrades,
296
+ * organizational changes, regulatory updates) are the primary
297
+ * sources of drift. The platform does not control these factors.
298
+ *
299
+ * Detection accepts that drift will occur and focuses on making
300
+ * it visible. A platform that detects drift enables humans to
301
+ * decide: Is this drift acceptable? Does it invalidate prior
302
+ * decisions? Should affected simulations be re-run?
303
+ *
304
+ * Detection preserves human agency. Prevention removes it by
305
+ * implying that the system knows which changes are acceptable and
306
+ * which are not.
307
+ *
308
+ * ============================================================================
309
+ * DOMAIN 3: GOVERNED SELF-MANAGEMENT
310
+ * ============================================================================
311
+ *
312
+ * DEFINITION:
313
+ *
314
+ * Governed self-management is the platform's ability to observe,
315
+ * compare, and surface information about its own state — without
316
+ * autonomously acting on that information. The platform manages
317
+ * itself structurally by maintaining the preconditions for human
318
+ * governance. It does not govern itself.
319
+ *
320
+ * WHAT "SELF-MANAGEMENT" MEANS:
321
+ *
322
+ * Self-management means the platform can:
323
+ *
324
+ * - Observe its own coherence state. The platform can determine
325
+ * whether its artifacts satisfy the invariants defined in
326
+ * ADRs 003-005. It can identify orphaned artifacts, broken
327
+ * lineage chains, dangling references, and stale derivations.
328
+ *
329
+ * - Compare artifacts across time. Because Ruvector stores
330
+ * simulation context, the platform can compare the inputs and
331
+ * outputs of simulations run at different times. It can identify
332
+ * cases where the same scenario produces materially different
333
+ * results, indicating that underlying assumptions have changed.
334
+ *
335
+ * - Surface findings to operators. The platform can present its
336
+ * observations in structured, actionable reports that describe
337
+ * what drift exists, where it exists, and what artifacts are
338
+ * affected. These reports are informational. They do not
339
+ * prescribe corrective action.
340
+ *
341
+ * WHAT "SELF-MANAGEMENT" DOES NOT MEAN:
342
+ *
343
+ * Self-management does NOT mean:
344
+ *
345
+ * - Self-correction. The platform does not fix drift. It does not
346
+ * re-run simulations, update proposals, reconcile integration
347
+ * definitions, or modify ERP mappings based on detected drift.
348
+ * Correction requires human judgment about whether the drift
349
+ * matters and what the correct response is.
350
+ *
351
+ * - Autonomous decision-making. The platform does not decide which
352
+ * simulations are "stale" and should be archived, which proposals
353
+ * are "outdated" and should be revoked, or which integrations
354
+ * are "drifted" and should be re-evaluated. These are enterprise
355
+ * decisions that humans must make.
356
+ *
357
+ * - Proactive remediation. The platform does not take preventive
358
+ * action to avoid future drift. It does not re-run simulations
359
+ * on a schedule, automatically refresh integration definitions,
360
+ * or periodically validate ERP mappings. These would be
361
+ * autonomous behaviors that bypass the governed CLI pipeline.
362
+ *
363
+ * CLEAR DISTINCTION: SELF-GOVERNANCE vs AUTOMATION vs AUTONOMY:
364
+ *
365
+ * Self-governance (what Agentics does):
366
+ * The platform maintains structural properties that enable
367
+ * human governance. It preserves lineage, ensures traceability,
368
+ * detects drift, and surfaces findings. Every action the platform
369
+ * takes to "manage itself" is observable, auditable, and does not
370
+ * modify enterprise decisions.
371
+ *
372
+ * Automation (what Agentics may support, under governance):
373
+ * Automation executes predefined, deterministic workflows that
374
+ * humans have explicitly configured. A scheduled coherence report
375
+ * is automation. A notification when lineage breaks is automation.
376
+ * Automation operates within governance — it does what humans
377
+ * told it to do, when they told it to do it.
378
+ *
379
+ * Autonomy (what Agentics must NEVER do):
380
+ * Autonomy means making enterprise decisions without human
381
+ * authorization. Re-running a simulation because drift was
382
+ * detected is autonomous. Archiving a "stale" proposal without
383
+ * human approval is autonomous. Modifying an ERP mapping based
384
+ * on detected integration changes is autonomous. Autonomy
385
+ * removes human judgment from the decision loop. The Agentics
386
+ * platform is explicitly non-autonomous.
387
+ *
388
+ * WHY AGENTICS MUST REMAIN EXPLAINABLE AND AUDITABLE:
389
+ *
390
+ * The platform exists in an enterprise context where every decision
391
+ * must be attributable to a human (or to a governed process that
392
+ * a human authorized). This is not a design preference — it is a
393
+ * requirement imposed by:
394
+ *
395
+ * - Compliance frameworks (SOC2, HIPAA, GDPR, ISO 27001) that
396
+ * require traceable decision chains with accountable actors.
397
+ *
398
+ * - Enterprise governance policies that prohibit autonomous system
399
+ * changes without human approval.
400
+ *
401
+ * - Risk management requirements that demand a clear separation
402
+ * between observation ("we detected drift") and action ("a human
403
+ * decided to re-simulate").
404
+ *
405
+ * If the platform autonomously corrects drift, the audit trail
406
+ * breaks. The question "Who decided to update this proposal?" has
407
+ * the answer "The system decided." In an enterprise context, that
408
+ * answer is unacceptable.
409
+ *
410
+ * ============================================================================
411
+ * DOMAIN 4: MEMORY-ANCHORED REALITY (RUVECTOR)
412
+ * ============================================================================
413
+ *
414
+ * DEFINITION:
415
+ *
416
+ * Memory-anchored reality is the principle that the platform's
417
+ * understanding of its own state is grounded in persisted memory
418
+ * (Ruvector), not in transient computation, inferred relationships,
419
+ * or assumed consistency. What is in Ruvector is real. What is not
420
+ * in Ruvector does not exist.
421
+ *
422
+ * CONCEPTUAL ROLE OF MEMORY IN DETECTING DRIFT:
423
+ *
424
+ * Drift detection requires comparison. To know that something has
425
+ * changed, the platform must know what it looked like before. This
426
+ * is the fundamental role of memory in drift detection:
427
+ *
428
+ * - When a simulation is created, the integration landscape is
429
+ * recorded as part of the simulation's context in Ruvector.
430
+ * Later, the platform can compare the recorded landscape against
431
+ * the current landscape and identify differences.
432
+ *
433
+ * - When a plan is derived from a simulation, the derivation
434
+ * relationship is recorded in Ruvector. Later, the platform can
435
+ * traverse derivation chains and verify that every link still
436
+ * resolves.
437
+ *
438
+ * - When an ERP proposal is projected onto the enterprise model,
439
+ * the proposal's basis (the simulation that produced it, the
440
+ * integration definitions it referenced) is recorded. Later,
441
+ * the platform can check whether that basis remains valid.
442
+ *
443
+ * Without memory, drift is undetectable. If the platform does not
444
+ * remember what integration definitions looked like when a simulation
445
+ * was created, it cannot know whether those definitions have changed.
446
+ * Memory is not a convenience — it is the substrate for coherence
447
+ * observation.
448
+ *
449
+ * WHY LINEAGE ENABLES COMPARISON OVER TIME:
450
+ *
451
+ * Lineage is the explicit record of how artifacts relate to each
452
+ * other and how they were produced. Lineage enables time-based
453
+ * comparison because it answers the question: "What was the world
454
+ * like when this artifact was created?"
455
+ *
456
+ * A simulation created on January 15 referenced Integration V2.3 of
457
+ * SAP. The current integration version is V3.1. Lineage tells the
458
+ * platform that the simulation's context assumed V2.3. The platform
459
+ * can then surface: "This simulation was created against SAP V2.3.
460
+ * The current version is V3.1. Changes may affect this simulation's
461
+ * conclusions."
462
+ *
463
+ * Without lineage, this comparison is impossible. The platform would
464
+ * know only the current state of integrations, with no way to
465
+ * determine what state existed when any given simulation was created.
466
+ *
467
+ * WHY REPLAY AND DIFFING ARE ARCHITECTURAL PRIMITIVES:
468
+ *
469
+ * Replay — the ability to re-execute a simulation's synthesis
470
+ * phase with recorded inputs — is not a feature. It is an
471
+ * architectural primitive that makes drift observable.
472
+ *
473
+ * When the platform replays a simulation and the output differs
474
+ * from the original, the difference is a signal. That signal may
475
+ * indicate that the synthesis engine has changed, that integration
476
+ * definitions have evolved, or that enterprise context has shifted.
477
+ * The platform does not interpret the signal — it presents it to
478
+ * humans.
479
+ *
480
+ * Diffing — the ability to compare two versions of an artifact,
481
+ * two simulation outputs, or two states of the integration
482
+ * landscape — is the mechanism by which replay signals become
483
+ * actionable. A diff that says "the cost projection changed by
484
+ * 40%" is more useful than a signal that says "something changed."
485
+ *
486
+ * Replay and diffing are architectural primitives because they are
487
+ * the fundamental operations through which coherence becomes
488
+ * observable. They are not features to be added later — they are
489
+ * capabilities that the memory architecture must support from the
490
+ * beginning.
491
+ *
492
+ * ============================================================================
493
+ * DOMAIN 5: HUMAN OVERSIGHT BOUNDARY
494
+ * ============================================================================
495
+ *
496
+ * DEFINITION:
497
+ *
498
+ * The human oversight boundary defines where human judgment is
499
+ * mandatory in the Agentics platform. It establishes an explicit
500
+ * line between what the platform may do autonomously (observe,
501
+ * compare, surface) and what requires human authorization (correct,
502
+ * approve, execute, archive).
503
+ *
504
+ * WHERE HUMANS REMAIN MANDATORY:
505
+ *
506
+ * Enterprise decisions:
507
+ * Every decision that affects the enterprise — approving a plan,
508
+ * executing a deployment, enabling a policy, rolling back a change
509
+ * — requires explicit human authorization through a
510
+ * COMMITMENT_GRADE command with --force confirmation. The platform
511
+ * presents information. Humans decide.
512
+ *
513
+ * Drift response:
514
+ * When the platform detects drift, the response is always a human
515
+ * decision. The platform surfaces: "These simulations may be
516
+ * affected by changes to Integration X." The human decides: re-run
517
+ * the simulations, accept the drift, or investigate further. The
518
+ * platform never decides autonomously which response is appropriate.
519
+ *
520
+ * Coherence remediation:
521
+ * When the platform identifies incoherence (orphaned artifacts,
522
+ * broken lineage, dangling references), remediation is a human
523
+ * action. The platform surfaces: "Plan Y references Simulation Z,
524
+ * which no longer exists." The human decides: delete the plan,
525
+ * re-create the simulation, or accept the orphaned state. The
526
+ * platform never cleans up autonomously.
527
+ *
528
+ * Archival and retention:
529
+ * Decisions about which simulations to archive, which proposals
530
+ * to retire, and which artifacts to retain are enterprise
531
+ * governance decisions. The platform may surface recommendations
532
+ * ("This simulation is 18 months old and has not been referenced").
533
+ * The human decides whether to archive it.
534
+ *
535
+ * Interpretation:
536
+ * The platform produces observations, not judgments. "Simulation A
537
+ * and Simulation B produce different cost projections for the same
538
+ * scenario" is an observation. "Simulation A is outdated" is a
539
+ * judgment. The platform makes observations. Humans make judgments.
540
+ *
541
+ * WHY EXECUTIVE AND OPERATOR JUDGMENT IS PRESERVED:
542
+ *
543
+ * Enterprise decisions have consequences that extend beyond the
544
+ * platform's scope. A deployment affects real systems, real budgets,
545
+ * real compliance obligations, and real people. The platform cannot
546
+ * understand these consequences because they exist outside its
547
+ * memory and governance model.
548
+ *
549
+ * A simulation may show that a migration saves $2M annually. An
550
+ * executive may reject it because a regulatory change makes the
551
+ * target architecture non-compliant next quarter. The platform
552
+ * does not know about the regulatory change. If it autonomously
553
+ * acted on the simulation's recommendation, it would make the
554
+ * wrong decision.
555
+ *
556
+ * Human judgment is not a limitation of the platform. It is a
557
+ * feature. It ensures that enterprise decisions account for context
558
+ * that the platform cannot observe.
559
+ *
560
+ * HOW THE SYSTEM SUPPORTS HUMANS WITHOUT REPLACING THEM:
561
+ *
562
+ * The platform supports human decision-making by:
563
+ *
564
+ * - Preserving context. Every simulation, plan, proposal, and
565
+ * decision is recorded with full context in Ruvector. Humans
566
+ * never need to reconstruct "why did we decide this?" — the
567
+ * platform remembers.
568
+ *
569
+ * - Surfacing drift. The platform identifies when underlying
570
+ * assumptions have changed. Humans do not need to manually
571
+ * compare integration versions or check simulation freshness —
572
+ * the platform observes and reports.
573
+ *
574
+ * - Enabling comparison. When humans need to evaluate alternatives,
575
+ * the platform can replay simulations, diff outputs, and present
576
+ * structured comparisons. Humans make the judgment; the platform
577
+ * provides the evidence.
578
+ *
579
+ * - Maintaining traceability. When a decision is questioned — by
580
+ * auditors, executives, or future contributors — the platform
581
+ * provides the complete decision trail. Every artifact traces
582
+ * to a simulation, a plan, a human authorization, and a
583
+ * governance checkpoint.
584
+ *
585
+ * The platform is an enterprise decision system that amplifies
586
+ * human judgment. It is not an AI tool that replaces it.
587
+ *
588
+ * ============================================================================
589
+ * SYSTEM-LEVEL INVARIANTS (NON-NEGOTIABLE)
590
+ * ============================================================================
591
+ *
592
+ * The following are system-level truths that all implementations
593
+ * must preserve. These invariants extend — and do not replace — the
594
+ * invariants defined in ADR-003 (Invariants 1-7) and ADR-004
595
+ * (Invariants 1-7).
596
+ *
597
+ * INVARIANT 1: Every enterprise decision must remain traceable
598
+ * over time.
599
+ *
600
+ * Traceability is not a point-in-time property. A decision must
601
+ * be traceable not only at creation but indefinitely afterward.
602
+ * The deletion or modification of upstream artifacts (simulations,
603
+ * plans, integration definitions) must not destroy the traceability
604
+ * of downstream decisions. If traceability degrades, the platform
605
+ * must detect and surface this as a coherence violation.
606
+ *
607
+ * INVARIANT 2: No integration or ERP proposal exists without
608
+ * historical context.
609
+ *
610
+ * Every proposal must record the context in which it was created:
611
+ * which integration definitions were current, what simulation
612
+ * parameters were used, what governance version was applied, and
613
+ * who authorized the simulation. This historical context is the
614
+ * basis for future drift detection. A proposal without historical
615
+ * context is undiffable and therefore unmonitorable.
616
+ *
617
+ * INVARIANT 3: Drift may be detected but never silently corrected.
618
+ *
619
+ * When the platform detects drift — stale simulations, changed
620
+ * integration definitions, broken lineage — it must surface the
621
+ * finding and wait for human response. The platform must not
622
+ * silently update, reconcile, archive, or discard artifacts
623
+ * based on detected drift. Silent correction is indistinguishable
624
+ * from data corruption from an audit perspective.
625
+ *
626
+ * INVARIANT 4: Memory is authoritative; projections are derived.
627
+ *
628
+ * Ruvector's stored artifacts are the authoritative record of
629
+ * what the platform has produced. Any view, dashboard, report,
630
+ * or comparison that the platform presents is a projection derived
631
+ * from Ruvector's records. If a projection contradicts Ruvector,
632
+ * Ruvector is correct and the projection is wrong. Projections
633
+ * must never modify memory; they are read-only derivations.
634
+ *
635
+ * INVARIANT 5: Self-management never bypasses governance.
636
+ *
637
+ * Any action the platform takes to manage its own state — producing
638
+ * coherence reports, detecting drift, comparing simulations,
639
+ * traversing lineage — must be a read-only operation against
640
+ * Ruvector. Self-management never writes to Ruvector, never
641
+ * modifies artifacts, never creates new artifacts, and never
642
+ * triggers the governed CLI pipeline without explicit human
643
+ * initiation.
644
+ *
645
+ * ============================================================================
646
+ * CONCEPTUAL LIFECYCLE (DESCRIPTIVE ONLY)
647
+ * ============================================================================
648
+ *
649
+ * The following describes, in prose, how the platform accumulates
650
+ * state over time and how coherence becomes observable. This is a
651
+ * conceptual description. It is not a specification, a workflow
652
+ * definition, or an implementation guide.
653
+ *
654
+ * ACCUMULATION:
655
+ *
656
+ * Over months and years of operation, the Agentics platform
657
+ * accumulates simulations, plans, proposals, and decisions. Each
658
+ * simulation captures a snapshot of the enterprise context at the
659
+ * time it was created: which integrations existed, what their
660
+ * capabilities were, what constraints applied, and what the user
661
+ * asked the system to reason about.
662
+ *
663
+ * As new simulations are created, the integration landscape
664
+ * evolves. New enterprise systems are added. Existing systems are
665
+ * upgraded. Capabilities change. Constraints shift. Each new
666
+ * simulation captures the current landscape, but earlier
667
+ * simulations retain the landscape as it was.
668
+ *
669
+ * COMPARISON:
670
+ *
671
+ * Because Ruvector stores the context of every simulation, the
672
+ * platform can compare any two points in time. A simulation from
673
+ * January can be compared against a simulation from July — not
674
+ * just in terms of their outputs, but in terms of the enterprise
675
+ * context that informed them.
676
+ *
677
+ * Comparison reveals divergence. If two simulations of the same
678
+ * scenario produce different cost projections, the platform can
679
+ * present the differences alongside the contextual changes that
680
+ * may explain them. "The January simulation assumed 50 EC2
681
+ * instances at $X/month. The July simulation assumed 120 Kubernetes
682
+ * pods at $Y/month. The integration landscape changed between
683
+ * these runs: AWS integration was updated from V2 to V3."
684
+ *
685
+ * DRIFT BECOMES OBSERVABLE:
686
+ *
687
+ * Drift becomes observable when the platform compares the context
688
+ * of an existing artifact against the current state of the system.
689
+ * The observation takes one of several forms:
690
+ *
691
+ * - An integration definition that a simulation referenced has
692
+ * been modified. The simulation's assumptions may no longer hold.
693
+ *
694
+ * - A derivation chain has a broken link. An artifact's parent
695
+ * no longer exists, making the artifact an orphan.
696
+ *
697
+ * - A replay of a simulation produces materially different output.
698
+ * Something in the synthesis context has changed.
699
+ *
700
+ * - Multiple proposals for the same enterprise process are based
701
+ * on different simulation contexts. The proposals may be
702
+ * contradictory.
703
+ *
704
+ * Each of these is an observation, not a judgment. The platform
705
+ * records the observation and makes it available to operators.
706
+ *
707
+ * HUMANS ARE ALERTED OR INFORMED:
708
+ *
709
+ * When drift is detected, the platform surfaces the finding through
710
+ * governed channels. The specific mechanism — a report, a
711
+ * notification, a dashboard entry, a CLI command output — is an
712
+ * implementation concern. The conceptual requirement is that drift
713
+ * findings reach a human who can evaluate them.
714
+ *
715
+ * The finding includes:
716
+ *
717
+ * - What was detected (the type of drift)
718
+ * - Where it was detected (which artifacts are affected)
719
+ * - What changed (the specific difference between the recorded
720
+ * context and the current state)
721
+ * - When the drift originated (the timestamp of the change)
722
+ *
723
+ * The finding does NOT include:
724
+ *
725
+ * - A recommendation for corrective action
726
+ * - A severity judgment
727
+ * - An automatic remediation option
728
+ * - A comparison to similar drift events
729
+ *
730
+ * The platform presents facts. Humans interpret them.
731
+ *
732
+ * CORRECTIONS OCCUR THROUGH GOVERNED WORKFLOWS:
733
+ *
734
+ * When a human decides that drift requires a response, the
735
+ * response flows through the governed CLI pipeline. If a
736
+ * simulation needs to be re-run, the human issues a simulate
737
+ * command. If a plan needs to be revised, the human issues a
738
+ * plan command. If a deployment needs to be rolled back, the
739
+ * human issues a deploy rollback command with --force confirmation.
740
+ *
741
+ * There is no "fix drift" command. There is no "reconcile" button.
742
+ * There is no "auto-heal" workflow. Corrections are composed from
743
+ * the existing governed command vocabulary. The governed pipeline
744
+ * ensures that every correction is subject to the same governance
745
+ * as the original action: identity attribution, synthesis
746
+ * classification, gate validation, and Ruvector persistence.
747
+ *
748
+ * This means that corrective actions are indistinguishable from
749
+ * original actions in the audit trail. A simulation re-run due
750
+ * to drift is just another simulation. A plan revision is just
751
+ * another plan. The platform does not distinguish between "first
752
+ * time" and "correction" — all actions are governed equally.
753
+ *
754
+ * ============================================================================
755
+ * RELATIONSHIP TO EXISTING ADRS
756
+ * ============================================================================
757
+ *
758
+ * ADR-005 is additive to the governance hierarchy established by
759
+ * ADRs 001-004. It does not rewrite, replace, or contradict any
760
+ * prior ADR.
761
+ *
762
+ * ADR-003 → defines the CLI control plane conceptual model
763
+ * ↓
764
+ * ADR-004 → defines the enterprise integration conceptual model
765
+ * ↓
766
+ * ADR-005 → defines how coherence and drift are governed over time
767
+ * ↓
768
+ * ADR-001 → instantiates the models (command registry + types)
769
+ * ↓
770
+ * ADR-002 → enforces the models (gates + CI + regression tests)
771
+ *
772
+ * Specifically:
773
+ *
774
+ * - ADR-003's five CLI domains (Control Plane, Command Semantics,
775
+ * Synthesis Governance, Execution & State Mutation, Governance
776
+ * Source of Truth) remain unchanged. ADR-005's five coherence
777
+ * domains are complementary. They describe how ADR-003's domains
778
+ * maintain integrity over time.
779
+ *
780
+ * - ADR-003's execution phases (Planning → Execution → Commitment →
781
+ * Rollback) are the mechanisms through which drift corrections
782
+ * occur. ADR-005 does not introduce new lifecycle phases.
783
+ *
784
+ * - ADR-004's enterprise domains (Simulation, Memory, Integration,
785
+ * ERP Surface, CLI as Orchestrator) are the subjects of ADR-005's
786
+ * drift detection. ADR-005 describes how those domains' artifacts
787
+ * are monitored for coherence.
788
+ *
789
+ * - ADR-004's invariants (particularly Invariant 4: Ruvector as
790
+ * memory authority) are the foundation for ADR-005's
791
+ * memory-anchored reality principle.
792
+ *
793
+ * - ADR-001's command vocabulary is the mechanism through which
794
+ * humans respond to detected drift. ADR-005 does not introduce
795
+ * new commands.
796
+ *
797
+ * - ADR-002's gate pipeline ensures that drift corrections (like
798
+ * all actions) pass governance validation. ADR-005 relies on this
799
+ * enforcement and does not duplicate it.
800
+ *
801
+ * No existing ADR needs to be edited as a result of ADR-005.
802
+ *
803
+ * ============================================================================
804
+ * CONSEQUENCES
805
+ * ============================================================================
806
+ *
807
+ * POSITIVE:
808
+ *
809
+ * - The platform's long-term integrity is explainable. A stakeholder
810
+ * can read this ADR and understand how the platform maintains
811
+ * coherence without requiring autonomous behavior.
812
+ *
813
+ * - Future contributors understand how drift is handled. The clear
814
+ * separation between detection (platform) and correction (human)
815
+ * prevents the introduction of autonomous remediation features.
816
+ *
817
+ * - No prior ADR needs revision. ADR-005 is purely additive,
818
+ * filling a conceptual gap without contradicting existing
819
+ * decisions.
820
+ *
821
+ * - The platform reads as an enterprise decision system, not an AI
822
+ * tool. The emphasis on human oversight, auditability, and
823
+ * governed workflows positions the platform as infrastructure
824
+ * for decision-making rather than a replacement for it.
825
+ *
826
+ * - Self-management is structural, not magical. There is no
827
+ * "auto-heal" mystique. The platform observes, compares, and
828
+ * surfaces. Humans govern.
829
+ *
830
+ * - The distinction between observation and action is explicit.
831
+ * Future contributors cannot accidentally build autonomous
832
+ * correction by confusing "detect" with "fix."
833
+ *
834
+ * NEGATIVE:
835
+ *
836
+ * - Drift correction requires human effort. The platform does not
837
+ * automate responses to drift, which means operators must monitor
838
+ * drift reports and take manual action. This is intentional —
839
+ * the alternative (autonomous correction) violates the governance
840
+ * model.
841
+ *
842
+ * - The conceptual ADR chain (003, 004, 005) is now three documents.
843
+ * Contributors must understand the coherence model in addition to
844
+ * the CLI control plane and enterprise integration models.
845
+ * However, ADR-005 addresses a distinct concern (long-term
846
+ * integrity) that is not covered by the other conceptual ADRs.
847
+ *
848
+ * - The invariant that drift is "never silently corrected" may
849
+ * frustrate contributors who want to build intelligent
850
+ * auto-remediation. This frustration is the point — the invariant
851
+ * exists to prevent well-intentioned autonomy from undermining
852
+ * governance.
853
+ *
854
+ * ============================================================================
855
+ * EXPLICIT NON-GOALS
856
+ * ============================================================================
857
+ *
858
+ * 1. This ADR does NOT introduce new CLI commands.
859
+ * Drift detection and coherence reporting will be exposed
860
+ * through existing or future commands defined in ADR-001.
861
+ * This ADR defines the conceptual domains, not the commands.
862
+ *
863
+ * 2. This ADR does NOT define schemas, tables, or APIs.
864
+ * How drift observations are stored, queried, or surfaced is
865
+ * an implementation concern for future ADRs.
866
+ *
867
+ * 3. This ADR does NOT describe middleware, jobs, or code.
868
+ * There are no background processes, cron jobs, or event
869
+ * handlers specified here. Implementation mechanisms belong
870
+ * in future implementation ADRs.
871
+ *
872
+ * 4. This ADR does NOT specify algorithms or heuristics.
873
+ * How drift is detected — what thresholds trigger observations,
874
+ * what comparison methods are used, how staleness is calculated
875
+ * — is an implementation concern. This ADR defines what drift
876
+ * IS and what the platform's responsibilities are, not how
877
+ * drift is computed.
878
+ *
879
+ * 5. This ADR does NOT propose automation or autonomous correction.
880
+ * The platform observes and surfaces. It does not fix, reconcile,
881
+ * archive, or remediate. Any future automation must be explicitly
882
+ * human-configured and must not violate Invariant 3.
883
+ *
884
+ * 6. This ADR does NOT re-state or modify prior ADR decisions.
885
+ * It extends the conceptual architecture into the coherence
886
+ * and drift space, which was not covered by ADRs 001-004.
887
+ *
888
+ * ============================================================================
889
+ * ANTI-PATTERNS (WHAT FUTURE CONTRIBUTORS MUST NOT DO)
890
+ * ============================================================================
891
+ *
892
+ * ANTI-PATTERN 1: SILENT AUTO-CORRECTION
893
+ *
894
+ * What it looks like:
895
+ * A background job detects that a simulation's integration
896
+ * references are outdated. It automatically re-runs the
897
+ * simulation with updated integration definitions and replaces
898
+ * the original results in Ruvector.
899
+ *
900
+ * Why it's wrong:
901
+ * Silent correction destroys the audit trail. The original
902
+ * simulation's results — which may have been reviewed, approved,
903
+ * and used to justify enterprise decisions — are overwritten.
904
+ * An auditor asking "What did the original simulation conclude?"
905
+ * gets the corrected answer, not the original. This violates
906
+ * Invariant 3 and is indistinguishable from data tampering.
907
+ *
908
+ * What to do instead:
909
+ * Surface the drift. Present: "Simulation X referenced
910
+ * Integration V2.3. The current version is V3.1." Let the
911
+ * human decide whether to re-run the simulation. If they do,
912
+ * it creates a NEW simulation with its own lineage — the
913
+ * original is preserved.
914
+ *
915
+ * ANTI-PATTERN 2: AUTONOMOUS ARCHIVAL
916
+ *
917
+ * What it looks like:
918
+ * A system policy automatically archives simulations older than
919
+ * 90 days. A "staleness" algorithm marks proposals as "outdated"
920
+ * and removes them from active views.
921
+ *
922
+ * Why it's wrong:
923
+ * Retention is an enterprise governance decision, not a system
924
+ * behavior. A simulation from two years ago may still be the
925
+ * basis for an active deployment. An "old" proposal may be
926
+ * under regulatory review. Autonomous archival removes artifacts
927
+ * that humans may need, based on the system's assumption about
928
+ * what is "stale." This violates Invariant 5.
929
+ *
930
+ * What to do instead:
931
+ * Surface retention observations: "These 47 simulations are
932
+ * older than 12 months and have no downstream references."
933
+ * Let the operator decide whether to archive them. Archival
934
+ * is a governed action, not an automatic one.
935
+ *
936
+ * ANTI-PATTERN 3: DRIFT SEVERITY SCORING
937
+ *
938
+ * What it looks like:
939
+ * The platform assigns "severity scores" to detected drift.
940
+ * "Critical: Integration SAP changed from V2 to V3. 12
941
+ * simulations affected." "Low: Integration Slack updated
942
+ * description text. 2 simulations reference it."
943
+ *
944
+ * Why it's wrong:
945
+ * Severity is a judgment, not a measurement. A "minor" text
946
+ * change in a Slack integration might be irrelevant to most
947
+ * simulations but critical to one that depends on specific
948
+ * notification behavior. A "major" version change in SAP might
949
+ * be backward-compatible and affect nothing. The platform does
950
+ * not understand enterprise context deeply enough to assign
951
+ * severity accurately. False severity scores create false
952
+ * confidence or false urgency.
953
+ *
954
+ * What to do instead:
955
+ * Present the facts without judgment: "Integration SAP changed
956
+ * from V2.3 to V3.1. 12 simulations referenced V2.3." The
957
+ * human determines whether this matters.
958
+ *
959
+ * ANTI-PATTERN 4: PREDICTIVE DRIFT PREVENTION
960
+ *
961
+ * What it looks like:
962
+ * The platform analyzes integration change patterns and
963
+ * "pre-emptively" re-runs simulations that are "likely" to be
964
+ * affected by upcoming changes.
965
+ *
966
+ * Why it's wrong:
967
+ * Prediction requires modeling the future behavior of enterprise
968
+ * systems, organizational decisions, and market conditions. The
969
+ * platform does not have access to these signals. Predictive
970
+ * prevention creates false confidence ("the system already
971
+ * accounted for this change") and wastes resources on
972
+ * simulations that may never be needed. Worse, it conflates
973
+ * prediction with governance — the platform is making decisions
974
+ * about what to simulate without human authorization.
975
+ *
976
+ * What to do instead:
977
+ * When changes occur, surface them. Let humans decide which
978
+ * simulations to re-run based on their understanding of the
979
+ * enterprise context.
980
+ *
981
+ * ANTI-PATTERN 5: OVER-AUTOMATION OF COHERENCE CHECKS
982
+ *
983
+ * What it looks like:
984
+ * Every artifact write triggers a full coherence check across
985
+ * the entire platform. Every integration change triggers
986
+ * notifications to all simulation owners. The system produces
987
+ * so many coherence observations that operators learn to
988
+ * ignore them.
989
+ *
990
+ * Why it's wrong:
991
+ * Over-automation creates noise. When every change generates
992
+ * observations, the signal-to-noise ratio collapses. Operators
993
+ * stop reading coherence reports. Critical drift observations
994
+ * are lost in a flood of irrelevant notifications. The system
995
+ * that was designed to make drift visible inadvertently makes
996
+ * it invisible through volume.
997
+ *
998
+ * What to do instead:
999
+ * Coherence checks should be invoked through governed workflows
1000
+ * — not triggered automatically on every state change. Humans
1001
+ * decide when to check coherence and at what scope.
1002
+ *
1003
+ * ============================================================================
1004
+ * SUCCESS CRITERIA
1005
+ * ============================================================================
1006
+ *
1007
+ * This ADR is successful if:
1008
+ *
1009
+ * 1. The system's long-term integrity is explainable. A new
1010
+ * contributor, a stakeholder, or an auditor can read this
1011
+ * document and understand how the platform maintains
1012
+ * coherence over time — without reading implementation code.
1013
+ *
1014
+ * 2. Future contributors understand how drift is handled.
1015
+ * The detect-surface-wait pattern is clear. No contributor
1016
+ * builds autonomous correction without explicitly violating
1017
+ * a stated invariant.
1018
+ *
1019
+ * 3. No prior ADR needs revision. ADR-005 is additive. ADRs
1020
+ * 001, 002, 003, and 004 remain unchanged and uncontradicted.
1021
+ *
1022
+ * 4. The platform reads as an enterprise decision system, not an
1023
+ * AI tool. The emphasis on human oversight, governed workflows,
1024
+ * and non-autonomous behavior positions the platform as
1025
+ * infrastructure for enterprise governance.
1026
+ *
1027
+ * 5. Self-management is structural, not magical. The document
1028
+ * makes clear that "self-managing" means observing and surfacing,
1029
+ * not deciding and acting. There is no mystique about what the
1030
+ * platform does on its own.
1031
+ *
1032
+ * ============================================================================
1033
+ * ALTERNATIVES CONSIDERED
1034
+ * ============================================================================
1035
+ *
1036
+ * A. Embed coherence concepts into ADR-004:
1037
+ * Rejected — ADR-004 defines the enterprise integration and
1038
+ * memory domains. Coherence and drift are cross-cutting concerns
1039
+ * that apply to all domains (CLI, integration, ERP Surface, memory).
1040
+ * Embedding them in ADR-004 would make coherence appear to be
1041
+ * an integration concern rather than a system-wide property.
1042
+ *
1043
+ * B. Define specific drift detection algorithms:
1044
+ * Rejected — algorithms are implementation concerns. This ADR
1045
+ * defines what drift IS, what the platform's responsibilities
1046
+ * are, and what boundaries apply. How drift is computed belongs
1047
+ * in a future implementation ADR.
1048
+ *
1049
+ * C. Allow limited autonomous correction for "safe" cases:
1050
+ * Rejected — "safe" autonomous correction is a category error.
1051
+ * Safety is a judgment that requires enterprise context. A
1052
+ * correction that is "safe" from a structural perspective may be
1053
+ * unsafe from a regulatory, financial, or organizational
1054
+ * perspective. The platform cannot evaluate these dimensions.
1055
+ * Therefore, no correction is autonomous.
1056
+ *
1057
+ * D. Combine coherence and governance into a single domain:
1058
+ * Rejected — governance (ADR-003) defines how decisions are
1059
+ * made and enforced. Coherence (ADR-005) defines how decisions
1060
+ * remain structurally consistent over time. These are related
1061
+ * but distinct concerns. Combining them would blur the boundary
1062
+ * between "how we decide" and "how we verify that our decisions
1063
+ * remain valid."
1064
+ *
1065
+ * E. Introduce a "drift" command category:
1066
+ * Rejected — this ADR does not introduce commands. If drift
1067
+ * detection commands are needed, they will be defined in ADR-001
1068
+ * (command registry) and governed by ADR-002 (enforcement), per
1069
+ * the established ADR hierarchy.
1070
+ */
1071
+ // ============================================================================
1072
+ // ADR-005 Metadata
1073
+ // ============================================================================
1074
+ // This ADR is purely conceptual. It exports only its own metadata
1075
+ // for identification and cross-referencing by other ADRs.
1076
+ // It contains no schemas, no middleware, no algorithms, no runtime code.
1077
+ // ============================================================================
1078
+ export const ADR_005_ID = 'ADR-005';
1079
+ export const ADR_005_TITLE = 'System Coherence, Drift Detection, and Self-Governance';
1080
+ export const ADR_005_STATUS = 'Accepted';
1081
+ export const ADR_005_DATE = '2026-01-28';
1082
+ // ============================================================================
1083
+ // ADR-005 Implementation: Constants
1084
+ // ============================================================================
1085
+ /**
1086
+ * The five system-level invariants from ADR-005.
1087
+ */
1088
+ export const COHERENCE_INVARIANTS = [
1089
+ {
1090
+ number: 1,
1091
+ id: 'INV-005-01',
1092
+ description: 'Every enterprise decision must remain traceable over time',
1093
+ domain: 'MEMORY_ANCHORED_REALITY',
1094
+ },
1095
+ {
1096
+ number: 2,
1097
+ id: 'INV-005-02',
1098
+ description: 'No integration or ERP proposal exists without historical context',
1099
+ domain: 'SYSTEM_COHERENCE',
1100
+ },
1101
+ {
1102
+ number: 3,
1103
+ id: 'INV-005-03',
1104
+ description: 'Drift may be detected but never silently corrected',
1105
+ domain: 'DRIFT_DETECTION',
1106
+ },
1107
+ {
1108
+ number: 4,
1109
+ id: 'INV-005-04',
1110
+ description: 'Memory is authoritative; projections are derived',
1111
+ domain: 'MEMORY_ANCHORED_REALITY',
1112
+ },
1113
+ {
1114
+ number: 5,
1115
+ id: 'INV-005-05',
1116
+ description: 'Self-management never bypasses governance',
1117
+ domain: 'GOVERNED_SELF_MANAGEMENT',
1118
+ },
1119
+ ];
1120
+ /**
1121
+ * Coherence domain definitions.
1122
+ */
1123
+ export const COHERENCE_DOMAINS = {
1124
+ SYSTEM_COHERENCE: {
1125
+ name: 'System Coherence',
1126
+ description: 'Structural property: lineage intact, references resolve, governed origins',
1127
+ verifiable: true,
1128
+ },
1129
+ DRIFT_DETECTION: {
1130
+ name: 'Drift Detection',
1131
+ description: 'Temporal divergence observation across 4 categories',
1132
+ verifiable: true,
1133
+ },
1134
+ GOVERNED_SELF_MANAGEMENT: {
1135
+ name: 'Governed Self-Management',
1136
+ description: 'Observe/compare/surface — NEVER correct/decide/remediate',
1137
+ verifiable: true,
1138
+ },
1139
+ MEMORY_ANCHORED_REALITY: {
1140
+ name: 'Memory-Anchored Reality',
1141
+ description: 'Ruvector as authoritative substrate; replay and diffing as primitives',
1142
+ verifiable: true,
1143
+ },
1144
+ HUMAN_OVERSIGHT_BOUNDARY: {
1145
+ name: 'Human Oversight Boundary',
1146
+ description: 'Human mandatory for decisions, drift response, remediation, archival, interpretation',
1147
+ verifiable: false,
1148
+ },
1149
+ };
1150
+ /**
1151
+ * Drift category definitions.
1152
+ */
1153
+ export const DRIFT_CATEGORIES = {
1154
+ SEMANTIC_DRIFT: {
1155
+ name: 'Semantic Drift',
1156
+ description: 'Meaning changes without acknowledgment',
1157
+ detectable_automatically: false,
1158
+ },
1159
+ STRUCTURAL_DRIFT: {
1160
+ name: 'Structural Drift',
1161
+ description: 'Schema or definition shape changes',
1162
+ detectable_automatically: true,
1163
+ },
1164
+ LINEAGE_DRIFT: {
1165
+ name: 'Lineage Drift',
1166
+ description: 'Broken or incomplete derivation chains',
1167
+ detectable_automatically: true,
1168
+ },
1169
+ INTEGRATION_DRIFT: {
1170
+ name: 'Integration Drift',
1171
+ description: 'Integration landscape evolution',
1172
+ detectable_automatically: true,
1173
+ },
1174
+ };
1175
+ /**
1176
+ * Self-management capabilities (all read-only, all allowed).
1177
+ */
1178
+ export const SELF_MANAGEMENT_CAPABILITIES = {
1179
+ OBSERVE_COHERENCE: {
1180
+ name: 'Observe Coherence',
1181
+ boundary: 'OBSERVATION',
1182
+ read_only: true,
1183
+ requires_human: false,
1184
+ },
1185
+ COMPARE_ARTIFACTS: {
1186
+ name: 'Compare Artifacts',
1187
+ boundary: 'OBSERVATION',
1188
+ read_only: true,
1189
+ requires_human: false,
1190
+ },
1191
+ SURFACE_FINDINGS: {
1192
+ name: 'Surface Findings',
1193
+ boundary: 'OBSERVATION',
1194
+ read_only: true,
1195
+ requires_human: false,
1196
+ },
1197
+ TRAVERSE_LINEAGE: {
1198
+ name: 'Traverse Lineage',
1199
+ boundary: 'OBSERVATION',
1200
+ read_only: true,
1201
+ requires_human: false,
1202
+ },
1203
+ DETECT_DRIFT: {
1204
+ name: 'Detect Drift',
1205
+ boundary: 'OBSERVATION',
1206
+ read_only: true,
1207
+ requires_human: false,
1208
+ },
1209
+ REPLAY_SIMULATION: {
1210
+ name: 'Replay Simulation',
1211
+ boundary: 'OBSERVATION',
1212
+ read_only: true,
1213
+ requires_human: false,
1214
+ },
1215
+ };
1216
+ /**
1217
+ * Prohibited autonomous actions (all forbidden, each references an invariant).
1218
+ */
1219
+ export const PROHIBITED_AUTONOMY = {
1220
+ AUTO_CORRECT_DRIFT: {
1221
+ name: 'Auto-Correct Drift',
1222
+ boundary: 'AUTONOMOUS_ACTION',
1223
+ violates_invariant: 3,
1224
+ reason: 'Drift may be detected but never silently corrected',
1225
+ },
1226
+ AUTO_ARCHIVE: {
1227
+ name: 'Auto-Archive',
1228
+ boundary: 'AUTONOMOUS_ACTION',
1229
+ violates_invariant: 5,
1230
+ reason: 'Self-management never bypasses governance',
1231
+ },
1232
+ AUTO_REMEDIATE: {
1233
+ name: 'Auto-Remediate',
1234
+ boundary: 'AUTONOMOUS_ACTION',
1235
+ violates_invariant: 3,
1236
+ reason: 'Remediation requires human decision',
1237
+ },
1238
+ AUTO_RERUN: {
1239
+ name: 'Auto-Rerun',
1240
+ boundary: 'AUTONOMOUS_ACTION',
1241
+ violates_invariant: 5,
1242
+ reason: 'Simulation execution must be human-initiated',
1243
+ },
1244
+ AUTO_RECONCILE: {
1245
+ name: 'Auto-Reconcile',
1246
+ boundary: 'AUTONOMOUS_ACTION',
1247
+ violates_invariant: 4,
1248
+ reason: 'Memory is authoritative; cannot be auto-modified',
1249
+ },
1250
+ AUTO_SEVERITY_SCORE: {
1251
+ name: 'Auto-Severity Score',
1252
+ boundary: 'AUTONOMOUS_ACTION',
1253
+ violates_invariant: 3,
1254
+ reason: 'Severity is a judgment that requires enterprise context',
1255
+ },
1256
+ };
1257
+ /**
1258
+ * Action verb patterns for boundary classification.
1259
+ */
1260
+ export const ACTION_BOUNDARIES = {
1261
+ read_operations: ['query', 'list', 'inspect', 'compare', 'traverse', 'observe', 'detect', 'replay', 'surface', 'check'],
1262
+ write_operations: ['correct', 'fix', 'remediate', 'archive', 'reconcile', 'update', 'delete', 'modify', 'overwrite'],
1263
+ judgment_operations: ['score', 'prioritize', 'recommend', 'decide', 'classify-severity', 'rank'],
1264
+ };
1265
+ // ============================================================================
1266
+ // ADR-005 Implementation: Validation Functions
1267
+ // ============================================================================
1268
+ /**
1269
+ * Classify an action as observation, autonomous, or governed.
1270
+ *
1271
+ * Uses verb pattern matching against ACTION_BOUNDARIES and known
1272
+ * capability/prohibition registries.
1273
+ */
1274
+ export function classifyAction(action) {
1275
+ const normalized = action.toLowerCase().replace(/[_-]/g, ' ');
1276
+ // Check against prohibited autonomy first (most restrictive)
1277
+ for (const [, config] of Object.entries(PROHIBITED_AUTONOMY)) {
1278
+ const keyword = config.name.toLowerCase().replace('auto-', '');
1279
+ if (normalized.includes('auto') && normalized.includes(keyword)) {
1280
+ return {
1281
+ action,
1282
+ boundary: 'AUTONOMOUS_ACTION',
1283
+ is_observation: false,
1284
+ is_autonomous: true,
1285
+ justification: config.reason,
1286
+ violates_invariant: config.violates_invariant,
1287
+ };
1288
+ }
1289
+ }
1290
+ // Check against self-management capabilities
1291
+ for (const [, config] of Object.entries(SELF_MANAGEMENT_CAPABILITIES)) {
1292
+ const keyword = config.name.toLowerCase();
1293
+ if (normalized.includes(keyword)) {
1294
+ return {
1295
+ action,
1296
+ boundary: 'OBSERVATION',
1297
+ is_observation: true,
1298
+ is_autonomous: false,
1299
+ justification: `Allowed self-management capability: ${config.name}`,
1300
+ };
1301
+ }
1302
+ }
1303
+ // Classify by verb patterns
1304
+ const hasReadVerb = ACTION_BOUNDARIES.read_operations.some(v => normalized.includes(v));
1305
+ const hasWriteVerb = ACTION_BOUNDARIES.write_operations.some(v => normalized.includes(v));
1306
+ const hasJudgmentVerb = ACTION_BOUNDARIES.judgment_operations.some(v => normalized.includes(v));
1307
+ if (hasWriteVerb || hasJudgmentVerb) {
1308
+ return {
1309
+ action,
1310
+ boundary: 'AUTONOMOUS_ACTION',
1311
+ is_observation: false,
1312
+ is_autonomous: true,
1313
+ justification: 'Write or judgment operation requires human authorization',
1314
+ violates_invariant: 5,
1315
+ };
1316
+ }
1317
+ if (hasReadVerb) {
1318
+ return {
1319
+ action,
1320
+ boundary: 'OBSERVATION',
1321
+ is_observation: true,
1322
+ is_autonomous: false,
1323
+ justification: 'Read-only operation',
1324
+ };
1325
+ }
1326
+ // Default: unknown actions require governance
1327
+ return {
1328
+ action,
1329
+ boundary: 'GOVERNED_ACTION',
1330
+ is_observation: false,
1331
+ is_autonomous: false,
1332
+ justification: 'Unknown action — requires explicit governance',
1333
+ };
1334
+ }
1335
+ /**
1336
+ * Check if an action is a pure observation (read-only, allowed).
1337
+ */
1338
+ export function isObservation(action) {
1339
+ return classifyAction(action).is_observation;
1340
+ }
1341
+ /**
1342
+ * Check if an action is autonomous (forbidden without human approval).
1343
+ */
1344
+ export function isAutonomous(action) {
1345
+ return classifyAction(action).is_autonomous;
1346
+ }
1347
+ /**
1348
+ * Check if a ProhibitedAutonomy key is in the prohibited list.
1349
+ */
1350
+ export function isProhibitedAction(action) {
1351
+ return action in PROHIBITED_AUTONOMY;
1352
+ }
1353
+ /**
1354
+ * Validate that an action respects the human oversight boundary.
1355
+ * Returns null if valid, or an error message if violated.
1356
+ */
1357
+ export function validateActionBoundary(action, hasHumanAuthorization) {
1358
+ const classification = classifyAction(action);
1359
+ if (classification.is_observation) {
1360
+ return null;
1361
+ }
1362
+ if (classification.is_autonomous) {
1363
+ return (`Action "${action}" is prohibited. ${classification.justification}. ` +
1364
+ `Violates ADR-005 Invariant ${classification.violates_invariant}.`);
1365
+ }
1366
+ if (classification.boundary === 'GOVERNED_ACTION' && !hasHumanAuthorization) {
1367
+ return `Action "${action}" requires human authorization.`;
1368
+ }
1369
+ return null;
1370
+ }
1371
+ //# sourceMappingURL=adr-005-system-coherence-drift-self-governance.js.map