The future of business, today.
RSSNewslettersAdvertise
Business Future Today

Agent Infrastructure

Why Coding Agents Often Choose Grep Over Smarter-Looking Code Tools

A small study finds that semantic code navigation is not automatically better for AI agents. The decisive factor may be the task, the repository’s noise level, and—especially—the design of the tool interface.

Editorial image for Why Coding Agents Often Choose Grep Over Smarter-Looking Code Tools
Illustration: Business Future Today

Coding-agent builders have a familiar instinct: give the model richer, more precise developer tools and it should produce better work. A small study comparing `grep` with Language Server Protocol (LSP)-backed navigation suggests the reality is more conditional.

Across a pilot involving three Claude models, Python and TypeScript repositories, and several coding tasks, agents frequently preferred plain lexical search even when semantic tools were available. On simple code-location tasks, the models chose the LSP route only 0% to 6% of the time. Forcing a semantic-first workflow reduced success in one test arm from 100% to 89%.

That does not mean LSP is ineffective. It means tool quality for an agent is not the same as technical sophistication.

Precision is useful—but only in the right workflow

LSP navigation can distinguish actual code references from a matching word in a comment or string. In tasks requiring every caller of a function, that precision mattered: the semantic route achieved perfect precision in the reported tests, versus 0.76 for `grep`.

But it did not improve recall, which remained near 0.66 in both approaches. The bottleneck was how thoroughly the agent pursued the task, not merely whether the retrieval system filtered false positives.

Supporting image for Why Coding Agents Often Choose Grep Over Smarter-Looking Code Tools
Illustration: Business Future Today

Repository characteristics also changed the outcome. In a clean TypeScript codebase, LSP navigation delivered no F1 improvement and used 16% more tokens. In a noisier TypeScript repository, it improved F1 by 0.246 and used 12% fewer tokens. The practical predictor was not static typing; it was how much irrelevant output lexical search produced.

For platform teams, this argues against a universal retrieval default. Measure lexical noise and task shape before making semantic navigation mandatory.

Output shape can matter more than the backend

The strongest result in the study may be about interface design. Initially, the LSP tools returned locations—file path, line and column—but no source snippet. That forced the agent to take another action to inspect each match.

When the same semantic results were returned with nearby source lines, multi-file rename pass@1 rose from 0.67 to 0.83. Follow-up file reads dropped from 15.2 to 3.2 per episode. The semantic backend did not change; the result format did.

That is a useful design rule for operators building agent tooling: return information that enables the next decision, rather than technically correct metadata that creates a chain of extra tool calls. A location is useful to a human IDE user. An agent may need the location *and* the relevant code context in the same response.

Grep has a structural advantage for some work

Lexical search is also not simply a familiar but inferior fallback. A code rename may require updates in comments, documentation, configuration files and string literals. Semantic reference tools intentionally omit many of those occurrences.

Supporting image for Why Coding Agents Often Choose Grep Over Smarter-Looking Code Tools
Illustration: Business Future Today

In other words, semantic references are a subset of textual occurrences. For broad text changes, `grep` may better match the actual job definition—even if a semantic tool is more accurate about executable code.

The study’s authors distinguish this structural reason from a second, unproven hypothesis: models may be more practiced at familiar loops involving commands such as `read`, `grep`, `edit` and shell execution. The evidence does not establish a training-data cause, but it does show that agent behavior changes with tool names, schemas and response formats.

The harness is part of the product

The broader implication is that an agent is not just a model endpoint. Its effective capability depends on the surrounding harness: system instructions, available actions, input schemas, error handling, returned context and the sequence in which the model sees information.

That has procurement and architecture consequences. Moving the same underlying model into a generic tool layer may not reproduce results from its native coding environment. Conversely, a well-designed wrapper can make specialized tools substantially more useful without changing the model at all.

What to watch next

The findings are preliminary and narrow, covering a limited set of models, repositories and tool behaviors. But the lesson is durable: evaluate agent systems end to end.

Teams should test tools on representative repositories and tasks; compare success, recall, precision and token use; and inspect the number of follow-up actions a result forces. “More semantic” is not a sufficient product requirement. The better question is whether a tool gives an agent the right context to make its next move reliably.

Sources

STAY AHEAD

The future of business, in your inbox.

Useful signals on the companies, technologies and shifts changing business.

One useful briefing. Unsubscribe any time.