The Interlock Protocol: Deterministic Rails with Autonomous AI Oversight
Earlier tonight, my desktop fired a notification: upstream had tagged a new release for one of the packages I maintain in Fedora Copr. My background auditor had caught the new release tag from an Atom feed, compared it against my local RPM spec, and alerted me.
Yet nothing was committed. Nothing was pushed. No build had queued.
Why? Because my auditor script was just that—an auditor. It was built strictly to notify, not to act. But when I sat down to fix it, I asked myself a question that every systems engineer wrestling with AI agents needs to confront: How much of this workflow should actually touch an LLM?
The Two Polar Anti-Patterns
In modern agentic automation, I see people constantly falling into one of two traps:
- LLM-First Naivety (Agent Sprawl):
- This is the Silicon Valley hype pattern: wrapping every routine mechanical task in an autonomous agent. You spin up an LLM to curl an archive, parse a version string with regex, bump a number in a text file, and git commit. It takes 45 seconds, burns $0.08 of API credits, risks stochastic hallucinations on simple syntax, and introduces five points of network latency to something POSIX utilities solve in 4 milliseconds.
- Script-Only Fragility:
- This is the old-school UNIX purist trap: writing rigid shell scripts for everything. It runs at blistering speed and zero token cost—until upstream refactors a directory, a patch rebase fails with rejects, a Go vendor hash changes, or a new binary appears that violates your RPM %files manifest. The script crashes, execution halts, and you are dragged out of deep work to manually triage a trivial packaging drift.
Both approaches are broken in production.
The sweet spot is an architectural pattern I call the Interlock Protocol.
The Philosophy: Deterministic Spine, Agentic Tripwire
In mechanical engineering and industrial safety, an interlock is a mechanism that prevents a machine from harming itself or its operator by halting execution the moment a state parameter drifts outside tolerance.
The Interlock Protocol applies this exact concept to AI systems engineering:
Note
Prime Axiom: Run deterministic rails until the end. Engage AI strictly on exception or verification.
Under this protocol, your automation has two distinct stages:
- Stage 1 (The Deterministic Spine): All routine operations—source retrieval, checksum validation, spec bumping, local SRPM building, static linting, and git operations—run on rigid, deterministic POSIX rails. Zero tokens are consumed on the happy path.
- Stage 2 (The Forensic Interlock): When—and only when—a deterministic gate trips (a non-zero exit code, a compiler error, an rpmlint failure, or a remote build failure), the harness halts, serializes a forensic payload, and dispatches an AI agent to investigate the root cause, remediate the code, and restore equilibrium.
+-----------------------------------------------------------+
| Deterministic Spine |
| |
| [Pull Remote] -> [Fetch Archive] -> [Update Spec/Config] |
| | |
| v |
| [Compile / Lint Gate] |
+--------------------------------------------+--------------+
|
+----------------+----------------+
| |
[Success] [Failure]
| |
v v
[Commit & Push Remote] +-------------------+
| Forensic Tripwire |
| - Capture Logs |
| - Capture Diffs |
+---------+---------+
|
v
+-------------------+
| AI Agent Dispatch |
| (Isolated Unit) |
+---------+---------+
|
[Diagnose & Remediate]
|
v
[Re-enter Det. Gate]
(Circuit Breaker: max 2)
The Four Core Axioms
If you want to implement this in your own infrastructure, here are the four non-negotiable rules:
- Axiom 1: The Deterministic Spine
- If a step can be accomplished via standard utilities, compilers, or exit-code checks, it must never touch an LLM. 90% of your operational cycles should execute in milliseconds with zero tokens spent.
- Axiom 2: The Forensic Tripwire
- Failures must never fail silently. When a command fails, your harness intercepts the signal and captures the exact failure slice: the failed stage name, exit codes, stderr/stdout tails, remote builder logs, and the active git diff.
- Axiom 3: Scoped Escalation
- Never launch an open-ended conversational agent. Dispatch the agent with bounded diagnostic context, target repository paths, and an explicit, verifiable objective. Run it in an isolated supervisor unit (like a transient systemd user unit) with independent resource accounting and cgroup isolation.
- Axiom 4: Zero-Trust Handback & Circuit Breakers
- An AI agent's fix must never be accepted blindly. The remediation must re-enter the deterministic harness and satisfy all original verification gates (clean compile, zero lint errors, test suites) before any change is committed or pushed. Crucially, enforce a Circuit Breaker (max 1 or 2 attempts) to prevent recursive self-healing cascades if a codebase has fundamental architectural flaws.
How I Put This into Practice
Tonight, I implemented the Interlock Protocol across my Fedora Copr packaging pipeline.
First, my auditor (fedora-copr-sync.bash) checks upstream GitHub Atom feeds for my packages (like obscura, d2, and lavinmq). When an update is detected, it doesn't just ping me; it dispatches my new updater script:
# Triggered asynchronously via systemd-run --user
fedora-copr-update.bash --watch obscura 0.2.3
The script runs Stage 1:
Pulls remote changes and verifies the git tree is clean.
Bumps the version in obscura.spec.
Runs spectool -g to fetch the new release archive.
Replaces the old tarball in git (for personal staging repositories) and stages the spec.
Runs rpmlint on the spec (enforcing 0 errors).
Builds the source RPM locally with rpmbuild -bs and validates the SRPM.
Commits the deterministic release:
feat(packaging): update obscura to 0.2.3 Signed-off-by: Rénich Bon Ćirić <renich@evalinux.com>
Pushes to GitLab over SSH and queues the build across all Fedora and CentOS Stream chroots in Copr.
Notice that on the happy path, there is no AI co-author trailer—because no AI was involved. It ran at pure hardware speed.
What Happens When the Build Breaks?
Here is where the Interlock trips. Suppose upstream introduced an incompatible C flag, or a Go package failed to re-vendor, or a patch rejected with .rej files, or a remote Copr builder failed in Rawhide.
In a pure script, the job dies. In an LLM-first setup, you waste tokens watching an agent fumble through 20 minutes of compilation.
Under the Interlock Protocol, the failure immediately trips Stage 2:
# Inside fail_and_dispatch()
systemd-run --user \
--unit="agy-copr-fix-${PKG}-${TIMESTAMP}" \
--description="Antigravity Interlock Auto-Fix for ${PKG}" \
agy \
--add-dir "${PKG_DIR}" \
--dangerously-skip-permissions \
--mode accept-edits \
--effort high \
--print \
--prompt "${DIAGNOSTIC_PAYLOAD}"
Because it runs under systemd-run --user:
The parent process exits cleanly without hanging the supervisor or timer.
The agent inherits active SSH credentials (via the systemd user session's SSH_AUTH_SOCK) so it can push verified fixes.
Its thinking trace, tool executions, and stderr stream directly to journald.
When a remote Copr build fails, the harness automatically downloads and decompresses the remote build.log.gz from the failed chroot, extracting the exact compilation failure so the agent isn't guessing blind.
The agent reads the failure, rebases the patch or updates the spec, validates the fix locally against rpmlint and rpmbuild -bs, and commits with the proper human-agent co-authorship trailer:
feat(packaging): update obscura to 0.2.3 - Remediate compiler flag incompatibility in spec - Rebase 0001-btls-sys-fix.patch against upstream 0.2.3 Signed-off-by: Rénich Bon Ćirić <renich@evalinux.com> Co-authored-by: Antigravity <antigravity@google.com>
The agent pushes to the remote repo, resubmits the Copr build, and notifies me on the desktop when the build is back in the green.
The Second Mode: Interlock-Verify
While tonight's focus was on Interlock-Resolve (self-healing exceptions), the Interlock Protocol also defines a second mode: Interlock-Verify.
In this mode, all deterministic checks pass, but the pipeline halts at a semantic boundary to allow an AI agent to perform non-computable qualitative evaluation:
- Security Attestation: Auditing AST diffs for unintended supply-chain anomalies before package signing.
- Changelog Semantic Consistency: Verifying that commit messages and user-facing changelogs actually reflect the underlying code diffs.
- Breaking Change Auditing: Scanning exported API symbols for subtle semantic breaks that type-checkers might miss.
If the audit passes, the release gate unlocks and publication proceeds. If the agent flags an issue, execution halts for human review—with maintainers retaining a deterministic override flag (e.g. --bypass-interlock-verify) to handle false positives.
Conclusion
AI agents are phenomenal reasoners, but terrible conveyor belts.
Don't use an LLM to turn a bolt that POSIX tools have been turning reliably for fifty years. Build rigid, lightning-fast deterministic rails for your happy path, instrument forensic tripwires at your failure boundaries, and unleash your AI agents where their cognitive capabilities actually matter: diagnosing root causes, adapting code, and verifying intent.
Deterministic till the end. AI on exception. That is the Interlock Protocol.