Dependency Graph Enforcement in Agent-Written Code
Deterministic build-time checks catch the structural violations that diff review can't.
Sponsored by Graphide

AI coding agents now produce most of the code on a typical engineering team, and that code is syntactically correct but architecturally blind. No reviewer, human or machine, can reliably see the violations that matter in a diff. The fix is not more review. It is deterministic enforcement of the dependency graph, applied at build time and in CI, before structurally invalid code ever reaches the merge button.
Why agent-written code breaks architectural boundaries in ways diffs cannot show
An engineer opens a pull request that an agent produced from a single prompt. The diff touches forty files and thousands of lines. By file nine, the reviewer has lost the architectural thread. The import in utils.ts that points back at auth.ts looks innocent in isolation. It is not. That import closes a cycle that will surface as a deployment failure months later, but a reviewer cannot hold the full dependency graph in working memory at that scale.
The problem is deeper than volume. An agent cannot see that auth.rs is a central hub with many downstream dependents, or that adding an import to utils.ts creates a circular dependency. That context does not exist in the generation process. Architecture decisions encode why a system is structured a certain way, not merely what code exists, and agents have no mechanism to read or respect that intent.
This is why the diff is the wrong instrument for reviewing agent output. A diff shows what changed. It does not show what the change means for the structure of the system. The very scale at which agents operate is the scale at which human review stops working, and the violations that matter most are precisely the ones a line-by-line diff cannot reveal.
How constraint decay makes the problem worse as architecture grows more complex
The teams that care most about design integrity are the ones most exposed to this failure. That is the uncomfortable finding at the center of what a May 2026 study named directly: as architectural requirements are layered onto an LLM agent, its correctness degrades measurably. Stacking constraints to a fully specified setup dropped capable configurations substantially in assertion pass rate.
This is not a quirk of a particular model. But agents are strongest when unconstrained, so the environment where architectural rules are most needed is exactly where their reliability falls furthest. Nor is this a model quality problem that future training will eliminate. It is an intrinsic property of instructing a generative system to honor implicit design invariants through natural-language prompts alone.
Documented constraints make the gap concrete. The prose exists, the intent is clear, and the agent generates code that violates it anyway, because nothing in the generation loop ever converts that prose into a binding constraint. Constraint decay is structural, not incidental.
Why error propagation through a dependency graph turns a small violation into a systemic failure
Architectural violations are not local events. Dependencies form directed graphs, and a boundary breach in one module propagates silently into every downstream consumer. If an upstream module fails a behavioral or structural constraint, every downstream consumer is operating on corrupted or invalid data, and agents have no robust way to detect these chains. The diff understates the real scope of the change.
The SaaS modular monolith case makes this concrete. When a developer later attempted to import billing internals for an urgent dashboard feature, CI failed with a visual violation graph before the change could merge. The gate caught what would have been a clean, small, reasonable-looking diff, and it caught it because the rule operated on the graph rather than on the files.
This propagation is exactly what the recursive governance framework for agentic AI systems formalizes. Cascading inter-agent dependencies introduce a class of risk, Agency Risk, that existing frameworks are ill-equipped to quantify because the propagation paths cannot be fully enumerated at registration time. The node where an error manifests is often not the node where it originates. Symptoms appear downstream, masking the upstream source, so post-hoc review catches the wrong place in the graph, if it catches anything at all.
Why the review bottleneck cannot be solved by adding more reviewers, human or AI
The obvious objection is to review more carefully, or to add more reviewers. Neither works. Human review cannot keep pace with agent output at scale. Adding humans does not solve a structural mismatch. It multiplies the cost of a process that was already falling behind.
Substituting an AI reviewer relocates the blind spot rather than eliminating it. Martin Monperrus's June 2026 paper, The End of Code Review: Coding Agents Supersede Human Inspection, argues coherently that having a human examine a diff before merge is no longer a necessary quality gate. His proposed alternative, an agent ensemble producing structured sign-off, closes the loop on agent-generated code. But when the same model family that generates code also reviews it, generative and review blind spots are correlated. The agent may fail to flag the very pattern its generation tendency produces. The reviewer sees the same architectural silence the generator did.
That is the pipeline on a typical 2026 engineering team. There is no deterministic structural gate anywhere in it. Nearly one in three recommendations was wrong in ways a compiler would not catch. The problem is not the number of reviewers. It is the absence of enforcement.
What deterministic enforcement actually means and why it is categorically different from review

Deterministic architecture tests are a different category of control from review. Review, human or machine, is probabilistic. It may catch a violation if attention, workload, and model blind spots allow it. Deterministic enforcement makes it structurally impossible for a violation to enter the codebase, regardless of who or what generated the code. Practitioners who evaluated architecture tests, agent-based reviews, and documentation or skills as enforcement strategies and chose architecture tests found them fully deterministic: a rule violation physically prevents the build from passing.
The economic difference is just as sharp. Every subsequent build checks the rule, whether the code came from a senior engineer or a first-shot agent prompt. The gate does not tire, does not skim, and does not share a blind spot with the generator.
The payment gateway case shows that enforcement is corrective, not merely punitive. The deterministic signal changed the agent's behavior. The ClosureBound reference monitor formalizes the underlying principle for agent skill dependencies: load-time integrity of a root skill does not bind later transitive resolution or equivalent effect paths, so re-binding must happen at operation time against the exact closure. A signed directory is insufficient without runtime enforcement of what actually executes. The same logic applies to code.
The enforcement tooling that exists today and what each layer catches
A mature ecosystem of deterministic architectural enforcement tools now exists across every major language, organized less by vendor than by what each layer of the dependency graph it catches. Java uses ArchUnit, with version 1.3.0 released April 2024, and its FreezingArchRule, introduced in v0.11.0, makes incremental adoption in legacy codebases feasible by freezing the current violation set and failing only on new ones..NET uses ArchUnitNET. JavaScript uses dependency-cruiser or eslint-plugin-import-x. Python uses import-linter. Go uses go-arch-lint or depguard for import allow/deny policies.
These tools are instances of a broader category: fitness functions. A fitness function encodes an architectural rule as an executable check, and it is the single most effective defense against AI-generated drift because it catches violations automatically regardless of whether the source is a human or an agent. The choice of tool is an ecosystem question more than an architectural one. What matters is that the rule runs mechanically on every build.
How to declare boundaries upstream so agents generate compliant code before enforcement catches violations
Enforcement gates catch what agents violate, but if you declare boundaries upstream, agents have less to violate in the first place. The two layers work together, not in sequence. The AI reads the Markdown to guide generation. The CI runner executes static YAML to enforce the boundary. The document informs, and the rule enforces.
The point is not better prompting. Prompts are probabilistic. Gates are deterministic. The goal is build-time boundaries that keep structurally invalid code out of the system, and you declare upstream so the developer's intent is legible to the agent before generation begins. As syntax becomes cheap and abundant, architectural control becomes the scarce resource, and effective governance starts upstream, where intent, constraints, and threat models shape the agent's working context.
What the developer's role becomes when enforcement is in the pipeline
When enforcement is baked into the pipeline, the senior engineer's job shifts from reviewing what agents built to declaring what they are absolutely forbidden from building. That is a more leveraged and more durable form of architectural control. The limiting factor in agent-assisted development has shifted from the model to the connective architecture around it. Most organizations have access to good AI tools. Very few have built engineering environments that can deliver against expectations.
The most valuable skill is no longer writing code efficiently. It is articulating tasks with sufficient clarity, context, and constraints that agents generate structurally valid output. The emerging term for this discipline is context engineering. The architecture it requires has three parts: knowledge that agents can consume, a harness that enforces quality deterministically, and the discipline to treat the SDLC itself as a product. Enforcement is the harness. The graph is the knowledge layer. Both must be designed and maintained, and that is where the senior engineer's attention goes.
The human work does not disappear. It relocates, from inspecting the code to owning the intent the code was supposed to satisfy. STRACE's causal extraction framework points toward the same principle at the optimization layer: the node where an error manifests is not where it originates. The senior engineer's job is to own the upstream model, not to triage the downstream symptoms. Enforcement is not a constraint on developer autonomy. It is an amplifier of it. The developer who declares the boundaries is the one whose intent actually survives at agent speed.
Current verification workflow
Dependency information can help explain a change’s reach, while CI still needs to establish the outcome of the tests it is responsible for running. Graphide CI runs existing GitHub Actions jobs on Graphide runners, using warm caches, and splitting long test steps only where a check shows every result stays the same, to reduce waiting while preserving the pass/fail verdict. A failing test fails the job. Graphide review is a separate product that presents changed behavior and findings with evidence; it does not block merging on its own. Consult the current documentation for supported workloads and limitations.
Product information updated November 13, 2026 to reflect Graphide’s current CI and review products.
Sources
- Versioned Transitive Dependency-Closure Binding and Operation-Time Effect Governance for Agent Skills: ClosureBound
- From Noisy Traces to Root Causes: Structural Trajectory Analysis and Causal Extraction for Agent Optimization
- Recursive Governance: A Graph-Theoretic Framework for Risk Propagation and Drift Detection in Agentic AI Systems
- The Missing Architecture for Agentic Software Development
- Architecture Without Architects: How AI Coding Agents Shape Software Architecture


