Remote coding agents (ACP)

Supervise and steer coding agents (Antigravity, Claude Code, Codex, Gemini CLI) on your devbox from a browser or IDE over Agent Mesh with zero inbound ports, pairing codes, cross-mesh MCP tool injection, and disconnect-safe SSE replay.

Run your coding agent where your code, toolchain, and git credentials live—your Linux workstation, remote VM, or build server—and steer it securely from a browser tab, phone, VS Code, or Zed over an Agent Mesh without opening inbound firewall ports, exposing SSH, or trusting a cloud proxy with plaintext code.

Source for the live walkthrough: development/examples/remote-coding-acp/ and the browser client in sdk/js/examples/browser-acp/.


Architecture

Agent Mesh keeps the core mesh transport thin and protocol-agnostic (SERVICE_TYPE_ACP, raw /mesh/acp/1.0.0 stdio pass-through plus private /libp2p-http transport), while agentmesh-node hosts an isolated in-process ACP supervisor (acp://<name>) that owns coding-agent subprocesses, SQLite WAL event history (acp.db), held permission prompts, and local LLM gateway session scoping:

flowchart LR
  subgraph Client["Laptop or Phone (zero inbound ports)"]
    Browser["Browser Tab (@agentmesh-p2p/sdk)<br/>IndexedDB Biscuit + session.fetch()"]
    IDE["VS Code / Zed / acp-ui<br/>agentmesh-node acp attach"]
  end

  subgraph Relay["Relay & Control Plane (agentmesh-one)"]
    One["agentmesh-one --tunnel cloudflare<br/>WSS Relay (Noise E2E encrypted)"]
  end

  subgraph Devbox["Devbox (agentmesh-node)"]
    Sup["ACP Supervisor (acp://devbox)<br/>• Pinned allowed_roots<br/>• Peer-bound pair codes<br/>• SQLite WAL (acp.db) + SSE replay"]
    GW["Local LLM Gateway & /mcp<br/>Ephemeral session tokens"]
    Agent["Coding Agent Subprocess<br/>agy / claude / codex / gemini"]
  end

  subgraph Ops["Private Ops Node (agentmesh-node)"]
    MCP["mcp://ops-telemetry<br/>Loopback-only MCP server"]
  end

  Browser -- "WSS + Noise + Biscuit<br/>POST/GET /acp (JSON-RPC + SSE)" --> One
  IDE -- "Noise + Biscuit" --> One
  One --> Sup
  Sup -- "stdin/stdout ACP" --> Agent
  Agent -- "LLM + injected /mcp" --> GW
  GW -- "Noise + Biscuit" --> MCP

Key properties:

  • Private to the mesh: ACP services explicitly forbid external router HTTP ingress (ExternalIngressAllowed() == false). Only authenticated mesh peers with valid Biscuit credentials can dial acp://<name> over Noise-encrypted libp2p streams.
  • Disconnect-safe supervision: Agent processes stay alive inside agentmesh-node even when a phone locks or a browser tab reloads. Every session/update and session/request_permission event is persisted to acp.db and replayed via GET /acp?sessionId=<id>&afterSeq=<n> (or Last-Event-ID).
  • Held permission approvals: When an agent asks to edit a file or execute a command (session/request_permission), the supervisor holds the JSON-RPC request open until an authorized peer resolves it, optionally firing a content-free wake-up ping to ntfy or a webhook.
  • Automatic MCP & gateway integration: For agents that advertise HTTP MCP capabilities (such as Antigravity agy acp --process-per-session), agentmesh-node automatically injects its local /mcp endpoint with a per-session capability token so the coding agent can invoke private remote MCP tools across the mesh when acp.allow_remote_mcp_tools: true is enabled.

Quick start with agentmesh-one --tunnel cloudflare

1. Start a private mesh with a Cloudflare Quick Tunnel

No DNS, TLS certificates, or inbound firewall rules are needed. Cloudflare carries Noise-encrypted libp2p WebSocket frames and never sees prompts, tool outputs, or code:

agentmesh-one \
  --data-dir ./one-data \
  --tunnel cloudflare \
  --tunnel-install \
  --policy-file development/examples/remote-coding-acp/policy.json

Save the printed Join Token into a 0600 file (never pass tokens as CLI flag values):

umask 077
printf '%s\n' "<JOIN_TOKEN>" > ./join-token

2. Configure and start agentmesh-node on your devbox

Create node-devbox.yaml pinning the allowed repository directory and requiring a single-use pairing code:

version: "v1alpha1"

gateway:
  enabled: true
  mode: both
  preference: mesh-first
  providers:
    - name: gemini
      protocol: gemini
      trust_zone: public
      base_url: "https://generativelanguage.googleapis.com"
      api_key_env: GEMINI_API_KEY
      models: ["gemini-3.1-pro-preview"]

acp:
  enabled: true
  service_name: devbox
  allowed_roots:
    - "/path/to/your/repo"
  # For OIDC-enrolled meshes, omit allowed_principals to bind strictly to your
  # own attested email. For bootstrap-enrolled agentmesh-one meshes without
  # OIDC, list exact peer IDs ("node:<peer-id>") or combine
  # "mesh:system:authenticated" with require_pair_code: true.
  allowed_principals:
    - "mesh:system:authenticated"
  require_pair_code: true
  allow_remote_mcp_tools: true
  auto_detect_agents: true

Start the devbox daemon:

export GEMINI_API_KEY="your-key"
agentmesh-node run \
  --control-plane https://<random>.trycloudflare.com \
  --bootstrap-token-path ./join-token \
  --config ./node-devbox.yaml \
  --data-dir ./devbox-data

Verify the supervisor and detected coding agents (agy, claude, codex, gemini):

agentmesh-node acp status --data-dir ./devbox-data

You can also expose any directory ad-hoc on an already running daemon without editing YAML:

agentmesh-node acp serve --dir . --agent agy --require-pair-code

3. Mint a single-use pairing code

When require_pair_code: true is enabled, any un-paired peer receives 403 Forbidden: pair_code is required. Mint a short-lived code on the devbox:

agentmesh-node pair --data-dir ./devbox-data

The first remote peer to present that code in the X-AgentMesh-Pair-Code header spends the code and receives a peer-bound pairing grant persisted in acp.db.

4. Connect from a browser tab (zero local daemon)

Bundle and serve the Browser ACP client in sdk/js/examples/browser-acp/:

cd sdk/js
npm run build
node scripts/bundle-browser.mjs examples/browser-acp/app.js /tmp/browser-acp --no-sourcemap
python3 -m http.server 8095 --bind 127.0.0.1 --directory /tmp/browser-acp

Open http://127.0.0.1:8095 in Chrome, Safari, or Firefox (or serve it over HTTPS for a phone):

  1. Enter your https://<random>.trycloudflare.com URL and Join Token, then click 1. Join Mesh. The browser enrolls via @agentmesh-p2p/sdk and saves its Biscuit credential in IndexedDB.
  2. Enter your Devbox Peer ID and single-use Pair Code, then click 2. Connect ACP.
  3. Click + New Session, send a prompt to Antigravity, reload the tab while a permission prompt is held, and verify the browser resumes the same PeerID and replays the session from acp.db.

Connecting from VS Code, Zed, or acp-ui

Any desktop ACP client that spawns an ACP stdio command can attach to your remote devbox through a local agentmesh-node joined to the same mesh:

agentmesh-node acp attach <devbox-peer-id>/devbox \
  --agent agy \
  --cwd /path/to/your/repo \
  --pair-code-path ./pair-code

For example, in VS Code with the ACP Client extension (formulahendry.vscode-acp):

{
  "acp.agents": [
    {
      "name": "Devbox Antigravity (Agent Mesh)",
      "command": "agentmesh-node",
      "args": [
        "acp",
        "attach",
        "<devbox-peer-id>/devbox",
        "--agent",
        "agy",
        "--cwd",
        "/path/to/your/repo"
      ]
    }
  ]
}

Supported coding agents

agentmesh-node auto-detects these ACP agents on PATH and lets you add or override any ACP-compatible command under acp.agents::

IDAgentBinary probed on PATHDefault args
agyAntigravityagyacp --process-per-session
claudeClaude Codeclaude-agent-acp (fallback claude-code-acp)(none)
codexCodexcodex-acp(none)
geminiGemini CLIgemini--acp

Security defaults

ControlDefault behavior
Workspace scopeDeny by default. acp.allowed_roots must be set; roots are canonicalized and pinned at startup to block symlink escapes and path traversal.
Caller identitySame-owner binding on OIDC-enrolled hosts (matches attested email). Fail closed on bootstrap-enrolled nodes unless acp.allowed_principals is explicitly configured.
Pairing codesSent exclusively in the X-AgentMesh-Pair-Code header (never URL query parameters), verified in constant time, single-use, and bound to the redeeming PeerID.
External ingressAlways refused (ExternalIngressAllowed() == false); ACP is strictly mesh-internal.
Push notificationsOptional ntfy_url / webhook_url payloads are strictly content-free wake-ups (service name, session ID, opaque permission ID—no code, prompts, or diffs).

Run the full example locally

The complete 5-act demo—including ops-box (mcp://ops-telemetry), devbox (acp://devbox + Antigravity), and the Browser ACP client—lives in development/examples/remote-coding-acp/:

export GEMINI_API_KEY="your-key"
make -C development/examples/remote-coding-acp run