Skip to content

feat: add Antigravity CLI adapter and session parser#1326

Draft
shreem26 wants to merge 1 commit into
BlazeUp-AI:mainfrom
shreem26:feat/antigravity-cli
Draft

feat: add Antigravity CLI adapter and session parser#1326
shreem26 wants to merge 1 commit into
BlazeUp-AI:mainfrom
shreem26:feat/antigravity-cli

Conversation

@shreem26
Copy link
Copy Markdown
Contributor

@shreem26 shreem26 commented Jun 1, 2026

Purpose

Add full IDE adapter for Google Antigravity CLI (agy), enabling Observal to scan, detect, and capture sessions from Antigravity installations. This brings Antigravity to first-class IDE status with session parsing support.

Approach

Follows the existing adapter pattern (one adapter per IDE on both CLI and server sides):

CLI side:

  • observal_cli/ide/antigravity.py — scan home/project for MCPs, skills, hooks, agents
  • observal_cli/ide_specs/antigravity_hooks_spec.py — hook spec using hooks.json format with PreInvocation + Stop events
  • observal_cli/sessions/antigravity.py — session file helpers with WSL path resolution
  • observal_cli/hooks/antigravity_session_push.py — hook-based session push (for when agy hook execution works)
  • observal_cli/cmd_reconcile_cli.pyobserval reconcile --ide antigravity for manual session push
  • observal_cli/cmd_doctor.py_patch_antigravity() writes hooks to ~/.gemini/config/hooks.json

Server side:

  • observal-server/services/ide/antigravity.py — config file generation for agent installs
  • observal-server/services/session_parsers/antigravity.py — parses brain/<id>/.system_generated/logs/transcript.jsonl into normalized trace events

Shared:

  • observal_cli/shared/utils.pyresolve_wsl_windows_home(), resolve_antigravity_dir(), resolve_antigravity_config_dir() for cross-platform path resolution
  • IDE registry entries on both server and CLI sides with session_parser: "antigravity"

Key paths:

  • Config: ~/.gemini/antigravity-cli/ (sessions, MCPs, settings)
  • Hooks: ~/.gemini/config/hooks.json (separate from settings.json)
  • Sessions: ~/.gemini/antigravity-cli/brain/<conversation-id>/.system_generated/logs/transcript.jsonl
  • MCP config: ~/.gemini/config/mcp_config.json

How has this been tested

  • 19 new tests in tests/test_antigravity_adapter.py covering:
    • Registry entry validation
    • Adapter registration and protocol compliance
    • MCP scanning (global + project, including serverUrl for remote MCPs)
    • Skill discovery
    • Hook detection from hooks.json
    • Hook config generation
    • Shim status
  • Existing test suites pass (156 total across adapter, registry, and sync tests)
  • Manual testing on WSL:
    • observal scan --ide antigravity detects the IDE and shows hook status
    • observal doctor patch --hook --ide antigravity writes correct hooks.json
    • observal reconcile --ide antigravity --dry-run discovers sessions with transcript data

Learnings

  • agy (Go binary) ≠ Gemini CLI (TypeScript): The closed-source agy binary has a different hook implementation from the open-source Gemini CLI. It logs "executing command" for hooks but does not actually spawn child processes in v1.0.3. The open-source Gemini CLI hooks are synchronous and functional.
  • Session transcripts are incremental JSONL: Written to brain/<id>/.system_generated/logs/transcript.jsonl in real-time during sessions. Format includes step_index, source, type, status, created_at, content, and tool_calls.
  • WSL path resolution needs 3 fallbacks: (1) native ~/.gemini/, (2) cmd.exe + wslpath, (3) scan /mnt/c/Users/ for username match.
  • observal reconcile is the reliable path: Until agy fixes hook execution, manual reconcile is the only way to push sessions. The hook infrastructure is ready for when it works.

Known limitations

  • Hook-based real-time capture does not work with agy v1.0.3 (hooks fire but commands are not executed)
  • observal reconcile --ide antigravity requires the server ingest endpoint to accept the payload (needs server rebuild)
  • Token counts are not available in the transcript format
  • Transcript files may be empty for very short sessions or if agy is killed ungracefully

@github-actions github-actions Bot added cli CLI changes server Pull request touches server code tests Pull request adds or modifies tests labels Jun 1, 2026
@shreem26 shreem26 changed the title feat(ide): add Antigravity CLI adapter and session parser feat: add Antigravity CLI adapter and session parser Jun 3, 2026
Add full IDE adapter for Google Antigravity CLI (agy), including:
- CLI adapter: scan home, scan project, MCP discovery, hook detection
- Server adapter: config file generation for agent installs
- Session parser: parse brain/<id>/transcript.jsonl into normalized traces
- Hook spec: hooks.json format with PreInvocation + Stop events
- Session push hook: for when agy hook execution is functional
- Reconcile command: observal reconcile --ide antigravity for manual push
- WSL path resolution: transparent Windows/Linux/macOS support
- IDE registry entries on both server and CLI sides
- 19 tests covering adapter protocol, scanning, and hook detection

SPDX-FileCopyrightText: 2026 Hari Srinivasan <harisrini21@gmail.com>
SPDX-License-Identifier: AGPL-3.0-only
@ShaanNarendran ShaanNarendran force-pushed the feat/antigravity-cli branch from 27fd313 to 95a6470 Compare June 3, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI changes server Pull request touches server code tests Pull request adds or modifies tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant