A build system determines how code is built and tested from declared targets and dependencies. Its project graph also gives an AI agent a way to navigate a codebase and estimate what a change might affect—without guessing from file names or relying on tribal knowledge. section 10.2.2 section 10.2.4
Build declarations can record project dependencies, available tasks, inputs, outputs, and tags. Query dependencies to find what a target needs; query reverse dependencies to find its consumers. The result is only as useful as the declarations and tags behind it. section 10.2.2
Listing 10.2 Query-based navigation and blast radius computation
bazel query 'deps(//packages/checkout:all)' --output=package # Navigation: what does checkout depend on? bazel query 'rdeps(//..., //libs/shared-utils:all)' --output=package # Blast radius: what depends on shared-utils? bazel test $(bazel query 'rdeps(//..., //libs/shared-utils:all)' \ --kind='test_suite rule') # Targeted testing: only test what this change actually affects
These Bazel queries illustrate dependency navigation, reverse-dependency analysis, and targeted testing. section 10.2.2
Use the graph as a change workflow, not just a build-time artifact:
- Navigate to the active target using its metadata, then make the change within that scope. section 10.2.2
- For shared code, query reverse dependencies and run consumer tests before submitting. Investigate failures outside the edited library too. section 10.2.2
- Record affected consumers in the pull request so reviewers can inspect the intended blast radius. section 10.2.2
Target granularity
A 45,000-line service with one target rebuilt the entire service and ran 847 tests for any change, taking 4.2 minutes. Smaller targets can narrow builds, test selection, and an agent's reasoning scope. The tradeoff is more declarations to maintain; dependency-detection tools can help. section 10.2.4
Static instructions can say to run tests, but they cannot report the current affected projects. A live interface can expose build metadata to an agent while it works. For example, Nx can connect an agent to the project graph and CI through an MCP server and provide workspace exploration and task-execution skills. section 10.2.5




