Intent Integrity for AI Agents: Do No Harm at Machine Speed
When a human authorizes an AI agent to build something, a contract forms: this is what I want, go make it real. The agent transforms that intent through dozens of intermediate steps — architecture decisions, code generation, refactoring, optimization, compilation, deployment. At each step, the original intent can drift, degrade, or disappear entirely. Intent integrity is the engineering discipline that prevents this.
What Intent Integrity Means
Intent integrity is the discipline of ensuring that an autonomous agent's observable actions remain aligned with the human-authorized goal, scope, constraints, and acceptable impact — preserved through every transformation between authorization and runtime behavior.
It's not about whether the code compiles or tests pass. It's about whether the system still does what was asked after everything the agent did to build it.
A measure engine that passes all tests but calculates quality scores using the wrong specification year has perfect test coverage and zero intent integrity. The code works flawlessly; it just doesn't do what was authorized. In healthcare, that gap costs organizations real money in payment adjustments. In safety-critical systems, it costs more.
Why It Matters When Agents Transform Code
Human developers maintain intent implicitly — they remember what they're building while they build it. AI agents don't have this implicit connection. They optimize for the objective function in front of them, which might be "make tests pass" rather than "accomplish what the human actually wanted." An agent can refactor code into something technically superior that no longer serves its original purpose. It can optimize a query for performance in a way that changes which records are included. It can resolve a merge conflict by choosing the wrong side.
At machine speed, these drift events compound. An agent making 50 changes per hour accumulates intent drift faster than any human reviewer can detect. By the time someone inspects the output, the system may be internally consistent (everything builds, tests pass, types check) but externally incorrect (it no longer does what was authorized).
How Intent Contracts Work
Intent Contracts are formal declarations of what a piece of code is authorized to accomplish. They are not comments — comments are discarded by compilers and ignored by runtimes. Intent Contracts are structured assertions meant to stay attached to the code through every transformation. In the free harness today the contract is a template that humans and agents keep with the work; carrying it through compilation is a goal of the design, not something the harness does yet.
A contract declares: this function must return the count of patients who meet CMS measure 130 criteria for the 2025 reporting year. That declaration persists whether the implementation uses SQL, Python, or a materialized view. It persists through refactoring, optimization, and agent-driven rewrites. At any point, a verifier can ask: does this implementation still satisfy its contract?
The contract doesn't specify how — that's the agent's job. It specifies what was authorized — that's the human's prerogative. The separation is what makes autonomous execution safe: agents have freedom to optimize implementation while being bound to declared intent.
Primum: Do No Harm Review
Primum — named for primum non nocere (first, do no harm) — is a review persona and checklist that asks whether execution still accomplishes what was authorized. It is applied when a review is run, against the intent contract. There is no runtime monitor today: Primum is a role an agent adopts and reviewers check, not a process that watches every pipeline run. See what is mechanically enforced and what is convention.
The contract it checks against is a template in the free harness (templates/INTENT-CONTRACT.md). Its sections are: Goal; Why; Authorized Scope; Protected Constraints; Non-Goals; Harm Boundaries; Escalation Conditions; Success Evidence; Reversibility Requirements; Authority Boundaries; Immutable Paths; and Approvals.
Primum doesn't prevent change — it prevents unauthorized change. An agent can rewrite an entire module, and Primum will approve it if the new implementation still satisfies the intent contract. But if an optimization subtly changes which patients qualify for a measure, a Primum review is designed to flag that drift at review time — not three months later when an auditor finds it.
The review is meant to run in a fresh context, on a different model family where one is available. That independence is a convention, not something the scripts prove: the same reasoning that introduced drift should not be the only thing checking for it.
Connection to Codifide Harness
Intent integrity operates across all three layers of the Codifide Harness governance model:
- Human layer — declares intent. Humans specify what should be accomplished, establish contracts, and retain authority to modify intent when requirements change.
- Gate layer — detects drift. Adversarial reviewers, domain expert personas, and security checks evaluate whether agent output still aligns with declared intent. The gate asks: "Is this still what was authorized?"
- Loop layer — verifies contracts. Where an automated verifier exists, it checks output mechanically and a failure halts the loop and triggers escalation. Not every intent can be verified by a script; those are left to the gate.
The three layers operate at different speeds but serve the same purpose: maintaining the chain from human authorization to runtime execution. Intent integrity is what makes autonomous loops safe — not by limiting what agents can do, but by ensuring that whatever they do still serves the original purpose.
Related Articles
- Codifide Harness: Three-Layer Governance — where intent integrity operates across all three layers
- Codifide Harness Whitepaper — the reasoning behind the gates, with one worked healthcare example
- Agentic SDLC Governance — checks and balances for AI-native development
- AI Coding Agent Governance — authority boundaries when agents write code
- Loop Engineering — autonomous loops with independent verification
- Quill: The War Correspondent Problem — the sibling cross-cutting concern
- Building a Regulated Healthcare Platform — intent integrity in a regulated domain