19. Tools, agents and teams on one graph
Every tool that works on software today builds its own model of the system, and each model stops at the edge of a runtime.
The compiler sees one module, and the IDE sees one project through a language server. The Language Server Protocol standardised how editors talk to such servers, so that one implementation serves many editors [245], but each server still knows one language.
The profiler sees one process, and the tracer sees spans joined by propagated identifiers but attributed to code by name.
The test runner sees files and mocks, and the reviewer sees a textual diff.
An agent sees whatever text it has read.
Each of these tools rebuilds a fragment of the structure that the graph holds. Code property graphs showed the value of merging representations: a graph that combines syntax trees, control flow and data dependence exposes vulnerabilities that none of the three exposes alone [358]. RG does the same for a whole system. With the graph present, a tool is a traversal or an executor, and what it produces (findings, plans, observations and claims) is graph data that other tools read. Figure 30 shows the arrangement, and Table 26 lists what each tool reads and writes.
Figure 30. Tools on one graph. People, agents and rewriting tools change the system only through patches, which the kernel checks, plans and admits. Compilers, analysers, tests, profilers and checkers read through typed queries that state their coverage, and write back findings, observations and claims that every other tool can read.
| Tool | Its own model today | What it reads from the graph | What it writes back |
|---|---|---|---|
| Compiler | one module | bindings, placements, consumers, profiles: the compilation plan | artefacts with digests; findings |
| Language server, IDE | one project | the elements behind each source span; connections across runtimes | diagnostics at source spans |
| Profiler | one process | the latency model; incidences | observations per incidence and revision |
| Tracer | spans named by service and operation | the instrumentation plan | observations joined by element identity |
| Test runner | files and mocks | the impact set; contracts; outcome types | evidence that attests claims |
| Fault injector | random faults | sessions with effects, handovers, outboxes, failure domains | counterexamples as findings |
| Static analyser | code | effect, authority and flow summaries | findings with witnesses and coverage |
| Refactoring engine | syntax trees | the preconditions of rewrites | patches |
| Debugger, incident tools | logs | why-queries, revisions and patches | timelines; runbooks as plans |
| Review | textual diffs | graph diffs, impact, stale claims | approvals, exercised under grants |
| Build and CI | build files | the impact traversal | artefacts and evidence |
| Agent | the text it has read | traversals with coverage | proposals, findings and receipts |
19.1 Compilers and language tooling#
Section 10.7 describes how the compiler uses the graph to optimise. Language tooling gains three further things.
Checks across runtimes. Each compiler checks its own runtime; the graph checks the boundaries between them. A Kotlin/JS Worker calling a JVM service, the Swift shell calling Kotlin/Native, a C++ codec behind a trunk and a SQL schema read by three services are each checked against one contract.
Navigation across runtimes. A language server backed by the graph can go from a call site to the provider that serves it in another runtime and another repository, find every consumer of a channel, and show on hover where a component is placed and under which grants it acts.
Diagnostics where the cause is. A rule that fails on the graph is reported at the source span that created the offending element, so an error about placement or authority appears in the editor, next to the line that caused it.
19.2 Performance engineering#
Profilers and tracers today describe one process or one request. Because observations are joined to elements and incidences by identity, the graph turns them into a profile of the system.
Where time goes. The critical path of a user action, across phone, edge, cloud and database, is a max-plus path problem over observed latencies.
What if. The orders of magnitude of Section 3, calibrated by observed latencies, predict the effect of moving a component before the move. The placement solver uses the same estimates, and observations afterwards confirm or refute the prediction.
Which change. Observations carry revisions, so a regression is attributed to the patch that introduced it, not to the deployment that happened to be nearby.
How much load. The capacity of a single path is a max-min path problem over observed throughput; where paths share a resource, such as a connection pool, capacity is a flow problem over the graph. A load test that shifts live traffic is a plan, observed and reverted like any release.
The same profiles feed profile-guided compilation (Section 10.7), so measurement and optimisation share one representation.
19.3 Testing and fault injection#
Selection by impact. Regression test selection by dynamic file dependencies already avoids running unaffected tests [147]. Selection by the impact traversal also follows dependencies that cross runtimes and pass through data.
Tests from contracts. Property-based testing generates inputs from types [62]. Contracts are canonical schemas, so generators come from them directly, and every boundary gets a test on both of its sides.
Faults where they matter. The graph says where faults can hurt: every Session with an effect, every handover of an exclusive component, every outbox and every failure domain. A fault plan injects loss, duplication, delay and crashes there, and checks the resulting histories against the TLA templates and the declared QoS. Where providers are replaced by models of their families, this is deterministic simulation in the style of FoundationDB [366], aimed by the graph rather than at random. Against real providers, such as Workers, Durable Objects or Postgres, it is fault injection, not simulation, because their schedules cannot be controlled.
Coverage of the system. Line coverage says little about a distributed system. System coverage counts which incidences, transitions, outcomes (UNKNOWN included) and grants the tests exercised.
Replay. A production failure captured at boundaries becomes a regression test.
19.4 Static analysis and security#
Infer showed that compositional analysis scales to very large code bases when procedures are summarised and only changed code is reanalysed [49]. RG’s analyses are compositional over the graph in the same way: effect footprints, authority, label flow and tenancy are summaries per element, combined along connections and maintained incrementally under patches (Proposition 7). Analysers that index code bodies, such as CodeQL [21], remain useful inside components. A security review reads grants and flows rather than reconstructing them, and every artefact derives from its sources, so the provenance of a release is a query.
19.5 Refactoring and migration#
A refactoring is a transformation that preserves behaviour, guarded by preconditions [273]. In RG a refactoring of a system is a rewrite whose preconditions are checked on the graph, and whose result must refine the original (Corollary 5). A rewrite that adds behaviour is not a refactoring: it states the behaviour it adds, and review approves it as a change.
Move a component to another place. Its Binds that now cross places become Sessions, and the compiler flags every call site that must now handle UNKNOWN. The move adds behaviour (calls that fail or end in UNKNOWN), so it is such a change rather than a refactoring.
Split or merge services. The rewrite reassigns ports and checks that no contract or grant is lost.
Extract a region for code push. The closure computation states what else must move with it.
Strengthen a channel’s QoS or evolve a contract, with the migration that the change requires.
The graph checks the structure, and agents or people edit the bodies that the rewrite leaves to them.
19.6 Debugging and operations#
Provenance makes why a query: why a route is unreachable, why a request took two seconds, why a grant was needed (Section 8.2). Revisions make when a query: what the system looked like at any time, and which patches separate two times. Centrality on the incidence graph estimates the blast radius of a failing element (Section 3). An incident timeline assembles itself from observations joined by identity, and a runbook is a plan with preconditions rather than a document.
19.7 Review, build and release#
Review moves from textual diffs to graph diffs that are ranked by risk and carry their computed impact and the claims they make stale (H6). The build graph is a projection of the system graph, as Bazel’s action graph of actions, inputs and outputs is a projection of a build [331]. Artefacts are addressed by digest, and CI runs the impact set rather than everything. Release admission then requires fresh evidence for exactly the digests being released (Section 15).
19.8 AI agents#
Studies of coding agents point in one direction: structure helps.
SWE-agent showed that the interface between agent and computer strongly affects results [359].
Agentless showed that a fixed pipeline, which localises a fault, repairs it and validates the repair, is competitive with open-ended agents [356].
CodePlan framed edits across a repository as planning over a dependency graph [25], and RepoGraph showed that a graph of the repository improves agents [276].
Language models use long contexts unevenly and often miss information in the middle [227].
The graph offers agents what these studies point to, at the level of the whole system.
Context with coverage. A task’s context is a traversal: small, typed and relevant, stating what it did not cover. The agent does not need to read files to find out what exists.
Localisation as a query. The elements that a task touches, and their source spans, are computed rather than searched for. Exploration took 31–63% of agent round trips in our measurements (Section 18).
Actions with immediate, precise feedback. An agent proposes a patch, and the kernel answers at once with findings and witnesses. That is a dense, exact signal, unlike a test suite that runs for minutes and reports one failure.
Safe parallelism. Patches to the graph that touch different elements commute (Theorem 10), so structural conflicts appear as soon as two patches exist rather than at merge time, and many agents can work on one system at once. Bodies still merge as text, and patches that commute can still be incompatible in meaning, which checks and tests must catch.
Bounded authority. An agent is a principal with grants and effect ceilings, and labels bound what injected content can cause (Section 17.1).
An interface designed for agents. Query, propose, check, plan and observe are typed operations, exposed as tools in the Model Context Protocol [18].
19.9 People and agents together#
Section 18 fixes the division of labour: people own intent, invariants, policy and approval; agents explore, propose and write bodies; the kernel checks; executors apply. Six patterns of collaboration follow from it.
Intent first. A person states intent as claims and invariants, and agents propose patches that must satisfy them.
Designer and programmer. As in a game studio, a person composes features in graph-owned scopes in the workbench, as a designer composes Blueprints, while agents write and maintain the Kotlin bodies behind the ports, as programmers maintain the C++ behind reflection (Section 4). The roles can also be reversed.
Review by exception. The kernel checks everything mechanical, and people review what the risk ranking surfaces: changes of authority, new external effects, declassifications and stale claims.
Teams of agents with roles. A planner, an implementer, a tester and a reviewer are distinct principals with distinct grants. Because no principal approves its own proposal (A5), review by a second principal is enforced rather than customary. A5 alone does not make review independent: an operator could mint a second agent with the same model and the same inputs. Approval grants above an effect class are therefore held by a person, or by a principal with its own delegation chain and a different model.
Earned autonomy. An agent’s grant widens as receipts and accepted patches accumulate, and narrows after a bad change. Autonomy is evidence-based rather than a switch.
Explanation on demand. Programmers who work with code-generating models alternate between accelerating what they already intend and exploring what they do not yet know [27]. The graph supports both: typed completion of edits for the first, why-queries for the second, so that people stay in control without reading all the code.
19.10 Risks#
Moving tools onto one graph creates new risks.
Automation bias. People may approve what the ranking does not flag; H6 and H7 measure accepted defects, not only speed.
Deskilling. People who read less code may understand less of it, so explanation is part of the design.
A valuable target. The graph is a complete map of the system, so it must be protected by the same grants and labels as the data it describes.
A dependency. If the kernel is unavailable, tools fall back to their own models; the graph must degrade to a cache, not to an outage.