AntiGravity Mastery
Master rules, MCPs, and agent workflows in Google's AI IDE
AntiGravity Mastery
AntiGravity is more than just an autocomplete tool. It is an Agentic IDE that can autonomously plan, execute, and verify complex tasks. To get the most out of it, you need to understand its three core pillars: Rules, Workflows, and MCPs.
1. Agent Modes
AntiGravity offers distinct modes for different stages of development:
Agent-Driven (Autonomous)
You give a high-level goal (e.g., "Implement the login screen"), and the agent continuously plans, writes, and fixes code until it's done.
- Best for: Well-defined tasks, refactoring, writing tests.
- Shortcut:
Cmd + L(Mac) /Ctrl + L(Windows) to open Agent Chat.
Agent-Assisted (Pair Programming)
The agent suggests edits and automates small tasks but stays in sync with your cursor.
- Best for: Daily development, complex logic implementation.
- Shortcut:
Cmd + K(Mac) /Ctrl + K(Windows) for inline edits.
2. The Power of Rules (.agent/rules vs .antigravity)
Defining clear rules is crucial for preventing hallucinations and maintaining code quality.
Project-Specific Rules (.antigravity)
Place a .antigravity file in your project root for high-level context.
# Project: Mobile Launcher
- Tech Stack: Expo, React Native, Redux Toolkit
- styling: Restyle (NO inline styles)
- I18n: Use `t('key')` for all textSystem Rules (.agent/rules/)
For granular control, simpler rules are often better. Break them down:
rules/typescript.md: "Always use strict types, noany."rules/testing.md: "All new features must have a corresponding.test.tsxfile."
3. Workflows (.agent/workflows/)
Workflows are repeatable "recipes" for the agent. Instead of typing "Create a new component with these props...", you can define a .md file in .agent/workflows/create-component.md:
---
description: Create a new UI component
---
1. Ask the user for the component name.
2. Create the file in `src/ui/components/`.
3. Use `Restyle` for styling.
4. Export it from `src/ui/index.ts`.Then, you can simply ask the agent: "Run the create-component workflow".
4. Model Context Protocol (MCP)
MCP allows AntiGravity to connect to external tools and data sources.
Why use MCP?
- External Context: Let the agent read tickets from Linear or Jira.
- Database Access: Let the agent query your local Postgres or Supabase DB to understand the schema.
- Documentation: specific docs for libraries not in the training data.
Setting up Supabase MCP
- Open Agent Settings (three dots menu).
- Go to MCP Servers.
- Add a new server for PostgreSQL/Supabase.
- Provide the connection string.
- Now you can ask: "Check the
userstable schema and generate a TypeScript interface for it."
5. U-AMOS Integration
This boilerplate uses U-AMOS (Universal AI Memory Operating System).
- Context Map:
.agent/context_map.mdhelps the agent navigate the massive codebase efficiently. - Memory: The
.memory/folder persists the agent's understanding of the project across sessions.
Pro Tip: Always ask the agent to "Update the memory bank" after a major feature implementation so the next session starts with full context.