Dependency Graph Analysis for Production Repos
Computed call relationships let CI block bad agent changes.
Sponsored by Graphide

Dependency graph analysis makes production repositories reviewable when agents generate changes faster than people can read their diffs. Its value is not a better picture of the codebase, but a computable account of call relationships, blast radius, and structural drift. When that account governs CI, developers can enforce architectural boundaries instead of trying to reconstruct the whole system from changed lines.
Why production codebases are no longer legible at the pace agents write them
Code review assumes that changes arrive at a pace a human can follow. Agents invalidate that assumption by working autonomously across dozens of steps, reading files, writing code, running commands, and iterating within a session. A single run can touch many files without the natural checkpoints of human development. The reviewer’s working memory becomes the bottleneck.
Reading every changed line does not clear that bottleneck because, to understand a repository, a reviewer must keep track of how its files relate to each other. ReCUBE shows that repository-level context utilization is hard even for state-of-the-art models. Agents can thus make changes that neither the generator nor the reviewer knows how to fit into the wider system. As that shared understanding weakens, the most important failures occur at the edges connecting individual functions to the rest of the codebase.
Where agent-generated code actually breaks: the cross-file dependency edge
An agent can satisfy the immediate requirements of a file while breaking a caller elsewhere. Its working context is bounded by what it has cloned or been shown, and its exploration may never reach every module that depends on a shared artifact. The changed implementation can look correct while an untouched caller receives a contract it does not expect. That failure is hard to find in a diff because the affected caller need not appear there at all.
Athena (Yan et al., 2024) frames impact analysis as the cognitively demanding task of reasoning about relationships between code constructs. A reviewer must understand not only the direct dependency but also the effects that cascade through it. The technical term for this reach is blast radius, which is the set of all entities transitively affected by a change. That set is computed from a dependency graph.
Better repository understanding by agents is a serious objection to treating this as a lasting constraint. However, ReCUBE shows that even state-of-the-art models fall well below full correctness in full-context settings. Access to repository context does not mean reliable use of it. The unresolved gap is between local correctness and compatibility with the wider system, which makes explicit dependency analysis useful even as code generation improves.

What dependency graph analysis computes and why those computations matter for review
A dependency graph turns relationships in source code into structured, queryable data. It captures caller-callee and class-member relationships, including method-level dependencies across the system. These relationships let a reviewer ask what depends on a changed entity without following references by hand through file after file.
Different computations answer different review questions. PageRank applied to a code dependency graph identifies highly imported files and structural hubs, exposing where a change may carry disproportionate impact. Traversal from changed nodes computes blast radius by following the relationships to transitively affected files, including files absent from the diff. Cycle detection finds dependency loops, such as when module A depends on B, B on C, and C on A. Together, these computations distinguish the size of an edit from its structural importance.
The 2026 ReCUBE paper demonstrates that this structure also helps agents. Its Caller-Centric Exploration (CCE) toolkit exposes dependency graph traversal through an agent-queryable interface. Agents augmented with CCE consistently outperform all baselines across all evaluated models, with improvements of up to 7.56% in strict pass rate. Graph access can thus improve the decisions made before review, rather than serving only as a way to inspect completed work. Its value multiplies when computed constraints are enforced, because a useful finding then becomes a boundary on what can merge.
How architecture drift develops silently in an agent-assisted codebase
Architecture drift develops through a sequence of locally reasonable changes. An agent session optimizes for its immediate task without maintaining architectural intent across sessions. Later sessions can repeat or build on a pattern that was added without seeing how it clashes with the broader design.
Context drift gives this cumulative problem concrete forms. Agent-generated changes can reach beyond their original scope, introduce patterns unsuited to the codebase, or diverge from the design described in the ticket. A diff can show the individual edits without revealing the accumulated departure. To spot that departure, the relationships in the actual source must be checked against the intended boundaries. A one-time graph cannot provide that comparison for later revisions.
Mabl’s hand-built registry shows that teams are already trying to give agents a clear view of how the code fits together. The scaling limit of that approach is hand maintenance, which must keep pace with changes across the repository. A registry or diagram that was accurate when created is not evidence that the current source still follows it. The reliable counter to drift is a graph regenerated from actual source at each check. Generating the graph on an ongoing basis shows how the structure changes, while enforcement decides whether an unacceptable change can go ahead.
Why CI enforcement is the only boundary an agent reliably respects
An architectural rule becomes an operational boundary when violating it exits non-zero and blocks the merge. A rule in a diagram or prompt does not impose the same constraint. As architectural requirements accumulate in prose, compliance depends on the agent retaining and applying them throughout its work. Constraint decay makes that instruction path weak precisely where the process needs a dependable check. CI moves the decision out of the agent’s interpretation and into enforcement.
That enforcement is only as current as the graph it evaluates. CI must regenerate the graph from the exact source revision under test. Otherwise, a source-level violation can pass while the stored graph still represents the old, compliant state. Research on GitHub’s native dependency graph, presented at the 28th International Conference on Evaluation and Assessment in Software Engineering, found meaningful inaccuracies. A custom-built or source-regenerated graph is therefore preferable for policy enforcement.
A useful gate must also explain its decision. Its output should state the governing decision, affected files, detected violation, approved alternatives, and exception path. A block without that context invites workarounds. This is enforcement with an explicit route for judgment about changes to the architecture. The principle is language-agnostic and scales through computed relationships rather than the amount of code a person can read, although individual tools cover different languages and graph layers.
The current tooling landscape for dependency graph enforcement in production repos
The first tooling distinction is the layer at which the constraint lives. Package and task graphs answer different questions from file, module, and symbol graphs, so it takes more than one tool to cover the whole problem. Most production teams need two.
At the package and task level, Nx ties a project graph to affected commands, caching, and CI. It enforces boundary tags at the project level and has plugins for TypeScript, Gradle, Maven, and.NET, with community plugins for Go. The command npx nx graph opens the graph, while nx affected runs tasks only for changed projects. Turborepo derives its package and task graph from the package manager and offers GraphQL repository queries through turbo query. It provides a low-ceremony entry point for JavaScript and TypeScript workspaces, though cycle detection is not its focus.
At the file and module level, dependency-cruiser validates dependencies against configured rules and handles JavaScript, TypeScript, Vue, and Svelte. Its supplied rules cover circular dependencies, orphaned modules, and production code importing development dependencies, making it directly suited to architectural gates in CI. Madge offers a fast route to a module graph and a list of circular imports through --circular, with --orphans and --image supporting other inspections. It reads AMD, CommonJS, ES6 modules, and CSS preprocessors including Sass, Stylus, and Less. Knip uses the module graph to find unused files, exports, and dependencies, with its focus on dead code and less on cycle enforcement.
Below package boundaries, full AST analysis can build file and symbol graphs for code in different languages. Tools at this layer can expose 17 or more edge types together with git-derived signals such as ownership, churn, and blast radius. For example, repowise parses code in 27 languages to a full AST for file and symbol graph analysis. This is the layer where a shared utility that has become a dumping ground, or two modules importing each other, becomes visible. An MCP or queryable API can also expose that structure to agents during planning, making structural context part of the workflow.
What it looks like in practice to steer agents on a dependency graph rather than review their diffs
A graph-led development cycle starts by defining the allowed change. Before the agent runs, the developer marks which modules are in scope and which boundaries cannot be crossed. The developer pays close attention to structural hubs and decides whether a new dependency needs sign-off. These constraints describe where the task may change the architecture.
This reverses the verification problem in which implementation takes minutes but careful review and manual testing take many times longer. Faster generation makes that imbalance worse if all scrutiny remains downstream. Giving the agent caller-centric graph access brings relevant relationships into planning, while CI checks whether the resulting source respects the boundaries. The two uses are complementary. Better context reduces avoidable mistakes, and enforcement catches violations without depending on the agent’s own judgment.
That distinction also addresses the weakness of asking an agent to review its own work. The same model can restate the assumptions behind its implementation. A graph-based gate instead evaluates explicit structural constraints against the source. The developer’s task becomes defining those constraints, interpreting the blast radius of proposed changes, and deciding whether a violation warrants a correction or a rule change.
Getting started: the right entry point for a production repo that has never had a dependency graph
A single question about the current codebase provides a starting point: what does a file’s blast radius look like? Answering it before the next agent session is more useful than beginning with a full architectural audit. The first graph should address the team’s most urgent pain. Its purpose is to expose a relationship the existing review process struggles to hold in view.
For a JavaScript or TypeScript monorepo losing CI time to circular dependencies, Madge’s --circular flag can produce a first answer in minutes. If the immediate need is rules that fail the build, dependency-cruiser’s config-based enforcement is the direct next step. If the problem is symbol-level impact and blast radius across multiple languages, the appropriate layer requires a tool that parses to a full AST. Each starting point fits a different constraint, and a repository can start with the one it needs without going through them all.
Before the next agent PR merges, encode at least one architectural constraint as a CI gate. A rule against circular imports in the core module is enough to demonstrate the pattern and provide a template for further rules. Regenerate the graph from source on every check, never treating a committed graph file as the enforcement artifact. Success is a constraint violation in an agent-generated PR exiting non-zero and blocking the merge before a human has to discover it in a diff.


