Grav — AI Autopilot for Windsurf / Antigravity IDEStop babysitting your AI agent. Grav auto-clicks approval buttons, keeps your chat pinned to the latest response, and blocks dangerous terminal commands — completely hands-free. Why Grav?Windsurf / Antigravity runs its agent panel inside an Out-of-Process IFrame (OOPIF) — standard VS Code extensions can't reach it. Grav connects directly via Chrome DevTools Protocol (CDP), injecting an observer into the webview to reliably interact with every button regardless of Shadow DOM or iframe boundaries.
Features🤖 Auto-Click Agent ButtonsAutomatically clicks 🛡️ Safety Guard (Terminal Protection)Reads every terminal command before clicking
Custom patterns via 🌐 Skip Browser SubAgentWhen the AI agent attempts to use a browser automation tool ( 📜 Auto-ScrollKeeps the chat panel pinned to the bottom while AI responds. Automatically pauses when you scroll up and resumes when you scroll back down. 🧠 Adaptive LearningObserves which terminal commands you approve or reject. Builds a confidence model and suggests promoting safe commands to the whitelist — fewer interruptions over time. 🛠️ Auto-FixerIf the AI Agent makes a typo in the terminal and the command fails, Grav evaluates the error and automatically injects the corrected command. No wasted turns asking for permission.
💬 VS Code Native Chat & Copilot EditsFully supports Microsoft's native Copilot Edits and Chat tools. Automatically detects native VS Code permission boundaries and auto-clicks 🗂️ Per-Project PatternsDefine custom button patterns and blacklists per workspace via
⚡ Adaptive Accept LoopDetects when the AI agent fires a 🧩 Smart Terminal Kill GuardWhen a notification containing blocking keywords appears, Grav inspects the actual DOM before sending any kill signal. Only fires if the element contains a visible 🔍 Dry Run ModeScan and match buttons without clicking. See exactly what Grav would click before enabling auto-approval on a new project. 📊 Real-Time Dashboard (
|
| Setting | Default | Description |
|---|---|---|
grav.enabled |
true |
Master on/off switch |
grav.autoScroll |
true |
Keep chat pinned to bottom |
grav.dryRun |
false |
Scan without clicking |
grav.skipBrowserAgent |
false |
Click Skip instead of Run on browser_subagent steps |
grav.approvePatterns |
[Accept, Run, ...] |
Button labels to auto-click |
grav.presetMode |
1.19.6 |
Button preset: 1.19.6, 1.23.2, 1.24+, custom |
grav.approveIntervalMs |
3000 |
Scan interval (ms, minimum enforced: 3000) |
grav.scrollPauseMs |
15000 |
Pause after manual scroll-up (ms) |
grav.learnEnabled |
true |
Adaptive learning engine |
grav.terminalWhitelist |
[] |
Always-allow command patterns |
grav.terminalBlacklist |
[] |
Always-block command patterns (supports /regex/) |
grav.cdpEnabled |
true |
CDP engine (required for OOPIF access) |
grav.cdpPort |
9333 |
CDP debug port |
Commands
| Command | Shortcut | Description |
|---|---|---|
Grav: Dashboard |
Cmd+Shift+D |
Open monitoring dashboard |
Grav: Diagnostics |
— | CDP sessions, button detection state, conflict report |
Grav: Pause Auto-Accept |
— | Temporarily pause clicking |
Grav: Resume Auto-Accept |
— | Resume clicking |
Grav: Accept All |
— | Force-click all accept commands once |
Grav: Toggle Dry Run |
— | Toggle dry run mode |
Grav: Toggle Auto-Scroll |
— | Toggle auto-scroll |
Grav: Toggle Skip Browser SubAgent |
— | Toggle browser agent bypass |
Grav: Refresh Observer |
— | Force re-inject observer into all sessions |
Grav: Force Reconnect CDP |
— | Manually reconnect CDP |
Grav: Init Project Config |
— | Create .vscode/grav.json template |
Grav: Purge Bad Learning Data |
— | Clean up incorrectly learned entries |
Grav: Learning Stats |
— | View command confidence scores |
Grav: Manage Terminal Commands |
— | Interactively manage whitelist/blacklist |
Grav: Stop All Terminals |
Cmd+Shift+Q |
Send Ctrl+C to agent terminals |
Status Bar
| Display | Meaning |
|---|---|
🚀 Grav |
Active — auto-clicking |
⏸ Grav |
Paused |
🚫 Grav |
Disabled |
$(plug) N $(fold-down) |
CDP connected, N sessions, auto-scroll ON |
$(debug-disconnect) |
CDP disconnected |
$(exclude) SKIP |
Skip Browser SubAgent ON |
$(eye) DRY |
Dry Run mode ON |
Troubleshooting
CDP off / disconnected: Fully quit the IDE (Cmd+Q), not just close the window. Reopen. If still failing: Grav: Force Reconnect CDP.
Buttons not being clicked: Check Dry Run in Dashboard. Open Activity log. Run Grav: Diagnostics. Verify label case matches exactly.
Learning store has garbage: Run Grav: Purge Bad Learning Data (also runs automatically on startup).
Terminal being killed unexpectedly: The Smart Terminal Kill Guard verifies DOM input presence before firing — approval toasts will never trigger a kill. If still happening, check grav.terminalBlacklist for conflicting entries via Grav: Diagnostics.
Requirements
- Windsurf IDE or Antigravity (VS Code fork with CDP debug port support)
- No additional setup —
wsWebSocket module is bundled in the VSIX
Changelog
v4.0.14
- Fix CDP disconnection under load: Heartbeat ticks (
setInterval+ async) were running concurrently — each spawning CDP commands that cascaded into timeouts, marking sessions dead, and triggering more discovery loops. Fixed with_heartbeatRunningguard that skips a tick if the previous is still in flight. - Fix concurrent
discoverTargets(): Added_discoverRunningguard to prevent the heartbeat,Target.targetCreatedevents, andhotUpdate()from running overlapping discovery loops. - Fast heartbeat ping: Observer alive-check (
window.__grav3) now uses 2s timeout (was 5s) so a dead session fails fast without blocking the full heartbeat tick for 5s. - Longer session pruning window:
DEAD_AFTER_MSraised from 15s → 30s, giving sessions more time to recover when Antigravity is busy processing a long AI turn. - Reconnecting status indicator: Status bar now shows
$(sync~spin)(spinning icon) while CDP is reconnecting, with attempt count. Previously showed$(debug-disconnect)immediately, causing confusion between "genuinely disconnected" and "momentarily reconnecting." - Cleanup guard:
cleanup()resets_heartbeatRunningand_discoverRunningso no stale "lock" blocks the next connection attempt after a WS close.
v4.0.13
- Security fix — pipe-to-shell detection:
curl url | bash,wget url | sh,curl url | zshwere silently passing the blacklist due to a regex anchor bug. All 8 pipe-to-shell patterns (| bash,| sh,| zsh,| pwsh,wget|sh,curl|sh,curl|bash,wget|bash) now correctly block in both the CDP observer and the learning safety guard. - False positive fix:
git push --forceno longer incorrectly blocksgit push --force-with-lease(trailing word-boundary lookahead added). Executebutton support: Added toDEFAULT_PATTERNSandPRESET_PATTERNS['1.24+']— Antigravity variants that useExecuteinstead ofRunare now auto-clicked.Allow This Workspaceadded to 1.24+ preset — covers Antigravity versions that use this label variant.HIGH_CONFcleanup: Removed dead entries'Go'(too generic, no matching pattern) and'Approved'. Added'Allow This Workspace'to match new preset entry.
v4.0.12
- Fix SKIP_BROWSER_AGENT false blocking: When Skip Browser SubAgent was ON and an AI response contained multiple tool calls (e.g.,
browser_subagentfollowed byrun_terminal), the terminalRunbutton was incorrectly blocked. Root cause:b.closest('[class*=message], [class*=container]')found a broad parent wrapping all steps; itsinnerTextcontainedbrowser_subagentfrom the earlier step. Fix: narrowed selector to[class*=tool], [class*=step]only — per-step scope, no cross-step bleed. - Observer version bumped to v4.0.12 for force-reload on update.
v4.0.11
- Restore JS click fallback alongside CDP native click for maximum compatibility.
- Fix iframe discovery for nested OOPIF targets in Antigravity 1.24+.
v4.0.10 — v4.0.7
- CDP click: trigger native
Input.dispatchMouseEventdirectly to bypass Antigravity's permission guard. - Human-like click sequence to avoid anti-automation detection on Antigravity update.
- Split status bar into 4 independent items (main, CDP, Skip, Dry Run).
- Skip Browser SubAgent feature: detect
browser_subagent/computer_usetool calls and click Skip instead of Run. - Fix activation crash introduced by Antigravity internal update.
v4.0.0
- Auto-Fixer Engine: Evaluates failed terminal commands (exit code > 0) and automatically injects corrections for common typos, missing aliases, and Git suggestions.
- VS Code Native Chat Support: Full support for Copilot Edits (
workbench.action.chat.applyAll,github.copilot.acceptWorkspaceEdit) and Inline Chat.
v3.7.0
- Adaptive Accept Loop: scan interval drops to 800ms for 10s on
run_commandtool-call event. - Smart Terminal Kill Guard: DOM-verified kill — only fires when
<input>/<textarea>is visible. - Diagnostics Conflict Report: surfaces conflicts between
SAFE_TERMINAL_CMDSand userterminalBlacklist.
v3.6.3
- Dev Server Protection:
grav.stopAllTerminalsfilters out user dev servers. - Enhanced Blacklist: Added
su -andgit reset --hard. - Optimized word-boundary matching in
matchesBlacklist.
v3.6.0
- Per-project patterns via
.vscode/grav.jsonwith live file watcher. - Dry Run mode with Dashboard toggle and status bar indicator.
- Notification suppression: debounced
MutationObserverreplaces polling.
v3.5.0
- CDP engine rewrite: exponential backoff reconnect, session pruning, heartbeat re-inject.
- Safety Guard: reads
<code>blocks adjacent to Run buttons. - Adaptive Learning Engine: mini-batch SGD, confidence scoring, promote/demote.
Author: An Le · GitHub · Issues · anlvdt@gmail.com
☕️ Support the Developer If Grav saves you time, consider supporting:
- 💳 MB Bank:
0360126996868(LE VAN AN)