Your Coding Agent Wastes SO MANY Tokens Just Finding Code - Here's the Fix

summarized

TLDR

Sonar Vortex gives coding agents a direct answer to 'what code applies here' by looking up a locally built code graph instead of searching and reading files, which is where most agent token spend goes. In a side-by-side test, the same change that burned 80,000 tokens on search and file reading cost roughly the same with Sonar Vortex even after a follow-up prompt, and Sonar's own study puts savings between 6% and 34%. It's a practical fix if your agent is burning context on navigation rather than edits.

Key points

Sonar Vortex resolves calls, implementations, and references down to file and line.

Its code graph is built locally, needs no compiler, and refreshes in about a millisecond.

A search-based agent turn used 80,000 tokens; Sonar Vortex matched that including a follow-up prompt.

Sonar's study of six refactoring tasks across ten runs found 6-34% token savings.

Semantic navigation currently supports Java, C#, JavaScript, TypeScript, Python, and Rust.

Tools mentioned

Techniques

  • semantic navigation
  • code graph-based lookup
  • incremental graph refresh
Transcript (captions)

0:00 Most of what you pay a coding agent for isn't actually writing code. It's finding the right code to edit in the first place. Seriously, if you ask your coding agent to change anything in your

0:09 code base, as long as it's not trivial, look what happens. It spends so much time searching and reading through all the files it finds to make sure they apply. And the search itself is fast and

0:20 cheap, but reading through all these files, it takes so much context here before you're even changing a single line of code. And it's not just the cost. searching is a guess. And so, if

0:32 you have something the agent should have changed, but it's named differently than what the agent is looking for, you're just going to miss it. And so, the change might be correct for everywhere

0:40 that it identified, but that isn't always good enough. Now, underneath all of this, your agent is just answering a single question. What code applies here for the change the user is requesting.

0:51 The problem is, coding agents can't answer that directly, but there is a tool that can, and it's called Sonar Vortex. And so, Sonar is a platform I've covered a lot on my channel already. It

1:02 already parses your code base. And so, now Sonar Vortex is a tool on top that solves our problem here. It's able to identify for us very efficiently and directly things like what classes

1:13 implement an interface, what calls a function, and what it calls back, down to the file and line. So, now I'm back over in Cloud Code with the same prompt, but this time giving it access to Sonar

1:23 Vortex. To show you here that it is a direct lookup instead of a search. It is much more efficient. And the graph that it uses to perform the lookups is built right on our machine. There's no

1:34 compiler or language server, and it refreshes in about a millisecond after any edit, which is a big deal for me because generally halfway through an agent turn, your code base hasn't

1:43 compiled yet. So, in our original conversation, after it did all of the searching and reading all the files, it took 80,000 tokens just to do this searching. But now, over to the second

1:53 one with Sonar Vortex, I was able to do the same lookup and then even a follow-up prompt to load more context, and it still was about the same number of tokens that it took. So, it's

2:03 definitely more efficient. Sonar did a study where they ran six refactoring tasks across 10 runs, and they figured out that the token savings was anywhere between 6 and 34%. Semantic navigation

2:15 covers Java, C#, JavaScript, TypeScript, Python, and Rust right now. It runs on SonarQube Cloud with the Sonar Agent Essentials add-on. Thanks to Sonar for working with me on this, and I'll have a

2:25 link to Sonar Vortex in the description.

Frontier News · by Hyperjump Technology