Switch Both the agy CLI and Antigravity IDE Without Signing Out
How agy-swap updates shared Antigravity credentials across ~/.gemini, OS keychains, state.vscdb, and the background agy service with lock and rollback safety.
What Changes During One Account Switch
Unlike standalone browser sign-out and sign-in, switching in agy-swap updates every local state file that the agy CLI and Antigravity IDE read together:
Layer
macOS & Linux Behavior
Windows Behavior
Session files (~/.gemini)
Writes active OAuth session (0600) for CLI, IDE, and Jetski
Writes active OAuth session (0600) for agy CLI
OS credential store
Mirrors active session via /usr/bin/security or secret-tool
Mirrors active session into Windows Credential Manager
IDE signed-in label
Updates state.vscdb email label when sqlite3 is present
CLI session only
Background agy service
Writes reload marker and restarts background service via agy wrapper
Not applicable
Safety mechanism
flock lock + automatic rollback on any write failure
LockFileEx lock + automatic rollback
Step-by-Step Setup on a New Machine
You can install the official agy binary directly through agy-swap with SHA-512 verification, save your Google accounts once, and switch from either the interactive TUI or one-line scripts.
# 1. Optional: install official Google Antigravity CLI with SHA-512 verification
agy-swap install-agy
# 2. Save each Google account via browser sign-in
agy-swap add
# 3. Open the TUI, highlight an account, press Enter, and choose Switch
agy-swap
# Or switch directly from scripts by email, alias, or 1-based slot
agy-swap switch 2
How the Launcher Wrapper Prevents Background Overwrites
When you leave agy open in another terminal or workspace, its hourly OAuth refresh normally overwrites the global session file. agy-swap wraps ~/.local/bin/agy and ~/.gemini/bin/agy (keeping the original binary at ~/.local/libexec/agy or .agy.real) and updates agy.version.json size/mtime metadata so the IDE accepts the wrapper.
Whenever agy exits or refreshes, agy-swap --sync-session matches the refresh_token against your saved accounts and harvests the refreshed token into vault.json without overriding whichever account you switched to.
Frequently Asked Questions
Do I need to restart the Antigravity IDE window after switching?
No on macOS and Linux. agy-swap writes the reload marker and restarts the background agy service so the open IDE picks up the new account. Note that any active in-flight agent run stops during the reload.
Can I remove the agy wrapper cleanly later?
Yes. Uninstall agy-swap first, then move ~/.local/libexec/agy (or .agy.real) back over agy, or re-run the official agy installer.
What happens if I sign in to a brand-new account inside the IDE instead of agy-swap?
agy-swap detects the unsaved active account without overwriting it, and running agy-swap add offers to save that active session.
Try agy-swap in your terminal
Install with Homebrew, shell, PowerShell, or Go source, then save your accounts and inspect live quotas locally.