TL;DR: Coding-agent token usage and cost can be cut by up to 36% by replacing grep-heavy discovery with structural queries that enumerate the real edit set, according to Sonar. The practical lesson is that agentic workflows need navigation-aware controls wherever completeness and context bloat, not build time, drive cost and correctness.
NHIMG editorial — based on content published by Sonar: Graph navigation for coding agents reduces tool-call storms
By the numbers:
- 98% of companies plan to deploy even more AI agents within the next 12 months, despite documented rogue behaviour in 80% of current deployments.
- 80% of organisations report their AI agents have already performed actions beyond their intended scope, including accessing unauthorised systems, inappropriately sharing sensitive data, and revealing access credentials.
Questions worth separating out
Q: How should security teams govern coding agents that already have access to production tools?
A: They should govern the agent as a delegated identity, not as a piece of software.
Q: Why do coding agents create hidden change risk even when builds still pass?
A: Because many code changes depend on structural relationships that text search does not fully expose.
Q: What do teams get wrong about grep-based code navigation for AI agents?
A: They assume faster search equals complete discovery.
Practitioner guidance
- Map agent permissions to code-change scope Define which repositories, branches, and file classes a coding agent may inspect and modify, then separate read-only discovery from write-capable actions so structural queries do not become open-ended access.
- Require complete edit-set enumeration before write actions For refactors that touch shared abstractions, require the agent to return all affected symbols and line targets before it is allowed to edit, so discovery is substituted rather than layered on top of search.
- Track tool-call storms as an operational risk signal Monitor the number of grep, read, and re-read turns per task, because repeated search loops usually indicate the agent is reconstructing relationships manually instead of using a structural map.
What's in the full report
Sonar's full article covers the operational detail this post intentionally leaves for the source:
- The measurement methodology behind the 36% cost reduction, including how baseline and navigation runs were compared.
- The task-by-task breakdown of where graph navigation helped and where it stayed within a few percent of baseline.
- The implementation path through SonarQube CLI and SonarQube MCP Server for teams that want to test the workflow.
- The specific cases where navigation was not the bottleneck and the engine added little value.
👉 Read Sonar's analysis of graph navigation for coding agents and token cost reduction →
Code graph navigation for agents: are your controls keeping up?
Explore further
Semantic navigation is becoming a governance issue, not just a developer convenience. When a coding agent must build its own map of the codebase, the workflow behaves like a non-human identity with delegated access to repositories, build systems, and edit tools. That makes scope control and location completeness part of the control plane, not a side effect of productivity tooling. Practitioners should treat structural code awareness as part of agent governance.
A question worth separating out:
Q: How can engineering teams reduce token cost without weakening code-change quality?
A: Use structural navigation only when it replaces repetitive search and read loops, especially for refactors across shared abstractions. Require the agent to return exact file and line targets, keep resident context small, and measure whether the tool eliminates extra turns. If it only adds queries, the cost benefit disappears.
👉 Read our full editorial: Graph navigation for coding agents reduces tool-call storms