Gateway Runtime Manual

Last updated: 2025-12-09

What It Is

How to Run (Local)

 

Remote Access

Multiple Gateways (Same Host)

Usually not needed: one Gateway can serve multiple message channels and agents. Use multiple Gateways only when you need redundancy or strict isolation (e.g., rescue bot). Supported if you isolate state + configuration and use unique ports. Full guide: Multiple Gateways. Service names are profile-aware:

Installation metadata is embedded in service configuration:

Rescue bot mode: Keep a second Gateway isolated with its own profile, state directory, workspace, and base port offset. Full guide: Rescue Bot Guide.

Dev Profile (--dev)

Quick path: Run completely isolated dev instance (config/state/workspace) without touching your main setup.

Defaults (overridable via env/flags/config):

Derived ports (rule of thumb):

Per-instance checklist:

Install services by profile:

Example:

Protocol (Operations View)

Methods (Initial Set)

See also: Presence for how presence is generated/deduplicated and why stable client.instanceId is important.

Events

WebChat Integration

Types and Validation

Connection Snapshot

Error Codes (res.error shape)

Keepalive Behavior

Replay / Gaps

Events are not replayed. Clients detect seq gaps and should refresh (health + system-presence) before continuing. WebChat and macOS clients now auto-refresh on gaps.

Supervision (macOS Example)

Gateway Service Management (CLI)

Use Gateway CLI for install/start/stop/restart/status:

Notes:

Bundled mac app:

Supervision (systemd user units)

OpenClaw defaults to systemd user services on Linux/WSL2. We recommend user services for single-user machines (simpler env, per-user config). For multi-user or always-on servers use system services (no lingering needed, shared supervision). openclaw gateway install writes user unit. openclaw doctor audits unit and can update it to match current recommended defaults. Creates ~/.config/systemd/user/openclaw-gateway[-<profile>].service:

Enable lingering (required for user services to survive logout/idle):

Onboarding runs this on Linux/WSL2 (may prompt for sudo; writes /var/lib/systemd/linger). Then enable service:

Alternative (system service) - For always-on or multi-user servers, you can install systemd system unit instead of user unit (no lingering needed). Create /etc/systemd/system/openclaw-gateway[-<profile>].service (copy unit above, switch WantedBy=multi-user.target, set User= + WorkingDirectory=), then:

Windows (WSL2)

Windows installations should use WSL2 and follow the Linux systemd section above.

Operations Checks

Security Guarantees

CLI Helpers

Migration Guide

For more Gateway content, refer to: Gateway Runtime Manual - OpenClaw