import { Callout } from '@/components/ui/callout';
Open a project in Antigravity, work with it for a few minutes, and you will notice something: the AI agent is willing to look at every file in the repo. node_modules/, build artifacts, and yes, even .env.local.
The mechanism for steering this is the .antigravityignore file. It looks like a cousin of .gitignore, but its purpose and behavior diverge in important ways. This article shares the patterns I have actually used across several projects, and the design choices behind them.
How It Differs from .gitignore
The two share syntax but serve different roles.
.gitignore keeps files out of Git history. .antigravityignore keeps files away from Antigravity's agents and indexer. There are surprisingly common cases where you want to commit a file but not let the AI read it — and the inverse, files you exclude from Git but expect the agent to consume (auto-generated schemas, for instance).
I keep them as separate files in my projects. Copying .gitignore straight across is convenient on day one, but maintaining the two with their own logic pays off long term.
A Baseline Template to Start From
This is the minimum I would set on any new project.
# .antigravityignore — baseline
# Dependencies — too large, wastes context
node_modules/
.pnpm-store/
__pycache__/
.venv/
# Build artifacts — the source is enough
dist/
build/
.next/
.nuxt/
out/
# Secrets — never expose to the AI
.env
.env.local
.env.*.local
*.pem
*.key
secrets/
credentials.json
# Test artifacts — large, low signal
coverage/
__snapshots__/
test-results/
playwright-report/
# AI-generated outputs — avoid self-reference
.claude/
.antigravity/cache/Two reasons this is worth doing immediately: a clean context improves answer quality, and excluding secrets reduces the risk of credentials leaking into prompts.
Layering on Project-Specific Rules
Beyond the baseline, the right additions depend on the project type.
Monorepos
When you are working in one package out of many, you generally want the agent's attention focused on the active workspace.
packages/*/dist/
packages/*/.cache/
apps/*/dist/
.turbo/
.nx/cache/Next.js + Cloudflare Workers
The Next.js + Cloudflare Workers stack I run for sites like Antigravity Lab generates a lot of intermediate output.
.next/
.open-next/
.wrangler/
public/cf-cache/
worker-bundle.js
# Auto-generated types and content data — touching these breaks invariants
src/generated/
public/content/src/generated/ is particularly important. It contains TypeScript types derived from MDX frontmatter, and you do not want the agent editing them as if they were source files.
iOS / Android Apps
# iOS
*.xcuserstate
DerivedData/
Pods/
*.xcworkspace/xcuserdata/
# Android
.gradle/
build/
*.keystore
local.propertieslocal.properties often holds API keys, so treat it as a secret.
The Risk of Excluding Too Much
The opposite mistake matters too. Early on I excluded docs/ entirely, reasoning that the agent could lean on README.md. The result was that it stopped understanding the intent behind features and started rewriting business logic in ways that broke product expectations.
So I now intentionally keep "the documents that exist to convey intent" inside the agent's reach.
# ✅ Re-include living architecture docs
# !docs/architecture/
# !docs/api-spec/
# ❌ But stale drafts add noise
docs/drafts/
docs/*.bakRe-inclusion with ! is order-sensitive, so audit carefully when you use it.
Verifying the Configuration
After editing .antigravityignore, check that the rules took effect. Antigravity's Mission Control panel surfaces the files currently in the agent's context, so you can confirm exclusions visually.
If something seems off, walk through this list:
- Is
.antigravityignoreat the project root? - Are line endings LF? (CRLF on Windows can misbehave)
- Is there a nested
.antigravityignorein a subfolder that overrides things? - Did you restart the agent session after editing? (Existing sessions sometimes hold the old state)
How I Think About This Day to Day
I run multiple side projects in parallel as a solo developer, so context efficiency matters a lot. Even with a generous context window, noise still degrades answers.
My rule of thumb is one question:
"Could I summarize this content in a single line if I had to explain it to the AI?"
If yes, you do not need the file in context. A 10,000-line lockfile compresses to "dependency lock" and that is enough. Files that resist summarization — design docs, ADRs, API contracts — are the ones worth keeping in.
Next Step
Drop the baseline template into .antigravityignore and ship. The build artifacts and secrets exclusions alone make the agent feel measurably faster and safer. From there, prune project-specific noise as you notice it during real sessions.