Skip to content

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.


β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 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:

  1. Connects to ws://127.0.0.1:8765 on startup.
  2. Sends REGISTER_ADAPTER with its name.
  3. Listens for forwarded messages from the Gateway.
  4. Interacts with its AI agent and sends STEP events back.

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 .vsix from GitHub Releases β†’ Install in VS Code

When the extension activates, it:

  1. Instantiates a GatewayClient that connects to ws://127.0.0.1:8765.
  2. Registers as "name": "ag".
  3. Watches the local transcript.jsonl file for new trajectory steps.
  4. Streams each new step to the Gateway as a STEP message.
  5. Listens for SEND_MESSAGE payloads and translates them into vscode.commands.executeCommand calls to inject prompts into the active agent.
Terminal window
cd adapters/ag/
npm install
npm run watch # Start esbuild watcher
# Press F5 in VS Code to launch Extension Development Host
npm run lint # TypeScript type-check
npm run build # Production build
npm run package # Package .vsix

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-ag2
    antimatter-ag2 start

This lightweight Python daemon:

  1. Monitors .system_generated/logs/transcript.jsonl for agent activity.
  2. Acts as an IPC bridge β€” passes prompts from the mobile app into the local Antigravity 2.0 SDK subprocess.
  3. Exposes an agent Skill allowing natural language control (e.g., β€œStart my Antimatter bridge”).
Terminal window
cd adapters/ag2/
uv sync # Install dependencies
uv run antimatter-ag2 # Run in dev mode

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-cc
    antimatter-cc start

This adapter uses the official Claude Agent SDK to:

  1. Stream all events and logs from a running Claude Code session.
  2. Convert each event (tool call, text, thinking) to a STEP message forwarded to the Gateway.
  3. On SEND_MESSAGE from the mobile app, inject the prompt directly into the running Claude session.
Terminal window
cd adapters/cc/
npm install
npm run dev # Start in watch mode

Any program that can open a WebSocket connection can become an Antimatter adapter. Here’s the minimum viable implementation:

To prevent rogue local processes from connecting to the Gateway, all adapters must authenticate using a secure IPC token generated by the Gateway.

  1. Read the IPC Token from ~/.antimatter_daemon/.ipc_token
  2. Connect to ws://127.0.0.1:8765
  3. Register immediately after connection, passing the token:
    { "type": "REGISTER_ADAPTER", "name": "my-agent", "ipc_token": "<token_string>" }
  4. Listen for forwarded messages:
    { "type": "SEND_MESSAGE", "content": "..." }
    { "type": "GET_FILES", "path": "/" }
    { "type": "READ_FILE", "path": "/some/file.py" }
  5. Reply with appropriate response messages:
    { "type": "STEP", "stepType": "text", "content": "..." }
    { "type": "FILE_TREE", "entries": [...] }
    { "type": "FILE_CONTENT", "content": "..." }
minimal_adapter.go
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.


Saif Mukhtar

Saif Mukhtar

Creator & Lead Developer of Antimatter Β· Android, iOS & Python engineer