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.

Antigravity301code explorationagent design6context management2search2

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 $10 for lifetime access
View Membership →

Related Articles

Editor View2026-06-28
Turning Faster Substring Search into Solid Grounding for Agents in Large Repos
Antigravity's substring search got faster. Rather than stopping at perceived speed, here is how to wire it into a search design that hands agents exactly the right context in a huge codebase, with concrete steps and pitfalls.
Editor View2026-06-30
The Built-in Guide Skill Is Only Advice — Pair It With a Gate That Mechanically Rejects Antigravity's Output
The v2.2.1 built-in Guide skill raises how often the agent complies, but it is still probabilistic advice. Here is the design for a deterministic gate that reliably stops the violations that slip through, with working code and measured results.
Editor View2026-06-26
Splitting a Giant Antigravity Diff Into Meaningful Commits
Are you committing the agent's 400-line diffs as a single blob? Here is a practical workflow, with scripts, for re-splitting an unreviewable bulk commit into one concern per commit.
📚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
See all →