Architecture Topology as the Durable Constraint Layer Prompt Engineering Cannot Provide
Architectural rules in code survive model updates and attention drift where prompts alone cannot.
Sponsored by Graphide

An interactive codebase graph for AI agent steering gives developers a shared map of code structure, while repository rules make its architectural boundaries enforceable. Prompt engineering can guide generation, but it cannot provide a durable constraint layer. Architectural topology can, because its rules persist in the artifact and run at every commit, outside the model’s attention and update cycle.
Why prompt engineering became the default guardrail for AI agents, and why that was always a fragile bet
System prompts, instruction files, and natural-language rules became the default surfaces for governing agents because they were the first available means of influence. Teams used them to set out naming conventions, dependency boundaries, and other expectations that people had previously had to judge for themselves. They filled a gap in the development process. Treating those instructions as enforcement was risky because stating a boundary does not create a check that rejects code that crosses it.
Konrad et al.’s 2026 paper, Architecture Without Architects: How AI Coding Agents Shape Software Architecture, names this pattern “vibe architecting.” Agents select frameworks, configure databases, and set up authentication without recording a justification for their choices. The paper’s illustrative demonstration shows that prompt wording alone produces structurally different systems for the same task. Architecture is therefore sensitive to phrasing before any later drift occurs. That is a different property from a declared dependency rule whose meaning stays fixed while implementations change.
Bain’s 2026 technology report identifies the surrounding organizational gap as a lack of explicit, machine-readable engineering knowledge. Much of that knowledge remains in people’s heads and emerges through conversation. Prompts try to fill that gap with words. However, a conversational account of an architectural decision is not yet a checkable representation of it, which leaves the model responsible for both interpreting and honoring the boundary.
How transformer attention geometry makes prompt-based constraints degrade over generation length
Within a long generation, that dependence on interpretation becomes a dependence on attention. Transformer attention distributes across the context, and position bias and attention drift can weaken the influence of an earlier instruction as generation proceeds. The instruction need not disappear from the context. It can remain available while no longer exerting enough influence over the next implementation decision.
A concrete example makes the distinction clear. A system prompt defines AuthConfig with tokenExpiry: 3600 at line 50, but by line 400 of generation the agent writes a session handler with a hardcoded expires_in: 86400. The constraint was present throughout the task. The contradictory handler illustrates why checking that an instruction was supplied is not equivalent to checking that the generated code obeys it.
Larger models do not remove this structural vulnerability. Attention drift, error cascade, and coherence decay are not simply capability gaps that additional parameters resolve, and no prompt technique reliably overcomes them. The reported gap between isolated-task performance above 80% and continuous-evolution performance below 38% is consistent with the breakdown of context management and verification over longer work. Those figures describe different operating conditions. The implication is that prompt-based constraints inherit a weakness from the model architecture before any team writes the prompt.
A second failure mode prompt engineering cannot address — silent regression after model updates
Attention drift unfolds within a generation, but model updates introduce a separate source of instability across a system’s lifecycle. Providers can update weights and reinforcement learning parameters without requiring any change to a team’s prompts. The input stays identical while behavior shifts. The output may then break a constraint it used to follow, even though the repository has stayed the same.
The prompt itself supplies no failure signal. Unless an independent check detects the violation, there need be no error, failed test, or CI signal to distinguish the new behavior from an acceptable result. Discovery falls to review or production. The objection that static frameworks are also vulnerable to model drift applies to prompt-dependent behavior, while graph-checked constraints evaluated outside the model remain unaffected by model drift.
Konrad et al. distinguish “contingent couplings,” whose effects may weaken as models improve, from “fundamental couplings,” which persist regardless of model capability. Their examples include structured output validation and tool-call orchestration, respectively. That distinction also clarifies where architectural constraints belong. A dependency rule evaluated against code does not need the generating model to remember, interpret, or endorse it.
How agent output volume outpaces every human and LLM-based review mechanism available today

Independent review might appear to supply the missing backstop, but its workload grows with the output it must inspect. Bain’s report finds that developers get meaningfully more tasks done while the time spent on review rises roughly four times as fast. Generation is no longer the binding constraint. The pressure has moved to the process that decides whether the generated changes are acceptable.
LLM-based review does not reliably close that gap at larger diff sizes. Reported F1 falls from 0.657 on diffs under 10 lines to 0.043 on diffs over 150 lines, while real pull-request diffs have a median of 117 lines and can reach 562. The deterioration occurs where substantial changes need scrutiny. It undermines the assumption that another model can reliably recover every architectural violation missed during generation.
The complexity of tasks agents can handle doubles about every 7 months, but the amount of work reviewers can check does not grow as fast. Both human and LLM review operate after the artifact exists, asking a reviewer to reconstruct intent and identify departures from it. Review remains useful for judgment, but it cannot serve as the sole enforcement mechanism for boundaries that can be expressed and checked directly.
What “architectural topology” means as a constraint layer and why it survives what prompts cannot
Architectural topology works like a build rule for dependency structure. A dependency that breaks the rule fails the check, just as breaking a build condition causes a build to fail. The rule tests the artifact the agent produced against an explicit boundary.
Concretely, topology is a machine-checkable dependency graph stored in the repository and evaluated at build time. Language-appropriate tooling parses imports into a directed graph whose nodes are modules and whose edges are dependencies. Declared rules then test that graph for layer crossings, cycles, or prohibited dependencies. A violation produces a non-zero exit code, regardless of what the prompt said. Because the rules version with the code and run in CI, they remain available through context resets, model updates, and agent handoffs.
The useful contrast is between a silent review miss and an explicit rejection. A failing build that prints the constraint it checked, the affected files, the violation, and the approved alternatives gives the developer what they need to fix it. A diff review that overlooks the same dependency supplies no such signal. This is why a navigable diagram alone is insufficient as a constraint layer. Its boundaries must also be executable.
Static checks evaluate declared boundaries before deployment, while runtime tracking detects unexpected inter-service communication patterns in production. Both operate outside the generating model. Their durability comes from that separation, although their coverage still depends on which constraints have been encoded and which relationships the checks can observe.
What teams enforcing topology in CI actually look like — three production patterns from 2026
The 2026 examples show three related patterns for moving control out of the prompt, though they do not all implement a dependency graph. Stripe illustrates specification-first governance at a shared review gate. ContextCov illustrates executable restrictions on agent actions. Repository analysis shows how rules for code structure can be enforced directly. Their convergence is a decision about where authority resides.
Stripe gives each agent, called a “minion,” a specification defining its objective, scope, relevant context, verification method, and constraints. Each week, its 1,300 AI-authored pull requests go through the same review gate. The specification establishes the terms of the work. Bain’s report says the gains come from that specification, with its clearly stated engineering knowledge, rather than from trust in what the model generates on its own.
ContextCov’s 2026 approach derives executable constraints from agent instruction files and intercepts shell commands through $PATH manipulation. When an agent runs npm or pip, a shim checks the command against declared architectural constraints before execution. The instruction becomes an executable check on the action. For semantic constraints that static analysis cannot verify, ContextCov uses an LLM-as-judge to complement enforcement.
The kadupulhq/kadupul pull request dated October 29, 2026 demonstrates the repository-analysis pattern. It adds PHPStan, Deptrac, and a composer-dependency-analyser to a static-analysis CI job because docs/architecture.md was enforced only by tests/Symfony/ArchitectureTest.php, using a token scan without Infrastructure rules. Deptrac encodes the boundaries per layer, while PHPStan gives new source code a type floor. CppDepend 2026.2 represents the same build-gate pattern by failing builds when quality gates or compliance rules are breached. CppDepend’s framing identifies subtle architectural creep, including dependencies that create circular loops across modules, as a weakness of manual review that graph-level checks address directly.
The objection that topology enforcement raises barriers and limits accessibility, and why it conflates authoring with enforcement
Encoding rules requires deliberate architectural decisions. If every team had to build a sophisticated constraint framework before using agents, the overhead could approach the traditional architecture work that AI was supposed to reduce. Rule authoring cannot be wished away. Someone must decide which dependencies are allowed and what the system lets agents do on their own.
However, authoring the policy and enforcing it are different tasks. Deptrac, Dependency Cruiser, and ArchUnit express rules declaratively, making repository enforcement closer to maintaining a linter configuration than constructing a bespoke framework. A rule such as “the service layer may not import from the persistence layer directly” can be one declarative line. The rule pays off each time it runs, including on changes where someone might otherwise have to find the same violation across forty files.
Bain’s report locates the leverage in making engineering knowledge explicit and structured. The kadupul pull request added enforcement without a rewrite. That invests design work in a versioned mechanism to replace perpetual prompt re-engineering whose failures can remain silent.
Clear scope and constraints help prevent gold-plating, undeclared dependency introduction, and scope creep. The benefit extends to the review workload. Reviewers can spend less effort rediscovering encoded boundaries and more effort on decisions that still require judgment, while the same rules apply across successive agent runs.
How do developers use a live codebase graph to steer AI agents.
A live architecture graph changes the developer’s unit of attention from isolated edits to structural changes. A graph that maps modules, files, classes, functions, and call relationships makes the relationships across forty changed files visible without requiring forty separate file readings. It provides a shared map for agent work. Prompts can state intent, and diffs can show edits, but neither alone provides that navigable account of how the resulting system connects.
For an interactive codebase graph to support AI agent steering, navigation and enforcement have distinct roles. Navigation exposes the current structure and the relationships affected by a proposed change, while declared rules define which structural changes are permissible. Neither role substitutes for the other. A graph without checks can show an architecture that breaks the rules, while checks without a model developers can navigate can reject a change without showing enough of the surrounding structure to help them steer the next one.
Putting architectural checks in CI
Choose an architecture-test or dependency-rule tool that supports your language and the constraints you can explicitly encode. Commit its rules with the code, run the documented command in CI, and make the resulting check required where those rules should prevent a merge. Test the gate with an intentionally forbidden dependency before relying on it. Such checks enforce the rules you specify; they do not establish that every aspect of the architecture or runtime behavior is correct.
Updated November 5, 2026: obsolete CLI examples removed. Use the selected tool’s current installation and command documentation.


