Gemini CLI to Antigravity CLI 2.0
Windows (PowerShell Profile)
# Add to your $PROFILE
$env:Path += ";C:\\Program Files\\Antigravity\\bin"
Verify your installation across the environment:
ag --version
Expected output syntax: ag version 2.0.0-release+go1.22 (build_date: 2026-05-15)
2.2 Migrating Legacy Configurations
The legacy CLI stored configuration vectors in ~/.config/gemini/config.json. The new system centralizes all global preferences, active session caches, and engine logs under a unified system directory: ~/.antigravity/. Run the automated ingestion pipeline to transfer active API keys, default enterprise billing configurations, and customized instruction headers:
ag config import --source=legacy-gemini
3. Core Command Mapping (Side-by-Side)
The following reference table outlines everyday developer operations, contrasting the old syntax with the modern agent-first structural equivalents. | Operational Use Case | Legacy Gemini CLI (gemini) | New Antigravity CLI (ag) | |---|---|---| | Basic Text Query | gemini "Explain closures in JS" | ag prompt "Explain closures in JS" | | Analyze a File | gemini -f src/index.ts "Find bugs" | ag file review src/index.ts | | Inline Code Patching | gemini -i "Add error handling" < api.py | ag code patch "Add error handling" -f api.py | | Interactive Shell | gemini chat | ag session start | | Multi-File Context Assignment | Not natively supported (Required shell cat hacks) | ag project init (Creates workspace tracking) | | Complex Multi-Step Goals | Impossible (Blocked terminal / timeouts) | ag run --task "Refactor auth and run tests" | | View Active Execution State | N/A (Process tracking was linear) | ag status | | Abort Background Processing | Ctrl + C (Kills local process hard) | ag abort
4. In-Depth Workflow & Procedural Guide
4.1 Running Single Prompts & Processing Pipeline Data
The legacy tool allowed quick piping from utilities like cat, grep, or git diff. The ag architecture preserves terminal composability while using structured subcommand structures.
Legacy Syntax
git diff main | gemini "Generate a conventional commit message based on this diff"
Modern ag Implementation
git diff main | ag prompt "Generate a conventional commit message based on this diff"
Tip: To strip out markdown formatting wrappers when piping output directly back into other shell tools, use the clean output flag:
git diff main | ag prompt "Generate a commit message" --raw
4.2 Initializing and Executing Project-Wide Operations
The primary advantage of the new engine is its understanding of project scopes. Instead of manually passing files as arguments, you define a workspace boundary.
Step 1: Initialize Project Mapping
Navigate to your repository root and spin up the Antigravity indexer:
ag project init
This scans your codebase, maps directory structures, respects your .gitignore configuration rules, and creates a hidden local manifest file (.antigravity/project.db).
Step 2: Queue a Complex Background Task
Instead of holding up your terminal pipeline to modify multiple components across your workspace, issue a long-running, asynchronous agent task:
ag run --task "Upgrade all dependencies in package.json, update broken typings in src/types/, and confirm code builds successfully via npm run build."
Step 3: Track Execution Progress
Because the above task runs asynchronously in the server-side agent harness, your command line is immediately responsive. Monitor the subagents executing your request using:
ag status
This outputs an execution tree tracking token usage, deep dependency resolution paths, file writes, and nested execution statuses:
Task ID: task_01J4K592M
Status: IN_PROGRESS (Executing sub-agent: refactor_engine)
├── [COMPLETED] Scan package.json for deprecated specs
├── [EXECUTING] Rewriting src/types/auth.d.ts (Line 42-60)
└── [QUEUED] Execution block: npm run build
4.3 Advanced Agent Commands (Slash Commands)
The modern CLI introduces interactive, agent-specific control patterns designed to orchestrate agent behaviors directly from the terminal prompt.
Interactive Socratic Questioning (/grill-me)
When working on delicate production components, you can force the underlying model to cross-examine your logic and structural requirements before it modifies files, preventing unintended side effects.
ag prompt /grill-me "Migrate our database migration script from raw SQL templates to Prisma ORM"
The agent will pause execution, map out data structures, and print a series of clarifying architecture questions regarding structural types, constraints, and data protection schemas before touching the disk.
Task Constraints Execution (/goal)
Forces subagents to systematically run step-by-step verification protocols until a distinct, measurable requirement is achieved:
ag prompt /goal "Fix the failing integration tests in test/auth.spec.ts without mutating the core configuration parameters"
5. Cheat Sheet: Legacy Command Translation Matrix
If your muscle memory is tied to old workflows, copy this exact reference sheet to quickly transition your scripting workflows.
1. Generating Documentation for a Target Module
- Old Way (gemini):
gemini "Write JSDoc comments for all exported functions in this file" < src/utils.js > src/utils.js.tmp && mv src/utils.js.tmp src/utils.js - New Way (ag):
ag code patch "Write JSDoc comments for all exported functions" -f src/utils.js
2. Live Debugging Logs
- Old Way (gemini):
tail -n 50 error.log | gemini "Analyze these stack traces and suggest fixes" - New Way (ag):
tail -n 50 error.log | ag prompt "Analyze these stack traces and suggest fixes"
3. State-Persistent Multi-Turn Coding Sessions
- Old Way (gemini):
# Each call was separate; context had to be passed repeatedly or via a temporary session JSON file flag. gemini chat --session-file=.gemini-session.json - New Way (ag):
# Drops into a persistent shell environment that automatically tracks filesystem state mutations ag session start
6. Disabling Agentic Autonomy (Emulating Claude Code Safety Features)
One of the largest friction points with the new platform is its heavy reliance on autonomous background task processing. If you prefer the explicit control model popularized by alternative utilities like Claude Code, you can force the ag platform to behave as a strictly gated tool. By default, the ag framework may attempt to chain background actions together to resolve an abstract objective. To force strict user conformation prompts before every single file modification or CLI terminal call, update your global profile or alias parameters:
Enforcing Strict Confirmation Globally
Run this command to update your global configurations:
ag config set security.execution_mode strict_confirmation
Alternatively, append the manual confirmation flag to individual calls within your terminal session:
ag run --task "Optimize index database queries" --interactive
Creating an Explicit Fallback Automation Configuration
To build an absolute mirror of a highly predictable, linear workflow, add the following alias configurations to your system shell file (~/.bashrc, ~/.zshrc):
# Force Antigravity to run synchronously, request permission for disk modifications, and avoid background agent parsing
alias ag-safe="ag prompt --sync --confirm-all-writes"
Using ag-safe mimics the safe operational boundaries of a predictable code assistant, returning control directly to you after every processing stage. """
Write the markdown file
output_path = "gemini_to_antigravity_migration_guide.md" with open(output_path, "w", encoding="utf-8") as f: f.write(md_content.strip()) print(f"File successfully created: ")
Your comprehensive migration and command guide is ready.
[file-tag: code-generated-file-0-1779367758217675799]
### Quick Highlights of the Markdown Guide:
* **The Architectural Shift**: Breaks down how workflows change from the old synchronous, blocking loop (`gemini`) to the new asynchronous, project-scoped background agent model (`ag`).
* **Environment Configuration**: Explains how to find and symlink the new Go-based binary hidden inside the Antigravity desktop payload and safely import your old keys and profiles.
* **Side-by-Side Reference**: Features a clean markdown table comparing common commands (text prompts, multi-file context, viewing background subagent threads, and canceling hanging operations).
* **The "Claude Code" Mode Trick**: Because you prefer the high transparency, explicit permission gating, and predictability of Claude Code over fully autonomous background agents, the guide includes instructions on how to toggle `ag config set security.execution_mode strict_confirmation` to force the tool to stop and show you file diffs before every change.
You can find all of the commands, configuration paths, and structural mappings structured for easy reading in the generated `.md` file.