Skip to content

feat(agent-manager): add Antigravity CLI adapter - #133

Open
nnhhoang wants to merge 3 commits into
codeaholicguy:mainfrom
nnhhoang:feat/antigravity-cli-adapter
Open

feat(agent-manager): add Antigravity CLI adapter#133
nnhhoang wants to merge 3 commits into
codeaholicguy:mainfrom
nnhhoang:feat/antigravity-cli-adapter

Conversation

@nnhhoang

@nnhhoang nnhhoang commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an antigravity_cli agent adapter so ai-devkit can detect, list, and inspect Google's Antigravity CLI (agy) alongside Claude, Codex, Gemini, and Grok. This is the runtime/agent side of Antigravity and is independent of the existing antigravity environment (which configures the Antigravity IDE), the same way gemini_cli is independent of the gemini environment.

How it works

  • Detects agy processes from the shared AgentDetectionContext snapshot (processNames = ['agy']), falling back to captureProcessSnapshot for standalone use.
  • Resolves each live process to its conversation through ~/.gemini/antigravity-cli/cache/last_conversations.json, a { "<cwd>": "<conversationId>" } map the CLI keeps per workspace (ANTIGRAVITY_CLI_HOME overrides the base).
  • Lists history from brain/ instead. That cache holds only the current conversation of each workspace, so listing from it would hide every older conversation of a cwd; brain/ is the complete set. The cache is then used for what it is — the cwd of a workspace's current conversation.
  • Reads the transcript from brain/<conversationId>/.system_generated/logs/transcript.jsonl: user prompts are the text inside <USER_REQUEST>...</USER_REQUEST> of type: "USER_INPUT" records, assistant turns are type: "PLANNER_RESPONSE", tool calls and SYSTEM records are skipped unless verbose. Summary is the last user request; last activity is the newest record created_at.

Known limitation: cwd for older conversations

Antigravity records a conversation's workspace nowhere except that cache — transcript.jsonl and transcript_full.jsonl contain no cwd, and conversations/<id>.db keeps its metadata in protobuf blobs (trajectory_metadata_blob, steps.metadata) with no readable path column. A conversation the cache no longer names is therefore listed with cwd: '' and surfaces under agent sessions --all rather than a cwd-scoped listing. Listing it without a cwd beats hiding it.

Changes

  • New AntigravityCliAdapter (self-contained, inline parsing like the other recent adapters) + unit tests.
  • AgentType/StartableAgentType gain antigravity_cli; AGENTS.antigravity_cli = { command: 'agy', matches: matchArgv0('agy') }; exported from the package.
  • Wired into the agent command and channel runner; TYPE_LABELS, --type help, and VALID_AGENT_TYPES updated.
  • README matrix gains an Antigravity CLI row (yes | yes) instead of ticking the Antigravity IDE row: remote control drives agy, not the IDE, and Setup is already true since the antigravity-cli environment shipped in feat(cli): add Antigravity CLI environment #134. Same separation the web docs already use.
  • dev-lifecycle docs under docs/ai/*/feature-antigravity-cli-adapter.md.

Testing

  • npx nx run agent-manager:test (594) and npx nx run cli:test (1057) pass; husky pre-commit ran all packages.
  • Verified against real agy data on disk: listSessions() returns all 5 conversations under brain/ where the cache named 1, and listSessions({ cwd }) still returns exactly the one belonging to that workspace.
  • detectAgents() with a live agy process resolves the cwd via last_conversations.json to its conversation and summary.

@nnhhoang
nnhhoang force-pushed the feat/antigravity-cli-adapter branch from 09604b5 to 617efc6 Compare July 2, 2026 07:30
* ~/.gemini/antigravity-cli/cache/last_conversations.json, which the CLI
* maintains as a `{ <cwd>: <conversationId> }` map of the current conversation
* per workspace. The process cwd is the join key.
* 3. Reading the transcript from

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation does not fully satisfy the stated requirement for historical Antigravity CLI sessions. listSessions() only reads cache/last_conversations.json, which is documented as the current conversation per cwd, so older brain/ transcripts can be missed.

Detect, list, and inspect Google's Antigravity CLI (`agy`) alongside Claude,
Codex, Gemini, and Grok.

- AntigravityCliAdapter (self-contained, parsing inline like the other recent
  adapters): detects `agy` processes via matchArgv0, resolves each live process
  to its conversation through
  ~/.gemini/antigravity-cli/cache/last_conversations.json (the { cwd:
  conversationId } registry), and reads the transcript from
  brain/<id>/.system_generated/logs/transcript.jsonl. The last <USER_REQUEST>
  prompt is the summary; the newest record created_at is the last activity.
- AgentType 'antigravity_cli', AGENTS launch map entry (command `agy`), package
  exports.
- Registered in the agent command and channel runner; added to TYPE_LABELS,
  --type help, and VALID_AGENT_TYPES. README matrix flips Antigravity remote
  control to yes.
- Independent of the existing `antigravity` IDE environment, the same way
  gemini_cli is independent of the gemini environment.

Verified against a real agy session on disk: listSessions and getConversation
parse the on-disk conversation, and detectAgents resolves a live agy pid via
last_conversations.json to its conversation and summary.
… cache

cache/last_conversations.json holds the current conversation per workspace, so
listing from it hid every older conversation of a cwd — on a dev machine with
five conversations on disk it surfaced one. Enumerate brain/ instead and use the
cache only for what it is: the cwd of a workspace's current conversation.

Antigravity records the workspace nowhere else — neither transcript.jsonl nor
transcript_full.jsonl carries it, and conversations/<id>.db keeps its metadata in
protobuf blobs — so a conversation the cache no longer names is listed with an
empty cwd and surfaces under `agent sessions --all` rather than a cwd-scoped
listing. Listing it without a cwd beats not listing it.

Also adopts the shared process snapshot (processNames + AgentDetectionContext)
that landed while this branch was open, so the adapter no longer runs its own ps.
@nnhhoang
nnhhoang force-pushed the feat/antigravity-cli-adapter branch from 617efc6 to 40e3908 Compare August 25, 2026 20:14
@nnhhoang

Copy link
Copy Markdown
Contributor Author

Sorry for the long silence on this one. Rebased onto main and fixed the review comment: listSessions() now walks brain/ instead of last_conversations.json, so older conversations aren't hidden anymore — on my machine it went from 1 session to all 5. CI is green, ready for another look.

Remote control drives the `agy` CLI, not the Antigravity IDE, so ticking it on
the IDE row was wrong. Add an "Antigravity CLI" row — Setup yes (the
antigravity-cli environment shipped in codeaholicguy#134) and Remote control yes from this
adapter — and leave the IDE row as it was. Matches how Grok Build CLI is listed
and how the merged web docs already separate the CLI from the IDE.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants