> For the complete documentation index, see [llms.txt](https://www.openclawbook.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.openclawbook.xyz/en/ch27-node-system/27.1-node-concepts.md). Agents can also search and read this documentation through its [MCP server](https://www.openclawbook.xyz/~gitbook/mcp).

# 27.1 Node Concepts

> **Generated by**: Claude Opus 4.6 (initial draft) / Claude Opus 5 (`v2026.3.9` revision) **Token usage**: Input \~250k tokens, Output \~6k tokens (this section) **Source baseline**: `v2026.3.9` (`v2026.3.8-170-g665f67726`)

***

A computer running OpenClaw Gateway has limited capabilities—it can execute Shell commands, read and write files, and control browsers, but it **cannot see a phone's camera**, **cannot push system notifications to an iPad**, and **cannot invoke a remote server's GPU cluster**. OpenClaw's Node System solves this problem: it allows an Agent to **invoke capabilities across devices** as naturally as if executing them locally.

This section introduces the core concepts of the Node System: what a node is, what roles nodes play, and how node commands are organized into namespaces and categories.

***

## 27.1.1 What is a Node: Remote Exposure of Device Capabilities

### Basic Concept

In OpenClaw terminology, a **Node** is a remote device or process connected to the Gateway via WebSocket. A node's core responsibility is to **expose** its hardware and software capabilities to the Gateway, allowing an Agent to use these capabilities remotely just as it would call local tools.

> **Sidebar: Capability Exposure**
>
> "Capability exposure" is a common pattern in distributed systems. Similar to how operating systems use device drivers to abstract hardware capabilities as file operations (Unix's "everything is a file" philosophy), the Node System abstracts remote device capabilities as **command invocations**. When an Agent issues a `camera.snap` command, it doesn't need to know which device the camera is connected to—the Gateway automatically routes it to the node that owns the camera.

### Node Data Model

Each node connected to the Gateway is described by the `NodeSession` type:

```typescript
// src/gateway/node-registry.ts

export type NodeSession = {
  nodeId: string;          // Unique node identifier (device ID or client ID)
  connId: string;          // Current WebSocket connection ID
  client: GatewayWsClient; // WebSocket client instance
  displayName?: string;    // Human-readable name, e.g., "MacBook Pro"
  platform?: string;       // OS identifier, e.g., "ios", "darwin", "android"
  version?: string;        // Client version number
  coreVersion?: string;    // OpenClaw core version
  uiVersion?: string;      // UI version (native clients only)
  deviceFamily?: string;   // Device family, e.g., "iPhone", "iPad"
  modelIdentifier?: string;// Device model, e.g., "iPhone15,2"
  remoteIp?: string;       // Remote IP address
  caps: string[];          // Capability list, e.g., ["system", "browser"]
  commands: string[];      // List of declared supported commands
  permissions?: Record<string, boolean>;  // Permission status
  pathEnv?: string;        // PATH environment variable
  connectedAtMs: number;   // Connection timestamp
};
```

This type reveals the Node System's design philosophy: **nodes are self-describing**. Upon connection, a node reports its identity (`nodeId`, `platform`), capabilities (`caps`, `commands`), and metadata (`version`, `deviceFamily`) to the Gateway, which then decides which commands can be sent to that node.

### Connection Architecture

The connection topology between nodes and the Gateway is a classic **star topology**:

```
┌──────────┐     WebSocket     ┌─────────────┐     WebSocket     ┌──────────┐
│  iPhone   │ ◄──────────────► │             │ ◄──────────────► │  Linux   │
│  (Node)   │                  │   Gateway   │                  │  Server  │
└──────────┘                   │  (Center)   │                  │  (Node)  │
                               │             │                  └──────────┘
┌──────────┐     WebSocket     │             │
│  macOS   │ ◄──────────────► │             │
│  (Node)   │                  └─────────────┘
└──────────┘                         ▲
                                     │ WebSocket
                               ┌─────────────┐
                               │  Android    │
                               │  (Node)     │
                               └─────────────┘
```

All nodes connect to the same Gateway, forming a centralized management model. This architecture offers several advantages:

| Feature                     | Description                                                                    |
| --------------------------- | ------------------------------------------------------------------------------ |
| **Unified Routing**         | Gateway knows all online nodes and can select the most appropriate target      |
| **Centralized Permissions** | Command allowlists are configured and checked uniformly on the Gateway side    |
| **State Awareness**         | Gateway is aware in real-time of which nodes are online and their capabilities |
| **Simplified Nodes**        | Nodes only need to implement "receive command and return result" logic         |

***

## 27.1.2 Node Roles: macOS / iOS / Android / Headless

### Platforms and Roles

Not all nodes provide the same capabilities. An iPhone has a camera but no Shell environment; a Linux server can execute arbitrary commands but has no GUI. OpenClaw distinguishes different node roles through **platform identifiers** and presets allowed command sets for each platform.

Platform identification is performed by the `normalizePlatformId` function:

```typescript
// src/gateway/node-command-policy.ts

function normalizePlatformId(platform?: string, deviceFamily?: string): string {
  const raw = (platform ?? "").trim().toLowerCase();
  if (raw.startsWith("ios"))     return "ios";
  if (raw.startsWith("android")) return "android";
  if (raw.startsWith("mac") || raw.startsWith("darwin")) return "macos";
  if (raw.startsWith("win"))     return "windows";
  if (raw.startsWith("linux"))   return "linux";
  // Fallback: infer from deviceFamily
  const family = (deviceFamily ?? "").trim().toLowerCase();
  if (family.includes("iphone") || family.includes("ipad")) return "ios";
  if (family.includes("android")) return "android";
  // ... more fallback logic
  return "unknown";
}
```

This function employs a **two-level fallback strategy**: first check the `platform` string prefix, and if unrecognized, infer from `deviceFamily`. This ensures correct classification even if a node reports a non-standard platform string.

### Four Typical Roles

Based on platform and purpose, nodes typically fall into four categories:

| Role                | Platform      | Typical Capabilities                            | Use Case                               |
| ------------------- | ------------- | ----------------------------------------------- | -------------------------------------- |
| **macOS Desktop**   | darwin        | Shell execution, browser proxy, Canvas, camera  | Primary development and execution node |
| **iOS Mobile**      | ios           | Canvas, camera, screen recording, location      | Mobile interaction, photo recognition  |
| **Android Mobile**  | android       | Canvas, camera, screen recording, location, SMS | Same as iOS, plus SMS support          |
| **Headless Server** | linux/windows | Shell execution, browser proxy                  | Remote computation, CI/CD              |

The **default command allowlist** for each role is hardcoded in `PLATFORM_DEFAULTS`:

```typescript
// src/gateway/node-command-policy.ts

const PLATFORM_DEFAULTS: Record<string, string[]> = {
  ios:     [...CANVAS_COMMANDS, ...CAMERA_COMMANDS, ...SCREEN_COMMANDS, ...LOCATION_COMMANDS],
  android: [...CANVAS_COMMANDS, ...CAMERA_COMMANDS, ...SCREEN_COMMANDS,
            ...LOCATION_COMMANDS, ...SMS_COMMANDS],
  macos:   [...CANVAS_COMMANDS, ...CAMERA_COMMANDS, ...SCREEN_COMMANDS,
            ...LOCATION_COMMANDS, ...SYSTEM_COMMANDS],
  linux:   [...SYSTEM_COMMANDS],
  windows: [...SYSTEM_COMMANDS],
  unknown: [/* union of all command types—conservatively allow everything */],
};
```

Note that the `unknown` platform is granted the **most permissive permissions**—the union of all command types. This seems counterintuitive, but it ensures that functionality for unrecognized device types isn't accidentally blocked. Actual security control relies on the node's `commands` declaration and configuration-level `allowCommands` / `denyCommands`.

### Mobile Node Detection

The Gateway sometimes needs to know if a mobile device is online (for example, to decide whether to offer a photo tool). This is implemented by a concise helper function:

```typescript
// src/gateway/server-mobile-nodes.ts

const isMobilePlatform = (platform: unknown): boolean => {
  const p = typeof platform === "string" ? platform.trim().toLowerCase() : "";
  return p.startsWith("ios") || p.startsWith("ipados") || p.startsWith("android");
};

export function hasConnectedMobileNode(registry: NodeRegistry): boolean {
  return registry.listConnected().some((n) => isMobilePlatform(n.platform));
}
```

***

## 27.1.3 Node Commands: Namespaces and Categories

### Command Naming Namespace

Node commands use **dot-separated namespace** organization, similar to Java packages or DNS domain names. Each namespace corresponds to a class of device capabilities:

| Namespace    | Commands                                                                                                                                               | Description                 |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------- |
| `canvas.*`   | `canvas.present`, `canvas.hide`, `canvas.navigate`, `canvas.eval`, `canvas.snapshot`, `canvas.a2ui.push`, `canvas.a2ui.pushJSONL`, `canvas.a2ui.reset` | Visual workspace operations |
| `camera.*`   | `camera.list`, `camera.snap`, `camera.clip`                                                                                                            | Camera control              |
| `screen.*`   | `screen.record`                                                                                                                                        | Screen recording            |
| `location.*` | `location.get`                                                                                                                                         | Geolocation                 |
| `sms.*`      | `sms.send`                                                                                                                                             | SMS sending (Android only)  |
| `system.*`   | `system.run`, `system.which`, `system.notify`, `system.execApprovals.get`, `system.execApprovals.set`                                                  | System command execution    |
| `browser.*`  | `browser.proxy`                                                                                                                                        | Browser proxy               |

This naming convention makes permission control very flexible—you can authorize entire namespaces (e.g., allow all `canvas.*`) or be precise down to individual commands.

### Three-Layer Command Control

For a command to be successfully executed, it must pass three layers of checks:

```
 ┌──────────────────────────────────────────────────┐
 │  Layer 1: Platform default allowlist (PLATFORM_DEFAULTS)  │
 │  + Configuration additions (allowCommands)       │
 │  - Configuration removals (denyCommands)         │
 │  → Produces allowlist                            │
 ├──────────────────────────────────────────────────┤
 │  Layer 2: Node's own declaration (commands array)│
 │  → Node must declare support for the command     │
 ├──────────────────────────────────────────────────┤
 │  Layer 3: Gateway-side policy check              │
 │  → isNodeCommandAllowed() makes final decision   │
 └──────────────────────────────────────────────────┘
```

This design implements **bidirectional constraints**:

1. **Gateway-side constraint**: Even if a node claims to support a command, if the Gateway configuration doesn't allow it, the command cannot execute.
2. **Node-side constraint**: Even if the Gateway allows a command, if the node hasn't declared support, it will be rejected.

The specific implementation is in the `isNodeCommandAllowed` function:

```typescript
// src/gateway/node-command-policy.ts

export function isNodeCommandAllowed(params: {
  command: string;
  declaredCommands?: string[];
  allowlist: Set<string>;
}): { ok: true } | { ok: false; reason: string } {
  const command = params.command.trim();
  if (!command) {
    return { ok: false, reason: "command required" };
  }
  // Check 1: Is it in the allowlist?
  if (!params.allowlist.has(command)) {
    return { ok: false, reason: "command not allowlisted" };
  }
  // Check 2: Does the node declare support?
  if (Array.isArray(params.declaredCommands) && params.declaredCommands.length > 0) {
    if (!params.declaredCommands.includes(command)) {
      return { ok: false, reason: "command not declared by node" };
    }
  } else {
    return { ok: false, reason: "node did not declare commands" };
  }
  return { ok: true };
}
```

The `allowlist` is constructed by `resolveNodeCommandAllowlist`:

```typescript
// src/gateway/node-command-policy.ts

export function resolveNodeCommandAllowlist(
  cfg: OpenClawConfig,
  node?: Pick<NodeSession, "platform" | "deviceFamily">,
): Set<string> {
  const platformId = normalizePlatformId(node?.platform, node?.deviceFamily);
  const base = PLATFORM_DEFAULTS[platformId] ?? PLATFORM_DEFAULTS.unknown;
  const extra = cfg.gateway?.nodes?.allowCommands ?? [];        // Configuration additions
  const deny = new Set(cfg.gateway?.nodes?.denyCommands ?? []); // Configuration removals
  const allow = new Set([...base, ...extra]);
  for (const blocked of deny) {
    allow.delete(blocked.trim());
  }
  return allow;
}
```

> **Sidebar: Allowlist Pattern**
>
> In security, there are two basic strategies: blocklist (default allow, list prohibited items) and allowlist (default deny, list allowed items). The Node Command System uses an allowlist pattern—starting from the platform default set, then adding via `allowCommands` and removing via `denyCommands`, finally producing a precise allowlist. The allowlist approach is more conservative in security because omitting a rule only causes functionality to be unavailable (safe but inconvenient), not capability leakage (dangerous but convenient).

### Command Invocation Sequence

When an Agent needs to invoke a node command (e.g., `camera.snap`), the complete sequence is:

```
Agent                   Gateway                    Node (iPhone)
  │                        │                           │
  │  node.invoke           │                           │
  │  {nodeId, command:     │                           │
  │   "camera.snap",       │                           │
  │   params: {...}}       │                           │
  │───────────────────────►│                           │
  │                        │                           │
  │                        │  ① Check if node is online│
  │                        │  ② Check if command allowed│
  │                        │  (isNodeCommandAllowed)   │
  │                        │                           │
  │                        │  node.invoke.request      │
  │                        │  {id, command, paramsJSON}│
  │                        │──────────────────────────►│
  │                        │                           │
  │                        │                           │  Execute photo
  │                        │                           │
  │                        │  node.invoke.result       │
  │                        │  {id, ok: true,           │
  │                        │   payloadJSON: "..."}     │
  │                        │◄──────────────────────────│
  │                        │                           │
  │  {ok: true,            │                           │
  │   payload: {...}}      │                           │
  │◄───────────────────────│                           │
```

This sequence shows the Gateway's role as a **middleman**: it not only routes messages but also performs security checks before routing. The Node Host receives the request, executes the actual operation, and then returns the result via `node.invoke.result`.

***

## Section Summary

1. **Nodes are proxies for remote capabilities**—connected to the Gateway via WebSocket, exposing device hardware and software capabilities for Agent use.
2. **NodeSession is a node's runtime snapshot**—containing identity, platform information, capability list, and declared command set.
3. **Star topology simplifies management**—all nodes connect to the same Gateway, with routing, permissions, and state management centralized on the Gateway side.
4. **Platform determines default role**—iOS/Android focus on mobile-aware capabilities (camera, location), macOS/Linux focus on system execution capabilities (Shell, browser proxy).
5. **Three-layer command control ensures security**—platform default set + configuration adjustments → allowlist → node declaration bidirectional validation, with the allowlist pattern ensuring the principle of least privilege.
6. **Dot-separated namespaces organize commands**—`canvas.*`, `camera.*`, `system.*` etc. clearly partition capability domains, facilitating fine-grained permission management.
