[RFC / Proposal] Prioritize git grep over Select-String on Windows in Git Repositories (Massive Token & DX Win)
Executive Summary (TL;DR)
Currently, when Google Antigravity agents operate on Windows (Operating System: windows. Shell: powershell.), the base models instinctively default to native PowerShell cmdletsâspecifically Select-String or Get-ChildItem -Recurse | Select-Stringâto search for symbols and strings across the codebase.
This leads to four severe systemic issues:
- Context Window Poisoning:
Select-Stringis.gitignore-blind. It blindly crawlsnode_modules/,bin/,obj/,.next/, dumping tens of thousands of minified/compiled lines into the prompt context. - Massive Token Waste: A single symbol lookup frequently burns 30,000 to 50,000+ unnecessary tokens, blowing up user token quotas and Googleâs inference compute.
- Execution Freezes / Timeouts: Parsing file trees in PowerShell with .NET
MatchInfoobject allocation is orders of magnitude slower than C-optimized index scans. - Approval Fatigue: Complex PowerShell pipelines (
Get-ChildItem | Select-String) cannot be safely auto-allowed by security filters, forcing repetitive, disruptive permission modals on the user.
The Fix: A single instruction in the Antigravity Windows system prompt directing the agent to prioritize git grep -n inside Git repositories completely eliminates these problems, delivering 100x faster searches, 99% token reduction, and seamless execution.
The Root Cause: Why LLMs Fall into the Select-String Trap
When Antigravity initializes on Windows, it injects:
The USER's OS version is windows. Shell: powershell.
LLMs are pre-trained with the rule: âOn Windows, standard grep is not built-in; use PowerShellâs Select-String (or sls) to prevent âcommand not foundâ errors.â
However, in the real world:
- 100% of developers using Antigravity are working inside a Git repository.
gitis already installed, configured, and accessible onPATH.- Because the system prompt doesnât explicitly inform the model of this, the agent conservatively falls back to the lowest common denominator: raw PowerShell disk walking.
Comparison: Select-String vs git grep
| Feature / Metric | Get-ChildItem | Select-String |
git grep -n "<query>" |
Real-World Impact |
|---|---|---|---|
| Search Engine | PowerShell pipeline / .NET CLR | C-optimized engine with mmap |
10x - 50x speedup (sub-50ms vs seconds) |
.gitignore Awareness |
Yes (only tracks source code) | Prevents 30k+ token context spam | |
| Memory / GC Pressure | Allocates MatchInfo per match |
Pure string streaming buffer | Zero CLI freezes or UI lockups |
| Output Ergonomics | Verbose table, prone to CLI truncation | Universal UNIX format (file:line: code) |
Perfectly parsed by LLMs for surgical edits |
| Permission Security | Piped commands are high-risk | Atomic, read-only command | Safely auto-allowable in approval gates |
A Real-World Failure Scenario
Consider an agent searching for an attribute in an ASPNET Core + Tailwind + NPM project:
# What the Agent currently runs:
Get-ChildItem -Recurse -Filter *.js | Select-String -Pattern "container"
- It traverses
node_modules/andwwwroot/lib/. - It hits bundled, minified vendor files and dumps 40,000 characters of unreadable minified code to the terminal.
- The prompt context is suddenly overwhelmed with junk tokens.
- The model suffers from attention drift / hallucination, forgetting previous instructions.
- The developer is left waiting 15 seconds for a tool response, only to see their token quota drained.
Contrast this with:
# What the Agent SHOULD run:
git grep -n "container"
- Execution Time:
38 ms - Output: Exactly 4 lines of clean source code with precise line numbers.
- Token Cost:
< 150 tokens(a 99.6% reduction!).
The Proposed Solution
We urge the Antigravity / DeepMind engineering team to implement the following high-ROI, low-effort enhancements:
1. System Prompt Guidance (Core Fix)
Update the Windows environment prompt instructions:
When operating on Windows inside a Git repository, always prioritize 'git grep -n' over PowerShell 'Select-String' or 'Get-ChildItem' for code search and string matching. This ensures .gitignore compliance, prevents token explosion, and provides millisecond lookup times.
2. Default Command Allowlist
Add git grep to Antigravityâs default out-of-the-box safe command allowlist on Windows so that users are never prompted with permission dialogs for read-only repository searches.
Conclusion
Windows should not be an inferior developer experience for AI-first programming. By simply steering agents toward git grep, Google Antigravity can immediately save massive amounts of inference compute, eliminate developer approval fatigue, and make agentic coding on Windows blazing fast.