Est.

Agent-Readable Architectural Scorecards From Live Dependency Graphs

Automated checks catch when AI agents drift from intended architecture using live dependency graphs.

Sponsored by Graphide

Shipped by Agents Editors
· 8 min read · Updated
Cover illustration for “Agent-Readable Architectural Scorecards From Live Dependency Graphs”
Agent-Generated Code · November 2, 2026 · 8 min read · 1,876 words

Architecture drift in AI-generated codebases is the buildup of structural changes that meet the needs of each task but break with the intended design. Agent-readable architectural scorecards find that drift by checking explicit constraints against a live dependency graph and returning structured pass/fail signals. The prerequisite is a current, queryable model of the codebase, because agents cannot reliably enforce boundaries that exist only in human memory or documentation.

Why agents need a machine-readable picture of the codebase before they touch it

AI coding agents select frameworks, wire integrations, and scaffold infrastructure without necessarily having a machine-readable record of the intended architecture. They read the codebase as it exists. An accidental dependency can look as legitimate as a deliberate one. Without encoded intent, the agent has no reliable basis for distinguishing them.

These violations can go unseen when a review focuses on the task. A change may do what was asked while crossing a module boundary, bypassing a gateway layer, or adding a package cycle. These are structural failures. As generated changes accumulate, inspecting each diff becomes a poor substitute for checking the relationships those changes create across the codebase. The detection mechanism must therefore operate on structure, rather than depend entirely on a reviewer reconstructing it.

Steve Yegge says he produced close to a million lines of code in a year using multi-agent systems. His Gas Town system runs 20–30 parallel agents, so a shared model of the codebase state that agents can query is needed both to coordinate their work and to help with review. Otherwise, each can satisfy its immediate assignment while contributing to a design that none of them evaluated as a whole.

What a live dependency graph actually is and why "live" is the load-bearing word

A dependency graph represents codebase elements as nodes and their dependencies as edges. A static import graph captures those relationships at a particular point in time. A live dependency graph is regenerated on every commit or CI trigger, stored in a versionable format, and queryable without human translation. Freshness is part of its meaning. An agent planning a change needs the relationships that exist now, rather than those recorded before intervening changes.

However, freshness alone does not establish completeness. Static tools such as dependency-cruiser and Nx project graphs are fast and CI-friendly, but static imports do not capture runtime service calls, generated code, or shared environment configuration. This limitation becomes consequential when a graph determines which builds can be skipped. An affected-only build is safe only if the dependency model includes the relevant edges. A missing edge can hide the very relationship that should have triggered work.

A stronger model has both static edges for build-time dependencies and runtime-trace edges for service call maps. Anatoly A. Krasnovsky’s Model Discovery and Graph Simulation proposes automatically synthesizing an analyzable system model from telemetry and other existing artifacts. Placing that discovery after the build stage allows CI to produce an updated model on each commit. The resulting graph must version with the code. A diagram stored in Confluence apart from the code can serve the same role only if its relationships become structured data that agents and CI can query and compare.

How design intent gets encoded as machine-readable constraints on the graph

A current graph describes what depends on what, but it does not establish which dependencies are permitted. That requires a separate declaration of intent. Machine-readable constraints connect the intended architecture to the graph by referring directly to its nodes, edges, and declared layers. For example, “module A must not import module B” becomes a predicate that fails when an import edge connects A to B. The rule is evaluable because its terms identify graph elements.

An enriched Architecture Decision Record, or ADR, provides a durable home for that declaration. It combines human-readable rationale with structured identity, lifecycle, ownership, scope, relationships, required behavior, and enforcement references. The metadata establishes where a decision applies and how it is checked. The rationale explains why it exists. Metadata alone is not an executable rule, but metadata linked to a graph predicate turns a documented decision into something the pipeline can enforce.

AGENTS.md complements that role with repository-level instructions, context, and conventions for coding agents. It tells agents how to work within the codebase, while enriched ADRs identify structural decisions and their enforcement references. Neither replaces the other. The MCP protocol and the AGENTS.md convention provide a common integration architecture for tooling, but the repository still needs explicit design content. Architecture, testability, and documentation become part of the agent’s operating context, so encoding intent configures behavior before code generation begins.

How do you detect when AI-generated code diverges from the intended architecture?

The detection step evaluates declared constraints against the live graph. For each constraint, it either confirms compliance or identifies the nodes and edges that violate the rule. This is a graph query. The evaluator walks edges, checks which declared layers the nodes belong to, and tests relationships against the predicates that apply. Given the same graph and constraint set, the result is deterministic, although its coverage remains bounded by what the graph and rules represent.

Graph-It-Live issue #390, opened in October 2026, proposes a way to make this output agent-readable. Its Architecture view shows existing dependencies, while its checks flag dependencies that are disallowed. The proposal includes CLI output in JSON, toon, Markdown, and SARIF formats for use in the editor, CI, and agent workflows. Its enforcement scope is static import pairs. It illustrates the scorecard interface without establishing that the tool implements the broader hybrid model of static and runtime dependencies.

For automated consumption, JSON or SARIF avoids requiring an agent to reinterpret a prose summary. Each scorecard entry should include a constraint identifier traceable to an ADR, the relevant edge or node, the declared rule, and a pass/fail status. Severity shows which failures should block a change and which should be warnings. SARIF also enables GitHub code scanning annotations. That places violations on the diff where an agent or reviewer can act on them, rather than leaving the findings in a disconnected report.

Nx’s affected-set computation offers a useful analogy. It determines which nodes a change touches so that work can be limited to the affected slice. The same approach can limit constraint evaluation to the rules that apply, as long as the graph has the dependencies those rules need. The question changes from what to build to what violates the design. That distinction gives an agent a basis for revising a change or escalating it.

Where agents consume the scorecard: pre-action queries, mid-task verification, and CI enforcement

Before acting, an agent queries the scorecard and applicable constraints for the modules it plans to modify. The answer draws on the current dependency model, which repository instructions alone do not provide. The agent can tell which relationships break the rules and which are allowed. Pre-action queries thus narrow the choices without a human having to put architectural intent into a new prompt for each task.

Mid-task verification checks a proposed change against the same constraints while there is still time to revise it. It catches violations in the plan before it runs and checks generated changes before they reach the merge gate. CI then supplies the independent enforcement point. A required check exits non-zero for blocking constraint violations, preventing merge regardless of whether a human or an agent authored the change. These three points serve different purposes, so an early query does not remove the need for final enforcement.

Meta’s RADAR system demonstrates why automated changes need risk-sensitive routing. Its AI Commit Eligibility pipeline handles bot-authored diffs, allowing low-risk changes to land without human review while routing higher-risk changes to reviewers. Stripe’s Minions system produces more than 1,300 production pull requests each week, illustrating the throughput such controls must accommodate. Neither example establishes a dependency-graph scorecard implementation. They show why architectural checks need to operate within the delivery loop rather than depend on proportional growth in human review.

Yegge’s Beads illustrates the adjacent need for persistent, queryable coordination data, with issue storage originally based on JSONL in git and a SQLite cache, later migrated to Dolt as the primary database. The scorecard serves a different purpose. It gives agents working in a system such as Gas Town a shared view of what the design allows, so they coordinate around architectural boundaries as well as who owns each task and how far it has progressed.

The objection the scorecard must answer: encoding what, not why

A scorecard can identify a forbidden edge without explaining why it was forbidden. That is a substantial limitation. An agent may satisfy every encoded predicate while undermining the reason those predicates were introduced. Patterns in the code do not show which shortcuts caused incidents, why the team turned down an alternative, or what users do beyond what the written requirements describe. A passing scorecard can therefore produce false confidence if it is treated as proof of architectural soundness.

Each scorecard entry should attach causal provenance to the constraints by identifying the ADR that explains the reasoning, the incident or design decision behind the rule, and the scope conditions under which an exception is legitimate. An agent encountering a violation can then retrieve the rationale. This connects the deterministic result to the context needed for a decision about repair, exception, or escalation.

That connection also makes deviations auditable. A violation is recorded against a named rule that can be reviewed, disputed, or deliberately updated, rather than against an implicit convention discovered months later. Severity must match how sure the team is of the rule. A well-established constraint should block merge, while a constraint still being validated should warn and require human acknowledgment before merge. High-severity violations that cannot be resolved automatically should escalate to a person, preserving judgment where a pass/fail predicate is insufficient.

How the graph-as-source-of-truth model changes what developers actually do

When constraints are enforced automatically, more of the developer’s work goes into designing the system in which agents work. Reviewing generated code remains necessary, but it is no longer the only place architectural judgment enters the process. The developer sets boundaries, records why they exist, assigns severity, and decides when exceptions are allowed. This context engineering specifies what agents see and what they are permitted to change before implementation choices spread through the codebase.

Instead of reconstructing architecture from a two-thousand-line diff, the developer specifies the solution space that every agent queries. That common model reduces the opportunity for contradictory structural decisions, while CI checks the result after changes converge. Enforcement gives the model practical authority. Without it, even a clearly stated architectural declaration is still advice that an agent or human can bypass.

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.

Sources

  1. Model Discovery and Graph Simulation: A Lightweight Gateway to Chaos Engineering

More in Agent-Generated Code