coderClaw

Gateway-owned pairing (Option B)

In Gateway-owned pairing, the Gateway is the source of truth for which nodes are allowed to join. UIs (macOS app, future clients) are just frontends that approve or reject pending requests.

Important: WS nodes use device pairing (role node) during connect. node.pair.* is a separate pairing store and does not gate the WS handshake. Only clients that explicitly call node.pair.* use this flow.

Concepts

How pairing works

  1. A node connects to the Gateway WS and requests pairing.
  2. The Gateway stores a pending request and emits node.pair.requested.
  3. You approve or reject the request (CLI or UI).
  4. On approval, the Gateway issues a new token (tokens are rotated on re‑pair).
  5. The node reconnects using the token and is now “paired”.

Pending requests expire automatically after 5 minutes.

CLI workflow (headless friendly)

coderclaw nodes pending
coderclaw nodes approve <requestId>
coderclaw nodes reject <requestId>
coderclaw nodes status
coderclaw nodes rename --node <id|name|ip> --name "Living Room iPad"

nodes status shows paired/connected nodes and their capabilities.

API surface (gateway protocol)

Events:

Methods:

Notes:

Auto-approval (macOS app)

The macOS app can optionally attempt a silent approval when:

If silent approval fails, it falls back to the normal “Approve/Reject” prompt.

Storage (local, private)

Pairing state is stored under the Gateway state directory (default ~/.coderclaw):

If you override CODERCLAW_STATE_DIR, the nodes/ folder moves with it.

Security notes:

Transport behavior