DEV Community

Cover image for Your AI Coding Agent Needs a Dependency Graph, Not Just a Repository
Nacho Aldama
Nacho Aldama

Posted on

Your AI Coding Agent Needs a Dependency Graph, Not Just a Repository

Tools like Claude and Cursor can generate a clean component in a couple of seconds. But generating isolated code is the easy part. The actual challenge is modifying a production system without breaking things three steps away.

Disclaimer: I work at Bit, and this post is based on what I've seen while working on the product.

Right now, we feed agents raw repository trees. That gives them source text, but it rarely exposes the operational context they actually need: component boundaries, published APIs, downstream consumers, or build dependencies.

If we want agents to do more than generate plausible-looking PRs, they need to navigate the codebase the way a senior engineer does: through an explicit dependency graph.

A repository snapshot is rarely the whole system

Take a dead-simple schema tweak:

// before
type Order = { total: number };

// after
type Order = { totalCents: number };
Enter fullscreen mode Exit fullscreen mode

TypeScript catches this rename when the consumers are visible to the same typecheck. Useful, but not the interesting failure.

Now keep the field name and change only its meaning:

// before: dollars
type Order = { total: number };

// after: cents
type Order = { total: number };
Enter fullscreen mode Exit fullscreen mode

Everything still compiles. A checkout that formats 12.99 as $12.99 may now receive 1299 and render $1,299.00. An admin panel, mobile client, or partner webhook can make the same silent mistake.

Ripple CI uses Bit's component graph to build the changed component and its affected dependents. For this change, a run could look like this:

Component Status What happened
Orders API Changed total now represents cents
Partner API Passed Contract test handles cents
Storefront Passed Doesn't display total
Checkout Failed Expected $12.99, rendered $1,299.00
Admin Panel Passed Consumer tests remain green
Mobile App Running Dependent build in progress

There is no type error here. The graph identifies which consumers need to be exercised, and a consumer test or staging preview reveals the hidden assumption. Instead of getting a vague red pipeline hours later, the agent gets the exact failure and affected component, then proposes an update to Checkout for review.

Those consumers may be maintained across different packages, workspaces, repositories, or teams.

When an agent only sees the immediate repository, it finishes the task, prints a successful diff, and moves on. The breakage doesn’t show up until hours later when a completely different pipeline blows up in staging.

If the agent can query an actual component graph, its behavior changes. Instead of guessing, it can check: Who consumes this contract, where are they deployed, and what needs to be tested if I change this field?

Why component boundaries make better context

Relying on text search (or even basic vector search) over a massive codebase produces noisy context. A component-driven architecture changes this by turning the system into a queryable graph:

  • Explicit public APIs versus internal implementation details
  • Known upstream dependencies and downstream dependents
  • Independent version history and ownership
  • Discrete build and test targets for each piece

Instead of dumping twenty semi-relevant files into the prompt window, you give the agent an exact map of the software. It knows which files matter, which contracts are strictly enforced, and which services depend on the output.

Nx and Turborepo already do affected builds well inside a workspace or monorepo. Bit's claim here is different: component relationships remain explicit when versioned components are published and consumed across workspaces or repositories, and Bit Cloud pairs that graph with per-change staging and release workflows.

The feedback loop: from diff to repair

Most agent workflows stall out after code generation:

Prompt → Agent generates diff → Developer reviews raw code → CI breaks
Enter fullscreen mode Exit fullscreen mode

A workable agent loop has to give the model feedback on the ripple effects of its changes:

Fetch context → Isolated change → Preview environment → Downstream builds → Repair attempt → Review → Ship
Enter fullscreen mode Exit fullscreen mode

The useful part here is the repair attempt. If an agent makes a breaking change to a shared component, it can use downstream failure logs to identify broken callers, propose targeted patches, rerun the relevant builds, and return the result for review within the same session. It does not get to decide that the repair is correct.

Hooking the Agent into the graph via MCP

Developers don't need another proprietary chat interface; they want to use Cursor, Claude Code, or whatever workspace they already like. The bridge here is the Model Context Protocol (MCP).

When you initialize a workspace with Bit (bit init --agent cursor or bit init --agent claude), Bit writes the relevant MCP configuration and editor-specific instructions. The configuration connects MCP-aware clients to Bit Cloud's hosted MCP endpoint and exposes tools such as bit_remote_search, bit_component_details, and bit_create.

A typical interaction looks like this:

Developer: Find the component that owns Order before changing its contract.

Agent: Uses bit_remote_search to locate candidates, then bit_component_details to inspect the selected component's API, version, and metadata.

That gives the agent enough context to:

  • Find existing shared components before reinventing the wheel
  • Inspect component APIs, versions, and metadata
  • Create a component with the workspace's configured generator when needed
  • Identify relevant dependencies before editing code

After the code changes, CI feedback comes through the Bit CLI rather than MCP. The bit ripple commands expose job status, logs, and errors, and the generated agent instructions tell supported clients how to use them. The MCP tools provide component context; Ripple reports what happened after the change.

Diffs don't tell the whole story

Code review for AI changes shouldn't just be scrolling through lines of green and red text. A diff can look spotless and still fall apart at runtime:

  • Did the styling break on mobile viewports?
  • Does the actual authentication flow complete end-to-end?
  • Did the shared design token change introduce contrast issues?

Bit Cloud gives each change a staging environment with a real URL before approval. That shifts the human role from tedious line-by-line syntax checking to evaluating the actual running behavior.

A passing build is evidence, not approval. The reviewer still needs to inspect the diff, tests, and preview, and decide whether the agent's repair preserves the intended behavior. Promotion remains an explicit human decision.

Quick start

To initialize a workspace and scaffold the components from this example:

# Install Bit and init workspace
npx @teambit/bvm install
bit init --default-scope acme.shop --agent cursor
bit create node entities/order
bit create react ui/order-summary
bit start
Enter fullscreen mode Exit fullscreen mode

The example configures Cursor. Use --agent claude instead if you're working with Claude Code.

Once ui/order-summary consumes the Order contract and has a test for its displayed value, make the units change, then snap and export it to let the cloud graph run the downstream checks:

bit snap --message "update order summary to cents"
bit export
bit ripple errors
Enter fullscreen mode Exit fullscreen mode

bit ripple errors resolves the latest export job and returns the failures that need attention. In this example, the useful feedback is not another type error. It is the consumer failure showing that Checkout treated 1299 cents as 1299 dollars.

The useful part comes after the diff

Coding agents are already fast enough at producing code. The slow part starts once the diff exists: finding affected consumers, waiting for CI, tracing failures across repositories, and checking whether the change works in a running environment.

This is where the component graph becomes useful. It lets the agent follow a change beyond the files it edited and respond to the same build failures a developer would see. The result still needs review, but it can arrive with the affected components tested and a working preview instead of leaving that investigation for later.


Try Bit Cloud · The New Bit Cloud · Bit Cloud Documentation · Cloud MCP Overview · Bit 2.0 Release Notes

Top comments (2)

Collapse
 
yona-bit profile image
Yonatan Sason

Great article, truly helpful guide!

Collapse
 
joshk2 profile image
Josh Kuttler

Thanks for sharing!