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 CLI13codesearchagent design8regexsearch 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-07-14
I Changed One Line in AGENTS.md and Broke the Agent — Regression-Testing the Instructions Themselves
Every time you edit the instructions you hand an agent — AGENTS.md, skill text — some other task quietly breaks. Here is a regression harness whose subject is the instructions, not the code: fixed tasks, deterministic assertions, and a way to wire it into unattended runs.
Agents & Manager2026-06-15
Stop Letting Antigravity Agents Self-Report 'Done' — Completion Contracts and External Verification
An Antigravity agent reporting 'done' when the work was not actually finished is a failure mode I kept hitting. Moving the completion decision out of the agent and into code fixed it. Here is the contract, a three-layer verifier, and how it holds up under unattended, scheduled runs.
Agents & Manager2026-05-06
Giving AI Agents an Aesthetic Sense — Building a UI Quality Evaluation Pipeline with Antigravity × Gemini Vision
Explore how to encode the vague judgment of 'is this UI good or bad' into code. Combines Antigravity with Gemini Vision to implement a complete pipeline — from screenshot capture to AI evaluation, improvement suggestions, automated fixes, and CI/CD integration.
📚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 →