◉ANTIGRAVITY LABJP
Articles/Antigravity Basics
◉ Antigravity Basics/2026-09-02Intermediate

Why Filename Search Misses Every Error String in Your Repo

Antigravity 2.12 improved partial filename search. Measuring name lookups against full-text search across a 2,088-file repository, the reading cost differed by 67x and error strings hit filenames only 4.5% of the time. Here is where the line actually falls.

Antigravity427SearchAgents27ripgrep4Repository maintenance

I knew I had written down an MCP timeout value somewhere. I could not find it. When I asked the agent to locate every mention of timeouts, it came back with 451 candidate files — 8 MB of text. That is not a list you read.

Antigravity 2.12 improved partial matching for filename search, and that failure came straight back to mind. Searching by name shrinks the candidate set dramatically. What I had never checked was what gets dropped along the way. So I measured both against a repository of 2,088 files.

One word, two very different answers

The corpus is 2,088 Markdown files across two languages, 34 MB in total. It has grown steadily over years of indie developer work, so it is a realistic size rather than a toy.

Searching for the single word "timeout":

MethodHitsBytes if all openedTime (mean of 5)
Partial filename match8 files128 KB5 ms
Full-text search (ripgrep)451 files8 MB15 ms

The search itself is only 3x apart. Both finish instantly as far as a human is concerned.

The gap opens afterward. An agent narrows the candidates, then reads them. That reading cost differs by 67x. Hand it 451 files and 8 MB, and the context window fills, the bill climbs, and the wait stretches. Choosing a search method is not a question of search speed. It is a question of how many bytes get read next.

If ripgrep is unavailable, this premise shifts entirely. I measured that scenario separately in How Much Slower Search Gets When /codesearch Cannot Run ripgrep.

Filenames carry topics; bodies carry symptoms

So should you just lean on filename search? Not quite. Run the same comparison on error strings and syscall names, and the result inverts.

TermFilename hitsBody hits
ENOSPC013
ECONNREFUSED09
SIGKILL014
flock018
IPv606
ETIMEDOUT09
EADDRINUSE210
FORBIDDEN29
Total488

Four hits out of eighty-eight. That is 4.5%. Delegate to filename search alone and you miss 95% of the places those errors are discussed, while getting a confident "nothing found" in return.

Topic words behave better. Ollama matches 16 filenames against 121 bodies (13%), Stripe 26 against 249 (10%), AdMob 22 against 329 (7%). Still roughly one in ten. Filename search surfaces the articles where something is the subject, never the ones where it comes up in passing.

There is a practical reading of that table. Filenames answer "what is this file about," while bodies answer "what happened while writing it." Debugging questions are almost always the second kind. When I search my own notes it is nearly always because something failed and I half-remember writing the fix down — which is exactly the case filename search cannot serve.

The asymmetry is not an implementation quirk. A filename is a label the author wrote to summarize the subject. Symptoms and API names live only in the prose. However clever filename matching becomes, a string that was never written into the name will not appear.

Partial matching only sees contiguous runs

There is a second trap. Partial matching compares contiguous substrings, so a different word order simply misses.

Looking for files about MCP timeouts by name, in the same repository:

# As a contiguous substring
find content/articles -iname '*mcp-timeout*'    # -> 2 files
find content/articles -iname '*timeout-mcp*'    # -> 0 files
 
# Both words, order-independent
find content/articles -iname '*mcp*' -iname '*timeout*'   # -> 4 files

The actual filenames explain it:

antigravity-mcp-timeout-seconds-boundary-latency-sizing.mdx
antigravity-cli-mcp-unresponsive-timeout-per-operation-design.mdx

The second one has unresponsive sitting between mcp and timeout, so *mcp-timeout* never reaches it. Reverse the order and you get nothing at all.

I used to stop at "the name search found 2 files, so that is all of them." It was half. Chaining -iname twice gives you an AND, which is what multi-word lookups actually need. The same applies when you instruct an agent: ask for files containing both mcp and timeout, not files containing mcp-timeout.

Separators cause the same problem. When I recounted in November 2026, with the repository grown to 2,306 files, names containing rate-limit came to 6, ratelimit to 4, and rate_limit to 0. Switch to an AND of -iname '*rate*' -iname '*limit*' and the count goes back up to 10.

Bodies drift too. "rate-limit" appears in 87 files, "rate limit" in 216, and the regex rate[-_ ]?limit catches 276. One spelling choice moves the count by more than 3x, so for any term with competing spellings I no longer search on a single form, whether by name or by body.

Frontmatter was quietly ruining full-text search

Full-text search has its own Markdown-specific failure mode.

Every file here opens with YAML frontmatter, and keys like premium: false appear in all of them. That makes full-text search on those tokens meaningless.

# Full text, frontmatter included
rg -li premium content/articles -g '*.mdx' | wc -l   # -> 2023
 
# Body only: everything after the second ---
for f in $(rg -li premium content/articles -g '*.mdx'); do
  awk 'c==2{print} /^---$/{c++}' "$f" | grep -qiF premium && echo "$f"
done | wc -l                                          # -> 111

2,023 of 2,088 files match — 97%. Restricted to bodies, it is 111. Nearly a 20x inflation.

Search on any frontmatter key or metadata value (premium, category, level, tags) and almost everything comes back. From the agent's side this is worse than "no results," because it looks like a narrowed set while actually being the whole corpus. For a long time I blamed my query phrasing.

Since Antigravity 2.11.0, frontmatter renders as a formatted metadata card, so it no longer clutters the reading view. The search index still treats it as body text. Elements that disappear visually are exactly the ones that trip you later.

Three approaches, measured for recall as well as cost

With that in hand, I looked for "articles covering MCP timeouts" three ways, using the full-text AND as the baseline.

MethodHitsRecallTime
A: full-text AND of MCP and timeout55100% (baseline)36 ms
B: narrow filenames to mcp, then grep timeout1833%12 ms
C: narrow by directory, then full-text AND2851%15 ms
# A: full-text AND (baseline)
rg -li timeout content/articles -g '*.mdx' | tr '\n' '\0' | xargs -0 rg -lFi 'MCP'
 
# B: narrow by filename, then search bodies
find content/articles -iname '*mcp*' -print0 | xargs -0 rg -lFi 'timeout'
 
# C: narrow by directory, then search bodies
rg -lFi 'MCP' content/articles/*/integrations -g '*.mdx' \
  | tr '\n' '\0' | xargs -0 rg -lFi 'timeout'

B is fast and finds a third of what exists. The 37 files it drops are not noise: they discuss MCP timeouts in passing without carrying mcp in the name. C narrows along a different axis and keeps half, because a directory groups files by subject area rather than by whichever words the author happened to put in the name. That is the general lesson — narrow on an axis that was assigned deliberately, not one that emerged from writing habits. All three land within tens of milliseconds of each other, which is noise in practice. I had assumed the tradeoff would be speed against thoroughness. It was not. Every method returns before you can notice, and the only variables that matter are how much you miss and how much the agent has to read.

So filename search is not something you pick for speed. Speed barely moves. What moves is recall, and how much text gets read afterward. Those numbers settled my own rules:

  1. When hunting an error string, symbol, or API name, skip filename search and go straight to full text. At a 4.5% hit rate, name matching is not narrowing — it is losing.
  2. When hunting a topic and one representative article is enough, filename search does the job. It is the wrong tool when coverage matters.
  3. When coverage does matter, narrow by directory rather than by name, then run full text. Recall goes from 33% to 51%, and reading cost stays at half of the exhaustive search.

Antigravity 2.12's partial matching improvement does not change cases 1 or 3. It helps case 2 — the moment when you already know which file you want to open. There, it genuinely got faster.

As of November 2026 the latest Antigravity release is v2.32.0. I could not confirm from the official changelog whether the partial matching introduced in 2.12 still works the same way. The numbers in this article come from find and rg, not from measuring Antigravity's internal search implementation itself.

A script that computes the ratio for your own repository

The numbers so far come from my own naming habits. So that you can get the same comparison for your tree in one run, I turned it into a script that prints, for each term, how many files match by name and how many match in the body. The lower the ratio, the more a name-only search will miss.

I tested it on Ubuntu 22.04.5, bash 5.1.16, and ripgrep 13.0.0. The -iname flag should also work with macOS find, but I have not run it there.

#!/usr/bin/env bash
# Usage: name_vs_body.sh <directory> term1 term2 ...
# For each term, print how many files match by filename and how many match in the body (frontmatter excluded)
set -euo pipefail
dir="${1:?pass a directory}"; shift
[ -d "$dir" ] || { echo "no such directory: $dir" >&2; exit 2; }
[ "$#" -ge 1 ] || { echo "pass at least one term" >&2; exit 2; }
command -v rg >/dev/null || { echo "ripgrep (rg) not found" >&2; exit 3; }
 
body_hits() {
  # Keep -g before -- (after it, rg treats them as paths). rg exit 1 means "no match", which is fine
  { rg -lFi -g '*.md' -g '*.mdx' -- "$1" "$dir" || [ $? -eq 1 ]; } |
  while IFS= read -r f; do
    # Skip from the first --- to the next ---, then check the body only
    if awk 'NR==1 && /^---$/ {fm=1; next} fm && /^---$/ {fm=0; next} !fm' "$f" | grep -qiF -- "$1"; then
      echo "$f"
    fi
  done | wc -l
}
 
printf '%-14s %6s %6s %6s\n' "word" "name" "body" "ratio"
tn=0; tb=0
for w in "$@"; do
  n=$(find "$dir" \( -name '*.md' -o -name '*.mdx' \) -iname "*${w}*" | wc -l)
  b=$(body_hits "$w")
  r="-"; [ "$b" -gt 0 ] && r="$(( n * 100 / b ))%"
  printf '%-14s %6d %6d %6s\n' "$w" "$n" "$b" "$r"
  tn=$((tn + n)); tb=$((tb + b))
done
if [ "$tb" -gt 0 ]; then printf '%-14s %6d %6d %6s\n' "TOTAL" "$tn" "$tb" "$(( tn * 100 / tb ))%"; fi

Here is the output against 2,306 files and 38 MB, as of November 2026. Six terms took 0.36 seconds.

$ ./name_vs_body.sh content/articles ENOSPC ECONNREFUSED SIGKILL EADDRINUSE ETIMEDOUT flock
word             name   body  ratio
ENOSPC              0     13     0%
ECONNREFUSED        0      6     0%
SIGKILL             0     15     0%
EADDRINUSE          2      8    25%
ETIMEDOUT           0     10     0%
flock               0     24     0%
TOTAL               2     76     2%
 
$ ./name_vs_body.sh content/articles ollama stripe admob
word             name   body  ratio
ollama             16     91    17%
stripe             26    157    16%
admob              22    243     9%
TOTAL              64    491    13%

The 4.5% I measured in September had fallen to 2% with more files in the tree. As a repository grows, error strings keep piling up in bodies and almost never in names. Topic words held at 13%, still around one in ten.

Three choices in the script deserve a reason. The awk line skips everything from the opening --- to the closing one, so grep only sees the body. The || [ $? -eq 1 ] treats rg's "no match" exit code as success; without it, set -o pipefail kills the script the first time a term has zero hits. And -g always goes before --.

That last one cost me a run. My first version said rg -lFi -- "$1" "$dir" -g '*.mdx', and the script printed the header row and quietly ended. Running the line on its own gave this:

$ rg -lFi -- ENOSPC content/articles -g '*.mdx' >/dev/null; echo "exit=$?"
-g: No such file or directory (os error 2)
*.mdx: No such file or directory (os error 2)
exit=2

Everything after -- is treated as a path, so -g and *.mdx became files that did not exist. The nasty part is that rg still printed the matches it did find. Had I only looked at the list, I would never have noticed the filter was not applied. What stopped me was the exit code.

Check the exit code and the count before the list. When I hand searches to an agent, that order is the one thing I keep fixed.

A triage table for too few or too many hits

These are the checks I run, top to bottom, when search results feel wrong. The error messages are exactly what ripgrep 13.0.0 printed for me.

SymptomLikely causeHow to checkFix
Name search returns 0, but you remember writing itThe term never made it into a filename (error strings, API names)Count body hits with rg -lFi 'term' .Start with full-text search
Name search finds only some filesPartial matching wants a contiguous run; word order or an extra word breaks itCompare with an AND of one -iname per wordSearch for files containing both A and B
Counts swing with spellingHyphens, underscores, and spaces varyCount all three spellings side by sideFold the variants into one regex such as rate[-_ ]?limit
Nearly every file matchesYou are hitting frontmatter keys or valuesCompare with the body-only count from the scriptSearch bodies only; do not search on key names
Lowercase finds fewer filesrg is case-sensitive by defaultCompare counts with and without -i (ENOSPC: 4 vs 15)Add -i or -S (smart case)
Stops with regex parse error( or . is being read as regexRead where the error pointsUse -F for a fixed string
Results print, yet exit code is 2Options placed after -- were read as pathsNo such file or directory (os error 2) on stderrMove every option before --
A file you know exists never shows uprg skips .gitignore'd, hidden, and binary files by defaultSee if the count rises with --no-ignore --hiddenName the target explicitly, or add those flags

When to pick each approach

Here are the rules from the previous section as a table. I dropped the speed column, since every method finishes within tens of milliseconds.

ApproachWhat it reachesReading cost afterwardBest for
Partial filename matchOnly files where the term is the subject (2% for error strings)LowestYou already know the one file you want
Directory first, then full textEverything inside that category (about half overall)About half of full textYou know the area and need coverage
Full text, bodies onlyEverything written in a bodyHighestError strings, symbols, API names

The decision fits in one line: start from bodies when you are hunting a symptom, from names when you are hunting a subject, and from directories when you need coverage.

Three misreadings worth undoing

The first is reading zero filename hits as "I never wrote about it." In the measurement above, error strings show up in names 2% of the time. Zero only means you did not put it in a name.

The second is assuming the faster search is the cheaper one. Every method finishes in tens of milliseconds. What decides cost and waiting time is how many bytes the agent opens and reads afterward.

The third is assuming rg looks at everything under a directory. As ripgrep's own guide explains, it skips files matched by .gitignore, hidden files, and binaries by default. If build output or logs are ignored in your repository, error strings that live there will not appear.

Rewriting how I ask the agent

After seeing these numbers, I changed the request itself. I used to write:

Find the files where I wrote about MCP timeouts and summarize them.

That leaves me blind to how the agent searched and how many files it opened. Now I write:

List the .mdx files under content/articles whose body (excluding the leading
frontmatter) contains both "MCP" and "timeout", using rg.
Return only the count and the paths. Do not open the files yet.

With the count in hand first, I decide how much gets read. Fifty-five files means narrowing by directory before reading; a handful means reading them all. Keeping search and reading as two separate requests looked like a detour and turned out to be the fastest path.

Measure your own naming conventions next

The 4.5% and 33% figures above are products of how I happen to name files. A repository that puts error codes into filenames would produce entirely different ratios.

Rather than carrying my numbers home, run the script above against your own tree. It takes about a minute and the answer is specific to you. Pick five error strings, compare filename hits with body hits, and look at the ratio. If it sits below ten percent, I think it is too early to let an agent search by name.

Once the entry point is fixed, the next thing people tend to hit is a workspace index that never finished, so the agent's search returns stale results. I wrote up that diagnosis in When Antigravity's Workspace Indexing Won't Finish. I used the same habit of recounting body strings with rg when auditing links between articles, and kept those results in 594 Articles Had No Body-Link Entrance.

For deciding the timeout values themselves, I left the measurements in I Measured Before Writing a Number: MCP Connect and Tool Calls Differed by 486x.

This has been a lot of counting, I know. But get the entry point of a search wrong and everything downstream — the reading, the reasoning, the decision — drifts with it. If you start anywhere, start by picking five error strings from your own logs and passing them to the script.

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 →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

◉ Antigravity2026-12-01
Your Editor Can't Show Antigravity's Remaining Quota — Check /usage in agy at Each Break Instead
When you run Antigravity through agy acp in Zed or a JetBrains IDE, your plan quota and AI credit balance never show up in the editor. Here is where the official numbers live (/usage, /credits, the statusline), why I don't scrape them with third-party tools, and the small check I now put between tasks.
◉ Antigravity2026-11-26
Should the Orchestrator's Planner and Executor Share a Model? What Runs as One Agent in 1.5.17, and What I Keep Two-Phase
Since Antigravity CLI 1.5.17, choosing the same model and the same Effort for both Planner and Executor in /model runs a single agent. A different Effort keeps it two-phase. Here is a small script that reads settings.json to tell which you have, and where I draw the line.
◉ Antigravity2026-11-23
Paying for Google AI Pro but Gemini 4 says Unavailable? Read the plan line first
You pay for Google AI Pro, yet Antigravity won't let you pick Gemini 4. Whether the plan line reads Starter Quota or Google AI Pro changes where you should look. Here are three patterns, the order I check them in, and a small script that keeps a record you can hand to support.