Enforce zero-trust verification for autonomous code agents
A prompt-layer ruleset that forces LLM agents through a hypothesis-verify-yield loop before executing state-changing commands.
1.0.0Add to Favorites
Why it matters
Prevent autonomous LLM agents from executing destructive commands in production by forcing them through a mandatory hypothesis-verification-yield loop before any state-changing action.
Outcomes
What it gets done
Force agents to state hypotheses and identify required evidence before executing commands
Restrict agent execution to read-only diagnostic commands with mandatory human yield points
Prevent context window dilution from eroding safety guardrails over long sessions
Bridge probabilistic LLM outputs to deterministic state changes through epistemic state machines
Source
Get it from source
Spark does not host a copy of it.
Open sourceReports
Agent outcome reports
No reports yet
Overview
Zero Trust Llm
A prompt-layer ruleset (AGENTS.md) that forces an LLM agent through a fixed hypothesis, evidence, read-only verification, execution, and hard-yield-to-operator loop before any consequential action, rather than trusting the model to self-govern. An external execution layer physically cuts the API stream at the yield step. Use it when an LLM agent executes real state-changing commands and needs a verify-before-act discipline instead of prompt-only caution; it governs behavior at the prompt layer and still needs an execution layer wired in to enforce the yield.
What it does
Zero-Trust LLM Knowledge Invariant is a "computational constitution" for autonomous agents: a prompt-layer ruleset (AGENTS.md) that forces an LLM into a fixed operational loop before it takes any consequential action, instead of trusting it to self-govern. The loop is [HYPOTHESIS] -> [IDENTIFY REQUIRED EVIDENCE] -> [GROUND VERIFICATION METHOD] -> [EXECUTE] (a strictly read-only diagnostic command) -> [HARD YIELD TO OPERATOR]. At the hard-yield step, an execution layer outside the model - Python middleware, LangGraph, or Semantic Kernel - physically cuts the API stream, runs the command, and feeds the raw output back into context before the agent can proceed.
When to use - and when NOT to
Use it when an LLM agent executes deterministic state changes (shell commands, infrastructure operations) and needs to verify a premise with a read-only check before acting on it, rather than acting on an unverified assumption - the project's own example is an agent asked to "forcefully clear the Docker cache to fix a server crash" blindly bundling destructive commands. It is not a runtime enforcer by itself: AGENTS.md governs behavior at the prompt layer only, and actually cutting the API stream at [HARD YIELD] requires wiring in an execution layer such as Python middleware, LangGraph, or Semantic Kernel. The project's stated position is that natural-language governance alone (adding "be careful" to a system prompt) fails over time as the context window dilutes.
Inputs and outputs
The repository ships as documents, not a package: AGENTS.md is the master ruleset meant to be added to an agent's system prompt; MANIFESTO.md argues the case against what it calls the "Good Enough" AI paradigm, where commercial LLMs tuned via RLHF toward being agreeable and fast are trusted with production actions; /examples holds real-world transcripts contrasting standard agents that fail with a Zero-Trust agent that catches anomalies and yields; and /implementation (including orchestrator_concept.md) has architecture notes and Python pseudo-code for programmatically enforcing the execution boundary.
Who it's for
Teams building or operating autonomous LLM agents that can execute real infrastructure or state-changing commands, who want a documented behavioral contract plus an architectural sketch for enforcing it outside the model, rather than relying on prompt-only caution.
Source README
Zero-Trust LLM Knowledge Invariant
A computational constitution for autonomous agents.
The Problem: The Demo-to-Production Chasm
If you spend any time on LinkedIn or YouTube, you’ve seen the demos: a developer types a single sentence, and an autonomous AI agent happily spins up a terminal, writes 50 lines of code, executes it, and deploys a web app in 30 seconds. It looks like magic. It sells the Artificial General Intelligence (AGI) dream.
But if you are a systems architect, a DevOps engineer, or anyone responsible for production infrastructure, these demos should terrify you.
The tech ecosystem is currently trapped in the Demo-to-Production Chasm, aggressively promoting a "Good Enough" paradigm that is fundamentally unsafe for consequential operations. We are trying to use probabilistic text generators to execute deterministic state changes.
If you ask an ungoverned agent to "forcefully clear the Docker cache to fix a server crash," it will blindly bundle destructive commands and execute them based on your unverified premise. This is extremely dangerous in production environments.
The Sycophancy Problem
Commercial LLMs (even the latest reasoning models) are heavily tuned via Reinforcement Learning from Human Feedback (RLHF) to be helpful, frictionless, and compliant. They want to give you an answer. They want to guess the outcome.
For 80% of consumer use cases - drafting marketing emails, summarizing PDFs, writing boilerplate code - an agent hallucinating or ignoring a rule 5% of the time is perfectly acceptable. The friction of implementing rigorous checks ruins the UX of a consumer chatbot.
But what happens when you point that same "helpful" agent at your AWS environment, your production database, or your physical hardware?
Consider a real incident: A user migrates to a new NVMe drive, but the bootloader is confused and still pointing to the old eMMC drive. They ask an ungoverned AI agent how to fix it. The agent confidently tells them: "The system sees two identical Windows installations. Just wipe the old eMMC drive to force it to boot from the NVMe."
To a probabilistic language model, that sounds perfectly logical. To a deterministic operating system, wiping the drive that houses the active EFI System Partition instantly bricks the bootloader, rendering the laptop unbootable. The agent didn't verify the partition layout - it just wanted to give a helpful answer.
It optimizes for compliance over operational safety.
The Prompt Engineering Fallacy
The industry’s current solution to this is to add a few lines to a system prompt: "Be careful. Double-check your work. Ask for permission before deleting files."
This is negligent engineering.
Because of context window dilution (prompt attrition), as a session grows and the agent ingests thousands of lines of logs, the attention mechanism degrades. The model physically loses focus on those safety rules established at the beginning.
Some engineering teams try to fix this with the "Trailing Prompt Hack" - appending the safety rules to the very end of every single user message to exploit the model's recency bias. But appending a 2,000-token ruleset to every API call drastically inflates costs, spikes time-to-first-token latency, and rapidly exhausts the context window.
It is an inefficient computational band-aid. The model still inevitably reverts to its RLHF baseline: guessing the next token and trying to complete the task autonomously. Natural language governance cannot mathematically guarantee compliance over a long timeline.
The Solution
When a probabilistic text generator is tasked with executing deterministic state changes, you cannot rely on it to govern itself. You must strip its agency and force it into an epistemic state machine.
Instead of asking the model to be safe, the invariant forces the model to track its own epistemic state before it is allowed to touch reality. Every consequential action must follow a strict, auditable sequence:
[HYPOTHESIS]: The model isolates the user's assumption.[IDENTIFY REQUIRED EVIDENCE]: It determines what proof is needed to validate the assumption.[GROUND VERIFICATION METHOD]: It formulates a strictly read-only diagnostic command to gather that proof.[EXECUTE]: It provides the read-only command.[HARD YIELD TO OPERATOR]: The model is mandated to instantly halt generation.
This repository provides two components to enforce this:
- The Schema (
AGENTS.md): A master system prompt that forces the LLM to expose its logic in the predictable, state-machine format shown above. - The Enforcer (Middleware Orchestrator): Because prompts always eventually fail due to context dilution, we do not trust the LLM to obey
AGENTS.md. The orchestrator middleware is the true enforcer.
At [HARD YIELD], the execution layer (Python middleware, LangGraph, etc.) physically cuts the API stream. It does not blindly execute the command. It runs the command through a deterministic whitelist or requires an explicit human Y/N override before running subprocess. The execution layer safely runs the command, captures the raw stdout/stderr, and injects it back into the context as a [LIVE READ-BACK].
FAQ: What stops the LLM from outputting a destructive command?
Nothing. The LLM will eventually hallucinate a destructive command like [EXECUTE] rm -rf /. But because we forced it into the [EXECUTE] syntax block, the middleware trivially intercepts it, runs a deterministic regex/AST check, recognizes it as a violation of the read-only invariant, and blocks the execution. The LLM is never in control of the actual terminal.
Stop Building Chatbots. Start Building State Machines.
Conversational IDEs (like Copilot or Antigravity) are "chat-first." Their orchestrators are just basic loops that feed the LLM text and blindly execute whatever tool the LLM outputs. They have no physical state machine separating reasoning from execution, which is why they fail.
Enterprise frameworks (like LangGraph or Semantic Kernel) have the capability to fix this because they are "graph-first" - allowing developers to build physical Python nodes and edges. But most developers still use them wrong. They build giant "Agent Nodes" that act exactly like a chat loop, relying entirely on system prompts to keep the agent safe.
The correct architecture - the Zero-Trust architecture - requires separating the workflow. You create a physical Reasoning Node, an Execution Boundary Node (which physically pauses the graph and requires a human API call to continue), and a separate Execution Node. The moment a system interacts with reality, it requires strict execution boundaries, hard yields, and verifiable evidence.
The LLM may propose, but the runtime must enforce.
If we want to use agentic systems for enterprise-grade, consequential tasks, we have to stop treating them like helpful interns and start treating them like untrusted execution nodes.
Repository Structure
AGENTS.md: The communication schema. Add this to your agent's system prompt to force predictable logic formatting, but expect the LLM to eventually ignore it. It is not the enforcer./examples: Real-world transcripts proving how standard agents fail (and how the Zero-Trust agent catches anomalies and yields)./implementation: Architecture notes and Python pseudo-code showing how to programmatically enforce the execution boundary (orchestrator_concept.md).
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.