ANTIGRAVITY LABJP
Articles/Agents & Manager
Agents & Manager/2026-06-30Advanced

When the Agent Hands You 1,400 Replacements in One Commit, Ask for Batches Instead

Ask Antigravity to run a large codemod and you can get back one unreviewable commit. Here is a small design — ast-grep rules plus a verified batch driver — that splits a mechanical replacement into the machine's job and the human's check, with working code.

Antigravity292codemodast-greprefactoring7ai-agent17code-review8indie-developer5

Premium Article

The morning a codemod came back as one giant commit

One morning I set out to move event tracking across my four indie apps onto a consent-aware wrapper. The old Analytics.logEvent("name", props) calls needed to become track("name", props), which checks consent state before sending. A plain mechanical job.

I asked Antigravity to "move everything onto track." It returned a single commit that rewrote 1,400 call sites across 230 files. The diff was endless, and I could not tell which parts were safe and which were risky.

The replacement itself was correct. The problem was that it arrived in a shape no human could verify. A change you cannot review does not ship, even when it happens to be right.

So rather than restate the recipe up front, let me walk through why I sent it back. What I landed on was a small design that re-splits the work into the machine's job and the human's check.

Why "one commit for everything" becomes unreviewable

A huge mechanical diff mixes changes of different natures.

Most of it is purely formulaic. Argument order and meaning are unchanged, and there is nothing worth reading. But buried inside are a few sites where meaning shifts — for example, calls that used to fire before consent now behave differently once the wrapper gates them.

Finding the dozen meaning-changing sites among 1,400 by eye is not realistic. The reviewer loses focus and waves it through with "probably fine." That was the real trap.

What the machine can safely fix should not need review; only what a human must judge should be carved out small. Without that separation, volume drowns quality.

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
A verification gate that slices 1,400 replacements into 25-file batches, each commit passing typecheck and tests
How to write ast-grep rules that separate what the machine can safely fix from what a human must judge
How to cap files-per-batch so the agent cannot pile up a giant diff
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-04-13
Building a Coding Agent System with Gemma 4 × Antigravity — A Complete Implementation Guide for Code Review, Test Generation, and Refactoring
A hands-on guide to building a 3-agent collaborative system using Gemma 4 and Antigravity AgentKit 2.0, covering code review, automated test generation, and refactoring suggestions. Includes production-quality code and pitfall solutions.
Agents & Manager2026-06-21
Letting a Background Agent Work Overnight Without Regretting It by Morning — Guardrails for Unattended Runs
When you hand overnight refactoring to Antigravity's Background Agent, the morning brings as much anxiety as convenience. From three angles — blast radius, completion criteria, and detecting silent regressions — here are the guardrails that let me run unattended jobs with confidence.
Agents & Manager2026-03-28
Designing a SKILL.md-Driven Code Review Agent
As AI accelerates implementation, review workload grows. Learn how to design a code review agent around SKILL.md — including a 9-step review process, quality guides, and custom instruction architecture.
📚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 →