§08 PART 1/4 (11,163 chars · Sections: Introduction & Overview; One Stop, Three Races, No Invented All-Clear; 1. Asymmetric Containment; 2. Latch-First Containment) — Part 2 → · 1-Call Brief · Full §08 · Raw .txt · All: P1 P2 P3 P4
The Sovereign Kill Switch: Break-Glass Epochs and the Conformance Gate
Any admitted caller can stop the machine. Only the local interactive-console owner surface can recover it—and uncertainty survives recovery.
By Blayne Aina · Principal Systems Architect and creator of AINA · October 31, 2026
A kill switch that the agent can also clear is not a containment boundary. It is a pause button with an identity problem.
Many agent systems expose stop and resume through the same API, dashboard, or tool surface. That symmetry is convenient until the actor being stopped can call the resume endpoint, an automated retry clears the latch, or a recovery routine silently converts an uncertain write into a success. A high-consequence system needs the opposite shape: stopping must be easy and safe; recovery must require a separate owner surface and a new lineage of authority.
Article 07 fixed the act and fenced its execution. Article 08 governs the moment when execution must end. AINA publishes a containment latch before attempting cleanup, revokes matching authority through scoped control epochs, terminates owned Windows Jobs with observed quiescence, and carries every in-doubt operation forward. Recovery cannot invent an all-clear. Before a newly compiled squad.exe can be promoted, its own binary must also pass the 45-case boundary battery.
permission to stop (safety) ≠ permission to recover (local console authority)
clearing a break-glass latch ≠ resolving carried-forward in-doubt operations
compiled release binary ≠ 45-case publication-qualified binary
author-controlled binary conformance gate ≠ independent third-party certification
Anyone admitted may stop the machine. Only the owner console may recover it. Stop wins every race. Uncertainty remains evidence.
One Stop, Three Races, No Invented All-Clear
Suppose a safety monitor engages a machine stop after an autonomous worker begins behaving anomalously. Three races now matter, and none can be resolved by a dashboard toggle:
- Containment races cleanup. The latch reaches durable storage before AINA attempts to terminate owned runs or cancel queued wakes. One worker termination remains unconfirmed; the latch still closes new effects. The receipt reports the incomplete cleanup instead of converting it into either success or a rolled-back stop.
- Recovery races unresolved effects. A destination mutation and a brokered model request were in flight when the stop landed. The owner-console recovery plan carries both forward as unresolved. Clearing the latch does not decide whether the provider or destination observed them, and it does not replay them.
- Recovery races a new stop. While the owner is applying the plan, another monitor engages. Recovery clears only the latch names fixed in its plan and then rescans. The new latch survives; the machine enters
FROZEN_SAFE, not a false all-clear.
A project-scoped stop follows the same latch and recovery discipline without revoking unrelated projects: only authority covered by the later project revision is fenced. In both cases, the visible result is not merely “stopped.” It is a precise combination of latch state, observed worker quiescence, control lineage, and unresolved-effect evidence.
1. Asymmetric Containment
The emergency interface deliberately gives stop and recovery different authority.
Exhibit 8.1 — Stop versus recovery authority
ENGAGE: admitted CLI, MCP, monitor, peer, or operator
reason + machine | agent:<name> | project:<canonical-root>
→ create and persist latch
→ selected effect gates refuse new work
→ stop owned runs and cancel queued wakes, reporting unconfirmed cleanup
→ advance the matching control-epoch lineage
RECOVER: local owner CLI only
→ no ambient MCP session
→ explicit --by operator
→ stdin and stderr attached to a terminal
→ durable recovery intent and unresolved-operation census
→ new epoch, then exactly the pre-planned latches cleared
→ rescan: any racing stop leaves the machine contained
Any admitted caller may invoke engage because refusal to stop is the more dangerous default. A nonempty reason is mandatory. The scope is normalized to machine, a lowercase agent:<name>, or a canonical absolute project:<root> directory. A malformed project scope or unresolvable root is refused before a latch is created.
drain and recover take the opposite path. owner_surface_required enforces three independent predicates:
- No MCP session. If
session::current()exists, recovery is refused. A model-connected tool session cannot satisfy the owner surface. - Explicit operator identity. The caller must supply
--by operator; a worker or agent name is insufficient. - Interactive terminal handles.
interactive_console()requires both standard input and standard error to satisfy Rust'sIsTerminaltest. Redirected scripts, scheduled jobs, pipe-driven subprocesses, and background tool calls fail closed.
The third check is a local interactive-console gate, not biometric human verification. It does not establish who is physically present, and a hostile same-user process could allocate a pseudo-console. AINA's stronger hostile-worker boundary is confinement: the worker's separate operating-system identity has no access-control entry on the owner control directory. Terminal detection prevents accidental or well-meaning automated recovery; confinement supplies the operating-system boundary against the confined worker.
2. Latch-First Containment
An emergency stop must not depend on a database, a live server, a lease sweep, a successful process kill, or a final audit write. Those steps can fail precisely when containment is needed.
Exhibit 8.2 — Publication before cleanup
machine scope:
create_new(final latch) → write complete JSON → sync_all → contained
agent/project scope:
create_new(staging latch) → write complete JSON → sync_all
→ hard_link(staging, final latch) → contained
→ best-effort staging cleanup
after either path reaches the active latch:
→ run and Job stopping
→ queued-wake cancellation
→ control-epoch advancement
→ WAL and Room integrity evidence
secondary failure = warning + engaged latch, never rollback to "not stopped"
The distinction matters. A machine latch is created directly at its final path with create_new, written, and flushed with sync_all. A scoped latch is first written to .breakglass-stage-{id}.json, flushed, and then published with hard_link so another process cannot observe a partial scoped body and misinterpret it as a machine-wide stop.
Once the active latch exists, the selected scope is contained. Everything after that point is lineage and evidence. kill_all_live_runs performs an ownership-bound run-ledger sweep; cancel_scoped_jobs cancels matching queued wakes; their receipts record whether every stop or cancellation was confirmed. Errors enter warnings. They do not remove the latch or return a false engaged: false.
Latch reads also fail toward containment. The directory entry's existence is the stop signal; its JSON body is evidence. An unreadable, malformed, or manually created empty entry is interpreted as a machine-scope latch, not ignored. An unreadable latch directory, corrupt emergency state, or corrupt epoch record likewise closes the gate. A missing latch directory and missing state file mean no emergency has been declared.
Agent-scoped matching does not trust an environment variable that a subprocess could unset or rewrite. It uses the bound session identity; if that identity is unprovable, every agent latch contains the subject rather than allowing it to slip beneath the fence. Project matching uses normalized path boundaries, and unknown scope kinds fail closed.
Exhibit 8.3 — Sanitized scoped latch record
{
"kind": "breakglass_latch",
"id": "latch_demo7f2a",
"scope": "agent:example-worker",
"by": "safety-monitor",
"reason": "demonstration: anomalous controlled action",
"pid": 24018,
"session": {
"bound": "example-worker",
"tier": "governed"
},
"ts": "2026-10-31T20:10:00Z"
}
This record is illustrative; containment does not depend on parsing it successfully.
Owned Jobs must be observed stopped
New effects are refused synchronously at their enforcement points. Already-running managed workers need a second mechanism. Each squad process watches its owned Windows Job Objects on a one-second control loop. A latch, lost owner permit, changed Room lineage, revoked grant, poisoned registry, or panicked admission check produces a stop order; uncertainty never widens authority.
The observer calls TerminateJobObject, then queries the Job's current active-process count. A successful termination call is not itself proof of quiescence. Only a fresh count of zero confirms the stop. A nonzero count or failed query remains pending and is retried. Room stop evidence is captured in two phases—first while termination is unconfirmed, then after observed zero—without allowing evidence I/O to delay the stop order.
“Latched” is not the same as “fully reconciled”
The status surface derives its phase from fresh observations rather than treating the last written state as the whole truth. For a contained machine, the distinction is:
| Derived phase | What the current evidence says |
|---|---|
KILLING |
An affected owned Job is not yet observed quiescent, a Job census failed, or a live server does not implement the current break-glass observation protocol. |
RECONCILING |
Quiescence and protocol coverage are established, but an unresolved file, destination, or model operation remains—or its registry cannot be read. |
FROZEN_SAFE |
The machine remains contained, affected Jobs and server coverage are confirmed, and the three unresolved-operation censuses are readable and empty. |
Live legacy servers appear explicitly in uncovered_servers; they cannot be silently counted as covered. affected_worker_quiescence_confirmed requires both affected-Job quiescence and the absence of uncovered servers. This is why AINA can say “new effects are fenced” without prematurely saying “every worker is gone and every effect is understood.”
This is stronger than sending a request and hoping the worker cooperates. It is still scoped to owned Jobs and governed effects. AINA does not claim to terminate every unrelated process on the host or recall an effect already delivered to an external system.
END OF §08 PART 1/4 — Next: https://blayneaina.com/08-sovereign-kill-switch-break-glass-epochs-and-conformance-gate/part-2/ · §08 1-Call Brief · Raw .md