Skip to content

The Drift Log · Governing agents that write code

Validating Licensing and Invariants at the Build Intent Gate

12 November 2026 · 3 min read · 542 words · established

A crystal shard held at a red-lit gateway in a black wall

Intercept agent code writes with a Build Intent gate to enforce licensing budgets and structural invariants before mutation touches disk.

An autonomous agent can generate four hundred lines of syntactically valid TypeScript in six seconds. The unit tests pass. The variable names match your existing conventions. The pull request looks clean.

Three weeks later, a compliance audit reveals that forty of those lines were lifted from a copyleft repository without attribution, and an architectural boundary—that no database client may be imported into domain services—was quietly bypassed via a dynamic import.

Human review missed both. That is not a failure of diligence; it is an arithmetic certainty when review volume outpaces human reading speed.

Diff Review Fails at Machine Speed

Traditional code review assumes a human developer wrote the patch with some baseline awareness of team conventions and legal boundaries. Reviewers look for logic errors, edge cases, and maintainability.

When you introduce high-volume coding agents, post-facto code review automation at the pull request level breaks down. Linters verify syntax and stylistic formatting. Security scanners flag known vulnerability signatures. Neither checks whether an agent's synthesized logic conforms to your repository's licensing budget or satisfies invariants that span multiple modules.

By the time code lands in a git diff, provenance is stripped. An agent does not preserve source metadata in a patch unless forced to by its toolchain. Attempting to catch missing attribution or broken structural invariants after files are written to disk makes governance forensic rather than preventative.

Enforcing Invariants on Intent, Not Files

The control point must move upstream. Instead of permitting an agent to write directly to the working tree and inspecting the diff later, you intercept the intent to write.

This is the mechanical core of agent governance: treating code generation as a formal proposal before any file mutation executes.

At the build gate, the agent submits a structured payload containing the target path, the proposed interface, and the implementation source:

interface BuildIntent {
  targetPath: string;
  interfaceSignature: string;
  implementationSource: string;
  invariants: string[];
  licensingBudget: string[];
}

Before the write lands on disk, the gate evaluates two checks in code:

  1. Licensing constraints: Does the implementation rely on patterns or dependencies governed by an incompatible license? If an agent incorporates external logic, does the proposal supply full upstream attribution within the defined budget? If not, the gate halts.
  2. Structural invariants: Does the proposed code respect architectural boundaries? If an invariant dictates that domain entities must remain pure and free of runtime I/O, does the AST contain prohibited network clients or dynamic module loaders?

The gate executes the artifact against the invariant harness and returns one of four terminal verification states:

  • CERTIFIED: The payload satisfies all declared invariants, compiles cleanly, and passes every harness check.
  • PROVISIONAL: The payload is repeatable and contains no boundary or license violations, but correctness assertions remain unexecuted.
  • INCONCLUSIVE: The harness could not exercise the input contract due to missing environment fixtures or harness limits, not a defect in the artifact itself.
  • FAILED: The payload violated an explicit invariant, broke the licensing budget, or failed static verification.

If the state is not CERTIFIED or PROVISIONAL, the working tree remains untouched. Previewing the intent validation costs nothing; writing the resulting artifact into the codebase requires passing the gate. By moving the check to the proposal phase, you eliminate entire classes of compliance and architectural drift before they can ever enter a commit log.

This post supports the longer argument in Placing an Invariant Gate in Front of Coding Agents.

Keep reading

Next in the log

The Strategic Master Library · written and reviewed under the house's own epistemic rules: nothing claimed that we cannot show.