agy~swap
Power Workflows

Directory Bindings and Running Two Antigravity CLI Accounts Simultaneously

Bind Git repositories to dedicated Antigravity profiles with sticky, balanced, or round-robin rules, or run two isolated agy CLI sessions at once.

Method 1: Per-Directory Account Profiles (Shared Session)

Profiles let you assign a primary account, a fallback reserve account, a model family focus, and a minimum quota threshold to specific repositories.

Ranking PolicyHow Eligible Accounts Are Selected
stickyKeeps the active or profile primary account until its quota drops below threshold or hits cooldown
balancedSelects whichever eligible account currently has the highest remaining quota
round-robinRotates through eligible accounts in saved order
agy-swap alias set work dev@company.com
agy-swap alias set personal user@example.com

agy-swap profile set work-profile work --family gemini --policy sticky --reserve personal --threshold 15
agy-swap bind set /path/to/repo work-profile --mode recommend
agy-swap run now

Method 2: Two Concurrent agy CLI Sessions on Different Accounts

Because agy normally stores credentials in a global OS keychain entry shared across all processes for your OS user, running a second account concurrently on macOS or Linux requires isolating both HOME and keychain storage so the two processes never overwrite each other:

AGY_BIN="$HOME/.local/libexec/agy"
[ -x "$AGY_BIN" ] || AGY_BIN="$(command -v agy)"

PROFILE_HOME="$HOME/.agy-homes/account-b"
mkdir -p "$PROFILE_HOME/.gemini/antigravity-cli/cache"
touch -t 203601010000 "$PROFILE_HOME/.gemini/antigravity-cli/cache/antigravity-keyring-unavailable"

HOME="$PROFILE_HOME" AGY_SWAP_SKIP_SYNC=1 WSL_INTEROP=1 "$AGY_BIN"

On the first launch, agy signs in for $PROFILE_HOME and stores credentials inside $PROFILE_HOME/.gemini, while your primary terminals and Antigravity IDE keep switching via agy-swap.

Choosing Between Directory Bindings and Isolated HOME

ScenarioRecommended Approach
Work repo vs personal repo used one at a timeUse agy-swap profile + agy-swap bind + agy-swap run now
Two live agy CLI agents editing different projects at the exact same momentUse isolated HOME with antigravity-keyring-unavailable and AGY_SWAP_SKIP_SYNC=1
Switching both the CLI and Antigravity IDE togetherUse agy-swap switch or press Enter -> Switch in the TUI

Frequently Asked Questions

Why does the isolated HOME command include WSL_INTEROP=1 on macOS or Linux?

Setting WSL_INTEROP=1 alongside the antigravity-keyring-unavailable marker instructs agy to keep its OAuth token inside $PROFILE_HOME/.gemini instead of writing to your global macOS Keychain or Linux Secret Service.

Does agy-swap profile isolate concurrent terminals automatically?

No. Profiles and bindings govern which account agy-swap activates in the shared local Antigravity session before launching agy-swap run now. For two separate simultaneous accounts, use the isolated HOME recipe.

Can I still use agy-swap inside the isolated HOME terminal?

Yes, if you leave AGY_SWAP_SKIP_SYNC unset and configure separate config paths, though keeping AGY_SWAP_SKIP_SYNC=1 prevents the secondary process from triggering global session synchronization.

Try agy-swap in your terminal

Install with Homebrew, shell, PowerShell, or Go source, then save your accounts and inspect live quotas locally.

brew install aklkbqx/agy-swap/agy-swap
curl -fsSL --proto '=https' --tlsv1.2 https://agy-swap.aklkbqx.com/install.sh | bash