This runbook documents day-2 operations for the agent-owned OpenClaw architecture:
- Agent owns OpenClaw WebSocket sessions and reconnect/backoff behavior.
- Desktop talks to the local agent API (loopback + bearer token), not directly to gateway WS in production mode.
- OpenClaw secrets are stored by the agent in secure storage (keyring where available, memory-only fallback when unavailable).
- Agent runtime:
apps/agent/src-tauri/ - Agent local API:
GET /api/v1/agent/healthGET|PUT /api/v1/agent/settingsPOST /api/v1/agent/policy-checkGET|POST|PATCH|DELETE /api/v1/openclaw/gatewaysPOST /api/v1/openclaw/gateways/:id/connectPOST /api/v1/openclaw/gateways/:id/disconnectPOST /api/v1/openclaw/discoverPOST /api/v1/openclaw/probePOST /api/v1/openclaw/requestGET /api/v1/openclaw/events(SSE)POST /api/v1/openclaw/import-desktop-gateways
- Agent OpenClaw runtime modules:
apps/agent/src-tauri/src/openclaw/manager.rsapps/agent/src-tauri/src/openclaw/protocol.rsapps/agent/src-tauri/src/openclaw/secret_store.rs
- Local auth token file:
~/.config/clawdstrike/agent-local-token
POST /api/v1/openclaw/request is policy-gated through the same local enforcement path as /api/v1/agent/policy-check (fail-closed when hushd is unreachable and enforcement is enabled).
- Start Clawdstrike Agent.
- Ensure
hushdis available and healthy. - Ensure
openclawCLI is installed if using discovery/probe or local gateway smoke scenarios. - Install
jqandcurlfor runbook commands and smoke automation.
CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/clawdstrike"
AGENT_PORT="$(jq -r '.agent_api_port // 9878' "${CONFIG_DIR}/agent.json" 2>/dev/null || echo 9878)"
AGENT_TOKEN="$(tr -d '[:space:]' < "${CONFIG_DIR}/agent-local-token")"
API_BASE="http://127.0.0.1:${AGENT_PORT}"
curl -fsS "${API_BASE}/api/v1/agent/health" | jq .
curl -fsS -H "Authorization: Bearer ${AGENT_TOKEN}" "${API_BASE}/api/v1/openclaw/gateways" | jq .Expected:
daemon.stateisrunningorstarting.- Gateway runtime statuses eventually settle to
connectedordisconnected, not stuck inconnectingindefinitely.
When enforcement is disabled, policy checks should return deterministic bypass metadata.
curl -fsS -X PUT \
-H "Authorization: Bearer ${AGENT_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"enabled":false}' \
"${API_BASE}/api/v1/agent/settings" >/dev/null
curl -fsS -X POST \
-H "Authorization: Bearer ${AGENT_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"action_type":"exec","target":"echo smoke"}' \
"${API_BASE}/api/v1/agent/policy-check" | jq .Expected response:
allowed: trueguard: "enforcement_disabled"
Restore enforcement:
curl -fsS -X PUT \
-H "Authorization: Bearer ${AGENT_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"enabled":true}' \
"${API_BASE}/api/v1/agent/settings" >/dev/nullUse the repository smoke script for consistent validation:
scripts/openclaw-agent-smoke.sh --gateway-url ws://127.0.0.1:18789 --gateway-token dev-tokenTo include gateway restart/reconnect validation managed by the script:
scripts/openclaw-agent-smoke.sh \
--start-local-gateway \
--gateway-url ws://127.0.0.1:18789 \
--gateway-token dev-tokenThe script validates:
- Agent health endpoint reachability.
- Enforcement-disabled policy bypass semantics.
- Gateway config import/connect via agent API.
- Request relay (
node.list) through agent-owned session. - Optional reconnect-after-restart check when local gateway is started by the script.
- Confirm token file exists:
~/.config/clawdstrike/agent-local-token - Ensure token has no trailing whitespace in client code.
- Confirm API bound port from
~/.config/clawdstrike/agent.json.
- Verify gateway URL and token using OpenClaw CLI:
openclaw gateway probe --json
- Inspect agent logs for connect/reconnect errors.
- Confirm origin/auth/connect payload compatibility if using non-default gateway builds.
- Confirm desktop is in agent-backed mode (production default).
- In dev, disable direct fallback unless intentionally testing:
- unset
VITE_OPENCLAW_DIRECT_MODE - unset
SDR_OPENCLAW_DIRECT_MODE
- unset
- Confirm SSE stream health by checking repeated
openclaw/eventsreconnects in logs.
- Agent falls back to memory-only secrets and logs a warning.
- In that mode, restart loses stored gateway secrets by design.
- Remediate by enabling OS keyring backend support for the runtime environment.
- Agent version and OS version.
GET /api/v1/agent/healthoutput.- Gateway list snapshot from
GET /api/v1/openclaw/gateways. - Relevant logs covering:
- daemon lifecycle transitions
- OpenClaw connect/disconnect/reconnect events
- local API auth failures
- Whether keyring or memory fallback secret mode is active.