@llm-dev-ops/agentics-cli 1.4.6 → 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 (120) 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/auth/identity-resolver.d.ts +21 -0
  6. package/dist/auth/identity-resolver.d.ts.map +1 -0
  7. package/dist/auth/identity-resolver.js +68 -0
  8. package/dist/auth/identity-resolver.js.map +1 -0
  9. package/dist/auth/index.d.ts +2 -0
  10. package/dist/auth/index.d.ts.map +1 -1
  11. package/dist/auth/index.js +2 -0
  12. package/dist/auth/index.js.map +1 -1
  13. package/dist/auth/role-permissions.d.ts +12 -0
  14. package/dist/auth/role-permissions.d.ts.map +1 -0
  15. package/dist/auth/role-permissions.js +43 -0
  16. package/dist/auth/role-permissions.js.map +1 -0
  17. package/dist/cli/index.js +30 -134
  18. package/dist/cli/index.js.map +1 -1
  19. package/dist/commands/erp.d.ts.map +1 -1
  20. package/dist/commands/erp.js +62 -0
  21. package/dist/commands/erp.js.map +1 -1
  22. package/dist/commands/login.d.ts.map +1 -1
  23. package/dist/commands/login.js +25 -0
  24. package/dist/commands/login.js.map +1 -1
  25. package/dist/commands/logout.d.ts.map +1 -1
  26. package/dist/commands/logout.js +4 -1
  27. package/dist/commands/logout.js.map +1 -1
  28. package/dist/commands/plan.d.ts.map +1 -1
  29. package/dist/commands/plan.js +6 -5
  30. package/dist/commands/plan.js.map +1 -1
  31. package/dist/commands/simulate.d.ts.map +1 -1
  32. package/dist/commands/simulate.js +57 -1
  33. package/dist/commands/simulate.js.map +1 -1
  34. package/dist/commands/whoami.d.ts +4 -0
  35. package/dist/commands/whoami.d.ts.map +1 -1
  36. package/dist/commands/whoami.js +22 -5
  37. package/dist/commands/whoami.js.map +1 -1
  38. package/dist/contracts/adr-002-operational-enforcement.d.ts +684 -0
  39. package/dist/contracts/adr-002-operational-enforcement.d.ts.map +1 -0
  40. package/dist/contracts/adr-002-operational-enforcement.js +671 -0
  41. package/dist/contracts/adr-002-operational-enforcement.js.map +1 -0
  42. package/dist/contracts/adr-003-governance-architecture.d.ts +766 -0
  43. package/dist/contracts/adr-003-governance-architecture.d.ts.map +1 -0
  44. package/dist/contracts/adr-003-governance-architecture.js +773 -0
  45. package/dist/contracts/adr-003-governance-architecture.js.map +1 -0
  46. package/dist/contracts/adr-004-enterprise-integration-memory.d.ts +1150 -0
  47. package/dist/contracts/adr-004-enterprise-integration-memory.d.ts.map +1 -0
  48. package/dist/contracts/adr-004-enterprise-integration-memory.js +1158 -0
  49. package/dist/contracts/adr-004-enterprise-integration-memory.js.map +1 -0
  50. package/dist/contracts/adr-005-system-coherence-drift-self-governance.d.ts +1393 -0
  51. package/dist/contracts/adr-005-system-coherence-drift-self-governance.d.ts.map +1 -0
  52. package/dist/contracts/adr-005-system-coherence-drift-self-governance.js +1371 -0
  53. package/dist/contracts/adr-005-system-coherence-drift-self-governance.js.map +1 -0
  54. package/dist/contracts/adr-command-semantics.d.ts +150 -0
  55. package/dist/contracts/adr-command-semantics.d.ts.map +1 -0
  56. package/dist/contracts/adr-command-semantics.js +984 -0
  57. package/dist/contracts/adr-command-semantics.js.map +1 -0
  58. package/dist/contracts/index.d.ts +5 -0
  59. package/dist/contracts/index.d.ts.map +1 -1
  60. package/dist/contracts/index.js +16 -0
  61. package/dist/contracts/index.js.map +1 -1
  62. package/dist/enterprise/index.d.ts +16 -0
  63. package/dist/enterprise/index.d.ts.map +1 -0
  64. package/dist/enterprise/index.js +17 -0
  65. package/dist/enterprise/index.js.map +1 -0
  66. package/dist/enterprise/integration-registry.d.ts +73 -0
  67. package/dist/enterprise/integration-registry.d.ts.map +1 -0
  68. package/dist/enterprise/integration-registry.js +252 -0
  69. package/dist/enterprise/integration-registry.js.map +1 -0
  70. package/dist/enterprise/lineage.d.ts +73 -0
  71. package/dist/enterprise/lineage.d.ts.map +1 -0
  72. package/dist/enterprise/lineage.js +218 -0
  73. package/dist/enterprise/lineage.js.map +1 -0
  74. package/dist/gates/argument-guard.d.ts +39 -0
  75. package/dist/gates/argument-guard.d.ts.map +1 -0
  76. package/dist/gates/argument-guard.js +180 -0
  77. package/dist/gates/argument-guard.js.map +1 -0
  78. package/dist/gates/index.d.ts +5 -0
  79. package/dist/gates/index.d.ts.map +1 -1
  80. package/dist/gates/index.js +7 -0
  81. package/dist/gates/index.js.map +1 -1
  82. package/dist/gates/lineage-gate.d.ts +55 -0
  83. package/dist/gates/lineage-gate.d.ts.map +1 -0
  84. package/dist/gates/lineage-gate.js +127 -0
  85. package/dist/gates/lineage-gate.js.map +1 -0
  86. package/dist/modules/help-renderer.d.ts +25 -0
  87. package/dist/modules/help-renderer.d.ts.map +1 -0
  88. package/dist/modules/help-renderer.js +163 -0
  89. package/dist/modules/help-renderer.js.map +1 -0
  90. package/dist/modules/index.d.ts +1 -0
  91. package/dist/modules/index.d.ts.map +1 -1
  92. package/dist/modules/index.js +1 -0
  93. package/dist/modules/index.js.map +1 -1
  94. package/dist/server/index.d.ts +2 -0
  95. package/dist/server/index.d.ts.map +1 -1
  96. package/dist/server/index.js +16 -1
  97. package/dist/server/index.js.map +1 -1
  98. package/dist/server/routes/identity.d.ts +9 -0
  99. package/dist/server/routes/identity.d.ts.map +1 -0
  100. package/dist/server/routes/identity.js +100 -0
  101. package/dist/server/routes/identity.js.map +1 -0
  102. package/dist/server/routes/index.d.ts +2 -0
  103. package/dist/server/routes/index.d.ts.map +1 -1
  104. package/dist/server/routes/index.js +2 -0
  105. package/dist/server/routes/index.js.map +1 -1
  106. package/dist/server/routes/lineage.d.ts +15 -0
  107. package/dist/server/routes/lineage.d.ts.map +1 -0
  108. package/dist/server/routes/lineage.js +128 -0
  109. package/dist/server/routes/lineage.js.map +1 -0
  110. package/dist/types/index.d.ts +132 -0
  111. package/dist/types/index.d.ts.map +1 -1
  112. package/dist/utils/identity-store.d.ts +31 -0
  113. package/dist/utils/identity-store.d.ts.map +1 -0
  114. package/dist/utils/identity-store.js +97 -0
  115. package/dist/utils/identity-store.js.map +1 -0
  116. package/dist/utils/index.d.ts +2 -0
  117. package/dist/utils/index.d.ts.map +1 -1
  118. package/dist/utils/index.js +1 -0
  119. package/dist/utils/index.js.map +1 -1
  120. package/package.json +1 -1
@@ -0,0 +1,773 @@
1
+ /**
2
+ * ADR-003: Governance Architecture for the Agentics CLI Control Plane
3
+ *
4
+ * STATUS: Accepted
5
+ * DATE: 2026-01-28
6
+ * AUTHORS: Platform Engineering
7
+ * SUPERSEDES: None
8
+ * DEPENDS ON: None (conceptual anchor for ADR-001 and ADR-002)
9
+ * REFERENCED BY: ADR-001, ADR-002, all future implementation ADRs
10
+ *
11
+ * ============================================================================
12
+ * POSITIONING STATEMENT
13
+ * ============================================================================
14
+ *
15
+ * The Agentics CLI is a governed control plane, not a conversational
16
+ * interface. It orchestrates enterprise simulation, planning, deployment,
17
+ * and compliance workflows through a deterministic, auditable pipeline.
18
+ *
19
+ * Natural language exists solely to seed synthesis — the intentional,
20
+ * bounded generation of structured artifacts. Outside of synthesis,
21
+ * the CLI operates on stable identifiers that resolve to persisted
22
+ * manifests, plans, simulations, and policies.
23
+ *
24
+ * This ADR defines the conceptual architecture that governs all CLI
25
+ * behavior. It introduces no new commands, schemas, middleware, or
26
+ * implementation artifacts. Its role is to establish the domain model,
27
+ * bounded contexts, and invariants that all present and future
28
+ * implementations must respect.
29
+ *
30
+ * ============================================================================
31
+ * CONTEXT
32
+ * ============================================================================
33
+ *
34
+ * The Agentics CLI has two accepted ADRs:
35
+ *
36
+ * ADR-001: Command Argument Semantics & Synthesis Governance
37
+ * Defines the argument type system (ID, NATURAL_LANGUAGE, SELECTOR),
38
+ * the synthesis governance matrix (REQUIRED, FORBIDDEN, COMMITMENT_GRADE),
39
+ * and the command registry that serves as the single source of truth.
40
+ *
41
+ * ADR-002: Operational Enforcement of CLI Governance
42
+ * Defines how ADR-001's rules are mechanically enforced through
43
+ * the 5-gate pipeline, runtime validation middleware, CI checks,
44
+ * and regression prevention.
45
+ *
46
+ * What is missing is a DDD-level conceptual framing that explains:
47
+ *
48
+ * - What the CLI control plane IS as an architectural concept
49
+ * - What bounded contexts exist and where their borders lie
50
+ * - Where governance logic BELONGS vs where it must NOT exist
51
+ * - What invariants must NEVER be violated, regardless of
52
+ * implementation choices
53
+ *
54
+ * Without this framing:
55
+ *
56
+ * - New contributors cannot reason about where to add new behavior
57
+ * - Governance logic migrates into command handlers (wrong boundary)
58
+ * - Invariants are only implicit in code, not stated as design law
59
+ * - Future ADRs lack a conceptual anchor to reference
60
+ * - The distinction between "the CLI does X" and "this domain owns X"
61
+ * is unclear, leading to scattered responsibility
62
+ *
63
+ * This ADR fills that gap.
64
+ *
65
+ * ============================================================================
66
+ * DECISION
67
+ * ============================================================================
68
+ *
69
+ * The Agentics CLI is organized into five bounded contexts (domains),
70
+ * each with clear responsibilities, ownership rules, and invariants.
71
+ * All governance is centralized. No domain may independently define
72
+ * or override governance rules.
73
+ *
74
+ * The five domains are:
75
+ *
76
+ * 1. CLI Control Plane
77
+ * 2. Command Semantics
78
+ * 3. Synthesis Governance
79
+ * 4. Execution & State Mutation
80
+ * 5. Governance Source of Truth
81
+ *
82
+ * ============================================================================
83
+ * DOMAIN 1: CLI CONTROL PLANE
84
+ * ============================================================================
85
+ *
86
+ * DEFINITION:
87
+ *
88
+ * The CLI Control Plane is the outermost boundary of the Agentics CLI.
89
+ * It is the execution surface through which all user intent enters the
90
+ * system and all system responses exit.
91
+ *
92
+ * PURPOSE:
93
+ *
94
+ * The Control Plane exists to:
95
+ * - Accept user input as structured command invocations
96
+ * - Route validated input to the appropriate domain handler
97
+ * - Enforce governance rules BEFORE any side effects occur
98
+ * - Render deterministic output in the requested format
99
+ * - Exit with a well-defined exit code
100
+ *
101
+ * RESPONSIBILITIES:
102
+ *
103
+ * - Argument parsing (string → CommandObject)
104
+ * - Gate pipeline orchestration (Gates 1–5 in sequence)
105
+ * - Command dispatch (validated CommandObject → handler)
106
+ * - Output rendering (result → formatted string)
107
+ * - Exit code management (SUCCESS, ARG_VALIDATION_ERROR, etc.)
108
+ *
109
+ * WHAT THE CONTROL PLANE EXPLICITLY DOES NOT DO:
110
+ *
111
+ * - Business logic: It does not interpret, transform, or enrich
112
+ * the user's request beyond parsing and routing.
113
+ *
114
+ * - State storage: It does not cache, persist, or remember anything
115
+ * between invocations. Every CLI run is stateless.
116
+ *
117
+ * - Inference: It does not guess, suggest, or auto-correct. If input
118
+ * does not match a declared contract, execution is rejected.
119
+ *
120
+ * - Negotiation: It does not ask clarifying questions, offer
121
+ * alternatives, or enter conversational modes. The user's
122
+ * command is accepted or rejected.
123
+ *
124
+ * - Direct API calls: It delegates all network communication to
125
+ * adapter modules. The Control Plane never constructs HTTP
126
+ * requests or parses HTTP responses.
127
+ *
128
+ * BOUNDARY RULE:
129
+ *
130
+ * Nothing outside of src/cli/index.ts and src/gates/ constitutes the
131
+ * Control Plane. Command handlers (src/commands/) are downstream of
132
+ * the Control Plane — they receive pre-validated input and return
133
+ * structured results.
134
+ *
135
+ * ============================================================================
136
+ * DOMAIN 2: COMMAND SEMANTICS
137
+ * ============================================================================
138
+ *
139
+ * DEFINITION:
140
+ *
141
+ * The Command Semantics domain defines what each CLI command means:
142
+ * its argument contract, its synthesis classification, and its
143
+ * behavioral constraints (irreversibility, confirmation requirements).
144
+ *
145
+ * RELATIONSHIP TO ADR-001:
146
+ *
147
+ * ADR-001 is the canonical expression of this domain. The
148
+ * COMMAND_REGISTRY is the domain's aggregate root — the single
149
+ * object from which all command knowledge is derived.
150
+ *
151
+ * WHY SEMANTICS ARE DECLARATIVE, NOT INFERRED:
152
+ *
153
+ * Each command's meaning is declared upfront in a registry entry.
154
+ * The system does not infer semantics from the user's input, from
155
+ * the command handler's behavior, or from runtime context.
156
+ *
157
+ * This is a deliberate architectural choice:
158
+ *
159
+ * - Declarative semantics are auditable. A reviewer can read the
160
+ * registry and know exactly what every command accepts.
161
+ *
162
+ * - Declarative semantics are testable. Tests are mechanically
163
+ * derived from the registry — no manual test authoring needed
164
+ * for argument contract coverage.
165
+ *
166
+ * - Declarative semantics are stable. Changing a command's behavior
167
+ * requires changing its registry entry, which is a reviewable,
168
+ * versioned, diff-friendly operation.
169
+ *
170
+ * - Inferred semantics are fragile. If the system guesses what the
171
+ * user meant, it will sometimes guess wrong, and the user has
172
+ * no way to predict when that will happen.
173
+ *
174
+ * DOMAIN VOCABULARY:
175
+ *
176
+ * CommandSpec — The complete declaration of a command's contract
177
+ * ArgumentSpec — The declaration of a single positional argument
178
+ * ArgumentType — The classification of an argument: ID,
179
+ * NATURAL_LANGUAGE, or SELECTOR
180
+ * SynthesisClass — The synthesis governance classification:
181
+ * SYNTHESIS_REQUIRED, SYNTHESIS_FORBIDDEN,
182
+ * or COMMITMENT_GRADE
183
+ *
184
+ * OWNERSHIP:
185
+ *
186
+ * This domain is owned by the COMMAND_REGISTRY in
187
+ * src/contracts/adr-command-semantics.ts. No other file may define
188
+ * command semantics. No command handler may override its own
189
+ * argument contract.
190
+ *
191
+ * ============================================================================
192
+ * DOMAIN 3: SYNTHESIS GOVERNANCE
193
+ * ============================================================================
194
+ *
195
+ * DEFINITION:
196
+ *
197
+ * The Synthesis Governance domain defines the rules that control
198
+ * when, where, and how LLM-powered synthesis may be invoked by
199
+ * CLI commands.
200
+ *
201
+ * CONCEPTUAL RULES:
202
+ *
203
+ * Rule 1: Synthesis is a controlled capability, not a default.
204
+ *
205
+ * The CLI does not synthesize by default. Synthesis only occurs
206
+ * when a command is explicitly classified as SYNTHESIS_REQUIRED
207
+ * or COMMITMENT_GRADE. All other commands are synthesis-free.
208
+ *
209
+ * Rule 2: Synthesis is scoped to creation and transformation.
210
+ *
211
+ * Synthesis creates new artifacts (plans, simulations, policies)
212
+ * or transforms existing ones (export, map, surface). It never
213
+ * reads, lists, inspects, or deletes existing artifacts.
214
+ *
215
+ * Rule 3: Synthesis boundaries are declared, not detected.
216
+ *
217
+ * Whether a command may invoke synthesis is determined by its
218
+ * SynthesisClass in the registry — not by the content of the
219
+ * user's input, not by a runtime feature flag, and not by the
220
+ * command handler's implementation.
221
+ *
222
+ * Rule 4: Synthesis is auditable.
223
+ *
224
+ * Because synthesis classification is declared in the registry,
225
+ * any reviewer can enumerate exactly which commands invoke LLMs.
226
+ * This enables compliance audits, cost analysis, and security
227
+ * review without reading implementation code.
228
+ *
229
+ * Rule 5: Synthesis governance cannot be relaxed at runtime.
230
+ *
231
+ * There is no environment variable, flag, or configuration that
232
+ * converts a SYNTHESIS_FORBIDDEN command into one that allows
233
+ * synthesis. The classification is immutable at runtime.
234
+ *
235
+ * WHY THIS MATTERS:
236
+ *
237
+ * In an enterprise context, LLM invocation has cost, latency, and
238
+ * compliance implications. Uncontrolled synthesis means:
239
+ *
240
+ * - Unpredictable costs (read commands accidentally invoking LLMs)
241
+ * - Data leakage risk (sensitive context sent to inference endpoints)
242
+ * - Non-determinism (same input producing different outputs)
243
+ * - Audit failure (no clear record of which commands called LLMs)
244
+ *
245
+ * By making synthesis governance a first-class domain, the CLI
246
+ * ensures that LLM invocation is intentional, bounded, and traceable.
247
+ *
248
+ * ============================================================================
249
+ * DOMAIN 4: EXECUTION & STATE MUTATION
250
+ * ============================================================================
251
+ *
252
+ * DEFINITION:
253
+ *
254
+ * The Execution & State Mutation domain defines the conceptual phases
255
+ * through which a command progresses from user intent to system effect.
256
+ * It establishes a clear separation between planning what to do and
257
+ * actually doing it.
258
+ *
259
+ * THE FOUR PHASES:
260
+ *
261
+ * Phase 1: PLANNING
262
+ *
263
+ * The user creates a plan, simulation, or policy. At this phase,
264
+ * no real-world state changes occur. The system generates artifacts
265
+ * that describe what WOULD happen.
266
+ *
267
+ * Commands in this phase:
268
+ * plan create, simulate create, policy create, quantify create
269
+ *
270
+ * Characteristics:
271
+ * - May invoke synthesis (SYNTHESIS_REQUIRED)
272
+ * - Produces persisted artifacts (plans, simulations, policies)
273
+ * - Artifacts are inert — they describe intent, not action
274
+ * - Reversible — artifacts can be deleted
275
+ *
276
+ * Phase 2: EXECUTION
277
+ *
278
+ * The user executes a previously planned action. This phase
279
+ * transitions artifacts from "intent" to "in-progress." The
280
+ * system begins performing real-world state changes.
281
+ *
282
+ * Commands in this phase:
283
+ * simulate run, deploy run, policy enable
284
+ *
285
+ * Characteristics:
286
+ * - COMMITMENT_GRADE — requires ID + confirmation
287
+ * - Irreversible — execution cannot be undone, only compensated
288
+ * - Requires the artifact to exist (ID must resolve)
289
+ * - May invoke synthesis as part of execution
290
+ *
291
+ * Phase 3: COMMITMENT
292
+ *
293
+ * The user approves or finalizes a result. This phase locks an
294
+ * artifact's state, preventing further modification.
295
+ *
296
+ * Commands in this phase:
297
+ * plan approve
298
+ *
299
+ * Characteristics:
300
+ * - COMMITMENT_GRADE — requires ID + confirmation
301
+ * - Irreversible — approval cannot be retracted
302
+ * - The artifact transitions to a terminal state
303
+ *
304
+ * Phase 4: ROLLBACK (Compensating Action)
305
+ *
306
+ * The user reverses the effects of a previous execution. Rollback
307
+ * does not undo — it applies a compensating action that
308
+ * counteracts the original execution's effects.
309
+ *
310
+ * Commands in this phase:
311
+ * deploy rollback
312
+ *
313
+ * Characteristics:
314
+ * - COMMITMENT_GRADE — requires ID + confirmation
315
+ * - Irreversible — the rollback itself cannot be rolled back
316
+ * - Creates a new state (post-rollback), not a restored state
317
+ *
318
+ * WHY THIS SEPARATION MATTERS:
319
+ *
320
+ * - Users can plan without risk (Phase 1 is always safe)
321
+ * - Execution requires explicit commitment (Phase 2 demands IDs
322
+ * and confirmation)
323
+ * - Approval is a one-way gate (Phase 3 prevents retroactive
324
+ * changes to approved artifacts)
325
+ * - Rollback is a forward action (Phase 4 does not pretend to
326
+ * undo — it explicitly compensates)
327
+ *
328
+ * CRITICAL INVARIANT:
329
+ *
330
+ * No command may skip phases. You cannot execute without a plan.
331
+ * You cannot approve without execution results. You cannot rollback
332
+ * without a prior deployment. The phase model is monotonically
333
+ * forward — there is no "go back to planning" from an executed state.
334
+ *
335
+ * ============================================================================
336
+ * DOMAIN 5: GOVERNANCE SOURCE OF TRUTH
337
+ * ============================================================================
338
+ *
339
+ * DEFINITION:
340
+ *
341
+ * The Governance Source of Truth domain defines where authoritative
342
+ * governance rules live and why they must never be duplicated.
343
+ *
344
+ * WHY GOVERNANCE MUST BE CENTRALIZED:
345
+ *
346
+ * The COMMAND_REGISTRY in src/contracts/adr-command-semantics.ts is
347
+ * the single source of truth for command governance. This is not a
348
+ * preference — it is an architectural invariant.
349
+ *
350
+ * Centralization ensures:
351
+ *
352
+ * - ONE place to review command contracts
353
+ * - ONE place to audit synthesis boundaries
354
+ * - ONE place to verify argument type rules
355
+ * - ONE place to check irreversibility flags
356
+ *
357
+ * If governance rules were scattered across command handlers, gate
358
+ * implementations, test files, and help text, there would be no
359
+ * reliable way to answer: "What does this command accept?"
360
+ *
361
+ * WHY DUPLICATION IS FORBIDDEN:
362
+ *
363
+ * Duplicated governance always diverges. When a rule exists in two
364
+ * places, one of them will eventually be wrong, and there is no
365
+ * arbiter to determine which is authoritative.
366
+ *
367
+ * Concretely, duplication means:
368
+ *
369
+ * - A command handler that re-checks argument types duplicates
370
+ * the gate's logic and may apply different rules
371
+ * - A help string that hard-codes argument names duplicates the
372
+ * registry and may show different names than the validator uses
373
+ * - A test that hard-codes expected behavior duplicates the
374
+ * registry and may test for stale behavior after a schema change
375
+ *
376
+ * The rule is: DERIVE, NEVER DUPLICATE.
377
+ *
378
+ * All consumers (gates, help, tests, CI) must import from the
379
+ * COMMAND_REGISTRY. They must not maintain their own copies of
380
+ * governance data.
381
+ *
382
+ * GOVERNANCE HIERARCHY:
383
+ *
384
+ * Level 1: ADR-003 (this document) — Conceptual model
385
+ * Defines WHAT domains exist and WHAT invariants hold.
386
+ * Does not contain implementation.
387
+ *
388
+ * Level 2: ADR-001 — Command semantics
389
+ * Defines WHICH commands exist and WHAT their contracts are.
390
+ * Contains the COMMAND_REGISTRY as executable data.
391
+ *
392
+ * Level 3: ADR-002 — Operational enforcement
393
+ * Defines HOW governance is enforced at runtime and in CI.
394
+ * Contains enforcement configuration and pipeline definitions.
395
+ *
396
+ * Future ADRs must reference this hierarchy. New implementation
397
+ * ADRs (Level 3) must not redefine concepts from Level 1.
398
+ * New semantic ADRs (Level 2) must not violate invariants
399
+ * from Level 1.
400
+ *
401
+ * ============================================================================
402
+ * INVARIANTS (NON-NEGOTIABLE)
403
+ * ============================================================================
404
+ *
405
+ * The following are system-level truths that all implementations
406
+ * must preserve. Violating any invariant is a bug, regardless of
407
+ * the feature being built or the deadline being met.
408
+ *
409
+ * INVARIANT 1: IDs and natural language are conceptually distinct.
410
+ *
411
+ * An ID resolves a persisted artifact. Natural language seeds
412
+ * synthesis. These are not interchangeable. No command may accept
413
+ * either type interchangeably. No heuristic may auto-detect
414
+ * which type the user intended.
415
+ *
416
+ * INVARIANT 2: Synthesis is opt-in, scoped, and auditable.
417
+ *
418
+ * Synthesis (LLM invocation) occurs only when a command's
419
+ * SynthesisClass is SYNTHESIS_REQUIRED or COMMITMENT_GRADE.
420
+ * The scope of synthesis is the command's declared contract.
421
+ * The audit trail is the COMMAND_REGISTRY itself.
422
+ *
423
+ * INVARIANT 3: No command may mutate state without passing governance.
424
+ *
425
+ * The 5-gate pipeline is the only path to command execution.
426
+ * There are no backdoors, no debug modes, no admin overrides
427
+ * that bypass governance validation.
428
+ *
429
+ * INVARIANT 4: Read-only commands never invoke synthesis.
430
+ *
431
+ * Commands classified as SYNTHESIS_FORBIDDEN must not invoke
432
+ * LLMs under any circumstance. This includes list, inspect,
433
+ * whoami, usage, and help commands. No runtime condition may
434
+ * override this.
435
+ *
436
+ * INVARIANT 5: Help output cannot diverge from governance rules.
437
+ *
438
+ * Help text is derived from the COMMAND_REGISTRY, not authored
439
+ * independently. If help says a command accepts an ID, the
440
+ * registry must declare that argument as type ID. Divergence
441
+ * between help and validation is a governance failure.
442
+ *
443
+ * INVARIANT 6: Governance is centralized in the registry.
444
+ *
445
+ * The COMMAND_REGISTRY is the single source of truth for all
446
+ * command contracts. No other file, module, or artifact may
447
+ * independently define command semantics, argument types,
448
+ * synthesis classifications, or behavioral constraints.
449
+ *
450
+ * INVARIANT 7: Execution phases are monotonically forward.
451
+ *
452
+ * A command's lifecycle progresses through Planning → Execution →
453
+ * Commitment. There is no mechanism to revert a committed artifact
454
+ * to a planning state. Rollback is a compensating action, not an
455
+ * undo operation.
456
+ *
457
+ * ============================================================================
458
+ * RELATIONSHIP TO EXISTING ADRS
459
+ * ============================================================================
460
+ *
461
+ * ADR-003 (this document) sits above ADR-001 and ADR-002 in the
462
+ * governance hierarchy:
463
+ *
464
+ * ADR-003 → defines the conceptual model (domains + invariants)
465
+ * ↓
466
+ * ADR-001 → instantiates the model (command registry + types)
467
+ * ↓
468
+ * ADR-002 → enforces the model (gates + CI + regression tests)
469
+ *
470
+ * ADR-003 does NOT modify, replace, or conflict with ADR-001 or
471
+ * ADR-002. It provides the conceptual anchor that both ADRs
472
+ * implicitly assumed but did not explicitly state.
473
+ *
474
+ * Specifically:
475
+ *
476
+ * - ADR-001's COMMAND_REGISTRY is an instance of Domain 2
477
+ * (Command Semantics) and Domain 3 (Synthesis Governance).
478
+ *
479
+ * - ADR-002's gate pipeline is the enforcement mechanism for
480
+ * Domain 1 (CLI Control Plane) and Domain 5 (Governance
481
+ * Source of Truth).
482
+ *
483
+ * - ADR-001's argument types (ID, NATURAL_LANGUAGE, SELECTOR)
484
+ * are the vocabulary of Domain 2, grounded in Invariant 1.
485
+ *
486
+ * - ADR-002's CI checks are the verification mechanism for
487
+ * Invariants 3, 5, and 6.
488
+ *
489
+ * No existing ADR needs to be edited as a result of ADR-003.
490
+ *
491
+ * ============================================================================
492
+ * CONSEQUENCES
493
+ * ============================================================================
494
+ *
495
+ * POSITIVE:
496
+ *
497
+ * - New contributors can read this ADR and understand where
498
+ * governance lives (Domain 5), what domains exist (1–5),
499
+ * and what invariants are non-negotiable (1–7).
500
+ *
501
+ * - Future ADRs can reference ADR-003 as a conceptual anchor.
502
+ * Instead of re-explaining why governance is centralized,
503
+ * they can cite "ADR-003, Invariant 6."
504
+ *
505
+ * - Implementation details can change without violating
506
+ * invariants. The gate pipeline could be refactored, commands
507
+ * could be added or removed, and the CI system could be
508
+ * replaced — as long as the invariants hold.
509
+ *
510
+ * - The distinction between "what the CLI does" (implementation)
511
+ * and "what the CLI IS" (architecture) is now explicit.
512
+ *
513
+ * - The document reads as platform architecture, not tooling
514
+ * notes, making it appropriate for stakeholder review.
515
+ *
516
+ * NEGATIVE:
517
+ *
518
+ * - This document adds a conceptual layer that must be
519
+ * maintained. If the domain model changes, ADR-003 must be
520
+ * updated before implementation ADRs.
521
+ *
522
+ * - Contributors must understand three ADRs (003, 001, 002)
523
+ * instead of two. However, ADR-003 is the shortest and most
524
+ * conceptual, serving as an on-ramp rather than a burden.
525
+ *
526
+ * ============================================================================
527
+ * EXPLICIT NON-GOALS
528
+ * ============================================================================
529
+ *
530
+ * 1. This ADR does NOT introduce new commands or CLI behavior.
531
+ * It defines domains and invariants, not features.
532
+ *
533
+ * 2. This ADR does NOT contain schemas, types, or field definitions.
534
+ * Those belong in ADR-001 (semantics) and ADR-002 (enforcement).
535
+ *
536
+ * 3. This ADR does NOT specify middleware interfaces or gate
537
+ * implementations. Those belong in ADR-002.
538
+ *
539
+ * 4. This ADR does NOT define CI pipelines, test harnesses, or
540
+ * build configurations. Those belong in ADR-002.
541
+ *
542
+ * 5. This ADR does NOT contain pseudocode or implementation details.
543
+ * It describes what IS, not how it WORKS.
544
+ *
545
+ * 6. This ADR does NOT modify ADR-001 or ADR-002. It provides
546
+ * context that both ADRs already implicitly operate within.
547
+ *
548
+ * ============================================================================
549
+ * CONCEPTUAL ARCHITECTURE (TEXT DIAGRAM)
550
+ * ============================================================================
551
+ *
552
+ * The following describes the directional relationships between
553
+ * domains. Arrows indicate "governs" or "flows into."
554
+ *
555
+ * ┌─────────────────────────────────────────────────────────────┐
556
+ * │ GOVERNANCE SOURCE OF TRUTH (Domain 5) │
557
+ * │ │
558
+ * │ COMMAND_REGISTRY: the single authoritative definition │
559
+ * │ of all command contracts, argument types, and synthesis │
560
+ * │ classifications. │
561
+ * │ │
562
+ * │ Invariants 1–7 apply to all domains below. │
563
+ * └────────────────────────┬────────────────────────────────────┘
564
+ * │ governs
565
+ * ┌─────────────┴──────────────┐
566
+ * │ │
567
+ * ▼ ▼
568
+ * ┌─────────────────────┐ ┌─────────────────────────┐
569
+ * │ COMMAND SEMANTICS │ │ SYNTHESIS GOVERNANCE │
570
+ * │ (Domain 2) │ │ (Domain 3) │
571
+ * │ │ │ │
572
+ * │ What commands mean. │ │ When synthesis may occur. │
573
+ * │ Argument contracts. │ │ REQUIRED / FORBIDDEN / │
574
+ * │ ID vs NL vs SELECTOR│ │ COMMITMENT_GRADE │
575
+ * │ │ │ │
576
+ * │ Owned by: ADR-001 │ │ Owned by: ADR-001 │
577
+ * └────────┬────────────┘ └────────────┬────────────┘
578
+ * │ declares │ classifies
579
+ * └──────────┬────────────────────┘
580
+ * │
581
+ * ▼
582
+ * ┌─────────────────────────────────────────────────────────────┐
583
+ * │ CLI CONTROL PLANE (Domain 1) │
584
+ * │ │
585
+ * │ Parse → Gate 1 → Gate 2 → Gate 3 → Gate 4 → Gate 5 │
586
+ * │ │ │
587
+ * │ Dispatch │
588
+ * │ │ │
589
+ * │ Render + Exit │
590
+ * │ │
591
+ * │ Owned by: src/cli/index.ts + src/gates/ │
592
+ * │ Enforced by: ADR-002 │
593
+ * └────────────────────────┬────────────────────────────────────┘
594
+ * │ dispatches to
595
+ * ▼
596
+ * ┌─────────────────────────────────────────────────────────────┐
597
+ * │ EXECUTION & STATE MUTATION (Domain 4) │
598
+ * │ │
599
+ * │ Planning → Execution → Commitment → Rollback │
600
+ * │ │
601
+ * │ Each phase has different governance requirements. │
602
+ * │ Phase transitions are irreversible. │
603
+ * │ │
604
+ * │ Owned by: src/commands/ + src/adapters/ │
605
+ * └─────────────────────────────────────────────────────────────┘
606
+ *
607
+ * DIRECTIONAL RESPONSIBILITIES:
608
+ *
609
+ * Domain 5 → Domain 2: The registry defines command semantics.
610
+ * Domain 5 → Domain 3: The registry defines synthesis boundaries.
611
+ * Domain 2 → Domain 1: Semantics inform the gate pipeline.
612
+ * Domain 3 → Domain 1: Synthesis classification gates NL input.
613
+ * Domain 1 → Domain 4: The control plane dispatches to execution.
614
+ * Domain 4 → (external): Execution invokes downstream services.
615
+ *
616
+ * ============================================================================
617
+ * ANTI-PATTERNS (WHAT FUTURE CONTRIBUTORS MUST NOT DO)
618
+ * ============================================================================
619
+ *
620
+ * ANTI-PATTERN 1: GOVERNANCE DRIFT
621
+ *
622
+ * What it looks like:
623
+ * A command handler checks argument types independently of the
624
+ * gate pipeline. The handler's check uses different rules than
625
+ * the Argument Guard gate.
626
+ *
627
+ * Why it's wrong:
628
+ * Two validation layers with different rules means the CLI's
629
+ * behavior depends on which layer runs first and whether both
630
+ * agree. This is non-deterministic and unauditable.
631
+ *
632
+ * What to do instead:
633
+ * Trust the gate pipeline. Command handlers receive pre-validated
634
+ * input. They must not re-validate argument types.
635
+ *
636
+ * ANTI-PATTERN 2: SHADOW REGISTRIES
637
+ *
638
+ * What it looks like:
639
+ * A new module maintains its own list of "supported commands"
640
+ * or "synthesis-allowed commands" separate from COMMAND_REGISTRY.
641
+ *
642
+ * Why it's wrong:
643
+ * Two registries will diverge. When they do, there is no arbiter.
644
+ * Users will experience inconsistent behavior depending on which
645
+ * registry a particular code path consulted.
646
+ *
647
+ * What to do instead:
648
+ * Import from COMMAND_REGISTRY. If the registry doesn't have what
649
+ * you need, extend the CommandSpec type and add the field to the
650
+ * registry. One registry, one truth.
651
+ *
652
+ * ANTI-PATTERN 3: SYNTHESIS CREEP
653
+ *
654
+ * What it looks like:
655
+ * A "read-only" command starts invoking an LLM "just to format
656
+ * the output" or "just to summarize the results."
657
+ *
658
+ * Why it's wrong:
659
+ * If a command's SynthesisClass is SYNTHESIS_FORBIDDEN, it must
660
+ * not invoke LLMs for any reason. Formatting and summarization
661
+ * are still synthesis. The boundary is absolute.
662
+ *
663
+ * What to do instead:
664
+ * If a command needs synthesis, change its SynthesisClass in the
665
+ * registry. This is a versioned, reviewed change that goes through
666
+ * the ADR process. Synthesis scope is never implicit.
667
+ *
668
+ * ANTI-PATTERN 4: PHASE SKIPPING
669
+ *
670
+ * What it looks like:
671
+ * A "quick deploy" feature that creates a plan and immediately
672
+ * executes it in a single command, skipping the planning phase.
673
+ *
674
+ * Why it's wrong:
675
+ * The phase model exists to give users a safe checkpoint between
676
+ * intent and action. Skipping phases removes that safety.
677
+ *
678
+ * What to do instead:
679
+ * Maintain phase separation. If the user wants a fast path,
680
+ * they can pipe commands together. The CLI never collapses
681
+ * phases internally.
682
+ *
683
+ * ANTI-PATTERN 5: CONVERSATIONAL PATTERNS
684
+ *
685
+ * What it looks like:
686
+ * Adding interactive prompts like "Did you mean X?", follow-up
687
+ * questions like "Which simulation?", or suggestions like
688
+ * "You might also want to run Y."
689
+ *
690
+ * Why it's wrong:
691
+ * The CLI is a control plane, not a conversation. Interactive
692
+ * negotiation makes the CLI non-composable (cannot be piped),
693
+ * non-deterministic (different paths depending on user response),
694
+ * and non-auditable (audit trail cannot capture dialogues).
695
+ *
696
+ * What to do instead:
697
+ * Reject invalid input with an instructional error. The error
698
+ * tells the user exactly what to type. No back-and-forth.
699
+ *
700
+ * ANTI-PATTERN 6: GATE BYPASS FOR CONVENIENCE
701
+ *
702
+ * What it looks like:
703
+ * Adding a --no-validate flag, a DEBUG_SKIP_GATES environment
704
+ * variable, or an "admin mode" that skips governance checks.
705
+ *
706
+ * Why it's wrong:
707
+ * Bypass mechanisms undermine the entire governance model.
708
+ * If governance can be skipped, it is not governance — it is
709
+ * a suggestion. Governance is either enforced or absent.
710
+ *
711
+ * What to do instead:
712
+ * If a gate is wrong, fix the gate. If a rule is too strict,
713
+ * change the rule through the ADR process. Never bypass.
714
+ *
715
+ * ============================================================================
716
+ * SUCCESS CRITERIA
717
+ * ============================================================================
718
+ *
719
+ * This ADR is successful if:
720
+ *
721
+ * 1. A new contributor can read this document and understand
722
+ * where governance lives, what domains exist, and what
723
+ * invariants are non-negotiable — without reading code.
724
+ *
725
+ * 2. Future ADRs reference this document as a conceptual anchor.
726
+ * ("Per ADR-003, Domain 3, synthesis is opt-in and scoped.")
727
+ *
728
+ * 3. Implementations can change (refactored gates, new CI system,
729
+ * different adapter patterns) without violating the invariants.
730
+ *
731
+ * 4. No existing ADR (001, 002) needs to be edited as a result
732
+ * of this document's acceptance.
733
+ *
734
+ * 5. The document reads as platform architecture — appropriate
735
+ * for stakeholder review, onboarding material, and compliance
736
+ * documentation — not as tooling notes.
737
+ *
738
+ * ============================================================================
739
+ * ALTERNATIVES CONSIDERED
740
+ * ============================================================================
741
+ *
742
+ * A. Embed domain definitions in ADR-001 or ADR-002:
743
+ * Rejected — those ADRs already have clear scope (semantics and
744
+ * enforcement, respectively). Adding conceptual framing would
745
+ * dilute their focus and make them harder to review.
746
+ *
747
+ * B. Use a separate architecture documentation system (Arc42, C4):
748
+ * Rejected — the ADR format is already established in this
749
+ * codebase. Introducing a second documentation system would
750
+ * create the very duplication this ADR warns against.
751
+ *
752
+ * C. Skip the conceptual ADR and let implementations speak:
753
+ * Rejected — implicit architecture is undiscoverable architecture.
754
+ * New contributors cannot reason about domain boundaries if those
755
+ * boundaries are only visible in import graphs and file structure.
756
+ *
757
+ * D. Write this as a README or wiki page:
758
+ * Rejected — READMEs are not versioned with the same rigor as
759
+ * ADRs. This document must be reviewed, accepted, and maintained
760
+ * as a formal decision. The ADR format provides that discipline.
761
+ */
762
+ // ============================================================================
763
+ // ADR-003 Metadata
764
+ // ============================================================================
765
+ // This ADR is purely conceptual. It exports only its own metadata
766
+ // for identification and cross-referencing by other ADRs.
767
+ // It contains no schemas, no middleware, no runtime code.
768
+ // ============================================================================
769
+ export const ADR_003_ID = 'ADR-003';
770
+ export const ADR_003_TITLE = 'Governance Architecture for the Agentics CLI Control Plane';
771
+ export const ADR_003_STATUS = 'Accepted';
772
+ export const ADR_003_DATE = '2026-01-28';
773
+ //# sourceMappingURL=adr-003-governance-architecture.js.map