Antigravity CLI Token Optimization
Layer 1 β Platform Mechanics
Keep GEMINI.md to Antigravity-only overrides; put shared, cross-tool rules in ~/.gemini/AGENTS.md to sidestep the Gemini CLI path conflict. Skills in ~/.gemini/config/skills/ follow the same load-on-match principle as Claude/Codex. Route lightweight or parallel subagents (e.g. a browser-testing subagent) to a faster model tier via their YAML model field, reserving your primary tier for the main coding loop.
Key Strategies:
- File Separation: Separate Antigravity-specific from shared rules
GEMINI.md: Antigravity-only overrides (keep thin)~/.gemini/AGENTS.md: Shared, cross-tool rules- Avoids Gemini CLI path conflict
- Skills Progressive Disclosure: Skills in
~/.gemini/config/skills/- Load-on-match principle like Claude/Codex
- Reduce always-loaded token overhead
- Tiered Subagent Routing: Route subagents by workload type
- Lightweight/parallel subagents: Faster model tier
- Main coding loop: Primary model tier
- Configure via YAML
modelfield in agent definitions
Layer 2 β Agent Operation
Antigravity’s Implementation Plan artifact is a built-in plan gate β explicitly ask for a plan first on non-trivial tasks so exploration and editing don’t happen uncontrolled in the same pass. Use PreToolUse-style hooks to hard-block expensive or risky operations (e.g. a forced push) rather than relying on the model to self-police.
Operational Best Practices:
- Implementation Plan Artifact: Built-in plan gate
- Explicitly request plan first on non-trivial tasks
- Separate exploration from editing
- Prevent uncontrolled mixed-mode operations
- Hook-Based Guardrails: Use
PreToolUse-style hooks- Hard-block expensive operations (e.g., force push)
- Don’t rely on model self-policing
- Enforce operational constraints at tool level
- Session Management: Clear separation between planning and execution phases
Layer 3 β Codebase Architecture
Duplicate the Conventions section into AGENTS.md (shared) or GEMINI.md only if Antigravity-specific phrasing is genuinely needed.
Architecture Rules:
- Shared Conventions: Use
AGENTS.mdfor cross-tool compatibility - Tool-Specific Overrides: Use
GEMINI.mdonly when Antigravity-specific phrasing is needed - Avoid Duplication: Don’t duplicate content between files unnecessarily
Antigravity CLI-Specific Features
Implementation Plan Artifact
Antigravity’s native Implementation Plan provides structured planning:
- Built-in plan gate separate from execution
- Structured approach to complex tasks
- Natural separation of exploration and implementation
YAML Agent Definitions
Subagent definitions in .antigravity/agents/ or ~/.config/antigravity/agents/:
- YAML-based agent configuration
- Per-agent model selection
- Support for complex agent orchestration
Hook System
Antigravity’s hook system allows operational control:
PreToolUsehooks for blocking operationsPostToolUsehooks for logging and auditing- Hard enforcement of operational constraints
Skills Integration
Skills in ~/.gemini/config/skills/:
- Follow same progressive disclosure pattern as other tools
- Load-on-demand based on task matching
- Reduce always-loaded context overhead
Path Conflict Resolution
Critical note for users with both Gemini CLI and Antigravity CLI:
- Both write to
~/.gemini/GEMINI.md - Can silently pollute context with wrong tool’s rules
- Deliberate separation required for clean operation