Skip to content

Repository files navigation

Antigravity-trace

This project lets you see the raw LLM calls made by Antigravity.

Usage

  • Setup: python3 -m venv venv && source venv/bin/activate && pip install -r requirements.txt. On subsequent use, just source venv/bin/activate
  • Install: ./antigravity-trace.py [--verbose]
  • Uninstall: ./antigravity-trace.py --uninstall

This sets up hooks to capture Antigravity's activity. It writes logs in ~/antigravity-trace. The logs are standalone HTML files so you can view in a normal browser and share them, but they're also JSONL in so you can process them with tools. The --verbose flag captures additional activity (LLM calls for next-edit-prediction, integration between core and VSCode, stderr).

When a new version of Antigravity is released, this extension will deliberately break to let you know something's wrong; you'll have to reinstall or uninstall.

Overview

Antigravity is a fork of VSCode with two main components:

  1. A bundled extension /Applications/Antigravity.app/Contents/Resources/app/extensions/antigravity written in typescript which does all the VSCode integration. (There are a few other bunded extensions too, for browser, code-executre, remoting).
  2. A core agent binary, written in Golang, which does the actual agentic work. This is similar to how Claude and Codex also have IDEs that shell out to their corresponding CLI binary. The agent also includes a language server for next-edit-prediction. The agent calls Google endpoints to make its LLM calls (for both agentic chat and next-edit-prediction), and also calls into services provided by the VSCode extension e.g. LaunchBrowser, InsertCodeAtCursor.

The extension invokes the core agent golang binary like this:

language_server_macos_arm \
  --cloud_code_endpoint https://daily-cloudcode-pa.sandbox.googleapis.com \
  --inference_api_server_url http://jetski-server.corp.goog \
  --api_server_url http://jetski-server.corp.goog \
  --analytics_server_url http://jetski-server.corp.goog \
  --parent_pipe_path <UDS> \
  --extension_server_port <EXTENSION> \
  [--server_port <HTTPS>] \
  --enable_lsp [--lsp_port <LSP>] \
  --random_port

When you install this extension, it hooks into the various communication channels and writes them into the log.

Note: strictly speaking, the extension doesn't normally pass --server_port nor --lsp_port: the golang server picks available ports for these, like it does for --random_port, and it communicates its chosen port numbers by sending a LanguageServerStarted(server,lsp,random) request to the extension.

I believe there must be another communication channel that I haven't yet spotted: when the user types a prompt into the agent and hits Submit, then this message must be sent somehow to the golang server, but I've not seen it on any of the above channels.

How does it hook into the communication channels? (1) It creates a "shadow" extension at ~/.antigravity/extensions/antigravity which is largely a copy of the true extension at /Applications/Antigravity.app/Contents/Resources/app/extensions/antigravity but with a higher version number in its package.json; Antigravity will by preference load the shadow rather than the real one. (2) In the shadow extension, language_server_macos_arm has been replaced with my own python wrapper which invokes the true binary but wraps all the communication channels above, e.g. it sets up a local proxy for --cloud_code_endpoint URI where the proxy intercepts requests and responses to the true URI, passing them on, but logging them. (3) For the HTTPS server_port, the wrapping is done by inserting a small interceptor into the extension's extension.js minified javascript.

About

Dump the LLM calls and extension activity of Antigravity IDE

Resources

Stars

72 stars

Watchers

5 watching

Forks

Releases

Packages

Contributors

Languages