Google Antigravity's Gemini 3 model features an unprecedented 1 million token context window—the largest in any AI coding assistant. This comprehensive guide teaches you how to leverage this massive context for complex coding tasks that were previously impossible.
To put this in perspective:
| Context Size | Approximate Code | Use Case |
|---|---|---|
| 8K tokens | ~200 lines | Single file editing |
| 32K tokens | ~800 lines | Small component work |
| 128K tokens | ~3,200 lines | Multi-file features |
| 1M tokens | ~25,000 lines | Entire codebase analysis |
With 1 million tokens, Gemini 3 can process:
Larger context enables:
Google Antigravity's @codebase command intelligently loads relevant files:
@codebase How does the authentication flow work?
Gemini 3 will:
For precise control, manually specify files:
@src/lib/auth.ts @src/middleware.ts @src/app/api/auth/[...nextauth]/route.ts
Explain how these files work together for authentication.
When approaching the context limit, prioritize:
Traditional AI assistants lose track during multi-file refactors. With 1M tokens:
@codebase
I want to rename the `getUserData` function to `fetchUserProfile`
across the entire codebase. This includes:
- The function definition
- All import statements
- All call sites
- Related type definitions
- Test files
- Documentation references
Show me a complete refactoring plan.
For massive changes, break into phases:
Phase 1: Analysis
@codebase
Analyze all usages of the deprecated `moment.js` library.
List every file, the specific usage, and suggest the dayjs equivalent.
Phase 2: Planning
Based on the analysis, create a migration plan that:
1. Prioritizes high-impact files
2. Groups related changes
3. Identifies potential breaking changes
4. Suggests test coverage additions
Phase 3: Execution
Execute phase 1 of the migration plan:
- Update @src/utils/dateHelpers.ts
- Update all components importing from dateHelpers
- Ensure TypeScript types are correct
Load entire modules for architectural analysis:
@src/services/ @src/lib/ @src/types/
Document the service layer architecture:
1. Service dependencies graph
2. Data flow patterns
3. Error handling approach
4. Suggested improvements
@codebase
Generate a Mermaid diagram showing:
1. All React components and their relationships
2. Data flow from API to UI
3. State management connections
Example output:
graph TD
A[App] --> B[Dashboard]
B --> C[UserStats]
B --> D[RecentActivity]
C --> E[useUser Hook]
D --> E
E --> F[Supabase Client]
F --> G[(Database)]
In monorepo setups, load multiple packages:
@packages/ui @packages/shared @apps/web/src/components
Create a new Button component in packages/ui that:
1. Follows the existing design system patterns
2. Uses shared utilities from packages/shared
3. Is compatible with how components are used in apps/web
@codebase
Audit all components for design system consistency:
- Color usage (should use CSS variables)
- Spacing (should use spacing scale)
- Typography (should use text styles)
- Border radius (should match tokens)
List all violations with file:line references.
@src/lib/payments/ @src/types/payment.ts
Generate comprehensive tests for the payments module:
1. Unit tests for each function
2. Integration tests for Stripe webhooks
3. Edge cases from the type definitions
4. Mock data based on actual types
@**/*.test.js @jest.config.js
I'm migrating from Jest to Vitest.
Analyze all 47 test files and provide:
1. Compatibility issues list
2. Required syntax changes
3. Config migration steps
4. A script to automate simple transformations
@git:diff:main
Review this PR with full codebase context:
1. Does it follow existing patterns?
2. Are there any inconsistencies with similar code?
3. Missing test coverage?
4. Potential performance issues?
5. Security concerns?
@git:history:src/lib/auth.ts @src/lib/auth.ts
This file has had 3 bugs in the last month.
Analyze the commit history and current code to:
1. Identify root cause patterns
2. Suggest preventive measures
3. Recommend architectural improvements
@codebase
Generate comprehensive API documentation including:
1. All exported functions with signatures
2. Usage examples for each
3. Error handling documentation
4. Related functions cross-references
5. Migration notes from v1 to v2
@codebase @package.json @.env.example
Generate a production-ready README.md with:
- Project overview (inferred from code)
- Installation steps
- Environment variables (from .env.example)
- API documentation
- Deployment guide
- Contributing guidelines
Start focused, expand as needed:
# Start specific
@src/components/Dashboard.tsx
# If needed, expand
@src/components/Dashboard.tsx @src/hooks/useDashboard.ts
# If still needed, go broader
@src/components/ @src/hooks/
For long sessions, periodically summarize:
Summarize our progress so far:
1. What files have we modified?
2. What decisions have we made?
3. What remains to be done?
Store this as a checkpoint.
Use .antigravityignore to exclude noise:
# .antigravityignore
node_modules/
.next/
coverage/
*.min.js
*.map
dist/
build/
Know your limits:
How much context am I using?
/context
Antigravity will show:
@src/legacy/ @src/types/ @src/modern/
I'm modernizing a legacy Express.js API to Next.js API routes.
The legacy code in @src/legacy has 45 endpoints.
Modern patterns are demonstrated in @src/modern.
Create a migration plan that:
1. Maps each legacy endpoint to its modern equivalent
2. Identifies shared logic to extract
3. Prioritizes based on usage (check route handlers)
4. Estimates effort for each migration
@codebase
Perform a security audit:
1. SQL injection vulnerabilities
2. XSS possibilities
3. Authentication bypasses
4. Sensitive data exposure
5. Dependency vulnerabilities
For each finding, provide:
- Severity (Critical/High/Medium/Low)
- File:line location
- Exploit scenario
- Recommended fix
@codebase
Identify performance bottlenecks:
1. N+1 query patterns
2. Unnecessary re-renders
3. Missing memoization
4. Large bundle imports
5. Unoptimized images
6. Missing caching
Prioritize by impact and provide fix recommendations.
Slightly. Processing 1M tokens takes longer than 8K, but Antigravity optimizes by:
The hard limit is 1M tokens. If you hit it:
.antigravityignore to exclude files@ commands/clearUse the /context command to see:
Yes, code is processed by Gemini 3. For sensitive projects:
Yes! Use context snapshots:
/save-context auth-refactor
/load-context auth-refactor
Gemini 3's 1 million token context window is a game-changer for AI-assisted development. By mastering these strategies, you can:
Start small, expand progressively, and always budget your context wisely. The developers who master large-context AI will have a significant productivity advantage.
Ready to put these strategies into practice? Explore our .antigravity rules templates or connect your first MCP server for even more capabilities.
Last updated: December 2024