How to use agyr on Windows: Git Bash and Credential Manager

Running agyr on Windows enables managing multiple Google accounts for Antigravity CLI (agy) and automating rotation during HTTP 429 quota exhaustion. While Linux uses filesystem token files and D-Bus keyring isolation, Windows uses Windows Credential Manager. This guide covers installation, credential storage in the wincred backend, shell wrappers, MSYS path conversion, process termination, locking, and limitations.

Installing agyr on Windows

Windows is supported as a first-class platform alongside Linux. Installation requires bash, git, and jq. In Git Bash (MSYS), prerequisites include jq (e.g. via winget install jqlang.jq), Windows PowerShell (powershell.exe on PATH), cygpath, and taskkill (taskkill is included with Git for Windows).

Install agyr using the unified auto-detect installer:

curl -fsSL https://agyr.pages.dev/install.sh | bash

Alternatively, clone the repository and invoke the platform installer directly:

git clone https://github.com/luongtrz/agyr.git ~/tools/agy-acct
bash ~/tools/agy-acct/platforms/windows/install.sh

The installer creates Git Bash scripts and Windows .cmd wrappers in ~/.local/bin. Install scripts only create wrappers; they never log in or inspect tokens. After installation, agyr help works and bash test/run.sh is expected to pass without requiring a login.

How the wincred Backend Stores and Swaps Credentials

The agyr tool selects the wincred backend on Windows automatically (AGYR_BACKEND=file|wincred). On Windows, agy stores its active login in a single Windows Credential Manager generic entry with target gemini:antigravity, containing JSON identical to the Linux token file. Override the target using AGY_CRED_TARGET.

Because Credential Manager is a global store that cannot be redirected per-process, agyr use <name> backs up the active login to accounts/.last-token.bak, then overwrites the entry using platforms/windows/cred.sh and cred.ps1. Bare agy, agyr, and .cmd wrappers all interact with swapped credentials without D-Bus bypasses.

Helper scripts in platforms/windows/ manage credential operations: cred.sh and cred.ps1 read, write, and delete entries without printing secrets, while inspect-cred.ps1 outputs diagnostic metadata. Running agyr forget deletes the gemini:antigravity entry (refusing with exit code 1 if unsaved, unless forced with -f).

Windows Command Wrappers and Supported Shells

The repository provides three entry-point commands in bin/: agyr (account management), agy-run (headless execution with 429 failover), and agy-task (worktree task runner).

The Windows installer generates Bash scripts and Windows .cmd batch wrappers (agyr.cmd, agy-run.cmd, agy-task.cmd) in $BIN_DIR. Supported shells include:

MSYS Path-Conversion Guard and Process-Tree Termination

Git Bash (MSYS) automatically rewrites POSIX arguments starting with a slash into Windows paths (e.g. converting /quota into C:/Program Files/Git/quota). To preserve arguments, platforms/windows/platform.sh sets MSYS2_ARG_CONV_EXCL=/quota for agyr and MSYS2_ARG_CONV_EXCL='*' for agy-run. Paths handed to agy are normalized via cygpath -m.

Git Bash lacks POSIX process groups and setsid detachment. When agy-run detects an HTTP 429 quota exhaustion error, it reaps the process tree using native Windows process management:

taskkill //T //F //PID <winpid>

This terminates the process tree cleanly, allowing agy-run to apply cooldowns, rotate accounts, and resume the conversation.

Cross-Platform Locking and Slot Safety

All credential swaps, slot writes, and updates to accounts/state.json are serialized by a lock file at accounts/.swap.lock using atomic exclusive file creation (set -o noclobber). This prevents concurrent operations from clobbering credentials.

Modifications use atomic file writes: token files, slots, backups, and state.json are written to temporary files and renamed into place. Operations take a single private snapshot of the active login for identity checks before write-back.

Slot names contain only ASCII letters, digits, hyphens, and underscores (e.g. acc1, work), disallowing spaces, dots, slashes, or @. On Windows, slot files in ~/.gemini/antigravity-cli/accounts/ are secured by NTFS user profile ACLs.

Known Limitations and Quick-Start Commands

Operating agyr on Windows involves several operational limitations:

To set up multiple accounts and verify automated execution on Windows, run the standard quick-start commands:

# Step 1: Sign in and save primary account
agyr
agyr save acc1

# Step 2: Clear active session and register second account
agyr forget
agyr
agyr save acc2

# Step 3: Inspect real-time quota status across all slots
agyr list

# Step 4: Run automated tasks with 429 auto-failover
agy-run --add-dir . --prompt "Write unit tests for the auth service"

Related Guides

Additional resources for configuring Antigravity CLI rotation and account management: