◉ANTIGRAVITY LABJP
Articles/Agents & Manager
◈ Agents & Manager/2026-07-18Advanced

Treating Code Search as a Contract: Measuring the /codesearch Regex Default

Antigravity CLI 1.1.3 interprets /codesearch queries as regular expressions by default. I measured the gap between regex and literal matching across a 979-article repository and turned the results into three query rules and a drift harness.

Antigravity CLI38codesearchagent design12regexsearch design

✦ Premium Article

The morning after I asked an agent to rewrite every call site, one line was still on the old signature.

The rewrite itself had been careful. The problem sat one step earlier: the search the agent ran first never returned that line. The work was fine. The set it worked on was quietly incomplete.

A bad edit is visible. A missing search result is not. Nothing failed — you simply believe that what came back was everything.

What 1.1.3 made the default

Antigravity CLI 1.1.3 (July 16) added /codesearch, aliased as /cs and /search.

Three parts of the spec matter in day-to-day use:

ItemBehavior
Query interpretationRegular expression by default
-F / --literalSwitches to exact (literal) matching
f: / file:Globs to include or exclude paths

I skimmed past that first line. As an indie developer I had spent years assuming that whatever I typed into a search box was simply the string I wanted to find.

But config.json, useState(, and ja|en all mean something else when read as patterns. A human sees the results and thinks, that's not right. An agent doesn't. It takes the returned set and starts working on it.

Measuring the gap on a real repository

Rather than guess, I measured.

The target was the Antigravity Lab repository itself: 979 Japanese MDX articles and 73 files under src/. I reproduced the same semantics /codesearch uses — regex by default, literal under -F — with local grep -E and grep -F, then compared hit counts for identical queries.

QueryRegex (default)Literal (-F)Gap
config.json1251250
tsconfig.json86860
package.json200199+1
.mdx4135+6
antigravity.google4835+13

config.json showed no gap at all. The dot matches any character, sure — but if no string like configXjson exists in the tree, nothing breaks.

That is exactly what makes this hard. For most queries, the regex default breaks nothing. So you never get a reason to question it.

The gap appeared on antigravity.google: 13 of 48 hits, roughly 27%, were false positives. Here's what they actually were:

src/generated/articles.json:antigravity-google
content/articles/ja/integrations/antigravity-google-workspace-mcp-daily-workflow.mdx:antigravity-google

The dot matched a hyphen. I was auditing outbound links to the official site, and article slugs came along for the ride.

The six extra .mdx hits followed the same shape: |mdx, mdx, _mdx, "mdx. I meant to count file extensions and picked up the character in front of them instead.

You'd catch all of this by reading the output. The moment you hand the list to an agent with "fix all of these," nobody is reading it.

✦

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
✦Measured regex-vs-literal hit gaps across 979 MDX files, with up to 27% false positives
✦How one delimiter turns a query into 4.5MB of output, or into zero results
✦Three rules for writing search queries as contracts, plus a Python drift harness
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

◈ Agents & Manager2026-09-29
Stopping One Sub-Agent Without Taking the Other Seven Down With It
One of eight parallel sub-agents went wrong and I wanted to stop only that one. Here is how Antigravity, Claude Code, and Gemini CLI differ in what a stop actually stops, and the per-child output layout plus merge script that keeps a halted child's partial files out of the rest.
◈ Agents & Manager2026-09-24
A Small Guard Script That Catches an Unattended Agent Rewriting Its Own Settings
After reading a report of an agent widening its own read-only limits by editing settings.json, I wrapped my overnight headless runs in an outside guard. Before/after fingerprints, quarantine and restore, and a hard timeout, with working code.
◈ Agents & Manager2026-08-30
What @ Includes Actually Shrink When You Split Agent Rule Files
I split my rule files using Antigravity 2.11.0's @path/to/file includes and measured the before and after across four real repositories. Maintenance surface dropped 62 percent. What a session actually reads dropped 1.7 percent. Here is why, plus the code that catches the silent failure mode.