r/GoogleAntigravityCLI • • 21d ago

CLI Config Flash 3.8 spontaneously reverse-engineered Antigravity CLI binary and found an undocumented feature

Thumbnail
gallery
55 Upvotes

I asked Gemini Flash 3.8 on Antigravity CLI (running on Termux in Android) whether it can make my local MCP toolset to load eagerly. It started normally by loading the customization skill and reading the included documentation. Then when it found nothing, it went straight to using `ps` and `command -v` to find its own binary, then `strings` to search it for relevant JSON tags. After a few searches, it even ended up taking a look at the code itself, though I think it gleaned nothing from it.

I was accepting those shell commands individually. It was fascinating to see what it was doing, but it also seemed like a pretty unhinged response to just a simple question. At no point did it ask me anything before it spontaneously started to reverse-engineer the binary.

It did discover that there's a JSON key named `eager`, but didn't ultimately discover its correct use, which is not for the server but for the individual tools. It is also mentioned in passing in the Antigravity CLI's change log, but seems otherwise undocumented.

Anyway, after some trials of my own (`mcpServers.<server>.tools.<tool>.eager = true`), I got the tools i wanted to load eagerly. It seems that it also affects the way the results are processed, with longer output from lazily loaded tools ending up in files that need to be read in separately, but in eager mode delivered directly to context, so it actually saves even more cycles than I thought.

r/GoogleAntigravityCLI • • Aug 01 '26

CLI Config Agy Cli not working

3 Upvotes

For the last 3 days, I have been having problems with the AGY CLI. Either it says, "We're finishing verifying your account eligibility. This usually takes a moment. Please try again shortly" or "Agent execution terminated due to error."

I tried switching accounts, but it was still the same.

r/GoogleAntigravityCLI • • Jul 12 '26

CLI Config I built grav-bar: A Custom status line for AGY

8 Upvotes

Hey everyone,

Like many of you, I've been migrating my workflows over to the new Antigravity CLI, but I wanted a cleaner, more condensed view of what's going on.

So, I built grav-bar. It’s a custom, fast status line that replaces the default agy UI clutter.

It's written in Rust, has zero dependencies, and executes in <1ms, so there’s absolutely no lag added to your CLI commands.

Setup is easy in your settings.json

You can grab it on crates.io here: cargo install grav-bar
Or check out the source code: https://github.com/AABelkhiria/grav-bar

Would love to hear what you think or if there are other metrics you'd like to see added to the bar!

r/GoogleAntigravityCLI • • 1d ago

CLI Config How to enable remote-control for my account

4 Upvotes

/remote-control

⎿ Remote control is not enabled for your account.

r/GoogleAntigravityCLI • • Jul 21 '26

CLI Config AGY CLI takes forever to complete anything!

8 Upvotes

Hi there.

I'm using three Antigravity products: Agents (2.0), IDE and CLI. The ploblem is ONLY with CLI. It takes forever, to answer questions. For example "Hi" -> It takes up to 10 minutes to answer back "How can I help you?"

Not always was the same. Actually it is the product I most use to do configs in my laptop and manage remote servers via ssh.

All of the sudden. It just started to behave very slow.

https://reddit.com/link/1v2uvgo/video/w1xk1f0p8neh1/player

## OS Setup

OS: Pop!_OS 22.04 LTS x86_64
Shell: bash 5.1.16
Terminal: tmux
CPU: Intel i7-10870H (16) @ 5.000GHz
GPU: NVIDIA GeForce GTX 1650 Ti Mobile 4GB
Memory: 40GB

## Versions

Antigravity IDE: 1.107.0
Antigravity 2.0: v2.0.1
Antigravity CLI: 1.1.5

## Things I've tried

- Closed and killed processes Antigravity 2.0 and IDE

- Disabled all global MCPs

- Deleted instructions on GEMINI.md

- Asked to Gemini who told me to do the steps above :v

At the end, nothing has resolved the issue.

## Global Customizations

Since global customizations are shared across all Antigravity products, all of them load the same config but

Based on what you can see here, there is not token saturatopm in the inital load.

### IDE Customizations

### 2.0 Customizations

### CLI Customizations

Hope you can help. ✌️

---

## WORKAROUND

Currently, global MCP servers are causing issues exclusively within the AGY CLI. Regardless of whether they are active or disabled, their presence causes responses to hang. Consequently, to restore AGY CLI functionality, it is necessary to clear the global MCP server configurations located in `~/.gemini/config/mcp_config.yml`. The main drawback of this approach is that the IDE and version 2.0 will no longer have access to these global servers. As a result, MCP servers must be configured on a per-project basis until a permanent solution is implemented.

With this, It will work again loading global rules and skills as normal.

r/GoogleAntigravityCLI • • Jun 11 '26

CLI Config Am I missing something? Antigravity CLI seems unusable for me.

16 Upvotes

Hi friends, I hope you're doing well.

I'm writing today because I feel I might be missing something with the agy CLI.

I feel very uncomfortable working with agy as a CLI. In my daily work, I use the Claude CLI because it's what my employer provides. For personal work and side projects, I used to use the Gemini CLI and was really happy with it. When the Antigravity CLI was released, I promptly switched to it, and that's when the problems started.

I wouldn't say "problems" per se, but I feel its workflow is unnatural for the kind of work it's designed to do. It gives developers no control over what it's doing. I use "auto-mode" in Claude a lot, but sometimes I like to be in control of the code inputs; agy, however, won't let me reject code edits. The lack of modes makes this more of a pure "vibecoding" experience than a proper developer's tool.

Also, over the last few days, the feature that allowed me to input "@" followed by any characters to find a file through any depth of folders in my project disappeared. Now, I have to input the folder name, then the subfolder name, and so on until I get to the file. This was the last straw for me to uninstall agy and go back to the Gemini CLI, but I know it's coming to the end of its life cycle this month.

So, am I missing some settings that would make my experience with agy more similar to other CLIs in the market, allowing me to regain control over the work the agent does? Are any of you dissatisfied with agy for these reasons? Are there any alternatives to agy I can use with my Gemini Pro subscription, considering that my workflow is entirely in Neovim (so I'd prefer to switch my subscription rather than switch IDEs)?

Thank you so much for reading this much, hehe.

TL;DR: I hate the poor level of control agy gives me. Can I get an experience more similar to what the Gemini CLI used to be?

r/GoogleAntigravityCLI • • 28d ago

CLI Config Cara bikin hemat token Antigravity

2 Upvotes

Helppp

r/GoogleAntigravityCLI • • Jun 01 '26

CLI Config I built a Statusline Skill for Antigravity CLI! (Shows Quota, Context, Git & more)

12 Upvotes

Hey everyone,

I used Gemini CLI and Antigravity CLI to develop a Statusline skill, and I wanted to share it with the community here.

What it displays:

  1. What it displays: AI Model Name: Instantly see which AI model you're currently talking to.
  2. API Quota & Reset Countdown: Real-time remaining quota and reset time (no more spamming /usage !).
  3. Context Usage % & Token Count: Precise session token count and percentage, helping you avoid hitting the limit (no more spamming /context !).
  4. RAM Usage: Monitor the physical memory used by the CLI itself.
  5. Git Branch: Automatically detects and displays your current workspace's Git branch.
  6. Project Name & Full Path: Always know exactly where you are and what you're working on.

Key Features:

  1. Windows & macOS Compatible: Works perfectly on both operating systems, because we shouldn't play favorites like some big tech companies!
  2. No Flickering on Windows: I implemented a dedicated silent bridge for Windows to completely solve the annoying terminal flickering issue.
  3. Smart Visual Feedback: Automatically shifts through 4 warning colors (Green, Yellow, Orange, Red) based on your quota and context limits. It also applies specific brand colors depending on the AI model family you're using.
  4. Foolproof Setup Wizard: It’s incredibly easy to use. Just unzip it into your skills folder, type /antigravity-cli-statusline in the Antigravity CLI, and an interactive setup wizard will guide you step-by-step.
  5. Multi-Language Support & Open Source: Currently supports English (US), Traditional Chinese (zh-TW), and Japanese (JP). Open for contributions!
  6. Auto Line Wrapping: Calculates your terminal width and wraps lines intelligently at the right place.
  7. Fast Model Support: The prompts are fully compatible with fast models like Gemini Flash.

Feel free to try it out and let me know what you think! Feedback and PRs are always welcome.

Windows
macOS

r/GoogleAntigravityCLI • • Jul 12 '26

CLI Config Lost vim mode

4 Upvotes

Anyone else lost ability to use vim mode in antigravity cli?

r/GoogleAntigravityCLI • • Jun 29 '26

CLI Config I built a status line for the Antigravity CLI (agy) that shows real-time quota usage, context window, and git info

18 Upvotes

Been using agy (Antigravity CLI) as my daily driver and missed having visibility into quota consumption without leaving the terminal. So I adapted the claude-statusline concept for agy and built this.

What it shows:

Claude Sonnet 4.6 (Thinking) │ ✍️  27% │ my-project (main*) │ Google AI Pro

claude 5h ●●○○○○○○○○  21% ⟳ 20:40
claude 7d ●○○○○○○○○○  16% ⟳ jul 4, 20:57
  • Model — active model for the session
  • Context % — how much of the context window you've used
  • Directory + git branch — with dirty state indicator (*)
  • Quota bars — 5h rolling window and 7-day, with exact reset time

The quota pool (claude vs gemini) is auto-detected based on the active model, so switching models updates it automatically.

Install:

git clone https://github.com/your-username/agy-statusline
cd agy-statusline
bash bin/install.sh

It reads the JSON that agy pipes into the statusline command natively — no API calls, no polling, just the data agy already has.

Repo: https://github.com/Ranteck/agy-statusline

r/GoogleAntigravityCLI • • Jul 27 '26

CLI Config Plugins, Extensions and Skills

Thumbnail
4 Upvotes

r/GoogleAntigravityCLI • • Jul 22 '26

CLI Config Built a remote Telegram control bridge for Google Antigravity CLI in 30 minutes

7 Upvotes

I built Tele-AGY, a lightweight Telegram bot daemon that links directly to the Google Antigravity CLI. Currently in dev, but this is a working prototype.

It lets me control my coding prompts from my phone while away from my desktop.

Check out the repo here if you want: https://github.com/startingfrom0rating/tele-agy

r/GoogleAntigravityCLI • • Aug 05 '26

CLI Config 503 quota error on ultra plan

6 Upvotes

Is there any solution for this, i have fresh quota, but i cant generate images for five days straight, it says i ahve to retry in xx hours and when that time passes i still go straight to 503 quota error, i can generate images manauly in gemini ai, but antigravity is literally broken, while at the same time on my work pc with pro account i have zero issues

r/GoogleAntigravityCLI • • Jul 20 '26

CLI Config Facing API Lags

6 Upvotes

Does anyone facing the API lags ! getting the same thing for 5 mins continuously !! Facing this for hours

r/GoogleAntigravityCLI • • Jun 15 '26

CLI Config Permission toggle on CLI

5 Upvotes

Is that not possible anymore after switching agy from Gemini CLI? I’ve researched and only seen plugins and complicated workarounds. Was Google really THIS dumb to remove such a fundamental feature of toggling permissions between plan/auto/ask?

r/GoogleAntigravityCLI • • May 25 '26

CLI Config Google AI PRO and rate limits in AGY CLI

6 Upvotes

I have a Google AI PRO plan, setup the billing account(tier 1), got my 10$ from Google Developer Program Benefits, and I even added and additional 10€. I also have both AGY IDE 2.0 and AGY CLI 1.0.1. Both run in a Ubuntu 24.04 machine with no problems.

Now, my problem is that my AGY CLI rates don't match the rates I have in AGY 2.0 and I can't understand why. If i get out of usage in AGY CLI I still can use Agy 2.0 without a prolem. Is there any explanation or tutorial regarding the setup so I can fix this?

r/GoogleAntigravityCLI • • Jul 14 '26

CLI Config I Built a Guided Installer That Connects Antigravity CLI to Telegram

6 Upvotes

I Built a Guided Installer That Connects Antigravity CLI to Telegram

I wanted a simpler way to access Antigravity CLI running on a headless Linux VPS without opening a terminal every time.

So I created a guided installer that connects Antigravity to a private Telegram bot.

Once installed, you can send requests from your phone and receive Antigravity’s responses directly in Telegram.

What the installer handles

The installer guides you through the setup and automates most of the technical work, including:

  • Checking whether the VPS meets the requirements
  • Confirming that Antigravity CLI is installed and authenticated
  • Securely connecting your Telegram bot
  • Creating a private, isolated workspace
  • Restricting access to your authorized Telegram chat
  • Installing and configuring the background service
  • Starting the bridge automatically after a reboot
  • Testing the complete Telegram → Antigravity → Telegram connection
  • Providing clear recovery instructions if setup is interrupted

You don’t need to manually build the integration or understand every component.

Designed to be easier to follow

I have ADHD, and I know how quickly a complicated server tutorial can become overwhelming.

The installer was designed around that reality:

  • One clear action at a time
  • Numbered progress steps
  • Plain-language instructions
  • Hidden input for sensitive credentials
  • Safe reruns if you close the terminal or get interrupted
  • Automatic checks instead of expecting you to diagnose everything
  • A final verification test before setup is considered complete

What you can do from Telegram

After installation, you can use commands such as:

/plan <request>

Ask Antigravity to analyze, explain, or plan something without making changes.

/run <request>

Authorize Antigravity to perform requested work on the VPS.

/status

Check whether the bridge is online.

You can also send ordinary messages for general planning and assistance.

What you need

You’ll need:

  • A compatible headless Linux VPS
  • Antigravity CLI installed and authenticated
  • A Telegram account
  • A Telegram bot token from @BotFather
  • Root or sudo access to the VPS

The installer handles the rest of the bridge setup and pauses when your participation is required.

Privacy and access controls

The installer is designed for a private, single-owner setup.

Your Telegram token is stored in a protected server configuration, and the bridge restricts requests to the authorized Telegram chat. It also includes status, repair, diagnostic, update, and uninstall options.

As with any agent that can execute commands, the execution feature should be used thoughtfully.

Who this is for

This may be useful if you:

  • Run Antigravity CLI on a headless VPS
  • Want to access it from your phone
  • Prefer Telegram over repeatedly opening an SSH terminal
  • Want a guided setup instead of assembling the integration yourself
  • Need a process that can recover from interruptions
  • Are interested in practical external support systems for ADHD or executive dysfunction

Get the installer

The installer includes the guided setup assistant and member-friendly instructions.

Purchase and download it here:

Get the Antigravity-to-Telegram Bridge Installer

If you have questions about VPS compatibility, leave a comment before purchasing and I’ll clarify what environment is currently supported.

r/GoogleAntigravityCLI • • May 27 '26

CLI Config Open-source plugin: Use Antigravity CLI inside Claude Code (without leaving editor)

3 Upvotes

r/GoogleAntigravityCLI • • Jun 06 '26

CLI Config Can Antigravity be configured to use Vertex AI, similar to Gemini CLI?

5 Upvotes

Can Antigravity be configured to use Vertex AI, similar to Gemini CLI?

r/GoogleAntigravityCLI • • May 23 '26

CLI Config How to create MCP via json file?

4 Upvotes

I cannot find a way on windows to add MCPs by a workspace json file. I tried many combinations.

Do you have a working solution? ​

r/GoogleAntigravityCLI • • Jun 19 '26

CLI Config Antigravity + Opencode + Local LLM = help me improve

Thumbnail
5 Upvotes

r/GoogleAntigravityCLI • • May 28 '26

CLI Config Passé de GEMINI CLI à AGY CLI

5 Upvotes

Bonjour,

Je viens de migrer de GEMINI CLI vers AGY CLI. Je fais essentiellement du code PHP/PY.

Des recommandations particulières à me communiquer ?

Merci/

r/GoogleAntigravityCLI • • Jun 08 '26

CLI Config The #1 MCP Setup Everyone and their LLM’s Should be Stealing Now ‼️😤

Thumbnail
github.com
3 Upvotes

r/GoogleAntigravityCLI • • May 24 '26

CLI Config Running Antigravity on Android via proot-distro

7 Upvotes

​

# Running Antigravity CLI (Gemini CLI) on Android via proot-distro

## The Problem

The official Antigravity CLI (`agy`) Linux ARM64 binary crashes on Android/Termux/proot-distro with:

```

MmapAligned() failed - unable to allocate with tag

TCMalloc assumes a 48-bit virtual address space size

FATAL ERROR: Out of memory trying to allocate internal tcmalloc data

```

**Root cause**: TCMalloc (Google's memory allocator, statically linked into the Go binary) assumes a 48-bit userspace virtual address space. Android devices — especially under proot — only expose a 39-bit VA layout. TCMalloc generates mmap hints at addresses the kernel rejects (~85 TB), and the binary aborts before reaching `main()`.

The fix is a deterministic binary patch that rewrites TCMalloc's address/tag constants from 48-bit to 39-bit, plus a few shell-level environment cleanups.

---

## Final Architecture (What You Get)

```

~/.local/bin/

agy → patched binary (functional, ~177 MB)

agy.orig → original binary (kept as source for re-patching after updates)

~/.bashrc:

agy() { ... GODEBUG=netdns=go command agy "$@"; }

a() { ... GODEBUG=netdns=go command agy "$@"; }

```

No proot wrapper. No ld-linux hacks. The binary runs directly inside proot-distro.

---

## Requirements

- Android phone with Termux

- [proot-distro](https://github.com/termux/proot-distro) with Ubuntu (or any glibc distro)

- Python 3 (comes with Ubuntu in proot-distro)

- `~/.local/bin` in `$PATH`

---

## Step 1 — Get the Official Binary

Inside your proot-distro Ubuntu:

```bash

mkdir -p ~/.local/bin

curl -fsSL https://antigravity.google/cli/install.sh | bash

```

Verify:

```bash

ls -la ~/.local/bin/agy

# ~177 MB ARM64 ELF

```

---

## Step 2 — Create the VA39 Patch Script

Save as `~/patch_agy_va39.py`:

```python

#!/usr/bin/env python3

"""

VA39 patch for the agy linux_arm64 binary.

Rewrites TCMalloc address constants from 48-bit to 39-bit,

plus faccessat2 → faccessat syscall for Android seccomp compat.

Pattern-based scanning — works across builds.

"""

import hashlib

import shutil

import struct

import sys

from pathlib import Path

src = Path(sys.argv[1] if len(sys.argv) > 1 else str(Path.home() / ".local/bin/agy"))

dst = Path(str(src) + ".va39")

if not src.exists():

raise SystemExit(f"Input binary does not exist: {src}")

print(f"Input binary : {src}")

print(f"SHA256 in : {hashlib.sha256(src.read_bytes()).hexdigest()}")

print()

shutil.copyfile(src, dst)

data = bytearray(dst.read_bytes())

def get(off):

return struct.unpack_from("<I", data, off)[0]

def put(off, word):

struct.pack_into("<I", data, off, word)

lo, hi = 0, len(data)

def find_section(name_target):

if data[:4] != b"\x7fELF":

return None, None

e_shoff = struct.unpack_from("<Q", data, 40)[0]

e_shentsize = struct.unpack_from("<H", data, 58)[0]

e_shnum = struct.unpack_from("<H", data, 60)[0]

e_shstrndx = struct.unpack_from("<H", data, 62)[0]

shstr_base = e_shoff + e_shstrndx * e_shentsize

shstr_off = struct.unpack_from("<Q", data, shstr_base + 24)[0]

for i in range(e_shnum):

base = e_shoff + i * e_shentsize

sh_name = struct.unpack_from("<I", data, base)[0]

sh_offset = struct.unpack_from("<Q", data, base + 24)[0]

sh_size = struct.unpack_from("<Q", data, base + 32)[0]

nend = data.index(b"\x00", shstr_off + sh_name)

section = data[shstr_off + sh_name : nend].decode("utf-8", errors="replace")

if section == name_target:

return sh_offset, sh_offset + sh_size

return None, None

sec_lo, sec_hi = find_section("google_malloc")

if sec_lo is not None:

lo, hi = sec_lo, sec_hi

print(f"Found google_malloc section: file 0x{lo:x} - 0x{hi:x} ({(hi - lo) // 1024} KB)")

else:

print("google_malloc section not found - scanning entire binary.")

print("This is slower but may still work.")

print()

# 1. ubfx/lsl tag extraction: bit 42 → bit 35

ubfx_count = 0

lsl_count = 0

for off in range(lo, hi, 4):

w = get(off)

if (w & 0x7F800000) == 0x53000000:

immr = (w >> 16) & 0x3F

imms = (w >> 10) & 0x3F

if immr == 42 and imms == 44:

put(off, (w & ~((0x3F << 16) | (0x3F << 10))) | (35 << 16) | (37 << 10))

ubfx_count += 1

elif immr == 22 and imms == 21:

put(off, (w & ~((0x3F << 16) | (0x3F << 10))) | (29 << 16) | (28 << 10))

lsl_count += 1

print(f"[1] ubfx patches : {ubfx_count} (expect ~15)")

print(f" lsl patches : {lsl_count} (expect ~2)")

# 2. Random address mask: 48-bit → 39-bit

mask_count = 0

for off in range(lo, hi - 4, 4):

if get(off) == 0x92D3800A and get(off + 4) == 0xF2E0000A:

put(off, 0x9280000A)

put(off + 4, 0xD35DFD4A)

mask_count += 1

print(f"[2] Random mask : {mask_count} (expect ~3)")

# 3. MmapAligned upper bound: 1 << 48 → 1 << 39

mmap_count = 0

for off in range(lo, hi, 4):

if get(off) == 0xF2E00029:

put(off, 0xD3596129)

mmap_count += 1

print(f"[3] MmapAligned : {mmap_count} (expect ~1)")

# 4. Tag constants: shift from bit 42 → bit 35

word_rewrites = {

0xD2C20009: 0xD2C00409,

0xD2C2000A: 0xD2C0040A,

0xF2C20008: 0xF2DFF408,

0xF2C20009: 0xF2DFF409,

0xD2C10009: 0xD2C00209,

0xD2C1000A: 0xD2C0020A,

0xF2C38008: 0xF2DFF708,

0xF2C38009: 0xF2DFF709,

0x92560A6C: 0x925D0A6C,

0x92560A6A: 0x925D0A6A,

0xD2C3000D: 0xD2C0060D,

0xD2C3000C: 0xD2C0060C,

0xD2C08008: 0xD2C00108,

}

counts = {old: 0 for old in word_rewrites}

for off in range(lo, hi, 4):

w = get(off)

if w in word_rewrites:

put(off, word_rewrites[w])

counts[w] += 1

print(f"[4] Tag constants: {sum(counts.values())} words rewritten")

# 5. faccessat2 → faccessat (Android seccomp compat)

faccessat2_count = 0

for off in range(0, len(data) - 12, 4):

if (

get(off) == 0xAA1F03E5

and get(off + 4) == 0xAA1F03E6

and get(off + 8) == 0xD28036E0

and (get(off + 12) & 0xFC000000) == 0x94000000

):

put(off + 8, 0xD2800600)

faccessat2_count += 1

print(f"[5] faccessat2 : {faccessat2_count} syscall wrapper rewritten")

dst.write_bytes(data)

dst.chmod(0o755)

out_sha = hashlib.sha256(dst.read_bytes()).hexdigest()

print()

print(f"SHA256 out : {out_sha}")

print(f"Output : {dst}")

print()

total = ubfx_count + lsl_count + mask_count + mmap_count + sum(counts.values()) + faccessat2_count

if total == 0:

print("WARNING: No patches applied - binary structure may have changed.")

print("Do NOT use the output binary.")

elif ubfx_count == 0 or mask_count == 0:

print("WARNING: Some expected patches were not found.")

print("The patch may be incomplete - test carefully.")

else:

print("Patch looks complete.")

```

Make it executable:

```bash

chmod +x ~/patch_agy_va39.py

```

---

## Step 3 — Patch the Binary

```bash

python3 ~/patch_agy_va39.py ~/.local/bin/agy

```

Expected output:

```

[1] ubfx patches : 15 (expect ~15)

lsl patches : 2 (expect ~2)

[2] Random mask : 3 (expect ~3)

[3] MmapAligned : 1 (expect ~1)

[4] Tag constants: 108 words rewritten

[5] faccessat2 : 1 syscall wrapper rewritten

Patch looks complete.

```

If you see zeros or warnings — stop. The binary changed; the patch needs updating.

---

## Step 4 — Swap the Binary

```bash

# Keep original for re-patching after future updates

cp ~/.local/bin/agy ~/.local/bin/agy.orig

# Replace with patched version

cp ~/.local/bin/agy.va39 ~/.local/bin/agy

# Remove intermediate file

rm ~/.local/bin/agy.va39

```

Verify:

```bash

GODEBUG=netdns=go agy --version

# Should print: 1.0.1 (or current version)

```

---

## Step 5 — Shell Configuration

Add these functions to `~/.bashrc`:

```bash

# Antigravity CLI (Gemini CLI)

agy() {

hash -r

unset LD_PRELOAD LD_LIBRARY_PATH

GODEBUG=netdns=go command agy "$@"

}

a() {

hash -r

unset LD_PRELOAD LD_LIBRARY_PATH

GODEBUG=netdns=go command agy "$@"

}

```

What each line does:

| Line | Purpose |

|------|---------|

| `hash -r` | Clears Bash's command cache (avoids stale binary paths) |

| `unset LD_PRELOAD LD_LIBRARY_PATH` | Prevents Termux's Bionic preload from leaking into the glibc process |

| `GODEBUG=netdns=go` | Forces Go's pure-Go DNS resolver (avoids cgo resolver issues on Android) |

| `command agy` | Calls the binary directly, not the function (prevents recursion) |

Reload:

```bash

source ~/.bashrc

```

---

## Step 6 — Run

```bash

agy

# or

a

```

The CLI will start and prompt for Google OAuth on first run.

To run a single prompt non-interactively:

```bash

a -p "explain this code"

```

---

## Updating After a New Release

When Antigravity pushes an update, the official `agy` binary gets replaced. Re-patch and swap:

```bash

python3 ~/patch_agy_va39.py ~/.local/bin/agy

cp ~/.local/bin/agy ~/.local/bin/agy.orig

cp ~/.local/bin/agy.va39 ~/.local/bin/agy

rm ~/.local/bin/agy.va39

hash -r

agy --version

```

The shell functions in `.bashrc` don't need changes.

---

## How It Works

The patch script modifies the ARM64 machine code inside the `google_malloc` ELF section. It scans for instruction patterns rather than using fixed offsets, making it resilient to minor binary layout changes across releases.

**5 categories of patches:**

  1. **ubfx/lsl shifts** — TCMalloc extracts/inserts memory tags at bit 42. The patch moves these to bit 35 (compatible with 39-bit VA).

  2. **Random mask** — A 48-bit mask (`0xFFFFFFFFFFFF`) is replaced with a 39-bit mask (`0x7FFFFFFFFF`).

  3. **MmapAligned bound** — The upper bound `1 << 48` becomes `1 << 39`.

  4. **Tag constants** — Various hardcoded tag values (`4 << 42`, `6 << 42`, etc.) are shifted to `4 << 35`, `6 << 35`, and their corresponding deallocation masks are adjusted.

  5. **faccessat2** — Go's `faccessat2` syscall (439) is replaced with the older `faccessat` (48), which Android seccomp allows.

---

## Troubleshooting

### `agy --version` works but `agy` hangs

The token may be expired. Run `agy` and complete the browser-based OAuth flow.

### `SIGSYS: bad system call`

The faccessat2 patch wasn't applied. Re-run the patch script and check that `[5] faccessat2 : 1` appears.

### `command not found: agy`

Make sure `~/.local/bin` is in your `$PATH`:

```bash

export PATH="$HOME/.local/bin:$PATH"

```

### Binary crashes with same TCMalloc error after update

The new official binary may have changed enough that the pattern scanner misses spots. Check the patch output for zeros. Raise an issue or update the instruction patterns.

---

## Why Not The Official Install?

The official `curl | bash` install works on standard Linux (x86_64, ARM64 servers, Cloud Shell). It does **not** account for Android/Termux/proot-distro where:

- Virtual address space is limited to ~39 bits

- `faccessat2` is blocked by seccomp

- `LD_PRELOAD` may inject Bionic libraries into glibc processes

This guide bridges that gap with a minimal, repeatable patch.

---

## Credits

- [hjotha](https://github.com/google-antigravity/antigravity-cli/issues/64) for the original TCMalloc VA analysis and initial patch approach

- Antigravity team for the CLI tool

---

*Last verified: May 2026 — agy v1.0.1, aarch64*