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
Section titled βThe Adapter Modelβββββββββββββββββββββββββββββββββββββββββββββββββββββββββ antimatter-gateway 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)
Section titled β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
Section titled β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
Section titled β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)
Section titled βAntigravity 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
Section titled β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
Section titled βDevelopmentβcd adapters/ag2/uv sync # Install dependenciesuv run antimatter-ag2 # Run in dev modeClaude Code Adapter (cc)
Section titled βClaude 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
Section titled β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
Section titled βDevelopmentβcd adapters/cc/npm installnpm run dev # Start in watch modeWriting a Custom Adapter
Section titled βWriting a Custom AdapterβAny program that can open a WebSocket connection can become an Antimatter adapter. Hereβs the minimum viable implementation:
Protocol & IPC Authentication
Section titled βProtocol & IPC AuthenticationβTo prevent rogue local processes from connecting to the Gateway, all adapters must authenticate using a secure IPC token generated by the Gateway.
- Read the IPC Token from
~/.antimatter_daemon/.ipc_token - Connect to
ws://127.0.0.1:8765 - Register immediately after connection, passing the token:
{ "type": "REGISTER_ADAPTER", "name": "my-agent", "ipc_token": "<token_string>" }
- 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
Section titled βExample β Go Adapterβpackage main
import ( "encoding/json" "github.com/gorilla/websocket" "log" "os" "path/filepath" "strings")
func main() { // 1. Read the IPC token homeDir, _ := os.UserHomeDir() tokenPath := filepath.Join(homeDir, ".antimatter_daemon", ".ipc_token") tokenBytes, err := os.ReadFile(tokenPath) if err != nil { log.Fatalf("Failed to read IPC token: %v", err) } ipcToken := strings.TrimSpace(string(tokenBytes))
// 2. Connect to the Gateway conn, _, err := websocket.DefaultDialer.Dial("ws://127.0.0.1:8765", nil) if err != nil { log.Fatal(err) } defer conn.Close()
// 3. Register with the token conn.WriteJSON(map[string]string{ "type": "REGISTER_ADAPTER", "name": "my-go-agent", "ipc_token": ipcToken, })
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.
