Worktrees & Adaptive Project Governance
Running multiple chats inside one checkout lets branch switches in one tab overwrite files under another — yet forcing heavy branch guardrails onto a throwaway prototype or notes directory creates needless friction. AGY Studio pairs filesystem-level Git Worktree isolation with Adaptive Project Governance that fits each repository's real operational risk.

Per-Chat Git Worktrees & Tiered Guardrails
Create or switch dedicated sibling worktrees directly from Project Detail or the conversation topbar, or run wt.mjs from any repository without repo-local config files.
Every registered repository uses one of three workflow tiers — stored strictly inside your local user directory (~/.gemini/antigravity/anti-claude/git-workflow-policy.json) so business repositories stay untouched:
| Tier | Recommended When | Behavior |
|---|---|---|
observe | Solo prototypes, notes, or exploration repos | Records activity with minimal friction while keeping irreversible safety floors active (force-push protection, commit-boundary secret scanning, destructive command prompts) |
protect-main | Shared app or team repositories | Keeps main clean; prompts or routes edits onto feature branches and sibling worktrees |
worktree-only | Live-daemon or runtime-attached repositories | Protects the primary checkout from in-place edits; requires worktree isolation for parallel development |
All tiers include force-push protection on protected branches, optional git push --tags blocking, commit-boundary credential/PII scanning (secret-scanner.mjs), and a 24-hour guard event log.
Adaptive Project Governance
Rather than applying one rigid policy to every folder, AGY Studio inspects local directory structure (package manifests, CI workflows, IaC files, docs layouts, and registered sibling repositories) to recommend guardrails tailored to both the project's shape and your personal working style.
Five Archetypes & Three Operational Traits
- Project Archetypes:
app(Application Engineering) ·infra(Infrastructure / Ops) ·exploration(Research & Exploration) ·prototype(Scripts & Prototypes) ·docs(Documentation & Writing) - Operational Risk Traits:
liveCheckout— Primary checkout runs a live local daemon or service (raises floor toworktree-only)shared— Team or shared repository (raises floor toprotect-main)remoteBlast— Commands can impact remote clusters or production infrastructure
Your personal preferences (gitExperience, autonomyPosture, reviewGatePref) are captured once and remembered globally. When a repository's safety floor is stricter than your preferred Git depth (for example, a lightweight Git user opening a liveCheckout repo), AGY Studio keeps the safety floor intact while letting agents handle branch/worktree creation smoothly in plain language.
Non-Blocking New-Project Onboarding & Greenfield git init
- Opening a new folder or creating a project from Sidebar
+or Projects → New project surfaces a calm, non-blocking Governance Card inside the Project Cockpit and topbar — never hijacking navigation or blocking your first prompt. - For brand-new folders without Git yet, the card offers one-click Init Git & Apply (runs safe
git init -b mainwithout staging stray untracked files) or Customize to tailor locked files and verify commands via/grill-me. - As a repository matures (e.g., adding CI or shared remotes, or running smoothly for 7+ days with zero workflow friction), AGY Studio suggests upward hardening or safe downward relaxation — always with sticky dismissal if you prefer your current setup.
Local History Replay Preview
Unsure whether tightening a repository from observe to protect-main or worktree-only will nag you constantly? Click Replay check (or run gov.mjs replay) before applying any rule change:
- Reads recent local conversation transcripts for that project strictly offline and read-only (never uploads logs and never reads raw Chain-of-Thought).
- Evaluates your past tool calls against the candidate policy and reports concrete counts: how many past actions would newly prompt versus how many would be relaxed, with sensitive command arguments redacted.
- Honest boundary: Brand-new directories with no prior local sessions have no history to replay yet.
10-Snapshot Policy Rollback
Every policy change — whether adopted from the Project Cockpit card or applied via gov.mjs apply — automatically records a validated snapshot in ~/.gemini/antigravity/anti-claude/governance-snapshots.json (retaining the last 10 snapshots per repository).
- In the UI: Click Undo last change directly on the Project Cockpit Governance Card.
- From the CLI:bash
node ~/.gemini/config/plugins/maga-git-workflow/bin/gov.mjs rollback --dir "<repo-path>" - Rollbacks write the restored policy atomically first and pop the snapshot second, rejecting malformed entries without mutating active rules.
Parameter & File Locks (.agents/locks.json)
For sensitive configs, migrations, published sections, or experiment hyperparameters that should never drift silently, declare locked files or keys in .agents/locks.json. Whenever an agent attempts to modify a locked target, AGY Studio pauses cleanly with a mandatory confirmation surfaced both inline and in the ⌘J Decision Inbox.
Live Diff Citations & Global Projects Hub
- Inline diffs & 1-click
@mentions: Expand uncommitted changes and recent commit diffs inside Project Detail without opening a terminal; click+or drag files straight into the composer as@context. - Cold-start conversation suggestions: Generates 3 concrete follow-up starters from recent branch state and project history using your own Gemini API key (compact summaries only, spending zero Antigravity quota); clicking one opens the matching worktree with a ready handoff prompt.
- Global Projects Hub: Survey every workspace in one screen — live activity badges, worktree counts, inline
AGENTS.mdeditor, and 30-day token usage heat bars.
