Adapters
The Antimatter ecosystem is built on an Independent Adapter Architecture. The central Gateway handles all security, routing, cryptography, and Cloudflare tunneling β adapters are lightweight IPC clients that bridge the Gateway to specific AI agents.
The Adapter Model
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ antimatter-core Gateway ββ (Security Β· Routing Β· Cryptography) βββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ β ws://127.0.0.1:8765 (IPC) ββββββββββββββ΄βββββββββββββββββββββ β β βββββββΌβββββββ βββββββββββββββ βββββββΌβββββββ β AG Adapter β β AG2 Adapter β β CC Adapter β βTypeScript β β Python β β Node.js β ββββββββββββββ βββββββββββββββ ββββββββββββββEach adapter:
- Connects to
ws://127.0.0.1:8765on startup. - Sends
REGISTER_ADAPTERwith its name. - Listens for forwarded messages from the Gateway.
- Interacts with its AI agent and sends
STEPevents back.
Antigravity IDE Adapter (ag)
The ag adapter bridges the Gateway with the official Google Antigravity IDE (VS Code extension).
- Source:
adapters/ag/ - Technology: TypeScript, VS Code Extension (
.vsix) - Install: Download
.vsixfrom GitHub Releases β Install in VS Code
How It Works
When the extension activates, it:
- Instantiates a
GatewayClientthat connects tows://127.0.0.1:8765. - Registers as
"name": "ag". - Watches the local
transcript.jsonlfile for new trajectory steps. - Streams each new step to the Gateway as a
STEPmessage. - Listens for
SEND_MESSAGEpayloads and translates them intovscode.commands.executeCommandcalls to inject prompts into the active agent.
Development
cd adapters/ag/npm installnpm run watch # Start esbuild watcher# Press F5 in VS Code to launch Extension Development Host
npm run lint # TypeScript type-checknpm run build # Production buildnpm run package # Package .vsixAntigravity 2.0 Adapter (ag2)
The ag2 adapter integrates the Gateway with the standalone Google Antigravity 2.0 desktop application.
- Source:
adapters/ag2/ - Technology: Python daemon
- Install:
Terminal window uv tool install antimatter-ag2antimatter-ag2 start
How It Works
This lightweight Python daemon:
- Monitors
.system_generated/logs/transcript.jsonlfor agent activity. - Acts as an IPC bridge β passes prompts from the mobile app into the local Antigravity 2.0 SDK subprocess.
- Exposes an agent Skill allowing natural language control (e.g., βStart my Antimatter bridgeβ).
Development
cd adapters/ag2/uv sync # Install dependenciesuv run antimatter-ag2 # Run in dev modeClaude Code Adapter (cc)
The cc adapter is the integration layer between the Gateway and Anthropicβs Claude Code CLI.
- Source:
adapters/cc/ - Technology: Node.js,
@anthropic-ai/claude-agent-sdk - Install:
Terminal window npm install -g antimatter-ccantimatter-cc start
How It Works
This adapter uses the official Claude Agent SDK to:
- Stream all events and logs from a running Claude Code session.
- Convert each event (tool call, text, thinking) to a
STEPmessage forwarded to the Gateway. - On
SEND_MESSAGEfrom the mobile app, inject the prompt directly into the running Claude session.
Development
cd adapters/cc/npm installnpm run dev # Start in watch modeWriting a Custom Adapter
Any program that can open a WebSocket connection can become an Antimatter adapter. Hereβs the minimum viable implementation:
Protocol
- Connect to
ws://127.0.0.1:8765 - Register immediately after connection:
{ "type": "REGISTER_ADAPTER", "name": "my-agent" }
- Listen for forwarded messages:
{ "type": "SEND_MESSAGE", "content": "..." }{ "type": "GET_FILES", "path": "/" }{ "type": "READ_FILE", "path": "/some/file.py" }
- Reply with appropriate response messages:
{ "type": "STEP", "stepType": "text", "content": "..." }{ "type": "FILE_TREE", "entries": [...] }{ "type": "FILE_CONTENT", "content": "..." }
Example β Go Adapter
package main
import ( "encoding/json" "github.com/gorilla/websocket" "log")
func main() { conn, _, err := websocket.DefaultDialer.Dial("ws://127.0.0.1:8765", nil) if err != nil { log.Fatal(err) } defer conn.Close()
// Register conn.WriteJSON(map[string]string{ "type": "REGISTER_ADAPTER", "name": "my-go-agent", })
for { _, raw, err := conn.ReadMessage() if err != nil { break } var msg map[string]interface{} json.Unmarshal(raw, &msg)
switch msg["type"] { case "SEND_MESSAGE": log.Printf("Received: %v", msg["content"]) // ... process with your AI agent } }}See the WebSocket Protocol Reference for the complete message schema.