◉ANTIGRAVITY LABJP
Articles/Editor View
⟐ Editor View/2026-07-01Advanced

Faster Substring Search Changes How You Should Let Agents Explore Code

The 6/26 update made substring search noticeably faster. Rather than treating it as a comfort improvement, here is how to redesign the way agents explore code, budget context, and verify their targets, with measurements from indie development.

Antigravity376code explorationagent design12context management3search

✦ Premium Article

The 6/26 update made Antigravity's substring search visibly faster. On a monorepo of roughly 20,000 files, a search that used to make me wait a few breaths now returns almost instantly.

But what mattered to me was not the speed itself. It was what came after. While search was slow, we quietly designed around it by having agents search as little as possible. Once search is cheap, that assumption deserves to be rebuilt. This article is about turning the substring-search speedup into an actual redesign of how agents explore code, measured against my own indie development work.

What we quietly gave up when search was slow

When you let an agent work in a codebase, exploration splits into two broad styles: raw substring search (grep-style) to pin down a lead, and semantic search that surfaces candidates by conceptual closeness.

Slow search makes each grep expensive. Designs then drift toward "search rarely, load a large context up front." I used to have the agent read entire likely directories before starting. That looks efficient, but it fills the context with irrelevant files and blurs the judgment that actually matters.

Fast substring search tips the scale back. A design closer to how humans actually navigate — search narrowly first, read only what you need — becomes practical again.

Measure the change before trusting the feel

Before talking about feel, I turn exploration cost into numbers. I use a thin wrapper that records searches, total tokens read, and round-trips per task.

#!/usr/bin/env bash
# agy-probe.sh — record per-task cost of an agent run
# usage: ./agy-probe.sh "investigate the AdMob consent flow, scoped to the consent module"
set -euo pipefail
 
TASK="$1"
LOG="probe_$(date +%Y%m%d_%H%M%S).jsonl"
 
agy run --json-events --prompt "$TASK" | while IFS= read -r line; do
  echo "$line" >> "$LOG"
done
 
python3 - "$LOG" << 'PY'
import json, sys
searches = reads = tokens = turns = 0
for ln in open(sys.argv[1]):
    ev = json.loads(ln)
    t = ev.get("type")
    if t == "tool_call" and ev.get("name") in ("search", "grep"):
        searches += 1
    if t == "file_read":
        reads += 1
        tokens += ev.get("tokens", 0)
    if t == "assistant_turn":
        turns += 1
print(f"searches={searches} file_reads={reads} read_tokens={tokens} turns={turns}")
PY

Running the same investigation task ten times each on pinned before/after versions produced this trend in my environment. These figures are one sample from my own monorepo.

Metric (avg of 10)Old design (read broadly)New design (search narrowly)
Search calls3.211.4
Tokens read~48,000~16,500
Assistant round-trips6.15.4
Edits to the wrong file20

Search calls actually went up. That is not the point. The point is that tokens read dropped to a third while wrong-file edits went to zero. Because search got cheap, there was room to narrow down before reading.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦A concrete rule for rebalancing grep-first versus semantic search now that substring search is fast
✦A measurement script that tracks exploration cost per task in tokens and round-trips
✦How to build a scoping step so agents don't trust the first search hit blindly
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $15 for lifetime access
View Membership →

Related Articles

⟐ Editor View2026-09-17
How Far to Chase a VS Code Extension That Open VSX Doesn't Carry
Why your settings come across to Antigravity but your extensions don't, how to reconcile the gap with a script, and how to decide between a substitute, a pinned VSIX, moving the job outside the editor, or swapping the registry.
⟐ Editor View2026-09-10
The File Counts Matched. 148 Pairs Disagreed on Code Blocks
My Japanese and English article trees matched at 1,057 files each, yet the bodies had quietly diverged. Here is what counting code blocks and H2 headings across every pair turned up, why a character-length ratio failed to catch any of it, and the 40-line checker I now run before every push.
⟐ Editor View2026-09-03
How much of Antigravity's generated commit message I actually keep
Where the Review pane's generated commit message stops being enough, and where I start writing. A prepare-commit-msg hook that adds a Why trailer, plus measured behaviour during rebase, cherry-pick and revert.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links