diff --git a/.agents/skills/openclaw-test-heap-leaks/SKILL.md b/.agents/skills/openclaw-test-heap-leaks/SKILL.md new file mode 100644 index 00000000000..a2ab2878430 --- /dev/null +++ b/.agents/skills/openclaw-test-heap-leaks/SKILL.md @@ -0,0 +1,71 @@ +--- +name: openclaw-test-heap-leaks +description: Investigate `pnpm test` memory growth, Vitest worker OOMs, and suspicious RSS increases in OpenClaw using the `scripts/test-parallel.mjs` heap snapshot tooling. Use when Codex needs to reproduce test-lane memory growth, collect repeated `.heapsnapshot` files, compare snapshots from the same worker PID, distinguish transformed-module retention from real data leaks, and fix or reduce the impact by patching cleanup logic or isolating hotspot tests. +--- + +# OpenClaw Test Heap Leaks + +Use this skill for test-memory investigations. Do not guess from RSS alone when heap snapshots are available. + +## Workflow + +1. Reproduce the failing shape first. + - Match the real entrypoint if possible. For Linux CI-style unit failures, start with: + - `pnpm canvas:a2ui:bundle && OPENCLAW_TEST_MEMORY_TRACE=1 OPENCLAW_TEST_HEAPSNAPSHOT_INTERVAL_MS=60000 OPENCLAW_TEST_HEAPSNAPSHOT_DIR=.tmp/heapsnap OPENCLAW_TEST_WORKERS=2 OPENCLAW_TEST_MAX_OLD_SPACE_SIZE_MB=6144 pnpm test` + - Keep `OPENCLAW_TEST_MEMORY_TRACE=1` enabled so the wrapper prints per-file RSS summaries alongside the snapshots. + - If the report is about a specific shard or worker budget, preserve that shape. + +2. Wait for repeated snapshots before concluding anything. + - Take at least two intervals from the same lane. + - Compare snapshots from the same PID inside one lane directory such as `.tmp/heapsnap/unit-fast/`. + - Use `scripts/heapsnapshot-delta.mjs` to compare either two files directly or the earliest/latest pair per PID in one lane directory. + +3. Classify the growth before choosing a fix. + - If growth is dominated by Vite/Vitest transformed source strings, `Module`, `system / Context`, bytecode, descriptor arrays, or property maps, treat it as retained module graph growth in long-lived workers. + - If growth is dominated by app objects, caches, buffers, server handles, timers, mock state, sqlite state, or similar runtime objects, treat it as a likely cleanup or lifecycle leak. + +4. Fix the right layer. + - For retained transformed-module growth in shared workers: + - Move hotspot files out of `unit-fast` by updating `test/fixtures/test-parallel.behavior.json`. + - Prefer `singletonIsolated` for files that are safe alone but inflate shared worker heaps. + - If the file should already have been peeled out by timings but is absent from `test/fixtures/test-timings.unit.json`, call that out explicitly. Missing timings are a scheduling blind spot. + - For real leaks: + - Patch the implicated test or runtime cleanup path. + - Look for missing `afterEach`/`afterAll`, module-reset gaps, retained global state, unreleased DB handles, or listeners/timers that survive the file. + +5. Verify with the most direct proof. + - Re-run the targeted lane or file with heap snapshots enabled if the suite still finishes in reasonable time. + - If snapshot overhead pushes tests over Vitest timeouts, fall back to the same lane without snapshots and confirm the RSS trend or OOM is reduced. + - For wrapper-only changes, at minimum verify the expected lanes start and the snapshot files are written. + +## Heuristics + +- Do not call everything a leak. In this repo, large `unit-fast` growth can be a worker-lifetime problem rather than an application object leak. +- `scripts/test-parallel.mjs` and `scripts/test-parallel-memory.mjs` are the primary control points for wrapper diagnostics. +- The lane names printed by `[test-parallel] start ...` and `[test-parallel][mem] summary ...` tell you where to focus. +- When one or two files account for most of the delta and they are missing from timings, reducing impact by isolating them is usually the first pragmatic fix. +- When the same retained object families grow across multiple intervals in the same worker PID, trust the snapshots over intuition. + +## Snapshot Comparison + +- Direct comparison: + - `node .agents/skills/openclaw-test-heap-leaks/scripts/heapsnapshot-delta.mjs before.heapsnapshot after.heapsnapshot` +- Auto-select earliest/latest snapshots per PID within one lane: + - `node .agents/skills/openclaw-test-heap-leaks/scripts/heapsnapshot-delta.mjs --lane-dir .tmp/heapsnap/unit-fast` +- Useful flags: + - `--top 40` + - `--min-kb 32` + - `--pid 16133` + +Read the top positive deltas first. Large positive growth in module-transform artifacts suggests lane isolation; large positive growth in runtime objects suggests a real leak. + +## Output Expectations + +When using this skill, report: + +- The exact reproduce command. +- Which lane and PID were compared. +- The dominant retained object families from the snapshot delta. +- Whether the issue is a real leak or shared-worker retained module growth. +- The concrete fix or impact-reduction patch. +- What you verified, and what snapshot overhead prevented you from verifying. diff --git a/.agents/skills/openclaw-test-heap-leaks/agents/openai.yaml b/.agents/skills/openclaw-test-heap-leaks/agents/openai.yaml new file mode 100644 index 00000000000..b5157911b77 --- /dev/null +++ b/.agents/skills/openclaw-test-heap-leaks/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: "Test Heap Leaks" + short_description: "Investigate test OOMs with heap snapshots" + default_prompt: "Use $openclaw-test-heap-leaks to investigate test memory growth with heap snapshots and reduce its impact." diff --git a/.agents/skills/openclaw-test-heap-leaks/scripts/heapsnapshot-delta.mjs b/.agents/skills/openclaw-test-heap-leaks/scripts/heapsnapshot-delta.mjs new file mode 100644 index 00000000000..ccb705c4c82 --- /dev/null +++ b/.agents/skills/openclaw-test-heap-leaks/scripts/heapsnapshot-delta.mjs @@ -0,0 +1,265 @@ +#!/usr/bin/env node + +import fs from "node:fs"; +import path from "node:path"; + +function printUsage() { + console.error( + "Usage: node heapsnapshot-delta.mjs [--top N] [--min-kb N]", + ); + console.error( + " or: node heapsnapshot-delta.mjs --lane-dir [--pid PID] [--top N] [--min-kb N]", + ); +} + +function fail(message) { + console.error(message); + process.exit(1); +} + +function parseArgs(argv) { + const options = { + top: 30, + minKb: 64, + laneDir: null, + pid: null, + files: [], + }; + + for (let index = 0; index < argv.length; index += 1) { + const arg = argv[index]; + if (arg === "--top") { + options.top = Number.parseInt(argv[index + 1] ?? "", 10); + index += 1; + continue; + } + if (arg === "--min-kb") { + options.minKb = Number.parseInt(argv[index + 1] ?? "", 10); + index += 1; + continue; + } + if (arg === "--lane-dir") { + options.laneDir = argv[index + 1] ?? null; + index += 1; + continue; + } + if (arg === "--pid") { + options.pid = Number.parseInt(argv[index + 1] ?? "", 10); + index += 1; + continue; + } + options.files.push(arg); + } + + if (!Number.isFinite(options.top) || options.top <= 0) { + fail("--top must be a positive integer"); + } + if (!Number.isFinite(options.minKb) || options.minKb < 0) { + fail("--min-kb must be a non-negative integer"); + } + if (options.pid !== null && (!Number.isInteger(options.pid) || options.pid <= 0)) { + fail("--pid must be a positive integer"); + } + + return options; +} + +function parseHeapFilename(filePath) { + const base = path.basename(filePath); + const match = base.match( + /^Heap\.(?\d{8}\.\d{6})\.(?\d+)\.0\.(?\d+)\.heapsnapshot$/u, + ); + if (!match?.groups) { + return null; + } + return { + filePath, + pid: Number.parseInt(match.groups.pid, 10), + stamp: match.groups.stamp, + sequence: Number.parseInt(match.groups.seq, 10), + }; +} + +function resolvePair(options) { + if (options.laneDir) { + const entries = fs + .readdirSync(options.laneDir) + .map((name) => parseHeapFilename(path.join(options.laneDir, name))) + .filter((entry) => entry !== null) + .filter((entry) => options.pid === null || entry.pid === options.pid) + .toSorted((left, right) => { + if (left.pid !== right.pid) { + return left.pid - right.pid; + } + if (left.stamp !== right.stamp) { + return left.stamp.localeCompare(right.stamp); + } + return left.sequence - right.sequence; + }); + + if (entries.length === 0) { + fail(`No matching heap snapshots found in ${options.laneDir}`); + } + + const groups = new Map(); + for (const entry of entries) { + const group = groups.get(entry.pid) ?? []; + group.push(entry); + groups.set(entry.pid, group); + } + + const candidates = Array.from(groups.values()) + .map((group) => ({ + pid: group[0].pid, + before: group[0], + after: group.at(-1), + count: group.length, + })) + .filter((entry) => entry.count >= 2); + + if (candidates.length === 0) { + fail(`Need at least two snapshots for one PID in ${options.laneDir}`); + } + + const chosen = + options.pid !== null + ? (candidates.find((entry) => entry.pid === options.pid) ?? null) + : candidates.toSorted((left, right) => right.count - left.count || left.pid - right.pid)[0]; + + if (!chosen) { + fail(`No PID with at least two snapshots matched in ${options.laneDir}`); + } + + return { + before: chosen.before.filePath, + after: chosen.after.filePath, + pid: chosen.pid, + snapshotCount: chosen.count, + }; + } + + if (options.files.length !== 2) { + printUsage(); + process.exit(1); + } + + return { + before: options.files[0], + after: options.files[1], + pid: null, + snapshotCount: 2, + }; +} + +function loadSummary(filePath) { + const data = JSON.parse(fs.readFileSync(filePath, "utf8")); + const meta = data.snapshot?.meta; + if (!meta) { + fail(`Invalid heap snapshot: ${filePath}`); + } + + const nodeFieldCount = meta.node_fields.length; + const typeNames = meta.node_types[0]; + const strings = data.strings; + const typeIndex = meta.node_fields.indexOf("type"); + const nameIndex = meta.node_fields.indexOf("name"); + const selfSizeIndex = meta.node_fields.indexOf("self_size"); + + const summary = new Map(); + for (let offset = 0; offset < data.nodes.length; offset += nodeFieldCount) { + const type = typeNames[data.nodes[offset + typeIndex]]; + const name = strings[data.nodes[offset + nameIndex]]; + const selfSize = data.nodes[offset + selfSizeIndex]; + const key = `${type}\t${name}`; + const current = summary.get(key) ?? { + type, + name, + selfSize: 0, + count: 0, + }; + current.selfSize += selfSize; + current.count += 1; + summary.set(key, current); + } + return { + nodeCount: data.snapshot.node_count, + summary, + }; +} + +function formatBytes(bytes) { + if (Math.abs(bytes) >= 1024 ** 2) { + return `${(bytes / 1024 ** 2).toFixed(2)} MiB`; + } + if (Math.abs(bytes) >= 1024) { + return `${(bytes / 1024).toFixed(1)} KiB`; + } + return `${bytes} B`; +} + +function formatDelta(bytes) { + return `${bytes >= 0 ? "+" : "-"}${formatBytes(Math.abs(bytes))}`; +} + +function truncate(text, maxLength) { + return text.length <= maxLength ? text : `${text.slice(0, maxLength - 1)}…`; +} + +function main() { + const options = parseArgs(process.argv.slice(2)); + const pair = resolvePair(options); + const before = loadSummary(pair.before); + const after = loadSummary(pair.after); + const minBytes = options.minKb * 1024; + + const rows = []; + for (const [key, next] of after.summary) { + const previous = before.summary.get(key) ?? { selfSize: 0, count: 0 }; + const sizeDelta = next.selfSize - previous.selfSize; + const countDelta = next.count - previous.count; + if (sizeDelta < minBytes) { + continue; + } + rows.push({ + type: next.type, + name: next.name, + sizeDelta, + countDelta, + afterSize: next.selfSize, + afterCount: next.count, + }); + } + + rows.sort( + (left, right) => right.sizeDelta - left.sizeDelta || right.countDelta - left.countDelta, + ); + + console.log(`before: ${pair.before}`); + console.log(`after: ${pair.after}`); + if (pair.pid !== null) { + console.log(`pid: ${pair.pid} (${pair.snapshotCount} snapshots found)`); + } + console.log( + `nodes: ${before.nodeCount} -> ${after.nodeCount} (${after.nodeCount - before.nodeCount >= 0 ? "+" : ""}${after.nodeCount - before.nodeCount})`, + ); + console.log(`filter: top=${options.top} min=${options.minKb} KiB`); + console.log(""); + + if (rows.length === 0) { + console.log("No entries exceeded the minimum delta."); + return; + } + + for (const row of rows.slice(0, options.top)) { + console.log( + [ + formatDelta(row.sizeDelta).padStart(11), + `count ${row.countDelta >= 0 ? "+" : ""}${row.countDelta}`.padStart(10), + row.type.padEnd(16), + truncate(row.name || "(empty)", 96), + ].join(" "), + ); + } +} + +main(); diff --git a/.dockerignore b/.dockerignore index f24c490e9ad..c6cc1510bcf 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,7 @@ .git .worktrees -# Sensitive files – docker-setup.sh writes .env with OPENCLAW_GATEWAY_TOKEN +# Sensitive files – scripts/docker/setup.sh writes .env with OPENCLAW_GATEWAY_TOKEN # into the project root; keep it out of the build context. .env .env.* diff --git a/.github/labeler.yml b/.github/labeler.yml index 7dcc038de4c..4ee43d5e6fa 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -165,7 +165,10 @@ - "Dockerfile.*" - "docker-compose.yml" - "docker-setup.sh" + - "setup-podman.sh" - ".dockerignore" + - "scripts/docker/setup.sh" + - "scripts/podman/setup.sh" - "scripts/**/*docker*" - "scripts/**/Dockerfile*" - "scripts/sandbox-*.sh" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 96ab35a297e..8f87c816488 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -496,7 +496,9 @@ jobs: run: pnpm test - name: Verify npm pack under Node 22 - run: pnpm release:check + run: | + node scripts/stage-bundled-plugin-runtime-deps.mjs + node --import tsx scripts/release-check.ts skills-python: needs: [docs-scope, changed-scope] diff --git a/.github/workflows/install-smoke.yml b/.github/workflows/install-smoke.yml index a8115f1644a..8baa84ca67b 100644 --- a/.github/workflows/install-smoke.yml +++ b/.github/workflows/install-smoke.yml @@ -62,9 +62,9 @@ jobs: run: | docker run --rm --entrypoint sh openclaw-dockerfile-smoke:local -lc 'which openclaw && openclaw --version' - # This smoke validates that the build-arg path preinstalls selected - # extension deps and that matrix plugin discovery stays healthy in the - # final runtime image. + # This smoke validates that the build-arg path preinstalls the matrix + # runtime deps declared by the plugin and that matrix discovery stays + # healthy in the final runtime image. - name: Build extension Dockerfile smoke image uses: useblacksmith/build-push-action@v2 with: @@ -84,9 +84,17 @@ jobs: openclaw --version && node -e " const Module = require(\"node:module\"); + const matrixPackage = require(\"/app/extensions/matrix/package.json\"); const requireFromMatrix = Module.createRequire(\"/app/extensions/matrix/package.json\"); - requireFromMatrix.resolve(\"@vector-im/matrix-bot-sdk/package.json\"); - requireFromMatrix.resolve(\"@matrix-org/matrix-sdk-crypto-nodejs/package.json\"); + const runtimeDeps = Object.keys(matrixPackage.dependencies ?? {}); + if (runtimeDeps.length === 0) { + throw new Error( + \"matrix package has no declared runtime dependencies; smoke cannot validate install mirroring\", + ); + } + for (const dep of runtimeDeps) { + requireFromMatrix.resolve(dep); + } const { spawnSync } = require(\"node:child_process\"); const run = spawnSync(\"openclaw\", [\"plugins\", \"list\", \"--json\"], { encoding: \"utf8\" }); if (run.status !== 0) { diff --git a/AGENTS.md b/AGENTS.md index 488bc0678fd..e6c5b1a5e92 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -70,15 +70,18 @@ - Format check: `pnpm format` (oxfmt --check) - Format fix: `pnpm format:fix` (oxfmt --write) - Tests: `pnpm test` (vitest); coverage: `pnpm test:coverage` -- Hard gate: before any commit, `pnpm check` MUST be run and MUST pass for the change being committed. -- Hard gate: before any push to `main`, `pnpm check` MUST be run and MUST pass, and `pnpm test` MUST be run and MUST pass. +- For narrowly scoped changes, prefer narrowly scoped tests that directly validate the touched behavior. If no meaningful scoped test exists, say so explicitly and use the next most direct validation available. +- Preferred landing bar for pushes to `main`: `pnpm check` and `pnpm test`, with a green result when feasible. +- Scoped tests prove the change itself. `pnpm test` remains the default `main` landing bar; scoped tests do not replace full-suite gates by default. - Hard gate: if the change can affect build output, packaging, lazy-loading/module boundaries, or published surfaces, `pnpm build` MUST be run and MUST pass before pushing `main`. -- Hard gate: do not commit or push with failing format, lint, type, build, or required test checks. +- Default rule: do not commit or push with failing format, lint, type, build, or required test checks when those failures are caused by the change or plausibly related to the touched surface. +- For narrowly scoped changes, if unrelated failures already exist on latest `origin/main`, state that clearly, report the scoped tests you ran, and ask before broadening scope into unrelated fixes or landing despite those failures. +- Do not use scoped tests as permission to ignore plausibly related failures. ## Coding Style & Naming Conventions - Language: TypeScript (ESM). Prefer strict typing; avoid `any`. -- Formatting/linting via Oxlint and Oxfmt; run `pnpm check` before commits. +- Formatting/linting via Oxlint and Oxfmt. - Never add `@ts-nocheck` and do not disable `no-explicit-any`; fix root causes and update Oxlint/Oxfmt config only when required. - Dynamic import guardrail: do not mix `await import("x")` and static `import ... from "x"` for the same module in production code paths. If you need lazy loading, create a dedicated `*.runtime.ts` boundary (that re-exports from `x`) and dynamically import that boundary from lazy callers only. - Dynamic import verification: after refactors that touch lazy-loading/module boundaries, run `pnpm build` and check for `[INEFFECTIVE_DYNAMIC_IMPORT]` warnings before submitting. diff --git a/CHANGELOG.md b/CHANGELOG.md index c5a376f35bc..0cf9b671096 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -92,6 +92,7 @@ Docs: https://docs.openclaw.ai - Z.AI/onboarding: add `glm-5-turbo` to the default Z.AI provider catalog so onboarding-generated configs expose the new model alongside the existing GLM defaults. (#46670) Thanks @tomsun28. - Zalo Personal/group gating: stop reapplying `dmPolicy.allowFrom` as a sender gate for already-allowlisted groups when `groupAllowFrom` is unset, so any member of an allowed group can trigger replies while DMs stay restricted. (#46663) Fixes #40146. Thanks @Takhoffman. - Zalo/plugin runtime: export `resolveClientIp` from `openclaw/plugin-sdk/zalo` so installed builds no longer crash on startup when the webhook monitor loads from the packaged extension instead of the monorepo source tree. (#46549) Thanks @No898. +- Onboarding/custom providers: store Azure OpenAI and Azure AI Foundry custom endpoints with the Responses API config shape, normalized `/openai/v1` base URLs, and Azure-safe defaults so TUI and agent runs work after setup. (#49543) Thanks @kunalk16. - Docker/live tests: mount external CLI auth homes into writable container copies, derive Codex OAuth expiry from JWT `exp`, refresh synced CLI creds instead of trusting stale cached expiry, and make gateway live probes wait on transcript output so `pnpm test:docker:all` stays green in Linux. - Plugins/install precedence: keep bundled plugins ahead of auto-discovered globals by default, but let an explicitly installed plugin record win its own duplicate-id tie so installed channel plugins load from `~/.openclaw/extensions` after `openclaw plugins install`. (#46722) Thanks @Takhoffman. - Control UI/logging: make browser-safe logger imports avoid eager temp-dir resolution so the bundled Control UI no longer crashes to a blank screen when logging reaches `tmp-openclaw-dir`. (#48469) Fixes #48062. Thanks @7inspire. @@ -117,6 +118,7 @@ Docs: https://docs.openclaw.ai - Slack/startup: harden `@slack/bolt` import interop across current bundled runtime shapes so Slack monitors no longer crash with `App is not a constructor` after plugin-sdk bundling changes. (#45953) Thanks @merc1305. - Windows/gateway status: accept `schtasks` `Last Result` output as an alias for `Last Run Result`, so running scheduled-task installs no longer show `Runtime: unknown`. (#47844) Thanks @MoerAI. - ACP/acpx: resolve the bundled plugin root from the actual plugin directory so plugin-local installs stay under `dist/extensions/acpx` instead of escaping to `dist/extensions` and failing runtime setup. (#47601) Thanks @ngutman. +- Gateway/WS handshake: raise the default pre-auth handshake timeout to 10 seconds and add `OPENCLAW_HANDSHAKE_TIMEOUT_MS` as a runtime override so busy local gateways stop dropping healthy CLI connections at 3 seconds. (#49262) Thanks @fuller-stack-dev. - Gateway/websocket pairing bypass for disabled auth: skip device-pairing enforcement for Control UI operator sessions when `gateway.auth.mode=none`, so reverse-proxied dashboards no longer get stuck on `pairing required` despite auth being explicitly disabled. (#47148) Thanks @ademczuk. - Control UI/model switching: preserve the selected provider prefix when switching models from the chat dropdown, so multi-provider setups no longer send `anthropic/gpt-5.2`-style mismatches when the user picked `openai/gpt-5.2`. (#47581) Thanks @chrishham. - Control UI/storage: scope persisted settings keys by gateway base path, with migration from the legacy shared key, so multiple gateways under one domain stop overwriting each other's dashboard preferences. (#47932) Thanks @bobBot-claw. @@ -137,6 +139,7 @@ Docs: https://docs.openclaw.ai - Discord: enforce strict DM component allowlist auth (#49997) Thanks @joshavant. - Stabilize plugin loader and Docker extension smoke (#50058) Thanks @joshavant. - Telegram: stabilize pairing/session/forum routing and reply formatting tests (#50155) Thanks @joshavant. +- Hardening: refresh stale device pairing requests and pending metadata (#50695) Thanks @smaeljaish771 and @joshavant. ### Fixes @@ -161,6 +164,10 @@ Docs: https://docs.openclaw.ai - Matrix: make onboarding status runtime-safe (#49995) Thanks @joshavant. - Channels: stabilize lane harness and monitor tests (#50167) Thanks @joshavant. - WhatsApp/active-listener: pin the active listener registry to a `globalThis` singleton so split WhatsApp bundle chunks share one listener map and outbound sends stop missing the registered session. (#47433) Thanks @clawdia67. +- Plugins/WhatsApp: share split-load singleton state for plugin command registration and active WhatsApp listeners so duplicate module graphs no longer lose native plugin commands or outbound listener state. (#50418) Thanks @huntharo. +- Onboarding/custom providers: keep Azure AI Foundry `*.services.ai.azure.com` custom endpoints on the selected compatibility path instead of forcing Responses, so chat-completions Foundry models still work after setup. Fixes #50528. (#50535) Thanks @obviyus. +- Plugins/update: let `openclaw plugins update ` target tracked npm installs by dist-tag or exact version, and preserve the recorded npm spec for later id-based updates. (#49998) Thanks @huntharo. +- Tests/CLI: reduce command-secret gateway test import pressure while keeping the real protocol payload validator in place, so the isolated lane no longer carries the heavier runtime-web and message-channel graphs. (#50663) Thanks @huntharo. ### Breaking diff --git a/README.md b/README.md index e483bcc9446..b21b19108c4 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Model note: while many providers/models are supported, for the best experience a ## Install (recommended) -Runtime: **Node ≥22**. +Runtime: **Node 24 (recommended) or Node 22.16+**. ```bash npm install -g openclaw@latest @@ -62,7 +62,7 @@ OpenClaw Onboard installs the Gateway daemon (launchd/systemd user service) so i ## Quick start (TL;DR) -Runtime: **Node ≥22**. +Runtime: **Node 24 (recommended) or Node 22.16+**. Full beginner guide (auth, pairing, channels): [Getting started](https://docs.openclaw.ai/start/getting-started) diff --git a/apps/android/app/src/main/java/ai/openclaw/app/node/LocationHandler.kt b/apps/android/app/src/main/java/ai/openclaw/app/node/LocationHandler.kt index 014eead6669..e9f520e9a35 100644 --- a/apps/android/app/src/main/java/ai/openclaw/app/node/LocationHandler.kt +++ b/apps/android/app/src/main/java/ai/openclaw/app/node/LocationHandler.kt @@ -8,27 +8,85 @@ import androidx.core.content.ContextCompat import ai.openclaw.app.gateway.GatewaySession import kotlinx.coroutines.TimeoutCancellationException import kotlinx.serialization.json.Json -import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.JsonPrimitive -class LocationHandler( +internal interface LocationDataSource { + fun hasFinePermission(context: Context): Boolean + + fun hasCoarsePermission(context: Context): Boolean + + suspend fun fetchLocation( + desiredProviders: List, + maxAgeMs: Long?, + timeoutMs: Long, + isPrecise: Boolean, + ): LocationCaptureManager.Payload +} + +private class DefaultLocationDataSource( + private val capture: LocationCaptureManager, +) : LocationDataSource { + override fun hasFinePermission(context: Context): Boolean = + ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == + PackageManager.PERMISSION_GRANTED + + override fun hasCoarsePermission(context: Context): Boolean = + ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) == + PackageManager.PERMISSION_GRANTED + + override suspend fun fetchLocation( + desiredProviders: List, + maxAgeMs: Long?, + timeoutMs: Long, + isPrecise: Boolean, + ): LocationCaptureManager.Payload = + capture.getLocation( + desiredProviders = desiredProviders, + maxAgeMs = maxAgeMs, + timeoutMs = timeoutMs, + isPrecise = isPrecise, + ) +} + +class LocationHandler private constructor( private val appContext: Context, - private val location: LocationCaptureManager, + private val dataSource: LocationDataSource, private val json: Json, private val isForeground: () -> Boolean, private val locationPreciseEnabled: () -> Boolean, ) { - fun hasFineLocationPermission(): Boolean { - return ( - ContextCompat.checkSelfPermission(appContext, Manifest.permission.ACCESS_FINE_LOCATION) == - PackageManager.PERMISSION_GRANTED - ) - } + constructor( + appContext: Context, + location: LocationCaptureManager, + json: Json, + isForeground: () -> Boolean, + locationPreciseEnabled: () -> Boolean, + ) : this( + appContext = appContext, + dataSource = DefaultLocationDataSource(location), + json = json, + isForeground = isForeground, + locationPreciseEnabled = locationPreciseEnabled, + ) - fun hasCoarseLocationPermission(): Boolean { - return ( - ContextCompat.checkSelfPermission(appContext, Manifest.permission.ACCESS_COARSE_LOCATION) == - PackageManager.PERMISSION_GRANTED + fun hasFineLocationPermission(): Boolean = dataSource.hasFinePermission(appContext) + + fun hasCoarseLocationPermission(): Boolean = dataSource.hasCoarsePermission(appContext) + + companion object { + internal fun forTesting( + appContext: Context, + dataSource: LocationDataSource, + json: Json = Json { ignoreUnknownKeys = true }, + isForeground: () -> Boolean = { true }, + locationPreciseEnabled: () -> Boolean = { true }, + ): LocationHandler = + LocationHandler( + appContext = appContext, + dataSource = dataSource, + json = json, + isForeground = isForeground, + locationPreciseEnabled = locationPreciseEnabled, ) } @@ -39,7 +97,7 @@ class LocationHandler( message = "LOCATION_BACKGROUND_UNAVAILABLE: location requires OpenClaw to stay open", ) } - if (!hasFineLocationPermission() && !hasCoarseLocationPermission()) { + if (!dataSource.hasFinePermission(appContext) && !dataSource.hasCoarsePermission(appContext)) { return GatewaySession.InvokeResult.error( code = "LOCATION_PERMISSION_REQUIRED", message = "LOCATION_PERMISSION_REQUIRED: grant Location permission", @@ -49,9 +107,9 @@ class LocationHandler( val preciseEnabled = locationPreciseEnabled() val accuracy = when (desiredAccuracy) { - "precise" -> if (preciseEnabled && hasFineLocationPermission()) "precise" else "balanced" + "precise" -> if (preciseEnabled && dataSource.hasFinePermission(appContext)) "precise" else "balanced" "coarse" -> "coarse" - else -> if (preciseEnabled && hasFineLocationPermission()) "precise" else "balanced" + else -> if (preciseEnabled && dataSource.hasFinePermission(appContext)) "precise" else "balanced" } val providers = when (accuracy) { @@ -61,7 +119,7 @@ class LocationHandler( } try { val payload = - location.getLocation( + dataSource.fetchLocation( desiredProviders = providers, maxAgeMs = maxAgeMs, timeoutMs = timeoutMs, diff --git a/apps/android/app/src/test/java/ai/openclaw/app/node/LocationHandlerTest.kt b/apps/android/app/src/test/java/ai/openclaw/app/node/LocationHandlerTest.kt new file mode 100644 index 00000000000..9605077fa8b --- /dev/null +++ b/apps/android/app/src/test/java/ai/openclaw/app/node/LocationHandlerTest.kt @@ -0,0 +1,88 @@ +package ai.openclaw.app.node + +import android.content.Context +import kotlinx.coroutines.test.runTest +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue +import org.junit.Test + +class LocationHandlerTest : NodeHandlerRobolectricTest() { + @Test + fun handleLocationGet_requiresLocationPermissionWhenNeitherFineNorCoarse() = + runTest { + val handler = + LocationHandler.forTesting( + appContext = appContext(), + dataSource = + FakeLocationDataSource( + fineGranted = false, + coarseGranted = false, + ), + ) + + val result = handler.handleLocationGet(null) + + assertFalse(result.ok) + assertEquals("LOCATION_PERMISSION_REQUIRED", result.error?.code) + } + + @Test + fun handleLocationGet_requiresForegroundBeforeLocationPermission() = + runTest { + val handler = + LocationHandler.forTesting( + appContext = appContext(), + dataSource = + FakeLocationDataSource( + fineGranted = true, + coarseGranted = true, + ), + isForeground = { false }, + ) + + val result = handler.handleLocationGet(null) + + assertFalse(result.ok) + assertEquals("LOCATION_BACKGROUND_UNAVAILABLE", result.error?.code) + } + + @Test + fun hasFineLocationPermission_reflectsDataSource() { + val denied = + LocationHandler.forTesting( + appContext = appContext(), + dataSource = FakeLocationDataSource(fineGranted = false, coarseGranted = true), + ) + assertFalse(denied.hasFineLocationPermission()) + assertTrue(denied.hasCoarseLocationPermission()) + + val granted = + LocationHandler.forTesting( + appContext = appContext(), + dataSource = FakeLocationDataSource(fineGranted = true, coarseGranted = false), + ) + assertTrue(granted.hasFineLocationPermission()) + assertFalse(granted.hasCoarseLocationPermission()) + } +} + +private class FakeLocationDataSource( + private val fineGranted: Boolean, + private val coarseGranted: Boolean, +) : LocationDataSource { + override fun hasFinePermission(context: Context): Boolean = fineGranted + + override fun hasCoarsePermission(context: Context): Boolean = coarseGranted + + override suspend fun fetchLocation( + desiredProviders: List, + maxAgeMs: Long?, + timeoutMs: Long, + isPrecise: Boolean, + ): LocationCaptureManager.Payload { + throw IllegalStateException( + "LocationHandlerTest: fetchLocation must not run in this scenario", + ) + } +} diff --git a/apps/macos/Sources/OpenClaw/ExecApprovalEvaluation.swift b/apps/macos/Sources/OpenClaw/ExecApprovalEvaluation.swift index a36e58db1d8..e39db84534f 100644 --- a/apps/macos/Sources/OpenClaw/ExecApprovalEvaluation.swift +++ b/apps/macos/Sources/OpenClaw/ExecApprovalEvaluation.swift @@ -9,6 +9,7 @@ struct ExecApprovalEvaluation { let env: [String: String] let resolution: ExecCommandResolution? let allowlistResolutions: [ExecCommandResolution] + let allowAlwaysPatterns: [String] let allowlistMatches: [ExecAllowlistEntry] let allowlistSatisfied: Bool let allowlistMatch: ExecAllowlistEntry? @@ -31,9 +32,16 @@ enum ExecApprovalEvaluator { let shellWrapper = ExecShellWrapperParser.extract(command: command, rawCommand: rawCommand).isWrapper let env = HostEnvSanitizer.sanitize(overrides: envOverrides, shellWrapper: shellWrapper) let displayCommand = ExecCommandFormatter.displayString(for: command, rawCommand: rawCommand) + let allowlistRawCommand = ExecSystemRunCommandValidator.allowlistEvaluationRawCommand( + command: command, + rawCommand: rawCommand) let allowlistResolutions = ExecCommandResolution.resolveForAllowlist( command: command, - rawCommand: rawCommand, + rawCommand: allowlistRawCommand, + cwd: cwd, + env: env) + let allowAlwaysPatterns = ExecCommandResolution.resolveAllowAlwaysPatterns( + command: command, cwd: cwd, env: env) let allowlistMatches = security == .allowlist @@ -60,6 +68,7 @@ enum ExecApprovalEvaluator { env: env, resolution: allowlistResolutions.first, allowlistResolutions: allowlistResolutions, + allowAlwaysPatterns: allowAlwaysPatterns, allowlistMatches: allowlistMatches, allowlistSatisfied: allowlistSatisfied, allowlistMatch: allowlistSatisfied ? allowlistMatches.first : nil, diff --git a/apps/macos/Sources/OpenClaw/ExecApprovalsSocket.swift b/apps/macos/Sources/OpenClaw/ExecApprovalsSocket.swift index 19336f4f7b1..1187d3d09a4 100644 --- a/apps/macos/Sources/OpenClaw/ExecApprovalsSocket.swift +++ b/apps/macos/Sources/OpenClaw/ExecApprovalsSocket.swift @@ -378,7 +378,7 @@ private enum ExecHostExecutor { let context = await self.buildContext( request: request, command: validatedRequest.command, - rawCommand: validatedRequest.displayCommand) + rawCommand: validatedRequest.evaluationRawCommand) switch ExecHostRequestEvaluator.evaluate( context: context, @@ -476,13 +476,7 @@ private enum ExecHostExecutor { { guard decision == .allowAlways, context.security == .allowlist else { return } var seenPatterns = Set() - for candidate in context.allowlistResolutions { - guard let pattern = ExecApprovalHelpers.allowlistPattern( - command: context.command, - resolution: candidate) - else { - continue - } + for pattern in context.allowAlwaysPatterns { if seenPatterns.insert(pattern).inserted { ExecApprovalsStore.addAllowlistEntry(agentId: context.agentId, pattern: pattern) } diff --git a/apps/macos/Sources/OpenClaw/ExecCommandResolution.swift b/apps/macos/Sources/OpenClaw/ExecCommandResolution.swift index f89293a81aa..131868bb23e 100644 --- a/apps/macos/Sources/OpenClaw/ExecCommandResolution.swift +++ b/apps/macos/Sources/OpenClaw/ExecCommandResolution.swift @@ -52,6 +52,23 @@ struct ExecCommandResolution { return [resolution] } + static func resolveAllowAlwaysPatterns( + command: [String], + cwd: String?, + env: [String: String]?) -> [String] + { + var patterns: [String] = [] + var seen = Set() + self.collectAllowAlwaysPatterns( + command: command, + cwd: cwd, + env: env, + depth: 0, + patterns: &patterns, + seen: &seen) + return patterns + } + static func resolve(command: [String], cwd: String?, env: [String: String]?) -> ExecCommandResolution? { let effective = ExecEnvInvocationUnwrapper.unwrapDispatchWrappersForResolution(command) guard let raw = effective.first?.trimmingCharacters(in: .whitespacesAndNewlines), !raw.isEmpty else { @@ -101,6 +118,115 @@ struct ExecCommandResolution { return self.resolveExecutable(rawExecutable: raw, cwd: cwd, env: env) } + private static func collectAllowAlwaysPatterns( + command: [String], + cwd: String?, + env: [String: String]?, + depth: Int, + patterns: inout [String], + seen: inout Set) + { + guard depth < 3, !command.isEmpty else { + return + } + + if let token0 = command.first?.trimmingCharacters(in: .whitespacesAndNewlines), + ExecCommandToken.basenameLower(token0) == "env", + let envUnwrapped = ExecEnvInvocationUnwrapper.unwrap(command), + !envUnwrapped.isEmpty + { + self.collectAllowAlwaysPatterns( + command: envUnwrapped, + cwd: cwd, + env: env, + depth: depth + 1, + patterns: &patterns, + seen: &seen) + return + } + + if let shellMultiplexer = self.unwrapShellMultiplexerInvocation(command) { + self.collectAllowAlwaysPatterns( + command: shellMultiplexer, + cwd: cwd, + env: env, + depth: depth + 1, + patterns: &patterns, + seen: &seen) + return + } + + let shell = ExecShellWrapperParser.extract(command: command, rawCommand: nil) + if shell.isWrapper { + guard let shellCommand = shell.command, + let segments = self.splitShellCommandChain(shellCommand) + else { + return + } + for segment in segments { + let tokens = self.tokenizeShellWords(segment) + guard !tokens.isEmpty else { + continue + } + self.collectAllowAlwaysPatterns( + command: tokens, + cwd: cwd, + env: env, + depth: depth + 1, + patterns: &patterns, + seen: &seen) + } + return + } + + guard let resolution = self.resolve(command: command, cwd: cwd, env: env), + let pattern = ExecApprovalHelpers.allowlistPattern(command: command, resolution: resolution), + seen.insert(pattern).inserted + else { + return + } + patterns.append(pattern) + } + + private static func unwrapShellMultiplexerInvocation(_ argv: [String]) -> [String]? { + guard let token0 = argv.first?.trimmingCharacters(in: .whitespacesAndNewlines), !token0.isEmpty else { + return nil + } + let wrapper = ExecCommandToken.basenameLower(token0) + guard wrapper == "busybox" || wrapper == "toybox" else { + return nil + } + + var appletIndex = 1 + if appletIndex < argv.count, argv[appletIndex].trimmingCharacters(in: .whitespacesAndNewlines) == "--" { + appletIndex += 1 + } + guard appletIndex < argv.count else { + return nil + } + let applet = argv[appletIndex].trimmingCharacters(in: .whitespacesAndNewlines) + guard !applet.isEmpty else { + return nil + } + + let normalizedApplet = ExecCommandToken.basenameLower(applet) + let shellWrappers = Set([ + "ash", + "bash", + "dash", + "fish", + "ksh", + "powershell", + "pwsh", + "sh", + "zsh", + ]) + guard shellWrappers.contains(normalizedApplet) else { + return nil + } + return Array(argv[appletIndex...]) + } + private static func parseFirstToken(_ command: String) -> String? { let trimmed = command.trimmingCharacters(in: .whitespacesAndNewlines) guard !trimmed.isEmpty else { return nil } diff --git a/apps/macos/Sources/OpenClaw/ExecEnvInvocationUnwrapper.swift b/apps/macos/Sources/OpenClaw/ExecEnvInvocationUnwrapper.swift index 19161858571..35423182b6e 100644 --- a/apps/macos/Sources/OpenClaw/ExecEnvInvocationUnwrapper.swift +++ b/apps/macos/Sources/OpenClaw/ExecEnvInvocationUnwrapper.swift @@ -12,14 +12,24 @@ enum ExecCommandToken { enum ExecEnvInvocationUnwrapper { static let maxWrapperDepth = 4 + struct UnwrapResult { + let command: [String] + let usesModifiers: Bool + } + private static func isEnvAssignment(_ token: String) -> Bool { let pattern = #"^[A-Za-z_][A-Za-z0-9_]*=.*"# return token.range(of: pattern, options: .regularExpression) != nil } static func unwrap(_ command: [String]) -> [String]? { + self.unwrapWithMetadata(command)?.command + } + + static func unwrapWithMetadata(_ command: [String]) -> UnwrapResult? { var idx = 1 var expectsOptionValue = false + var usesModifiers = false while idx < command.count { let token = command[idx].trimmingCharacters(in: .whitespacesAndNewlines) if token.isEmpty { @@ -28,6 +38,7 @@ enum ExecEnvInvocationUnwrapper { } if expectsOptionValue { expectsOptionValue = false + usesModifiers = true idx += 1 continue } @@ -36,6 +47,7 @@ enum ExecEnvInvocationUnwrapper { break } if self.isEnvAssignment(token) { + usesModifiers = true idx += 1 continue } @@ -43,10 +55,12 @@ enum ExecEnvInvocationUnwrapper { let lower = token.lowercased() let flag = lower.split(separator: "=", maxSplits: 1).first.map(String.init) ?? lower if ExecEnvOptions.flagOnly.contains(flag) { + usesModifiers = true idx += 1 continue } if ExecEnvOptions.withValue.contains(flag) { + usesModifiers = true if !lower.contains("=") { expectsOptionValue = true } @@ -63,6 +77,7 @@ enum ExecEnvInvocationUnwrapper { lower.hasPrefix("--ignore-signal=") || lower.hasPrefix("--block-signal=") { + usesModifiers = true idx += 1 continue } @@ -70,8 +85,8 @@ enum ExecEnvInvocationUnwrapper { } break } - guard idx < command.count else { return nil } - return Array(command[idx...]) + guard !expectsOptionValue, idx < command.count else { return nil } + return UnwrapResult(command: Array(command[idx...]), usesModifiers: usesModifiers) } static func unwrapDispatchWrappersForResolution(_ command: [String]) -> [String] { @@ -84,10 +99,13 @@ enum ExecEnvInvocationUnwrapper { guard ExecCommandToken.basenameLower(token) == "env" else { break } - guard let unwrapped = self.unwrap(current), !unwrapped.isEmpty else { + guard let unwrapped = self.unwrapWithMetadata(current), !unwrapped.command.isEmpty else { break } - current = unwrapped + if unwrapped.usesModifiers { + break + } + current = unwrapped.command depth += 1 } return current diff --git a/apps/macos/Sources/OpenClaw/ExecHostRequestEvaluator.swift b/apps/macos/Sources/OpenClaw/ExecHostRequestEvaluator.swift index 4e0ff4173de..5a95bd7949d 100644 --- a/apps/macos/Sources/OpenClaw/ExecHostRequestEvaluator.swift +++ b/apps/macos/Sources/OpenClaw/ExecHostRequestEvaluator.swift @@ -3,6 +3,7 @@ import Foundation struct ExecHostValidatedRequest { let command: [String] let displayCommand: String + let evaluationRawCommand: String? } enum ExecHostPolicyDecision { @@ -27,7 +28,10 @@ enum ExecHostRequestEvaluator { rawCommand: request.rawCommand) switch validatedCommand { case let .ok(resolved): - return .success(ExecHostValidatedRequest(command: command, displayCommand: resolved.displayCommand)) + return .success(ExecHostValidatedRequest( + command: command, + displayCommand: resolved.displayCommand, + evaluationRawCommand: resolved.evaluationRawCommand)) case let .invalid(message): return .failure( ExecHostError( diff --git a/apps/macos/Sources/OpenClaw/ExecSystemRunCommandValidator.swift b/apps/macos/Sources/OpenClaw/ExecSystemRunCommandValidator.swift index f8ff84155e1..d73724db5bd 100644 --- a/apps/macos/Sources/OpenClaw/ExecSystemRunCommandValidator.swift +++ b/apps/macos/Sources/OpenClaw/ExecSystemRunCommandValidator.swift @@ -3,6 +3,7 @@ import Foundation enum ExecSystemRunCommandValidator { struct ResolvedCommand { let displayCommand: String + let evaluationRawCommand: String? } enum ValidationResult { @@ -52,18 +53,43 @@ enum ExecSystemRunCommandValidator { let envManipulationBeforeShellWrapper = self.hasEnvManipulationBeforeShellWrapper(command) let shellWrapperPositionalArgv = self.hasTrailingPositionalArgvAfterInlineCommand(command) let mustBindDisplayToFullArgv = envManipulationBeforeShellWrapper || shellWrapperPositionalArgv - - let inferred: String = if let shellCommand, !mustBindDisplayToFullArgv { + let formattedArgv = ExecCommandFormatter.displayString(for: command) + let previewCommand: String? = if let shellCommand, !mustBindDisplayToFullArgv { shellCommand } else { - ExecCommandFormatter.displayString(for: command) + nil } - if let raw = normalizedRaw, raw != inferred { + if let raw = normalizedRaw, raw != formattedArgv, raw != previewCommand { return .invalid(message: "INVALID_REQUEST: rawCommand does not match command") } - return .ok(ResolvedCommand(displayCommand: normalizedRaw ?? inferred)) + return .ok(ResolvedCommand( + displayCommand: formattedArgv, + evaluationRawCommand: self.allowlistEvaluationRawCommand( + normalizedRaw: normalizedRaw, + shellIsWrapper: shell.isWrapper, + previewCommand: previewCommand))) + } + + static func allowlistEvaluationRawCommand(command: [String], rawCommand: String?) -> String? { + let normalizedRaw = self.normalizeRaw(rawCommand) + let shell = ExecShellWrapperParser.extract(command: command, rawCommand: nil) + let shellCommand = shell.isWrapper ? self.trimmedNonEmpty(shell.command) : nil + + let envManipulationBeforeShellWrapper = self.hasEnvManipulationBeforeShellWrapper(command) + let shellWrapperPositionalArgv = self.hasTrailingPositionalArgvAfterInlineCommand(command) + let mustBindDisplayToFullArgv = envManipulationBeforeShellWrapper || shellWrapperPositionalArgv + let previewCommand: String? = if let shellCommand, !mustBindDisplayToFullArgv { + shellCommand + } else { + nil + } + + return self.allowlistEvaluationRawCommand( + normalizedRaw: normalizedRaw, + shellIsWrapper: shell.isWrapper, + previewCommand: previewCommand) } private static func normalizeRaw(_ rawCommand: String?) -> String? { @@ -76,6 +102,20 @@ enum ExecSystemRunCommandValidator { return trimmed.isEmpty ? nil : trimmed } + private static func allowlistEvaluationRawCommand( + normalizedRaw: String?, + shellIsWrapper: Bool, + previewCommand: String?) -> String? + { + guard shellIsWrapper else { + return normalizedRaw + } + guard let normalizedRaw else { + return nil + } + return normalizedRaw == previewCommand ? normalizedRaw : nil + } + private static func normalizeExecutableToken(_ token: String) -> String { let base = ExecCommandToken.basenameLower(token) if base.hasSuffix(".exe") { diff --git a/apps/macos/Sources/OpenClaw/NodeMode/MacNodeRuntime.swift b/apps/macos/Sources/OpenClaw/NodeMode/MacNodeRuntime.swift index 6782913bd23..c24f5d0f1b8 100644 --- a/apps/macos/Sources/OpenClaw/NodeMode/MacNodeRuntime.swift +++ b/apps/macos/Sources/OpenClaw/NodeMode/MacNodeRuntime.swift @@ -507,8 +507,7 @@ actor MacNodeRuntime { persistAllowlist: persistAllowlist, security: evaluation.security, agentId: evaluation.agentId, - command: command, - allowlistResolutions: evaluation.allowlistResolutions) + allowAlwaysPatterns: evaluation.allowAlwaysPatterns) if evaluation.security == .allowlist, !evaluation.allowlistSatisfied, !evaluation.skillAllow, !approvedByAsk { await self.emitExecEvent( @@ -795,15 +794,11 @@ extension MacNodeRuntime { persistAllowlist: Bool, security: ExecSecurity, agentId: String?, - command: [String], - allowlistResolutions: [ExecCommandResolution]) + allowAlwaysPatterns: [String]) { guard persistAllowlist, security == .allowlist else { return } var seenPatterns = Set() - for candidate in allowlistResolutions { - guard let pattern = ExecApprovalHelpers.allowlistPattern(command: command, resolution: candidate) else { - continue - } + for pattern in allowAlwaysPatterns { if seenPatterns.insert(pattern).inserted { ExecApprovalsStore.addAllowlistEntry(agentId: agentId, pattern: pattern) } diff --git a/apps/macos/Tests/OpenClawIPCTests/CommandResolverTests.swift b/apps/macos/Tests/OpenClawIPCTests/CommandResolverTests.swift index 969a8ea1a51..5e8e68f52e6 100644 --- a/apps/macos/Tests/OpenClawIPCTests/CommandResolverTests.swift +++ b/apps/macos/Tests/OpenClawIPCTests/CommandResolverTests.swift @@ -45,7 +45,7 @@ import Testing let nodePath = tmp.appendingPathComponent("node_modules/.bin/node") let scriptPath = tmp.appendingPathComponent("bin/openclaw.js") try makeExecutableForTests(at: nodePath) - try "#!/bin/sh\necho v22.0.0\n".write(to: nodePath, atomically: true, encoding: .utf8) + try "#!/bin/sh\necho v22.16.0\n".write(to: nodePath, atomically: true, encoding: .utf8) try FileManager().setAttributes([.posixPermissions: 0o755], ofItemAtPath: nodePath.path) try makeExecutableForTests(at: scriptPath) diff --git a/apps/macos/Tests/OpenClawIPCTests/ExecAllowlistTests.swift b/apps/macos/Tests/OpenClawIPCTests/ExecAllowlistTests.swift index fa92cc81ef5..dc2ab9c42d7 100644 --- a/apps/macos/Tests/OpenClawIPCTests/ExecAllowlistTests.swift +++ b/apps/macos/Tests/OpenClawIPCTests/ExecAllowlistTests.swift @@ -240,7 +240,7 @@ struct ExecAllowlistTests { #expect(resolutions[0].executableName == "touch") } - @Test func `resolve for allowlist unwraps env assignments inside shell segments`() { + @Test func `resolve for allowlist preserves env assignments inside shell segments`() { let command = ["/bin/sh", "-lc", "env FOO=bar /usr/bin/touch /tmp/openclaw-allowlist-test"] let resolutions = ExecCommandResolution.resolveForAllowlist( command: command, @@ -248,11 +248,11 @@ struct ExecAllowlistTests { cwd: nil, env: ["PATH": "/usr/bin:/bin"]) #expect(resolutions.count == 1) - #expect(resolutions[0].resolvedPath == "/usr/bin/touch") - #expect(resolutions[0].executableName == "touch") + #expect(resolutions[0].resolvedPath == "/usr/bin/env") + #expect(resolutions[0].executableName == "env") } - @Test func `resolve for allowlist unwraps env to effective direct executable`() { + @Test func `resolve for allowlist preserves env wrapper with modifiers`() { let command = ["/usr/bin/env", "FOO=bar", "/usr/bin/printf", "ok"] let resolutions = ExecCommandResolution.resolveForAllowlist( command: command, @@ -260,8 +260,33 @@ struct ExecAllowlistTests { cwd: nil, env: ["PATH": "/usr/bin:/bin"]) #expect(resolutions.count == 1) - #expect(resolutions[0].resolvedPath == "/usr/bin/printf") - #expect(resolutions[0].executableName == "printf") + #expect(resolutions[0].resolvedPath == "/usr/bin/env") + #expect(resolutions[0].executableName == "env") + } + + @Test func `approval evaluator resolves shell payload from canonical wrapper text`() async { + let command = ["/bin/sh", "-lc", "/usr/bin/printf ok"] + let rawCommand = "/bin/sh -lc \"/usr/bin/printf ok\"" + let evaluation = await ExecApprovalEvaluator.evaluate( + command: command, + rawCommand: rawCommand, + cwd: nil, + envOverrides: ["PATH": "/usr/bin:/bin"], + agentId: nil) + + #expect(evaluation.displayCommand == rawCommand) + #expect(evaluation.allowlistResolutions.count == 1) + #expect(evaluation.allowlistResolutions[0].resolvedPath == "/usr/bin/printf") + #expect(evaluation.allowlistResolutions[0].executableName == "printf") + } + + @Test func `allow always patterns unwrap env wrapper modifiers to the inner executable`() { + let patterns = ExecCommandResolution.resolveAllowAlwaysPatterns( + command: ["/usr/bin/env", "FOO=bar", "/usr/bin/printf", "ok"], + cwd: nil, + env: ["PATH": "/usr/bin:/bin"]) + + #expect(patterns == ["/usr/bin/printf"]) } @Test func `match all requires every segment to match`() { diff --git a/apps/macos/Tests/OpenClawIPCTests/ExecApprovalsStoreRefactorTests.swift b/apps/macos/Tests/OpenClawIPCTests/ExecApprovalsStoreRefactorTests.swift index 480b4cd9194..cd270d00fd2 100644 --- a/apps/macos/Tests/OpenClawIPCTests/ExecApprovalsStoreRefactorTests.swift +++ b/apps/macos/Tests/OpenClawIPCTests/ExecApprovalsStoreRefactorTests.swift @@ -21,13 +21,12 @@ struct ExecApprovalsStoreRefactorTests { try await self.withTempStateDir { _ in _ = ExecApprovalsStore.ensureFile() let url = ExecApprovalsStore.fileURL() - let firstWriteDate = try Self.modificationDate(at: url) + let firstIdentity = try Self.fileIdentity(at: url) - try await Task.sleep(nanoseconds: 1_100_000_000) _ = ExecApprovalsStore.ensureFile() - let secondWriteDate = try Self.modificationDate(at: url) + let secondIdentity = try Self.fileIdentity(at: url) - #expect(firstWriteDate == secondWriteDate) + #expect(firstIdentity == secondIdentity) } } @@ -81,12 +80,12 @@ struct ExecApprovalsStoreRefactorTests { } } - private static func modificationDate(at url: URL) throws -> Date { + private static func fileIdentity(at url: URL) throws -> Int { let attributes = try FileManager().attributesOfItem(atPath: url.path) - guard let date = attributes[.modificationDate] as? Date else { - struct MissingDateError: Error {} - throw MissingDateError() + guard let identifier = (attributes[.systemFileNumber] as? NSNumber)?.intValue else { + struct MissingIdentifierError: Error {} + throw MissingIdentifierError() } - return date + return identifier } } diff --git a/apps/macos/Tests/OpenClawIPCTests/ExecHostRequestEvaluatorTests.swift b/apps/macos/Tests/OpenClawIPCTests/ExecHostRequestEvaluatorTests.swift index c9772a5d512..ee2177e1440 100644 --- a/apps/macos/Tests/OpenClawIPCTests/ExecHostRequestEvaluatorTests.swift +++ b/apps/macos/Tests/OpenClawIPCTests/ExecHostRequestEvaluatorTests.swift @@ -77,6 +77,7 @@ struct ExecHostRequestEvaluatorTests { env: [:], resolution: nil, allowlistResolutions: [], + allowAlwaysPatterns: [], allowlistMatches: [], allowlistSatisfied: allowlistSatisfied, allowlistMatch: nil, diff --git a/apps/macos/Tests/OpenClawIPCTests/ExecSystemRunCommandValidatorTests.swift b/apps/macos/Tests/OpenClawIPCTests/ExecSystemRunCommandValidatorTests.swift index 64dbb335807..2b07d928ccf 100644 --- a/apps/macos/Tests/OpenClawIPCTests/ExecSystemRunCommandValidatorTests.swift +++ b/apps/macos/Tests/OpenClawIPCTests/ExecSystemRunCommandValidatorTests.swift @@ -50,6 +50,20 @@ struct ExecSystemRunCommandValidatorTests { } } + @Test func `validator keeps canonical wrapper text out of allowlist raw parsing`() { + let command = ["/bin/sh", "-lc", "/usr/bin/printf ok"] + let rawCommand = "/bin/sh -lc \"/usr/bin/printf ok\"" + let result = ExecSystemRunCommandValidator.resolve(command: command, rawCommand: rawCommand) + + switch result { + case let .ok(resolved): + #expect(resolved.displayCommand == rawCommand) + #expect(resolved.evaluationRawCommand == nil) + case let .invalid(message): + Issue.record("unexpected invalid result: \(message)") + } + } + private static func loadContractCases() throws -> [SystemRunCommandContractCase] { let fixtureURL = try self.findContractFixtureURL() let data = try Data(contentsOf: fixtureURL) diff --git a/changelog/fragments/session-history-live-events-followups.md b/changelog/fragments/session-history-live-events-followups.md deleted file mode 100644 index 59b98f364e2..00000000000 --- a/changelog/fragments/session-history-live-events-followups.md +++ /dev/null @@ -1,3 +0,0 @@ -### Fixes - -- Gateway/session history: return `404` for unknown session history lookups, unsubscribe session lifecycle listeners during shutdown, add coverage for the new transcript and lifecycle helpers, and tighten session history plus live transcript tests so the Control UI session surfaces stay stable under restart and follow mode. diff --git a/docker-compose.yml b/docker-compose.yml index c0bffc64458..0a55b342e92 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,7 @@ services: ## Uncomment the lines below to enable sandbox isolation ## (agents.defaults.sandbox). Requires Docker CLI in the image ## (build with --build-arg OPENCLAW_INSTALL_DOCKER_CLI=1) or use - ## docker-setup.sh with OPENCLAW_SANDBOX=1 for automated setup. + ## scripts/docker/setup.sh with OPENCLAW_SANDBOX=1 for automated setup. ## Set DOCKER_GID to the host's docker group GID (run: stat -c '%g' /var/run/docker.sock). # - /var/run/docker.sock:/var/run/docker.sock # group_add: diff --git a/docker-setup.sh b/docker-setup.sh index 19e5461765b..e8d6335bf42 100755 --- a/docker-setup.sh +++ b/docker-setup.sh @@ -2,615 +2,11 @@ set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -COMPOSE_FILE="$ROOT_DIR/docker-compose.yml" -EXTRA_COMPOSE_FILE="$ROOT_DIR/docker-compose.extra.yml" -IMAGE_NAME="${OPENCLAW_IMAGE:-openclaw:local}" -EXTRA_MOUNTS="${OPENCLAW_EXTRA_MOUNTS:-}" -HOME_VOLUME_NAME="${OPENCLAW_HOME_VOLUME:-}" -RAW_SANDBOX_SETTING="${OPENCLAW_SANDBOX:-}" -SANDBOX_ENABLED="" -DOCKER_SOCKET_PATH="${OPENCLAW_DOCKER_SOCKET:-}" -TIMEZONE="${OPENCLAW_TZ:-}" +SCRIPT_PATH="$ROOT_DIR/scripts/docker/setup.sh" -fail() { - echo "ERROR: $*" >&2 - exit 1 -} - -require_cmd() { - if ! command -v "$1" >/dev/null 2>&1; then - echo "Missing dependency: $1" >&2 - exit 1 - fi -} - -is_truthy_value() { - local raw="${1:-}" - raw="$(printf '%s' "$raw" | tr '[:upper:]' '[:lower:]')" - case "$raw" in - 1 | true | yes | on) return 0 ;; - *) return 1 ;; - esac -} - -read_config_gateway_token() { - local config_path="$OPENCLAW_CONFIG_DIR/openclaw.json" - if [[ ! -f "$config_path" ]]; then - return 0 - fi - if command -v python3 >/dev/null 2>&1; then - python3 - "$config_path" <<'PY' -import json -import sys - -path = sys.argv[1] -try: - with open(path, "r", encoding="utf-8") as f: - cfg = json.load(f) -except Exception: - raise SystemExit(0) - -gateway = cfg.get("gateway") -if not isinstance(gateway, dict): - raise SystemExit(0) -auth = gateway.get("auth") -if not isinstance(auth, dict): - raise SystemExit(0) -token = auth.get("token") -if isinstance(token, str): - token = token.strip() - if token: - print(token) -PY - return 0 - fi - if command -v node >/dev/null 2>&1; then - node - "$config_path" <<'NODE' -const fs = require("node:fs"); -const configPath = process.argv[2]; -try { - const cfg = JSON.parse(fs.readFileSync(configPath, "utf8")); - const token = cfg?.gateway?.auth?.token; - if (typeof token === "string" && token.trim().length > 0) { - process.stdout.write(token.trim()); - } -} catch { - // Keep docker-setup resilient when config parsing fails. -} -NODE - fi -} - -read_env_gateway_token() { - local env_path="$1" - local line="" - local token="" - if [[ ! -f "$env_path" ]]; then - return 0 - fi - while IFS= read -r line || [[ -n "$line" ]]; do - line="${line%$'\r'}" - if [[ "$line" == OPENCLAW_GATEWAY_TOKEN=* ]]; then - token="${line#OPENCLAW_GATEWAY_TOKEN=}" - fi - done <"$env_path" - if [[ -n "$token" ]]; then - printf '%s' "$token" - fi -} - -ensure_control_ui_allowed_origins() { - if [[ "${OPENCLAW_GATEWAY_BIND}" == "loopback" ]]; then - return 0 - fi - - local allowed_origin_json - local current_allowed_origins - allowed_origin_json="$(printf '["http://127.0.0.1:%s"]' "$OPENCLAW_GATEWAY_PORT")" - current_allowed_origins="$( - docker compose "${COMPOSE_ARGS[@]}" run --rm openclaw-cli \ - config get gateway.controlUi.allowedOrigins 2>/dev/null || true - )" - current_allowed_origins="${current_allowed_origins//$'\r'/}" - - if [[ -n "$current_allowed_origins" && "$current_allowed_origins" != "null" && "$current_allowed_origins" != "[]" ]]; then - echo "Control UI allowlist already configured; leaving gateway.controlUi.allowedOrigins unchanged." - return 0 - fi - - docker compose "${COMPOSE_ARGS[@]}" run --rm openclaw-cli \ - config set gateway.controlUi.allowedOrigins "$allowed_origin_json" --strict-json >/dev/null - echo "Set gateway.controlUi.allowedOrigins to $allowed_origin_json for non-loopback bind." -} - -sync_gateway_mode_and_bind() { - docker compose "${COMPOSE_ARGS[@]}" run --rm openclaw-cli \ - config set gateway.mode local >/dev/null - docker compose "${COMPOSE_ARGS[@]}" run --rm openclaw-cli \ - config set gateway.bind "$OPENCLAW_GATEWAY_BIND" >/dev/null - echo "Pinned gateway.mode=local and gateway.bind=$OPENCLAW_GATEWAY_BIND for Docker setup." -} - -contains_disallowed_chars() { - local value="$1" - [[ "$value" == *$'\n'* || "$value" == *$'\r'* || "$value" == *$'\t'* ]] -} - -is_valid_timezone() { - local value="$1" - [[ -e "/usr/share/zoneinfo/$value" && ! -d "/usr/share/zoneinfo/$value" ]] -} - -validate_mount_path_value() { - local label="$1" - local value="$2" - if [[ -z "$value" ]]; then - fail "$label cannot be empty." - fi - if contains_disallowed_chars "$value"; then - fail "$label contains unsupported control characters." - fi - if [[ "$value" =~ [[:space:]] ]]; then - fail "$label cannot contain whitespace." - fi -} - -validate_named_volume() { - local value="$1" - if [[ ! "$value" =~ ^[A-Za-z0-9][A-Za-z0-9_.-]*$ ]]; then - fail "OPENCLAW_HOME_VOLUME must match [A-Za-z0-9][A-Za-z0-9_.-]* when using a named volume." - fi -} - -validate_mount_spec() { - local mount="$1" - if contains_disallowed_chars "$mount"; then - fail "OPENCLAW_EXTRA_MOUNTS entries cannot contain control characters." - fi - # Keep mount specs strict to avoid YAML structure injection. - # Expected format: source:target[:options] - if [[ ! "$mount" =~ ^[^[:space:],:]+:[^[:space:],:]+(:[^[:space:],:]+)?$ ]]; then - fail "Invalid mount format '$mount'. Expected source:target[:options] without spaces." - fi -} - -require_cmd docker -if ! docker compose version >/dev/null 2>&1; then - echo "Docker Compose not available (try: docker compose version)" >&2 +if [[ ! -f "$SCRIPT_PATH" ]]; then + echo "Docker setup script not found at $SCRIPT_PATH" >&2 exit 1 fi -if [[ -z "$DOCKER_SOCKET_PATH" && "${DOCKER_HOST:-}" == unix://* ]]; then - DOCKER_SOCKET_PATH="${DOCKER_HOST#unix://}" -fi -if [[ -z "$DOCKER_SOCKET_PATH" ]]; then - DOCKER_SOCKET_PATH="/var/run/docker.sock" -fi -if is_truthy_value "$RAW_SANDBOX_SETTING"; then - SANDBOX_ENABLED="1" -fi - -OPENCLAW_CONFIG_DIR="${OPENCLAW_CONFIG_DIR:-$HOME/.openclaw}" -OPENCLAW_WORKSPACE_DIR="${OPENCLAW_WORKSPACE_DIR:-$HOME/.openclaw/workspace}" - -validate_mount_path_value "OPENCLAW_CONFIG_DIR" "$OPENCLAW_CONFIG_DIR" -validate_mount_path_value "OPENCLAW_WORKSPACE_DIR" "$OPENCLAW_WORKSPACE_DIR" -if [[ -n "$HOME_VOLUME_NAME" ]]; then - if [[ "$HOME_VOLUME_NAME" == *"/"* ]]; then - validate_mount_path_value "OPENCLAW_HOME_VOLUME" "$HOME_VOLUME_NAME" - else - validate_named_volume "$HOME_VOLUME_NAME" - fi -fi -if contains_disallowed_chars "$EXTRA_MOUNTS"; then - fail "OPENCLAW_EXTRA_MOUNTS cannot contain control characters." -fi -if [[ -n "$SANDBOX_ENABLED" ]]; then - validate_mount_path_value "OPENCLAW_DOCKER_SOCKET" "$DOCKER_SOCKET_PATH" -fi -if [[ -n "$TIMEZONE" ]]; then - if contains_disallowed_chars "$TIMEZONE"; then - fail "OPENCLAW_TZ contains unsupported control characters." - fi - if [[ ! "$TIMEZONE" =~ ^[A-Za-z0-9/_+\-]+$ ]]; then - fail "OPENCLAW_TZ must be a valid IANA timezone string (e.g. Asia/Shanghai)." - fi - if ! is_valid_timezone "$TIMEZONE"; then - fail "OPENCLAW_TZ must match a timezone in /usr/share/zoneinfo (e.g. Asia/Shanghai)." - fi -fi - -mkdir -p "$OPENCLAW_CONFIG_DIR" -mkdir -p "$OPENCLAW_WORKSPACE_DIR" -# Seed directory tree eagerly so bind mounts work even on Docker Desktop/Windows -# where the container (even as root) cannot create new host subdirectories. -mkdir -p "$OPENCLAW_CONFIG_DIR/identity" -mkdir -p "$OPENCLAW_CONFIG_DIR/agents/main/agent" -mkdir -p "$OPENCLAW_CONFIG_DIR/agents/main/sessions" - -export OPENCLAW_CONFIG_DIR -export OPENCLAW_WORKSPACE_DIR -export OPENCLAW_GATEWAY_PORT="${OPENCLAW_GATEWAY_PORT:-18789}" -export OPENCLAW_BRIDGE_PORT="${OPENCLAW_BRIDGE_PORT:-18790}" -export OPENCLAW_GATEWAY_BIND="${OPENCLAW_GATEWAY_BIND:-lan}" -export OPENCLAW_IMAGE="$IMAGE_NAME" -export OPENCLAW_DOCKER_APT_PACKAGES="${OPENCLAW_DOCKER_APT_PACKAGES:-}" -export OPENCLAW_EXTENSIONS="${OPENCLAW_EXTENSIONS:-}" -export OPENCLAW_EXTRA_MOUNTS="$EXTRA_MOUNTS" -export OPENCLAW_HOME_VOLUME="$HOME_VOLUME_NAME" -export OPENCLAW_ALLOW_INSECURE_PRIVATE_WS="${OPENCLAW_ALLOW_INSECURE_PRIVATE_WS:-}" -export OPENCLAW_SANDBOX="$SANDBOX_ENABLED" -export OPENCLAW_DOCKER_SOCKET="$DOCKER_SOCKET_PATH" -export OPENCLAW_TZ="$TIMEZONE" - -# Detect Docker socket GID for sandbox group_add. -DOCKER_GID="" -if [[ -n "$SANDBOX_ENABLED" && -S "$DOCKER_SOCKET_PATH" ]]; then - DOCKER_GID="$(stat -c '%g' "$DOCKER_SOCKET_PATH" 2>/dev/null || stat -f '%g' "$DOCKER_SOCKET_PATH" 2>/dev/null || echo "")" -fi -export DOCKER_GID - -if [[ -z "${OPENCLAW_GATEWAY_TOKEN:-}" ]]; then - EXISTING_CONFIG_TOKEN="$(read_config_gateway_token || true)" - if [[ -n "$EXISTING_CONFIG_TOKEN" ]]; then - OPENCLAW_GATEWAY_TOKEN="$EXISTING_CONFIG_TOKEN" - echo "Reusing gateway token from $OPENCLAW_CONFIG_DIR/openclaw.json" - else - DOTENV_GATEWAY_TOKEN="$(read_env_gateway_token "$ROOT_DIR/.env" || true)" - if [[ -n "$DOTENV_GATEWAY_TOKEN" ]]; then - OPENCLAW_GATEWAY_TOKEN="$DOTENV_GATEWAY_TOKEN" - echo "Reusing gateway token from $ROOT_DIR/.env" - elif command -v openssl >/dev/null 2>&1; then - OPENCLAW_GATEWAY_TOKEN="$(openssl rand -hex 32)" - else - OPENCLAW_GATEWAY_TOKEN="$(python3 - <<'PY' -import secrets -print(secrets.token_hex(32)) -PY -)" - fi - fi -fi -export OPENCLAW_GATEWAY_TOKEN - -COMPOSE_FILES=("$COMPOSE_FILE") -COMPOSE_ARGS=() - -write_extra_compose() { - local home_volume="$1" - shift - local mount - local gateway_home_mount - local gateway_config_mount - local gateway_workspace_mount - - cat >"$EXTRA_COMPOSE_FILE" <<'YAML' -services: - openclaw-gateway: - volumes: -YAML - - if [[ -n "$home_volume" ]]; then - gateway_home_mount="${home_volume}:/home/node" - gateway_config_mount="${OPENCLAW_CONFIG_DIR}:/home/node/.openclaw" - gateway_workspace_mount="${OPENCLAW_WORKSPACE_DIR}:/home/node/.openclaw/workspace" - validate_mount_spec "$gateway_home_mount" - validate_mount_spec "$gateway_config_mount" - validate_mount_spec "$gateway_workspace_mount" - printf ' - %s\n' "$gateway_home_mount" >>"$EXTRA_COMPOSE_FILE" - printf ' - %s\n' "$gateway_config_mount" >>"$EXTRA_COMPOSE_FILE" - printf ' - %s\n' "$gateway_workspace_mount" >>"$EXTRA_COMPOSE_FILE" - fi - - for mount in "$@"; do - validate_mount_spec "$mount" - printf ' - %s\n' "$mount" >>"$EXTRA_COMPOSE_FILE" - done - - cat >>"$EXTRA_COMPOSE_FILE" <<'YAML' - openclaw-cli: - volumes: -YAML - - if [[ -n "$home_volume" ]]; then - printf ' - %s\n' "$gateway_home_mount" >>"$EXTRA_COMPOSE_FILE" - printf ' - %s\n' "$gateway_config_mount" >>"$EXTRA_COMPOSE_FILE" - printf ' - %s\n' "$gateway_workspace_mount" >>"$EXTRA_COMPOSE_FILE" - fi - - for mount in "$@"; do - validate_mount_spec "$mount" - printf ' - %s\n' "$mount" >>"$EXTRA_COMPOSE_FILE" - done - - if [[ -n "$home_volume" && "$home_volume" != *"/"* ]]; then - validate_named_volume "$home_volume" - cat >>"$EXTRA_COMPOSE_FILE" <>"$tmp" - seen="$seen$k " - replaced=true - break - fi - done - if [[ "$replaced" == false ]]; then - printf '%s\n' "$line" >>"$tmp" - fi - done <"$file" - fi - - for k in "${keys[@]}"; do - if [[ "$seen" != *" $k "* ]]; then - printf '%s=%s\n' "$k" "${!k-}" >>"$tmp" - fi - done - - mv "$tmp" "$file" -} - -upsert_env "$ENV_FILE" \ - OPENCLAW_CONFIG_DIR \ - OPENCLAW_WORKSPACE_DIR \ - OPENCLAW_GATEWAY_PORT \ - OPENCLAW_BRIDGE_PORT \ - OPENCLAW_GATEWAY_BIND \ - OPENCLAW_GATEWAY_TOKEN \ - OPENCLAW_IMAGE \ - OPENCLAW_EXTRA_MOUNTS \ - OPENCLAW_HOME_VOLUME \ - OPENCLAW_DOCKER_APT_PACKAGES \ - OPENCLAW_EXTENSIONS \ - OPENCLAW_SANDBOX \ - OPENCLAW_DOCKER_SOCKET \ - DOCKER_GID \ - OPENCLAW_INSTALL_DOCKER_CLI \ - OPENCLAW_ALLOW_INSECURE_PRIVATE_WS \ - OPENCLAW_TZ - -if [[ "$IMAGE_NAME" == "openclaw:local" ]]; then - echo "==> Building Docker image: $IMAGE_NAME" - docker build \ - --build-arg "OPENCLAW_DOCKER_APT_PACKAGES=${OPENCLAW_DOCKER_APT_PACKAGES}" \ - --build-arg "OPENCLAW_EXTENSIONS=${OPENCLAW_EXTENSIONS}" \ - --build-arg "OPENCLAW_INSTALL_DOCKER_CLI=${OPENCLAW_INSTALL_DOCKER_CLI:-}" \ - -t "$IMAGE_NAME" \ - -f "$ROOT_DIR/Dockerfile" \ - "$ROOT_DIR" -else - echo "==> Pulling Docker image: $IMAGE_NAME" - if ! docker pull "$IMAGE_NAME"; then - echo "ERROR: Failed to pull image $IMAGE_NAME. Please check the image name and your access permissions." >&2 - exit 1 - fi -fi - -# Ensure bind-mounted data directories are writable by the container's `node` -# user (uid 1000). Host-created dirs inherit the host user's uid which may -# differ, causing EACCES when the container tries to mkdir/write. -# Running a brief root container to chown is the portable Docker idiom -- -# it works regardless of the host uid and doesn't require host-side root. -echo "" -echo "==> Fixing data-directory permissions" -# Use -xdev to restrict chown to the config-dir mount only — without it, -# the recursive chown would cross into the workspace bind mount and rewrite -# ownership of all user project files on Linux hosts. -# After fixing the config dir, only the OpenClaw metadata subdirectory -# (.openclaw/) inside the workspace gets chowned, not the user's project files. -docker compose "${COMPOSE_ARGS[@]}" run --rm --user root --entrypoint sh openclaw-cli -c \ - 'find /home/node/.openclaw -xdev -exec chown node:node {} +; \ - [ -d /home/node/.openclaw/workspace/.openclaw ] && chown -R node:node /home/node/.openclaw/workspace/.openclaw || true' - -echo "" -echo "==> Onboarding (interactive)" -echo "Docker setup pins Gateway mode to local." -echo "Gateway runtime bind comes from OPENCLAW_GATEWAY_BIND (default: lan)." -echo "Current runtime bind: $OPENCLAW_GATEWAY_BIND" -echo "Gateway token: $OPENCLAW_GATEWAY_TOKEN" -echo "Tailscale exposure: Off (use host-level tailnet/Tailscale setup separately)." -echo "Install Gateway daemon: No (managed by Docker Compose)" -echo "" -docker compose "${COMPOSE_ARGS[@]}" run --rm openclaw-cli onboard --mode local --no-install-daemon - -echo "" -echo "==> Docker gateway defaults" -sync_gateway_mode_and_bind - -echo "" -echo "==> Control UI origin allowlist" -ensure_control_ui_allowed_origins - -echo "" -echo "==> Provider setup (optional)" -echo "WhatsApp (QR):" -echo " ${COMPOSE_HINT} run --rm openclaw-cli channels login" -echo "Telegram (bot token):" -echo " ${COMPOSE_HINT} run --rm openclaw-cli channels add --channel telegram --token " -echo "Discord (bot token):" -echo " ${COMPOSE_HINT} run --rm openclaw-cli channels add --channel discord --token " -echo "Docs: https://docs.openclaw.ai/channels" - -echo "" -echo "==> Starting gateway" -docker compose "${COMPOSE_ARGS[@]}" up -d openclaw-gateway - -# --- Sandbox setup (opt-in via OPENCLAW_SANDBOX=1) --- -if [[ -n "$SANDBOX_ENABLED" ]]; then - echo "" - echo "==> Sandbox setup" - - # Build sandbox image if Dockerfile.sandbox exists. - if [[ -f "$ROOT_DIR/Dockerfile.sandbox" ]]; then - echo "Building sandbox image: openclaw-sandbox:bookworm-slim" - docker build \ - -t "openclaw-sandbox:bookworm-slim" \ - -f "$ROOT_DIR/Dockerfile.sandbox" \ - "$ROOT_DIR" - else - echo "WARNING: Dockerfile.sandbox not found in $ROOT_DIR" >&2 - echo " Sandbox config will be applied but no sandbox image will be built." >&2 - echo " Agent exec may fail if the configured sandbox image does not exist." >&2 - fi - - # Defense-in-depth: verify Docker CLI in the running image before enabling - # sandbox. This avoids claiming sandbox is enabled when the image cannot - # launch sandbox containers. - if ! docker compose "${COMPOSE_ARGS[@]}" run --rm --entrypoint docker openclaw-gateway --version >/dev/null 2>&1; then - echo "WARNING: Docker CLI not found inside the container image." >&2 - echo " Sandbox requires Docker CLI. Rebuild with --build-arg OPENCLAW_INSTALL_DOCKER_CLI=1" >&2 - echo " or use a local build (OPENCLAW_IMAGE=openclaw:local). Skipping sandbox setup." >&2 - SANDBOX_ENABLED="" - fi -fi - -# Apply sandbox config only if prerequisites are met. -if [[ -n "$SANDBOX_ENABLED" ]]; then - # Mount Docker socket via a dedicated compose overlay. This overlay is - # created only after sandbox prerequisites pass, so the socket is never - # exposed when sandbox cannot actually run. - if [[ -S "$DOCKER_SOCKET_PATH" ]]; then - SANDBOX_COMPOSE_FILE="$ROOT_DIR/docker-compose.sandbox.yml" - cat >"$SANDBOX_COMPOSE_FILE" <>"$SANDBOX_COMPOSE_FILE" < Sandbox: added Docker socket mount" - else - echo "WARNING: OPENCLAW_SANDBOX enabled but Docker socket not found at $DOCKER_SOCKET_PATH." >&2 - echo " Sandbox requires Docker socket access. Skipping sandbox setup." >&2 - SANDBOX_ENABLED="" - fi -fi - -if [[ -n "$SANDBOX_ENABLED" ]]; then - # Enable sandbox in OpenClaw config. - sandbox_config_ok=true - if ! docker compose "${COMPOSE_ARGS[@]}" run --rm --no-deps openclaw-cli \ - config set agents.defaults.sandbox.mode "non-main" >/dev/null; then - echo "WARNING: Failed to set agents.defaults.sandbox.mode" >&2 - sandbox_config_ok=false - fi - if ! docker compose "${COMPOSE_ARGS[@]}" run --rm --no-deps openclaw-cli \ - config set agents.defaults.sandbox.scope "agent" >/dev/null; then - echo "WARNING: Failed to set agents.defaults.sandbox.scope" >&2 - sandbox_config_ok=false - fi - if ! docker compose "${COMPOSE_ARGS[@]}" run --rm --no-deps openclaw-cli \ - config set agents.defaults.sandbox.workspaceAccess "none" >/dev/null; then - echo "WARNING: Failed to set agents.defaults.sandbox.workspaceAccess" >&2 - sandbox_config_ok=false - fi - - if [[ "$sandbox_config_ok" == true ]]; then - echo "Sandbox enabled: mode=non-main, scope=agent, workspaceAccess=none" - echo "Docs: https://docs.openclaw.ai/gateway/sandboxing" - # Restart gateway with sandbox compose overlay to pick up socket mount + config. - docker compose "${COMPOSE_ARGS[@]}" up -d openclaw-gateway - else - echo "WARNING: Sandbox config was partially applied. Check errors above." >&2 - echo " Skipping gateway restart to avoid exposing Docker socket without a full sandbox policy." >&2 - if ! docker compose "${BASE_COMPOSE_ARGS[@]}" run --rm --no-deps openclaw-cli \ - config set agents.defaults.sandbox.mode "off" >/dev/null; then - echo "WARNING: Failed to roll back agents.defaults.sandbox.mode to off" >&2 - else - echo "Sandbox mode rolled back to off due to partial sandbox config failure." - fi - if [[ -n "${SANDBOX_COMPOSE_FILE:-}" ]]; then - rm -f "$SANDBOX_COMPOSE_FILE" - fi - # Ensure gateway service definition is reset without sandbox overlay mount. - docker compose "${BASE_COMPOSE_ARGS[@]}" up -d --force-recreate openclaw-gateway - fi -else - # Keep reruns deterministic: if sandbox is not active for this run, reset - # persisted sandbox mode so future execs do not require docker.sock by stale - # config alone. - if ! docker compose "${COMPOSE_ARGS[@]}" run --rm openclaw-cli \ - config set agents.defaults.sandbox.mode "off" >/dev/null; then - echo "WARNING: Failed to reset agents.defaults.sandbox.mode to off" >&2 - fi - if [[ -f "$ROOT_DIR/docker-compose.sandbox.yml" ]]; then - rm -f "$ROOT_DIR/docker-compose.sandbox.yml" - fi -fi - -echo "" -echo "Gateway running with host port mapping." -echo "Access from tailnet devices via the host's tailnet IP." -echo "Config: $OPENCLAW_CONFIG_DIR" -echo "Workspace: $OPENCLAW_WORKSPACE_DIR" -echo "Token: $OPENCLAW_GATEWAY_TOKEN" -echo "" -echo "Commands:" -echo " ${COMPOSE_HINT} logs -f openclaw-gateway" -echo " ${COMPOSE_HINT} exec openclaw-gateway node dist/index.js health --token \"$OPENCLAW_GATEWAY_TOKEN\"" +exec "$SCRIPT_PATH" "$@" diff --git a/docs/automation/hooks.md b/docs/automation/hooks.md index a470bef8540..4d7dbd02533 100644 --- a/docs/automation/hooks.md +++ b/docs/automation/hooks.md @@ -1046,4 +1046,4 @@ node -e "import('./path/to/handler.ts').then(console.log)" - [CLI Reference: hooks](/cli/hooks) - [Bundled Hooks README](https://github.com/openclaw/openclaw/tree/main/src/hooks/bundled) - [Webhook Hooks](/automation/webhook) -- [Configuration](/gateway/configuration#hooks) +- [Configuration](/gateway/configuration-reference#hooks) diff --git a/docs/channels/groups.md b/docs/channels/groups.md index a6bd8621784..8895cdd18f9 100644 --- a/docs/channels/groups.md +++ b/docs/channels/groups.md @@ -116,7 +116,7 @@ Want “groups can only see folder X” instead of “no host access”? Keep `w Related: -- Configuration keys and defaults: [Gateway configuration](/gateway/configuration#agentsdefaultssandbox) +- Configuration keys and defaults: [Gateway configuration](/gateway/configuration-reference#agents-defaults-sandbox) - Debugging why a tool is blocked: [Sandbox vs Tool Policy vs Elevated](/gateway/sandbox-vs-tool-policy-vs-elevated) - Bind mounts details: [Sandboxing](/gateway/sandboxing#custom-bind-mounts) diff --git a/docs/channels/irc.md b/docs/channels/irc.md index 900c531da81..8475c6a4454 100644 --- a/docs/channels/irc.md +++ b/docs/channels/irc.md @@ -1,6 +1,5 @@ --- title: IRC -description: Connect OpenClaw to IRC channels and direct messages. summary: "IRC plugin setup, access controls, and troubleshooting" read_when: - You want to connect OpenClaw to IRC channels or DMs @@ -17,18 +16,18 @@ IRC ships as an extension plugin, but it is configured in the main config under 1. Enable IRC config in `~/.openclaw/openclaw.json`. 2. Set at least: -```json +```json5 { - "channels": { - "irc": { - "enabled": true, - "host": "irc.libera.chat", - "port": 6697, - "tls": true, - "nick": "openclaw-bot", - "channels": ["#openclaw"] - } - } + channels: { + irc: { + enabled: true, + host: "irc.libera.chat", + port: 6697, + tls: true, + nick: "openclaw-bot", + channels: ["#openclaw"], + }, + }, } ``` @@ -75,7 +74,7 @@ If you see logs like: Example (allow anyone in `#tuirc-dev` to talk to the bot): -```json5 +```json55 { channels: { irc: { @@ -96,7 +95,7 @@ That means you may see logs like `drop channel … (missing-mention)` unless the To make the bot reply in an IRC channel **without needing a mention**, disable mention gating for that channel: -```json5 +```json55 { channels: { irc: { @@ -114,7 +113,7 @@ To make the bot reply in an IRC channel **without needing a mention**, disable m Or to allow **all** IRC channels (no per-channel allowlist) and still reply without mentions: -```json5 +```json55 { channels: { irc: { @@ -134,7 +133,7 @@ To reduce risk, restrict tools for that channel. ### Same tools for everyone in the channel -```json5 +```json55 { channels: { irc: { @@ -155,7 +154,7 @@ To reduce risk, restrict tools for that channel. Use `toolsBySender` to apply a stricter policy to `"*"` and a looser one to your nick: -```json5 +```json55 { channels: { irc: { @@ -190,32 +189,32 @@ For more on group access vs mention-gating (and how they interact), see: [/chann To identify with NickServ after connect: -```json +```json5 { - "channels": { - "irc": { - "nickserv": { - "enabled": true, - "service": "NickServ", - "password": "your-nickserv-password" - } - } - } + channels: { + irc: { + nickserv: { + enabled: true, + service: "NickServ", + password: "your-nickserv-password", + }, + }, + }, } ``` Optional one-time registration on connect: -```json +```json5 { - "channels": { - "irc": { - "nickserv": { - "register": true, - "registerEmail": "bot@example.com" - } - } - } + channels: { + irc: { + nickserv: { + register: true, + registerEmail: "bot@example.com", + }, + }, + }, } ``` diff --git a/docs/channels/matrix.md b/docs/channels/matrix.md index 4d9d0fa0e4f..360bc706748 100644 --- a/docs/channels/matrix.md +++ b/docs/channels/matrix.md @@ -204,6 +204,8 @@ Bootstrap cross-signing and verification state: openclaw matrix verify bootstrap ``` +Multi-account support: use `channels.matrix.accounts` with per-account credentials and optional `name`. See [Configuration reference](/gateway/configuration-reference#multi-account-all-channels) for the shared pattern. + Verbose bootstrap diagnostics: ```bash @@ -372,7 +374,7 @@ Planned improvement: ## Automatic verification notices -Matrix now posts verification lifecycle notices directly into the Matrix room as `m.notice` messages. +Matrix now posts verification lifecycle notices directly into the strict DM verification room as `m.notice` messages. That includes: - verification request notices @@ -381,7 +383,8 @@ That includes: - SAS details (emoji and decimal) when available Incoming verification requests from another Matrix client are tracked and auto-accepted by OpenClaw. -When SAS emoji verification becomes available, OpenClaw starts that SAS flow automatically for inbound requests and confirms its own side. +For self-verification flows, OpenClaw also starts the SAS flow automatically when emoji verification becomes available and confirms its own side. +For verification requests from another Matrix user/device, OpenClaw auto-accepts the request and then waits for the SAS flow to proceed normally. You still need to compare the emoji or decimal SAS in your Matrix client and confirm "They match" there to complete the verification. OpenClaw does not auto-accept self-initiated duplicate flows blindly. Startup skips creating a new request when a self-verification request is already pending. diff --git a/docs/channels/msteams.md b/docs/channels/msteams.md index 88cba3ce6aa..49a9f04347e 100644 --- a/docs/channels/msteams.md +++ b/docs/channels/msteams.md @@ -260,15 +260,17 @@ This is often easier than hand-editing JSON manifests. 4. **Configure OpenClaw** - ```json + ```json5 { - "msteams": { - "enabled": true, - "appId": "", - "appPassword": "", - "tenantId": "", - "webhook": { "port": 3978, "path": "/api/messages" } - } + channels: { + msteams: { + enabled: true, + appId: "", + appPassword: "", + tenantId: "", + webhook: { port: 3978, path: "/api/messages" }, + }, + }, } ``` @@ -312,49 +314,49 @@ These are the **existing resourceSpecific permissions** in our Teams app manifes Minimal, valid example with the required fields. Replace IDs and URLs. -```json +```json5 { - "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.23/MicrosoftTeams.schema.json", - "manifestVersion": "1.23", - "version": "1.0.0", - "id": "00000000-0000-0000-0000-000000000000", - "name": { "short": "OpenClaw" }, - "developer": { - "name": "Your Org", - "websiteUrl": "https://example.com", - "privacyUrl": "https://example.com/privacy", - "termsOfUseUrl": "https://example.com/terms" + $schema: "https://developer.microsoft.com/en-us/json-schemas/teams/v1.23/MicrosoftTeams.schema.json", + manifestVersion: "1.23", + version: "1.0.0", + id: "00000000-0000-0000-0000-000000000000", + name: { short: "OpenClaw" }, + developer: { + name: "Your Org", + websiteUrl: "https://example.com", + privacyUrl: "https://example.com/privacy", + termsOfUseUrl: "https://example.com/terms", }, - "description": { "short": "OpenClaw in Teams", "full": "OpenClaw in Teams" }, - "icons": { "outline": "outline.png", "color": "color.png" }, - "accentColor": "#5B6DEF", - "bots": [ + description: { short: "OpenClaw in Teams", full: "OpenClaw in Teams" }, + icons: { outline: "outline.png", color: "color.png" }, + accentColor: "#5B6DEF", + bots: [ { - "botId": "11111111-1111-1111-1111-111111111111", - "scopes": ["personal", "team", "groupChat"], - "isNotificationOnly": false, - "supportsCalling": false, - "supportsVideo": false, - "supportsFiles": true - } + botId: "11111111-1111-1111-1111-111111111111", + scopes: ["personal", "team", "groupChat"], + isNotificationOnly: false, + supportsCalling: false, + supportsVideo: false, + supportsFiles: true, + }, ], - "webApplicationInfo": { - "id": "11111111-1111-1111-1111-111111111111" + webApplicationInfo: { + id: "11111111-1111-1111-1111-111111111111", + }, + authorization: { + permissions: { + resourceSpecific: [ + { name: "ChannelMessage.Read.Group", type: "Application" }, + { name: "ChannelMessage.Send.Group", type: "Application" }, + { name: "Member.Read.Group", type: "Application" }, + { name: "Owner.Read.Group", type: "Application" }, + { name: "ChannelSettings.Read.Group", type: "Application" }, + { name: "TeamMember.Read.Group", type: "Application" }, + { name: "TeamSettings.Read.Group", type: "Application" }, + { name: "ChatMessage.Read.Chat", type: "Application" }, + ], + }, }, - "authorization": { - "permissions": { - "resourceSpecific": [ - { "name": "ChannelMessage.Read.Group", "type": "Application" }, - { "name": "ChannelMessage.Send.Group", "type": "Application" }, - { "name": "Member.Read.Group", "type": "Application" }, - { "name": "Owner.Read.Group", "type": "Application" }, - { "name": "ChannelSettings.Read.Group", "type": "Application" }, - { "name": "TeamMember.Read.Group", "type": "Application" }, - { "name": "TeamSettings.Read.Group", "type": "Application" }, - { "name": "ChatMessage.Read.Chat", "type": "Application" } - ] - } - } } ``` @@ -500,20 +502,22 @@ Teams recently introduced two channel UI styles over the same underlying data mo **Solution:** Configure `replyStyle` per-channel based on how the channel is set up: -```json +```json5 { - "msteams": { - "replyStyle": "thread", - "teams": { - "19:abc...@thread.tacv2": { - "channels": { - "19:xyz...@thread.tacv2": { - "replyStyle": "top-level" - } - } - } - } - } + channels: { + msteams: { + replyStyle: "thread", + teams: { + "19:abc...@thread.tacv2": { + channels: { + "19:xyz...@thread.tacv2": { + replyStyle: "top-level", + }, + }, + }, + }, + }, + }, } ``` @@ -616,16 +620,16 @@ The `card` parameter accepts an Adaptive Card JSON object. When `card` is provid **Agent tool:** -```json +```json5 { - "action": "send", - "channel": "msteams", - "target": "user:", - "card": { - "type": "AdaptiveCard", - "version": "1.5", - "body": [{ "type": "TextBlock", "text": "Hello!" }] - } + action: "send", + channel: "msteams", + target: "user:", + card: { + type: "AdaptiveCard", + version: "1.5", + body: [{ type: "TextBlock", text: "Hello!" }], + }, } ``` @@ -669,25 +673,25 @@ openclaw message send --channel msteams --target "conversation:19:abc...@thread. **Agent tool examples:** -```json +```json5 { - "action": "send", - "channel": "msteams", - "target": "user:John Smith", - "message": "Hello!" + action: "send", + channel: "msteams", + target: "user:John Smith", + message: "Hello!", } ``` -```json +```json5 { - "action": "send", - "channel": "msteams", - "target": "conversation:19:abc...@thread.tacv2", - "card": { - "type": "AdaptiveCard", - "version": "1.5", - "body": [{ "type": "TextBlock", "text": "Hello" }] - } + action: "send", + channel: "msteams", + target: "conversation:19:abc...@thread.tacv2", + card: { + type: "AdaptiveCard", + version: "1.5", + body: [{ type: "TextBlock", text: "Hello" }], + }, } ``` diff --git a/docs/channels/nostr.md b/docs/channels/nostr.md index c8d5d69753b..d453d9f653c 100644 --- a/docs/channels/nostr.md +++ b/docs/channels/nostr.md @@ -60,13 +60,13 @@ nak key generate 2. Add to config: -```json +```json5 { - "channels": { - "nostr": { - "privateKey": "${NOSTR_PRIVATE_KEY}" - } - } + channels: { + nostr: { + privateKey: "${NOSTR_PRIVATE_KEY}", + }, + }, } ``` @@ -96,23 +96,23 @@ Profile data is published as a NIP-01 `kind:0` event. You can manage it from the Example: -```json +```json5 { - "channels": { - "nostr": { - "privateKey": "${NOSTR_PRIVATE_KEY}", - "profile": { - "name": "openclaw", - "displayName": "OpenClaw", - "about": "Personal assistant DM bot", - "picture": "https://example.com/avatar.png", - "banner": "https://example.com/banner.png", - "website": "https://example.com", - "nip05": "openclaw@example.com", - "lud16": "openclaw@example.com" - } - } - } + channels: { + nostr: { + privateKey: "${NOSTR_PRIVATE_KEY}", + profile: { + name: "openclaw", + displayName: "OpenClaw", + about: "Personal assistant DM bot", + picture: "https://example.com/avatar.png", + banner: "https://example.com/banner.png", + website: "https://example.com", + nip05: "openclaw@example.com", + lud16: "openclaw@example.com", + }, + }, + }, } ``` @@ -132,15 +132,15 @@ Notes: ### Allowlist example -```json +```json5 { - "channels": { - "nostr": { - "privateKey": "${NOSTR_PRIVATE_KEY}", - "dmPolicy": "allowlist", - "allowFrom": ["npub1abc...", "npub1xyz..."] - } - } + channels: { + nostr: { + privateKey: "${NOSTR_PRIVATE_KEY}", + dmPolicy: "allowlist", + allowFrom: ["npub1abc...", "npub1xyz..."], + }, + }, } ``` @@ -155,14 +155,14 @@ Accepted formats: Defaults: `relay.damus.io` and `nos.lol`. -```json +```json5 { - "channels": { - "nostr": { - "privateKey": "${NOSTR_PRIVATE_KEY}", - "relays": ["wss://relay.damus.io", "wss://relay.primal.net", "wss://nostr.wine"] - } - } + channels: { + nostr: { + privateKey: "${NOSTR_PRIVATE_KEY}", + relays: ["wss://relay.damus.io", "wss://relay.primal.net", "wss://nostr.wine"], + }, + }, } ``` @@ -191,14 +191,14 @@ Tips: docker run -p 7777:7777 ghcr.io/hoytech/strfry ``` -```json +```json5 { - "channels": { - "nostr": { - "privateKey": "${NOSTR_PRIVATE_KEY}", - "relays": ["ws://localhost:7777"] - } - } + channels: { + nostr: { + privateKey: "${NOSTR_PRIVATE_KEY}", + relays: ["ws://localhost:7777"], + }, + }, } ``` diff --git a/docs/channels/pairing.md b/docs/channels/pairing.md index 1ba3c6c92f2..592ced0f11d 100644 --- a/docs/channels/pairing.md +++ b/docs/channels/pairing.md @@ -67,7 +67,7 @@ If you use the `device-pair` plugin, you can do first-time device pairing entire 2. The bot replies with two messages: an instruction message and a separate **setup code** message (easy to copy/paste in Telegram). 3. On your phone, open the OpenClaw iOS app → Settings → Gateway. 4. Paste the setup code and connect. -5. Back in Telegram: `/pair approve` +5. Back in Telegram: `/pair pending` (review request IDs, role, and scopes), then approve. The setup code is a base64-encoded JSON payload that contains: @@ -84,6 +84,10 @@ openclaw devices approve openclaw devices reject ``` +If the same device retries with different auth details (for example different +role/scopes/public key), the previous pending request is superseded and a new +`requestId` is created. + ### Node pairing state storage Stored under `~/.openclaw/devices/`: diff --git a/docs/channels/signal.md b/docs/channels/signal.md index cfc050b6e75..fb5747dc417 100644 --- a/docs/channels/signal.md +++ b/docs/channels/signal.md @@ -99,7 +99,7 @@ Example: } ``` -Multi-account support: use `channels.signal.accounts` with per-account config and optional `name`. See [`gateway/configuration`](/gateway/configuration#telegramaccounts--discordaccounts--slackaccounts--signalaccounts--imessageaccounts) for the shared pattern. +Multi-account support: use `channels.signal.accounts` with per-account config and optional `name`. See [`gateway/configuration`](/gateway/configuration-reference#multi-account-all-channels) for the shared pattern. ## Setup path B: register dedicated bot number (SMS, Linux) diff --git a/docs/channels/telegram.md b/docs/channels/telegram.md index 2758982b8d7..91ac3ec4b67 100644 --- a/docs/channels/telegram.md +++ b/docs/channels/telegram.md @@ -346,7 +346,13 @@ curl "https://api.telegram.org/bot/getUpdates" 1. `/pair` generates setup code 2. paste code in iOS app - 3. `/pair approve` approves latest pending request + 3. `/pair pending` lists pending requests (including role/scopes) + 4. approve the request: + - `/pair approve ` for explicit approval + - `/pair approve` when there is only one pending request + - `/pair approve latest` for most recent + + If a device retries with changed auth details (for example role/scopes/public key), the previous pending request is superseded and the new request uses a different `requestId`. Re-run `/pair pending` before approving. More details: [Pairing](/channels/pairing#pair-via-telegram-recommended-for-ios). diff --git a/docs/channels/troubleshooting.md b/docs/channels/troubleshooting.md index a7850801948..106710ca926 100644 --- a/docs/channels/troubleshooting.md +++ b/docs/channels/troubleshooting.md @@ -38,7 +38,7 @@ Healthy baseline: | Group messages ignored | Check `requireMention` + mention patterns in config | Mention the bot or relax mention policy for that group. | | Random disconnect/relogin loops | `openclaw channels status --probe` + logs | Re-login and verify credentials directory is healthy. | -Full troubleshooting: [/channels/whatsapp#troubleshooting-quick](/channels/whatsapp#troubleshooting-quick) +Full troubleshooting: [/channels/whatsapp#troubleshooting](/channels/whatsapp#troubleshooting) ## Telegram @@ -90,7 +90,7 @@ Full troubleshooting: [/channels/slack#troubleshooting](/channels/slack#troubles Full troubleshooting: -- [/channels/imessage#troubleshooting-macos-privacy-and-security-tcc](/channels/imessage#troubleshooting-macos-privacy-and-security-tcc) +- [/channels/imessage#troubleshooting](/channels/imessage#troubleshooting) - [/channels/bluebubbles#troubleshooting](/channels/bluebubbles#troubleshooting) ## Signal diff --git a/docs/channels/twitch.md b/docs/channels/twitch.md index d184a2d8432..98174fdcc7b 100644 --- a/docs/channels/twitch.md +++ b/docs/channels/twitch.md @@ -123,7 +123,7 @@ Prefer `allowFrom` for a hard allowlist. Use `allowedRoles` instead if you want **Why user IDs?** Usernames can change, allowing impersonation. User IDs are permanent. -Find your Twitch user ID: [https://www.streamweasels.com/tools/convert-twitch-username-%20to-user-id/](https://www.streamweasels.com/tools/convert-twitch-username-%20to-user-id/) (Convert your Twitch username to ID) +Find your Twitch user ID: [https://www.streamweasels.com/tools/convert-twitch-username-to-user-id/](https://www.streamweasels.com/tools/convert-twitch-username-to-user-id/) (Convert your Twitch username to ID) ## Token refresh (optional) diff --git a/docs/ci.md b/docs/ci.md index e8710b87cb1..36e5fba0d8c 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -1,6 +1,5 @@ --- title: CI Pipeline -description: How the OpenClaw CI pipeline works summary: "CI job graph, scope gates, and local command equivalents" read_when: - You need to understand why a CI job did or did not run diff --git a/docs/cli/devices.md b/docs/cli/devices.md index f73f30dfa1d..fa0d53a2401 100644 --- a/docs/cli/devices.md +++ b/docs/cli/devices.md @@ -21,6 +21,9 @@ openclaw devices list openclaw devices list --json ``` +Pending request output includes the requested role and scopes so approvals can +be reviewed before you approve. + ### `openclaw devices remove ` Remove one paired device entry. @@ -45,6 +48,11 @@ openclaw devices clear --yes --pending --json Approve a pending device pairing request. If `requestId` is omitted, OpenClaw automatically approves the most recent pending request. +Note: if a device retries pairing with changed auth details (role/scopes/public +key), OpenClaw supersedes the previous pending entry and issues a new +`requestId`. Run `openclaw devices list` right before approval to use the +current ID. + ``` openclaw devices approve openclaw devices approve diff --git a/docs/cli/node.md b/docs/cli/node.md index baf8c3cd45e..a1f882a7870 100644 --- a/docs/cli/node.md +++ b/docs/cli/node.md @@ -111,6 +111,10 @@ openclaw devices list openclaw devices approve ``` +If the node retries pairing with changed auth details (role/scopes/public key), +the previous pending request is superseded and a new `requestId` is created. +Run `openclaw devices list` again before approval. + The node host stores its node id, token, display name, and gateway connection info in `~/.openclaw/node.json`. diff --git a/docs/cli/plugins.md b/docs/cli/plugins.md index 47ef4930b8a..3d4c482707f 100644 --- a/docs/cli/plugins.md +++ b/docs/cli/plugins.md @@ -138,14 +138,24 @@ state dir extensions root (`$OPENCLAW_STATE_DIR/extensions/`). Use ### Update ```bash -openclaw plugins update +openclaw plugins update openclaw plugins update --all -openclaw plugins update --dry-run +openclaw plugins update --dry-run +openclaw plugins update @openclaw/voice-call@beta ``` Updates apply to tracked installs in `plugins.installs`, currently npm and marketplace installs. +When you pass a plugin id, OpenClaw reuses the recorded install spec for that +plugin. That means previously stored dist-tags such as `@beta` and exact pinned +versions continue to be used on later `update ` runs. + +For npm installs, you can also pass an explicit npm package spec with a dist-tag +or exact version. OpenClaw resolves that package name back to the tracked plugin +record, updates that installed plugin, and records the new npm spec for future +id-based updates. + When a stored integrity hash exists and the fetched artifact hash changes, OpenClaw prints a warning and asks for confirmation before proceeding. Use global `--yes` to bypass prompts in CI/non-interactive runs. diff --git a/docs/cli/sessions.md b/docs/cli/sessions.md index 6ea2df094f0..bb75782c4cd 100644 --- a/docs/cli/sessions.md +++ b/docs/cli/sessions.md @@ -46,7 +46,7 @@ JSON examples: "activeMinutes": null, "sessions": [ { "agentId": "main", "key": "agent:main:main", "model": "gpt-5" }, - { "agentId": "work", "key": "agent:work:main", "model": "claude-opus-4-5" } + { "agentId": "work", "key": "agent:work:main", "model": "claude-opus-4-6" } ] } ``` diff --git a/docs/concepts/agent.md b/docs/concepts/agent.md index 26d677745e4..e719c452643 100644 --- a/docs/concepts/agent.md +++ b/docs/concepts/agent.md @@ -1,13 +1,13 @@ --- -summary: "Agent runtime (embedded pi-mono), workspace contract, and session bootstrap" +summary: "Agent runtime, workspace contract, and session bootstrap" read_when: - Changing agent runtime, workspace bootstrap, or session behavior title: "Agent Runtime" --- -# Agent Runtime 🤖 +# Agent Runtime -OpenClaw runs a single embedded agent runtime derived from **pi-mono**. +OpenClaw runs a single embedded agent runtime. ## Workspace (required) @@ -63,12 +63,11 @@ OpenClaw loads skills from three locations (workspace wins on name conflict): Skills can be gated by config/env (see `skills` in [Gateway configuration](/gateway/configuration)). -## pi-mono integration +## Runtime boundaries -OpenClaw reuses pieces of the pi-mono codebase (models/tools), but **session management, discovery, and tool wiring are OpenClaw-owned**. - -- No pi-coding agent runtime. -- No `~/.pi/agent` or `/.pi` settings are consulted. +The embedded agent runtime is built on the Pi agent core (models, tools, and +prompt pipeline). Session management, discovery, tool wiring, and channel +delivery are OpenClaw-owned layers on top of that core. ## Sessions @@ -77,7 +76,7 @@ Session transcripts are stored as JSONL at: - `~/.openclaw/agents//sessions/.jsonl` The session ID is stable and chosen by OpenClaw. -Legacy Pi/Tau session folders are **not** read. +Legacy session folders from other tools are not read. ## Steering while streaming diff --git a/docs/concepts/architecture.md b/docs/concepts/architecture.md index a36c93313c6..f32a6d3649f 100644 --- a/docs/concepts/architecture.md +++ b/docs/concepts/architecture.md @@ -7,8 +7,6 @@ title: "Gateway Architecture" # Gateway architecture -Last updated: 2026-01-22 - ## Overview - A single long‑lived **Gateway** owns all messaging surfaces (WhatsApp via diff --git a/docs/concepts/compaction.md b/docs/concepts/compaction.md index 550d3b385d4..87ef2aaf9b1 100644 --- a/docs/concepts/compaction.md +++ b/docs/concepts/compaction.md @@ -31,7 +31,7 @@ You can optionally specify a different model for compaction summarization via `a "agents": { "defaults": { "compaction": { - "model": "openrouter/anthropic/claude-sonnet-4-5" + "model": "openrouter/anthropic/claude-sonnet-4-6" } } } diff --git a/docs/concepts/features.md b/docs/concepts/features.md index 03528032b40..56c486ea6f5 100644 --- a/docs/concepts/features.md +++ b/docs/concepts/features.md @@ -32,24 +32,42 @@ title: "Features" ## Full list -- WhatsApp integration via WhatsApp Web (Baileys) -- Telegram bot support (grammY) -- Discord bot support (channels.discord.js) -- Mattermost bot support (plugin) -- iMessage integration via local imsg CLI (macOS) -- Agent bridge for Pi in RPC mode with tool streaming -- Streaming and chunking for long responses -- Multi-agent routing for isolated sessions per workspace or sender -- Subscription auth for Anthropic and OpenAI via OAuth -- Sessions: direct chats collapse into shared `main`; groups are isolated -- Group chat support with mention based activation -- Media support for images, audio, and documents -- Optional voice note transcription hook -- WebChat and macOS menu bar app -- iOS node with pairing, Canvas, camera, screen recording, location, and voice features -- Android node with pairing, Connect tab, chat sessions, voice tab, Canvas/camera, plus device, notifications, contacts/calendar, motion, photos, and SMS commands +**Channels:** - -Legacy Claude, Codex, Gemini, and Opencode paths have been removed. Pi is the only -coding agent path. - +- WhatsApp, Telegram, Discord, iMessage (built-in) +- Mattermost, Matrix, MS Teams, Nostr, and more (plugins) +- Group chat support with mention-based activation +- DM safety with allowlists and pairing + +**Agent:** + +- Embedded agent runtime with tool streaming +- Multi-agent routing with isolated sessions per workspace or sender +- Sessions: direct chats collapse into shared `main`; groups are isolated +- Streaming and chunking for long responses + +**Auth and providers:** + +- 35+ model providers (Anthropic, OpenAI, Google, and more) +- Subscription auth via OAuth (e.g. OpenAI Codex) +- Custom and self-hosted provider support (vLLM, SGLang, Ollama, and any OpenAI-compatible or Anthropic-compatible endpoint) + +**Media:** + +- Images, audio, video, and documents in and out +- Voice note transcription +- Text-to-speech with multiple providers + +**Apps and interfaces:** + +- WebChat and browser Control UI +- macOS menu bar companion app +- iOS node with pairing, Canvas, camera, screen recording, location, and voice +- Android node with pairing, chat, voice, Canvas, camera, and device commands + +**Tools and automation:** + +- Browser automation, exec, sandboxing +- Web search (Brave, Perplexity, Gemini, Grok, Kimi, Firecrawl) +- Cron jobs and heartbeat scheduling +- Skills, plugins, and workflow pipelines (Lobster) diff --git a/docs/concepts/memory.md b/docs/concepts/memory.md index 2649125dc45..f1f60071bc2 100644 --- a/docs/concepts/memory.md +++ b/docs/concepts/memory.md @@ -34,8 +34,8 @@ These files live under the workspace (`agents.defaults.workspace`, default OpenClaw exposes two agent-facing tools for these Markdown files: -- `memory_search` — semantic recall over indexed snippets. -- `memory_get` — targeted read of a specific Markdown file/line range. +- `memory_search` -- semantic recall over indexed snippets. +- `memory_get` -- targeted read of a specific Markdown file/line range. `memory_get` now **degrades gracefully when a file doesn't exist** (for example, today's daily log before the first write). Both the builtin manager and the QMD @@ -94,709 +94,15 @@ For the full compaction lifecycle, see ## Vector memory search OpenClaw can build a small vector index over `MEMORY.md` and `memory/*.md` so -semantic queries can find related notes even when wording differs. - -Defaults: - -- Enabled by default. -- Watches memory files for changes (debounced). -- Configure memory search under `agents.defaults.memorySearch` (not top-level - `memorySearch`). -- Uses remote embeddings by default. If `memorySearch.provider` is not set, OpenClaw auto-selects: - 1. `local` if a `memorySearch.local.modelPath` is configured and the file exists. - 2. `openai` if an OpenAI key can be resolved. - 3. `gemini` if a Gemini key can be resolved. - 4. `voyage` if a Voyage key can be resolved. - 5. `mistral` if a Mistral key can be resolved. - 6. Otherwise memory search stays disabled until configured. -- Local mode uses node-llama-cpp and may require `pnpm approve-builds`. -- Uses sqlite-vec (when available) to accelerate vector search inside SQLite. -- `memorySearch.provider = "ollama"` is also supported for local/self-hosted - Ollama embeddings (`/api/embeddings`), but it is not auto-selected. - -Remote embeddings **require** an API key for the embedding provider. OpenClaw -resolves keys from auth profiles, `models.providers.*.apiKey`, or environment -variables. Codex OAuth only covers chat/completions and does **not** satisfy -embeddings for memory search. For Gemini, use `GEMINI_API_KEY` or -`models.providers.google.apiKey`. For Voyage, use `VOYAGE_API_KEY` or -`models.providers.voyage.apiKey`. For Mistral, use `MISTRAL_API_KEY` or -`models.providers.mistral.apiKey`. Ollama typically does not require a real API -key (a placeholder like `OLLAMA_API_KEY=ollama-local` is enough when needed by -local policy). -When using a custom OpenAI-compatible endpoint, -set `memorySearch.remote.apiKey` (and optional `memorySearch.remote.headers`). - -### QMD backend (experimental) - -Set `memory.backend = "qmd"` to swap the built-in SQLite indexer for -[QMD](https://github.com/tobi/qmd): a local-first search sidecar that combines -BM25 + vectors + reranking. Markdown stays the source of truth; OpenClaw shells -out to QMD for retrieval. Key points: - -**Prereqs** - -- Disabled by default. Opt in per-config (`memory.backend = "qmd"`). -- Install the QMD CLI separately (`bun install -g https://github.com/tobi/qmd` or grab - a release) and make sure the `qmd` binary is on the gateway’s `PATH`. -- QMD needs an SQLite build that allows extensions (`brew install sqlite` on - macOS). -- QMD runs fully locally via Bun + `node-llama-cpp` and auto-downloads GGUF - models from HuggingFace on first use (no separate Ollama daemon required). -- The gateway runs QMD in a self-contained XDG home under - `~/.openclaw/agents//qmd/` by setting `XDG_CONFIG_HOME` and - `XDG_CACHE_HOME`. -- OS support: macOS and Linux work out of the box once Bun + SQLite are - installed. Windows is best supported via WSL2. - -**How the sidecar runs** - -- The gateway writes a self-contained QMD home under - `~/.openclaw/agents//qmd/` (config + cache + sqlite DB). -- Collections are created via `qmd collection add` from `memory.qmd.paths` - (plus default workspace memory files), then `qmd update` + `qmd embed` run - on boot and on a configurable interval (`memory.qmd.update.interval`, - default 5 m). -- The gateway now initializes the QMD manager on startup, so periodic update - timers are armed even before the first `memory_search` call. -- Boot refresh now runs in the background by default so chat startup is not - blocked; set `memory.qmd.update.waitForBootSync = true` to keep the previous - blocking behavior. -- Searches run via `memory.qmd.searchMode` (default `qmd search --json`; also - supports `vsearch` and `query`). If the selected mode rejects flags on your - QMD build, OpenClaw retries with `qmd query`. If QMD fails or the binary is - missing, OpenClaw automatically falls back to the builtin SQLite manager so - memory tools keep working. -- OpenClaw does not expose QMD embed batch-size tuning today; batch behavior is - controlled by QMD itself. -- **First search may be slow**: QMD may download local GGUF models (reranker/query - expansion) on the first `qmd query` run. - - OpenClaw sets `XDG_CONFIG_HOME`/`XDG_CACHE_HOME` automatically when it runs QMD. - - If you want to pre-download models manually (and warm the same index OpenClaw - uses), run a one-off query with the agent’s XDG dirs. - - OpenClaw’s QMD state lives under your **state dir** (defaults to `~/.openclaw`). - You can point `qmd` at the exact same index by exporting the same XDG vars - OpenClaw uses: - - ```bash - # Pick the same state dir OpenClaw uses - STATE_DIR="${OPENCLAW_STATE_DIR:-$HOME/.openclaw}" - - export XDG_CONFIG_HOME="$STATE_DIR/agents/main/qmd/xdg-config" - export XDG_CACHE_HOME="$STATE_DIR/agents/main/qmd/xdg-cache" - - # (Optional) force an index refresh + embeddings - qmd update - qmd embed - - # Warm up / trigger first-time model downloads - qmd query "test" -c memory-root --json >/dev/null 2>&1 - ``` - -**Config surface (`memory.qmd.*`)** - -- `command` (default `qmd`): override the executable path. -- `searchMode` (default `search`): pick which QMD command backs - `memory_search` (`search`, `vsearch`, `query`). -- `includeDefaultMemory` (default `true`): auto-index `MEMORY.md` + `memory/**/*.md`. -- `paths[]`: add extra directories/files (`path`, optional `pattern`, optional - stable `name`). -- `sessions`: opt into session JSONL indexing (`enabled`, `retentionDays`, - `exportDir`). -- `update`: controls refresh cadence and maintenance execution: - (`interval`, `debounceMs`, `onBoot`, `waitForBootSync`, `embedInterval`, - `commandTimeoutMs`, `updateTimeoutMs`, `embedTimeoutMs`). -- `limits`: clamp recall payload (`maxResults`, `maxSnippetChars`, - `maxInjectedChars`, `timeoutMs`). -- `scope`: same schema as [`session.sendPolicy`](/gateway/configuration#session). - Default is DM-only (`deny` all, `allow` direct chats); loosen it to surface QMD - hits in groups/channels. - - `match.keyPrefix` matches the **normalized** session key (lowercased, with any - leading `agent::` stripped). Example: `discord:channel:`. - - `match.rawKeyPrefix` matches the **raw** session key (lowercased), including - `agent::`. Example: `agent:main:discord:`. - - Legacy: `match.keyPrefix: "agent:..."` is still treated as a raw-key prefix, - but prefer `rawKeyPrefix` for clarity. -- When `scope` denies a search, OpenClaw logs a warning with the derived - `channel`/`chatType` so empty results are easier to debug. -- Snippets sourced outside the workspace show up as - `qmd//` in `memory_search` results; `memory_get` - understands that prefix and reads from the configured QMD collection root. -- When `memory.qmd.sessions.enabled = true`, OpenClaw exports sanitized session - transcripts (User/Assistant turns) into a dedicated QMD collection under - `~/.openclaw/agents//qmd/sessions/`, so `memory_search` can recall recent - conversations without touching the builtin SQLite index. -- `memory_search` snippets now include a `Source: ` footer when - `memory.citations` is `auto`/`on`; set `memory.citations = "off"` to keep - the path metadata internal (the agent still receives the path for - `memory_get`, but the snippet text omits the footer and the system prompt - warns the agent not to cite it). - -**Example** - -```json5 -memory: { - backend: "qmd", - citations: "auto", - qmd: { - includeDefaultMemory: true, - update: { interval: "5m", debounceMs: 15000 }, - limits: { maxResults: 6, timeoutMs: 4000 }, - scope: { - default: "deny", - rules: [ - { action: "allow", match: { chatType: "direct" } }, - // Normalized session-key prefix (strips `agent::`). - { action: "deny", match: { keyPrefix: "discord:channel:" } }, - // Raw session-key prefix (includes `agent::`). - { action: "deny", match: { rawKeyPrefix: "agent:main:discord:" } }, - ] - }, - paths: [ - { name: "docs", path: "~/notes", pattern: "**/*.md" } - ] - } -} -``` - -**Citations & fallback** - -- `memory.citations` applies regardless of backend (`auto`/`on`/`off`). -- When `qmd` runs, we tag `status().backend = "qmd"` so diagnostics show which - engine served the results. If the QMD subprocess exits or JSON output can’t be - parsed, the search manager logs a warning and returns the builtin provider - (existing Markdown embeddings) until QMD recovers. - -### Additional memory paths - -If you want to index Markdown files outside the default workspace layout, add -explicit paths: - -```json5 -agents: { - defaults: { - memorySearch: { - extraPaths: ["../team-docs", "/srv/shared-notes/overview.md"] - } - } -} -``` - -Notes: - -- Paths can be absolute or workspace-relative. -- Directories are scanned recursively for `.md` files. -- By default, only Markdown files are indexed. -- If `memorySearch.multimodal.enabled = true`, OpenClaw also indexes supported image/audio files under `extraPaths` only. Default memory roots (`MEMORY.md`, `memory.md`, `memory/**/*.md`) stay Markdown-only. -- Symlinks are ignored (files or directories). - -### Multimodal memory files (Gemini image + audio) - -OpenClaw can index image and audio files from `memorySearch.extraPaths` when using Gemini embedding 2: - -```json5 -agents: { - defaults: { - memorySearch: { - provider: "gemini", - model: "gemini-embedding-2-preview", - extraPaths: ["assets/reference", "voice-notes"], - multimodal: { - enabled: true, - modalities: ["image", "audio"], // or ["all"] - maxFileBytes: 10000000 - }, - remote: { - apiKey: "YOUR_GEMINI_API_KEY" - } - } - } -} -``` - -Notes: - -- Multimodal memory is currently supported only for `gemini-embedding-2-preview`. -- Multimodal indexing applies only to files discovered through `memorySearch.extraPaths`. -- Supported modalities in this phase: image and audio. -- `memorySearch.fallback` must stay `"none"` while multimodal memory is enabled. -- Matching image/audio file bytes are uploaded to the configured Gemini embedding endpoint during indexing. -- Supported image extensions: `.jpg`, `.jpeg`, `.png`, `.webp`, `.gif`, `.heic`, `.heif`. -- Supported audio extensions: `.mp3`, `.wav`, `.ogg`, `.opus`, `.m4a`, `.aac`, `.flac`. -- Search queries remain text, but Gemini can compare those text queries against indexed image/audio embeddings. -- `memory_get` still reads Markdown only; binary files are searchable but not returned as raw file contents. - -### Gemini embeddings (native) - -Set the provider to `gemini` to use the Gemini embeddings API directly: - -```json5 -agents: { - defaults: { - memorySearch: { - provider: "gemini", - model: "gemini-embedding-001", - remote: { - apiKey: "YOUR_GEMINI_API_KEY" - } - } - } -} -``` - -Notes: - -- `remote.baseUrl` is optional (defaults to the Gemini API base URL). -- `remote.headers` lets you add extra headers if needed. -- Default model: `gemini-embedding-001`. -- `gemini-embedding-2-preview` is also supported: 8192 token limit and configurable dimensions (768 / 1536 / 3072, default 3072). - -#### Gemini Embedding 2 (preview) - -```json5 -agents: { - defaults: { - memorySearch: { - provider: "gemini", - model: "gemini-embedding-2-preview", - outputDimensionality: 3072, // optional: 768, 1536, or 3072 (default) - remote: { - apiKey: "YOUR_GEMINI_API_KEY" - } - } - } -} -``` - -> **⚠️ Re-index required:** Switching from `gemini-embedding-001` (768 dimensions) -> to `gemini-embedding-2-preview` (3072 dimensions) changes the vector size. The same is true if you -> change `outputDimensionality` between 768, 1536, and 3072. -> OpenClaw will automatically reindex when it detects a model or dimension change. - -If you want to use a **custom OpenAI-compatible endpoint** (OpenRouter, vLLM, or a proxy), -you can use the `remote` configuration with the OpenAI provider: - -```json5 -agents: { - defaults: { - memorySearch: { - provider: "openai", - model: "text-embedding-3-small", - remote: { - baseUrl: "https://api.example.com/v1/", - apiKey: "YOUR_OPENAI_COMPAT_API_KEY", - headers: { "X-Custom-Header": "value" } - } - } - } -} -``` - -If you don't want to set an API key, use `memorySearch.provider = "local"` or set -`memorySearch.fallback = "none"`. - -Fallbacks: - -- `memorySearch.fallback` can be `openai`, `gemini`, `voyage`, `mistral`, `ollama`, `local`, or `none`. -- The fallback provider is only used when the primary embedding provider fails. - -Batch indexing (OpenAI + Gemini + Voyage): - -- Disabled by default. Set `agents.defaults.memorySearch.remote.batch.enabled = true` to enable for large-corpus indexing (OpenAI, Gemini, and Voyage). -- Default behavior waits for batch completion; tune `remote.batch.wait`, `remote.batch.pollIntervalMs`, and `remote.batch.timeoutMinutes` if needed. -- Set `remote.batch.concurrency` to control how many batch jobs we submit in parallel (default: 2). -- Batch mode applies when `memorySearch.provider = "openai"` or `"gemini"` and uses the corresponding API key. -- Gemini batch jobs use the async embeddings batch endpoint and require Gemini Batch API availability. - -Why OpenAI batch is fast + cheap: - -- For large backfills, OpenAI is typically the fastest option we support because we can submit many embedding requests in a single batch job and let OpenAI process them asynchronously. -- OpenAI offers discounted pricing for Batch API workloads, so large indexing runs are usually cheaper than sending the same requests synchronously. -- See the OpenAI Batch API docs and pricing for details: - - [https://platform.openai.com/docs/api-reference/batch](https://platform.openai.com/docs/api-reference/batch) - - [https://platform.openai.com/pricing](https://platform.openai.com/pricing) - -Config example: - -```json5 -agents: { - defaults: { - memorySearch: { - provider: "openai", - model: "text-embedding-3-small", - fallback: "openai", - remote: { - batch: { enabled: true, concurrency: 2 } - }, - sync: { watch: true } - } - } -} -``` - -Tools: - -- `memory_search` — returns snippets with file + line ranges. -- `memory_get` — read memory file content by path. - -Local mode: - -- Set `agents.defaults.memorySearch.provider = "local"`. -- Provide `agents.defaults.memorySearch.local.modelPath` (GGUF or `hf:` URI). -- Optional: set `agents.defaults.memorySearch.fallback = "none"` to avoid remote fallback. - -### How the memory tools work - -- `memory_search` semantically searches Markdown chunks (~400 token target, 80-token overlap) from `MEMORY.md` + `memory/**/*.md`. It returns snippet text (capped ~700 chars), file path, line range, score, provider/model, and whether we fell back from local → remote embeddings. No full file payload is returned. -- `memory_get` reads a specific memory Markdown file (workspace-relative), optionally from a starting line and for N lines. Paths outside `MEMORY.md` / `memory/` are rejected. -- Both tools are enabled only when `memorySearch.enabled` resolves true for the agent. - -### What gets indexed (and when) - -- File type: Markdown only (`MEMORY.md`, `memory/**/*.md`). -- Index storage: per-agent SQLite at `~/.openclaw/memory/.sqlite` (configurable via `agents.defaults.memorySearch.store.path`, supports `{agentId}` token). -- Freshness: watcher on `MEMORY.md` + `memory/` marks the index dirty (debounce 1.5s). Sync is scheduled on session start, on search, or on an interval and runs asynchronously. Session transcripts use delta thresholds to trigger background sync. -- Reindex triggers: the index stores the embedding **provider/model + endpoint fingerprint + chunking params**. If any of those change, OpenClaw automatically resets and reindexes the entire store. - -### Hybrid search (BM25 + vector) - -When enabled, OpenClaw combines: - -- **Vector similarity** (semantic match, wording can differ) -- **BM25 keyword relevance** (exact tokens like IDs, env vars, code symbols) - -If full-text search is unavailable on your platform, OpenClaw falls back to vector-only search. - -#### Why hybrid? - -Vector search is great at “this means the same thing”: - -- “Mac Studio gateway host” vs “the machine running the gateway” -- “debounce file updates” vs “avoid indexing on every write” - -But it can be weak at exact, high-signal tokens: - -- IDs (`a828e60`, `b3b9895a…`) -- code symbols (`memorySearch.query.hybrid`) -- error strings ("sqlite-vec unavailable") - -BM25 (full-text) is the opposite: strong at exact tokens, weaker at paraphrases. -Hybrid search is the pragmatic middle ground: **use both retrieval signals** so you get -good results for both "natural language" queries and "needle in a haystack" queries. - -#### How we merge results (the current design) - -Implementation sketch: - -1. Retrieve a candidate pool from both sides: - -- **Vector**: top `maxResults * candidateMultiplier` by cosine similarity. -- **BM25**: top `maxResults * candidateMultiplier` by FTS5 BM25 rank (lower is better). - -2. Convert BM25 rank into a 0..1-ish score: - -- `textScore = 1 / (1 + max(0, bm25Rank))` - -3. Union candidates by chunk id and compute a weighted score: - -- `finalScore = vectorWeight * vectorScore + textWeight * textScore` - -Notes: - -- `vectorWeight` + `textWeight` is normalized to 1.0 in config resolution, so weights behave as percentages. -- If embeddings are unavailable (or the provider returns a zero-vector), we still run BM25 and return keyword matches. -- If FTS5 can't be created, we keep vector-only search (no hard failure). - -This isn't "IR-theory perfect", but it's simple, fast, and tends to improve recall/precision on real notes. -If we want to get fancier later, common next steps are Reciprocal Rank Fusion (RRF) or score normalization -(min/max or z-score) before mixing. - -#### Post-processing pipeline - -After merging vector and keyword scores, two optional post-processing stages -refine the result list before it reaches the agent: - -``` -Vector + Keyword → Weighted Merge → Temporal Decay → Sort → MMR → Top-K Results -``` - -Both stages are **off by default** and can be enabled independently. - -#### MMR re-ranking (diversity) - -When hybrid search returns results, multiple chunks may contain similar or overlapping content. -For example, searching for "home network setup" might return five nearly identical snippets -from different daily notes that all mention the same router configuration. - -**MMR (Maximal Marginal Relevance)** re-ranks the results to balance relevance with diversity, -ensuring the top results cover different aspects of the query instead of repeating the same information. - -How it works: - -1. Results are scored by their original relevance (vector + BM25 weighted score). -2. MMR iteratively selects results that maximize: `λ × relevance − (1−λ) × max_similarity_to_selected`. -3. Similarity between results is measured using Jaccard text similarity on tokenized content. - -The `lambda` parameter controls the trade-off: - -- `lambda = 1.0` → pure relevance (no diversity penalty) -- `lambda = 0.0` → maximum diversity (ignores relevance) -- Default: `0.7` (balanced, slight relevance bias) - -**Example — query: "home network setup"** - -Given these memory files: - -``` -memory/2026-02-10.md → "Configured Omada router, set VLAN 10 for IoT devices" -memory/2026-02-08.md → "Configured Omada router, moved IoT to VLAN 10" -memory/2026-02-05.md → "Set up AdGuard DNS on 192.168.10.2" -memory/network.md → "Router: Omada ER605, AdGuard: 192.168.10.2, VLAN 10: IoT" -``` - -Without MMR — top 3 results: - -``` -1. memory/2026-02-10.md (score: 0.92) ← router + VLAN -2. memory/2026-02-08.md (score: 0.89) ← router + VLAN (near-duplicate!) -3. memory/network.md (score: 0.85) ← reference doc -``` - -With MMR (λ=0.7) — top 3 results: - -``` -1. memory/2026-02-10.md (score: 0.92) ← router + VLAN -2. memory/network.md (score: 0.85) ← reference doc (diverse!) -3. memory/2026-02-05.md (score: 0.78) ← AdGuard DNS (diverse!) -``` - -The near-duplicate from Feb 8 drops out, and the agent gets three distinct pieces of information. - -**When to enable:** If you notice `memory_search` returning redundant or near-duplicate snippets, -especially with daily notes that often repeat similar information across days. - -#### Temporal decay (recency boost) - -Agents with daily notes accumulate hundreds of dated files over time. Without decay, -a well-worded note from six months ago can outrank yesterday's update on the same topic. - -**Temporal decay** applies an exponential multiplier to scores based on the age of each result, -so recent memories naturally rank higher while old ones fade: - -``` -decayedScore = score × e^(-λ × ageInDays) -``` - -where `λ = ln(2) / halfLifeDays`. - -With the default half-life of 30 days: - -- Today's notes: **100%** of original score -- 7 days ago: **~84%** -- 30 days ago: **50%** -- 90 days ago: **12.5%** -- 180 days ago: **~1.6%** - -**Evergreen files are never decayed:** - -- `MEMORY.md` (root memory file) -- Non-dated files in `memory/` (e.g., `memory/projects.md`, `memory/network.md`) -- These contain durable reference information that should always rank normally. - -**Dated daily files** (`memory/YYYY-MM-DD.md`) use the date extracted from the filename. -Other sources (e.g., session transcripts) fall back to file modification time (`mtime`). - -**Example — query: "what's Rod's work schedule?"** - -Given these memory files (today is Feb 10): - -``` -memory/2025-09-15.md → "Rod works Mon-Fri, standup at 10am, pairing at 2pm" (148 days old) -memory/2026-02-10.md → "Rod has standup at 14:15, 1:1 with Zeb at 14:45" (today) -memory/2026-02-03.md → "Rod started new team, standup moved to 14:15" (7 days old) -``` - -Without decay: - -``` -1. memory/2025-09-15.md (score: 0.91) ← best semantic match, but stale! -2. memory/2026-02-10.md (score: 0.82) -3. memory/2026-02-03.md (score: 0.80) -``` - -With decay (halfLife=30): - -``` -1. memory/2026-02-10.md (score: 0.82 × 1.00 = 0.82) ← today, no decay -2. memory/2026-02-03.md (score: 0.80 × 0.85 = 0.68) ← 7 days, mild decay -3. memory/2025-09-15.md (score: 0.91 × 0.03 = 0.03) ← 148 days, nearly gone -``` - -The stale September note drops to the bottom despite having the best raw semantic match. - -**When to enable:** If your agent has months of daily notes and you find that old, -stale information outranks recent context. A half-life of 30 days works well for -daily-note-heavy workflows; increase it (e.g., 90 days) if you reference older notes frequently. - -#### Configuration - -Both features are configured under `memorySearch.query.hybrid`: - -```json5 -agents: { - defaults: { - memorySearch: { - query: { - hybrid: { - enabled: true, - vectorWeight: 0.7, - textWeight: 0.3, - candidateMultiplier: 4, - // Diversity: reduce redundant results - mmr: { - enabled: true, // default: false - lambda: 0.7 // 0 = max diversity, 1 = max relevance - }, - // Recency: boost newer memories - temporalDecay: { - enabled: true, // default: false - halfLifeDays: 30 // score halves every 30 days - } - } - } - } - } -} -``` - -You can enable either feature independently: - -- **MMR only** — useful when you have many similar notes but age doesn't matter. -- **Temporal decay only** — useful when recency matters but your results are already diverse. -- **Both** — recommended for agents with large, long-running daily note histories. - -### Embedding cache - -OpenClaw can cache **chunk embeddings** in SQLite so reindexing and frequent updates (especially session transcripts) don't re-embed unchanged text. - -Config: - -```json5 -agents: { - defaults: { - memorySearch: { - cache: { - enabled: true, - maxEntries: 50000 - } - } - } -} -``` - -### Session memory search (experimental) - -You can optionally index **session transcripts** and surface them via `memory_search`. -This is gated behind an experimental flag. - -```json5 -agents: { - defaults: { - memorySearch: { - experimental: { sessionMemory: true }, - sources: ["memory", "sessions"] - } - } -} -``` - -Notes: - -- Session indexing is **opt-in** (off by default). -- Session updates are debounced and **indexed asynchronously** once they cross delta thresholds (best-effort). -- `memory_search` never blocks on indexing; results can be slightly stale until background sync finishes. -- Results still include snippets only; `memory_get` remains limited to memory files. -- Session indexing is isolated per agent (only that agent’s session logs are indexed). -- Session logs live on disk (`~/.openclaw/agents//sessions/*.jsonl`). Any process/user with filesystem access can read them, so treat disk access as the trust boundary. For stricter isolation, run agents under separate OS users or hosts. - -Delta thresholds (defaults shown): - -```json5 -agents: { - defaults: { - memorySearch: { - sync: { - sessions: { - deltaBytes: 100000, // ~100 KB - deltaMessages: 50 // JSONL lines - } - } - } - } -} -``` - -### SQLite vector acceleration (sqlite-vec) - -When the sqlite-vec extension is available, OpenClaw stores embeddings in a -SQLite virtual table (`vec0`) and performs vector distance queries in the -database. This keeps search fast without loading every embedding into JS. - -Configuration (optional): - -```json5 -agents: { - defaults: { - memorySearch: { - store: { - vector: { - enabled: true, - extensionPath: "/path/to/sqlite-vec" - } - } - } - } -} -``` - -Notes: - -- `enabled` defaults to true; when disabled, search falls back to in-process - cosine similarity over stored embeddings. -- If the sqlite-vec extension is missing or fails to load, OpenClaw logs the - error and continues with the JS fallback (no vector table). -- `extensionPath` overrides the bundled sqlite-vec path (useful for custom builds - or non-standard install locations). - -### Local embedding auto-download - -- Default local embedding model: `hf:ggml-org/embeddinggemma-300m-qat-q8_0-GGUF/embeddinggemma-300m-qat-Q8_0.gguf` (~0.6 GB). -- When `memorySearch.provider = "local"`, `node-llama-cpp` resolves `modelPath`; if the GGUF is missing it **auto-downloads** to the cache (or `local.modelCacheDir` if set), then loads it. Downloads resume on retry. -- Native build requirement: run `pnpm approve-builds`, pick `node-llama-cpp`, then `pnpm rebuild node-llama-cpp`. -- Fallback: if local setup fails and `memorySearch.fallback = "openai"`, we automatically switch to remote embeddings (`openai/text-embedding-3-small` unless overridden) and record the reason. - -### Custom OpenAI-compatible endpoint example - -```json5 -agents: { - defaults: { - memorySearch: { - provider: "openai", - model: "text-embedding-3-small", - remote: { - baseUrl: "https://api.example.com/v1/", - apiKey: "YOUR_REMOTE_API_KEY", - headers: { - "X-Organization": "org-id", - "X-Project": "project-id" - } - } - } - } -} -``` - -Notes: - -- `remote.*` takes precedence over `models.providers.openai.*`. -- `remote.headers` merge with OpenAI headers; remote wins on key conflicts. Omit `remote.headers` to use the OpenAI defaults. +semantic queries can find related notes even when wording differs. Hybrid search +(BM25 + vector) is available for combining semantic matching with exact keyword +lookups. + +Memory search supports multiple embedding providers (OpenAI, Gemini, Voyage, +Mistral, Ollama, and local GGUF models), an optional QMD sidecar backend for +advanced retrieval, and post-processing features like MMR diversity re-ranking +and temporal decay. + +For the full configuration reference -- including embedding provider setup, QMD +backend, hybrid search tuning, multimodal memory, and all config knobs -- see +[Memory configuration reference](/reference/memory-config). diff --git a/docs/concepts/messages.md b/docs/concepts/messages.md index 4930002187e..e94092e7bbc 100644 --- a/docs/concepts/messages.md +++ b/docs/concepts/messages.md @@ -151,4 +151,4 @@ Outbound message formatting is centralized in `messages`: - `messages.responsePrefix`, `channels..responsePrefix`, and `channels..accounts..responsePrefix` (outbound prefix cascade), plus `channels.whatsapp.messagePrefix` (WhatsApp inbound prefix) - Reply threading via `replyToMode` and per-channel defaults -Details: [Configuration](/gateway/configuration#messages) and channel docs. +Details: [Configuration](/gateway/configuration-reference#messages) and channel docs. diff --git a/docs/concepts/model-providers.md b/docs/concepts/model-providers.md index 98f68bef5cc..ebcf7e49290 100644 --- a/docs/concepts/model-providers.md +++ b/docs/concepts/model-providers.md @@ -255,7 +255,7 @@ See [/providers/kilocode](/providers/kilocode) for setup details. ### Other bundled provider plugins - OpenRouter: `openrouter` (`OPENROUTER_API_KEY`) -- Example model: `openrouter/anthropic/claude-sonnet-4-5` +- Example model: `openrouter/anthropic/claude-sonnet-4-6` - Kilo Gateway: `kilocode` (`KILOCODE_API_KEY`) - Example model: `kilocode/anthropic/claude-opus-4.6` - MiniMax: `minimax` (`MINIMAX_API_KEY`) diff --git a/docs/concepts/models.md b/docs/concepts/models.md index 0a32e1b5d8b..d9a76cabc64 100644 --- a/docs/concepts/models.md +++ b/docs/concepts/models.md @@ -58,7 +58,7 @@ Model refs are normalized to lowercase. Provider aliases like `z.ai/*` normalize to `zai/*`. Provider configuration examples (including OpenCode) live in -[/gateway/configuration](/gateway/configuration#opencode). +[/providers/opencode](/providers/opencode). ## "Model is not allowed" (and why replies stop) @@ -82,9 +82,9 @@ Example allowlist config: ```json5 { agent: { - model: { primary: "anthropic/claude-sonnet-4-5" }, + model: { primary: "anthropic/claude-sonnet-4-6" }, models: { - "anthropic/claude-sonnet-4-5": { alias: "Sonnet" }, + "anthropic/claude-sonnet-4-6": { alias: "Sonnet" }, "anthropic/claude-opus-4-6": { alias: "Opus" }, }, }, diff --git a/docs/concepts/multi-agent.md b/docs/concepts/multi-agent.md index 3f52fa77e74..eda035e72a4 100644 --- a/docs/concepts/multi-agent.md +++ b/docs/concepts/multi-agent.md @@ -388,7 +388,7 @@ Split by channel: route WhatsApp to a fast everyday agent and Telegram to an Opu id: "chat", name: "Everyday", workspace: "~/.openclaw/workspace-chat", - model: "anthropic/claude-sonnet-4-5", + model: "anthropic/claude-sonnet-4-6", }, { id: "opus", @@ -422,7 +422,7 @@ Keep WhatsApp on the fast agent, but route one DM to Opus: id: "chat", name: "Everyday", workspace: "~/.openclaw/workspace-chat", - model: "anthropic/claude-sonnet-4-5", + model: "anthropic/claude-sonnet-4-6", }, { id: "opus", @@ -501,7 +501,7 @@ Notes: ## Per-Agent Sandbox and Tool Configuration -Starting with v2026.1.6, each agent can have its own sandbox and tool restrictions: +Each agent can have its own sandbox and tool restrictions: ```js { diff --git a/docs/concepts/oauth.md b/docs/concepts/oauth.md index 4766687ad51..2589dcaa8f9 100644 --- a/docs/concepts/oauth.md +++ b/docs/concepts/oauth.md @@ -50,7 +50,7 @@ Legacy import-only file (still supported, but not the main store): - `~/.openclaw/credentials/oauth.json` (imported into `auth-profiles.json` on first use) -All of the above also respect `$OPENCLAW_STATE_DIR` (state dir override). Full reference: [/gateway/configuration](/gateway/configuration#auth-storage-oauth--api-keys) +All of the above also respect `$OPENCLAW_STATE_DIR` (state dir override). Full reference: [/gateway/configuration](/gateway/configuration-reference#auth-storage) For static secret refs and runtime snapshot activation behavior, see [Secrets Management](/gateway/secrets). diff --git a/docs/docs.json b/docs/docs.json index 1e5cf45d4d5..bd7d01fc43b 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -43,10 +43,39 @@ "label": "Releases", "href": "https://github.com/openclaw/openclaw/releases", "icon": "package" + }, + { + "label": "Discord", + "href": "https://discord.com/invite/clawd", + "icon": "discord" } ] }, "redirects": [ + { + "source": "/platforms/oracle", + "destination": "/install/oracle" + }, + { + "source": "/platforms/digitalocean", + "destination": "/install/digitalocean" + }, + { + "source": "/platforms/raspberry-pi", + "destination": "/install/raspberry-pi" + }, + { + "source": "/brave-search", + "destination": "/tools/brave-search" + }, + { + "source": "/perplexity", + "destination": "/tools/perplexity-search" + }, + { + "source": "/tts", + "destination": "/tools/tts" + }, { "source": "/messages", "destination": "/concepts/messages" @@ -767,6 +796,14 @@ "source": "/gcp", "destination": "/install/gcp" }, + { + "source": "/azure", + "destination": "/install/azure" + }, + { + "source": "/install/azure/azure", + "destination": "/install/azure" + }, { "source": "/platforms/fly", "destination": "/install/fly" @@ -779,6 +816,10 @@ "source": "/platforms/gcp", "destination": "/install/gcp" }, + { + "source": "/platforms/azure", + "destination": "/install/azure" + }, { "source": "/platforms/macos-vm", "destination": "/install/macos-vm" @@ -812,17 +853,9 @@ { "tab": "Get started", "groups": [ - { - "group": "Home", - "pages": ["index"] - }, { "group": "Overview", - "pages": ["start/showcase"] - }, - { - "group": "Core concepts", - "pages": ["concepts/features"] + "pages": ["index", "start/showcase", "concepts/features"] }, { "group": "First steps", @@ -848,40 +881,46 @@ "groups": [ { "group": "Install overview", - "pages": ["install/index", "install/installer"] + "pages": ["install/index", "install/installer", "install/node"] }, { - "group": "Other install methods", + "group": "Containers", "pages": [ - "install/docker", - "install/podman", - "install/nix", "install/ansible", - "install/bun" + "install/bun", + "install/docker", + "install/nix", + "install/podman" + ] + }, + { + "group": "Hosting", + "pages": [ + "install/azure", + "install/digitalocean", + "install/docker-vm-runtime", + "install/exe-dev", + "install/fly", + "install/gcp", + "install/hetzner", + "install/kubernetes", + "vps", + "install/macos-vm", + "install/northflank", + "install/oracle", + "install/railway", + "install/raspberry-pi", + "install/render" ] }, { "group": "Maintenance", - "pages": ["install/updating", "install/migrating", "install/uninstall"] - }, - { - "group": "Hosting and deployment", "pages": [ - "vps", - "install/kubernetes", - "install/fly", - "install/hetzner", - "install/gcp", - "install/macos-vm", - "install/exe-dev", - "install/railway", - "install/render", - "install/northflank" + "install/updating", + "install/migrating", + "install/uninstall", + "install/development-channels" ] - }, - { - "group": "Advanced", - "pages": ["install/development-channels"] } ] }, @@ -938,7 +977,6 @@ { "group": "Fundamentals", "pages": [ - "pi", "concepts/architecture", "concepts/agent", "concepts/agent-loop", @@ -946,13 +984,10 @@ "concepts/context", "concepts/context-engine", "concepts/agent-workspace", - "concepts/oauth" + "concepts/oauth", + "start/bootstrapping" ] }, - { - "group": "Bootstrapping", - "pages": ["start/bootstrapping"] - }, { "group": "Sessions and memory", "pages": [ @@ -989,7 +1024,7 @@ "group": "Built-in tools", "pages": [ "tools/apply-patch", - "brave-search", + "tools/brave-search", "tools/btw", "tools/diffs", "tools/elevated", @@ -1000,7 +1035,7 @@ "tools/lobster", "tools/loop-detection", "tools/pdf", - "perplexity", + "tools/perplexity-search", "tools/reactions", "tools/thinking", "tools/web" @@ -1011,7 +1046,8 @@ "pages": [ "tools/browser", "tools/browser-login", - "tools/browser-linux-troubleshooting" + "tools/browser-linux-troubleshooting", + "tools/browser-wsl2-windows-remote-cdp-troubleshooting" ] }, { @@ -1031,7 +1067,8 @@ "tools/skills", "tools/skills-config", "tools/clawhub", - "tools/plugin" + "tools/plugin", + "prose" ] }, { @@ -1045,8 +1082,7 @@ "plugins/zalouser", "plugins/manifest", "plugins/agent-tools", - "tools/capability-cookbook", - "prose" + "tools/capability-cookbook" ] }, { @@ -1074,7 +1110,7 @@ "nodes/talk", "nodes/voicewake", "nodes/location-command", - "tts" + "tools/tts" ] } ] @@ -1087,12 +1123,8 @@ "pages": ["providers/index", "providers/models"] }, { - "group": "Model concepts", - "pages": ["concepts/models"] - }, - { - "group": "Configuration", - "pages": ["concepts/model-providers", "concepts/model-failover"] + "group": "Concepts and configuration", + "pages": ["concepts/models", "concepts/model-providers", "concepts/model-failover"] }, { "group": "Providers", @@ -1104,6 +1136,7 @@ "providers/deepgram", "providers/github-copilot", "providers/google", + "providers/groq", "providers/huggingface", "providers/kilocode", "providers/litellm", @@ -1146,10 +1179,7 @@ "platforms/linux", "platforms/windows", "platforms/android", - "platforms/ios", - "platforms/digitalocean", - "platforms/oracle", - "platforms/raspberry-pi" + "platforms/ios" ] }, { @@ -1198,6 +1228,7 @@ "gateway/heartbeat", "gateway/doctor", "gateway/logging", + "logging", "gateway/gateway-lock", "gateway/background-process", "gateway/multiple-gateways", @@ -1228,6 +1259,7 @@ { "group": "Networking and discovery", "pages": [ + "network", "gateway/network-model", "gateway/pairing", "gateway/discovery", @@ -1261,51 +1293,76 @@ "group": "CLI commands", "pages": [ "cli/index", - "cli/acp", - "cli/agent", - "cli/agents", - "cli/approvals", - "cli/browser", - "cli/channels", - "cli/clawbot", - "cli/completion", - "cli/config", - "cli/configure", - "cli/cron", - "cli/daemon", - "cli/dashboard", - "cli/devices", - "cli/directory", - "cli/dns", - "cli/docs", - "cli/doctor", - "cli/gateway", - "cli/health", - "cli/hooks", - "cli/logs", - "cli/memory", - "cli/message", - "cli/models", - "cli/node", - "cli/nodes", - "cli/onboard", - "cli/pairing", - "cli/plugins", - "cli/qr", - "cli/reset", - "cli/sandbox", - "cli/secrets", - "cli/security", - "cli/sessions", - "cli/setup", - "cli/skills", - "cli/status", - "cli/system", - "cli/tui", - "cli/uninstall", - "cli/update", - "cli/voicecall", - "cli/webhooks" + { + "group": "Gateway and service", + "pages": [ + "cli/backup", + "cli/daemon", + "cli/doctor", + "cli/gateway", + "cli/health", + "cli/logs", + "cli/onboard", + "cli/reset", + "cli/secrets", + "cli/security", + "cli/setup", + "cli/status", + "cli/uninstall", + "cli/update" + ] + }, + { + "group": "Agents and sessions", + "pages": [ + "cli/agent", + "cli/agents", + "cli/hooks", + "cli/memory", + "cli/message", + "cli/models", + "cli/sessions", + "cli/system" + ] + }, + { + "group": "Channels and messaging", + "pages": [ + "cli/channels", + "cli/devices", + "cli/directory", + "cli/pairing", + "cli/qr", + "cli/voicecall" + ] + }, + { + "group": "Tools and execution", + "pages": [ + "cli/approvals", + "cli/browser", + "cli/cron", + "cli/node", + "cli/nodes", + "cli/sandbox" + ] + }, + { + "group": "Configuration", + "pages": ["cli/config", "cli/configure", "cli/webhooks"] + }, + { + "group": "Plugins and skills", + "pages": ["cli/plugins", "cli/skills"] + }, + { + "group": "Interfaces", + "pages": ["cli/dashboard", "cli/tui"] + }, + { + "group": "Utility", + "pages": ["cli/acp", "cli/clawbot", "cli/completion", "cli/dns", "cli/docs"] + } ] }, { @@ -1329,12 +1386,14 @@ { "group": "Technical reference", "pages": [ + "pi", "reference/wizard", "reference/token-use", "reference/secretref-credential-surface", "reference/prompt-caching", "reference/api-usage-costs", "reference/transcript-hygiene", + "reference/memory-config", "date-time" ] }, @@ -1380,10 +1439,6 @@ "diagnostics/flags" ] }, - { - "group": "Node runtime", - "pages": ["install/node"] - }, { "group": "Compaction internals", "pages": ["reference/session-management-compaction"] diff --git a/docs/gateway/cli-backends.md b/docs/gateway/cli-backends.md index fe3006bcd1a..f76a6046b60 100644 --- a/docs/gateway/cli-backends.md +++ b/docs/gateway/cli-backends.md @@ -114,8 +114,8 @@ The provider id becomes the left side of your model ref: modelArg: "--model", modelAliases: { "claude-opus-4-6": "opus", - "claude-opus-4-5": "opus", - "claude-sonnet-4-5": "sonnet", + "claude-opus-4-6": "opus", + "claude-sonnet-4-6": "sonnet", }, sessionArg: "--session", sessionMode: "existing", diff --git a/docs/gateway/configuration-examples.md b/docs/gateway/configuration-examples.md index 5627f93395d..8ca6657bd82 100644 --- a/docs/gateway/configuration-examples.md +++ b/docs/gateway/configuration-examples.md @@ -35,7 +35,7 @@ Save to `~/.openclaw/openclaw.json` and you can DM the bot from that number. }, agent: { workspace: "~/.openclaw/workspace", - model: { primary: "anthropic/claude-sonnet-4-5" }, + model: { primary: "anthropic/claude-sonnet-4-6" }, }, channels: { whatsapp: { @@ -238,15 +238,15 @@ Save to `~/.openclaw/openclaw.json` and you can DM the bot from that number. workspace: "~/.openclaw/workspace", userTimezone: "America/Chicago", model: { - primary: "anthropic/claude-sonnet-4-5", + primary: "anthropic/claude-sonnet-4-6", fallbacks: ["anthropic/claude-opus-4-6", "openai/gpt-5.2"], }, imageModel: { - primary: "openrouter/anthropic/claude-sonnet-4-5", + primary: "openrouter/anthropic/claude-sonnet-4-6", }, models: { "anthropic/claude-opus-4-6": { alias: "opus" }, - "anthropic/claude-sonnet-4-5": { alias: "sonnet" }, + "anthropic/claude-sonnet-4-6": { alias: "sonnet" }, "openai/gpt-5.2": { alias: "gpt" }, }, thinkingDefault: "low", @@ -271,7 +271,7 @@ Save to `~/.openclaw/openclaw.json` and you can DM the bot from that number. maxConcurrent: 3, heartbeat: { every: "30m", - model: "anthropic/claude-sonnet-4-5", + model: "anthropic/claude-sonnet-4-6", target: "last", directPolicy: "allow", // allow (default) | block to: "+15555550123", @@ -520,7 +520,7 @@ Only enable direct mutable name/email/nick matching with each channel's `dangero agent: { workspace: "~/.openclaw/workspace", model: { - primary: "anthropic/claude-sonnet-4-5", + primary: "anthropic/claude-sonnet-4-6", fallbacks: ["anthropic/claude-opus-4-6"], }, }, diff --git a/docs/gateway/configuration-reference.md b/docs/gateway/configuration-reference.md index 49c743db623..57756608a35 100644 --- a/docs/gateway/configuration-reference.md +++ b/docs/gateway/configuration-reference.md @@ -1,6 +1,5 @@ --- title: "Configuration Reference" -description: "Complete field-by-field reference for ~/.openclaw/openclaw.json" summary: "Complete reference for every OpenClaw config key, defaults, and channel settings" read_when: - You need exact field-level config semantics or defaults @@ -1019,7 +1018,7 @@ Periodic heartbeat runs. identifierPolicy: "strict", // strict | off | custom identifierInstructions: "Preserve deployment IDs, ticket IDs, and host:port pairs exactly.", // used when identifierPolicy=custom postCompactionSections: ["Session Startup", "Red Lines"], // [] disables reinjection - model: "openrouter/anthropic/claude-sonnet-4-5", // optional compaction-only model override + model: "openrouter/anthropic/claude-sonnet-4-6", // optional compaction-only model override memoryFlush: { enabled: true, softThresholdTokens: 6000, diff --git a/docs/gateway/configuration.md b/docs/gateway/configuration.md index b8977ca10ac..42977c2b6f1 100644 --- a/docs/gateway/configuration.md +++ b/docs/gateway/configuration.md @@ -112,11 +112,11 @@ When validation fails: agents: { defaults: { model: { - primary: "anthropic/claude-sonnet-4-5", + primary: "anthropic/claude-sonnet-4-6", fallbacks: ["openai/gpt-5.2"], }, models: { - "anthropic/claude-sonnet-4-5": { alias: "Sonnet" }, + "anthropic/claude-sonnet-4-6": { alias: "Sonnet" }, "openai/gpt-5.2": { alias: "GPT" }, }, }, @@ -251,7 +251,7 @@ When validation fails: Build the image first: `scripts/sandbox-setup.sh` - See [Sandboxing](/gateway/sandboxing) for the full guide and [full reference](/gateway/configuration-reference#sandbox) for all options. + See [Sandboxing](/gateway/sandboxing) for the full guide and [full reference](/gateway/configuration-reference#agents-defaults-sandbox) for all options. diff --git a/docs/gateway/local-models.md b/docs/gateway/local-models.md index 4059f988776..1bb9dac5b91 100644 --- a/docs/gateway/local-models.md +++ b/docs/gateway/local-models.md @@ -69,11 +69,11 @@ Keep hosted models configured even when running local; use `models.mode: "merge" agents: { defaults: { model: { - primary: "anthropic/claude-sonnet-4-5", + primary: "anthropic/claude-sonnet-4-6", fallbacks: ["lmstudio/minimax-m2.5-gs32", "anthropic/claude-opus-4-6"], }, models: { - "anthropic/claude-sonnet-4-5": { alias: "Sonnet" }, + "anthropic/claude-sonnet-4-6": { alias: "Sonnet" }, "lmstudio/minimax-m2.5-gs32": { alias: "MiniMax Local" }, "anthropic/claude-opus-4-6": { alias: "Opus" }, }, diff --git a/docs/gateway/sandboxing.md b/docs/gateway/sandboxing.md index 736dc7c6261..e49372ddc41 100644 --- a/docs/gateway/sandboxing.md +++ b/docs/gateway/sandboxing.md @@ -399,7 +399,7 @@ Security defaults: Docker installs and the containerized gateway live here: [Docker](/install/docker) -For Docker gateway deployments, `docker-setup.sh` can bootstrap sandbox config. +For Docker gateway deployments, `scripts/docker/setup.sh` can bootstrap sandbox config. Set `OPENCLAW_SANDBOX=1` (or `true`/`yes`/`on`) to enable that path. You can override socket location with `OPENCLAW_DOCKER_SOCKET`. Full setup and env reference: [Docker](/install/docker#enable-agent-sandbox-for-docker-gateway-opt-in). @@ -463,7 +463,7 @@ See [Multi-Agent Sandbox & Tools](/tools/multi-agent-sandbox-tools) for preceden ## Related docs - [OpenShell](/gateway/openshell) -- managed sandbox backend setup, workspace modes, and config reference -- [Sandbox Configuration](/gateway/configuration#agentsdefaults-sandbox) +- [Sandbox Configuration](/gateway/configuration-reference#agents-defaults-sandbox) - [Sandbox vs Tool Policy vs Elevated](/gateway/sandbox-vs-tool-policy-vs-elevated) -- debugging "why is this blocked?" - [Multi-Agent Sandbox & Tools](/tools/multi-agent-sandbox-tools) -- per-agent overrides and precedence - [Security](/gateway/security) diff --git a/docs/gateway/security/index.md b/docs/gateway/security/index.md index 8cea1b42766..26cfbc4d6df 100644 --- a/docs/gateway/security/index.md +++ b/docs/gateway/security/index.md @@ -5,7 +5,7 @@ read_when: title: "Security" --- -# Security 🔒 +# Security > [!WARNING] > **Personal assistant trust model:** this guidance assumes one trusted operator boundary per gateway (single-user/personal assistant model). @@ -25,7 +25,7 @@ This page explains hardening **within that model**. It does not claim hostile mu ## Quick check: `openclaw security audit` -See also: [Formal Verification (Security Models)](/security/formal-verification/) +See also: [Formal Verification (Security Models)](/security/formal-verification) Run this regularly (especially after changing config or exposing network surfaces): diff --git a/docs/gateway/trusted-proxy-auth.md b/docs/gateway/trusted-proxy-auth.md index 7144452b2e6..cff00bb6720 100644 --- a/docs/gateway/trusted-proxy-auth.md +++ b/docs/gateway/trusted-proxy-auth.md @@ -1,4 +1,5 @@ --- +title: "Trusted Proxy Auth" summary: "Delegate gateway authentication to a trusted reverse proxy (Pomerium, Caddy, nginx + OAuth)" read_when: - Running OpenClaw behind an identity-aware proxy diff --git a/docs/help/environment.md b/docs/help/environment.md index 860129bde37..45faad7c66c 100644 --- a/docs/help/environment.md +++ b/docs/help/environment.md @@ -90,7 +90,7 @@ You can reference env vars directly in config string values using `${VAR_NAME}` } ``` -See [Configuration: Env var substitution](/gateway/configuration#env-var-substitution-in-config) for full details. +See [Configuration: Env var substitution](/gateway/configuration-reference#env-var-substitution) for full details. ## Secret refs vs `${ENV}` strings diff --git a/docs/help/faq.md b/docs/help/faq.md index 5e892da6a7b..68debcd807c 100644 --- a/docs/help/faq.md +++ b/docs/help/faq.md @@ -10,196 +10,6 @@ title: "FAQ" Quick answers plus deeper troubleshooting for real-world setups (local dev, VPS, multi-agent, OAuth/API keys, model failover). For runtime diagnostics, see [Troubleshooting](/gateway/troubleshooting). For the full config reference, see [Configuration](/gateway/configuration). -## Table of contents - -- [Quick start and first-run setup] - - [I am stuck - fastest way to get unstuck](#i-am-stuck---fastest-way-to-get-unstuck) - - [Recommended way to install and set up OpenClaw](#recommended-way-to-install-and-set-up-openclaw) - - [How do I open the dashboard after onboarding?](#how-do-i-open-the-dashboard-after-onboarding) - - [How do I authenticate the dashboard (token) on localhost vs remote?](#how-do-i-authenticate-the-dashboard-token-on-localhost-vs-remote) - - [What runtime do I need?](#what-runtime-do-i-need) - - [Does it run on Raspberry Pi?](#does-it-run-on-raspberry-pi) - - [Any tips for Raspberry Pi installs?](#any-tips-for-raspberry-pi-installs) - - [It is stuck on "wake up my friend" / onboarding will not hatch. What now?](#it-is-stuck-on-wake-up-my-friend-onboarding-will-not-hatch-what-now) - - [Can I migrate my setup to a new machine (Mac mini) without redoing onboarding?](#can-i-migrate-my-setup-to-a-new-machine-mac-mini-without-redoing-onboarding) - - [Where do I see what is new in the latest version?](#where-do-i-see-what-is-new-in-the-latest-version) - - [Cannot access docs.openclaw.ai (SSL error)](#cannot-access-docsopenclawai-ssl-error) - - [Difference between stable and beta](#difference-between-stable-and-beta) - - [How do I install the beta version and what is the difference between beta and dev](#how-do-i-install-the-beta-version-and-what-is-the-difference-between-beta-and-dev) - - [How do I try the latest bits?](#how-do-i-try-the-latest-bits) - - [How long does install and onboarding usually take?](#how-long-does-install-and-onboarding-usually-take) - - [Installer stuck? How do I get more feedback?](#installer-stuck-how-do-i-get-more-feedback) - - [Windows install says git not found or openclaw not recognized](#windows-install-says-git-not-found-or-openclaw-not-recognized) - - [Windows exec output shows garbled Chinese text what should I do](#windows-exec-output-shows-garbled-chinese-text-what-should-i-do) - - [The docs did not answer my question - how do I get a better answer](#the-docs-did-not-answer-my-question---how-do-i-get-a-better-answer) - - [How do I install OpenClaw on Linux?](#how-do-i-install-openclaw-on-linux) - - [How do I install OpenClaw on a VPS?](#how-do-i-install-openclaw-on-a-vps) - - [Where are the cloud/VPS install guides?](#where-are-the-cloudvps-install-guides) - - [Can I ask OpenClaw to update itself?](#can-i-ask-openclaw-to-update-itself) - - [What does onboarding actually do?](#what-does-onboarding-actually-do) - - [Do I need a Claude or OpenAI subscription to run this?](#do-i-need-a-claude-or-openai-subscription-to-run-this) - - [Can I use Claude Max subscription without an API key](#can-i-use-claude-max-subscription-without-an-api-key) - - [How does Anthropic "setup-token" auth work?](#how-does-anthropic-setuptoken-auth-work) - - [Where do I find an Anthropic setup-token?](#where-do-i-find-an-anthropic-setuptoken) - - [Do you support Claude subscription auth (Claude Pro or Max)?](#do-you-support-claude-subscription-auth-claude-pro-or-max) - - [Why am I seeing `HTTP 429: rate_limit_error` from Anthropic?](#why-am-i-seeing-http-429-ratelimiterror-from-anthropic) - - [Is AWS Bedrock supported?](#is-aws-bedrock-supported) - - [How does Codex auth work?](#how-does-codex-auth-work) - - [Do you support OpenAI subscription auth (Codex OAuth)?](#do-you-support-openai-subscription-auth-codex-oauth) - - [How do I set up Gemini CLI OAuth](#how-do-i-set-up-gemini-cli-oauth) - - [Is a local model OK for casual chats?](#is-a-local-model-ok-for-casual-chats) - - [How do I keep hosted model traffic in a specific region?](#how-do-i-keep-hosted-model-traffic-in-a-specific-region) - - [Do I have to buy a Mac Mini to install this?](#do-i-have-to-buy-a-mac-mini-to-install-this) - - [Do I need a Mac mini for iMessage support?](#do-i-need-a-mac-mini-for-imessage-support) - - [If I buy a Mac mini to run OpenClaw, can I connect it to my MacBook Pro?](#if-i-buy-a-mac-mini-to-run-openclaw-can-i-connect-it-to-my-macbook-pro) - - [Can I use Bun?](#can-i-use-bun) - - [Telegram: what goes in `allowFrom`?](#telegram-what-goes-in-allowfrom) - - [Can multiple people use one WhatsApp number with different OpenClaw instances?](#can-multiple-people-use-one-whatsapp-number-with-different-openclaw-instances) - - [Can I run a "fast chat" agent and an "Opus for coding" agent?](#can-i-run-a-fast-chat-agent-and-an-opus-for-coding-agent) - - [Does Homebrew work on Linux?](#does-homebrew-work-on-linux) - - [Difference between the hackable git install and npm install](#difference-between-the-hackable-git-install-and-npm-install) - - [Can I switch between npm and git installs later?](#can-i-switch-between-npm-and-git-installs-later) - - [Should I run the Gateway on my laptop or a VPS?](#should-i-run-the-gateway-on-my-laptop-or-a-vps) - - [How important is it to run OpenClaw on a dedicated machine?](#how-important-is-it-to-run-openclaw-on-a-dedicated-machine) - - [What are the minimum VPS requirements and recommended OS?](#what-are-the-minimum-vps-requirements-and-recommended-os) - - [Can I run OpenClaw in a VM and what are the requirements](#can-i-run-openclaw-in-a-vm-and-what-are-the-requirements) -- [What is OpenClaw?](#what-is-openclaw) - - [What is OpenClaw, in one paragraph?](#what-is-openclaw-in-one-paragraph) - - [Value proposition](#value-proposition) - - [I just set it up what should I do first](#i-just-set-it-up-what-should-i-do-first) - - [What are the top five everyday use cases for OpenClaw](#what-are-the-top-five-everyday-use-cases-for-openclaw) - - [Can OpenClaw help with lead gen outreach ads and blogs for a SaaS](#can-openclaw-help-with-lead-gen-outreach-ads-and-blogs-for-a-saas) - - [What are the advantages vs Claude Code for web development?](#what-are-the-advantages-vs-claude-code-for-web-development) -- [Skills and automation](#skills-and-automation) - - [How do I customize skills without keeping the repo dirty?](#how-do-i-customize-skills-without-keeping-the-repo-dirty) - - [Can I load skills from a custom folder?](#can-i-load-skills-from-a-custom-folder) - - [How can I use different models for different tasks?](#how-can-i-use-different-models-for-different-tasks) - - [The bot freezes while doing heavy work. How do I offload that?](#the-bot-freezes-while-doing-heavy-work-how-do-i-offload-that) - - [Cron or reminders do not fire. What should I check?](#cron-or-reminders-do-not-fire-what-should-i-check) - - [How do I install skills on Linux?](#how-do-i-install-skills-on-linux) - - [Can OpenClaw run tasks on a schedule or continuously in the background?](#can-openclaw-run-tasks-on-a-schedule-or-continuously-in-the-background) - - [Can I run Apple macOS-only skills from Linux?](#can-i-run-apple-macos-only-skills-from-linux) - - [Do you have a Notion or HeyGen integration?](#do-you-have-a-notion-or-heygen-integration) - - [How do I use my existing signed-in Chrome with OpenClaw?](#how-do-i-use-my-existing-signed-in-chrome-with-openclaw) -- [Sandboxing and memory](#sandboxing-and-memory) - - [Is there a dedicated sandboxing doc?](#is-there-a-dedicated-sandboxing-doc) - - [How do I bind a host folder into the sandbox?](#how-do-i-bind-a-host-folder-into-the-sandbox) - - [How does memory work?](#how-does-memory-work) - - [Memory keeps forgetting things. How do I make it stick?](#memory-keeps-forgetting-things-how-do-i-make-it-stick) - - [Does memory persist forever? What are the limits?](#does-memory-persist-forever-what-are-the-limits) - - [Does semantic memory search require an OpenAI API key?](#does-semantic-memory-search-require-an-openai-api-key) -- [Where things live on disk](#where-things-live-on-disk) - - [Is all data used with OpenClaw saved locally?](#is-all-data-used-with-openclaw-saved-locally) - - [Where does OpenClaw store its data?](#where-does-openclaw-store-its-data) - - [Where should AGENTS.md / SOUL.md / USER.md / MEMORY.md live?](#where-should-agentsmd-soulmd-usermd-memorymd-live) - - [Recommended backup strategy](#recommended-backup-strategy) - - [How do I completely uninstall OpenClaw?](#how-do-i-completely-uninstall-openclaw) - - [Can agents work outside the workspace?](#can-agents-work-outside-the-workspace) - - [I'm in remote mode - where is the session store?](#im-in-remote-mode-where-is-the-session-store) -- [Config basics](#config-basics) - - [What format is the config? Where is it?](#what-format-is-the-config-where-is-it) - - [I set `gateway.bind: "lan"` (or `"tailnet"`) and now nothing listens / the UI says unauthorized](#i-set-gatewaybind-lan-or-tailnet-and-now-nothing-listens-the-ui-says-unauthorized) - - [Why do I need a token on localhost now?](#why-do-i-need-a-token-on-localhost-now) - - [Do I have to restart after changing config?](#do-i-have-to-restart-after-changing-config) - - [How do I disable funny CLI taglines?](#how-do-i-disable-funny-cli-taglines) - - [How do I enable web search (and web fetch)?](#how-do-i-enable-web-search-and-web-fetch) - - [config.apply wiped my config. How do I recover and avoid this?](#configapply-wiped-my-config-how-do-i-recover-and-avoid-this) - - [How do I run a central Gateway with specialized workers across devices?](#how-do-i-run-a-central-gateway-with-specialized-workers-across-devices) - - [Can the OpenClaw browser run headless?](#can-the-openclaw-browser-run-headless) - - [How do I use Brave for browser control?](#how-do-i-use-brave-for-browser-control) -- [Remote gateways and nodes](#remote-gateways-and-nodes) - - [How do commands propagate between Telegram, the gateway, and nodes?](#how-do-commands-propagate-between-telegram-the-gateway-and-nodes) - - [How can my agent access my computer if the Gateway is hosted remotely?](#how-can-my-agent-access-my-computer-if-the-gateway-is-hosted-remotely) - - [Tailscale is connected but I get no replies. What now?](#tailscale-is-connected-but-i-get-no-replies-what-now) - - [Can two OpenClaw instances talk to each other (local + VPS)?](#can-two-openclaw-instances-talk-to-each-other-local-vps) - - [Do I need separate VPSes for multiple agents](#do-i-need-separate-vpses-for-multiple-agents) - - [Is there a benefit to using a node on my personal laptop instead of SSH from a VPS?](#is-there-a-benefit-to-using-a-node-on-my-personal-laptop-instead-of-ssh-from-a-vps) - - [Do nodes run a gateway service?](#do-nodes-run-a-gateway-service) - - [Is there an API / RPC way to apply config?](#is-there-an-api-rpc-way-to-apply-config) - - [Minimal sane config for a first install](#minimal-sane-config-for-a-first-install) - - [How do I set up Tailscale on a VPS and connect from my Mac?](#how-do-i-set-up-tailscale-on-a-vps-and-connect-from-my-mac) - - [How do I connect a Mac node to a remote Gateway (Tailscale Serve)?](#how-do-i-connect-a-mac-node-to-a-remote-gateway-tailscale-serve) - - [Should I install on a second laptop or just add a node?](#should-i-install-on-a-second-laptop-or-just-add-a-node) -- [Env vars and .env loading](#env-vars-and-env-loading) - - [How does OpenClaw load environment variables?](#how-does-openclaw-load-environment-variables) - - ["I started the Gateway via the service and my env vars disappeared." What now?](#i-started-the-gateway-via-the-service-and-my-env-vars-disappeared-what-now) - - [I set `COPILOT_GITHUB_TOKEN`, but models status shows "Shell env: off." Why?](#i-set-copilotgithubtoken-but-models-status-shows-shell-env-off-why) -- [Sessions and multiple chats](#sessions-and-multiple-chats) - - [How do I start a fresh conversation?](#how-do-i-start-a-fresh-conversation) - - [Do sessions reset automatically if I never send `/new`?](#do-sessions-reset-automatically-if-i-never-send-new) - - [Is there a way to make a team of OpenClaw instances one CEO and many agents](#is-there-a-way-to-make-a-team-of-openclaw-instances-one-ceo-and-many-agents) - - [Why did context get truncated mid-task? How do I prevent it?](#why-did-context-get-truncated-midtask-how-do-i-prevent-it) - - [How do I completely reset OpenClaw but keep it installed?](#how-do-i-completely-reset-openclaw-but-keep-it-installed) - - [I'm getting "context too large" errors - how do I reset or compact?](#im-getting-context-too-large-errors-how-do-i-reset-or-compact) - - [Why am I seeing "LLM request rejected: messages.content.tool_use.input field required"?](#why-am-i-seeing-llm-request-rejected-messagescontenttool_useinput-field-required) - - [Why am I getting heartbeat messages every 30 minutes?](#why-am-i-getting-heartbeat-messages-every-30-minutes) - - [Do I need to add a "bot account" to a WhatsApp group?](#do-i-need-to-add-a-bot-account-to-a-whatsapp-group) - - [How do I get the JID of a WhatsApp group?](#how-do-i-get-the-jid-of-a-whatsapp-group) - - [Why does OpenClaw not reply in a group](#why-does-openclaw-not-reply-in-a-group) - - [Do groups/threads share context with DMs?](#do-groupsthreads-share-context-with-dms) - - [How many workspaces and agents can I create?](#how-many-workspaces-and-agents-can-i-create) - - [Can I run multiple bots or chats at the same time (Slack), and how should I set that up?](#can-i-run-multiple-bots-or-chats-at-the-same-time-slack-and-how-should-i-set-that-up) -- [Models: defaults, selection, aliases, switching](#models-defaults-selection-aliases-switching) - - [What is the "default model"?](#what-is-the-default-model) - - [What model do you recommend?](#what-model-do-you-recommend) - - [How do I switch models without wiping my config?](#how-do-i-switch-models-without-wiping-my-config) - - [Can I use self-hosted models (llama.cpp, vLLM, Ollama)?](#can-i-use-selfhosted-models-llamacpp-vllm-ollama) - - [What do OpenClaw, Flawd, and Krill use for models?](#what-do-openclaw-flawd-and-krill-use-for-models) - - [How do I switch models on the fly (without restarting)?](#how-do-i-switch-models-on-the-fly-without-restarting) - - [Can I use GPT 5.2 for daily tasks and Codex 5.3 for coding](#can-i-use-gpt-52-for-daily-tasks-and-codex-53-for-coding) - - [Why do I see "Model … is not allowed" and then no reply?](#why-do-i-see-model-is-not-allowed-and-then-no-reply) - - [Why do I see "Unknown model: minimax/MiniMax-M2.5"?](#why-do-i-see-unknown-model-minimaxminimaxm25) - - [Can I use MiniMax as my default and OpenAI for complex tasks?](#can-i-use-minimax-as-my-default-and-openai-for-complex-tasks) - - [Are opus / sonnet / gpt built-in shortcuts?](#are-opus-sonnet-gpt-builtin-shortcuts) - - [How do I define/override model shortcuts (aliases)?](#how-do-i-defineoverride-model-shortcuts-aliases) - - [How do I add models from other providers like OpenRouter or Z.AI?](#how-do-i-add-models-from-other-providers-like-openrouter-or-zai) -- [Model failover and "All models failed"](#model-failover-and-all-models-failed) - - [How does failover work?](#how-does-failover-work) - - [What does this error mean?](#what-does-this-error-mean) - - [Fix checklist for `No credentials found for profile "anthropic:default"`](#fix-checklist-for-no-credentials-found-for-profile-anthropicdefault) - - [Why did it also try Google Gemini and fail?](#why-did-it-also-try-google-gemini-and-fail) -- [Auth profiles: what they are and how to manage them](#auth-profiles-what-they-are-and-how-to-manage-them) - - [What is an auth profile?](#what-is-an-auth-profile) - - [What are typical profile IDs?](#what-are-typical-profile-ids) - - [Can I control which auth profile is tried first?](#can-i-control-which-auth-profile-is-tried-first) - - [OAuth vs API key - what is the difference](#oauth-vs-api-key---what-is-the-difference) -- [Gateway: ports, "already running", and remote mode](#gateway-ports-already-running-and-remote-mode) - - [What port does the Gateway use?](#what-port-does-the-gateway-use) - - [Why does `openclaw gateway status` say `Runtime: running` but `RPC probe: failed`?](#why-does-openclaw-gateway-status-say-runtime-running-but-rpc-probe-failed) - - [Why does `openclaw gateway status` show `Config (cli)` and `Config (service)` different?](#why-does-openclaw-gateway-status-show-config-cli-and-config-service-different) - - [What does "another gateway instance is already listening" mean?](#what-does-another-gateway-instance-is-already-listening-mean) - - [How do I run OpenClaw in remote mode (client connects to a Gateway elsewhere)?](#how-do-i-run-openclaw-in-remote-mode-client-connects-to-a-gateway-elsewhere) - - [The Control UI says "unauthorized" (or keeps reconnecting). What now?](#the-control-ui-says-unauthorized-or-keeps-reconnecting-what-now) - - [I set gateway.bind tailnet but it cannot bind and nothing listens](#i-set-gatewaybind-tailnet-but-it-cannot-bind-and-nothing-listens) - - [Can I run multiple Gateways on the same host?](#can-i-run-multiple-gateways-on-the-same-host) - - [What does "invalid handshake" / code 1008 mean?](#what-does-invalid-handshake-code-1008-mean) -- [Logging and debugging](#logging-and-debugging) - - [Where are logs?](#where-are-logs) - - [How do I start/stop/restart the Gateway service?](#how-do-i-startstoprestart-the-gateway-service) - - [I closed my terminal on Windows - how do I restart OpenClaw?](#i-closed-my-terminal-on-windows-how-do-i-restart-openclaw) - - [The Gateway is up but replies never arrive. What should I check?](#the-gateway-is-up-but-replies-never-arrive-what-should-i-check) - - ["Disconnected from gateway: no reason" - what now?](#disconnected-from-gateway-no-reason-what-now) - - [Telegram setMyCommands fails. What should I check?](#telegram-setmycommands-fails-what-should-i-check) - - [TUI shows no output. What should I check?](#tui-shows-no-output-what-should-i-check) - - [How do I completely stop then start the Gateway?](#how-do-i-completely-stop-then-start-the-gateway) - - [ELI5: `openclaw gateway restart` vs `openclaw gateway`](#eli5-openclaw-gateway-restart-vs-openclaw-gateway) - - [Fastest way to get more details when something fails](#fastest-way-to-get-more-details-when-something-fails) -- [Media and attachments](#media-and-attachments) - - [My skill generated an image/PDF, but nothing was sent](#my-skill-generated-an-imagepdf-but-nothing-was-sent) -- [Security and access control](#security-and-access-control) - - [Is it safe to expose OpenClaw to inbound DMs?](#is-it-safe-to-expose-openclaw-to-inbound-dms) - - [Is prompt injection only a concern for public bots?](#is-prompt-injection-only-a-concern-for-public-bots) - - [Should my bot have its own email GitHub account or phone number](#should-my-bot-have-its-own-email-github-account-or-phone-number) - - [Can I give it autonomy over my text messages and is that safe](#can-i-give-it-autonomy-over-my-text-messages-and-is-that-safe) - - [Can I use cheaper models for personal assistant tasks?](#can-i-use-cheaper-models-for-personal-assistant-tasks) - - [I ran /start in Telegram but did not get a pairing code](#i-ran-start-in-telegram-but-did-not-get-a-pairing-code) - - [WhatsApp: will it message my contacts? How does pairing work?](#whatsapp-will-it-message-my-contacts-how-does-pairing-work) -- [Chat commands, aborting tasks, and "it will not stop"](#chat-commands-aborting-tasks-and-it-will-not-stop) - - [How do I stop internal system messages from showing in chat](#how-do-i-stop-internal-system-messages-from-showing-in-chat) - - [How do I stop/cancel a running task?](#how-do-i-stopcancel-a-running-task) - - [How do I send a Discord message from Telegram? ("Cross-context messaging denied")](#how-do-i-send-a-discord-message-from-telegram-crosscontext-messaging-denied) - - [Why does it feel like the bot "ignores" rapid-fire messages?](#why-does-it-feel-like-the-bot-ignores-rapidfire-messages) - ## First 60 seconds if something is broken 1. **Quick status (first check)** @@ -267,2740 +77,2921 @@ Quick answers plus deeper troubleshooting for real-world setups (local dev, VPS, ## Quick start and first-run setup -### I am stuck - fastest way to get unstuck + + + Use a local AI agent that can **see your machine**. That is far more effective than asking + in Discord, because most "I'm stuck" cases are **local config or environment issues** that + remote helpers cannot inspect. -Use a local AI agent that can **see your machine**. That is far more effective than asking -in Discord, because most "I'm stuck" cases are **local config or environment issues** that -remote helpers cannot inspect. + - **Claude Code**: [https://www.anthropic.com/claude-code/](https://www.anthropic.com/claude-code/) + - **OpenAI Codex**: [https://openai.com/codex/](https://openai.com/codex/) -- **Claude Code**: [https://www.anthropic.com/claude-code/](https://www.anthropic.com/claude-code/) -- **OpenAI Codex**: [https://openai.com/codex/](https://openai.com/codex/) + These tools can read the repo, run commands, inspect logs, and help fix your machine-level + setup (PATH, services, permissions, auth files). Give them the **full source checkout** via + the hackable (git) install: -These tools can read the repo, run commands, inspect logs, and help fix your machine-level -setup (PATH, services, permissions, auth files). Give them the **full source checkout** via -the hackable (git) install: + ```bash + curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method git + ``` -```bash -curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method git -``` + This installs OpenClaw **from a git checkout**, so the agent can read the code + docs and + reason about the exact version you are running. You can always switch back to stable later + by re-running the installer without `--install-method git`. -This installs OpenClaw **from a git checkout**, so the agent can read the code + docs and -reason about the exact version you are running. You can always switch back to stable later -by re-running the installer without `--install-method git`. + Tip: ask the agent to **plan and supervise** the fix (step-by-step), then execute only the + necessary commands. That keeps changes small and easier to audit. -Tip: ask the agent to **plan and supervise** the fix (step-by-step), then execute only the -necessary commands. That keeps changes small and easier to audit. + If you discover a real bug or fix, please file a GitHub issue or send a PR: + [https://github.com/openclaw/openclaw/issues](https://github.com/openclaw/openclaw/issues) + [https://github.com/openclaw/openclaw/pulls](https://github.com/openclaw/openclaw/pulls) -If you discover a real bug or fix, please file a GitHub issue or send a PR: -[https://github.com/openclaw/openclaw/issues](https://github.com/openclaw/openclaw/issues) -[https://github.com/openclaw/openclaw/pulls](https://github.com/openclaw/openclaw/pulls) + Start with these commands (share outputs when asking for help): -Start with these commands (share outputs when asking for help): + ```bash + openclaw status + openclaw models status + openclaw doctor + ``` -```bash -openclaw status -openclaw models status -openclaw doctor -``` + What they do: -What they do: + - `openclaw status`: quick snapshot of gateway/agent health + basic config. + - `openclaw models status`: checks provider auth + model availability. + - `openclaw doctor`: validates and repairs common config/state issues. -- `openclaw status`: quick snapshot of gateway/agent health + basic config. -- `openclaw models status`: checks provider auth + model availability. -- `openclaw doctor`: validates and repairs common config/state issues. + Other useful CLI checks: `openclaw status --all`, `openclaw logs --follow`, + `openclaw gateway status`, `openclaw health --verbose`. -Other useful CLI checks: `openclaw status --all`, `openclaw logs --follow`, -`openclaw gateway status`, `openclaw health --verbose`. + Quick debug loop: [First 60 seconds if something is broken](#first-60-seconds-if-something-is-broken). + Install docs: [Install](/install), [Installer flags](/install/installer), [Updating](/install/updating). -Quick debug loop: [First 60 seconds if something is broken](#first-60-seconds-if-something-is-broken). -Install docs: [Install](/install), [Installer flags](/install/installer), [Updating](/install/updating). + -### Recommended way to install and set up OpenClaw + + The repo recommends running from source and using onboarding: -The repo recommends running from source and using onboarding: + ```bash + curl -fsSL https://openclaw.ai/install.sh | bash + openclaw onboard --install-daemon + ``` -```bash -curl -fsSL https://openclaw.ai/install.sh | bash -openclaw onboard --install-daemon -``` + The wizard can also build UI assets automatically. After onboarding, you typically run the Gateway on port **18789**. -The wizard can also build UI assets automatically. After onboarding, you typically run the Gateway on port **18789**. + From source (contributors/dev): -From source (contributors/dev): + ```bash + git clone https://github.com/openclaw/openclaw.git + cd openclaw + pnpm install + pnpm build + pnpm ui:build # auto-installs UI deps on first run + openclaw onboard + ``` -```bash -git clone https://github.com/openclaw/openclaw.git -cd openclaw -pnpm install -pnpm build -pnpm ui:build # auto-installs UI deps on first run -openclaw onboard -``` + If you don't have a global install yet, run it via `pnpm openclaw onboard`. -If you don't have a global install yet, run it via `pnpm openclaw onboard`. + -### How do I open the dashboard after onboarding + + The wizard opens your browser with a clean (non-tokenized) dashboard URL right after onboarding and also prints the link in the summary. Keep that tab open; if it didn't launch, copy/paste the printed URL on the same machine. + -The wizard opens your browser with a clean (non-tokenized) dashboard URL right after onboarding and also prints the link in the summary. Keep that tab open; if it didn't launch, copy/paste the printed URL on the same machine. + + **Localhost (same machine):** -### How do I authenticate the dashboard token on localhost vs remote + - Open `http://127.0.0.1:18789/`. + - If it asks for auth, paste the token from `gateway.auth.token` (or `OPENCLAW_GATEWAY_TOKEN`) into Control UI settings. + - Retrieve it from the gateway host: `openclaw config get gateway.auth.token` (or generate one: `openclaw doctor --generate-gateway-token`). -**Localhost (same machine):** + **Not on localhost:** -- Open `http://127.0.0.1:18789/`. -- If it asks for auth, paste the token from `gateway.auth.token` (or `OPENCLAW_GATEWAY_TOKEN`) into Control UI settings. -- Retrieve it from the gateway host: `openclaw config get gateway.auth.token` (or generate one: `openclaw doctor --generate-gateway-token`). + - **Tailscale Serve** (recommended): keep bind loopback, run `openclaw gateway --tailscale serve`, open `https:///`. If `gateway.auth.allowTailscale` is `true`, identity headers satisfy Control UI/WebSocket auth (no token, assumes trusted gateway host); HTTP APIs still require token/password. + - **Tailnet bind**: run `openclaw gateway --bind tailnet --token ""`, open `http://:18789/`, paste token in dashboard settings. + - **SSH tunnel**: `ssh -N -L 18789:127.0.0.1:18789 user@host` then open `http://127.0.0.1:18789/` and paste the token in Control UI settings. -**Not on localhost:** + See [Dashboard](/web/dashboard) and [Web surfaces](/web) for bind modes and auth details. -- **Tailscale Serve** (recommended): keep bind loopback, run `openclaw gateway --tailscale serve`, open `https:///`. If `gateway.auth.allowTailscale` is `true`, identity headers satisfy Control UI/WebSocket auth (no token, assumes trusted gateway host); HTTP APIs still require token/password. -- **Tailnet bind**: run `openclaw gateway --bind tailnet --token ""`, open `http://:18789/`, paste token in dashboard settings. -- **SSH tunnel**: `ssh -N -L 18789:127.0.0.1:18789 user@host` then open `http://127.0.0.1:18789/` and paste the token in Control UI settings. + -See [Dashboard](/web/dashboard) and [Web surfaces](/web) for bind modes and auth details. + + Node **>= 22** is required. `pnpm` is recommended. Bun is **not recommended** for the Gateway. + -### What runtime do I need + + Yes. The Gateway is lightweight - docs list **512MB-1GB RAM**, **1 core**, and about **500MB** + disk as enough for personal use, and note that a **Raspberry Pi 4 can run it**. -Node **>= 22** is required. `pnpm` is recommended. Bun is **not recommended** for the Gateway. + If you want extra headroom (logs, media, other services), **2GB is recommended**, but it's + not a hard minimum. -### Does it run on Raspberry Pi + Tip: a small Pi/VPS can host the Gateway, and you can pair **nodes** on your laptop/phone for + local screen/camera/canvas or command execution. See [Nodes](/nodes). -Yes. The Gateway is lightweight - docs list **512MB-1GB RAM**, **1 core**, and about **500MB** -disk as enough for personal use, and note that a **Raspberry Pi 4 can run it**. + -If you want extra headroom (logs, media, other services), **2GB is recommended**, but it's -not a hard minimum. + + Short version: it works, but expect rough edges. -Tip: a small Pi/VPS can host the Gateway, and you can pair **nodes** on your laptop/phone for -local screen/camera/canvas or command execution. See [Nodes](/nodes). + - Use a **64-bit** OS and keep Node >= 22. + - Prefer the **hackable (git) install** so you can see logs and update fast. + - Start without channels/skills, then add them one by one. + - If you hit weird binary issues, it is usually an **ARM compatibility** problem. -### Any tips for Raspberry Pi installs + Docs: [Linux](/platforms/linux), [Install](/install). -Short version: it works, but expect rough edges. + -- Use a **64-bit** OS and keep Node >= 22. -- Prefer the **hackable (git) install** so you can see logs and update fast. -- Start without channels/skills, then add them one by one. -- If you hit weird binary issues, it is usually an **ARM compatibility** problem. + + That screen depends on the Gateway being reachable and authenticated. The TUI also sends + "Wake up, my friend!" automatically on first hatch. If you see that line with **no reply** + and tokens stay at 0, the agent never ran. -Docs: [Linux](/platforms/linux), [Install](/install). + 1. Restart the Gateway: -### It is stuck on wake up my friend onboarding will not hatch What now + ```bash + openclaw gateway restart + ``` -That screen depends on the Gateway being reachable and authenticated. The TUI also sends -"Wake up, my friend!" automatically on first hatch. If you see that line with **no reply** -and tokens stay at 0, the agent never ran. + 2. Check status + auth: -1. Restart the Gateway: + ```bash + openclaw status + openclaw models status + openclaw logs --follow + ``` -```bash -openclaw gateway restart -``` + 3. If it still hangs, run: -2. Check status + auth: + ```bash + openclaw doctor + ``` -```bash -openclaw status -openclaw models status -openclaw logs --follow -``` + If the Gateway is remote, ensure the tunnel/Tailscale connection is up and that the UI + is pointed at the right Gateway. See [Remote access](/gateway/remote). -3. If it still hangs, run: + -```bash -openclaw doctor -``` + + Yes. Copy the **state directory** and **workspace**, then run Doctor once. This + keeps your bot "exactly the same" (memory, session history, auth, and channel + state) as long as you copy **both** locations: -If the Gateway is remote, ensure the tunnel/Tailscale connection is up and that the UI -is pointed at the right Gateway. See [Remote access](/gateway/remote). + 1. Install OpenClaw on the new machine. + 2. Copy `$OPENCLAW_STATE_DIR` (default: `~/.openclaw`) from the old machine. + 3. Copy your workspace (default: `~/.openclaw/workspace`). + 4. Run `openclaw doctor` and restart the Gateway service. -### Can I migrate my setup to a new machine Mac mini without redoing onboarding + That preserves config, auth profiles, WhatsApp creds, sessions, and memory. If you're in + remote mode, remember the gateway host owns the session store and workspace. -Yes. Copy the **state directory** and **workspace**, then run Doctor once. This -keeps your bot "exactly the same" (memory, session history, auth, and channel -state) as long as you copy **both** locations: + **Important:** if you only commit/push your workspace to GitHub, you're backing + up **memory + bootstrap files**, but **not** session history or auth. Those live + under `~/.openclaw/` (for example `~/.openclaw/agents//sessions/`). -1. Install OpenClaw on the new machine. -2. Copy `$OPENCLAW_STATE_DIR` (default: `~/.openclaw`) from the old machine. -3. Copy your workspace (default: `~/.openclaw/workspace`). -4. Run `openclaw doctor` and restart the Gateway service. + Related: [Migrating](/install/migrating), [Where things live on disk](#where-things-live-on-disk), + [Agent workspace](/concepts/agent-workspace), [Doctor](/gateway/doctor), + [Remote mode](/gateway/remote). -That preserves config, auth profiles, WhatsApp creds, sessions, and memory. If you're in -remote mode, remember the gateway host owns the session store and workspace. + -**Important:** if you only commit/push your workspace to GitHub, you're backing -up **memory + bootstrap files**, but **not** session history or auth. Those live -under `~/.openclaw/` (for example `~/.openclaw/agents//sessions/`). + + Check the GitHub changelog: + [https://github.com/openclaw/openclaw/blob/main/CHANGELOG.md](https://github.com/openclaw/openclaw/blob/main/CHANGELOG.md) -Related: [Migrating](/install/migrating), [Where things live on disk](/help/faq#where-does-openclaw-store-its-data), -[Agent workspace](/concepts/agent-workspace), [Doctor](/gateway/doctor), -[Remote mode](/gateway/remote). + Newest entries are at the top. If the top section is marked **Unreleased**, the next dated + section is the latest shipped version. Entries are grouped by **Highlights**, **Changes**, and + **Fixes** (plus docs/other sections when needed). -### Where do I see what is new in the latest version + -Check the GitHub changelog: -[https://github.com/openclaw/openclaw/blob/main/CHANGELOG.md](https://github.com/openclaw/openclaw/blob/main/CHANGELOG.md) + + Some Comcast/Xfinity connections incorrectly block `docs.openclaw.ai` via Xfinity + Advanced Security. Disable it or allowlist `docs.openclaw.ai`, then retry. More + detail: [Troubleshooting](/help/faq#docsopenclawai-shows-an-ssl-error-comcast-xfinity). + Please help us unblock it by reporting here: [https://spa.xfinity.com/check_url_status](https://spa.xfinity.com/check_url_status). -Newest entries are at the top. If the top section is marked **Unreleased**, the next dated -section is the latest shipped version. Entries are grouped by **Highlights**, **Changes**, and -**Fixes** (plus docs/other sections when needed). + If you still can't reach the site, the docs are mirrored on GitHub: + [https://github.com/openclaw/openclaw/tree/main/docs](https://github.com/openclaw/openclaw/tree/main/docs) -### Cannot access docs.openclaw.ai (SSL error) + -Some Comcast/Xfinity connections incorrectly block `docs.openclaw.ai` via Xfinity -Advanced Security. Disable it or allowlist `docs.openclaw.ai`, then retry. More -detail: [Troubleshooting](/help/troubleshooting#docsopenclawai-shows-an-ssl-error-comcastxfinity). -Please help us unblock it by reporting here: [https://spa.xfinity.com/check_url_status](https://spa.xfinity.com/check_url_status). + + **Stable** and **beta** are **npm dist-tags**, not separate code lines: -If you still can't reach the site, the docs are mirrored on GitHub: -[https://github.com/openclaw/openclaw/tree/main/docs](https://github.com/openclaw/openclaw/tree/main/docs) + - `latest` = stable + - `beta` = early build for testing -### Difference between stable and beta + We ship builds to **beta**, test them, and once a build is solid we **promote + that same version to `latest`**. That's why beta and stable can point at the + **same version**. -**Stable** and **beta** are **npm dist-tags**, not separate code lines: + See what changed: + [https://github.com/openclaw/openclaw/blob/main/CHANGELOG.md](https://github.com/openclaw/openclaw/blob/main/CHANGELOG.md) -- `latest` = stable -- `beta` = early build for testing + -We ship builds to **beta**, test them, and once a build is solid we **promote -that same version to `latest`**. That's why beta and stable can point at the -**same version**. + + **Beta** is the npm dist-tag `beta` (may match `latest`). + **Dev** is the moving head of `main` (git); when published, it uses the npm dist-tag `dev`. -See what changed: -[https://github.com/openclaw/openclaw/blob/main/CHANGELOG.md](https://github.com/openclaw/openclaw/blob/main/CHANGELOG.md) + One-liners (macOS/Linux): -### How do I install the beta version and what is the difference between beta and dev + ```bash + curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- --beta + ``` -**Beta** is the npm dist-tag `beta` (may match `latest`). -**Dev** is the moving head of `main` (git); when published, it uses the npm dist-tag `dev`. + ```bash + curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- --install-method git + ``` -One-liners (macOS/Linux): + Windows installer (PowerShell): + [https://openclaw.ai/install.ps1](https://openclaw.ai/install.ps1) -```bash -curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- --beta -``` + More detail: [Development channels](/install/development-channels) and [Installer flags](/install/installer). -```bash -curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- --install-method git -``` + -Windows installer (PowerShell): -[https://openclaw.ai/install.ps1](https://openclaw.ai/install.ps1) + + Two options: -More detail: [Development channels](/install/development-channels) and [Installer flags](/install/installer). + 1. **Dev channel (git checkout):** -### How long does install and onboarding usually take + ```bash + openclaw update --channel dev + ``` -Rough guide: + This switches to the `main` branch and updates from source. -- **Install:** 2-5 minutes -- **Onboarding:** 5-15 minutes depending on how many channels/models you configure + 2. **Hackable install (from the installer site):** -If it hangs, use [Installer stuck](/help/faq#installer-stuck-how-do-i-get-more-feedback) -and the fast debug loop in [I am stuck](/help/faq#i-am-stuck---fastest-way-to-get-unstuck). + ```bash + curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method git + ``` -### How do I try the latest bits + That gives you a local repo you can edit, then update via git. -Two options: + If you prefer a clean clone manually, use: -1. **Dev channel (git checkout):** + ```bash + git clone https://github.com/openclaw/openclaw.git + cd openclaw + pnpm install + pnpm build + ``` -```bash -openclaw update --channel dev -``` + Docs: [Update](/cli/update), [Development channels](/install/development-channels), + [Install](/install). -This switches to the `main` branch and updates from source. + -2. **Hackable install (from the installer site):** + + Rough guide: -```bash -curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method git -``` + - **Install:** 2-5 minutes + - **Onboarding:** 5-15 minutes depending on how many channels/models you configure -That gives you a local repo you can edit, then update via git. + If it hangs, use [Installer stuck](#quick-start-and-first-run-setup) + and the fast debug loop in [I am stuck](#quick-start-and-first-run-setup). -If you prefer a clean clone manually, use: + -```bash -git clone https://github.com/openclaw/openclaw.git -cd openclaw -pnpm install -pnpm build -``` + + Re-run the installer with **verbose output**: -Docs: [Update](/cli/update), [Development channels](/install/development-channels), -[Install](/install). + ```bash + curl -fsSL https://openclaw.ai/install.sh | bash -s -- --verbose + ``` -### Installer stuck How do I get more feedback + Beta install with verbose: -Re-run the installer with **verbose output**: + ```bash + curl -fsSL https://openclaw.ai/install.sh | bash -s -- --beta --verbose + ``` -```bash -curl -fsSL https://openclaw.ai/install.sh | bash -s -- --verbose -``` + For a hackable (git) install: -Beta install with verbose: + ```bash + curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method git --verbose + ``` -```bash -curl -fsSL https://openclaw.ai/install.sh | bash -s -- --beta --verbose -``` + Windows (PowerShell) equivalent: -For a hackable (git) install: + ```powershell + # install.ps1 has no dedicated -Verbose flag yet. + Set-PSDebug -Trace 1 + & ([scriptblock]::Create((iwr -useb https://openclaw.ai/install.ps1))) -NoOnboard + Set-PSDebug -Trace 0 + ``` -```bash -curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method git --verbose -``` + More options: [Installer flags](/install/installer). -Windows (PowerShell) equivalent: + -```powershell -# install.ps1 has no dedicated -Verbose flag yet. -Set-PSDebug -Trace 1 -& ([scriptblock]::Create((iwr -useb https://openclaw.ai/install.ps1))) -NoOnboard -Set-PSDebug -Trace 0 -``` + + Two common Windows issues: -More options: [Installer flags](/install/installer). + **1) npm error spawn git / git not found** -### Windows install says git not found or openclaw not recognized + - Install **Git for Windows** and make sure `git` is on your PATH. + - Close and reopen PowerShell, then re-run the installer. -Two common Windows issues: + **2) openclaw is not recognized after install** -**1) npm error spawn git / git not found** + - Your npm global bin folder is not on PATH. + - Check the path: -- Install **Git for Windows** and make sure `git` is on your PATH. -- Close and reopen PowerShell, then re-run the installer. + ```powershell + npm config get prefix + ``` -**2) openclaw is not recognized after install** + - Add that directory to your user PATH (no `\bin` suffix needed on Windows; on most systems it is `%AppData%\npm`). + - Close and reopen PowerShell after updating PATH. -- Your npm global bin folder is not on PATH. -- Check the path: + If you want the smoothest Windows setup, use **WSL2** instead of native Windows. + Docs: [Windows](/platforms/windows). - ```powershell - npm config get prefix - ``` + -- Add that directory to your user PATH (no `\bin` suffix needed on Windows; on most systems it is `%AppData%\npm`). -- Close and reopen PowerShell after updating PATH. + + This is usually a console code page mismatch on native Windows shells. -If you want the smoothest Windows setup, use **WSL2** instead of native Windows. -Docs: [Windows](/platforms/windows). + Symptoms: -### Windows exec output shows garbled Chinese text what should I do + - `system.run`/`exec` output renders Chinese as mojibake + - The same command looks fine in another terminal profile -This is usually a console code page mismatch on native Windows shells. + Quick workaround in PowerShell: -Symptoms: + ```powershell + chcp 65001 + [Console]::InputEncoding = [System.Text.UTF8Encoding]::new($false) + [Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false) + $OutputEncoding = [System.Text.UTF8Encoding]::new($false) + ``` -- `system.run`/`exec` output renders Chinese as mojibake -- The same command looks fine in another terminal profile + Then restart the Gateway and retry your command: -Quick workaround in PowerShell: + ```powershell + openclaw gateway restart + ``` -```powershell -chcp 65001 -[Console]::InputEncoding = [System.Text.UTF8Encoding]::new($false) -[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false) -$OutputEncoding = [System.Text.UTF8Encoding]::new($false) -``` + If you still reproduce this on latest OpenClaw, track/report it in: -Then restart the Gateway and retry your command: + - [Issue #30640](https://github.com/openclaw/openclaw/issues/30640) -```powershell -openclaw gateway restart -``` + -If you still reproduce this on latest OpenClaw, track/report it in: + + Use the **hackable (git) install** so you have the full source and docs locally, then ask + your bot (or Claude/Codex) _from that folder_ so it can read the repo and answer precisely. -- [Issue #30640](https://github.com/openclaw/openclaw/issues/30640) + ```bash + curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method git + ``` -### The docs did not answer my question - how do I get a better answer + More detail: [Install](/install) and [Installer flags](/install/installer). -Use the **hackable (git) install** so you have the full source and docs locally, then ask -your bot (or Claude/Codex) _from that folder_ so it can read the repo and answer precisely. + -```bash -curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method git -``` + + Short answer: follow the Linux guide, then run onboarding. -More detail: [Install](/install) and [Installer flags](/install/installer). + - Linux quick path + service install: [Linux](/platforms/linux). + - Full walkthrough: [Getting Started](/start/getting-started). + - Installer + updates: [Install & updates](/install/updating). -### How do I install OpenClaw on Linux + -Short answer: follow the Linux guide, then run onboarding. + + Any Linux VPS works. Install on the server, then use SSH/Tailscale to reach the Gateway. -- Linux quick path + service install: [Linux](/platforms/linux). -- Full walkthrough: [Getting Started](/start/getting-started). -- Installer + updates: [Install & updates](/install/updating). + Guides: [exe.dev](/install/exe-dev), [Hetzner](/install/hetzner), [Fly.io](/install/fly). + Remote access: [Gateway remote](/gateway/remote). -### How do I install OpenClaw on a VPS + -Any Linux VPS works. Install on the server, then use SSH/Tailscale to reach the Gateway. + + We keep a **hosting hub** with the common providers. Pick one and follow the guide: -Guides: [exe.dev](/install/exe-dev), [Hetzner](/install/hetzner), [Fly.io](/install/fly). -Remote access: [Gateway remote](/gateway/remote). + - [VPS hosting](/vps) (all providers in one place) + - [Fly.io](/install/fly) + - [Hetzner](/install/hetzner) + - [exe.dev](/install/exe-dev) -### Where are the cloudVPS install guides + How it works in the cloud: the **Gateway runs on the server**, and you access it + from your laptop/phone via the Control UI (or Tailscale/SSH). Your state + workspace + live on the server, so treat the host as the source of truth and back it up. -We keep a **hosting hub** with the common providers. Pick one and follow the guide: + You can pair **nodes** (Mac/iOS/Android/headless) to that cloud Gateway to access + local screen/camera/canvas or run commands on your laptop while keeping the + Gateway in the cloud. -- [VPS hosting](/vps) (all providers in one place) -- [Fly.io](/install/fly) -- [Hetzner](/install/hetzner) -- [exe.dev](/install/exe-dev) + Hub: [Platforms](/platforms). Remote access: [Gateway remote](/gateway/remote). + Nodes: [Nodes](/nodes), [Nodes CLI](/cli/nodes). -How it works in the cloud: the **Gateway runs on the server**, and you access it -from your laptop/phone via the Control UI (or Tailscale/SSH). Your state + workspace -live on the server, so treat the host as the source of truth and back it up. + -You can pair **nodes** (Mac/iOS/Android/headless) to that cloud Gateway to access -local screen/camera/canvas or run commands on your laptop while keeping the -Gateway in the cloud. + + Short answer: **possible, not recommended**. The update flow can restart the + Gateway (which drops the active session), may need a clean git checkout, and + can prompt for confirmation. Safer: run updates from a shell as the operator. -Hub: [Platforms](/platforms). Remote access: [Gateway remote](/gateway/remote). -Nodes: [Nodes](/nodes), [Nodes CLI](/cli/nodes). + Use the CLI: -### Can I ask OpenClaw to update itself + ```bash + openclaw update + openclaw update status + openclaw update --channel stable|beta|dev + openclaw update --tag + openclaw update --no-restart + ``` -Short answer: **possible, not recommended**. The update flow can restart the -Gateway (which drops the active session), may need a clean git checkout, and -can prompt for confirmation. Safer: run updates from a shell as the operator. + If you must automate from an agent: -Use the CLI: + ```bash + openclaw update --yes --no-restart + openclaw gateway restart + ``` -```bash -openclaw update -openclaw update status -openclaw update --channel stable|beta|dev -openclaw update --tag -openclaw update --no-restart -``` + Docs: [Update](/cli/update), [Updating](/install/updating). -If you must automate from an agent: + -```bash -openclaw update --yes --no-restart -openclaw gateway restart -``` + + `openclaw onboard` is the recommended setup path. In **local mode** it walks you through: -Docs: [Update](/cli/update), [Updating](/install/updating). + - **Model/auth setup** (provider OAuth/setup-token flows and API keys supported, plus local model options such as LM Studio) + - **Workspace** location + bootstrap files + - **Gateway settings** (bind/port/auth/tailscale) + - **Providers** (WhatsApp, Telegram, Discord, Mattermost (plugin), Signal, iMessage) + - **Daemon install** (LaunchAgent on macOS; systemd user unit on Linux/WSL2) + - **Health checks** and **skills** selection -### What does onboarding actually do + It also warns if your configured model is unknown or missing auth. -`openclaw onboard` is the recommended setup path. In **local mode** it walks you through: + -- **Model/auth setup** (provider OAuth/setup-token flows and API keys supported, plus local model options such as LM Studio) -- **Workspace** location + bootstrap files -- **Gateway settings** (bind/port/auth/tailscale) -- **Providers** (WhatsApp, Telegram, Discord, Mattermost (plugin), Signal, iMessage) -- **Daemon install** (LaunchAgent on macOS; systemd user unit on Linux/WSL2) -- **Health checks** and **skills** selection + + No. You can run OpenClaw with **API keys** (Anthropic/OpenAI/others) or with + **local-only models** so your data stays on your device. Subscriptions (Claude + Pro/Max or OpenAI Codex) are optional ways to authenticate those providers. -It also warns if your configured model is unknown or missing auth. + If you choose Anthropic subscription auth, decide for yourself whether to use it: + Anthropic has blocked some subscription usage outside Claude Code in the past. + OpenAI Codex OAuth is explicitly supported for external tools like OpenClaw. -### Do I need a Claude or OpenAI subscription to run this + Docs: [Anthropic](/providers/anthropic), [OpenAI](/providers/openai), + [Local models](/gateway/local-models), [Models](/concepts/models). -No. You can run OpenClaw with **API keys** (Anthropic/OpenAI/others) or with -**local-only models** so your data stays on your device. Subscriptions (Claude -Pro/Max or OpenAI Codex) are optional ways to authenticate those providers. + -If you choose Anthropic subscription auth, decide for yourself whether to use it: -Anthropic has blocked some subscription usage outside Claude Code in the past. -OpenAI Codex OAuth is explicitly supported for external tools like OpenClaw. + + Yes. You can authenticate with a **setup-token** + instead of an API key. This is the subscription path. -Docs: [Anthropic](/providers/anthropic), [OpenAI](/providers/openai), -[Local models](/gateway/local-models), [Models](/concepts/models). + Claude Pro/Max subscriptions **do not include an API key**, so this is the + technical path for subscription accounts. But this is your decision: Anthropic + has blocked some subscription usage outside Claude Code in the past. + If you want the clearest and safest supported path for production, use an Anthropic API key. -### Can I use Claude Max subscription without an API key + -Yes. You can authenticate with a **setup-token** -instead of an API key. This is the subscription path. + + `claude setup-token` generates a **token string** via the Claude Code CLI (it is not available in the web console). You can run it on **any machine**. Choose **Anthropic token (paste setup-token)** in onboarding or paste it with `openclaw models auth paste-token --provider anthropic`. The token is stored as an auth profile for the **anthropic** provider and used like an API key (no auto-refresh). More detail: [OAuth](/concepts/oauth). + -Claude Pro/Max subscriptions **do not include an API key**, so this is the -technical path for subscription accounts. But this is your decision: Anthropic -has blocked some subscription usage outside Claude Code in the past. -If you want the clearest and safest supported path for production, use an Anthropic API key. + + It is **not** in the Anthropic Console. The setup-token is generated by the **Claude Code CLI** on **any machine**: -### How does Anthropic setuptoken auth work + ```bash + claude setup-token + ``` -`claude setup-token` generates a **token string** via the Claude Code CLI (it is not available in the web console). You can run it on **any machine**. Choose **Anthropic token (paste setup-token)** in onboarding or paste it with `openclaw models auth paste-token --provider anthropic`. The token is stored as an auth profile for the **anthropic** provider and used like an API key (no auto-refresh). More detail: [OAuth](/concepts/oauth). + Copy the token it prints, then choose **Anthropic token (paste setup-token)** in onboarding. If you want to run it on the gateway host, use `openclaw models auth setup-token --provider anthropic`. If you ran `claude setup-token` elsewhere, paste it on the gateway host with `openclaw models auth paste-token --provider anthropic`. See [Anthropic](/providers/anthropic). -### Where do I find an Anthropic setuptoken + -It is **not** in the Anthropic Console. The setup-token is generated by the **Claude Code CLI** on **any machine**: + + Yes - via **setup-token**. OpenClaw no longer reuses Claude Code CLI OAuth tokens; use a setup-token or an Anthropic API key. Generate the token anywhere and paste it on the gateway host. See [Anthropic](/providers/anthropic) and [OAuth](/concepts/oauth). -```bash -claude setup-token -``` + Important: this is technical compatibility, not a policy guarantee. Anthropic + has blocked some subscription usage outside Claude Code in the past. + You need to decide whether to use it and verify Anthropic's current terms. + For production or multi-user workloads, Anthropic API key auth is the safer, recommended choice. -Copy the token it prints, then choose **Anthropic token (paste setup-token)** in onboarding. If you want to run it on the gateway host, use `openclaw models auth setup-token --provider anthropic`. If you ran `claude setup-token` elsewhere, paste it on the gateway host with `openclaw models auth paste-token --provider anthropic`. See [Anthropic](/providers/anthropic). + -### Do you support Claude subscription auth (Claude Pro or Max) + + That means your **Anthropic quota/rate limit** is exhausted for the current window. If you + use a **Claude subscription** (setup-token), wait for the window to + reset or upgrade your plan. If you use an **Anthropic API key**, check the Anthropic Console + for usage/billing and raise limits as needed. -Yes - via **setup-token**. OpenClaw no longer reuses Claude Code CLI OAuth tokens; use a setup-token or an Anthropic API key. Generate the token anywhere and paste it on the gateway host. See [Anthropic](/providers/anthropic) and [OAuth](/concepts/oauth). + If the message is specifically: + `Extra usage is required for long context requests`, the request is trying to use + Anthropic's 1M context beta (`context1m: true`). That only works when your + credential is eligible for long-context billing (API key billing or subscription + with Extra Usage enabled). -Important: this is technical compatibility, not a policy guarantee. Anthropic -has blocked some subscription usage outside Claude Code in the past. -You need to decide whether to use it and verify Anthropic's current terms. -For production or multi-user workloads, Anthropic API key auth is the safer, recommended choice. + Tip: set a **fallback model** so OpenClaw can keep replying while a provider is rate-limited. + See [Models](/cli/models), [OAuth](/concepts/oauth), and + [/gateway/troubleshooting#anthropic-429-extra-usage-required-for-long-context](/gateway/troubleshooting#anthropic-429-extra-usage-required-for-long-context). -### Why am I seeing HTTP 429 ratelimiterror from Anthropic + -That means your **Anthropic quota/rate limit** is exhausted for the current window. If you -use a **Claude subscription** (setup-token), wait for the window to -reset or upgrade your plan. If you use an **Anthropic API key**, check the Anthropic Console -for usage/billing and raise limits as needed. + + Yes - via pi-ai's **Amazon Bedrock (Converse)** provider with **manual config**. You must supply AWS credentials/region on the gateway host and add a Bedrock provider entry in your models config. See [Amazon Bedrock](/providers/bedrock) and [Model providers](/providers/models). If you prefer a managed key flow, an OpenAI-compatible proxy in front of Bedrock is still a valid option. + -If the message is specifically: -`Extra usage is required for long context requests`, the request is trying to use -Anthropic's 1M context beta (`context1m: true`). That only works when your -credential is eligible for long-context billing (API key billing or subscription -with Extra Usage enabled). + + OpenClaw supports **OpenAI Code (Codex)** via OAuth (ChatGPT sign-in). Onboarding can run the OAuth flow and will set the default model to `openai-codex/gpt-5.4` when appropriate. See [Model providers](/concepts/model-providers) and [Onboarding (CLI)](/start/wizard). + -Tip: set a **fallback model** so OpenClaw can keep replying while a provider is rate-limited. -See [Models](/cli/models), [OAuth](/concepts/oauth), and -[/gateway/troubleshooting#anthropic-429-extra-usage-required-for-long-context](/gateway/troubleshooting#anthropic-429-extra-usage-required-for-long-context). + + Yes. OpenClaw fully supports **OpenAI Code (Codex) subscription OAuth**. + OpenAI explicitly allows subscription OAuth usage in external tools/workflows + like OpenClaw. Onboarding can run the OAuth flow for you. -### Is AWS Bedrock supported + See [OAuth](/concepts/oauth), [Model providers](/concepts/model-providers), and [Onboarding (CLI)](/start/wizard). -Yes - via pi-ai's **Amazon Bedrock (Converse)** provider with **manual config**. You must supply AWS credentials/region on the gateway host and add a Bedrock provider entry in your models config. See [Amazon Bedrock](/providers/bedrock) and [Model providers](/providers/models). If you prefer a managed key flow, an OpenAI-compatible proxy in front of Bedrock is still a valid option. + -### How does Codex auth work + + Gemini CLI uses a **plugin auth flow**, not a client id or secret in `openclaw.json`. -OpenClaw supports **OpenAI Code (Codex)** via OAuth (ChatGPT sign-in). Onboarding can run the OAuth flow and will set the default model to `openai-codex/gpt-5.4` when appropriate. See [Model providers](/concepts/model-providers) and [Onboarding (CLI)](/start/wizard). + Steps: -### Do you support OpenAI subscription auth Codex OAuth + 1. Enable the plugin: `openclaw plugins enable google` + 2. Login: `openclaw models auth login --provider google-gemini-cli --set-default` -Yes. OpenClaw fully supports **OpenAI Code (Codex) subscription OAuth**. -OpenAI explicitly allows subscription OAuth usage in external tools/workflows -like OpenClaw. Onboarding can run the OAuth flow for you. + This stores OAuth tokens in auth profiles on the gateway host. Details: [Model providers](/concepts/model-providers). -See [OAuth](/concepts/oauth), [Model providers](/concepts/model-providers), and [Onboarding (CLI)](/start/wizard). + -### How do I set up Gemini CLI OAuth + + Usually no. OpenClaw needs large context + strong safety; small cards truncate and leak. If you must, run the **largest** MiniMax M2.5 build you can locally (LM Studio) and see [/gateway/local-models](/gateway/local-models). Smaller/quantized models increase prompt-injection risk - see [Security](/gateway/security). + -Gemini CLI uses a **plugin auth flow**, not a client id or secret in `openclaw.json`. + + Pick region-pinned endpoints. OpenRouter exposes US-hosted options for MiniMax, Kimi, and GLM; choose the US-hosted variant to keep data in-region. You can still list Anthropic/OpenAI alongside these by using `models.mode: "merge"` so fallbacks stay available while respecting the regioned provider you select. + -Steps: + + No. OpenClaw runs on macOS or Linux (Windows via WSL2). A Mac mini is optional - some people + buy one as an always-on host, but a small VPS, home server, or Raspberry Pi-class box works too. -1. Enable the plugin: `openclaw plugins enable google` -2. Login: `openclaw models auth login --provider google-gemini-cli --set-default` + You only need a Mac **for macOS-only tools**. For iMessage, use [BlueBubbles](/channels/bluebubbles) (recommended) - the BlueBubbles server runs on any Mac, and the Gateway can run on Linux or elsewhere. If you want other macOS-only tools, run the Gateway on a Mac or pair a macOS node. -This stores OAuth tokens in auth profiles on the gateway host. Details: [Model providers](/concepts/model-providers). + Docs: [BlueBubbles](/channels/bluebubbles), [Nodes](/nodes), [Mac remote mode](/platforms/mac/remote). -### Is a local model OK for casual chats + -Usually no. OpenClaw needs large context + strong safety; small cards truncate and leak. If you must, run the **largest** MiniMax M2.5 build you can locally (LM Studio) and see [/gateway/local-models](/gateway/local-models). Smaller/quantized models increase prompt-injection risk - see [Security](/gateway/security). + + You need **some macOS device** signed into Messages. It does **not** have to be a Mac mini - + any Mac works. **Use [BlueBubbles](/channels/bluebubbles)** (recommended) for iMessage - the BlueBubbles server runs on macOS, while the Gateway can run on Linux or elsewhere. -### How do I keep hosted model traffic in a specific region + Common setups: -Pick region-pinned endpoints. OpenRouter exposes US-hosted options for MiniMax, Kimi, and GLM; choose the US-hosted variant to keep data in-region. You can still list Anthropic/OpenAI alongside these by using `models.mode: "merge"` so fallbacks stay available while respecting the regioned provider you select. + - Run the Gateway on Linux/VPS, and run the BlueBubbles server on any Mac signed into Messages. + - Run everything on the Mac if you want the simplest single-machine setup. -### Do I have to buy a Mac Mini to install this + Docs: [BlueBubbles](/channels/bluebubbles), [Nodes](/nodes), + [Mac remote mode](/platforms/mac/remote). -No. OpenClaw runs on macOS or Linux (Windows via WSL2). A Mac mini is optional - some people -buy one as an always-on host, but a small VPS, home server, or Raspberry Pi-class box works too. + -You only need a Mac **for macOS-only tools**. For iMessage, use [BlueBubbles](/channels/bluebubbles) (recommended) - the BlueBubbles server runs on any Mac, and the Gateway can run on Linux or elsewhere. If you want other macOS-only tools, run the Gateway on a Mac or pair a macOS node. + + Yes. The **Mac mini can run the Gateway**, and your MacBook Pro can connect as a + **node** (companion device). Nodes don't run the Gateway - they provide extra + capabilities like screen/camera/canvas and `system.run` on that device. -Docs: [BlueBubbles](/channels/bluebubbles), [Nodes](/nodes), [Mac remote mode](/platforms/mac/remote). + Common pattern: -### Do I need a Mac mini for iMessage support + - Gateway on the Mac mini (always-on). + - MacBook Pro runs the macOS app or a node host and pairs to the Gateway. + - Use `openclaw nodes status` / `openclaw nodes list` to see it. -You need **some macOS device** signed into Messages. It does **not** have to be a Mac mini - -any Mac works. **Use [BlueBubbles](/channels/bluebubbles)** (recommended) for iMessage - the BlueBubbles server runs on macOS, while the Gateway can run on Linux or elsewhere. + Docs: [Nodes](/nodes), [Nodes CLI](/cli/nodes). -Common setups: + -- Run the Gateway on Linux/VPS, and run the BlueBubbles server on any Mac signed into Messages. -- Run everything on the Mac if you want the simplest single‑machine setup. + + Bun is **not recommended**. We see runtime bugs, especially with WhatsApp and Telegram. + Use **Node** for stable gateways. -Docs: [BlueBubbles](/channels/bluebubbles), [Nodes](/nodes), -[Mac remote mode](/platforms/mac/remote). + If you still want to experiment with Bun, do it on a non-production gateway + without WhatsApp/Telegram. -### If I buy a Mac mini to run OpenClaw can I connect it to my MacBook Pro + -Yes. The **Mac mini can run the Gateway**, and your MacBook Pro can connect as a -**node** (companion device). Nodes don't run the Gateway - they provide extra -capabilities like screen/camera/canvas and `system.run` on that device. + + `channels.telegram.allowFrom` is **the human sender's Telegram user ID** (numeric). It is not the bot username. -Common pattern: + Onboarding accepts `@username` input and resolves it to a numeric ID, but OpenClaw authorization uses numeric IDs only. -- Gateway on the Mac mini (always-on). -- MacBook Pro runs the macOS app or a node host and pairs to the Gateway. -- Use `openclaw nodes status` / `openclaw nodes list` to see it. + Safer (no third-party bot): -Docs: [Nodes](/nodes), [Nodes CLI](/cli/nodes). + - DM your bot, then run `openclaw logs --follow` and read `from.id`. -### Can I use Bun + Official Bot API: -Bun is **not recommended**. We see runtime bugs, especially with WhatsApp and Telegram. -Use **Node** for stable gateways. + - DM your bot, then call `https://api.telegram.org/bot/getUpdates` and read `message.from.id`. -If you still want to experiment with Bun, do it on a non-production gateway -without WhatsApp/Telegram. + Third-party (less private): -### Telegram what goes in allowFrom + - DM `@userinfobot` or `@getidsbot`. -`channels.telegram.allowFrom` is **the human sender's Telegram user ID** (numeric). It is not the bot username. + See [/channels/telegram](/channels/telegram#access-control-and-activation). -Onboarding accepts `@username` input and resolves it to a numeric ID, but OpenClaw authorization uses numeric IDs only. + -Safer (no third-party bot): + + Yes, via **multi-agent routing**. Bind each sender's WhatsApp **DM** (peer `kind: "direct"`, sender E.164 like `+15551234567`) to a different `agentId`, so each person gets their own workspace and session store. Replies still come from the **same WhatsApp account**, and DM access control (`channels.whatsapp.dmPolicy` / `channels.whatsapp.allowFrom`) is global per WhatsApp account. See [Multi-Agent Routing](/concepts/multi-agent) and [WhatsApp](/channels/whatsapp). + -- DM your bot, then run `openclaw logs --follow` and read `from.id`. + + Yes. Use multi-agent routing: give each agent its own default model, then bind inbound routes (provider account or specific peers) to each agent. Example config lives in [Multi-Agent Routing](/concepts/multi-agent). See also [Models](/concepts/models) and [Configuration](/gateway/configuration). + -Official Bot API: + + Yes. Homebrew supports Linux (Linuxbrew). Quick setup: -- DM your bot, then call `https://api.telegram.org/bot/getUpdates` and read `message.from.id`. + ```bash + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.profile + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + brew install + ``` -Third-party (less private): + If you run OpenClaw via systemd, ensure the service PATH includes `/home/linuxbrew/.linuxbrew/bin` (or your brew prefix) so `brew`-installed tools resolve in non-login shells. + Recent builds also prepend common user bin dirs on Linux systemd services (for example `~/.local/bin`, `~/.npm-global/bin`, `~/.local/share/pnpm`, `~/.bun/bin`) and honor `PNPM_HOME`, `NPM_CONFIG_PREFIX`, `BUN_INSTALL`, `VOLTA_HOME`, `ASDF_DATA_DIR`, `NVM_DIR`, and `FNM_DIR` when set. -- DM `@userinfobot` or `@getidsbot`. + -See [/channels/telegram](/channels/telegram#access-control-dms--groups). + + - **Hackable (git) install:** full source checkout, editable, best for contributors. + You run builds locally and can patch code/docs. + - **npm install:** global CLI install, no repo, best for "just run it." + Updates come from npm dist-tags. -### Can multiple people use one WhatsApp number with different OpenClaw instances + Docs: [Getting started](/start/getting-started), [Updating](/install/updating). -Yes, via **multi-agent routing**. Bind each sender's WhatsApp **DM** (peer `kind: "direct"`, sender E.164 like `+15551234567`) to a different `agentId`, so each person gets their own workspace and session store. Replies still come from the **same WhatsApp account**, and DM access control (`channels.whatsapp.dmPolicy` / `channels.whatsapp.allowFrom`) is global per WhatsApp account. See [Multi-Agent Routing](/concepts/multi-agent) and [WhatsApp](/channels/whatsapp). + -### Can I run a fast chat agent and an Opus for coding agent + + Yes. Install the other flavor, then run Doctor so the gateway service points at the new entrypoint. + This **does not delete your data** - it only changes the OpenClaw code install. Your state + (`~/.openclaw`) and workspace (`~/.openclaw/workspace`) stay untouched. -Yes. Use multi-agent routing: give each agent its own default model, then bind inbound routes (provider account or specific peers) to each agent. Example config lives in [Multi-Agent Routing](/concepts/multi-agent). See also [Models](/concepts/models) and [Configuration](/gateway/configuration). + From npm to git: -### Does Homebrew work on Linux + ```bash + git clone https://github.com/openclaw/openclaw.git + cd openclaw + pnpm install + pnpm build + openclaw doctor + openclaw gateway restart + ``` -Yes. Homebrew supports Linux (Linuxbrew). Quick setup: + From git to npm: -```bash -/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.profile -eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" -brew install -``` + ```bash + npm install -g openclaw@latest + openclaw doctor + openclaw gateway restart + ``` -If you run OpenClaw via systemd, ensure the service PATH includes `/home/linuxbrew/.linuxbrew/bin` (or your brew prefix) so `brew`-installed tools resolve in non-login shells. -Recent builds also prepend common user bin dirs on Linux systemd services (for example `~/.local/bin`, `~/.npm-global/bin`, `~/.local/share/pnpm`, `~/.bun/bin`) and honor `PNPM_HOME`, `NPM_CONFIG_PREFIX`, `BUN_INSTALL`, `VOLTA_HOME`, `ASDF_DATA_DIR`, `NVM_DIR`, and `FNM_DIR` when set. + Doctor detects a gateway service entrypoint mismatch and offers to rewrite the service config to match the current install (use `--repair` in automation). -### Difference between the hackable git install and npm install + Backup tips: see [Backup strategy](#where-things-live-on-disk). -- **Hackable (git) install:** full source checkout, editable, best for contributors. - You run builds locally and can patch code/docs. -- **npm install:** global CLI install, no repo, best for "just run it." - Updates come from npm dist-tags. + -Docs: [Getting started](/start/getting-started), [Updating](/install/updating). + + Short answer: **if you want 24/7 reliability, use a VPS**. If you want the + lowest friction and you're okay with sleep/restarts, run it locally. -### Can I switch between npm and git installs later + **Laptop (local Gateway)** -Yes. Install the other flavor, then run Doctor so the gateway service points at the new entrypoint. -This **does not delete your data** - it only changes the OpenClaw code install. Your state -(`~/.openclaw`) and workspace (`~/.openclaw/workspace`) stay untouched. + - **Pros:** no server cost, direct access to local files, live browser window. + - **Cons:** sleep/network drops = disconnects, OS updates/reboots interrupt, must stay awake. -From npm → git: + **VPS / cloud** -```bash -git clone https://github.com/openclaw/openclaw.git -cd openclaw -pnpm install -pnpm build -openclaw doctor -openclaw gateway restart -``` + - **Pros:** always-on, stable network, no laptop sleep issues, easier to keep running. + - **Cons:** often run headless (use screenshots), remote file access only, you must SSH for updates. -From git → npm: + **OpenClaw-specific note:** WhatsApp/Telegram/Slack/Mattermost (plugin)/Discord all work fine from a VPS. The only real trade-off is **headless browser** vs a visible window. See [Browser](/tools/browser). -```bash -npm install -g openclaw@latest -openclaw doctor -openclaw gateway restart -``` + **Recommended default:** VPS if you had gateway disconnects before. Local is great when you're actively using the Mac and want local file access or UI automation with a visible browser. -Doctor detects a gateway service entrypoint mismatch and offers to rewrite the service config to match the current install (use `--repair` in automation). + -Backup tips: see [Backup strategy](/help/faq#recommended-backup-strategy). + + Not required, but **recommended for reliability and isolation**. -### Should I run the Gateway on my laptop or a VPS + - **Dedicated host (VPS/Mac mini/Pi):** always-on, fewer sleep/reboot interruptions, cleaner permissions, easier to keep running. + - **Shared laptop/desktop:** totally fine for testing and active use, but expect pauses when the machine sleeps or updates. -Short answer: **if you want 24/7 reliability, use a VPS**. If you want the -lowest friction and you're okay with sleep/restarts, run it locally. + If you want the best of both worlds, keep the Gateway on a dedicated host and pair your laptop as a **node** for local screen/camera/exec tools. See [Nodes](/nodes). + For security guidance, read [Security](/gateway/security). -**Laptop (local Gateway)** + -- **Pros:** no server cost, direct access to local files, live browser window. -- **Cons:** sleep/network drops = disconnects, OS updates/reboots interrupt, must stay awake. + + OpenClaw is lightweight. For a basic Gateway + one chat channel: -**VPS / cloud** + - **Absolute minimum:** 1 vCPU, 1GB RAM, ~500MB disk. + - **Recommended:** 1-2 vCPU, 2GB RAM or more for headroom (logs, media, multiple channels). Node tools and browser automation can be resource hungry. -- **Pros:** always-on, stable network, no laptop sleep issues, easier to keep running. -- **Cons:** often run headless (use screenshots), remote file access only, you must SSH for updates. + OS: use **Ubuntu LTS** (or any modern Debian/Ubuntu). The Linux install path is best tested there. -**OpenClaw-specific note:** WhatsApp/Telegram/Slack/Mattermost (plugin)/Discord all work fine from a VPS. The only real trade-off is **headless browser** vs a visible window. See [Browser](/tools/browser). + Docs: [Linux](/platforms/linux), [VPS hosting](/vps). -**Recommended default:** VPS if you had gateway disconnects before. Local is great when you're actively using the Mac and want local file access or UI automation with a visible browser. + -### How important is it to run OpenClaw on a dedicated machine + + Yes. Treat a VM the same as a VPS: it needs to be always on, reachable, and have enough + RAM for the Gateway and any channels you enable. -Not required, but **recommended for reliability and isolation**. + Baseline guidance: -- **Dedicated host (VPS/Mac mini/Pi):** always-on, fewer sleep/reboot interruptions, cleaner permissions, easier to keep running. -- **Shared laptop/desktop:** totally fine for testing and active use, but expect pauses when the machine sleeps or updates. + - **Absolute minimum:** 1 vCPU, 1GB RAM. + - **Recommended:** 2GB RAM or more if you run multiple channels, browser automation, or media tools. + - **OS:** Ubuntu LTS or another modern Debian/Ubuntu. -If you want the best of both worlds, keep the Gateway on a dedicated host and pair your laptop as a **node** for local screen/camera/exec tools. See [Nodes](/nodes). -For security guidance, read [Security](/gateway/security). + If you are on Windows, **WSL2 is the easiest VM style setup** and has the best tooling + compatibility. See [Windows](/platforms/windows), [VPS hosting](/vps). + If you are running macOS in a VM, see [macOS VM](/install/macos-vm). -### What are the minimum VPS requirements and recommended OS - -OpenClaw is lightweight. For a basic Gateway + one chat channel: - -- **Absolute minimum:** 1 vCPU, 1GB RAM, ~500MB disk. -- **Recommended:** 1-2 vCPU, 2GB RAM or more for headroom (logs, media, multiple channels). Node tools and browser automation can be resource hungry. - -OS: use **Ubuntu LTS** (or any modern Debian/Ubuntu). The Linux install path is best tested there. - -Docs: [Linux](/platforms/linux), [VPS hosting](/vps). - -### Can I run OpenClaw in a VM and what are the requirements - -Yes. Treat a VM the same as a VPS: it needs to be always on, reachable, and have enough -RAM for the Gateway and any channels you enable. - -Baseline guidance: - -- **Absolute minimum:** 1 vCPU, 1GB RAM. -- **Recommended:** 2GB RAM or more if you run multiple channels, browser automation, or media tools. -- **OS:** Ubuntu LTS or another modern Debian/Ubuntu. - -If you are on Windows, **WSL2 is the easiest VM style setup** and has the best tooling -compatibility. See [Windows](/platforms/windows), [VPS hosting](/vps). -If you are running macOS in a VM, see [macOS VM](/install/macos-vm). + + ## What is OpenClaw? -### What is OpenClaw in one paragraph + + + OpenClaw is a personal AI assistant you run on your own devices. It replies on the messaging surfaces you already use (WhatsApp, Telegram, Slack, Mattermost (plugin), Discord, Google Chat, Signal, iMessage, WebChat) and can also do voice + a live Canvas on supported platforms. The **Gateway** is the always-on control plane; the assistant is the product. + -OpenClaw is a personal AI assistant you run on your own devices. It replies on the messaging surfaces you already use (WhatsApp, Telegram, Slack, Mattermost (plugin), Discord, Google Chat, Signal, iMessage, WebChat) and can also do voice + a live Canvas on supported platforms. The **Gateway** is the always-on control plane; the assistant is the product. + + OpenClaw is not "just a Claude wrapper." It's a **local-first control plane** that lets you run a + capable assistant on **your own hardware**, reachable from the chat apps you already use, with + stateful sessions, memory, and tools - without handing control of your workflows to a hosted + SaaS. -### Value proposition + Highlights: -OpenClaw is not "just a Claude wrapper." It's a **local-first control plane** that lets you run a -capable assistant on **your own hardware**, reachable from the chat apps you already use, with -stateful sessions, memory, and tools - without handing control of your workflows to a hosted -SaaS. + - **Your devices, your data:** run the Gateway wherever you want (Mac, Linux, VPS) and keep the + workspace + session history local. + - **Real channels, not a web sandbox:** WhatsApp/Telegram/Slack/Discord/Signal/iMessage/etc, + plus mobile voice and Canvas on supported platforms. + - **Model-agnostic:** use Anthropic, OpenAI, MiniMax, OpenRouter, etc., with per-agent routing + and failover. + - **Local-only option:** run local models so **all data can stay on your device** if you want. + - **Multi-agent routing:** separate agents per channel, account, or task, each with its own + workspace and defaults. + - **Open source and hackable:** inspect, extend, and self-host without vendor lock-in. -Highlights: + Docs: [Gateway](/gateway), [Channels](/channels), [Multi-agent](/concepts/multi-agent), + [Memory](/concepts/memory). -- **Your devices, your data:** run the Gateway wherever you want (Mac, Linux, VPS) and keep the - workspace + session history local. -- **Real channels, not a web sandbox:** WhatsApp/Telegram/Slack/Discord/Signal/iMessage/etc, - plus mobile voice and Canvas on supported platforms. -- **Model-agnostic:** use Anthropic, OpenAI, MiniMax, OpenRouter, etc., with per-agent routing - and failover. -- **Local-only option:** run local models so **all data can stay on your device** if you want. -- **Multi-agent routing:** separate agents per channel, account, or task, each with its own - workspace and defaults. -- **Open source and hackable:** inspect, extend, and self-host without vendor lock-in. + -Docs: [Gateway](/gateway), [Channels](/channels), [Multi-agent](/concepts/multi-agent), -[Memory](/concepts/memory). + + Good first projects: -### I just set it up what should I do first + - Build a website (WordPress, Shopify, or a simple static site). + - Prototype a mobile app (outline, screens, API plan). + - Organize files and folders (cleanup, naming, tagging). + - Connect Gmail and automate summaries or follow ups. -Good first projects: + It can handle large tasks, but it works best when you split them into phases and + use sub agents for parallel work. -- Build a website (WordPress, Shopify, or a simple static site). -- Prototype a mobile app (outline, screens, API plan). -- Organize files and folders (cleanup, naming, tagging). -- Connect Gmail and automate summaries or follow ups. + -It can handle large tasks, but it works best when you split them into phases and -use sub agents for parallel work. + + Everyday wins usually look like: -### What are the top five everyday use cases for OpenClaw + - **Personal briefings:** summaries of inbox, calendar, and news you care about. + - **Research and drafting:** quick research, summaries, and first drafts for emails or docs. + - **Reminders and follow ups:** cron or heartbeat driven nudges and checklists. + - **Browser automation:** filling forms, collecting data, and repeating web tasks. + - **Cross device coordination:** send a task from your phone, let the Gateway run it on a server, and get the result back in chat. -Everyday wins usually look like: + -- **Personal briefings:** summaries of inbox, calendar, and news you care about. -- **Research and drafting:** quick research, summaries, and first drafts for emails or docs. -- **Reminders and follow ups:** cron or heartbeat driven nudges and checklists. -- **Browser automation:** filling forms, collecting data, and repeating web tasks. -- **Cross device coordination:** send a task from your phone, let the Gateway run it on a server, and get the result back in chat. + + Yes for **research, qualification, and drafting**. It can scan sites, build shortlists, + summarize prospects, and write outreach or ad copy drafts. -### Can OpenClaw help with lead gen outreach ads and blogs for a SaaS + For **outreach or ad runs**, keep a human in the loop. Avoid spam, follow local laws and + platform policies, and review anything before it is sent. The safest pattern is to let + OpenClaw draft and you approve. -Yes for **research, qualification, and drafting**. It can scan sites, build shortlists, -summarize prospects, and write outreach or ad copy drafts. + Docs: [Security](/gateway/security). -For **outreach or ad runs**, keep a human in the loop. Avoid spam, follow local laws and -platform policies, and review anything before it is sent. The safest pattern is to let -OpenClaw draft and you approve. + -Docs: [Security](/gateway/security). + + OpenClaw is a **personal assistant** and coordination layer, not an IDE replacement. Use + Claude Code or Codex for the fastest direct coding loop inside a repo. Use OpenClaw when you + want durable memory, cross-device access, and tool orchestration. -### What are the advantages vs Claude Code for web development + Advantages: -OpenClaw is a **personal assistant** and coordination layer, not an IDE replacement. Use -Claude Code or Codex for the fastest direct coding loop inside a repo. Use OpenClaw when you -want durable memory, cross-device access, and tool orchestration. + - **Persistent memory + workspace** across sessions + - **Multi-platform access** (WhatsApp, Telegram, TUI, WebChat) + - **Tool orchestration** (browser, files, scheduling, hooks) + - **Always-on Gateway** (run on a VPS, interact from anywhere) + - **Nodes** for local browser/screen/camera/exec -Advantages: + Showcase: [https://openclaw.ai/showcase](https://openclaw.ai/showcase) -- **Persistent memory + workspace** across sessions -- **Multi-platform access** (WhatsApp, Telegram, TUI, WebChat) -- **Tool orchestration** (browser, files, scheduling, hooks) -- **Always-on Gateway** (run on a VPS, interact from anywhere) -- **Nodes** for local browser/screen/camera/exec - -Showcase: [https://openclaw.ai/showcase](https://openclaw.ai/showcase) + + ## Skills and automation -### How do I customize skills without keeping the repo dirty + + + Use managed overrides instead of editing the repo copy. Put your changes in `~/.openclaw/skills//SKILL.md` (or add a folder via `skills.load.extraDirs` in `~/.openclaw/openclaw.json`). Precedence is `/skills` > `~/.openclaw/skills` > bundled, so managed overrides win without touching git. Only upstream-worthy edits should live in the repo and go out as PRs. + -Use managed overrides instead of editing the repo copy. Put your changes in `~/.openclaw/skills//SKILL.md` (or add a folder via `skills.load.extraDirs` in `~/.openclaw/openclaw.json`). Precedence is `/skills` > `~/.openclaw/skills` > bundled, so managed overrides win without touching git. Only upstream-worthy edits should live in the repo and go out as PRs. + + Yes. Add extra directories via `skills.load.extraDirs` in `~/.openclaw/openclaw.json` (lowest precedence). Default precedence remains: `/skills` → `~/.openclaw/skills` → bundled → `skills.load.extraDirs`. `clawhub` installs into `./skills` by default, which OpenClaw treats as `/skills` on the next session. + -### Can I load skills from a custom folder + + Today the supported patterns are: -Yes. Add extra directories via `skills.load.extraDirs` in `~/.openclaw/openclaw.json` (lowest precedence). Default precedence remains: `/skills` → `~/.openclaw/skills` → bundled → `skills.load.extraDirs`. `clawhub` installs into `./skills` by default, which OpenClaw treats as `/skills`. + - **Cron jobs**: isolated jobs can set a `model` override per job. + - **Sub-agents**: route tasks to separate agents with different default models. + - **On-demand switch**: use `/model` to switch the current session model at any time. -### How can I use different models for different tasks + See [Cron jobs](/automation/cron-jobs), [Multi-Agent Routing](/concepts/multi-agent), and [Slash commands](/tools/slash-commands). -Today the supported patterns are: + -- **Cron jobs**: isolated jobs can set a `model` override per job. -- **Sub-agents**: route tasks to separate agents with different default models. -- **On-demand switch**: use `/model` to switch the current session model at any time. + + Use **sub-agents** for long or parallel tasks. Sub-agents run in their own session, + return a summary, and keep your main chat responsive. -See [Cron jobs](/automation/cron-jobs), [Multi-Agent Routing](/concepts/multi-agent), and [Slash commands](/tools/slash-commands). + Ask your bot to "spawn a sub-agent for this task" or use `/subagents`. + Use `/status` in chat to see what the Gateway is doing right now (and whether it is busy). -### The bot freezes while doing heavy work How do I offload that + Token tip: long tasks and sub-agents both consume tokens. If cost is a concern, set a + cheaper model for sub-agents via `agents.defaults.subagents.model`. -Use **sub-agents** for long or parallel tasks. Sub-agents run in their own session, -return a summary, and keep your main chat responsive. + Docs: [Sub-agents](/tools/subagents). -Ask your bot to "spawn a sub-agent for this task" or use `/subagents`. -Use `/status` in chat to see what the Gateway is doing right now (and whether it is busy). + -Token tip: long tasks and sub-agents both consume tokens. If cost is a concern, set a -cheaper model for sub-agents via `agents.defaults.subagents.model`. + + Use thread bindings. You can bind a Discord thread to a subagent or session target so follow-up messages in that thread stay on that bound session. -Docs: [Sub-agents](/tools/subagents). + Basic flow: -### How do thread-bound subagent sessions work on Discord + - Spawn with `sessions_spawn` using `thread: true` (and optionally `mode: "session"` for persistent follow-up). + - Or manually bind with `/focus `. + - Use `/agents` to inspect binding state. + - Use `/session idle ` and `/session max-age ` to control auto-unfocus. + - Use `/unfocus` to detach the thread. -Use thread bindings. You can bind a Discord thread to a subagent or session target so follow-up messages in that thread stay on that bound session. + Required config: -Basic flow: + - Global defaults: `session.threadBindings.enabled`, `session.threadBindings.idleHours`, `session.threadBindings.maxAgeHours`. + - Discord overrides: `channels.discord.threadBindings.enabled`, `channels.discord.threadBindings.idleHours`, `channels.discord.threadBindings.maxAgeHours`. + - Auto-bind on spawn: set `channels.discord.threadBindings.spawnSubagentSessions: true`. -- Spawn with `sessions_spawn` using `thread: true` (and optionally `mode: "session"` for persistent follow-up). -- Or manually bind with `/focus `. -- Use `/agents` to inspect binding state. -- Use `/session idle ` and `/session max-age ` to control auto-unfocus. -- Use `/unfocus` to detach the thread. + Docs: [Sub-agents](/tools/subagents), [Discord](/channels/discord), [Configuration Reference](/gateway/configuration-reference), [Slash commands](/tools/slash-commands). -Required config: + -- Global defaults: `session.threadBindings.enabled`, `session.threadBindings.idleHours`, `session.threadBindings.maxAgeHours`. -- Discord overrides: `channels.discord.threadBindings.enabled`, `channels.discord.threadBindings.idleHours`, `channels.discord.threadBindings.maxAgeHours`. -- Auto-bind on spawn: set `channels.discord.threadBindings.spawnSubagentSessions: true`. + + Cron runs inside the Gateway process. If the Gateway is not running continuously, + scheduled jobs will not run. -Docs: [Sub-agents](/tools/subagents), [Discord](/channels/discord), [Configuration Reference](/gateway/configuration-reference), [Slash commands](/tools/slash-commands). + Checklist: -### Cron or reminders do not fire What should I check + - Confirm cron is enabled (`cron.enabled`) and `OPENCLAW_SKIP_CRON` is not set. + - Check the Gateway is running 24/7 (no sleep/restarts). + - Verify timezone settings for the job (`--tz` vs host timezone). -Cron runs inside the Gateway process. If the Gateway is not running continuously, -scheduled jobs will not run. + Debug: -Checklist: + ```bash + openclaw cron run --force + openclaw cron runs --id --limit 50 + ``` -- Confirm cron is enabled (`cron.enabled`) and `OPENCLAW_SKIP_CRON` is not set. -- Check the Gateway is running 24/7 (no sleep/restarts). -- Verify timezone settings for the job (`--tz` vs host timezone). + Docs: [Cron jobs](/automation/cron-jobs), [Cron vs Heartbeat](/automation/cron-vs-heartbeat). -Debug: + -```bash -openclaw cron run --force -openclaw cron runs --id --limit 50 -``` + + Use **ClawHub** (CLI) or drop skills into your workspace. The macOS Skills UI isn't available on Linux. + Browse skills at [https://clawhub.com](https://clawhub.com). -Docs: [Cron jobs](/automation/cron-jobs), [Cron vs Heartbeat](/automation/cron-vs-heartbeat). + Install the ClawHub CLI (pick one package manager): -### How do I install skills on Linux + ```bash + npm i -g clawhub + ``` -Use **ClawHub** (CLI) or drop skills into your workspace. The macOS Skills UI isn't available on Linux. -Browse skills at [https://clawhub.com](https://clawhub.com). + ```bash + pnpm add -g clawhub + ``` -Install the ClawHub CLI (pick one package manager): + -```bash -npm i -g clawhub -``` + + Yes. Use the Gateway scheduler: -```bash -pnpm add -g clawhub -``` + - **Cron jobs** for scheduled or recurring tasks (persist across restarts). + - **Heartbeat** for "main session" periodic checks. + - **Isolated jobs** for autonomous agents that post summaries or deliver to chats. -### Can OpenClaw run tasks on a schedule or continuously in the background + Docs: [Cron jobs](/automation/cron-jobs), [Cron vs Heartbeat](/automation/cron-vs-heartbeat), + [Heartbeat](/gateway/heartbeat). -Yes. Use the Gateway scheduler: + -- **Cron jobs** for scheduled or recurring tasks (persist across restarts). -- **Heartbeat** for "main session" periodic checks. -- **Isolated jobs** for autonomous agents that post summaries or deliver to chats. + + Not directly. macOS skills are gated by `metadata.openclaw.os` plus required binaries, and skills only appear in the system prompt when they are eligible on the **Gateway host**. On Linux, `darwin`-only skills (like `apple-notes`, `apple-reminders`, `things-mac`) will not load unless you override the gating. -Docs: [Cron jobs](/automation/cron-jobs), [Cron vs Heartbeat](/automation/cron-vs-heartbeat), -[Heartbeat](/gateway/heartbeat). + You have three supported patterns: -### Can I run Apple macOS-only skills from Linux? + **Option A - run the Gateway on a Mac (simplest).** + Run the Gateway where the macOS binaries exist, then connect from Linux in [remote mode](#gateway-ports-already-running-and-remote-mode) or over Tailscale. The skills load normally because the Gateway host is macOS. -Not directly. macOS skills are gated by `metadata.openclaw.os` plus required binaries, and skills only appear in the system prompt when they are eligible on the **Gateway host**. On Linux, `darwin`-only skills (like `apple-notes`, `apple-reminders`, `things-mac`) will not load unless you override the gating. + **Option B - use a macOS node (no SSH).** + Run the Gateway on Linux, pair a macOS node (menubar app), and set **Node Run Commands** to "Always Ask" or "Always Allow" on the Mac. OpenClaw can treat macOS-only skills as eligible when the required binaries exist on the node. The agent runs those skills via the `nodes` tool. If you choose "Always Ask", approving "Always Allow" in the prompt adds that command to the allowlist. -You have three supported patterns: + **Option C - proxy macOS binaries over SSH (advanced).** + Keep the Gateway on Linux, but make the required CLI binaries resolve to SSH wrappers that run on a Mac. Then override the skill to allow Linux so it stays eligible. -**Option A - run the Gateway on a Mac (simplest).** -Run the Gateway where the macOS binaries exist, then connect from Linux in [remote mode](#how-do-i-run-openclaw-in-remote-mode-client-connects-to-a-gateway-elsewhere) or over Tailscale. The skills load normally because the Gateway host is macOS. + 1. Create an SSH wrapper for the binary (example: `memo` for Apple Notes): -**Option B - use a macOS node (no SSH).** -Run the Gateway on Linux, pair a macOS node (menubar app), and set **Node Run Commands** to "Always Ask" or "Always Allow" on the Mac. OpenClaw can treat macOS-only skills as eligible when the required binaries exist on the node. The agent runs those skills via the `nodes` tool. If you choose "Always Ask", approving "Always Allow" in the prompt adds that command to the allowlist. + ```bash + #!/usr/bin/env bash + set -euo pipefail + exec ssh -T user@mac-host /opt/homebrew/bin/memo "$@" + ``` -**Option C - proxy macOS binaries over SSH (advanced).** -Keep the Gateway on Linux, but make the required CLI binaries resolve to SSH wrappers that run on a Mac. Then override the skill to allow Linux so it stays eligible. + 2. Put the wrapper on `PATH` on the Linux host (for example `~/bin/memo`). + 3. Override the skill metadata (workspace or `~/.openclaw/skills`) to allow Linux: -1. Create an SSH wrapper for the binary (example: `memo` for Apple Notes): + ```markdown + --- + name: apple-notes + description: Manage Apple Notes via the memo CLI on macOS. + metadata: { "openclaw": { "os": ["darwin", "linux"], "requires": { "bins": ["memo"] } } } + --- + ``` - ```bash - #!/usr/bin/env bash - set -euo pipefail - exec ssh -T user@mac-host /opt/homebrew/bin/memo "$@" - ``` + 4. Start a new session so the skills snapshot refreshes. -2. Put the wrapper on `PATH` on the Linux host (for example `~/bin/memo`). -3. Override the skill metadata (workspace or `~/.openclaw/skills`) to allow Linux: + - ```markdown - --- - name: apple-notes - description: Manage Apple Notes via the memo CLI on macOS. - metadata: { "openclaw": { "os": ["darwin", "linux"], "requires": { "bins": ["memo"] } } } - --- - ``` + + Not built-in today. -4. Start a new session so the skills snapshot refreshes. + Options: -### Do you have a Notion or HeyGen integration + - **Custom skill / plugin:** best for reliable API access (Notion/HeyGen both have APIs). + - **Browser automation:** works without code but is slower and more fragile. -Not built-in today. + If you want to keep context per client (agency workflows), a simple pattern is: -Options: + - One Notion page per client (context + preferences + active work). + - Ask the agent to fetch that page at the start of a session. -- **Custom skill / plugin:** best for reliable API access (Notion/HeyGen both have APIs). -- **Browser automation:** works without code but is slower and more fragile. + If you want a native integration, open a feature request or build a skill + targeting those APIs. -If you want to keep context per client (agency workflows), a simple pattern is: + Install skills: -- One Notion page per client (context + preferences + active work). -- Ask the agent to fetch that page at the start of a session. + ```bash + clawhub install + clawhub update --all + ``` -If you want a native integration, open a feature request or build a skill -targeting those APIs. + ClawHub installs into `./skills` under your current directory (or falls back to your configured OpenClaw workspace); OpenClaw treats that as `/skills` on the next session. For shared skills across agents, place them in `~/.openclaw/skills//SKILL.md`. Some skills expect binaries installed via Homebrew; on Linux that means Linuxbrew (see the Homebrew Linux FAQ entry above). See [Skills](/tools/skills) and [ClawHub](/tools/clawhub). -Install skills: + -```bash -clawhub install -clawhub update --all -``` + + Use the built-in `user` browser profile, which attaches through Chrome DevTools MCP: -ClawHub installs into `./skills` under your current directory (or falls back to your configured OpenClaw workspace); OpenClaw treats that as `/skills` on the next session. For shared skills across agents, place them in `~/.openclaw/skills//SKILL.md`. Some skills expect binaries installed via Homebrew; on Linux that means Linuxbrew (see the Homebrew Linux FAQ entry above). See [Skills](/tools/skills) and [ClawHub](/tools/clawhub). + ```bash + openclaw browser --browser-profile user tabs + openclaw browser --browser-profile user snapshot + ``` -### How do I use my existing signed-in Chrome with OpenClaw + If you want a custom name, create an explicit MCP profile: -Use the built-in `user` browser profile, which attaches through Chrome DevTools MCP: + ```bash + openclaw browser create-profile --name chrome-live --driver existing-session + openclaw browser --browser-profile chrome-live tabs + ``` -```bash -openclaw browser --browser-profile user tabs -openclaw browser --browser-profile user snapshot -``` + This path is host-local. If the Gateway runs elsewhere, either run a node host on the browser machine or use remote CDP instead. -If you want a custom name, create an explicit MCP profile: - -```bash -openclaw browser create-profile --name chrome-live --driver existing-session -openclaw browser --browser-profile chrome-live tabs -``` - -This path is host-local. If the Gateway runs elsewhere, either run a node host on the browser machine or use remote CDP instead. + + ## Sandboxing and memory -### Is there a dedicated sandboxing doc + + + Yes. See [Sandboxing](/gateway/sandboxing). For Docker-specific setup (full gateway in Docker or sandbox images), see [Docker](/install/docker). + -Yes. See [Sandboxing](/gateway/sandboxing). For Docker-specific setup (full gateway in Docker or sandbox images), see [Docker](/install/docker). + + The default image is security-first and runs as the `node` user, so it does not + include system packages, Homebrew, or bundled browsers. For a fuller setup: -### Docker feels limited How do I enable full features + - Persist `/home/node` with `OPENCLAW_HOME_VOLUME` so caches survive. + - Bake system deps into the image with `OPENCLAW_DOCKER_APT_PACKAGES`. + - Install Playwright browsers via the bundled CLI: + `node /app/node_modules/playwright-core/cli.js install chromium` + - Set `PLAYWRIGHT_BROWSERS_PATH` and ensure the path is persisted. -The default image is security-first and runs as the `node` user, so it does not -include system packages, Homebrew, or bundled browsers. For a fuller setup: + Docs: [Docker](/install/docker), [Browser](/tools/browser). -- Persist `/home/node` with `OPENCLAW_HOME_VOLUME` so caches survive. -- Bake system deps into the image with `OPENCLAW_DOCKER_APT_PACKAGES`. -- Install Playwright browsers via the bundled CLI: - `node /app/node_modules/playwright-core/cli.js install chromium` -- Set `PLAYWRIGHT_BROWSERS_PATH` and ensure the path is persisted. + -Docs: [Docker](/install/docker), [Browser](/tools/browser). + + Yes - if your private traffic is **DMs** and your public traffic is **groups**. -**Can I keep DMs personal but make groups public sandboxed with one agent** + Use `agents.defaults.sandbox.mode: "non-main"` so group/channel sessions (non-main keys) run in Docker, while the main DM session stays on-host. Then restrict what tools are available in sandboxed sessions via `tools.sandbox.tools`. -Yes - if your private traffic is **DMs** and your public traffic is **groups**. + Setup walkthrough + example config: [Groups: personal DMs + public groups](/channels/groups#pattern-personal-dms-public-groups-single-agent) -Use `agents.defaults.sandbox.mode: "non-main"` so group/channel sessions (non-main keys) run in Docker, while the main DM session stays on-host. Then restrict what tools are available in sandboxed sessions via `tools.sandbox.tools`. + Key config reference: [Gateway configuration](/gateway/configuration-reference#agents-defaults-sandbox) -Setup walkthrough + example config: [Groups: personal DMs + public groups](/channels/groups#pattern-personal-dms-public-groups-single-agent) + -Key config reference: [Gateway configuration](/gateway/configuration#agentsdefaultssandbox) + + Set `agents.defaults.sandbox.docker.binds` to `["host:path:mode"]` (e.g., `"/home/user/src:/src:ro"`). Global + per-agent binds merge; per-agent binds are ignored when `scope: "shared"`. Use `:ro` for anything sensitive and remember binds bypass the sandbox filesystem walls. See [Sandboxing](/gateway/sandboxing#custom-bind-mounts) and [Sandbox vs Tool Policy vs Elevated](/gateway/sandbox-vs-tool-policy-vs-elevated#bind-mounts-security-quick-check) for examples and safety notes. + -### How do I bind a host folder into the sandbox + + OpenClaw memory is just Markdown files in the agent workspace: -Set `agents.defaults.sandbox.docker.binds` to `["host:path:mode"]` (e.g., `"/home/user/src:/src:ro"`). Global + per-agent binds merge; per-agent binds are ignored when `scope: "shared"`. Use `:ro` for anything sensitive and remember binds bypass the sandbox filesystem walls. See [Sandboxing](/gateway/sandboxing#custom-bind-mounts) and [Sandbox vs Tool Policy vs Elevated](/gateway/sandbox-vs-tool-policy-vs-elevated#bind-mounts-security-quick-check) for examples and safety notes. + - Daily notes in `memory/YYYY-MM-DD.md` + - Curated long-term notes in `MEMORY.md` (main/private sessions only) -### How does memory work + OpenClaw also runs a **silent pre-compaction memory flush** to remind the model + to write durable notes before auto-compaction. This only runs when the workspace + is writable (read-only sandboxes skip it). See [Memory](/concepts/memory). -OpenClaw memory is just Markdown files in the agent workspace: + -- Daily notes in `memory/YYYY-MM-DD.md` -- Curated long-term notes in `MEMORY.md` (main/private sessions only) + + Ask the bot to **write the fact to memory**. Long-term notes belong in `MEMORY.md`, + short-term context goes into `memory/YYYY-MM-DD.md`. -OpenClaw also runs a **silent pre-compaction memory flush** to remind the model -to write durable notes before auto-compaction. This only runs when the workspace -is writable (read-only sandboxes skip it). See [Memory](/concepts/memory). + This is still an area we are improving. It helps to remind the model to store memories; + it will know what to do. If it keeps forgetting, verify the Gateway is using the same + workspace on every run. -### Memory keeps forgetting things How do I make it stick + Docs: [Memory](/concepts/memory), [Agent workspace](/concepts/agent-workspace). -Ask the bot to **write the fact to memory**. Long-term notes belong in `MEMORY.md`, -short-term context goes into `memory/YYYY-MM-DD.md`. + -This is still an area we are improving. It helps to remind the model to store memories; -it will know what to do. If it keeps forgetting, verify the Gateway is using the same -workspace on every run. + + Memory files live on disk and persist until you delete them. The limit is your + storage, not the model. The **session context** is still limited by the model + context window, so long conversations can compact or truncate. That is why + memory search exists - it pulls only the relevant parts back into context. -Docs: [Memory](/concepts/memory), [Agent workspace](/concepts/agent-workspace). + Docs: [Memory](/concepts/memory), [Context](/concepts/context). -### Does semantic memory search require an OpenAI API key + -Only if you use **OpenAI embeddings**. Codex OAuth covers chat/completions and -does **not** grant embeddings access, so **signing in with Codex (OAuth or the -Codex CLI login)** does not help for semantic memory search. OpenAI embeddings -still need a real API key (`OPENAI_API_KEY` or `models.providers.openai.apiKey`). + + Only if you use **OpenAI embeddings**. Codex OAuth covers chat/completions and + does **not** grant embeddings access, so **signing in with Codex (OAuth or the + Codex CLI login)** does not help for semantic memory search. OpenAI embeddings + still need a real API key (`OPENAI_API_KEY` or `models.providers.openai.apiKey`). -If you don't set a provider explicitly, OpenClaw auto-selects a provider when it -can resolve an API key (auth profiles, `models.providers.*.apiKey`, or env vars). -It prefers OpenAI if an OpenAI key resolves, otherwise Gemini if a Gemini key -resolves, then Voyage, then Mistral. If no remote key is available, memory -search stays disabled until you configure it. If you have a local model path -configured and present, OpenClaw -prefers `local`. Ollama is supported when you explicitly set -`memorySearch.provider = "ollama"`. + If you don't set a provider explicitly, OpenClaw auto-selects a provider when it + can resolve an API key (auth profiles, `models.providers.*.apiKey`, or env vars). + It prefers OpenAI if an OpenAI key resolves, otherwise Gemini if a Gemini key + resolves, then Voyage, then Mistral. If no remote key is available, memory + search stays disabled until you configure it. If you have a local model path + configured and present, OpenClaw + prefers `local`. Ollama is supported when you explicitly set + `memorySearch.provider = "ollama"`. -If you'd rather stay local, set `memorySearch.provider = "local"` (and optionally -`memorySearch.fallback = "none"`). If you want Gemini embeddings, set -`memorySearch.provider = "gemini"` and provide `GEMINI_API_KEY` (or -`memorySearch.remote.apiKey`). We support **OpenAI, Gemini, Voyage, Mistral, Ollama, or local** embedding -models - see [Memory](/concepts/memory) for the setup details. + If you'd rather stay local, set `memorySearch.provider = "local"` (and optionally + `memorySearch.fallback = "none"`). If you want Gemini embeddings, set + `memorySearch.provider = "gemini"` and provide `GEMINI_API_KEY` (or + `memorySearch.remote.apiKey`). We support **OpenAI, Gemini, Voyage, Mistral, Ollama, or local** embedding + models - see [Memory](/concepts/memory) for the setup details. -### Does memory persist forever What are the limits - -Memory files live on disk and persist until you delete them. The limit is your -storage, not the model. The **session context** is still limited by the model -context window, so long conversations can compact or truncate. That is why -memory search exists - it pulls only the relevant parts back into context. - -Docs: [Memory](/concepts/memory), [Context](/concepts/context). + + ## Where things live on disk -### Is all data used with OpenClaw saved locally + + + No - **OpenClaw's state is local**, but **external services still see what you send them**. -No - **OpenClaw's state is local**, but **external services still see what you send them**. + - **Local by default:** sessions, memory files, config, and workspace live on the Gateway host + (`~/.openclaw` + your workspace directory). + - **Remote by necessity:** messages you send to model providers (Anthropic/OpenAI/etc.) go to + their APIs, and chat platforms (WhatsApp/Telegram/Slack/etc.) store message data on their + servers. + - **You control the footprint:** using local models keeps prompts on your machine, but channel + traffic still goes through the channel's servers. -- **Local by default:** sessions, memory files, config, and workspace live on the Gateway host - (`~/.openclaw` + your workspace directory). -- **Remote by necessity:** messages you send to model providers (Anthropic/OpenAI/etc.) go to - their APIs, and chat platforms (WhatsApp/Telegram/Slack/etc.) store message data on their - servers. -- **You control the footprint:** using local models keeps prompts on your machine, but channel - traffic still goes through the channel's servers. + Related: [Agent workspace](/concepts/agent-workspace), [Memory](/concepts/memory). -Related: [Agent workspace](/concepts/agent-workspace), [Memory](/concepts/memory). + -### Where does OpenClaw store its data + + Everything lives under `$OPENCLAW_STATE_DIR` (default: `~/.openclaw`): -Everything lives under `$OPENCLAW_STATE_DIR` (default: `~/.openclaw`): + | Path | Purpose | + | --------------------------------------------------------------- | ------------------------------------------------------------------ | + | `$OPENCLAW_STATE_DIR/openclaw.json` | Main config (JSON5) | + | `$OPENCLAW_STATE_DIR/credentials/oauth.json` | Legacy OAuth import (copied into auth profiles on first use) | + | `$OPENCLAW_STATE_DIR/agents//agent/auth-profiles.json` | Auth profiles (OAuth, API keys, and optional `keyRef`/`tokenRef`) | + | `$OPENCLAW_STATE_DIR/secrets.json` | Optional file-backed secret payload for `file` SecretRef providers | + | `$OPENCLAW_STATE_DIR/agents//agent/auth.json` | Legacy compatibility file (static `api_key` entries scrubbed) | + | `$OPENCLAW_STATE_DIR/credentials/` | Provider state (e.g. `whatsapp//creds.json`) | + | `$OPENCLAW_STATE_DIR/agents/` | Per-agent state (agentDir + sessions) | + | `$OPENCLAW_STATE_DIR/agents//sessions/` | Conversation history & state (per agent) | + | `$OPENCLAW_STATE_DIR/agents//sessions/sessions.json` | Session metadata (per agent) | -| Path | Purpose | -| --------------------------------------------------------------- | ------------------------------------------------------------------ | -| `$OPENCLAW_STATE_DIR/openclaw.json` | Main config (JSON5) | -| `$OPENCLAW_STATE_DIR/credentials/oauth.json` | Legacy OAuth import (copied into auth profiles on first use) | -| `$OPENCLAW_STATE_DIR/agents//agent/auth-profiles.json` | Auth profiles (OAuth, API keys, and optional `keyRef`/`tokenRef`) | -| `$OPENCLAW_STATE_DIR/secrets.json` | Optional file-backed secret payload for `file` SecretRef providers | -| `$OPENCLAW_STATE_DIR/agents//agent/auth.json` | Legacy compatibility file (static `api_key` entries scrubbed) | -| `$OPENCLAW_STATE_DIR/credentials/` | Provider state (e.g. `whatsapp//creds.json`) | -| `$OPENCLAW_STATE_DIR/agents/` | Per-agent state (agentDir + sessions) | -| `$OPENCLAW_STATE_DIR/agents//sessions/` | Conversation history & state (per agent) | -| `$OPENCLAW_STATE_DIR/agents//sessions/sessions.json` | Session metadata (per agent) | + Legacy single-agent path: `~/.openclaw/agent/*` (migrated by `openclaw doctor`). -Legacy single-agent path: `~/.openclaw/agent/*` (migrated by `openclaw doctor`). + Your **workspace** (AGENTS.md, memory files, skills, etc.) is separate and configured via `agents.defaults.workspace` (default: `~/.openclaw/workspace`). -Your **workspace** (AGENTS.md, memory files, skills, etc.) is separate and configured via `agents.defaults.workspace` (default: `~/.openclaw/workspace`). + -### Where should AGENTSmd SOULmd USERmd MEMORYmd live + + These files live in the **agent workspace**, not `~/.openclaw`. -These files live in the **agent workspace**, not `~/.openclaw`. + - **Workspace (per agent)**: `AGENTS.md`, `SOUL.md`, `IDENTITY.md`, `USER.md`, + `MEMORY.md` (or legacy fallback `memory.md` when `MEMORY.md` is absent), + `memory/YYYY-MM-DD.md`, optional `HEARTBEAT.md`. + - **State dir (`~/.openclaw`)**: config, credentials, auth profiles, sessions, logs, + and shared skills (`~/.openclaw/skills`). -- **Workspace (per agent)**: `AGENTS.md`, `SOUL.md`, `IDENTITY.md`, `USER.md`, - `MEMORY.md` (or legacy fallback `memory.md` when `MEMORY.md` is absent), - `memory/YYYY-MM-DD.md`, optional `HEARTBEAT.md`. -- **State dir (`~/.openclaw`)**: config, credentials, auth profiles, sessions, logs, - and shared skills (`~/.openclaw/skills`). + Default workspace is `~/.openclaw/workspace`, configurable via: -Default workspace is `~/.openclaw/workspace`, configurable via: + ```json5 + { + agents: { defaults: { workspace: "~/.openclaw/workspace" } }, + } + ``` -```json5 -{ - agents: { defaults: { workspace: "~/.openclaw/workspace" } }, -} -``` + If the bot "forgets" after a restart, confirm the Gateway is using the same + workspace on every launch (and remember: remote mode uses the **gateway host's** + workspace, not your local laptop). -If the bot "forgets" after a restart, confirm the Gateway is using the same -workspace on every launch (and remember: remote mode uses the **gateway host's** -workspace, not your local laptop). + Tip: if you want a durable behavior or preference, ask the bot to **write it into + AGENTS.md or MEMORY.md** rather than relying on chat history. -Tip: if you want a durable behavior or preference, ask the bot to **write it into -AGENTS.md or MEMORY.md** rather than relying on chat history. + See [Agent workspace](/concepts/agent-workspace) and [Memory](/concepts/memory). -See [Agent workspace](/concepts/agent-workspace) and [Memory](/concepts/memory). + -### Recommended backup strategy + + Put your **agent workspace** in a **private** git repo and back it up somewhere + private (for example GitHub private). This captures memory + AGENTS/SOUL/USER + files, and lets you restore the assistant's "mind" later. -Put your **agent workspace** in a **private** git repo and back it up somewhere -private (for example GitHub private). This captures memory + AGENTS/SOUL/USER -files, and lets you restore the assistant's "mind" later. + Do **not** commit anything under `~/.openclaw` (credentials, sessions, tokens, or encrypted secrets payloads). + If you need a full restore, back up both the workspace and the state directory + separately (see the migration question above). -Do **not** commit anything under `~/.openclaw` (credentials, sessions, tokens, or encrypted secrets payloads). -If you need a full restore, back up both the workspace and the state directory -separately (see the migration question above). + Docs: [Agent workspace](/concepts/agent-workspace). -Docs: [Agent workspace](/concepts/agent-workspace). + -### How do I completely uninstall OpenClaw + + See the dedicated guide: [Uninstall](/install/uninstall). + -See the dedicated guide: [Uninstall](/install/uninstall). + + Yes. The workspace is the **default cwd** and memory anchor, not a hard sandbox. + Relative paths resolve inside the workspace, but absolute paths can access other + host locations unless sandboxing is enabled. If you need isolation, use + [`agents.defaults.sandbox`](/gateway/sandboxing) or per-agent sandbox settings. If you + want a repo to be the default working directory, point that agent's + `workspace` to the repo root. The OpenClaw repo is just source code; keep the + workspace separate unless you intentionally want the agent to work inside it. -### Can agents work outside the workspace + Example (repo as default cwd): -Yes. The workspace is the **default cwd** and memory anchor, not a hard sandbox. -Relative paths resolve inside the workspace, but absolute paths can access other -host locations unless sandboxing is enabled. If you need isolation, use -[`agents.defaults.sandbox`](/gateway/sandboxing) or per-agent sandbox settings. If you -want a repo to be the default working directory, point that agent's -`workspace` to the repo root. The OpenClaw repo is just source code; keep the -workspace separate unless you intentionally want the agent to work inside it. + ```json5 + { + agents: { + defaults: { + workspace: "~/Projects/my-repo", + }, + }, + } + ``` -Example (repo as default cwd): + -```json5 -{ - agents: { - defaults: { - workspace: "~/Projects/my-repo", - }, - }, -} -``` - -### Im in remote mode where is the session store - -Session state is owned by the **gateway host**. If you're in remote mode, the session store you care about is on the remote machine, not your local laptop. See [Session management](/concepts/session). + + Session state is owned by the **gateway host**. If you're in remote mode, the session store you care about is on the remote machine, not your local laptop. See [Session management](/concepts/session). + + ## Config basics -### What format is the config Where is it + + + OpenClaw reads an optional **JSON5** config from `$OPENCLAW_CONFIG_PATH` (default: `~/.openclaw/openclaw.json`): -OpenClaw reads an optional **JSON5** config from `$OPENCLAW_CONFIG_PATH` (default: `~/.openclaw/openclaw.json`): + ``` + $OPENCLAW_CONFIG_PATH + ``` -``` -$OPENCLAW_CONFIG_PATH -``` + If the file is missing, it uses safe-ish defaults (including a default workspace of `~/.openclaw/workspace`). -If the file is missing, it uses safe-ish defaults (including a default workspace of `~/.openclaw/workspace`). + -### I set gatewaybind lan or tailnet and now nothing listens the UI says unauthorized + + Non-loopback binds **require auth**. Configure `gateway.auth.mode` + `gateway.auth.token` (or use `OPENCLAW_GATEWAY_TOKEN`). -Non-loopback binds **require auth**. Configure `gateway.auth.mode` + `gateway.auth.token` (or use `OPENCLAW_GATEWAY_TOKEN`). + ```json5 + { + gateway: { + bind: "lan", + auth: { + mode: "token", + token: "replace-me", + }, + }, + } + ``` -```json5 -{ - gateway: { - bind: "lan", - auth: { - mode: "token", - token: "replace-me", - }, - }, -} -``` + Notes: -Notes: + - `gateway.remote.token` / `.password` do **not** enable local gateway auth by themselves. + - Local call paths can use `gateway.remote.*` as fallback only when `gateway.auth.*` is unset. + - If `gateway.auth.token` / `gateway.auth.password` is explicitly configured via SecretRef and unresolved, resolution fails closed (no remote fallback masking). + - The Control UI authenticates via `connect.params.auth.token` (stored in app/UI settings). Avoid putting tokens in URLs. -- `gateway.remote.token` / `.password` do **not** enable local gateway auth by themselves. -- Local call paths can use `gateway.remote.*` as fallback only when `gateway.auth.*` is unset. -- If `gateway.auth.token` / `gateway.auth.password` is explicitly configured via SecretRef and unresolved, resolution fails closed (no remote fallback masking). -- The Control UI authenticates via `connect.params.auth.token` (stored in app/UI settings). Avoid putting tokens in URLs. + -### Why do I need a token on localhost now + + OpenClaw enforces token auth by default, including loopback. If no token is configured, gateway startup auto-generates one and saves it to `gateway.auth.token`, so **local WS clients must authenticate**. This blocks other local processes from calling the Gateway. -OpenClaw enforces token auth by default, including loopback. If no token is configured, gateway startup auto-generates one and saves it to `gateway.auth.token`, so **local WS clients must authenticate**. This blocks other local processes from calling the Gateway. + If you **really** want open loopback, set `gateway.auth.mode: "none"` explicitly in your config. Doctor can generate a token for you any time: `openclaw doctor --generate-gateway-token`. -If you **really** want open loopback, set `gateway.auth.mode: "none"` explicitly in your config. Doctor can generate a token for you any time: `openclaw doctor --generate-gateway-token`. + -### Do I have to restart after changing config + + The Gateway watches the config and supports hot-reload: -The Gateway watches the config and supports hot-reload: + - `gateway.reload.mode: "hybrid"` (default): hot-apply safe changes, restart for critical ones + - `hot`, `restart`, `off` are also supported -- `gateway.reload.mode: "hybrid"` (default): hot-apply safe changes, restart for critical ones -- `hot`, `restart`, `off` are also supported + -### How do I disable funny CLI taglines + + Set `cli.banner.taglineMode` in config: -Set `cli.banner.taglineMode` in config: + ```json5 + { + cli: { + banner: { + taglineMode: "off", // random | default | off + }, + }, + } + ``` -```json5 -{ - cli: { - banner: { - taglineMode: "off", // random | default | off - }, - }, -} -``` + - `off`: hides tagline text but keeps the banner title/version line. + - `default`: uses `All your chats, one OpenClaw.` every time. + - `random`: rotating funny/seasonal taglines (default behavior). + - If you want no banner at all, set env `OPENCLAW_HIDE_BANNER=1`. -- `off`: hides tagline text but keeps the banner title/version line. -- `default`: uses `All your chats, one OpenClaw.` every time. -- `random`: rotating funny/seasonal taglines (default behavior). -- If you want no banner at all, set env `OPENCLAW_HIDE_BANNER=1`. + -### How do I enable web search and web fetch + + `web_fetch` works without an API key. `web_search` requires a key for your + selected provider (Brave, Gemini, Grok, Kimi, or Perplexity). + **Recommended:** run `openclaw configure --section web` and choose a provider. + Environment alternatives: -`web_fetch` works without an API key. `web_search` requires a key for your -selected provider (Brave, Gemini, Grok, Kimi, or Perplexity). -**Recommended:** run `openclaw configure --section web` and choose a provider. -Environment alternatives: + - Brave: `BRAVE_API_KEY` + - Gemini: `GEMINI_API_KEY` + - Grok: `XAI_API_KEY` + - Kimi: `KIMI_API_KEY` or `MOONSHOT_API_KEY` + - Perplexity: `PERPLEXITY_API_KEY` or `OPENROUTER_API_KEY` -- Brave: `BRAVE_API_KEY` -- Gemini: `GEMINI_API_KEY` -- Grok: `XAI_API_KEY` -- Kimi: `KIMI_API_KEY` or `MOONSHOT_API_KEY` -- Perplexity: `PERPLEXITY_API_KEY` or `OPENROUTER_API_KEY` - -```json5 -{ - plugins: { - entries: { - brave: { - config: { - webSearch: { - apiKey: "BRAVE_API_KEY_HERE", + ```json5 + { + plugins: { + entries: { + brave: { + config: { + webSearch: { + apiKey: "BRAVE_API_KEY_HERE", + }, + }, }, }, }, - }, - }, - tools: { - web: { - search: { - enabled: true, - provider: "brave", - maxResults: 5, + tools: { + web: { + search: { + enabled: true, + provider: "brave", + maxResults: 5, + }, + fetch: { + enabled: true, + }, + }, }, - fetch: { - enabled: true, + } + ``` + + Provider-specific web-search config now lives under `plugins.entries..config.webSearch.*`. + Legacy `tools.web.search.*` provider paths still load temporarily for compatibility, but they should not be used for new configs. + + Notes: + + - If you use allowlists, add `web_search`/`web_fetch` or `group:web`. + - `web_fetch` is enabled by default (unless explicitly disabled). + - Daemons read env vars from `~/.openclaw/.env` (or the service environment). + + Docs: [Web tools](/tools/web). + + + + + `config.apply` replaces the **entire config**. If you send a partial object, everything + else is removed. + + Recover: + + - Restore from backup (git or a copied `~/.openclaw/openclaw.json`). + - If you have no backup, re-run `openclaw doctor` and reconfigure channels/models. + - If this was unexpected, file a bug and include your last known config or any backup. + - A local coding agent can often reconstruct a working config from logs or history. + + Avoid it: + + - Use `openclaw config set` for small changes. + - Use `openclaw configure` for interactive edits. + + Docs: [Config](/cli/config), [Configure](/cli/configure), [Doctor](/gateway/doctor). + + + + + The common pattern is **one Gateway** (e.g. Raspberry Pi) plus **nodes** and **agents**: + + - **Gateway (central):** owns channels (Signal/WhatsApp), routing, and sessions. + - **Nodes (devices):** Macs/iOS/Android connect as peripherals and expose local tools (`system.run`, `canvas`, `camera`). + - **Agents (workers):** separate brains/workspaces for special roles (e.g. "Hetzner ops", "Personal data"). + - **Sub-agents:** spawn background work from a main agent when you want parallelism. + - **TUI:** connect to the Gateway and switch agents/sessions. + + Docs: [Nodes](/nodes), [Remote access](/gateway/remote), [Multi-Agent Routing](/concepts/multi-agent), [Sub-agents](/tools/subagents), [TUI](/web/tui). + + + + + Yes. It's a config option: + + ```json5 + { + browser: { headless: true }, + agents: { + defaults: { + sandbox: { browser: { headless: true } }, + }, }, - }, - }, -} -``` + } + ``` -Provider-specific web-search config now lives under `plugins.entries..config.webSearch.*`. -Legacy `tools.web.search.*` provider paths still load temporarily for compatibility, but they should not be used for new configs. + Default is `false` (headful). Headless is more likely to trigger anti-bot checks on some sites. See [Browser](/tools/browser). -Notes: + Headless uses the **same Chromium engine** and works for most automation (forms, clicks, scraping, logins). The main differences: -- If you use allowlists, add `web_search`/`web_fetch` or `group:web`. -- `web_fetch` is enabled by default (unless explicitly disabled). -- Daemons read env vars from `~/.openclaw/.env` (or the service environment). + - No visible browser window (use screenshots if you need visuals). + - Some sites are stricter about automation in headless mode (CAPTCHAs, anti-bot). + For example, X/Twitter often blocks headless sessions. -Docs: [Web tools](/tools/web). + -### How do I run a central Gateway with specialized workers across devices - -The common pattern is **one Gateway** (e.g. Raspberry Pi) plus **nodes** and **agents**: - -- **Gateway (central):** owns channels (Signal/WhatsApp), routing, and sessions. -- **Nodes (devices):** Macs/iOS/Android connect as peripherals and expose local tools (`system.run`, `canvas`, `camera`). -- **Agents (workers):** separate brains/workspaces for special roles (e.g. "Hetzner ops", "Personal data"). -- **Sub-agents:** spawn background work from a main agent when you want parallelism. -- **TUI:** connect to the Gateway and switch agents/sessions. - -Docs: [Nodes](/nodes), [Remote access](/gateway/remote), [Multi-Agent Routing](/concepts/multi-agent), [Sub-agents](/tools/subagents), [TUI](/web/tui). - -### Can the OpenClaw browser run headless - -Yes. It's a config option: - -```json5 -{ - browser: { headless: true }, - agents: { - defaults: { - sandbox: { browser: { headless: true } }, - }, - }, -} -``` - -Default is `false` (headful). Headless is more likely to trigger anti-bot checks on some sites. See [Browser](/tools/browser). - -Headless uses the **same Chromium engine** and works for most automation (forms, clicks, scraping, logins). The main differences: - -- No visible browser window (use screenshots if you need visuals). -- Some sites are stricter about automation in headless mode (CAPTCHAs, anti-bot). - For example, X/Twitter often blocks headless sessions. - -### How do I use Brave for browser control - -Set `browser.executablePath` to your Brave binary (or any Chromium-based browser) and restart the Gateway. -See the full config examples in [Browser](/tools/browser#use-brave-or-another-chromium-based-browser). + + Set `browser.executablePath` to your Brave binary (or any Chromium-based browser) and restart the Gateway. + See the full config examples in [Browser](/tools/browser#use-brave-or-another-chromium-based-browser). + + ## Remote gateways and nodes -### How do commands propagate between Telegram the gateway and nodes + + + Telegram messages are handled by the **gateway**. The gateway runs the agent and + only then calls nodes over the **Gateway WebSocket** when a node tool is needed: -Telegram messages are handled by the **gateway**. The gateway runs the agent and -only then calls nodes over the **Gateway WebSocket** when a node tool is needed: + Telegram → Gateway → Agent → `node.*` → Node → Gateway → Telegram -Telegram → Gateway → Agent → `node.*` → Node → Gateway → Telegram + Nodes don't see inbound provider traffic; they only receive node RPC calls. -Nodes don't see inbound provider traffic; they only receive node RPC calls. + -### How can my agent access my computer if the Gateway is hosted remotely + + Short answer: **pair your computer as a node**. The Gateway runs elsewhere, but it can + call `node.*` tools (screen, camera, system) on your local machine over the Gateway WebSocket. -Short answer: **pair your computer as a node**. The Gateway runs elsewhere, but it can -call `node.*` tools (screen, camera, system) on your local machine over the Gateway WebSocket. + Typical setup: -Typical setup: + 1. Run the Gateway on the always-on host (VPS/home server). + 2. Put the Gateway host + your computer on the same tailnet. + 3. Ensure the Gateway WS is reachable (tailnet bind or SSH tunnel). + 4. Open the macOS app locally and connect in **Remote over SSH** mode (or direct tailnet) + so it can register as a node. + 5. Approve the node on the Gateway: -1. Run the Gateway on the always-on host (VPS/home server). -2. Put the Gateway host + your computer on the same tailnet. -3. Ensure the Gateway WS is reachable (tailnet bind or SSH tunnel). -4. Open the macOS app locally and connect in **Remote over SSH** mode (or direct tailnet) - so it can register as a node. -5. Approve the node on the Gateway: + ```bash + openclaw devices list + openclaw devices approve + ``` - ```bash - openclaw devices list - openclaw devices approve - ``` + No separate TCP bridge is required; nodes connect over the Gateway WebSocket. -No separate TCP bridge is required; nodes connect over the Gateway WebSocket. + Security reminder: pairing a macOS node allows `system.run` on that machine. Only + pair devices you trust, and review [Security](/gateway/security). -Security reminder: pairing a macOS node allows `system.run` on that machine. Only -pair devices you trust, and review [Security](/gateway/security). + Docs: [Nodes](/nodes), [Gateway protocol](/gateway/protocol), [macOS remote mode](/platforms/mac/remote), [Security](/gateway/security). -Docs: [Nodes](/nodes), [Gateway protocol](/gateway/protocol), [macOS remote mode](/platforms/mac/remote), [Security](/gateway/security). + -### Tailscale is connected but I get no replies What now + + Check the basics: -Check the basics: + - Gateway is running: `openclaw gateway status` + - Gateway health: `openclaw status` + - Channel health: `openclaw channels status` -- Gateway is running: `openclaw gateway status` -- Gateway health: `openclaw status` -- Channel health: `openclaw channels status` + Then verify auth and routing: -Then verify auth and routing: + - If you use Tailscale Serve, make sure `gateway.auth.allowTailscale` is set correctly. + - If you connect via SSH tunnel, confirm the local tunnel is up and points at the right port. + - Confirm your allowlists (DM or group) include your account. -- If you use Tailscale Serve, make sure `gateway.auth.allowTailscale` is set correctly. -- If you connect via SSH tunnel, confirm the local tunnel is up and points at the right port. -- Confirm your allowlists (DM or group) include your account. + Docs: [Tailscale](/gateway/tailscale), [Remote access](/gateway/remote), [Channels](/channels). -Docs: [Tailscale](/gateway/tailscale), [Remote access](/gateway/remote), [Channels](/channels). + -### Can two OpenClaw instances talk to each other local VPS + + Yes. There is no built-in "bot-to-bot" bridge, but you can wire it up in a few + reliable ways: -Yes. There is no built-in "bot-to-bot" bridge, but you can wire it up in a few -reliable ways: + **Simplest:** use a normal chat channel both bots can access (Telegram/Slack/WhatsApp). + Have Bot A send a message to Bot B, then let Bot B reply as usual. -**Simplest:** use a normal chat channel both bots can access (Telegram/Slack/WhatsApp). -Have Bot A send a message to Bot B, then let Bot B reply as usual. + **CLI bridge (generic):** run a script that calls the other Gateway with + `openclaw agent --message ... --deliver`, targeting a chat where the other bot + listens. If one bot is on a remote VPS, point your CLI at that remote Gateway + via SSH/Tailscale (see [Remote access](/gateway/remote)). -**CLI bridge (generic):** run a script that calls the other Gateway with -`openclaw agent --message ... --deliver`, targeting a chat where the other bot -listens. If one bot is on a remote VPS, point your CLI at that remote Gateway -via SSH/Tailscale (see [Remote access](/gateway/remote)). + Example pattern (run from a machine that can reach the target Gateway): -Example pattern (run from a machine that can reach the target Gateway): + ```bash + openclaw agent --message "Hello from local bot" --deliver --channel telegram --reply-to + ``` -```bash -openclaw agent --message "Hello from local bot" --deliver --channel telegram --reply-to -``` + Tip: add a guardrail so the two bots do not loop endlessly (mention-only, channel + allowlists, or a "do not reply to bot messages" rule). -Tip: add a guardrail so the two bots do not loop endlessly (mention-only, channel -allowlists, or a "do not reply to bot messages" rule). + Docs: [Remote access](/gateway/remote), [Agent CLI](/cli/agent), [Agent send](/tools/agent-send). -Docs: [Remote access](/gateway/remote), [Agent CLI](/cli/agent), [Agent send](/tools/agent-send). + -### Do I need separate VPSes for multiple agents + + No. One Gateway can host multiple agents, each with its own workspace, model defaults, + and routing. That is the normal setup and it is much cheaper and simpler than running + one VPS per agent. -No. One Gateway can host multiple agents, each with its own workspace, model defaults, -and routing. That is the normal setup and it is much cheaper and simpler than running -one VPS per agent. + Use separate VPSes only when you need hard isolation (security boundaries) or very + different configs that you do not want to share. Otherwise, keep one Gateway and + use multiple agents or sub-agents. -Use separate VPSes only when you need hard isolation (security boundaries) or very -different configs that you do not want to share. Otherwise, keep one Gateway and -use multiple agents or sub-agents. + -### Is there a benefit to using a node on my personal laptop instead of SSH from a VPS + + Yes - nodes are the first-class way to reach your laptop from a remote Gateway, and they + unlock more than shell access. The Gateway runs on macOS/Linux (Windows via WSL2) and is + lightweight (a small VPS or Raspberry Pi-class box is fine; 4 GB RAM is plenty), so a common + setup is an always-on host plus your laptop as a node. -Yes - nodes are the first-class way to reach your laptop from a remote Gateway, and they -unlock more than shell access. The Gateway runs on macOS/Linux (Windows via WSL2) and is -lightweight (a small VPS or Raspberry Pi-class box is fine; 4 GB RAM is plenty), so a common -setup is an always-on host plus your laptop as a node. + - **No inbound SSH required.** Nodes connect out to the Gateway WebSocket and use device pairing. + - **Safer execution controls.** `system.run` is gated by node allowlists/approvals on that laptop. + - **More device tools.** Nodes expose `canvas`, `camera`, and `screen` in addition to `system.run`. + - **Local browser automation.** Keep the Gateway on a VPS, but run Chrome locally through a node host on the laptop, or attach to local Chrome on the host via Chrome MCP. -- **No inbound SSH required.** Nodes connect out to the Gateway WebSocket and use device pairing. -- **Safer execution controls.** `system.run` is gated by node allowlists/approvals on that laptop. -- **More device tools.** Nodes expose `canvas`, `camera`, and `screen` in addition to `system.run`. -- **Local browser automation.** Keep the Gateway on a VPS, but run Chrome locally through a node host on the laptop, or attach to local Chrome on the host via Chrome MCP. + SSH is fine for ad-hoc shell access, but nodes are simpler for ongoing agent workflows and + device automation. -SSH is fine for ad-hoc shell access, but nodes are simpler for ongoing agent workflows and -device automation. + Docs: [Nodes](/nodes), [Nodes CLI](/cli/nodes), [Browser](/tools/browser). -Docs: [Nodes](/nodes), [Nodes CLI](/cli/nodes), [Browser](/tools/browser). + -### Should I install on a second laptop or just add a node + + No. Only **one gateway** should run per host unless you intentionally run isolated profiles (see [Multiple gateways](/gateway/multiple-gateways)). Nodes are peripherals that connect + to the gateway (iOS/Android nodes, or macOS "node mode" in the menubar app). For headless node + hosts and CLI control, see [Node host CLI](/cli/node). -If you only need **local tools** (screen/camera/exec) on the second laptop, add it as a -**node**. That keeps a single Gateway and avoids duplicated config. Local node tools are -currently macOS-only, but we plan to extend them to other OSes. + A full restart is required for `gateway`, `discovery`, and `canvasHost` changes. -Install a second Gateway only when you need **hard isolation** or two fully separate bots. + -Docs: [Nodes](/nodes), [Nodes CLI](/cli/nodes), [Multiple gateways](/gateway/multiple-gateways). + + Yes. `config.apply` validates + writes the full config and restarts the Gateway as part of the operation. + -### Do nodes run a gateway service + + ```json5 + { + agents: { defaults: { workspace: "~/.openclaw/workspace" } }, + channels: { whatsapp: { allowFrom: ["+15555550123"] } }, + } + ``` -No. Only **one gateway** should run per host unless you intentionally run isolated profiles (see [Multiple gateways](/gateway/multiple-gateways)). Nodes are peripherals that connect -to the gateway (iOS/Android nodes, or macOS "node mode" in the menubar app). For headless node -hosts and CLI control, see [Node host CLI](/cli/node). + This sets your workspace and restricts who can trigger the bot. -A full restart is required for `gateway`, `discovery`, and `canvasHost` changes. + -### Is there an API RPC way to apply config + + Minimal steps: -Yes. `config.apply` validates + writes the full config and restarts the Gateway as part of the operation. + 1. **Install + login on the VPS** -### configapply wiped my config How do I recover and avoid this + ```bash + curl -fsSL https://tailscale.com/install.sh | sh + sudo tailscale up + ``` -`config.apply` replaces the **entire config**. If you send a partial object, everything -else is removed. + 2. **Install + login on your Mac** + - Use the Tailscale app and sign in to the same tailnet. + 3. **Enable MagicDNS (recommended)** + - In the Tailscale admin console, enable MagicDNS so the VPS has a stable name. + 4. **Use the tailnet hostname** + - SSH: `ssh user@your-vps.tailnet-xxxx.ts.net` + - Gateway WS: `ws://your-vps.tailnet-xxxx.ts.net:18789` -Recover: + If you want the Control UI without SSH, use Tailscale Serve on the VPS: -- Restore from backup (git or a copied `~/.openclaw/openclaw.json`). -- If you have no backup, re-run `openclaw doctor` and reconfigure channels/models. -- If this was unexpected, file a bug and include your last known config or any backup. -- A local coding agent can often reconstruct a working config from logs or history. + ```bash + openclaw gateway --tailscale serve + ``` -Avoid it: + This keeps the gateway bound to loopback and exposes HTTPS via Tailscale. See [Tailscale](/gateway/tailscale). -- Use `openclaw config set` for small changes. -- Use `openclaw configure` for interactive edits. + -Docs: [Config](/cli/config), [Configure](/cli/configure), [Doctor](/gateway/doctor). + + Serve exposes the **Gateway Control UI + WS**. Nodes connect over the same Gateway WS endpoint. -### Minimal sane config for a first install + Recommended setup: -```json5 -{ - agents: { defaults: { workspace: "~/.openclaw/workspace" } }, - channels: { whatsapp: { allowFrom: ["+15555550123"] } }, -} -``` + 1. **Make sure the VPS + Mac are on the same tailnet**. + 2. **Use the macOS app in Remote mode** (SSH target can be the tailnet hostname). + The app will tunnel the Gateway port and connect as a node. + 3. **Approve the node** on the gateway: -This sets your workspace and restricts who can trigger the bot. + ```bash + openclaw devices list + openclaw devices approve + ``` -### How do I set up Tailscale on a VPS and connect from my Mac + Docs: [Gateway protocol](/gateway/protocol), [Discovery](/gateway/discovery), [macOS remote mode](/platforms/mac/remote). -Minimal steps: + -1. **Install + login on the VPS** + + If you only need **local tools** (screen/camera/exec) on the second laptop, add it as a + **node**. That keeps a single Gateway and avoids duplicated config. Local node tools are + currently macOS-only, but we plan to extend them to other OSes. - ```bash - curl -fsSL https://tailscale.com/install.sh | sh - sudo tailscale up - ``` + Install a second Gateway only when you need **hard isolation** or two fully separate bots. -2. **Install + login on your Mac** - - Use the Tailscale app and sign in to the same tailnet. -3. **Enable MagicDNS (recommended)** - - In the Tailscale admin console, enable MagicDNS so the VPS has a stable name. -4. **Use the tailnet hostname** - - SSH: `ssh user@your-vps.tailnet-xxxx.ts.net` - - Gateway WS: `ws://your-vps.tailnet-xxxx.ts.net:18789` + Docs: [Nodes](/nodes), [Nodes CLI](/cli/nodes), [Multiple gateways](/gateway/multiple-gateways). -If you want the Control UI without SSH, use Tailscale Serve on the VPS: - -```bash -openclaw gateway --tailscale serve -``` - -This keeps the gateway bound to loopback and exposes HTTPS via Tailscale. See [Tailscale](/gateway/tailscale). - -### How do I connect a Mac node to a remote Gateway Tailscale Serve - -Serve exposes the **Gateway Control UI + WS**. Nodes connect over the same Gateway WS endpoint. - -Recommended setup: - -1. **Make sure the VPS + Mac are on the same tailnet**. -2. **Use the macOS app in Remote mode** (SSH target can be the tailnet hostname). - The app will tunnel the Gateway port and connect as a node. -3. **Approve the node** on the gateway: - - ```bash - openclaw devices list - openclaw devices approve - ``` - -Docs: [Gateway protocol](/gateway/protocol), [Discovery](/gateway/discovery), [macOS remote mode](/platforms/mac/remote). + + ## Env vars and .env loading -### How does OpenClaw load environment variables + + + OpenClaw reads env vars from the parent process (shell, launchd/systemd, CI, etc.) and additionally loads: -OpenClaw reads env vars from the parent process (shell, launchd/systemd, CI, etc.) and additionally loads: + - `.env` from the current working directory + - a global fallback `.env` from `~/.openclaw/.env` (aka `$OPENCLAW_STATE_DIR/.env`) -- `.env` from the current working directory -- a global fallback `.env` from `~/.openclaw/.env` (aka `$OPENCLAW_STATE_DIR/.env`) + Neither `.env` file overrides existing env vars. -Neither `.env` file overrides existing env vars. + You can also define inline env vars in config (applied only if missing from the process env): -You can also define inline env vars in config (applied only if missing from the process env): + ```json5 + { + env: { + OPENROUTER_API_KEY: "sk-or-...", + vars: { GROQ_API_KEY: "gsk-..." }, + }, + } + ``` -```json5 -{ - env: { - OPENROUTER_API_KEY: "sk-or-...", - vars: { GROQ_API_KEY: "gsk-..." }, - }, -} -``` + See [/environment](/help/environment) for full precedence and sources. -See [/environment](/help/environment) for full precedence and sources. + -### I started the Gateway via the service and my env vars disappeared What now + + Two common fixes: -Two common fixes: + 1. Put the missing keys in `~/.openclaw/.env` so they're picked up even when the service doesn't inherit your shell env. + 2. Enable shell import (opt-in convenience): -1. Put the missing keys in `~/.openclaw/.env` so they're picked up even when the service doesn't inherit your shell env. -2. Enable shell import (opt-in convenience): + ```json5 + { + env: { + shellEnv: { + enabled: true, + timeoutMs: 15000, + }, + }, + } + ``` -```json5 -{ - env: { - shellEnv: { - enabled: true, - timeoutMs: 15000, - }, - }, -} -``` + This runs your login shell and imports only missing expected keys (never overrides). Env var equivalents: + `OPENCLAW_LOAD_SHELL_ENV=1`, `OPENCLAW_SHELL_ENV_TIMEOUT_MS=15000`. -This runs your login shell and imports only missing expected keys (never overrides). Env var equivalents: -`OPENCLAW_LOAD_SHELL_ENV=1`, `OPENCLAW_SHELL_ENV_TIMEOUT_MS=15000`. + -### I set COPILOTGITHUBTOKEN but models status shows Shell env off Why + + `openclaw models status` reports whether **shell env import** is enabled. "Shell env: off" + does **not** mean your env vars are missing - it just means OpenClaw won't load + your login shell automatically. -`openclaw models status` reports whether **shell env import** is enabled. "Shell env: off" -does **not** mean your env vars are missing - it just means OpenClaw won't load -your login shell automatically. + If the Gateway runs as a service (launchd/systemd), it won't inherit your shell + environment. Fix by doing one of these: -If the Gateway runs as a service (launchd/systemd), it won't inherit your shell -environment. Fix by doing one of these: + 1. Put the token in `~/.openclaw/.env`: -1. Put the token in `~/.openclaw/.env`: + ``` + COPILOT_GITHUB_TOKEN=... + ``` - ``` - COPILOT_GITHUB_TOKEN=... - ``` + 2. Or enable shell import (`env.shellEnv.enabled: true`). + 3. Or add it to your config `env` block (applies only if missing). -2. Or enable shell import (`env.shellEnv.enabled: true`). -3. Or add it to your config `env` block (applies only if missing). + Then restart the gateway and recheck: -Then restart the gateway and recheck: + ```bash + openclaw models status + ``` -```bash -openclaw models status -``` + Copilot tokens are read from `COPILOT_GITHUB_TOKEN` (also `GH_TOKEN` / `GITHUB_TOKEN`). + See [/concepts/model-providers](/concepts/model-providers) and [/environment](/help/environment). -Copilot tokens are read from `COPILOT_GITHUB_TOKEN` (also `GH_TOKEN` / `GITHUB_TOKEN`). -See [/concepts/model-providers](/concepts/model-providers) and [/environment](/help/environment). + + ## Sessions and multiple chats -### How do I start a fresh conversation + + + Send `/new` or `/reset` as a standalone message. See [Session management](/concepts/session). + -Send `/new` or `/reset` as a standalone message. See [Session management](/concepts/session). + + Yes. Sessions expire after `session.idleMinutes` (default **60**). The **next** + message starts a fresh session id for that chat key. This does not delete + transcripts - it just starts a new session. -### Do sessions reset automatically if I never send new - -Yes. Sessions expire after `session.idleMinutes` (default **60**). The **next** -message starts a fresh session id for that chat key. This does not delete -transcripts - it just starts a new session. - -```json5 -{ - session: { - idleMinutes: 240, - }, -} -``` - -### Is there a way to make a team of OpenClaw instances one CEO and many agents - -Yes, via **multi-agent routing** and **sub-agents**. You can create one coordinator -agent and several worker agents with their own workspaces and models. - -That said, this is best seen as a **fun experiment**. It is token heavy and often -less efficient than using one bot with separate sessions. The typical model we -envision is one bot you talk to, with different sessions for parallel work. That -bot can also spawn sub-agents when needed. - -Docs: [Multi-agent routing](/concepts/multi-agent), [Sub-agents](/tools/subagents), [Agents CLI](/cli/agents). - -### Why did context get truncated midtask How do I prevent it - -Session context is limited by the model window. Long chats, large tool outputs, or many -files can trigger compaction or truncation. - -What helps: - -- Ask the bot to summarize the current state and write it to a file. -- Use `/compact` before long tasks, and `/new` when switching topics. -- Keep important context in the workspace and ask the bot to read it back. -- Use sub-agents for long or parallel work so the main chat stays smaller. -- Pick a model with a larger context window if this happens often. - -### How do I completely reset OpenClaw but keep it installed - -Use the reset command: - -```bash -openclaw reset -``` - -Non-interactive full reset: - -```bash -openclaw reset --scope full --yes --non-interactive -``` - -Then re-run setup: - -```bash -openclaw onboard --install-daemon -``` - -Notes: - -- Onboarding also offers **Reset** if it sees an existing config. See [Onboarding (CLI)](/start/wizard). -- If you used profiles (`--profile` / `OPENCLAW_PROFILE`), reset each state dir (defaults are `~/.openclaw-`). -- Dev reset: `openclaw gateway --dev --reset` (dev-only; wipes dev config + credentials + sessions + workspace). - -### Im getting context too large errors how do I reset or compact - -Use one of these: - -- **Compact** (keeps the conversation but summarizes older turns): - - ``` - /compact - ``` - - or `/compact ` to guide the summary. - -- **Reset** (fresh session ID for the same chat key): - - ``` - /new - /reset - ``` - -If it keeps happening: - -- Enable or tune **session pruning** (`agents.defaults.contextPruning`) to trim old tool output. -- Use a model with a larger context window. - -Docs: [Compaction](/concepts/compaction), [Session pruning](/concepts/session-pruning), [Session management](/concepts/session). - -### Why am I seeing "LLM request rejected: messages.content.tool_use.input field required"? - -This is a provider validation error: the model emitted a `tool_use` block without the required -`input`. It usually means the session history is stale or corrupted (often after long threads -or a tool/schema change). - -Fix: start a fresh session with `/new` (standalone message). - -### Why am I getting heartbeat messages every 30 minutes - -Heartbeats run every **30m** by default. Tune or disable them: - -```json5 -{ - agents: { - defaults: { - heartbeat: { - every: "2h", // or "0m" to disable + ```json5 + { + session: { + idleMinutes: 240, }, - }, - }, -} -``` + } + ``` -If `HEARTBEAT.md` exists but is effectively empty (only blank lines and markdown -headers like `# Heading`), OpenClaw skips the heartbeat run to save API calls. -If the file is missing, the heartbeat still runs and the model decides what to do. + -Per-agent overrides use `agents.list[].heartbeat`. Docs: [Heartbeat](/gateway/heartbeat). + + Yes, via **multi-agent routing** and **sub-agents**. You can create one coordinator + agent and several worker agents with their own workspaces and models. -### Do I need to add a bot account to a WhatsApp group + That said, this is best seen as a **fun experiment**. It is token heavy and often + less efficient than using one bot with separate sessions. The typical model we + envision is one bot you talk to, with different sessions for parallel work. That + bot can also spawn sub-agents when needed. -No. OpenClaw runs on **your own account**, so if you're in the group, OpenClaw can see it. -By default, group replies are blocked until you allow senders (`groupPolicy: "allowlist"`). + Docs: [Multi-agent routing](/concepts/multi-agent), [Sub-agents](/tools/subagents), [Agents CLI](/cli/agents). -If you want only **you** to be able to trigger group replies: + -```json5 -{ - channels: { - whatsapp: { - groupPolicy: "allowlist", - groupAllowFrom: ["+15551234567"], - }, - }, -} -``` + + Session context is limited by the model window. Long chats, large tool outputs, or many + files can trigger compaction or truncation. -### How do I get the JID of a WhatsApp group + What helps: -Option 1 (fastest): tail logs and send a test message in the group: + - Ask the bot to summarize the current state and write it to a file. + - Use `/compact` before long tasks, and `/new` when switching topics. + - Keep important context in the workspace and ask the bot to read it back. + - Use sub-agents for long or parallel work so the main chat stays smaller. + - Pick a model with a larger context window if this happens often. -```bash -openclaw logs --follow --json -``` + -Look for `chatId` (or `from`) ending in `@g.us`, like: -`1234567890-1234567890@g.us`. + + Use the reset command: -Option 2 (if already configured/allowlisted): list groups from config: + ```bash + openclaw reset + ``` -```bash -openclaw directory groups list --channel whatsapp -``` + Non-interactive full reset: -Docs: [WhatsApp](/channels/whatsapp), [Directory](/cli/directory), [Logs](/cli/logs). + ```bash + openclaw reset --scope full --yes --non-interactive + ``` -### Why does OpenClaw not reply in a group + Then re-run setup: -Two common causes: + ```bash + openclaw onboard --install-daemon + ``` -- Mention gating is on (default). You must @mention the bot (or match `mentionPatterns`). -- You configured `channels.whatsapp.groups` without `"*"` and the group isn't allowlisted. + Notes: -See [Groups](/channels/groups) and [Group messages](/channels/group-messages). + - Onboarding also offers **Reset** if it sees an existing config. See [Onboarding (CLI)](/start/wizard). + - If you used profiles (`--profile` / `OPENCLAW_PROFILE`), reset each state dir (defaults are `~/.openclaw-`). + - Dev reset: `openclaw gateway --dev --reset` (dev-only; wipes dev config + credentials + sessions + workspace). -### Do groups/threads share context with DMs + -Direct chats collapse to the main session by default. Groups/channels have their own session keys, and Telegram topics / Discord threads are separate sessions. See [Groups](/channels/groups) and [Group messages](/channels/group-messages). + + Use one of these: -### How many workspaces and agents can I create + - **Compact** (keeps the conversation but summarizes older turns): -No hard limits. Dozens (even hundreds) are fine, but watch for: + ``` + /compact + ``` -- **Disk growth:** sessions + transcripts live under `~/.openclaw/agents//sessions/`. -- **Token cost:** more agents means more concurrent model usage. -- **Ops overhead:** per-agent auth profiles, workspaces, and channel routing. + or `/compact ` to guide the summary. -Tips: + - **Reset** (fresh session ID for the same chat key): -- Keep one **active** workspace per agent (`agents.defaults.workspace`). -- Prune old sessions (delete JSONL or store entries) if disk grows. -- Use `openclaw doctor` to spot stray workspaces and profile mismatches. + ``` + /new + /reset + ``` -### Can I run multiple bots or chats at the same time Slack and how should I set that up + If it keeps happening: -Yes. Use **Multi-Agent Routing** to run multiple isolated agents and route inbound messages by -channel/account/peer. Slack is supported as a channel and can be bound to specific agents. + - Enable or tune **session pruning** (`agents.defaults.contextPruning`) to trim old tool output. + - Use a model with a larger context window. -Browser access is powerful but not "do anything a human can" - anti-bot, CAPTCHAs, and MFA can -still block automation. For the most reliable browser control, use local Chrome MCP on the host, -or use CDP on the machine that actually runs the browser. + Docs: [Compaction](/concepts/compaction), [Session pruning](/concepts/session-pruning), [Session management](/concepts/session). -Best-practice setup: + -- Always-on Gateway host (VPS/Mac mini). -- One agent per role (bindings). -- Slack channel(s) bound to those agents. -- Local browser via Chrome MCP or a node when needed. + + This is a provider validation error: the model emitted a `tool_use` block without the required + `input`. It usually means the session history is stale or corrupted (often after long threads + or a tool/schema change). -Docs: [Multi-Agent Routing](/concepts/multi-agent), [Slack](/channels/slack), -[Browser](/tools/browser), [Nodes](/nodes). + Fix: start a fresh session with `/new` (standalone message). + + + + + Heartbeats run every **30m** by default. Tune or disable them: + + ```json5 + { + agents: { + defaults: { + heartbeat: { + every: "2h", // or "0m" to disable + }, + }, + }, + } + ``` + + If `HEARTBEAT.md` exists but is effectively empty (only blank lines and markdown + headers like `# Heading`), OpenClaw skips the heartbeat run to save API calls. + If the file is missing, the heartbeat still runs and the model decides what to do. + + Per-agent overrides use `agents.list[].heartbeat`. Docs: [Heartbeat](/gateway/heartbeat). + + + + + No. OpenClaw runs on **your own account**, so if you're in the group, OpenClaw can see it. + By default, group replies are blocked until you allow senders (`groupPolicy: "allowlist"`). + + If you want only **you** to be able to trigger group replies: + + ```json5 + { + channels: { + whatsapp: { + groupPolicy: "allowlist", + groupAllowFrom: ["+15551234567"], + }, + }, + } + ``` + + + + + Option 1 (fastest): tail logs and send a test message in the group: + + ```bash + openclaw logs --follow --json + ``` + + Look for `chatId` (or `from`) ending in `@g.us`, like: + `1234567890-1234567890@g.us`. + + Option 2 (if already configured/allowlisted): list groups from config: + + ```bash + openclaw directory groups list --channel whatsapp + ``` + + Docs: [WhatsApp](/channels/whatsapp), [Directory](/cli/directory), [Logs](/cli/logs). + + + + + Two common causes: + + - Mention gating is on (default). You must @mention the bot (or match `mentionPatterns`). + - You configured `channels.whatsapp.groups` without `"*"` and the group isn't allowlisted. + + See [Groups](/channels/groups) and [Group messages](/channels/group-messages). + + + + + Direct chats collapse to the main session by default. Groups/channels have their own session keys, and Telegram topics / Discord threads are separate sessions. See [Groups](/channels/groups) and [Group messages](/channels/group-messages). + + + + No hard limits. Dozens (even hundreds) are fine, but watch for: + + - **Disk growth:** sessions + transcripts live under `~/.openclaw/agents//sessions/`. + - **Token cost:** more agents means more concurrent model usage. + - **Ops overhead:** per-agent auth profiles, workspaces, and channel routing. + + Tips: + + - Keep one **active** workspace per agent (`agents.defaults.workspace`). + - Prune old sessions (delete JSONL or store entries) if disk grows. + - Use `openclaw doctor` to spot stray workspaces and profile mismatches. + + + + + Yes. Use **Multi-Agent Routing** to run multiple isolated agents and route inbound messages by + channel/account/peer. Slack is supported as a channel and can be bound to specific agents. + + Browser access is powerful but not "do anything a human can" - anti-bot, CAPTCHAs, and MFA can + still block automation. For the most reliable browser control, use local Chrome MCP on the host, + or use CDP on the machine that actually runs the browser. + + Best-practice setup: + + - Always-on Gateway host (VPS/Mac mini). + - One agent per role (bindings). + - Slack channel(s) bound to those agents. + - Local browser via Chrome MCP or a node when needed. + + Docs: [Multi-Agent Routing](/concepts/multi-agent), [Slack](/channels/slack), + [Browser](/tools/browser), [Nodes](/nodes). + + + ## Models: defaults, selection, aliases, switching -### What is the default model + + + OpenClaw's default model is whatever you set as: -OpenClaw's default model is whatever you set as: + ``` + agents.defaults.model.primary + ``` -``` -agents.defaults.model.primary -``` + Models are referenced as `provider/model` (example: `anthropic/claude-opus-4-6`). If you omit the provider, OpenClaw currently assumes `anthropic` as a temporary deprecation fallback - but you should still **explicitly** set `provider/model`. -Models are referenced as `provider/model` (example: `anthropic/claude-opus-4-6`). If you omit the provider, OpenClaw currently assumes `anthropic` as a temporary deprecation fallback - but you should still **explicitly** set `provider/model`. + -### What model do you recommend + + **Recommended default:** use the strongest latest-generation model available in your provider stack. + **For tool-enabled or untrusted-input agents:** prioritize model strength over cost. + **For routine/low-stakes chat:** use cheaper fallback models and route by agent role. -**Recommended default:** use the strongest latest-generation model available in your provider stack. -**For tool-enabled or untrusted-input agents:** prioritize model strength over cost. -**For routine/low-stakes chat:** use cheaper fallback models and route by agent role. + MiniMax M2.5 has its own docs: [MiniMax](/providers/minimax) and + [Local models](/gateway/local-models). -MiniMax M2.5 has its own docs: [MiniMax](/providers/minimax) and -[Local models](/gateway/local-models). + Rule of thumb: use the **best model you can afford** for high-stakes work, and a cheaper + model for routine chat or summaries. You can route models per agent and use sub-agents to + parallelize long tasks (each sub-agent consumes tokens). See [Models](/concepts/models) and + [Sub-agents](/tools/subagents). -Rule of thumb: use the **best model you can afford** for high-stakes work, and a cheaper -model for routine chat or summaries. You can route models per agent and use sub-agents to -parallelize long tasks (each sub-agent consumes tokens). See [Models](/concepts/models) and -[Sub-agents](/tools/subagents). + Strong warning: weaker/over-quantized models are more vulnerable to prompt + injection and unsafe behavior. See [Security](/gateway/security). -Strong warning: weaker/over-quantized models are more vulnerable to prompt -injection and unsafe behavior. See [Security](/gateway/security). + More context: [Models](/concepts/models). -More context: [Models](/concepts/models). + -### Can I use selfhosted models llamacpp vLLM Ollama + + Use **model commands** or edit only the **model** fields. Avoid full config replaces. -Yes. Ollama is the easiest path for local models. + Safe options: -Quickest setup: + - `/model` in chat (quick, per-session) + - `openclaw models set ...` (updates just model config) + - `openclaw configure --section model` (interactive) + - edit `agents.defaults.model` in `~/.openclaw/openclaw.json` -1. Install Ollama from `https://ollama.com/download` -2. Pull a local model such as `ollama pull glm-4.7-flash` -3. If you want Ollama Cloud too, run `ollama signin` -4. Run `openclaw onboard` and choose `Ollama` -5. Pick `Local` or `Cloud + Local` + Avoid `config.apply` with a partial object unless you intend to replace the whole config. + If you did overwrite config, restore from backup or re-run `openclaw doctor` to repair. -Notes: + Docs: [Models](/concepts/models), [Configure](/cli/configure), [Config](/cli/config), [Doctor](/gateway/doctor). -- `Cloud + Local` gives you Ollama Cloud models plus your local Ollama models -- cloud models such as `kimi-k2.5:cloud` do not need a local pull -- for manual switching, use `openclaw models list` and `openclaw models set ollama/` + -Security note: smaller or heavily quantized models are more vulnerable to prompt -injection. We strongly recommend **large models** for any bot that can use tools. -If you still want small models, enable sandboxing and strict tool allowlists. + + Yes. Ollama is the easiest path for local models. -Docs: [Ollama](/providers/ollama), [Local models](/gateway/local-models), -[Model providers](/concepts/model-providers), [Security](/gateway/security), -[Sandboxing](/gateway/sandboxing). + Quickest setup: -### How do I switch models without wiping my config + 1. Install Ollama from `https://ollama.com/download` + 2. Pull a local model such as `ollama pull glm-4.7-flash` + 3. If you want Ollama Cloud too, run `ollama signin` + 4. Run `openclaw onboard` and choose `Ollama` + 5. Pick `Local` or `Cloud + Local` -Use **model commands** or edit only the **model** fields. Avoid full config replaces. + Notes: -Safe options: + - `Cloud + Local` gives you Ollama Cloud models plus your local Ollama models + - cloud models such as `kimi-k2.5:cloud` do not need a local pull + - for manual switching, use `openclaw models list` and `openclaw models set ollama/` -- `/model` in chat (quick, per-session) -- `openclaw models set ...` (updates just model config) -- `openclaw configure --section model` (interactive) -- edit `agents.defaults.model` in `~/.openclaw/openclaw.json` + Security note: smaller or heavily quantized models are more vulnerable to prompt + injection. We strongly recommend **large models** for any bot that can use tools. + If you still want small models, enable sandboxing and strict tool allowlists. -Avoid `config.apply` with a partial object unless you intend to replace the whole config. -If you did overwrite config, restore from backup or re-run `openclaw doctor` to repair. + Docs: [Ollama](/providers/ollama), [Local models](/gateway/local-models), + [Model providers](/concepts/model-providers), [Security](/gateway/security), + [Sandboxing](/gateway/sandboxing). -Docs: [Models](/concepts/models), [Configure](/cli/configure), [Config](/cli/config), [Doctor](/gateway/doctor). + -### What do OpenClaw, Flawd, and Krill use for models + + - These deployments can differ and may change over time; there is no fixed provider recommendation. + - Check the current runtime setting on each gateway with `openclaw models status`. + - For security-sensitive/tool-enabled agents, use the strongest latest-generation model available. + -- These deployments can differ and may change over time; there is no fixed provider recommendation. -- Check the current runtime setting on each gateway with `openclaw models status`. -- For security-sensitive/tool-enabled agents, use the strongest latest-generation model available. + + Use the `/model` command as a standalone message: -### How do I switch models on the fly without restarting + ``` + /model sonnet + /model haiku + /model opus + /model gpt + /model gpt-mini + /model gemini + /model gemini-flash + ``` -Use the `/model` command as a standalone message: + You can list available models with `/model`, `/model list`, or `/model status`. -``` -/model sonnet -/model haiku -/model opus -/model gpt -/model gpt-mini -/model gemini -/model gemini-flash -``` + `/model` (and `/model list`) shows a compact, numbered picker. Select by number: -You can list available models with `/model`, `/model list`, or `/model status`. + ``` + /model 3 + ``` -`/model` (and `/model list`) shows a compact, numbered picker. Select by number: + You can also force a specific auth profile for the provider (per session): -``` -/model 3 -``` + ``` + /model opus@anthropic:default + /model opus@anthropic:work + ``` -You can also force a specific auth profile for the provider (per session): + Tip: `/model status` shows which agent is active, which `auth-profiles.json` file is being used, and which auth profile will be tried next. + It also shows the configured provider endpoint (`baseUrl`) and API mode (`api`) when available. -``` -/model opus@anthropic:default -/model opus@anthropic:work -``` + **How do I unpin a profile I set with @profile?** -Tip: `/model status` shows which agent is active, which `auth-profiles.json` file is being used, and which auth profile will be tried next. -It also shows the configured provider endpoint (`baseUrl`) and API mode (`api`) when available. + Re-run `/model` **without** the `@profile` suffix: -**How do I unpin a profile I set with profile** + ``` + /model anthropic/claude-opus-4-6 + ``` -Re-run `/model` **without** the `@profile` suffix: + If you want to return to the default, pick it from `/model` (or send `/model `). + Use `/model status` to confirm which auth profile is active. -``` -/model anthropic/claude-opus-4-6 -``` + -If you want to return to the default, pick it from `/model` (or send `/model `). -Use `/model status` to confirm which auth profile is active. + + Yes. Set one as default and switch as needed: -### Can I use GPT 5.2 for daily tasks and Codex 5.3 for coding + - **Quick switch (per session):** `/model gpt-5.2` for daily tasks, `/model openai-codex/gpt-5.4` for coding with Codex OAuth. + - **Default + switch:** set `agents.defaults.model.primary` to `openai/gpt-5.2`, then switch to `openai-codex/gpt-5.4` when coding (or the other way around). + - **Sub-agents:** route coding tasks to sub-agents with a different default model. -Yes. Set one as default and switch as needed: + See [Models](/concepts/models) and [Slash commands](/tools/slash-commands). -- **Quick switch (per session):** `/model gpt-5.2` for daily tasks, `/model openai-codex/gpt-5.4` for coding with Codex OAuth. -- **Default + switch:** set `agents.defaults.model.primary` to `openai/gpt-5.2`, then switch to `openai-codex/gpt-5.4` when coding (or the other way around). -- **Sub-agents:** route coding tasks to sub-agents with a different default model. + -See [Models](/concepts/models) and [Slash commands](/tools/slash-commands). + + If `agents.defaults.models` is set, it becomes the **allowlist** for `/model` and any + session overrides. Choosing a model that isn't in that list returns: -### Why do I see Model is not allowed and then no reply + ``` + Model "provider/model" is not allowed. Use /model to list available models. + ``` -If `agents.defaults.models` is set, it becomes the **allowlist** for `/model` and any -session overrides. Choosing a model that isn't in that list returns: + That error is returned **instead of** a normal reply. Fix: add the model to + `agents.defaults.models`, remove the allowlist, or pick a model from `/model list`. -``` -Model "provider/model" is not allowed. Use /model to list available models. -``` + -That error is returned **instead of** a normal reply. Fix: add the model to -`agents.defaults.models`, remove the allowlist, or pick a model from `/model list`. + + This means the **provider isn't configured** (no MiniMax provider config or auth + profile was found), so the model can't be resolved. A fix for this detection is + in **2026.1.12** (unreleased at the time of writing). -### Why do I see Unknown model minimaxMiniMaxM25 + Fix checklist: -This means the **provider isn't configured** (no MiniMax provider config or auth -profile was found), so the model can't be resolved. A fix for this detection is -in **2026.1.12** (unreleased at the time of writing). + 1. Upgrade to **2026.1.12** (or run from source `main`), then restart the gateway. + 2. Make sure MiniMax is configured (wizard or JSON), or that a MiniMax API key + exists in env/auth profiles so the provider can be injected. + 3. Use the exact model id (case-sensitive): `minimax/MiniMax-M2.5` or + `minimax/MiniMax-M2.5-highspeed`. + 4. Run: -Fix checklist: + ```bash + openclaw models list + ``` -1. Upgrade to **2026.1.12** (or run from source `main`), then restart the gateway. -2. Make sure MiniMax is configured (wizard or JSON), or that a MiniMax API key - exists in env/auth profiles so the provider can be injected. -3. Use the exact model id (case-sensitive): `minimax/MiniMax-M2.5` or - `minimax/MiniMax-M2.5-highspeed`. -4. Run: + and pick from the list (or `/model list` in chat). - ```bash - openclaw models list - ``` + See [MiniMax](/providers/minimax) and [Models](/concepts/models). - and pick from the list (or `/model list` in chat). + -See [MiniMax](/providers/minimax) and [Models](/concepts/models). + + Yes. Use **MiniMax as the default** and switch models **per session** when needed. + Fallbacks are for **errors**, not "hard tasks," so use `/model` or a separate agent. -### Can I use MiniMax as my default and OpenAI for complex tasks + **Option A: switch per session** -Yes. Use **MiniMax as the default** and switch models **per session** when needed. -Fallbacks are for **errors**, not "hard tasks," so use `/model` or a separate agent. - -**Option A: switch per session** - -```json5 -{ - env: { MINIMAX_API_KEY: "sk-...", OPENAI_API_KEY: "sk-..." }, - agents: { - defaults: { - model: { primary: "minimax/MiniMax-M2.5" }, - models: { - "minimax/MiniMax-M2.5": { alias: "minimax" }, - "openai/gpt-5.2": { alias: "gpt" }, + ```json5 + { + env: { MINIMAX_API_KEY: "sk-...", OPENAI_API_KEY: "sk-..." }, + agents: { + defaults: { + model: { primary: "minimax/MiniMax-M2.5" }, + models: { + "minimax/MiniMax-M2.5": { alias: "minimax" }, + "openai/gpt-5.2": { alias: "gpt" }, + }, + }, }, - }, - }, -} -``` + } + ``` -Then: + Then: -``` -/model gpt -``` + ``` + /model gpt + ``` -**Option B: separate agents** + **Option B: separate agents** -- Agent A default: MiniMax -- Agent B default: OpenAI -- Route by agent or use `/agent` to switch + - Agent A default: MiniMax + - Agent B default: OpenAI + - Route by agent or use `/agent` to switch -Docs: [Models](/concepts/models), [Multi-Agent Routing](/concepts/multi-agent), [MiniMax](/providers/minimax), [OpenAI](/providers/openai). + Docs: [Models](/concepts/models), [Multi-Agent Routing](/concepts/multi-agent), [MiniMax](/providers/minimax), [OpenAI](/providers/openai). -### Are opus sonnet gpt builtin shortcuts + -Yes. OpenClaw ships a few default shorthands (only applied when the model exists in `agents.defaults.models`): + + Yes. OpenClaw ships a few default shorthands (only applied when the model exists in `agents.defaults.models`): -- `opus` → `anthropic/claude-opus-4-6` -- `sonnet` → `anthropic/claude-sonnet-4-6` -- `gpt` → `openai/gpt-5.4` -- `gpt-mini` → `openai/gpt-5-mini` -- `gemini` → `google/gemini-3.1-pro-preview` -- `gemini-flash` → `google/gemini-3-flash-preview` -- `gemini-flash-lite` → `google/gemini-3.1-flash-lite-preview` + - `opus` → `anthropic/claude-opus-4-6` + - `sonnet` → `anthropic/claude-sonnet-4-6` + - `gpt` → `openai/gpt-5.4` + - `gpt-mini` → `openai/gpt-5-mini` + - `gemini` → `google/gemini-3.1-pro-preview` + - `gemini-flash` → `google/gemini-3-flash-preview` + - `gemini-flash-lite` → `google/gemini-3.1-flash-lite-preview` -If you set your own alias with the same name, your value wins. + If you set your own alias with the same name, your value wins. -### How do I defineoverride model shortcuts aliases + -Aliases come from `agents.defaults.models..alias`. Example: + + Aliases come from `agents.defaults.models..alias`. Example: -```json5 -{ - agents: { - defaults: { - model: { primary: "anthropic/claude-opus-4-6" }, - models: { - "anthropic/claude-opus-4-6": { alias: "opus" }, - "anthropic/claude-sonnet-4-5": { alias: "sonnet" }, - "anthropic/claude-haiku-4-5": { alias: "haiku" }, + ```json5 + { + agents: { + defaults: { + model: { primary: "anthropic/claude-opus-4-6" }, + models: { + "anthropic/claude-opus-4-6": { alias: "opus" }, + "anthropic/claude-sonnet-4-6": { alias: "sonnet" }, + "anthropic/claude-haiku-4-5": { alias: "haiku" }, + }, + }, }, - }, - }, -} -``` + } + ``` -Then `/model sonnet` (or `/` when supported) resolves to that model ID. + Then `/model sonnet` (or `/` when supported) resolves to that model ID. -### How do I add models from other providers like OpenRouter or ZAI + -OpenRouter (pay-per-token; many models): + + OpenRouter (pay-per-token; many models): -```json5 -{ - agents: { - defaults: { - model: { primary: "openrouter/anthropic/claude-sonnet-4-5" }, - models: { "openrouter/anthropic/claude-sonnet-4-5": {} }, - }, - }, - env: { OPENROUTER_API_KEY: "sk-or-..." }, -} -``` + ```json5 + { + agents: { + defaults: { + model: { primary: "openrouter/anthropic/claude-sonnet-4-6" }, + models: { "openrouter/anthropic/claude-sonnet-4-6": {} }, + }, + }, + env: { OPENROUTER_API_KEY: "sk-or-..." }, + } + ``` -Z.AI (GLM models): + Z.AI (GLM models): -```json5 -{ - agents: { - defaults: { - model: { primary: "zai/glm-5" }, - models: { "zai/glm-5": {} }, - }, - }, - env: { ZAI_API_KEY: "..." }, -} -``` + ```json5 + { + agents: { + defaults: { + model: { primary: "zai/glm-5" }, + models: { "zai/glm-5": {} }, + }, + }, + env: { ZAI_API_KEY: "..." }, + } + ``` -If you reference a provider/model but the required provider key is missing, you'll get a runtime auth error (e.g. `No API key found for provider "zai"`). + If you reference a provider/model but the required provider key is missing, you'll get a runtime auth error (e.g. `No API key found for provider "zai"`). -**No API key found for provider after adding a new agent** + **No API key found for provider after adding a new agent** -This usually means the **new agent** has an empty auth store. Auth is per-agent and -stored in: + This usually means the **new agent** has an empty auth store. Auth is per-agent and + stored in: -``` -~/.openclaw/agents//agent/auth-profiles.json -``` + ``` + ~/.openclaw/agents//agent/auth-profiles.json + ``` -Fix options: + Fix options: -- Run `openclaw agents add ` and configure auth during the wizard. -- Or copy `auth-profiles.json` from the main agent's `agentDir` into the new agent's `agentDir`. + - Run `openclaw agents add ` and configure auth during the wizard. + - Or copy `auth-profiles.json` from the main agent's `agentDir` into the new agent's `agentDir`. -Do **not** reuse `agentDir` across agents; it causes auth/session collisions. + Do **not** reuse `agentDir` across agents; it causes auth/session collisions. + + + ## Model failover and "All models failed" -### How does failover work + + + Failover happens in two stages: -Failover happens in two stages: + 1. **Auth profile rotation** within the same provider. + 2. **Model fallback** to the next model in `agents.defaults.model.fallbacks`. -1. **Auth profile rotation** within the same provider. -2. **Model fallback** to the next model in `agents.defaults.model.fallbacks`. + Cooldowns apply to failing profiles (exponential backoff), so OpenClaw can keep responding even when a provider is rate-limited or temporarily failing. -Cooldowns apply to failing profiles (exponential backoff), so OpenClaw can keep responding even when a provider is rate-limited or temporarily failing. + -### What does this error mean + + It means the system attempted to use the auth profile ID `anthropic:default`, but could not find credentials for it in the expected auth store. -``` -No credentials found for profile "anthropic:default" -``` + **Fix checklist:** -It means the system attempted to use the auth profile ID `anthropic:default`, but could not find credentials for it in the expected auth store. + - **Confirm where auth profiles live** (new vs legacy paths) + - Current: `~/.openclaw/agents//agent/auth-profiles.json` + - Legacy: `~/.openclaw/agent/*` (migrated by `openclaw doctor`) + - **Confirm your env var is loaded by the Gateway** + - If you set `ANTHROPIC_API_KEY` in your shell but run the Gateway via systemd/launchd, it may not inherit it. Put it in `~/.openclaw/.env` or enable `env.shellEnv`. + - **Make sure you're editing the correct agent** + - Multi-agent setups mean there can be multiple `auth-profiles.json` files. + - **Sanity-check model/auth status** + - Use `openclaw models status` to see configured models and whether providers are authenticated. -### Fix checklist for No credentials found for profile anthropicdefault + **Fix checklist for "No credentials found for profile anthropic"** -- **Confirm where auth profiles live** (new vs legacy paths) - - Current: `~/.openclaw/agents//agent/auth-profiles.json` - - Legacy: `~/.openclaw/agent/*` (migrated by `openclaw doctor`) -- **Confirm your env var is loaded by the Gateway** - - If you set `ANTHROPIC_API_KEY` in your shell but run the Gateway via systemd/launchd, it may not inherit it. Put it in `~/.openclaw/.env` or enable `env.shellEnv`. -- **Make sure you're editing the correct agent** - - Multi-agent setups mean there can be multiple `auth-profiles.json` files. -- **Sanity-check model/auth status** - - Use `openclaw models status` to see configured models and whether providers are authenticated. + This means the run is pinned to an Anthropic auth profile, but the Gateway + can't find it in its auth store. -**Fix checklist for No credentials found for profile anthropic** + - **Use a setup-token** + - Run `claude setup-token`, then paste it with `openclaw models auth setup-token --provider anthropic`. + - If the token was created on another machine, use `openclaw models auth paste-token --provider anthropic`. + - **If you want to use an API key instead** + - Put `ANTHROPIC_API_KEY` in `~/.openclaw/.env` on the **gateway host**. + - Clear any pinned order that forces a missing profile: -This means the run is pinned to an Anthropic auth profile, but the Gateway -can't find it in its auth store. + ```bash + openclaw models auth order clear --provider anthropic + ``` -- **Use a setup-token** - - Run `claude setup-token`, then paste it with `openclaw models auth setup-token --provider anthropic`. - - If the token was created on another machine, use `openclaw models auth paste-token --provider anthropic`. -- **If you want to use an API key instead** - - Put `ANTHROPIC_API_KEY` in `~/.openclaw/.env` on the **gateway host**. - - Clear any pinned order that forces a missing profile: + - **Confirm you're running commands on the gateway host** + - In remote mode, auth profiles live on the gateway machine, not your laptop. - ```bash - openclaw models auth order clear --provider anthropic - ``` + -- **Confirm you're running commands on the gateway host** - - In remote mode, auth profiles live on the gateway machine, not your laptop. + + If your model config includes Google Gemini as a fallback (or you switched to a Gemini shorthand), OpenClaw will try it during model fallback. If you haven't configured Google credentials, you'll see `No API key found for provider "google"`. -### Why did it also try Google Gemini and fail + Fix: either provide Google auth, or remove/avoid Google models in `agents.defaults.model.fallbacks` / aliases so fallback doesn't route there. -If your model config includes Google Gemini as a fallback (or you switched to a Gemini shorthand), OpenClaw will try it during model fallback. If you haven't configured Google credentials, you'll see `No API key found for provider "google"`. + **LLM request rejected: thinking signature required (Google Antigravity)** -Fix: either provide Google auth, or remove/avoid Google models in `agents.defaults.model.fallbacks` / aliases so fallback doesn't route there. + Cause: the session history contains **thinking blocks without signatures** (often from + an aborted/partial stream). Google Antigravity requires signatures for thinking blocks. -**LLM request rejected message thinking signature required google antigravity** + Fix: OpenClaw now strips unsigned thinking blocks for Google Antigravity Claude. If it still appears, start a **new session** or set `/thinking off` for that agent. -Cause: the session history contains **thinking blocks without signatures** (often from -an aborted/partial stream). Google Antigravity requires signatures for thinking blocks. - -Fix: OpenClaw now strips unsigned thinking blocks for Google Antigravity Claude. If it still appears, start a **new session** or set `/thinking off` for that agent. + + ## Auth profiles: what they are and how to manage them Related: [/concepts/oauth](/concepts/oauth) (OAuth flows, token storage, multi-account patterns) -### What is an auth profile + + + An auth profile is a named credential record (OAuth or API key) tied to a provider. Profiles live in: -An auth profile is a named credential record (OAuth or API key) tied to a provider. Profiles live in: + ``` + ~/.openclaw/agents//agent/auth-profiles.json + ``` -``` -~/.openclaw/agents//agent/auth-profiles.json -``` + -### What are typical profile IDs + + OpenClaw uses provider-prefixed IDs like: -OpenClaw uses provider-prefixed IDs like: + - `anthropic:default` (common when no email identity exists) + - `anthropic:` for OAuth identities + - custom IDs you choose (e.g. `anthropic:work`) -- `anthropic:default` (common when no email identity exists) -- `anthropic:` for OAuth identities -- custom IDs you choose (e.g. `anthropic:work`) + -### Can I control which auth profile is tried first + + Yes. Config supports optional metadata for profiles and an ordering per provider (`auth.order.`). This does **not** store secrets; it maps IDs to provider/mode and sets rotation order. -Yes. Config supports optional metadata for profiles and an ordering per provider (`auth.order.`). This does **not** store secrets; it maps IDs to provider/mode and sets rotation order. + OpenClaw may temporarily skip a profile if it's in a short **cooldown** (rate limits/timeouts/auth failures) or a longer **disabled** state (billing/insufficient credits). To inspect this, run `openclaw models status --json` and check `auth.unusableProfiles`. Tuning: `auth.cooldowns.billingBackoffHours*`. -OpenClaw may temporarily skip a profile if it's in a short **cooldown** (rate limits/timeouts/auth failures) or a longer **disabled** state (billing/insufficient credits). To inspect this, run `openclaw models status --json` and check `auth.unusableProfiles`. Tuning: `auth.cooldowns.billingBackoffHours*`. + You can also set a **per-agent** order override (stored in that agent's `auth-profiles.json`) via the CLI: -You can also set a **per-agent** order override (stored in that agent's `auth-profiles.json`) via the CLI: + ```bash + # Defaults to the configured default agent (omit --agent) + openclaw models auth order get --provider anthropic -```bash -# Defaults to the configured default agent (omit --agent) -openclaw models auth order get --provider anthropic + # Lock rotation to a single profile (only try this one) + openclaw models auth order set --provider anthropic anthropic:default -# Lock rotation to a single profile (only try this one) -openclaw models auth order set --provider anthropic anthropic:default + # Or set an explicit order (fallback within provider) + openclaw models auth order set --provider anthropic anthropic:work anthropic:default -# Or set an explicit order (fallback within provider) -openclaw models auth order set --provider anthropic anthropic:work anthropic:default + # Clear override (fall back to config auth.order / round-robin) + openclaw models auth order clear --provider anthropic + ``` -# Clear override (fall back to config auth.order / round-robin) -openclaw models auth order clear --provider anthropic -``` + To target a specific agent: -To target a specific agent: + ```bash + openclaw models auth order set --provider anthropic --agent main anthropic:default + ``` -```bash -openclaw models auth order set --provider anthropic --agent main anthropic:default -``` + -### OAuth vs API key - what is the difference + + OpenClaw supports both: -OpenClaw supports both: + - **OAuth** often leverages subscription access (where applicable). + - **API keys** use pay-per-token billing. -- **OAuth** often leverages subscription access (where applicable). -- **API keys** use pay-per-token billing. + The wizard explicitly supports Anthropic setup-token and OpenAI Codex OAuth and can store API keys for you. -The wizard explicitly supports Anthropic setup-token and OpenAI Codex OAuth and can store API keys for you. + + ## Gateway: ports, "already running", and remote mode -### What port does the Gateway use + + + `gateway.port` controls the single multiplexed port for WebSocket + HTTP (Control UI, hooks, etc.). -`gateway.port` controls the single multiplexed port for WebSocket + HTTP (Control UI, hooks, etc.). + Precedence: -Precedence: + ``` + --port > OPENCLAW_GATEWAY_PORT > gateway.port > default 18789 + ``` -``` ---port > OPENCLAW_GATEWAY_PORT > gateway.port > default 18789 -``` + -### Why does openclaw gateway status say Runtime running but RPC probe failed + + Because "running" is the **supervisor's** view (launchd/systemd/schtasks). The RPC probe is the CLI actually connecting to the gateway WebSocket and calling `status`. -Because "running" is the **supervisor's** view (launchd/systemd/schtasks). The RPC probe is the CLI actually connecting to the gateway WebSocket and calling `status`. + Use `openclaw gateway status` and trust these lines: -Use `openclaw gateway status` and trust these lines: + - `Probe target:` (the URL the probe actually used) + - `Listening:` (what's actually bound on the port) + - `Last gateway error:` (common root cause when the process is alive but the port isn't listening) -- `Probe target:` (the URL the probe actually used) -- `Listening:` (what's actually bound on the port) -- `Last gateway error:` (common root cause when the process is alive but the port isn't listening) + -### Why does openclaw gateway status show Config cli and Config service different + + You're editing one config file while the service is running another (often a `--profile` / `OPENCLAW_STATE_DIR` mismatch). -You're editing one config file while the service is running another (often a `--profile` / `OPENCLAW_STATE_DIR` mismatch). + Fix: -Fix: + ```bash + openclaw gateway install --force + ``` -```bash -openclaw gateway install --force -``` + Run that from the same `--profile` / environment you want the service to use. -Run that from the same `--profile` / environment you want the service to use. + -### What does another gateway instance is already listening mean + + OpenClaw enforces a runtime lock by binding the WebSocket listener immediately on startup (default `ws://127.0.0.1:18789`). If the bind fails with `EADDRINUSE`, it throws `GatewayLockError` indicating another instance is already listening. -OpenClaw enforces a runtime lock by binding the WebSocket listener immediately on startup (default `ws://127.0.0.1:18789`). If the bind fails with `EADDRINUSE`, it throws `GatewayLockError` indicating another instance is already listening. + Fix: stop the other instance, free the port, or run with `openclaw gateway --port `. -Fix: stop the other instance, free the port, or run with `openclaw gateway --port `. + -### How do I run OpenClaw in remote mode client connects to a Gateway elsewhere + + Set `gateway.mode: "remote"` and point to a remote WebSocket URL, optionally with a token/password: -Set `gateway.mode: "remote"` and point to a remote WebSocket URL, optionally with a token/password: + ```json5 + { + gateway: { + mode: "remote", + remote: { + url: "ws://gateway.tailnet:18789", + token: "your-token", + password: "your-password", + }, + }, + } + ``` -```json5 -{ - gateway: { - mode: "remote", - remote: { - url: "ws://gateway.tailnet:18789", - token: "your-token", - password: "your-password", - }, - }, -} -``` + Notes: -Notes: + - `openclaw gateway` only starts when `gateway.mode` is `local` (or you pass the override flag). + - The macOS app watches the config file and switches modes live when these values change. -- `openclaw gateway` only starts when `gateway.mode` is `local` (or you pass the override flag). -- The macOS app watches the config file and switches modes live when these values change. + -### The Control UI says unauthorized or keeps reconnecting What now + + Your gateway is running with auth enabled (`gateway.auth.*`), but the UI is not sending the matching token/password. -Your gateway is running with auth enabled (`gateway.auth.*`), but the UI is not sending the matching token/password. + Facts (from code): -Facts (from code): + - The Control UI keeps the token in `sessionStorage` for the current browser tab session and selected gateway URL, so same-tab refreshes keep working without restoring long-lived localStorage token persistence. + - On `AUTH_TOKEN_MISMATCH`, trusted clients can attempt one bounded retry with a cached device token when the gateway returns retry hints (`canRetryWithDeviceToken=true`, `recommendedNextStep=retry_with_device_token`). -- The Control UI keeps the token in `sessionStorage` for the current browser tab session and selected gateway URL, so same-tab refreshes keep working without restoring long-lived localStorage token persistence. -- On `AUTH_TOKEN_MISMATCH`, trusted clients can attempt one bounded retry with a cached device token when the gateway returns retry hints (`canRetryWithDeviceToken=true`, `recommendedNextStep=retry_with_device_token`). + Fix: -Fix: + - Fastest: `openclaw dashboard` (prints + copies the dashboard URL, tries to open; shows SSH hint if headless). + - If you don't have a token yet: `openclaw doctor --generate-gateway-token`. + - If remote, tunnel first: `ssh -N -L 18789:127.0.0.1:18789 user@host` then open `http://127.0.0.1:18789/`. + - Set `gateway.auth.token` (or `OPENCLAW_GATEWAY_TOKEN`) on the gateway host. + - In the Control UI settings, paste the same token. + - If mismatch persists after the one retry, rotate/re-approve the paired device token: + - `openclaw devices list` + - `openclaw devices rotate --device --role operator` + - Still stuck? Run `openclaw status --all` and follow [Troubleshooting](/gateway/troubleshooting). See [Dashboard](/web/dashboard) for auth details. -- Fastest: `openclaw dashboard` (prints + copies the dashboard URL, tries to open; shows SSH hint if headless). -- If you don't have a token yet: `openclaw doctor --generate-gateway-token`. -- If remote, tunnel first: `ssh -N -L 18789:127.0.0.1:18789 user@host` then open `http://127.0.0.1:18789/`. -- Set `gateway.auth.token` (or `OPENCLAW_GATEWAY_TOKEN`) on the gateway host. -- In the Control UI settings, paste the same token. -- If mismatch persists after the one retry, rotate/re-approve the paired device token: - - `openclaw devices list` - - `openclaw devices rotate --device --role operator` -- Still stuck? Run `openclaw status --all` and follow [Troubleshooting](/gateway/troubleshooting). See [Dashboard](/web/dashboard) for auth details. + -### I set gateway.bind tailnet but it cannot bind and nothing listens + + `tailnet` bind picks a Tailscale IP from your network interfaces (100.64.0.0/10). If the machine isn't on Tailscale (or the interface is down), there's nothing to bind to. -`tailnet` bind picks a Tailscale IP from your network interfaces (100.64.0.0/10). If the machine isn't on Tailscale (or the interface is down), there's nothing to bind to. + Fix: -Fix: + - Start Tailscale on that host (so it has a 100.x address), or + - Switch to `gateway.bind: "loopback"` / `"lan"`. -- Start Tailscale on that host (so it has a 100.x address), or -- Switch to `gateway.bind: "loopback"` / `"lan"`. + Note: `tailnet` is explicit. `auto` prefers loopback; use `gateway.bind: "tailnet"` when you want a tailnet-only bind. -Note: `tailnet` is explicit. `auto` prefers loopback; use `gateway.bind: "tailnet"` when you want a tailnet-only bind. + -### Can I run multiple Gateways on the same host + + Usually no - one Gateway can run multiple messaging channels and agents. Use multiple Gateways only when you need redundancy (ex: rescue bot) or hard isolation. -Usually no - one Gateway can run multiple messaging channels and agents. Use multiple Gateways only when you need redundancy (ex: rescue bot) or hard isolation. + Yes, but you must isolate: -Yes, but you must isolate: + - `OPENCLAW_CONFIG_PATH` (per-instance config) + - `OPENCLAW_STATE_DIR` (per-instance state) + - `agents.defaults.workspace` (workspace isolation) + - `gateway.port` (unique ports) -- `OPENCLAW_CONFIG_PATH` (per-instance config) -- `OPENCLAW_STATE_DIR` (per-instance state) -- `agents.defaults.workspace` (workspace isolation) -- `gateway.port` (unique ports) + Quick setup (recommended): -Quick setup (recommended): + - Use `openclaw --profile ...` per instance (auto-creates `~/.openclaw-`). + - Set a unique `gateway.port` in each profile config (or pass `--port` for manual runs). + - Install a per-profile service: `openclaw --profile gateway install`. -- Use `openclaw --profile …` per instance (auto-creates `~/.openclaw-`). -- Set a unique `gateway.port` in each profile config (or pass `--port` for manual runs). -- Install a per-profile service: `openclaw --profile gateway install`. + Profiles also suffix service names (`ai.openclaw.`; legacy `com.openclaw.*`, `openclaw-gateway-.service`, `OpenClaw Gateway ()`). + Full guide: [Multiple gateways](/gateway/multiple-gateways). -Profiles also suffix service names (`ai.openclaw.`; legacy `com.openclaw.*`, `openclaw-gateway-.service`, `OpenClaw Gateway ()`). -Full guide: [Multiple gateways](/gateway/multiple-gateways). + -### What does invalid handshake code 1008 mean + + The Gateway is a **WebSocket server**, and it expects the very first message to + be a `connect` frame. If it receives anything else, it closes the connection + with **code 1008** (policy violation). -The Gateway is a **WebSocket server**, and it expects the very first message to -be a `connect` frame. If it receives anything else, it closes the connection -with **code 1008** (policy violation). + Common causes: -Common causes: + - You opened the **HTTP** URL in a browser (`http://...`) instead of a WS client. + - You used the wrong port or path. + - A proxy or tunnel stripped auth headers or sent a non-Gateway request. -- You opened the **HTTP** URL in a browser (`http://...`) instead of a WS client. -- You used the wrong port or path. -- A proxy or tunnel stripped auth headers or sent a non-Gateway request. + Quick fixes: -Quick fixes: + 1. Use the WS URL: `ws://:18789` (or `wss://...` if HTTPS). + 2. Don't open the WS port in a normal browser tab. + 3. If auth is on, include the token/password in the `connect` frame. -1. Use the WS URL: `ws://:18789` (or `wss://...` if HTTPS). -2. Don't open the WS port in a normal browser tab. -3. If auth is on, include the token/password in the `connect` frame. + If you're using the CLI or TUI, the URL should look like: -If you're using the CLI or TUI, the URL should look like: + ``` + openclaw tui --url ws://:18789 --token + ``` -``` -openclaw tui --url ws://:18789 --token -``` + Protocol details: [Gateway protocol](/gateway/protocol). -Protocol details: [Gateway protocol](/gateway/protocol). + + ## Logging and debugging -### Where are logs + + + File logs (structured): -File logs (structured): + ``` + /tmp/openclaw/openclaw-YYYY-MM-DD.log + ``` -``` -/tmp/openclaw/openclaw-YYYY-MM-DD.log -``` + You can set a stable path via `logging.file`. File log level is controlled by `logging.level`. Console verbosity is controlled by `--verbose` and `logging.consoleLevel`. -You can set a stable path via `logging.file`. File log level is controlled by `logging.level`. Console verbosity is controlled by `--verbose` and `logging.consoleLevel`. + Fastest log tail: -Fastest log tail: + ```bash + openclaw logs --follow + ``` -```bash -openclaw logs --follow -``` + Service/supervisor logs (when the gateway runs via launchd/systemd): -Service/supervisor logs (when the gateway runs via launchd/systemd): + - macOS: `$OPENCLAW_STATE_DIR/logs/gateway.log` and `gateway.err.log` (default: `~/.openclaw/logs/...`; profiles use `~/.openclaw-/logs/...`) + - Linux: `journalctl --user -u openclaw-gateway[-].service -n 200 --no-pager` + - Windows: `schtasks /Query /TN "OpenClaw Gateway ()" /V /FO LIST` -- macOS: `$OPENCLAW_STATE_DIR/logs/gateway.log` and `gateway.err.log` (default: `~/.openclaw/logs/...`; profiles use `~/.openclaw-/logs/...`) -- Linux: `journalctl --user -u openclaw-gateway[-].service -n 200 --no-pager` -- Windows: `schtasks /Query /TN "OpenClaw Gateway ()" /V /FO LIST` + See [Troubleshooting](/gateway/troubleshooting) for more. -See [Troubleshooting](/gateway/troubleshooting#log-locations) for more. + -### How do I start/stop/restart the Gateway service + + Use the gateway helpers: -Use the gateway helpers: + ```bash + openclaw gateway status + openclaw gateway restart + ``` -```bash -openclaw gateway status -openclaw gateway restart -``` + If you run the gateway manually, `openclaw gateway --force` can reclaim the port. See [Gateway](/gateway). -If you run the gateway manually, `openclaw gateway --force` can reclaim the port. See [Gateway](/gateway). + -### I closed my terminal on Windows how do I restart OpenClaw + + There are **two Windows install modes**: -There are **two Windows install modes**: + **1) WSL2 (recommended):** the Gateway runs inside Linux. -**1) WSL2 (recommended):** the Gateway runs inside Linux. + Open PowerShell, enter WSL, then restart: -Open PowerShell, enter WSL, then restart: + ```powershell + wsl + openclaw gateway status + openclaw gateway restart + ``` -```powershell -wsl -openclaw gateway status -openclaw gateway restart -``` + If you never installed the service, start it in the foreground: -If you never installed the service, start it in the foreground: + ```bash + openclaw gateway run + ``` -```bash -openclaw gateway run -``` + **2) Native Windows (not recommended):** the Gateway runs directly in Windows. -**2) Native Windows (not recommended):** the Gateway runs directly in Windows. + Open PowerShell and run: -Open PowerShell and run: + ```powershell + openclaw gateway status + openclaw gateway restart + ``` -```powershell -openclaw gateway status -openclaw gateway restart -``` + If you run it manually (no service), use: -If you run it manually (no service), use: + ```powershell + openclaw gateway run + ``` -```powershell -openclaw gateway run -``` + Docs: [Windows (WSL2)](/platforms/windows), [Gateway service runbook](/gateway). -Docs: [Windows (WSL2)](/platforms/windows), [Gateway service runbook](/gateway). + -### The Gateway is up but replies never arrive What should I check + + Start with a quick health sweep: -Start with a quick health sweep: + ```bash + openclaw status + openclaw models status + openclaw channels status + openclaw logs --follow + ``` -```bash -openclaw status -openclaw models status -openclaw channels status -openclaw logs --follow -``` + Common causes: -Common causes: + - Model auth not loaded on the **gateway host** (check `models status`). + - Channel pairing/allowlist blocking replies (check channel config + logs). + - WebChat/Dashboard is open without the right token. -- Model auth not loaded on the **gateway host** (check `models status`). -- Channel pairing/allowlist blocking replies (check channel config + logs). -- WebChat/Dashboard is open without the right token. + If you are remote, confirm the tunnel/Tailscale connection is up and that the + Gateway WebSocket is reachable. -If you are remote, confirm the tunnel/Tailscale connection is up and that the -Gateway WebSocket is reachable. + Docs: [Channels](/channels), [Troubleshooting](/gateway/troubleshooting), [Remote access](/gateway/remote). -Docs: [Channels](/channels), [Troubleshooting](/gateway/troubleshooting), [Remote access](/gateway/remote). + -### Disconnected from gateway no reason what now + + This usually means the UI lost the WebSocket connection. Check: -This usually means the UI lost the WebSocket connection. Check: + 1. Is the Gateway running? `openclaw gateway status` + 2. Is the Gateway healthy? `openclaw status` + 3. Does the UI have the right token? `openclaw dashboard` + 4. If remote, is the tunnel/Tailscale link up? -1. Is the Gateway running? `openclaw gateway status` -2. Is the Gateway healthy? `openclaw status` -3. Does the UI have the right token? `openclaw dashboard` -4. If remote, is the tunnel/Tailscale link up? + Then tail logs: -Then tail logs: + ```bash + openclaw logs --follow + ``` -```bash -openclaw logs --follow -``` + Docs: [Dashboard](/web/dashboard), [Remote access](/gateway/remote), [Troubleshooting](/gateway/troubleshooting). -Docs: [Dashboard](/web/dashboard), [Remote access](/gateway/remote), [Troubleshooting](/gateway/troubleshooting). + -### Telegram setMyCommands fails What should I check + + Start with logs and channel status: -Start with logs and channel status: + ```bash + openclaw channels status + openclaw channels logs --channel telegram + ``` -```bash -openclaw channels status -openclaw channels logs --channel telegram -``` + Then match the error: -Then match the error: + - `BOT_COMMANDS_TOO_MUCH`: the Telegram menu has too many entries. OpenClaw already trims to the Telegram limit and retries with fewer commands, but some menu entries still need to be dropped. Reduce plugin/skill/custom commands, or disable `channels.telegram.commands.native` if you do not need the menu. + - `TypeError: fetch failed`, `Network request for 'setMyCommands' failed!`, or similar network errors: if you are on a VPS or behind a proxy, confirm outbound HTTPS is allowed and DNS works for `api.telegram.org`. -- `BOT_COMMANDS_TOO_MUCH`: the Telegram menu has too many entries. OpenClaw already trims to the Telegram limit and retries with fewer commands, but some menu entries still need to be dropped. Reduce plugin/skill/custom commands, or disable `channels.telegram.commands.native` if you do not need the menu. -- `TypeError: fetch failed`, `Network request for 'setMyCommands' failed!`, or similar network errors: if you are on a VPS or behind a proxy, confirm outbound HTTPS is allowed and DNS works for `api.telegram.org`. + If the Gateway is remote, make sure you are looking at logs on the Gateway host. -If the Gateway is remote, make sure you are looking at logs on the Gateway host. + Docs: [Telegram](/channels/telegram), [Channel troubleshooting](/channels/troubleshooting). -Docs: [Telegram](/channels/telegram), [Channel troubleshooting](/channels/troubleshooting). + -### TUI shows no output What should I check + + First confirm the Gateway is reachable and the agent can run: -First confirm the Gateway is reachable and the agent can run: + ```bash + openclaw status + openclaw models status + openclaw logs --follow + ``` -```bash -openclaw status -openclaw models status -openclaw logs --follow -``` + In the TUI, use `/status` to see the current state. If you expect replies in a chat + channel, make sure delivery is enabled (`/deliver on`). -In the TUI, use `/status` to see the current state. If you expect replies in a chat -channel, make sure delivery is enabled (`/deliver on`). + Docs: [TUI](/web/tui), [Slash commands](/tools/slash-commands). -Docs: [TUI](/web/tui), [Slash commands](/tools/slash-commands). + -### How do I completely stop then start the Gateway + + If you installed the service: -If you installed the service: + ```bash + openclaw gateway stop + openclaw gateway start + ``` -```bash -openclaw gateway stop -openclaw gateway start -``` + This stops/starts the **supervised service** (launchd on macOS, systemd on Linux). + Use this when the Gateway runs in the background as a daemon. -This stops/starts the **supervised service** (launchd on macOS, systemd on Linux). -Use this when the Gateway runs in the background as a daemon. + If you're running in the foreground, stop with Ctrl-C, then: -If you're running in the foreground, stop with Ctrl-C, then: + ```bash + openclaw gateway run + ``` -```bash -openclaw gateway run -``` + Docs: [Gateway service runbook](/gateway). -Docs: [Gateway service runbook](/gateway). + -### ELI5 openclaw gateway restart vs openclaw gateway + + - `openclaw gateway restart`: restarts the **background service** (launchd/systemd). + - `openclaw gateway`: runs the gateway **in the foreground** for this terminal session. -- `openclaw gateway restart`: restarts the **background service** (launchd/systemd). -- `openclaw gateway`: runs the gateway **in the foreground** for this terminal session. + If you installed the service, use the gateway commands. Use `openclaw gateway` when + you want a one-off, foreground run. -If you installed the service, use the gateway commands. Use `openclaw gateway` when -you want a one-off, foreground run. + -### Fastest way to get more details when something fails - -Start the Gateway with `--verbose` to get more console detail. Then inspect the log file for channel auth, model routing, and RPC errors. + + Start the Gateway with `--verbose` to get more console detail. Then inspect the log file for channel auth, model routing, and RPC errors. + + ## Media and attachments -### My skill generated an imagePDF but nothing was sent + + + Outbound attachments from the agent must include a `MEDIA:` line (on its own line). See [OpenClaw assistant setup](/start/openclaw) and [Agent send](/tools/agent-send). -Outbound attachments from the agent must include a `MEDIA:` line (on its own line). See [OpenClaw assistant setup](/start/openclaw) and [Agent send](/tools/agent-send). + CLI sending: -CLI sending: + ```bash + openclaw message send --target +15555550123 --message "Here you go" --media /path/to/file.png + ``` -```bash -openclaw message send --target +15555550123 --message "Here you go" --media /path/to/file.png -``` + Also check: -Also check: + - The target channel supports outbound media and isn't blocked by allowlists. + - The file is within the provider's size limits (images are resized to max 2048px). -- The target channel supports outbound media and isn't blocked by allowlists. -- The file is within the provider's size limits (images are resized to max 2048px). + See [Images](/nodes/images). -See [Images](/nodes/images). + + ## Security and access control -### Is it safe to expose OpenClaw to inbound DMs + + + Treat inbound DMs as untrusted input. Defaults are designed to reduce risk: -Treat inbound DMs as untrusted input. Defaults are designed to reduce risk: + - Default behavior on DM-capable channels is **pairing**: + - Unknown senders receive a pairing code; the bot does not process their message. + - Approve with: `openclaw pairing approve --channel [--account ] ` + - Pending requests are capped at **3 per channel**; check `openclaw pairing list --channel [--account ]` if a code didn't arrive. + - Opening DMs publicly requires explicit opt-in (`dmPolicy: "open"` and allowlist `"*"`). -- Default behavior on DM-capable channels is **pairing**: - - Unknown senders receive a pairing code; the bot does not process their message. - - Approve with: `openclaw pairing approve --channel [--account ] ` - - Pending requests are capped at **3 per channel**; check `openclaw pairing list --channel [--account ]` if a code didn't arrive. -- Opening DMs publicly requires explicit opt-in (`dmPolicy: "open"` and allowlist `"*"`). + Run `openclaw doctor` to surface risky DM policies. -Run `openclaw doctor` to surface risky DM policies. + -### Is prompt injection only a concern for public bots + + No. Prompt injection is about **untrusted content**, not just who can DM the bot. + If your assistant reads external content (web search/fetch, browser pages, emails, + docs, attachments, pasted logs), that content can include instructions that try + to hijack the model. This can happen even if **you are the only sender**. -No. Prompt injection is about **untrusted content**, not just who can DM the bot. -If your assistant reads external content (web search/fetch, browser pages, emails, -docs, attachments, pasted logs), that content can include instructions that try -to hijack the model. This can happen even if **you are the only sender**. + The biggest risk is when tools are enabled: the model can be tricked into + exfiltrating context or calling tools on your behalf. Reduce the blast radius by: -The biggest risk is when tools are enabled: the model can be tricked into -exfiltrating context or calling tools on your behalf. Reduce the blast radius by: + - using a read-only or tool-disabled "reader" agent to summarize untrusted content + - keeping `web_search` / `web_fetch` / `browser` off for tool-enabled agents + - sandboxing and strict tool allowlists -- using a read-only or tool-disabled "reader" agent to summarize untrusted content -- keeping `web_search` / `web_fetch` / `browser` off for tool-enabled agents -- sandboxing and strict tool allowlists + Details: [Security](/gateway/security). -Details: [Security](/gateway/security). + -### Should my bot have its own email GitHub account or phone number + + Yes, for most setups. Isolating the bot with separate accounts and phone numbers + reduces the blast radius if something goes wrong. This also makes it easier to rotate + credentials or revoke access without impacting your personal accounts. -Yes, for most setups. Isolating the bot with separate accounts and phone numbers -reduces the blast radius if something goes wrong. This also makes it easier to rotate -credentials or revoke access without impacting your personal accounts. + Start small. Give access only to the tools and accounts you actually need, and expand + later if required. -Start small. Give access only to the tools and accounts you actually need, and expand -later if required. + Docs: [Security](/gateway/security), [Pairing](/channels/pairing). -Docs: [Security](/gateway/security), [Pairing](/channels/pairing). + -### Can I give it autonomy over my text messages and is that safe + + We do **not** recommend full autonomy over your personal messages. The safest pattern is: -We do **not** recommend full autonomy over your personal messages. The safest pattern is: + - Keep DMs in **pairing mode** or a tight allowlist. + - Use a **separate number or account** if you want it to message on your behalf. + - Let it draft, then **approve before sending**. -- Keep DMs in **pairing mode** or a tight allowlist. -- Use a **separate number or account** if you want it to message on your behalf. -- Let it draft, then **approve before sending**. + If you want to experiment, do it on a dedicated account and keep it isolated. See + [Security](/gateway/security). -If you want to experiment, do it on a dedicated account and keep it isolated. See -[Security](/gateway/security). + -### Can I use cheaper models for personal assistant tasks + + Yes, **if** the agent is chat-only and the input is trusted. Smaller tiers are + more susceptible to instruction hijacking, so avoid them for tool-enabled agents + or when reading untrusted content. If you must use a smaller model, lock down + tools and run inside a sandbox. See [Security](/gateway/security). + -Yes, **if** the agent is chat-only and the input is trusted. Smaller tiers are -more susceptible to instruction hijacking, so avoid them for tool-enabled agents -or when reading untrusted content. If you must use a smaller model, lock down -tools and run inside a sandbox. See [Security](/gateway/security). + + Pairing codes are sent **only** when an unknown sender messages the bot and + `dmPolicy: "pairing"` is enabled. `/start` by itself doesn't generate a code. -### I ran start in Telegram but did not get a pairing code + Check pending requests: -Pairing codes are sent **only** when an unknown sender messages the bot and -`dmPolicy: "pairing"` is enabled. `/start` by itself doesn't generate a code. + ```bash + openclaw pairing list telegram + ``` -Check pending requests: + If you want immediate access, allowlist your sender id or set `dmPolicy: "open"` + for that account. -```bash -openclaw pairing list telegram -``` + -If you want immediate access, allowlist your sender id or set `dmPolicy: "open"` -for that account. + + No. Default WhatsApp DM policy is **pairing**. Unknown senders only get a pairing code and their message is **not processed**. OpenClaw only replies to chats it receives or to explicit sends you trigger. -### WhatsApp will it message my contacts How does pairing work + Approve pairing with: -No. Default WhatsApp DM policy is **pairing**. Unknown senders only get a pairing code and their message is **not processed**. OpenClaw only replies to chats it receives or to explicit sends you trigger. + ```bash + openclaw pairing approve whatsapp + ``` -Approve pairing with: + List pending requests: -```bash -openclaw pairing approve whatsapp -``` + ```bash + openclaw pairing list whatsapp + ``` -List pending requests: + Wizard phone number prompt: it's used to set your **allowlist/owner** so your own DMs are permitted. It's not used for auto-sending. If you run on your personal WhatsApp number, use that number and enable `channels.whatsapp.selfChatMode`. -```bash -openclaw pairing list whatsapp -``` - -Wizard phone number prompt: it's used to set your **allowlist/owner** so your own DMs are permitted. It's not used for auto-sending. If you run on your personal WhatsApp number, use that number and enable `channels.whatsapp.selfChatMode`. + + ## Chat commands, aborting tasks, and "it will not stop" -### How do I stop internal system messages from showing in chat + + + Most internal or tool messages only appear when **verbose** or **reasoning** is enabled + for that session. -Most internal or tool messages only appear when **verbose** or **reasoning** is enabled -for that session. + Fix in the chat where you see it: -Fix in the chat where you see it: + ``` + /verbose off + /reasoning off + ``` -``` -/verbose off -/reasoning off -``` + If it is still noisy, check the session settings in the Control UI and set verbose + to **inherit**. Also confirm you are not using a bot profile with `verboseDefault` set + to `on` in config. -If it is still noisy, check the session settings in the Control UI and set verbose -to **inherit**. Also confirm you are not using a bot profile with `verboseDefault` set -to `on` in config. + Docs: [Thinking and verbose](/tools/thinking), [Security](/gateway/security#reasoning-verbose-output-in-groups). -Docs: [Thinking and verbose](/tools/thinking), [Security](/gateway/security#reasoning--verbose-output-in-groups). + -### How do I stopcancel a running task + + Send any of these **as a standalone message** (no slash): -Send any of these **as a standalone message** (no slash): + ``` + stop + stop action + stop current action + stop run + stop current run + stop agent + stop the agent + stop openclaw + openclaw stop + stop don't do anything + stop do not do anything + stop doing anything + please stop + stop please + abort + esc + wait + exit + interrupt + ``` -``` -stop -stop action -stop current action -stop run -stop current run -stop agent -stop the agent -stop openclaw -openclaw stop -stop don't do anything -stop do not do anything -stop doing anything -please stop -stop please -abort -esc -wait -exit -interrupt -``` + These are abort triggers (not slash commands). -These are abort triggers (not slash commands). + For background processes (from the exec tool), you can ask the agent to run: -For background processes (from the exec tool), you can ask the agent to run: + ``` + process action:kill sessionId:XXX + ``` -``` -process action:kill sessionId:XXX -``` + Slash commands overview: see [Slash commands](/tools/slash-commands). -Slash commands overview: see [Slash commands](/tools/slash-commands). + Most commands must be sent as a **standalone** message that starts with `/`, but a few shortcuts (like `/status`) also work inline for allowlisted senders. -Most commands must be sent as a **standalone** message that starts with `/`, but a few shortcuts (like `/status`) also work inline for allowlisted senders. + -### How do I send a Discord message from Telegram Crosscontext messaging denied + + OpenClaw blocks **cross-provider** messaging by default. If a tool call is bound + to Telegram, it won't send to Discord unless you explicitly allow it. -OpenClaw blocks **cross-provider** messaging by default. If a tool call is bound -to Telegram, it won't send to Discord unless you explicitly allow it. + Enable cross-provider messaging for the agent: -Enable cross-provider messaging for the agent: - -```json5 -{ - agents: { - defaults: { - tools: { - message: { - crossContext: { - allowAcrossProviders: true, - marker: { enabled: true, prefix: "[from {channel}] " }, + ```json5 + { + agents: { + defaults: { + tools: { + message: { + crossContext: { + allowAcrossProviders: true, + marker: { enabled: true, prefix: "[from {channel}] " }, + }, + }, }, }, }, - }, - }, -} -``` + } + ``` -Restart the gateway after editing config. If you only want this for a single -agent, set it under `agents.list[].tools.message` instead. + Restart the gateway after editing config. If you only want this for a single + agent, set it under `agents.list[].tools.message` instead. -### Why does it feel like the bot ignores rapidfire messages + -Queue mode controls how new messages interact with an in-flight run. Use `/queue` to change modes: + + Queue mode controls how new messages interact with an in-flight run. Use `/queue` to change modes: -- `steer` - new messages redirect the current task -- `followup` - run messages one at a time -- `collect` - batch messages and reply once (default) -- `steer-backlog` - steer now, then process backlog -- `interrupt` - abort current run and start fresh + - `steer` - new messages redirect the current task + - `followup` - run messages one at a time + - `collect` - batch messages and reply once (default) + - `steer-backlog` - steer now, then process backlog + - `interrupt` - abort current run and start fresh -You can add options like `debounce:2s cap:25 drop:summarize` for followup modes. + You can add options like `debounce:2s cap:25 drop:summarize` for followup modes. -## Answer the exact question from the screenshot/chat log + + -**Q: "What's the default model for Anthropic with an API key?"** +## Miscellaneous -**A:** In OpenClaw, credentials and model selection are separate. Setting `ANTHROPIC_API_KEY` (or storing an Anthropic API key in auth profiles) enables authentication, but the actual default model is whatever you configure in `agents.defaults.model.primary` (for example, `anthropic/claude-sonnet-4-5` or `anthropic/claude-opus-4-6`). If you see `No credentials found for profile "anthropic:default"`, it means the Gateway couldn't find Anthropic credentials in the expected `auth-profiles.json` for the agent that's running. + + + In OpenClaw, credentials and model selection are separate. Setting `ANTHROPIC_API_KEY` (or storing an Anthropic API key in auth profiles) enables authentication, but the actual default model is whatever you configure in `agents.defaults.model.primary` (for example, `anthropic/claude-sonnet-4-6` or `anthropic/claude-opus-4-6`). If you see `No credentials found for profile "anthropic:default"`, it means the Gateway couldn't find Anthropic credentials in the expected `auth-profiles.json` for the agent that's running. + + --- diff --git a/docs/help/index.md b/docs/help/index.md index 80aa5d304e8..26b990c1533 100644 --- a/docs/help/index.md +++ b/docs/help/index.md @@ -11,7 +11,7 @@ title: "Help" If you want a quick “get unstuck” flow, start here: - **Troubleshooting:** [Start here](/help/troubleshooting) -- **Install sanity (Node/npm/PATH):** [Install](/install#nodejs--npm-path-sanity) +- **Install sanity (Node/npm/PATH):** [Install](/install/node#troubleshooting) - **Gateway issues:** [Gateway troubleshooting](/gateway/troubleshooting) - **Logs:** [Logging](/logging) and [Gateway logging](/gateway/logging) - **Repairs:** [Doctor](/gateway/doctor) @@ -19,3 +19,10 @@ If you want a quick “get unstuck” flow, start here: If you’re looking for conceptual questions (not “something broke”): - [FAQ (concepts)](/help/faq) + +## Environment and debugging + +- **Environment variables:** [Where OpenClaw loads env vars and precedence](/help/environment) +- **Debugging:** [Watch mode, raw streams, and dev profile](/help/debugging) +- **Testing:** [Test suites, live tests, and Docker runners](/help/testing) +- **Scripts:** [Repository helper scripts](/help/scripts) diff --git a/docs/help/testing.md b/docs/help/testing.md index ee0a5b357a0..06cc31b185f 100644 --- a/docs/help/testing.md +++ b/docs/help/testing.md @@ -308,7 +308,7 @@ This is the “common models” run we expect to keep working: - OpenAI (non-Codex): `openai/gpt-5.2` (optional: `openai/gpt-5.1`) - OpenAI Codex: `openai-codex/gpt-5.4` -- Anthropic: `anthropic/claude-opus-4-6` (or `anthropic/claude-sonnet-4-5`) +- Anthropic: `anthropic/claude-opus-4-6` (or `anthropic/claude-sonnet-4-6`) - Google (Gemini API): `google/gemini-3.1-pro-preview` and `google/gemini-3-flash-preview` (avoid older Gemini 2.x models) - Google (Antigravity): `google-antigravity/claude-opus-4-6-thinking` and `google-antigravity/gemini-3-flash` - Z.AI (GLM): `zai/glm-4.7` @@ -322,7 +322,7 @@ Run gateway smoke with tools + image: Pick at least one per provider family: - OpenAI: `openai/gpt-5.2` (or `openai/gpt-5-mini`) -- Anthropic: `anthropic/claude-opus-4-6` (or `anthropic/claude-sonnet-4-5`) +- Anthropic: `anthropic/claude-opus-4-6` (or `anthropic/claude-sonnet-4-6`) - Google: `google/gemini-3-flash-preview` (or `google/gemini-3.1-pro-preview`) - Z.AI (GLM): `zai/glm-4.7` - MiniMax: `minimax/minimax-m2.5` diff --git a/docs/index.md b/docs/index.md index 25162bc9676..270f0835287 100644 --- a/docs/index.md +++ b/docs/index.md @@ -106,15 +106,19 @@ The Gateway is the single source of truth for sessions, routing, and channel con openclaw onboard --install-daemon ``` - + + Open the Control UI in your browser and send a message: + ```bash - openclaw channels login - openclaw gateway --port 18789 + openclaw dashboard ``` + + Or connect a channel ([Telegram](/channels/telegram) is fastest) and chat from your phone. + -Need the full install and dev setup? See [Quick start](/start/quickstart). +Need the full install and dev setup? See [Getting Started](/start/getting-started). ## Dashboard diff --git a/docs/install/ansible.md b/docs/install/ansible.md index d19383398d6..84ed56c5d03 100644 --- a/docs/install/ansible.md +++ b/docs/install/ansible.md @@ -9,7 +9,29 @@ title: "Ansible" # Ansible Installation -The recommended way to deploy OpenClaw to production servers is via **[openclaw-ansible](https://github.com/openclaw/openclaw-ansible)** — an automated installer with security-first architecture. +Deploy OpenClaw to production servers with **[openclaw-ansible](https://github.com/openclaw/openclaw-ansible)** -- an automated installer with security-first architecture. + + +The [openclaw-ansible](https://github.com/openclaw/openclaw-ansible) repo is the source of truth for Ansible deployment. This page is a quick overview. + + +## Prerequisites + +| Requirement | Details | +| ----------- | --------------------------------------------------------- | +| **OS** | Debian 11+ or Ubuntu 20.04+ | +| **Access** | Root or sudo privileges | +| **Network** | Internet connection for package installation | +| **Ansible** | 2.14+ (installed automatically by the quick-start script) | + +## What You Get + +- **Firewall-first security** -- UFW + Docker isolation (only SSH + Tailscale accessible) +- **Tailscale VPN** -- secure remote access without exposing services publicly +- **Docker** -- isolated sandbox containers, localhost-only bindings +- **Defense in depth** -- 4-layer security architecture +- **Systemd integration** -- auto-start on boot with hardening +- **One-command setup** -- complete deployment in minutes ## Quick Start @@ -19,55 +41,50 @@ One-command install: curl -fsSL https://raw.githubusercontent.com/openclaw/openclaw-ansible/main/install.sh | bash ``` -> **📦 Full guide: [github.com/openclaw/openclaw-ansible](https://github.com/openclaw/openclaw-ansible)** -> -> The openclaw-ansible repo is the source of truth for Ansible deployment. This page is a quick overview. - -## What You Get - -- 🔒 **Firewall-first security**: UFW + Docker isolation (only SSH + Tailscale accessible) -- 🔐 **Tailscale VPN**: Secure remote access without exposing services publicly -- 🐳 **Docker**: Isolated sandbox containers, localhost-only bindings -- 🛡️ **Defense in depth**: 4-layer security architecture -- 🚀 **One-command setup**: Complete deployment in minutes -- 🔧 **Systemd integration**: Auto-start on boot with hardening - -## Requirements - -- **OS**: Debian 11+ or Ubuntu 20.04+ -- **Access**: Root or sudo privileges -- **Network**: Internet connection for package installation -- **Ansible**: 2.14+ (installed automatically by quick-start script) - ## What Gets Installed The Ansible playbook installs and configures: -1. **Tailscale** (mesh VPN for secure remote access) -2. **UFW firewall** (SSH + Tailscale ports only) -3. **Docker CE + Compose V2** (for agent sandboxes) -4. **Node.js 24 + pnpm** (runtime dependencies; Node 22 LTS, currently `22.16+`, remains supported for compatibility) -5. **OpenClaw** (host-based, not containerized) -6. **Systemd service** (auto-start with security hardening) +1. **Tailscale** -- mesh VPN for secure remote access +2. **UFW firewall** -- SSH + Tailscale ports only +3. **Docker CE + Compose V2** -- for agent sandboxes +4. **Node.js 24 + pnpm** -- runtime dependencies (Node 22 LTS, currently `22.16+`, remains supported) +5. **OpenClaw** -- host-based, not containerized +6. **Systemd service** -- auto-start with security hardening -Note: The gateway runs **directly on the host** (not in Docker), but agent sandboxes use Docker for isolation. See [Sandboxing](/gateway/sandboxing) for details. + +The gateway runs directly on the host (not in Docker), but agent sandboxes use Docker for isolation. See [Sandboxing](/gateway/sandboxing) for details. + ## Post-Install Setup -After installation completes, switch to the openclaw user: + + + ```bash + sudo -i -u openclaw + ``` + + + The post-install script guides you through configuring OpenClaw settings. + + + Log in to WhatsApp, Telegram, Discord, or Signal: + ```bash + openclaw channels login + ``` + + + ```bash + sudo systemctl status openclaw + sudo journalctl -u openclaw -f + ``` + + + Join your VPN mesh for secure remote access. + + -```bash -sudo -i -u openclaw -``` - -The post-install script will guide you through: - -1. **Onboarding wizard**: Configure OpenClaw settings -2. **Provider login**: Connect WhatsApp/Telegram/Discord/Signal -3. **Gateway testing**: Verify the installation -4. **Tailscale setup**: Connect to your VPN mesh - -### Quick commands +### Quick Commands ```bash # Check service status @@ -86,115 +103,120 @@ openclaw channels login ## Security Architecture -### 4-Layer Defense +The deployment uses a 4-layer defense model: -1. **Firewall (UFW)**: Only SSH (22) + Tailscale (41641/udp) exposed publicly -2. **VPN (Tailscale)**: Gateway accessible only via VPN mesh -3. **Docker Isolation**: DOCKER-USER iptables chain prevents external port exposure -4. **Systemd Hardening**: NoNewPrivileges, PrivateTmp, unprivileged user +1. **Firewall (UFW)** -- only SSH (22) + Tailscale (41641/udp) exposed publicly +2. **VPN (Tailscale)** -- gateway accessible only via VPN mesh +3. **Docker isolation** -- DOCKER-USER iptables chain prevents external port exposure +4. **Systemd hardening** -- NoNewPrivileges, PrivateTmp, unprivileged user -### Verification - -Test external attack surface: +To verify your external attack surface: ```bash nmap -p- YOUR_SERVER_IP ``` -Should show **only port 22** (SSH) open. All other services (gateway, Docker) are locked down. +Only port 22 (SSH) should be open. All other services (gateway, Docker) are locked down. -### Docker Availability - -Docker is installed for **agent sandboxes** (isolated tool execution), not for running the gateway itself. The gateway binds to localhost only and is accessible via Tailscale VPN. - -See [Multi-Agent Sandbox & Tools](/tools/multi-agent-sandbox-tools) for sandbox configuration. +Docker is installed for agent sandboxes (isolated tool execution), not for running the gateway itself. See [Multi-Agent Sandbox and Tools](/tools/multi-agent-sandbox-tools) for sandbox configuration. ## Manual Installation If you prefer manual control over the automation: -```bash -# 1. Install prerequisites -sudo apt update && sudo apt install -y ansible git + + + ```bash + sudo apt update && sudo apt install -y ansible git + ``` + + + ```bash + git clone https://github.com/openclaw/openclaw-ansible.git + cd openclaw-ansible + ``` + + + ```bash + ansible-galaxy collection install -r requirements.yml + ``` + + + ```bash + ./run-playbook.sh + ``` -# 2. Clone repository -git clone https://github.com/openclaw/openclaw-ansible.git -cd openclaw-ansible + Alternatively, run directly and then manually execute the setup script afterward: + ```bash + ansible-playbook playbook.yml --ask-become-pass + # Then run: /tmp/openclaw-setup.sh + ``` -# 3. Install Ansible collections -ansible-galaxy collection install -r requirements.yml + + -# 4. Run playbook -./run-playbook.sh - -# Or run directly (then manually execute /tmp/openclaw-setup.sh after) -# ansible-playbook playbook.yml --ask-become-pass -``` - -## Updating OpenClaw +## Updating The Ansible installer sets up OpenClaw for manual updates. See [Updating](/install/updating) for the standard update flow. -To re-run the Ansible playbook (e.g., for configuration changes): +To re-run the Ansible playbook (for example, for configuration changes): ```bash cd openclaw-ansible ./run-playbook.sh ``` -Note: This is idempotent and safe to run multiple times. +This is idempotent and safe to run multiple times. ## Troubleshooting -### Firewall blocks my connection + + + - Ensure you can access via Tailscale VPN first + - SSH access (port 22) is always allowed + - The gateway is only accessible via Tailscale by design + + + ```bash + # Check logs + sudo journalctl -u openclaw -n 100 -If you're locked out: + # Verify permissions + sudo ls -la /opt/openclaw -- Ensure you can access via Tailscale VPN first -- SSH access (port 22) is always allowed -- The gateway is **only** accessible via Tailscale by design + # Test manual start + sudo -i -u openclaw + cd ~/openclaw + openclaw gateway run + ``` -### Service will not start + + + ```bash + # Verify Docker is running + sudo systemctl status docker -```bash -# Check logs -sudo journalctl -u openclaw -n 100 + # Check sandbox image + sudo docker images | grep openclaw-sandbox -# Verify permissions -sudo ls -la /opt/openclaw + # Build sandbox image if missing + cd /opt/openclaw/openclaw + sudo -u openclaw ./scripts/sandbox-setup.sh + ``` -# Test manual start -sudo -i -u openclaw -cd ~/openclaw -pnpm start -``` - -### Docker sandbox issues - -```bash -# Verify Docker is running -sudo systemctl status docker - -# Check sandbox image -sudo docker images | grep openclaw-sandbox - -# Build sandbox image if missing -cd /opt/openclaw/openclaw -sudo -u openclaw ./scripts/sandbox-setup.sh -``` - -### Provider login fails - -Make sure you're running as the `openclaw` user: - -```bash -sudo -i -u openclaw -openclaw channels login -``` + + + Make sure you are running as the `openclaw` user: + ```bash + sudo -i -u openclaw + openclaw channels login + ``` + + ## Advanced Configuration -For detailed security architecture and troubleshooting: +For detailed security architecture and troubleshooting, see the openclaw-ansible repo: - [Security Architecture](https://github.com/openclaw/openclaw-ansible/blob/main/docs/security.md) - [Technical Details](https://github.com/openclaw/openclaw-ansible/blob/main/docs/architecture.md) @@ -202,7 +224,7 @@ For detailed security architecture and troubleshooting: ## Related -- [openclaw-ansible](https://github.com/openclaw/openclaw-ansible) — full deployment guide -- [Docker](/install/docker) — containerized gateway setup -- [Sandboxing](/gateway/sandboxing) — agent sandbox configuration -- [Multi-Agent Sandbox & Tools](/tools/multi-agent-sandbox-tools) — per-agent isolation +- [openclaw-ansible](https://github.com/openclaw/openclaw-ansible) -- full deployment guide +- [Docker](/install/docker) -- containerized gateway setup +- [Sandboxing](/gateway/sandboxing) -- agent sandbox configuration +- [Multi-Agent Sandbox and Tools](/tools/multi-agent-sandbox-tools) -- per-agent isolation diff --git a/docs/install/azure.md b/docs/install/azure.md new file mode 100644 index 00000000000..615049ef937 --- /dev/null +++ b/docs/install/azure.md @@ -0,0 +1,178 @@ +--- +summary: "Run OpenClaw Gateway 24/7 on an Azure Linux VM with durable state" +read_when: + - You want OpenClaw running 24/7 on Azure with Network Security Group hardening + - You want a production-grade, always-on OpenClaw Gateway on your own Azure Linux VM + - You want secure administration with Azure Bastion SSH + - You want repeatable deployments with Azure Resource Manager templates +title: "Azure" +--- + +# OpenClaw on Azure Linux VM + +This guide sets up an Azure Linux VM, applies Network Security Group (NSG) hardening, configures Azure Bastion (managed Azure SSH entry point), and installs OpenClaw. + +## What you’ll do + +- Deploy Azure compute and network resources with Azure Resource Manager (ARM) templates +- Apply Azure Network Security Group (NSG) rules so VM SSH is allowed only from Azure Bastion +- Use Azure Bastion for SSH access +- Install OpenClaw with the installer script +- Verify the Gateway + +## Before you start + +You’ll need: + +- An Azure subscription with permission to create compute and network resources +- Azure CLI installed (see [Azure CLI install steps](https://learn.microsoft.com/cli/azure/install-azure-cli) if needed) + + + + ```bash + az login # Sign in and select your Azure subscription + az extension add -n ssh # Extension required for Azure Bastion SSH management + ``` + + + + ```bash + az provider register --namespace Microsoft.Compute + az provider register --namespace Microsoft.Network + ``` + + Verify Azure resource provider registration. Wait until both show `Registered`. + + ```bash + az provider show --namespace Microsoft.Compute --query registrationState -o tsv + az provider show --namespace Microsoft.Network --query registrationState -o tsv + ``` + + + + + ```bash + RG="rg-openclaw" + LOCATION="westus2" + TEMPLATE_URI="https://raw.githubusercontent.com/openclaw/openclaw/main/infra/azure/templates/azuredeploy.json" + PARAMS_URI="https://raw.githubusercontent.com/openclaw/openclaw/main/infra/azure/templates/azuredeploy.parameters.json" + ``` + + + + Use your existing public key if you have one: + + ```bash + SSH_PUB_KEY="$(cat ~/.ssh/id_ed25519.pub)" + ``` + + If you don’t have an SSH key yet, run the following: + + ```bash + ssh-keygen -t ed25519 -a 100 -f ~/.ssh/id_ed25519 -C "you@example.com" + SSH_PUB_KEY="$(cat ~/.ssh/id_ed25519.pub)" + ``` + + + + + Set VM and disk sizing variables: + + ```bash + VM_SIZE="Standard_B2as_v2" + OS_DISK_SIZE_GB=64 + ``` + + Choose a VM size and OS disk size that are available in your Azure subscription/region and matches your workload: + + - Start smaller for light usage and scale up later + - Use more vCPU/RAM/OS disk size for heavier automation, more channels, or larger model/tool workloads + - If a VM size is unavailable in your region or subscription quota, pick the closest available SKU + + List VM sizes available in your target region: + + ```bash + az vm list-skus --location "${LOCATION}" --resource-type virtualMachines -o table + ``` + + Check your current VM vCPU and OS disk size usage/quota: + + ```bash + az vm list-usage --location "${LOCATION}" -o table + ``` + + + + + ```bash + az group create -n "${RG}" -l "${LOCATION}" + ``` + + + + This command applies your selected SSH key, VM size, and OS disk size. + + ```bash + az deployment group create \ + -g "${RG}" \ + --template-uri "${TEMPLATE_URI}" \ + --parameters "${PARAMS_URI}" \ + --parameters location="${LOCATION}" \ + --parameters vmSize="${VM_SIZE}" \ + --parameters osDiskSizeGb="${OS_DISK_SIZE_GB}" \ + --parameters sshPublicKey="${SSH_PUB_KEY}" + ``` + + + + + ```bash + RG="rg-openclaw" + VM_NAME="vm-openclaw" + BASTION_NAME="bas-openclaw" + ADMIN_USERNAME="openclaw" + VM_ID="$(az vm show -g "${RG}" -n "${VM_NAME}" --query id -o tsv)" + + az network bastion ssh \ + --name "${BASTION_NAME}" \ + --resource-group "${RG}" \ + --target-resource-id "${VM_ID}" \ + --auth-type ssh-key \ + --username "${ADMIN_USERNAME}" \ + --ssh-key ~/.ssh/id_ed25519 + ``` + + + + + ```bash + curl -fsSL https://openclaw.ai/install.sh -o /tmp/openclaw-install.sh + bash /tmp/openclaw-install.sh + rm -f /tmp/openclaw-install.sh + openclaw --version + ``` + + The installer script handles Node detection/installation and runs onboarding by default. + + + + + After onboarding completes: + + ```bash + openclaw gateway status + ``` + + Most enterprise Azure teams already have GitHub Copilot licenses. If that is your case, we recommend choosing the GitHub Copilot provider in the OpenClaw onboarding wizard. See [GitHub Copilot provider](/providers/github-copilot). + + The included ARM template uses Ubuntu image `version: "latest"` for convenience. If you need reproducible builds, pin a specific image version in `infra/azure/templates/azuredeploy.json` (you can list versions with `az vm image list --publisher Canonical --offer ubuntu-24_04-lts --sku server --all -o table`). + + + + +## Next steps + +- Set up messaging channels: [Channels](/channels) +- Pair local devices as nodes: [Nodes](/nodes) +- Configure the Gateway: [Gateway configuration](/gateway/configuration) +- For more details on OpenClaw Azure deployment with the GitHub Copilot model provider: [OpenClaw on Azure with GitHub Copilot](https://github.com/johnsonshi/openclaw-azure-github-copilot) diff --git a/docs/install/bun.md b/docs/install/bun.md index 5cbe76ce3ac..080479fc6b0 100644 --- a/docs/install/bun.md +++ b/docs/install/bun.md @@ -6,49 +6,45 @@ read_when: title: "Bun (Experimental)" --- -# Bun (experimental) +# Bun (Experimental) -Goal: run this repo with **Bun** (optional, not recommended for WhatsApp/Telegram) -without diverging from pnpm workflows. + +Bun is **not recommended for gateway runtime** (known issues with WhatsApp and Telegram). Use Node for production. + -⚠️ **Not recommended for Gateway runtime** (WhatsApp/Telegram bugs). Use Node for production. - -## Status - -- Bun is an optional local runtime for running TypeScript directly (`bun run …`, `bun --watch …`). -- `pnpm` is the default for builds and remains fully supported (and used by some docs tooling). -- Bun cannot use `pnpm-lock.yaml` and will ignore it. +Bun is an optional local runtime for running TypeScript directly (`bun run ...`, `bun --watch ...`). The default package manager remains `pnpm`, which is fully supported and used by docs tooling. Bun cannot use `pnpm-lock.yaml` and will ignore it. ## Install -Default: + + + ```sh + bun install + ``` -```sh -bun install -``` + `bun.lock` / `bun.lockb` are gitignored, so there is no repo churn. To skip lockfile writes entirely: -Note: `bun.lock`/`bun.lockb` are gitignored, so there’s no repo churn either way. If you want _no lockfile writes_: + ```sh + bun install --no-save + ``` -```sh -bun install --no-save -``` + + + ```sh + bun run build + bun run vitest run + ``` + + -## Build / Test (Bun) +## Lifecycle Scripts -```sh -bun run build -bun run vitest run -``` +Bun blocks dependency lifecycle scripts unless explicitly trusted. For this repo, the commonly blocked scripts are not required: -## Bun lifecycle scripts (blocked by default) +- `@whiskeysockets/baileys` `preinstall` -- checks Node major >= 20 (OpenClaw defaults to Node 24 and still supports Node 22 LTS, currently `22.16+`) +- `protobufjs` `postinstall` -- emits warnings about incompatible version schemes (no build artifacts) -Bun may block dependency lifecycle scripts unless explicitly trusted (`bun pm untrusted` / `bun pm trust`). -For this repo, the commonly blocked scripts are not required: - -- `@whiskeysockets/baileys` `preinstall`: checks Node major >= 20 (OpenClaw defaults to Node 24 and still supports Node 22 LTS, currently `22.16+`). -- `protobufjs` `postinstall`: emits warnings about incompatible version schemes (no build artifacts). - -If you hit a real runtime issue that requires these scripts, trust them explicitly: +If you hit a runtime issue that requires these scripts, trust them explicitly: ```sh bun pm trust @whiskeysockets/baileys protobufjs @@ -56,4 +52,4 @@ bun pm trust @whiskeysockets/baileys protobufjs ## Caveats -- Some scripts still hardcode pnpm (e.g. `docs:build`, `ui:*`, `protocol:check`). Run those via pnpm for now. +Some scripts still hardcode pnpm (for example `docs:build`, `ui:*`, `protocol:check`). Run those via pnpm for now. diff --git a/docs/install/development-channels.md b/docs/install/development-channels.md index d5eab403ce3..9a716b18dbe 100644 --- a/docs/install/development-channels.md +++ b/docs/install/development-channels.md @@ -4,7 +4,8 @@ read_when: - You want to switch between stable/beta/dev - You want to pin a specific version, tag, or SHA - You are tagging or publishing prereleases -title: "Development Channels" +title: "Release Channels" +sidebarTitle: "Release Channels" --- # Development channels diff --git a/docs/install/digitalocean.md b/docs/install/digitalocean.md new file mode 100644 index 00000000000..92b2efc1e2d --- /dev/null +++ b/docs/install/digitalocean.md @@ -0,0 +1,129 @@ +--- +summary: "Host OpenClaw on a DigitalOcean Droplet" +read_when: + - Setting up OpenClaw on DigitalOcean + - Looking for a simple paid VPS for OpenClaw +title: "DigitalOcean" +--- + +# DigitalOcean + +Run a persistent OpenClaw Gateway on a DigitalOcean Droplet. + +## Prerequisites + +- DigitalOcean account ([signup](https://cloud.digitalocean.com/registrations/new)) +- SSH key pair (or willingness to use password auth) +- About 20 minutes + +## Setup + + + + + Use a clean base image (Ubuntu 24.04 LTS). Avoid third-party Marketplace 1-click images unless you have reviewed their startup scripts and firewall defaults. + + + 1. Log into [DigitalOcean](https://cloud.digitalocean.com/). + 2. Click **Create > Droplets**. + 3. Choose: + - **Region:** Closest to you + - **Image:** Ubuntu 24.04 LTS + - **Size:** Basic, Regular, 1 vCPU / 1 GB RAM / 25 GB SSD + - **Authentication:** SSH key (recommended) or password + 4. Click **Create Droplet** and note the IP address. + + + + + ```bash + ssh root@YOUR_DROPLET_IP + + apt update && apt upgrade -y + + # Install Node.js 24 + curl -fsSL https://deb.nodesource.com/setup_24.x | bash - + apt install -y nodejs + + # Install OpenClaw + curl -fsSL https://openclaw.ai/install.sh | bash + openclaw --version + ``` + + + + + ```bash + openclaw onboard --install-daemon + ``` + + The wizard walks you through model auth, channel setup, gateway token generation, and daemon installation (systemd). + + + + + ```bash + fallocate -l 2G /swapfile + chmod 600 /swapfile + mkswap /swapfile + swapon /swapfile + echo '/swapfile none swap sw 0 0' >> /etc/fstab + ``` + + + + ```bash + openclaw status + systemctl --user status openclaw-gateway.service + journalctl --user -u openclaw-gateway.service -f + ``` + + + + The gateway binds to loopback by default. Pick one of these options. + + **Option A: SSH tunnel (simplest)** + + ```bash + # From your local machine + ssh -L 18789:localhost:18789 root@YOUR_DROPLET_IP + ``` + + Then open `http://localhost:18789`. + + **Option B: Tailscale Serve** + + ```bash + curl -fsSL https://tailscale.com/install.sh | sh + tailscale up + openclaw config set gateway.tailscale.mode serve + openclaw gateway restart + ``` + + Then open `https:///` from any device on your tailnet. + + **Option C: Tailnet bind (no Serve)** + + ```bash + openclaw config set gateway.bind tailnet + openclaw gateway restart + ``` + + Then open `http://:18789` (token required). + + + + +## Troubleshooting + +**Gateway will not start** -- Run `openclaw doctor --non-interactive` and check logs with `journalctl --user -u openclaw-gateway.service -n 50`. + +**Port already in use** -- Run `lsof -i :18789` to find the process, then stop it. + +**Out of memory** -- Verify swap is active with `free -h`. If still hitting OOM, use API-based models (Claude, GPT) rather than local models, or upgrade to a 2 GB Droplet. + +## Next steps + +- [Channels](/channels) -- connect Telegram, WhatsApp, Discord, and more +- [Gateway configuration](/gateway/configuration) -- all config options +- [Updating](/install/updating) -- keep OpenClaw up to date diff --git a/docs/install/docker-vm-runtime.md b/docs/install/docker-vm-runtime.md index 77436f44486..3fba137c67f 100644 --- a/docs/install/docker-vm-runtime.md +++ b/docs/install/docker-vm-runtime.md @@ -71,6 +71,10 @@ ENV NODE_ENV=production CMD ["node","dist/index.js"] ``` + +The download URLs above are for x86_64 (amd64). For ARM-based VMs (e.g. Hetzner ARM, GCP Tau T2A), replace the download URLs with the appropriate ARM64 variants from each tool's release page. + + ## Build and launch ```bash diff --git a/docs/install/docker.md b/docs/install/docker.md index f4913a5138a..ce78993e737 100644 --- a/docs/install/docker.md +++ b/docs/install/docker.md @@ -13,215 +13,84 @@ Docker is **optional**. Use it only if you want a containerized gateway or to va ## Is Docker right for me? - **Yes**: you want an isolated, throwaway gateway environment or to run OpenClaw on a host without local installs. -- **No**: you’re running on your own machine and just want the fastest dev loop. Use the normal install flow instead. +- **No**: you are running on your own machine and just want the fastest dev loop. Use the normal install flow instead. - **Sandboxing note**: agent sandboxing uses Docker too, but it does **not** require the full gateway to run in Docker. See [Sandboxing](/gateway/sandboxing). -This guide covers: - -- Containerized Gateway (full OpenClaw in Docker) -- Per-session Agent Sandbox (host gateway + Docker-isolated agent tools) - -Sandboxing details: [Sandboxing](/gateway/sandboxing) - -## Requirements +## Prerequisites - Docker Desktop (or Docker Engine) + Docker Compose v2 - At least 2 GB RAM for image build (`pnpm install` may be OOM-killed on 1 GB hosts with exit 137) -- Enough disk for images + logs +- Enough disk for images and logs - If running on a VPS/public host, review - [Security hardening for network exposure](/gateway/security#04-network-exposure-bind--port--firewall), + [Security hardening for network exposure](/gateway/security#0-4-network-exposure-bind-port-firewall), especially Docker `DOCKER-USER` firewall policy. -## Containerized Gateway (Docker Compose) +## Containerized Gateway -### Quick start (recommended) + + + From the repo root, run the setup script: - -Docker defaults here assume bind modes (`lan`/`loopback`), not host aliases. Use bind -mode values in `gateway.bind` (for example `lan` or `loopback`), not host aliases like -`0.0.0.0` or `localhost`. - + ```bash + ./scripts/docker/setup.sh + ``` -From repo root: + This builds the gateway image locally. To use a pre-built image instead: -```bash -./docker-setup.sh -``` + ```bash + export OPENCLAW_IMAGE="ghcr.io/openclaw/openclaw:latest" + ./scripts/docker/setup.sh + ``` -This script: + Pre-built images are published at the + [GitHub Container Registry](https://github.com/openclaw/openclaw/pkgs/container/openclaw). + Common tags: `main`, `latest`, `` (e.g. `2026.2.26`). -- builds the gateway image locally (or pulls a remote image if `OPENCLAW_IMAGE` is set) -- runs onboarding -- prints optional provider setup hints -- starts the gateway via Docker Compose -- generates a gateway token and writes it to `.env` + -Optional env vars: + + The setup script runs onboarding automatically. It will: -- `OPENCLAW_IMAGE` — use a remote image instead of building locally (e.g. `ghcr.io/openclaw/openclaw:latest`) -- `OPENCLAW_DOCKER_APT_PACKAGES` — install extra apt packages during build -- `OPENCLAW_EXTENSIONS` — pre-install extension dependencies at build time (space-separated extension names, e.g. `diagnostics-otel matrix`) -- `OPENCLAW_EXTRA_MOUNTS` — add extra host bind mounts -- `OPENCLAW_HOME_VOLUME` — persist `/home/node` in a named volume -- `OPENCLAW_SANDBOX` — opt in to Docker gateway sandbox bootstrap. Only explicit truthy values enable it: `1`, `true`, `yes`, `on` -- `OPENCLAW_INSTALL_DOCKER_CLI` — build arg passthrough for local image builds (`1` installs Docker CLI in the image). `docker-setup.sh` sets this automatically when `OPENCLAW_SANDBOX=1` for local builds. -- `OPENCLAW_DOCKER_SOCKET` — override Docker socket path (default: `DOCKER_HOST=unix://...` path, else `/var/run/docker.sock`) -- `OPENCLAW_ALLOW_INSECURE_PRIVATE_WS=1` — break-glass: allow trusted private-network - `ws://` targets for CLI/onboarding client paths (default is loopback-only) -- `OPENCLAW_BROWSER_DISABLE_GRAPHICS_FLAGS=0` — disable container browser hardening flags - `--disable-3d-apis`, `--disable-software-rasterizer`, `--disable-gpu` when you need - WebGL/3D compatibility. -- `OPENCLAW_BROWSER_DISABLE_EXTENSIONS=0` — keep extensions enabled when browser - flows require them (default keeps extensions disabled in sandbox browser). -- `OPENCLAW_BROWSER_RENDERER_PROCESS_LIMIT=` — set Chromium renderer process - limit; set to `0` to skip the flag and use Chromium default behavior. + - prompt for provider API keys + - generate a gateway token and write it to `.env` + - start the gateway via Docker Compose -After it finishes: + -- Open `http://127.0.0.1:18789/` in your browser. -- Paste the token into the Control UI (Settings → token). -- Need the URL again? Run `docker compose run --rm openclaw-cli dashboard --no-open`. + + Open `http://127.0.0.1:18789/` in your browser and paste the token into + Settings. -### Enable agent sandbox for Docker gateway (opt-in) + Need the URL again? -`docker-setup.sh` can also bootstrap `agents.defaults.sandbox.*` for Docker -deployments. + ```bash + docker compose run --rm openclaw-cli dashboard --no-open + ``` -Enable with: + -```bash -export OPENCLAW_SANDBOX=1 -./docker-setup.sh -``` + + Use the CLI container to add messaging channels: -Custom socket path (for example rootless Docker): + ```bash + # WhatsApp (QR) + docker compose run --rm openclaw-cli channels login -```bash -export OPENCLAW_SANDBOX=1 -export OPENCLAW_DOCKER_SOCKET=/run/user/1000/docker.sock -./docker-setup.sh -``` + # Telegram + docker compose run --rm openclaw-cli channels add --channel telegram --token "" -Notes: + # Discord + docker compose run --rm openclaw-cli channels add --channel discord --token "" + ``` -- The script mounts `docker.sock` only after sandbox prerequisites pass. -- If sandbox setup cannot be completed, the script resets - `agents.defaults.sandbox.mode` to `off` to avoid stale/broken sandbox config - on reruns. -- If `Dockerfile.sandbox` is missing, the script prints a warning and continues; - build `openclaw-sandbox:bookworm-slim` with `scripts/sandbox-setup.sh` if - needed. -- For non-local `OPENCLAW_IMAGE` values, the image must already contain Docker - CLI support for sandbox execution. + Docs: [WhatsApp](/channels/whatsapp), [Telegram](/channels/telegram), [Discord](/channels/discord) -### Automation/CI (non-interactive, no TTY noise) + + -For scripts and CI, disable Compose pseudo-TTY allocation with `-T`: +### Manual flow -```bash -docker compose run -T --rm openclaw-cli gateway probe -docker compose run -T --rm openclaw-cli devices list --json -``` - -If your automation exports no Claude session vars, leaving them unset now resolves to -empty values by default in `docker-compose.yml` to avoid repeated "variable is not set" -warnings. - -### Shared-network security note (CLI + gateway) - -`openclaw-cli` uses `network_mode: "service:openclaw-gateway"` so CLI commands can -reliably reach the gateway over `127.0.0.1` in Docker. - -Treat this as a shared trust boundary: loopback binding is not isolation between these two -containers. If you need stronger separation, run commands from a separate container/host -network path instead of the bundled `openclaw-cli` service. - -To reduce impact if the CLI process is compromised, the compose config drops -`NET_RAW`/`NET_ADMIN` and enables `no-new-privileges` on `openclaw-cli`. - -It writes config/workspace on the host: - -- `~/.openclaw/` -- `~/.openclaw/workspace` - -Running on a VPS? See [Hetzner (Docker VPS)](/install/hetzner). - -### Use a remote image (skip local build) - -Official pre-built images are published at: - -- [GitHub Container Registry package](https://github.com/openclaw/openclaw/pkgs/container/openclaw) - -Use image name `ghcr.io/openclaw/openclaw` (not similarly named Docker Hub -images). - -Common tags: - -- `main` — latest build from `main` -- `` — release tag builds (for example `2026.2.26`) -- `latest` — latest stable release tag - -### Base image metadata - -The main Docker image currently uses: - -- `node:24-bookworm` - -The docker image now publishes OCI base-image annotations (sha256 is an example, -and points at the pinned multi-arch manifest list for that tag): - -- `org.opencontainers.image.base.name=docker.io/library/node:24-bookworm` -- `org.opencontainers.image.base.digest=sha256:3a09aa6354567619221ef6c45a5051b671f953f0a1924d1f819ffb236e520e6b` -- `org.opencontainers.image.source=https://github.com/openclaw/openclaw` -- `org.opencontainers.image.url=https://openclaw.ai` -- `org.opencontainers.image.documentation=https://docs.openclaw.ai/install/docker` -- `org.opencontainers.image.licenses=MIT` -- `org.opencontainers.image.title=OpenClaw` -- `org.opencontainers.image.description=OpenClaw gateway and CLI runtime container image` -- `org.opencontainers.image.revision=` -- `org.opencontainers.image.version=` -- `org.opencontainers.image.created=` - -Reference: [OCI image annotations](https://github.com/opencontainers/image-spec/blob/main/annotations.md) - -Release context: this repository's tagged history already uses Bookworm in -`v2026.2.22` and earlier 2026 tags (for example `v2026.2.21`, `v2026.2.9`). - -By default the setup script builds the image from source. To pull a pre-built -image instead, set `OPENCLAW_IMAGE` before running the script: - -```bash -export OPENCLAW_IMAGE="ghcr.io/openclaw/openclaw:latest" -./docker-setup.sh -``` - -The script detects that `OPENCLAW_IMAGE` is not the default `openclaw:local` and -runs `docker pull` instead of `docker build`. Everything else (onboarding, -gateway start, token generation) works the same way. - -`docker-setup.sh` still runs from the repository root because it uses the local -`docker-compose.yml` and helper files. `OPENCLAW_IMAGE` skips local image build -time; it does not replace the compose/setup workflow. - -### Shell Helpers (optional) - -For easier day-to-day Docker management, install `ClawDock`: - -```bash -mkdir -p ~/.clawdock && curl -sL https://raw.githubusercontent.com/openclaw/openclaw/main/scripts/shell-helpers/clawdock-helpers.sh -o ~/.clawdock/clawdock-helpers.sh -``` - -**Add to your shell config (zsh):** - -```bash -echo 'source ~/.clawdock/clawdock-helpers.sh' >> ~/.zshrc && source ~/.zshrc -``` - -Then use `clawdock-start`, `clawdock-stop`, `clawdock-dashboard`, etc. Run `clawdock-help` for all commands. - -See [`ClawDock` Helper README](https://github.com/openclaw/openclaw/blob/main/scripts/shell-helpers/README.md) for details. - -### Manual flow (compose) +If you prefer to run each step yourself instead of using the setup script: ```bash docker build -t openclaw:local -f Dockerfile . @@ -229,378 +98,212 @@ docker compose run --rm openclaw-cli onboard docker compose up -d openclaw-gateway ``` -Note: run `docker compose ...` from the repo root. If you enabled -`OPENCLAW_EXTRA_MOUNTS` or `OPENCLAW_HOME_VOLUME`, the setup script writes -`docker-compose.extra.yml`; include it when running Compose elsewhere: - -```bash -docker compose -f docker-compose.yml -f docker-compose.extra.yml -``` - -### Control UI token + pairing (Docker) - -If you see “unauthorized” or “disconnected (1008): pairing required”, fetch a -fresh dashboard link and approve the browser device: - -```bash -docker compose run --rm openclaw-cli dashboard --no-open -docker compose run --rm openclaw-cli devices list -docker compose run --rm openclaw-cli devices approve -``` - -More detail: [Dashboard](/web/dashboard), [Devices](/cli/devices). - -### Extra mounts (optional) - -If you want to mount additional host directories into the containers, set -`OPENCLAW_EXTRA_MOUNTS` before running `docker-setup.sh`. This accepts a -comma-separated list of Docker bind mounts and applies them to both -`openclaw-gateway` and `openclaw-cli` by generating `docker-compose.extra.yml`. - -Example: - -```bash -export OPENCLAW_EXTRA_MOUNTS="$HOME/.codex:/home/node/.codex:ro,$HOME/github:/home/node/github:rw" -./docker-setup.sh -``` - -Notes: - -- Paths must be shared with Docker Desktop on macOS/Windows. -- Each entry must be `source:target[:options]` with no spaces, tabs, or newlines. -- If you edit `OPENCLAW_EXTRA_MOUNTS`, rerun `docker-setup.sh` to regenerate the - extra compose file. -- `docker-compose.extra.yml` is generated. Don’t hand-edit it. - -### Persist the entire container home (optional) - -If you want `/home/node` to persist across container recreation, set a named -volume via `OPENCLAW_HOME_VOLUME`. This creates a Docker volume and mounts it at -`/home/node`, while keeping the standard config/workspace bind mounts. Use a -named volume here (not a bind path); for bind mounts, use -`OPENCLAW_EXTRA_MOUNTS`. - -Example: - -```bash -export OPENCLAW_HOME_VOLUME="openclaw_home" -./docker-setup.sh -``` - -You can combine this with extra mounts: - -```bash -export OPENCLAW_HOME_VOLUME="openclaw_home" -export OPENCLAW_EXTRA_MOUNTS="$HOME/.codex:/home/node/.codex:ro,$HOME/github:/home/node/github:rw" -./docker-setup.sh -``` - -Notes: - -- Named volumes must match `^[A-Za-z0-9][A-Za-z0-9_.-]*$`. -- If you change `OPENCLAW_HOME_VOLUME`, rerun `docker-setup.sh` to regenerate the - extra compose file. -- The named volume persists until removed with `docker volume rm `. - -### Install extra apt packages (optional) - -If you need system packages inside the image (for example, build tools or media -libraries), set `OPENCLAW_DOCKER_APT_PACKAGES` before running `docker-setup.sh`. -This installs the packages during the image build, so they persist even if the -container is deleted. - -Example: - -```bash -export OPENCLAW_DOCKER_APT_PACKAGES="ffmpeg build-essential" -./docker-setup.sh -``` - -Notes: - -- This accepts a space-separated list of apt package names. -- If you change `OPENCLAW_DOCKER_APT_PACKAGES`, rerun `docker-setup.sh` to rebuild - the image. - -### Pre-install extension dependencies (optional) - -Extensions with their own `package.json` (e.g. `diagnostics-otel`, `matrix`, -`msteams`) install their npm dependencies on first load. To bake those -dependencies into the image instead, set `OPENCLAW_EXTENSIONS` before -running `docker-setup.sh`: - -```bash -export OPENCLAW_EXTENSIONS="diagnostics-otel matrix" -./docker-setup.sh -``` - -Or when building directly: - -```bash -docker build --build-arg OPENCLAW_EXTENSIONS="diagnostics-otel matrix" . -``` - -Notes: - -- This accepts a space-separated list of extension directory names (under `extensions/`). -- Only extensions with a `package.json` are affected; lightweight plugins without one are ignored. -- If you change `OPENCLAW_EXTENSIONS`, rerun `docker-setup.sh` to rebuild - the image. - -### Power-user / full-featured container (opt-in) - -The default Docker image is **security-first** and runs as the non-root `node` -user. This keeps the attack surface small, but it means: - -- no system package installs at runtime -- no Homebrew by default -- no bundled Chromium/Playwright browsers - -If you want a more full-featured container, use these opt-in knobs: - -1. **Persist `/home/node`** so browser downloads and tool caches survive: - -```bash -export OPENCLAW_HOME_VOLUME="openclaw_home" -./docker-setup.sh -``` - -2. **Bake system deps into the image** (repeatable + persistent): - -```bash -export OPENCLAW_DOCKER_APT_PACKAGES="git curl jq" -./docker-setup.sh -``` - -3. **Install Playwright browsers without `npx`** (avoids npm override conflicts): - -```bash -docker compose run --rm openclaw-cli \ - node /app/node_modules/playwright-core/cli.js install chromium -``` - -If you need Playwright to install system deps, rebuild the image with -`OPENCLAW_DOCKER_APT_PACKAGES` instead of using `--with-deps` at runtime. - -4. **Persist Playwright browser downloads**: - -- Set `PLAYWRIGHT_BROWSERS_PATH=/home/node/.cache/ms-playwright` in - `docker-compose.yml`. -- Ensure `/home/node` persists via `OPENCLAW_HOME_VOLUME`, or mount - `/home/node/.cache/ms-playwright` via `OPENCLAW_EXTRA_MOUNTS`. - -### Permissions + EACCES - -The image runs as `node` (uid 1000). If you see permission errors on -`/home/node/.openclaw`, make sure your host bind mounts are owned by uid 1000. - -Example (Linux host): - -```bash -sudo chown -R 1000:1000 /path/to/openclaw-config /path/to/openclaw-workspace -``` - -If you choose to run as root for convenience, you accept the security tradeoff. - -### Faster rebuilds (recommended) - -To speed up rebuilds, order your Dockerfile so dependency layers are cached. -This avoids re-running `pnpm install` unless lockfiles change: - -```dockerfile -FROM node:24-bookworm - -# Install Bun (required for build scripts) -RUN curl -fsSL https://bun.sh/install | bash -ENV PATH="/root/.bun/bin:${PATH}" - -RUN corepack enable - -WORKDIR /app - -# Cache dependencies unless package metadata changes -COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./ -COPY ui/package.json ./ui/package.json -COPY scripts ./scripts - -RUN pnpm install --frozen-lockfile - -COPY . . -RUN pnpm build -RUN pnpm ui:install -RUN pnpm ui:build - -ENV NODE_ENV=production - -CMD ["node","dist/index.js"] -``` - -### Channel setup (optional) - -Use the CLI container to configure channels, then restart the gateway if needed. - -WhatsApp (QR): - -```bash -docker compose run --rm openclaw-cli channels login -``` - -Telegram (bot token): - -```bash -docker compose run --rm openclaw-cli channels add --channel telegram --token "" -``` - -Discord (bot token): - -```bash -docker compose run --rm openclaw-cli channels add --channel discord --token "" -``` - -Docs: [WhatsApp](/channels/whatsapp), [Telegram](/channels/telegram), [Discord](/channels/discord) - -### OpenAI Codex OAuth (headless Docker) - -If you pick OpenAI Codex OAuth in the wizard, it opens a browser URL and tries -to capture a callback on `http://127.0.0.1:1455/auth/callback`. In Docker or -headless setups that callback can show a browser error. Copy the full redirect -URL you land on and paste it back into the wizard to finish auth. + +Run `docker compose` from the repo root. If you enabled `OPENCLAW_EXTRA_MOUNTS` +or `OPENCLAW_HOME_VOLUME`, the setup script writes `docker-compose.extra.yml`; +include it with `-f docker-compose.yml -f docker-compose.extra.yml`. + + +### Environment variables + +The setup script accepts these optional environment variables: + +| Variable | Purpose | +| ------------------------------ | ---------------------------------------------------------------- | +| `OPENCLAW_IMAGE` | Use a remote image instead of building locally | +| `OPENCLAW_DOCKER_APT_PACKAGES` | Install extra apt packages during build (space-separated) | +| `OPENCLAW_EXTENSIONS` | Pre-install extension deps at build time (space-separated names) | +| `OPENCLAW_EXTRA_MOUNTS` | Extra host bind mounts (comma-separated `source:target[:opts]`) | +| `OPENCLAW_HOME_VOLUME` | Persist `/home/node` in a named Docker volume | +| `OPENCLAW_SANDBOX` | Opt in to sandbox bootstrap (`1`, `true`, `yes`, `on`) | +| `OPENCLAW_DOCKER_SOCKET` | Override Docker socket path | ### Health checks Container probe endpoints (no auth required): ```bash -curl -fsS http://127.0.0.1:18789/healthz -curl -fsS http://127.0.0.1:18789/readyz +curl -fsS http://127.0.0.1:18789/healthz # liveness +curl -fsS http://127.0.0.1:18789/readyz # readiness ``` -Aliases: `/health` and `/ready`. +The Docker image includes a built-in `HEALTHCHECK` that pings `/healthz`. +If checks keep failing, Docker marks the container as `unhealthy` and +orchestration systems can restart or replace it. -`/healthz` is a shallow liveness probe for "the gateway process is up". -`/readyz` stays ready during startup grace, then becomes `503` only if required -managed channels are still disconnected after grace or disconnect later. - -The Docker image includes a built-in `HEALTHCHECK` that pings `/healthz` in the -background. In plain terms: Docker keeps checking if OpenClaw is still -responsive. If checks keep failing, Docker marks the container as `unhealthy`, -and orchestration systems (Docker Compose restart policy, Swarm, Kubernetes, -etc.) can automatically restart or replace it. - -Authenticated deep health snapshot (gateway + channels): +Authenticated deep health snapshot: ```bash docker compose exec openclaw-gateway node dist/index.js health --token "$OPENCLAW_GATEWAY_TOKEN" ``` -### E2E smoke test (Docker) +### LAN vs loopback -```bash -scripts/e2e/onboard-docker.sh -``` - -### QR import smoke test (Docker) - -```bash -pnpm test:docker:qr -``` - -### LAN vs loopback (Docker Compose) - -`docker-setup.sh` defaults `OPENCLAW_GATEWAY_BIND=lan` so host access to +`scripts/docker/setup.sh` defaults `OPENCLAW_GATEWAY_BIND=lan` so host access to `http://127.0.0.1:18789` works with Docker port publishing. -- `lan` (default): host browser + host CLI can reach the published gateway port. +- `lan` (default): host browser and host CLI can reach the published gateway port. - `loopback`: only processes inside the container network namespace can reach - the gateway directly; host-published port access may fail. + the gateway directly. -The setup script also pins `gateway.mode=local` after onboarding so Docker CLI -commands default to local loopback targeting. + +Use bind mode values in `gateway.bind` (`lan` / `loopback` / `custom` / +`tailnet` / `auto`), not host aliases like `0.0.0.0` or `127.0.0.1`. + -Legacy config note: use bind mode values in `gateway.bind` (`lan` / `loopback` / -`custom` / `tailnet` / `auto`), not host aliases (`0.0.0.0`, `127.0.0.1`, -`localhost`, `::`, `::1`). +### Storage and persistence -If you see `Gateway target: ws://172.x.x.x:18789` or repeated `pairing required` -errors from Docker CLI commands, run: +Docker Compose bind-mounts `OPENCLAW_CONFIG_DIR` to `/home/node/.openclaw` and +`OPENCLAW_WORKSPACE_DIR` to `/home/node/.openclaw/workspace`, so those paths +survive container replacement. + +For full persistence details on VM deployments, see +[Docker VM Runtime - What persists where](/install/docker-vm-runtime#what-persists-where). + +**Disk growth hotspots:** watch `media/`, session JSONL files, `cron/runs/*.jsonl`, +and rolling file logs under `/tmp/openclaw/`. + +### Shell helpers (optional) + +For easier day-to-day Docker management, install `ClawDock`: ```bash -docker compose run --rm openclaw-cli config set gateway.mode local -docker compose run --rm openclaw-cli config set gateway.bind lan -docker compose run --rm openclaw-cli devices list --url ws://127.0.0.1:18789 +mkdir -p ~/.clawdock && curl -sL https://raw.githubusercontent.com/openclaw/openclaw/main/scripts/shell-helpers/clawdock-helpers.sh -o ~/.clawdock/clawdock-helpers.sh +echo 'source ~/.clawdock/clawdock-helpers.sh' >> ~/.zshrc && source ~/.zshrc ``` -### Notes +Then use `clawdock-start`, `clawdock-stop`, `clawdock-dashboard`, etc. Run +`clawdock-help` for all commands. +See the [`ClawDock` Helper README](https://github.com/openclaw/openclaw/blob/main/scripts/shell-helpers/README.md). -- Gateway bind defaults to `lan` for container use (`OPENCLAW_GATEWAY_BIND`). -- Dockerfile CMD uses `--allow-unconfigured`; mounted config with `gateway.mode` not `local` will still start. Override CMD to enforce the guard. -- The gateway container is the source of truth for sessions (`~/.openclaw/agents//sessions/`). + + + ```bash + export OPENCLAW_SANDBOX=1 + ./scripts/docker/setup.sh + ``` -### Storage model + Custom socket path (e.g. rootless Docker): -- **Persistent host data:** Docker Compose bind-mounts `OPENCLAW_CONFIG_DIR` to `/home/node/.openclaw` and `OPENCLAW_WORKSPACE_DIR` to `/home/node/.openclaw/workspace`, so those paths survive container replacement. -- **Ephemeral sandbox tmpfs:** when `agents.defaults.sandbox` is enabled, the sandbox containers use `tmpfs` for `/tmp`, `/var/tmp`, and `/run`. Those mounts are separate from the top-level Compose stack and disappear with the sandbox container. -- **Disk growth hotspots:** watch `media/`, `agents//sessions/sessions.json`, transcript JSONL files, `cron/runs/*.jsonl`, and rolling file logs under `/tmp/openclaw/` (or your configured `logging.file`). If you also run the macOS app outside Docker, its service logs are separate again: `~/.openclaw/logs/gateway.log`, `~/.openclaw/logs/gateway.err.log`, and `/tmp/openclaw/openclaw-gateway.log`. + ```bash + export OPENCLAW_SANDBOX=1 + export OPENCLAW_DOCKER_SOCKET=/run/user/1000/docker.sock + ./scripts/docker/setup.sh + ``` -## Agent Sandbox (host gateway + Docker tools) + The script mounts `docker.sock` only after sandbox prerequisites pass. If + sandbox setup cannot complete, the script resets `agents.defaults.sandbox.mode` + to `off`. -Deep dive: [Sandboxing](/gateway/sandboxing) + -### What it does + + Disable Compose pseudo-TTY allocation with `-T`: -When `agents.defaults.sandbox` is enabled, **non-main sessions** run tools inside a Docker -container. The gateway stays on your host, but the tool execution is isolated: + ```bash + docker compose run -T --rm openclaw-cli gateway probe + docker compose run -T --rm openclaw-cli devices list --json + ``` -- scope: `"agent"` by default (one container + workspace per agent) -- scope: `"session"` for per-session isolation -- per-scope workspace folder mounted at `/workspace` -- optional agent workspace access (`agents.defaults.sandbox.workspaceAccess`) -- allow/deny tool policy (deny wins) -- inbound media is copied into the active sandbox workspace (`media/inbound/*`) so tools can read it (with `workspaceAccess: "rw"`, this lands in the agent workspace) + -Warning: `scope: "shared"` disables cross-session isolation. All sessions share -one container and one workspace. + + `openclaw-cli` uses `network_mode: "service:openclaw-gateway"` so CLI + commands can reach the gateway over `127.0.0.1`. Treat this as a shared + trust boundary. The compose config drops `NET_RAW`/`NET_ADMIN` and enables + `no-new-privileges` on `openclaw-cli`. + -### Per-agent sandbox profiles (multi-agent) + + The image runs as `node` (uid 1000). If you see permission errors on + `/home/node/.openclaw`, make sure your host bind mounts are owned by uid 1000: -If you use multi-agent routing, each agent can override sandbox + tool settings: -`agents.list[].sandbox` and `agents.list[].tools` (plus `agents.list[].tools.sandbox.tools`). This lets you run -mixed access levels in one gateway: + ```bash + sudo chown -R 1000:1000 /path/to/openclaw-config /path/to/openclaw-workspace + ``` -- Full access (personal agent) -- Read-only tools + read-only workspace (family/work agent) -- No filesystem/shell tools (public agent) + -See [Multi-Agent Sandbox & Tools](/tools/multi-agent-sandbox-tools) for examples, -precedence, and troubleshooting. + + Order your Dockerfile so dependency layers are cached. This avoids re-running + `pnpm install` unless lockfiles change: -### Default behavior + ```dockerfile + FROM node:24-bookworm + RUN curl -fsSL https://bun.sh/install | bash + ENV PATH="/root/.bun/bin:${PATH}" + RUN corepack enable + WORKDIR /app + COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./ + COPY ui/package.json ./ui/package.json + COPY scripts ./scripts + RUN pnpm install --frozen-lockfile + COPY . . + RUN pnpm build + RUN pnpm ui:install + RUN pnpm ui:build + ENV NODE_ENV=production + CMD ["node","dist/index.js"] + ``` -- Image: `openclaw-sandbox:bookworm-slim` -- One container per agent -- Agent workspace access: `workspaceAccess: "none"` (default) uses `~/.openclaw/sandboxes` - - `"ro"` keeps the sandbox workspace at `/workspace` and mounts the agent workspace read-only at `/agent` (disables `write`/`edit`/`apply_patch`) - - `"rw"` mounts the agent workspace read/write at `/workspace` -- Auto-prune: idle > 24h OR age > 7d -- Network: `none` by default (explicitly opt-in if you need egress) - - `host` is blocked. - - `container:` is blocked by default (namespace-join risk). -- Default allow: `exec`, `process`, `read`, `write`, `edit`, `sessions_list`, `sessions_history`, `sessions_send`, `sessions_spawn`, `session_status` -- Default deny: `browser`, `canvas`, `nodes`, `cron`, `discord`, `gateway` + -### Enable sandboxing + + The default image is security-first and runs as non-root `node`. For a more + full-featured container: -If you plan to install packages in `setupCommand`, note: + 1. **Persist `/home/node`**: `export OPENCLAW_HOME_VOLUME="openclaw_home"` + 2. **Bake system deps**: `export OPENCLAW_DOCKER_APT_PACKAGES="git curl jq"` + 3. **Install Playwright browsers**: + ```bash + docker compose run --rm openclaw-cli \ + node /app/node_modules/playwright-core/cli.js install chromium + ``` + 4. **Persist browser downloads**: set + `PLAYWRIGHT_BROWSERS_PATH=/home/node/.cache/ms-playwright` and use + `OPENCLAW_HOME_VOLUME` or `OPENCLAW_EXTRA_MOUNTS`. -- Default `docker.network` is `"none"` (no egress). -- `docker.network: "host"` is blocked. -- `docker.network: "container:"` is blocked by default. -- Break-glass override: `agents.defaults.sandbox.docker.dangerouslyAllowContainerNamespaceJoin: true`. -- `readOnlyRoot: true` blocks package installs. -- `user` must be root for `apt-get` (omit `user` or set `user: "0:0"`). - OpenClaw auto-recreates containers when `setupCommand` (or docker config) changes - unless the container was **recently used** (within ~5 minutes). Hot containers - log a warning with the exact `openclaw sandbox recreate ...` command. + + + + If you pick OpenAI Codex OAuth in the wizard, it opens a browser URL. In + Docker or headless setups, copy the full redirect URL you land on and paste + it back into the wizard to finish auth. + + + + The main Docker image uses `node:24-bookworm` and publishes OCI base-image + annotations including `org.opencontainers.image.base.name`, + `org.opencontainers.image.source`, and others. See + [OCI image annotations](https://github.com/opencontainers/image-spec/blob/main/annotations.md). + + + +### Running on a VPS? + +See [Hetzner (Docker VPS)](/install/hetzner) and +[Docker VM Runtime](/install/docker-vm-runtime) for shared VM deployment steps +including binary baking, persistence, and updates. + +## Agent Sandbox + +When `agents.defaults.sandbox` is enabled, the gateway runs agent tool execution +(shell, file read/write, etc.) inside isolated Docker containers while the +gateway itself stays on the host. This gives you a hard wall around untrusted or +multi-tenant agent sessions without containerizing the entire gateway. + +Sandbox scope can be per-agent (default), per-session, or shared. Each scope +gets its own workspace mounted at `/workspace`. You can also configure +allow/deny tool policies, network isolation, resource limits, and browser +containers. + +For full configuration, images, security notes, and multi-agent profiles, see: + +- [Sandboxing](/gateway/sandboxing) -- complete sandbox reference +- [OpenShell](/gateway/openshell) -- interactive shell access to sandbox containers +- [Multi-Agent Sandbox and Tools](/tools/multi-agent-sandbox-tools) -- per-agent overrides + +### Quick enable ```json5 { @@ -608,237 +311,65 @@ If you plan to install packages in `setupCommand`, note: defaults: { sandbox: { mode: "non-main", // off | non-main | all - scope: "agent", // session | agent | shared (agent is default) - workspaceAccess: "none", // none | ro | rw - workspaceRoot: "~/.openclaw/sandboxes", - docker: { - image: "openclaw-sandbox:bookworm-slim", - workdir: "/workspace", - readOnlyRoot: true, - tmpfs: ["/tmp", "/var/tmp", "/run"], - network: "none", - user: "1000:1000", - capDrop: ["ALL"], - env: { LANG: "C.UTF-8" }, - setupCommand: "apt-get update && apt-get install -y git curl jq", - pidsLimit: 256, - memory: "1g", - memorySwap: "2g", - cpus: 1, - ulimits: { - nofile: { soft: 1024, hard: 2048 }, - nproc: 256, - }, - seccompProfile: "/path/to/seccomp.json", - apparmorProfile: "openclaw-sandbox", - dns: ["1.1.1.1", "8.8.8.8"], - extraHosts: ["internal.service:10.0.0.5"], - }, - prune: { - idleHours: 24, // 0 disables idle pruning - maxAgeDays: 7, // 0 disables max-age pruning - }, - }, - }, - }, - tools: { - sandbox: { - tools: { - allow: [ - "exec", - "process", - "read", - "write", - "edit", - "sessions_list", - "sessions_history", - "sessions_send", - "sessions_spawn", - "session_status", - ], - deny: ["browser", "canvas", "nodes", "cron", "discord", "gateway"], + scope: "agent", // session | agent | shared }, }, }, } ``` -Hardening knobs live under `agents.defaults.sandbox.docker`: -`network`, `user`, `pidsLimit`, `memory`, `memorySwap`, `cpus`, `ulimits`, -`seccompProfile`, `apparmorProfile`, `dns`, `extraHosts`, -`dangerouslyAllowContainerNamespaceJoin` (break-glass only). - -Multi-agent: override `agents.defaults.sandbox.{docker,browser,prune}.*` per agent via `agents.list[].sandbox.{docker,browser,prune}.*` -(ignored when `agents.defaults.sandbox.scope` / `agents.list[].sandbox.scope` is `"shared"`). - -### Build the default sandbox image +Build the default sandbox image: ```bash scripts/sandbox-setup.sh ``` -This builds `openclaw-sandbox:bookworm-slim` using `Dockerfile.sandbox`. - -### Sandbox common image (optional) - -If you want a sandbox image with common build tooling (Node, Go, Rust, etc.), build the common image: - -```bash -scripts/sandbox-common-setup.sh -``` - -This builds `openclaw-sandbox-common:bookworm-slim`. To use it: - -```json5 -{ - agents: { - defaults: { - sandbox: { docker: { image: "openclaw-sandbox-common:bookworm-slim" } }, - }, - }, -} -``` - -### Sandbox browser image - -To run the browser tool inside the sandbox, build the browser image: - -```bash -scripts/sandbox-browser-setup.sh -``` - -This builds `openclaw-sandbox-browser:bookworm-slim` using -`Dockerfile.sandbox-browser`. The container runs Chromium with CDP enabled and -an optional noVNC observer (headful via Xvfb). - -Notes: - -- Docker and other headless/container browser flows stay on raw CDP. Chrome MCP `existing-session` is for host-local Chrome, not container takeover. -- Headful (Xvfb) reduces bot blocking vs headless. -- Headless can still be used by setting `agents.defaults.sandbox.browser.headless=true`. -- No full desktop environment (GNOME) is needed; Xvfb provides the display. -- Browser containers default to a dedicated Docker network (`openclaw-sandbox-browser`) instead of global `bridge`. -- Optional `agents.defaults.sandbox.browser.cdpSourceRange` restricts container-edge CDP ingress by CIDR (for example `172.21.0.1/32`). -- noVNC observer access is password-protected by default; OpenClaw provides a short-lived observer token URL that serves a local bootstrap page and keeps the password in URL fragment (instead of URL query). -- Browser container startup defaults are conservative for shared/container workloads, including: - - `--remote-debugging-address=127.0.0.1` - - `--remote-debugging-port=` - - `--user-data-dir=${HOME}/.chrome` - - `--no-first-run` - - `--no-default-browser-check` - - `--disable-3d-apis` - - `--disable-software-rasterizer` - - `--disable-gpu` - - `--disable-dev-shm-usage` - - `--disable-background-networking` - - `--disable-features=TranslateUI` - - `--disable-breakpad` - - `--disable-crash-reporter` - - `--metrics-recording-only` - - `--renderer-process-limit=2` - - `--no-zygote` - - `--disable-extensions` - - If `agents.defaults.sandbox.browser.noSandbox` is set, `--no-sandbox` and - `--disable-setuid-sandbox` are also appended. - - The three graphics hardening flags above are optional. If your workload needs - WebGL/3D, set `OPENCLAW_BROWSER_DISABLE_GRAPHICS_FLAGS=0` to run without - `--disable-3d-apis`, `--disable-software-rasterizer`, and `--disable-gpu`. - - Extension behavior is controlled by `--disable-extensions` and can be disabled - (enables extensions) via `OPENCLAW_BROWSER_DISABLE_EXTENSIONS=0` for - extension-dependent pages or extensions-heavy workflows. - - `--renderer-process-limit=2` is also configurable with - `OPENCLAW_BROWSER_RENDERER_PROCESS_LIMIT`; set `0` to let Chromium choose its - default process limit when browser concurrency needs tuning. - -Defaults are applied by default in the bundled image. If you need different -Chromium flags, use a custom browser image and provide your own entrypoint. - -Use config: - -```json5 -{ - agents: { - defaults: { - sandbox: { - browser: { enabled: true }, - }, - }, - }, -} -``` - -Custom browser image: - -```json5 -{ - agents: { - defaults: { - sandbox: { browser: { image: "my-openclaw-browser" } }, - }, - }, -} -``` - -When enabled, the agent receives: - -- a sandbox browser control URL (for the `browser` tool) -- a noVNC URL (if enabled and headless=false) - -Remember: if you use an allowlist for tools, add `browser` (and remove it from -deny) or the tool remains blocked. -Prune rules (`agents.defaults.sandbox.prune`) apply to browser containers too. - -### Custom sandbox image - -Build your own image and point config to it: - -```bash -docker build -t my-openclaw-sbx -f Dockerfile.sandbox . -``` - -```json5 -{ - agents: { - defaults: { - sandbox: { docker: { image: "my-openclaw-sbx" } }, - }, - }, -} -``` - -### Tool policy (allow/deny) - -- `deny` wins over `allow`. -- If `allow` is empty: all tools (except deny) are available. -- If `allow` is non-empty: only tools in `allow` are available (minus deny). - -### Pruning strategy - -Two knobs: - -- `prune.idleHours`: remove containers not used in X hours (0 = disable) -- `prune.maxAgeDays`: remove containers older than X days (0 = disable) - -Example: - -- Keep busy sessions but cap lifetime: - `idleHours: 24`, `maxAgeDays: 7` -- Never prune: - `idleHours: 0`, `maxAgeDays: 0` - -### Security notes - -- Hard wall only applies to **tools** (exec/read/write/edit/apply_patch). -- Host-only tools like browser/camera/canvas are blocked by default. -- Allowing `browser` in sandbox **breaks isolation** (browser runs on host). - ## Troubleshooting -- Image missing: build with [`scripts/sandbox-setup.sh`](https://github.com/openclaw/openclaw/blob/main/scripts/sandbox-setup.sh) or set `agents.defaults.sandbox.docker.image`. -- Container not running: it will auto-create per session on demand. -- Permission errors in sandbox: set `docker.user` to a UID:GID that matches your - mounted workspace ownership (or chown the workspace folder). -- Custom tools not found: OpenClaw runs commands with `sh -lc` (login shell), which - sources `/etc/profile` and may reset PATH. Set `docker.env.PATH` to prepend your - custom tool paths (e.g., `/custom/bin:/usr/local/share/npm-global/bin`), or add - a script under `/etc/profile.d/` in your Dockerfile. + + + Build the sandbox image with + [`scripts/sandbox-setup.sh`](https://github.com/openclaw/openclaw/blob/main/scripts/sandbox-setup.sh) + or set `agents.defaults.sandbox.docker.image` to your custom image. + Containers are auto-created per session on demand. + + + + Set `docker.user` to a UID:GID that matches your mounted workspace ownership, + or chown the workspace folder. + + + + OpenClaw runs commands with `sh -lc` (login shell), which sources + `/etc/profile` and may reset PATH. Set `docker.env.PATH` to prepend your + custom tool paths, or add a script under `/etc/profile.d/` in your Dockerfile. + + + + The VM needs at least 2 GB RAM. Use a larger machine class and retry. + + + + Fetch a fresh dashboard link and approve the browser device: + + ```bash + docker compose run --rm openclaw-cli dashboard --no-open + docker compose run --rm openclaw-cli devices list + docker compose run --rm openclaw-cli devices approve + ``` + + More detail: [Dashboard](/web/dashboard), [Devices](/cli/devices). + + + + + Reset gateway mode and bind: + + ```bash + docker compose run --rm openclaw-cli config set gateway.mode local + docker compose run --rm openclaw-cli config set gateway.bind lan + docker compose run --rm openclaw-cli devices list --url ws://127.0.0.1:18789 + ``` + + + diff --git a/docs/install/exe-dev.md b/docs/install/exe-dev.md index c49dab4e426..529f6286318 100644 --- a/docs/install/exe-dev.md +++ b/docs/install/exe-dev.md @@ -16,9 +16,9 @@ This page assumes exe.dev's default **exeuntu** image. If you picked a different 1. [https://exe.new/openclaw](https://exe.new/openclaw) 2. Fill in your auth key/token as needed -3. Click on "Agent" next to your VM, and wait... -4. ??? -5. Profit +3. Click on "Agent" next to your VM and wait for Shelley to finish provisioning +4. Open `https://.exe.xyz/` and paste your gateway token to authenticate +5. Approve any pending device pairing requests with `openclaw devices approve ` ## What you need diff --git a/docs/install/fly.md b/docs/install/fly.md index f70f7590ad0..0a5c9b22338 100644 --- a/docs/install/fly.md +++ b/docs/install/fly.md @@ -1,6 +1,5 @@ --- title: Fly.io -description: Deploy OpenClaw on Fly.io summary: "Step-by-step Fly.io deployment for OpenClaw with persistent storage and HTTPS" read_when: - Deploying OpenClaw on Fly.io @@ -25,222 +24,228 @@ read_when: 3. Deploy with `fly deploy` 4. SSH in to create config or use Control UI -## 1) Create the Fly app + + + ```bash + # Clone the repo + git clone https://github.com/openclaw/openclaw.git + cd openclaw -```bash -# Clone the repo -git clone https://github.com/openclaw/openclaw.git -cd openclaw + # Create a new Fly app (pick your own name) + fly apps create my-openclaw -# Create a new Fly app (pick your own name) -fly apps create my-openclaw + # Create a persistent volume (1GB is usually enough) + fly volumes create openclaw_data --size 1 --region iad + ``` -# Create a persistent volume (1GB is usually enough) -fly volumes create openclaw_data --size 1 --region iad -``` + **Tip:** Choose a region close to you. Common options: `lhr` (London), `iad` (Virginia), `sjc` (San Jose). -**Tip:** Choose a region close to you. Common options: `lhr` (London), `iad` (Virginia), `sjc` (San Jose). + -## 2) Configure fly.toml + + Edit `fly.toml` to match your app name and requirements. -Edit `fly.toml` to match your app name and requirements. + **Security note:** The default config exposes a public URL. For a hardened deployment with no public IP, see [Private Deployment](#private-deployment-hardened) or use `fly.private.toml`. -**Security note:** The default config exposes a public URL. For a hardened deployment with no public IP, see [Private Deployment](#private-deployment-hardened) or use `fly.private.toml`. + ```toml + app = "my-openclaw" # Your app name + primary_region = "iad" -```toml -app = "my-openclaw" # Your app name -primary_region = "iad" + [build] + dockerfile = "Dockerfile" -[build] - dockerfile = "Dockerfile" + [env] + NODE_ENV = "production" + OPENCLAW_PREFER_PNPM = "1" + OPENCLAW_STATE_DIR = "/data" + NODE_OPTIONS = "--max-old-space-size=1536" -[env] - NODE_ENV = "production" - OPENCLAW_PREFER_PNPM = "1" - OPENCLAW_STATE_DIR = "/data" - NODE_OPTIONS = "--max-old-space-size=1536" + [processes] + app = "node dist/index.js gateway --allow-unconfigured --port 3000 --bind lan" -[processes] - app = "node dist/index.js gateway --allow-unconfigured --port 3000 --bind lan" + [http_service] + internal_port = 3000 + force_https = true + auto_stop_machines = false + auto_start_machines = true + min_machines_running = 1 + processes = ["app"] -[http_service] - internal_port = 3000 - force_https = true - auto_stop_machines = false - auto_start_machines = true - min_machines_running = 1 - processes = ["app"] + [[vm]] + size = "shared-cpu-2x" + memory = "2048mb" -[[vm]] - size = "shared-cpu-2x" - memory = "2048mb" + [mounts] + source = "openclaw_data" + destination = "/data" + ``` -[mounts] - source = "openclaw_data" - destination = "/data" -``` + **Key settings:** -**Key settings:** + | Setting | Why | + | ------------------------------ | --------------------------------------------------------------------------- | + | `--bind lan` | Binds to `0.0.0.0` so Fly's proxy can reach the gateway | + | `--allow-unconfigured` | Starts without a config file (you'll create one after) | + | `internal_port = 3000` | Must match `--port 3000` (or `OPENCLAW_GATEWAY_PORT`) for Fly health checks | + | `memory = "2048mb"` | 512MB is too small; 2GB recommended | + | `OPENCLAW_STATE_DIR = "/data"` | Persists state on the volume | -| Setting | Why | -| ------------------------------ | --------------------------------------------------------------------------- | -| `--bind lan` | Binds to `0.0.0.0` so Fly's proxy can reach the gateway | -| `--allow-unconfigured` | Starts without a config file (you'll create one after) | -| `internal_port = 3000` | Must match `--port 3000` (or `OPENCLAW_GATEWAY_PORT`) for Fly health checks | -| `memory = "2048mb"` | 512MB is too small; 2GB recommended | -| `OPENCLAW_STATE_DIR = "/data"` | Persists state on the volume | + -## 3) Set secrets + + ```bash + # Required: Gateway token (for non-loopback binding) + fly secrets set OPENCLAW_GATEWAY_TOKEN=$(openssl rand -hex 32) -```bash -# Required: Gateway token (for non-loopback binding) -fly secrets set OPENCLAW_GATEWAY_TOKEN=$(openssl rand -hex 32) + # Model provider API keys + fly secrets set ANTHROPIC_API_KEY=sk-ant-... -# Model provider API keys -fly secrets set ANTHROPIC_API_KEY=sk-ant-... + # Optional: Other providers + fly secrets set OPENAI_API_KEY=sk-... + fly secrets set GOOGLE_API_KEY=... -# Optional: Other providers -fly secrets set OPENAI_API_KEY=sk-... -fly secrets set GOOGLE_API_KEY=... + # Channel tokens + fly secrets set DISCORD_BOT_TOKEN=MTQ... + ``` -# Channel tokens -fly secrets set DISCORD_BOT_TOKEN=MTQ... -``` + **Notes:** -**Notes:** + - Non-loopback binds (`--bind lan`) require `OPENCLAW_GATEWAY_TOKEN` for security. + - Treat these tokens like passwords. + - **Prefer env vars over config file** for all API keys and tokens. This keeps secrets out of `openclaw.json` where they could be accidentally exposed or logged. -- Non-loopback binds (`--bind lan`) require `OPENCLAW_GATEWAY_TOKEN` for security. -- Treat these tokens like passwords. -- **Prefer env vars over config file** for all API keys and tokens. This keeps secrets out of `openclaw.json` where they could be accidentally exposed or logged. + -## 4) Deploy + + ```bash + fly deploy + ``` -```bash -fly deploy -``` + First deploy builds the Docker image (~2-3 minutes). Subsequent deploys are faster. -First deploy builds the Docker image (~2-3 minutes). Subsequent deploys are faster. + After deployment, verify: -After deployment, verify: + ```bash + fly status + fly logs + ``` -```bash -fly status -fly logs -``` + You should see: -You should see: + ``` + [gateway] listening on ws://0.0.0.0:3000 (PID xxx) + [discord] logged in to discord as xxx + ``` -``` -[gateway] listening on ws://0.0.0.0:3000 (PID xxx) -[discord] logged in to discord as xxx -``` + -## 5) Create config file + + SSH into the machine to create a proper config: -SSH into the machine to create a proper config: + ```bash + fly ssh console + ``` -```bash -fly ssh console -``` + Create the config directory and file: -Create the config directory and file: - -```bash -mkdir -p /data -cat > /data/openclaw.json << 'EOF' -{ - "agents": { - "defaults": { - "model": { - "primary": "anthropic/claude-opus-4-6", - "fallbacks": ["anthropic/claude-sonnet-4-5", "openai/gpt-4o"] - }, - "maxConcurrent": 4 - }, - "list": [ - { - "id": "main", - "default": true - } - ] - }, - "auth": { - "profiles": { - "anthropic:default": { "mode": "token", "provider": "anthropic" }, - "openai:default": { "mode": "token", "provider": "openai" } - } - }, - "bindings": [ + ```bash + mkdir -p /data + cat > /data/openclaw.json << 'EOF' { - "agentId": "main", - "match": { "channel": "discord" } - } - ], - "channels": { - "discord": { - "enabled": true, - "groupPolicy": "allowlist", - "guilds": { - "YOUR_GUILD_ID": { - "channels": { "general": { "allow": true } }, - "requireMention": false + "agents": { + "defaults": { + "model": { + "primary": "anthropic/claude-opus-4-6", + "fallbacks": ["anthropic/claude-sonnet-4-6", "openai/gpt-4o"] + }, + "maxConcurrent": 4 + }, + "list": [ + { + "id": "main", + "default": true + } + ] + }, + "auth": { + "profiles": { + "anthropic:default": { "mode": "token", "provider": "anthropic" }, + "openai:default": { "mode": "token", "provider": "openai" } } - } + }, + "bindings": [ + { + "agentId": "main", + "match": { "channel": "discord" } + } + ], + "channels": { + "discord": { + "enabled": true, + "groupPolicy": "allowlist", + "guilds": { + "YOUR_GUILD_ID": { + "channels": { "general": { "allow": true } }, + "requireMention": false + } + } + } + }, + "gateway": { + "mode": "local", + "bind": "auto" + }, + "meta": {} } - }, - "gateway": { - "mode": "local", - "bind": "auto" - }, - "meta": { - "lastTouchedVersion": "2026.1.29" - } -} -EOF -``` + EOF + ``` -**Note:** With `OPENCLAW_STATE_DIR=/data`, the config path is `/data/openclaw.json`. + **Note:** With `OPENCLAW_STATE_DIR=/data`, the config path is `/data/openclaw.json`. -**Note:** The Discord token can come from either: + **Note:** The Discord token can come from either: -- Environment variable: `DISCORD_BOT_TOKEN` (recommended for secrets) -- Config file: `channels.discord.token` + - Environment variable: `DISCORD_BOT_TOKEN` (recommended for secrets) + - Config file: `channels.discord.token` -If using env var, no need to add token to config. The gateway reads `DISCORD_BOT_TOKEN` automatically. + If using env var, no need to add token to config. The gateway reads `DISCORD_BOT_TOKEN` automatically. -Restart to apply: + Restart to apply: -```bash -exit -fly machine restart -``` + ```bash + exit + fly machine restart + ``` -## 6) Access the Gateway + -### Control UI + + ### Control UI -Open in browser: + Open in browser: -```bash -fly open -``` + ```bash + fly open + ``` -Or visit `https://my-openclaw.fly.dev/` + Or visit `https://my-openclaw.fly.dev/` -Paste your gateway token (the one from `OPENCLAW_GATEWAY_TOKEN`) to authenticate. + Paste your gateway token (the one from `OPENCLAW_GATEWAY_TOKEN`) to authenticate. -### Logs + ### Logs -```bash -fly logs # Live logs -fly logs --no-tail # Recent logs -``` + ```bash + fly logs # Live logs + fly logs --no-tail # Recent logs + ``` -### SSH Console + ### SSH Console -```bash -fly ssh console -``` + ```bash + fly ssh console + ``` + + + ## Troubleshooting @@ -442,22 +447,22 @@ If you need webhook callbacks (Twilio, Telnyx, etc.) without public exposure: Example voice-call config with ngrok: -```json +```json5 { - "plugins": { - "entries": { + plugins: { + entries: { "voice-call": { - "enabled": true, - "config": { - "provider": "twilio", - "tunnel": { "provider": "ngrok" }, - "webhookSecurity": { - "allowedHosts": ["example.ngrok.app"] - } - } - } - } - } + enabled: true, + config: { + provider: "twilio", + tunnel: { provider: "ngrok" }, + webhookSecurity: { + allowedHosts: ["example.ngrok.app"], + }, + }, + }, + }, + }, } ``` @@ -488,3 +493,9 @@ With the recommended config (`shared-cpu-2x`, 2GB RAM): - Free tier includes some allowance See [Fly.io pricing](https://fly.io/docs/about/pricing/) for details. + +## Next steps + +- Set up messaging channels: [Channels](/channels) +- Configure the Gateway: [Gateway configuration](/gateway/configuration) +- Keep OpenClaw up to date: [Updating](/install/updating) diff --git a/docs/install/gcp.md b/docs/install/gcp.md index 7ff4a00d087..3714d9bcb1b 100644 --- a/docs/install/gcp.md +++ b/docs/install/gcp.md @@ -65,274 +65,271 @@ For the generic Docker flow, see [Docker](/install/docker). --- -## 1) Install gcloud CLI (or use Console) + + + **Option A: gcloud CLI** (recommended for automation) -**Option A: gcloud CLI** (recommended for automation) + Install from [https://cloud.google.com/sdk/docs/install](https://cloud.google.com/sdk/docs/install) -Install from [https://cloud.google.com/sdk/docs/install](https://cloud.google.com/sdk/docs/install) + Initialize and authenticate: -Initialize and authenticate: + ```bash + gcloud init + gcloud auth login + ``` -```bash -gcloud init -gcloud auth login -``` + **Option B: Cloud Console** -**Option B: Cloud Console** + All steps can be done via the web UI at [https://console.cloud.google.com](https://console.cloud.google.com) -All steps can be done via the web UI at [https://console.cloud.google.com](https://console.cloud.google.com) + ---- + + **CLI:** -## 2) Create a GCP project + ```bash + gcloud projects create my-openclaw-project --name="OpenClaw Gateway" + gcloud config set project my-openclaw-project + ``` -**CLI:** + Enable billing at [https://console.cloud.google.com/billing](https://console.cloud.google.com/billing) (required for Compute Engine). -```bash -gcloud projects create my-openclaw-project --name="OpenClaw Gateway" -gcloud config set project my-openclaw-project -``` + Enable the Compute Engine API: -Enable billing at [https://console.cloud.google.com/billing](https://console.cloud.google.com/billing) (required for Compute Engine). + ```bash + gcloud services enable compute.googleapis.com + ``` -Enable the Compute Engine API: + **Console:** -```bash -gcloud services enable compute.googleapis.com -``` + 1. Go to IAM & Admin > Create Project + 2. Name it and create + 3. Enable billing for the project + 4. Navigate to APIs & Services > Enable APIs > search "Compute Engine API" > Enable -**Console:** + -1. Go to IAM & Admin > Create Project -2. Name it and create -3. Enable billing for the project -4. Navigate to APIs & Services > Enable APIs > search "Compute Engine API" > Enable + + **Machine types:** ---- + | Type | Specs | Cost | Notes | + | --------- | ------------------------ | ------------------ | -------------------------------------------- | + | e2-medium | 2 vCPU, 4GB RAM | ~$25/mo | Most reliable for local Docker builds | + | e2-small | 2 vCPU, 2GB RAM | ~$12/mo | Minimum recommended for Docker build | + | e2-micro | 2 vCPU (shared), 1GB RAM | Free tier eligible | Often fails with Docker build OOM (exit 137) | -## 3) Create the VM + **CLI:** -**Machine types:** + ```bash + gcloud compute instances create openclaw-gateway \ + --zone=us-central1-a \ + --machine-type=e2-small \ + --boot-disk-size=20GB \ + --image-family=debian-12 \ + --image-project=debian-cloud + ``` -| Type | Specs | Cost | Notes | -| --------- | ------------------------ | ------------------ | -------------------------------------------- | -| e2-medium | 2 vCPU, 4GB RAM | ~$25/mo | Most reliable for local Docker builds | -| e2-small | 2 vCPU, 2GB RAM | ~$12/mo | Minimum recommended for Docker build | -| e2-micro | 2 vCPU (shared), 1GB RAM | Free tier eligible | Often fails with Docker build OOM (exit 137) | + **Console:** -**CLI:** + 1. Go to Compute Engine > VM instances > Create instance + 2. Name: `openclaw-gateway` + 3. Region: `us-central1`, Zone: `us-central1-a` + 4. Machine type: `e2-small` + 5. Boot disk: Debian 12, 20GB + 6. Create -```bash -gcloud compute instances create openclaw-gateway \ - --zone=us-central1-a \ - --machine-type=e2-small \ - --boot-disk-size=20GB \ - --image-family=debian-12 \ - --image-project=debian-cloud -``` + -**Console:** + + **CLI:** -1. Go to Compute Engine > VM instances > Create instance -2. Name: `openclaw-gateway` -3. Region: `us-central1`, Zone: `us-central1-a` -4. Machine type: `e2-small` -5. Boot disk: Debian 12, 20GB -6. Create + ```bash + gcloud compute ssh openclaw-gateway --zone=us-central1-a + ``` ---- + **Console:** -## 4) SSH into the VM + Click the "SSH" button next to your VM in the Compute Engine dashboard. -**CLI:** + Note: SSH key propagation can take 1-2 minutes after VM creation. If connection is refused, wait and retry. -```bash -gcloud compute ssh openclaw-gateway --zone=us-central1-a -``` + -**Console:** + + ```bash + sudo apt-get update + sudo apt-get install -y git curl ca-certificates + curl -fsSL https://get.docker.com | sudo sh + sudo usermod -aG docker $USER + ``` -Click the "SSH" button next to your VM in the Compute Engine dashboard. + Log out and back in for the group change to take effect: -Note: SSH key propagation can take 1-2 minutes after VM creation. If connection is refused, wait and retry. + ```bash + exit + ``` ---- + Then SSH back in: -## 5) Install Docker (on the VM) + ```bash + gcloud compute ssh openclaw-gateway --zone=us-central1-a + ``` -```bash -sudo apt-get update -sudo apt-get install -y git curl ca-certificates -curl -fsSL https://get.docker.com | sudo sh -sudo usermod -aG docker $USER -``` + Verify: -Log out and back in for the group change to take effect: + ```bash + docker --version + docker compose version + ``` -```bash -exit -``` + -Then SSH back in: + + ```bash + git clone https://github.com/openclaw/openclaw.git + cd openclaw + ``` -```bash -gcloud compute ssh openclaw-gateway --zone=us-central1-a -``` + This guide assumes you will build a custom image to guarantee binary persistence. -Verify: + -```bash -docker --version -docker compose version -``` + + Docker containers are ephemeral. + All long-lived state must live on the host. ---- + ```bash + mkdir -p ~/.openclaw + mkdir -p ~/.openclaw/workspace + ``` -## 6) Clone the OpenClaw repository + -```bash -git clone https://github.com/openclaw/openclaw.git -cd openclaw -``` + + Create `.env` in the repository root. -This guide assumes you will build a custom image to guarantee binary persistence. + ```bash + OPENCLAW_IMAGE=openclaw:latest + OPENCLAW_GATEWAY_TOKEN=change-me-now + OPENCLAW_GATEWAY_BIND=lan + OPENCLAW_GATEWAY_PORT=18789 ---- + OPENCLAW_CONFIG_DIR=/home/$USER/.openclaw + OPENCLAW_WORKSPACE_DIR=/home/$USER/.openclaw/workspace -## 7) Create persistent host directories + GOG_KEYRING_PASSWORD=change-me-now + XDG_CONFIG_HOME=/home/node/.openclaw + ``` -Docker containers are ephemeral. -All long-lived state must live on the host. + Generate strong secrets: -```bash -mkdir -p ~/.openclaw -mkdir -p ~/.openclaw/workspace -``` + ```bash + openssl rand -hex 32 + ``` ---- + **Do not commit this file.** -## 8) Configure environment variables + -Create `.env` in the repository root. + + Create or update `docker-compose.yml`. -```bash -OPENCLAW_IMAGE=openclaw:latest -OPENCLAW_GATEWAY_TOKEN=change-me-now -OPENCLAW_GATEWAY_BIND=lan -OPENCLAW_GATEWAY_PORT=18789 + ```yaml + services: + openclaw-gateway: + image: ${OPENCLAW_IMAGE} + build: . + restart: unless-stopped + env_file: + - .env + environment: + - HOME=/home/node + - NODE_ENV=production + - TERM=xterm-256color + - OPENCLAW_GATEWAY_BIND=${OPENCLAW_GATEWAY_BIND} + - OPENCLAW_GATEWAY_PORT=${OPENCLAW_GATEWAY_PORT} + - OPENCLAW_GATEWAY_TOKEN=${OPENCLAW_GATEWAY_TOKEN} + - GOG_KEYRING_PASSWORD=${GOG_KEYRING_PASSWORD} + - XDG_CONFIG_HOME=${XDG_CONFIG_HOME} + - PATH=/home/linuxbrew/.linuxbrew/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + volumes: + - ${OPENCLAW_CONFIG_DIR}:/home/node/.openclaw + - ${OPENCLAW_WORKSPACE_DIR}:/home/node/.openclaw/workspace + ports: + # Recommended: keep the Gateway loopback-only on the VM; access via SSH tunnel. + # To expose it publicly, remove the `127.0.0.1:` prefix and firewall accordingly. + - "127.0.0.1:${OPENCLAW_GATEWAY_PORT}:18789" + command: + [ + "node", + "dist/index.js", + "gateway", + "--bind", + "${OPENCLAW_GATEWAY_BIND}", + "--port", + "${OPENCLAW_GATEWAY_PORT}", + "--allow-unconfigured", + ] + ``` -OPENCLAW_CONFIG_DIR=/home/$USER/.openclaw -OPENCLAW_WORKSPACE_DIR=/home/$USER/.openclaw/workspace + `--allow-unconfigured` is only for bootstrap convenience, it is not a replacement for a proper gateway configuration. Still set auth (`gateway.auth.token` or password) and use safe bind settings for your deployment. -GOG_KEYRING_PASSWORD=change-me-now -XDG_CONFIG_HOME=/home/node/.openclaw -``` + -Generate strong secrets: + + Use the shared runtime guide for the common Docker host flow: -```bash -openssl rand -hex 32 -``` + - [Bake required binaries into the image](/install/docker-vm-runtime#bake-required-binaries-into-the-image) + - [Build and launch](/install/docker-vm-runtime#build-and-launch) + - [What persists where](/install/docker-vm-runtime#what-persists-where) + - [Updates](/install/docker-vm-runtime#updates) -**Do not commit this file.** + ---- + + On GCP, if build fails with `Killed` or `exit code 137` during `pnpm install --frozen-lockfile`, the VM is out of memory. Use `e2-small` minimum, or `e2-medium` for more reliable first builds. -## 9) Docker Compose configuration + When binding to LAN (`OPENCLAW_GATEWAY_BIND=lan`), configure a trusted browser origin before continuing: -Create or update `docker-compose.yml`. + ```bash + docker compose run --rm openclaw-cli config set gateway.controlUi.allowedOrigins '["http://127.0.0.1:18789"]' --strict-json + ``` + + If you changed the gateway port, replace `18789` with your configured port. -```yaml -services: - openclaw-gateway: - image: ${OPENCLAW_IMAGE} - build: . - restart: unless-stopped - env_file: - - .env - environment: - - HOME=/home/node - - NODE_ENV=production - - TERM=xterm-256color - - OPENCLAW_GATEWAY_BIND=${OPENCLAW_GATEWAY_BIND} - - OPENCLAW_GATEWAY_PORT=${OPENCLAW_GATEWAY_PORT} - - OPENCLAW_GATEWAY_TOKEN=${OPENCLAW_GATEWAY_TOKEN} - - GOG_KEYRING_PASSWORD=${GOG_KEYRING_PASSWORD} - - XDG_CONFIG_HOME=${XDG_CONFIG_HOME} - - PATH=/home/linuxbrew/.linuxbrew/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - volumes: - - ${OPENCLAW_CONFIG_DIR}:/home/node/.openclaw - - ${OPENCLAW_WORKSPACE_DIR}:/home/node/.openclaw/workspace - ports: - # Recommended: keep the Gateway loopback-only on the VM; access via SSH tunnel. - # To expose it publicly, remove the `127.0.0.1:` prefix and firewall accordingly. - - "127.0.0.1:${OPENCLAW_GATEWAY_PORT}:18789" - command: - [ - "node", - "dist/index.js", - "gateway", - "--bind", - "${OPENCLAW_GATEWAY_BIND}", - "--port", - "${OPENCLAW_GATEWAY_PORT}", - ] -``` + + + + Create an SSH tunnel to forward the Gateway port: ---- + ```bash + gcloud compute ssh openclaw-gateway --zone=us-central1-a -- -L 18789:127.0.0.1:18789 + ``` + + Open in your browser: -## 10) Shared Docker VM runtime steps + `http://127.0.0.1:18789/` + + Fetch a fresh tokenized dashboard link: -Use the shared runtime guide for the common Docker host flow: + ```bash + docker compose run --rm openclaw-cli dashboard --no-open + ``` -- [Bake required binaries into the image](/install/docker-vm-runtime#bake-required-binaries-into-the-image) -- [Build and launch](/install/docker-vm-runtime#build-and-launch) -- [What persists where](/install/docker-vm-runtime#what-persists-where) -- [Updates](/install/docker-vm-runtime#updates) + Paste the token from that URL. + + If Control UI shows `unauthorized` or `disconnected (1008): pairing required`, approve the browser device: ---- - -## 11) GCP-specific launch notes - -On GCP, if build fails with `Killed` or `exit code 137` during `pnpm install --frozen-lockfile`, the VM is out of memory. Use `e2-small` minimum, or `e2-medium` for more reliable first builds. - -When binding to LAN (`OPENCLAW_GATEWAY_BIND=lan`), configure a trusted browser origin before continuing: - -```bash -docker compose run --rm openclaw-cli config set gateway.controlUi.allowedOrigins '["http://127.0.0.1:18789"]' --strict-json -``` - -If you changed the gateway port, replace `18789` with your configured port. - -## 12) Access from your laptop - -Create an SSH tunnel to forward the Gateway port: - -```bash -gcloud compute ssh openclaw-gateway --zone=us-central1-a -- -L 18789:127.0.0.1:18789 -``` - -Open in your browser: - -`http://127.0.0.1:18789/` - -Fetch a fresh tokenized dashboard link: - -```bash -docker compose run --rm openclaw-cli dashboard --no-open -``` - -Paste the token from that URL. - -If Control UI shows `unauthorized` or `disconnected (1008): pairing required`, approve the browser device: - -```bash -docker compose run --rm openclaw-cli devices list -docker compose run --rm openclaw-cli devices approve -``` - -Need the shared persistence and update reference again? -See [Docker VM Runtime](/install/docker-vm-runtime#what-persists-where) and [Docker VM Runtime updates](/install/docker-vm-runtime#updates). + ```bash + docker compose run --rm openclaw-cli devices list + docker compose run --rm openclaw-cli devices approve + ``` + + Need the shared persistence and update reference again? + See [Docker VM Runtime](/install/docker-vm-runtime#what-persists-where) and [Docker VM Runtime updates](/install/docker-vm-runtime#updates). + + + --- diff --git a/docs/install/hetzner.md b/docs/install/hetzner.md index 46bc76d6243..b123b3d92f6 100644 --- a/docs/install/hetzner.md +++ b/docs/install/hetzner.md @@ -72,162 +72,156 @@ For the generic Docker flow, see [Docker](/install/docker). --- -## 1) Provision the VPS + + + Create an Ubuntu or Debian VPS in Hetzner. -Create an Ubuntu or Debian VPS in Hetzner. + Connect as root: -Connect as root: + ```bash + ssh root@YOUR_VPS_IP + ``` -```bash -ssh root@YOUR_VPS_IP -``` + This guide assumes the VPS is stateful. + Do not treat it as disposable infrastructure. -This guide assumes the VPS is stateful. -Do not treat it as disposable infrastructure. + ---- + + ```bash + apt-get update + apt-get install -y git curl ca-certificates + curl -fsSL https://get.docker.com | sh + ``` -## 2) Install Docker (on the VPS) + Verify: -```bash -apt-get update -apt-get install -y git curl ca-certificates -curl -fsSL https://get.docker.com | sh -``` + ```bash + docker --version + docker compose version + ``` -Verify: + -```bash -docker --version -docker compose version -``` + + ```bash + git clone https://github.com/openclaw/openclaw.git + cd openclaw + ``` ---- + This guide assumes you will build a custom image to guarantee binary persistence. -## 3) Clone the OpenClaw repository + -```bash -git clone https://github.com/openclaw/openclaw.git -cd openclaw -``` + + Docker containers are ephemeral. + All long-lived state must live on the host. -This guide assumes you will build a custom image to guarantee binary persistence. + ```bash + mkdir -p /root/.openclaw/workspace ---- + # Set ownership to the container user (uid 1000): + chown -R 1000:1000 /root/.openclaw + ``` -## 4) Create persistent host directories + -Docker containers are ephemeral. -All long-lived state must live on the host. + + Create `.env` in the repository root. -```bash -mkdir -p /root/.openclaw/workspace + ```bash + OPENCLAW_IMAGE=openclaw:latest + OPENCLAW_GATEWAY_TOKEN=change-me-now + OPENCLAW_GATEWAY_BIND=lan + OPENCLAW_GATEWAY_PORT=18789 -# Set ownership to the container user (uid 1000): -chown -R 1000:1000 /root/.openclaw -``` + OPENCLAW_CONFIG_DIR=/root/.openclaw + OPENCLAW_WORKSPACE_DIR=/root/.openclaw/workspace ---- + GOG_KEYRING_PASSWORD=change-me-now + XDG_CONFIG_HOME=/home/node/.openclaw + ``` -## 5) Configure environment variables + Generate strong secrets: -Create `.env` in the repository root. + ```bash + openssl rand -hex 32 + ``` -```bash -OPENCLAW_IMAGE=openclaw:latest -OPENCLAW_GATEWAY_TOKEN=change-me-now -OPENCLAW_GATEWAY_BIND=lan -OPENCLAW_GATEWAY_PORT=18789 + **Do not commit this file.** -OPENCLAW_CONFIG_DIR=/root/.openclaw -OPENCLAW_WORKSPACE_DIR=/root/.openclaw/workspace + -GOG_KEYRING_PASSWORD=change-me-now -XDG_CONFIG_HOME=/home/node/.openclaw -``` + + Create or update `docker-compose.yml`. -Generate strong secrets: + ```yaml + services: + openclaw-gateway: + image: ${OPENCLAW_IMAGE} + build: . + restart: unless-stopped + env_file: + - .env + environment: + - HOME=/home/node + - NODE_ENV=production + - TERM=xterm-256color + - OPENCLAW_GATEWAY_BIND=${OPENCLAW_GATEWAY_BIND} + - OPENCLAW_GATEWAY_PORT=${OPENCLAW_GATEWAY_PORT} + - OPENCLAW_GATEWAY_TOKEN=${OPENCLAW_GATEWAY_TOKEN} + - GOG_KEYRING_PASSWORD=${GOG_KEYRING_PASSWORD} + - XDG_CONFIG_HOME=${XDG_CONFIG_HOME} + - PATH=/home/linuxbrew/.linuxbrew/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + volumes: + - ${OPENCLAW_CONFIG_DIR}:/home/node/.openclaw + - ${OPENCLAW_WORKSPACE_DIR}:/home/node/.openclaw/workspace + ports: + # Recommended: keep the Gateway loopback-only on the VPS; access via SSH tunnel. + # To expose it publicly, remove the `127.0.0.1:` prefix and firewall accordingly. + - "127.0.0.1:${OPENCLAW_GATEWAY_PORT}:18789" + command: + [ + "node", + "dist/index.js", + "gateway", + "--bind", + "${OPENCLAW_GATEWAY_BIND}", + "--port", + "${OPENCLAW_GATEWAY_PORT}", + "--allow-unconfigured", + ] + ``` -```bash -openssl rand -hex 32 -``` + `--allow-unconfigured` is only for bootstrap convenience, it is not a replacement for a proper gateway configuration. Still set auth (`gateway.auth.token` or password) and use safe bind settings for your deployment. -**Do not commit this file.** + ---- + + Use the shared runtime guide for the common Docker host flow: -## 6) Docker Compose configuration + - [Bake required binaries into the image](/install/docker-vm-runtime#bake-required-binaries-into-the-image) + - [Build and launch](/install/docker-vm-runtime#build-and-launch) + - [What persists where](/install/docker-vm-runtime#what-persists-where) + - [Updates](/install/docker-vm-runtime#updates) -Create or update `docker-compose.yml`. + -```yaml -services: - openclaw-gateway: - image: ${OPENCLAW_IMAGE} - build: . - restart: unless-stopped - env_file: - - .env - environment: - - HOME=/home/node - - NODE_ENV=production - - TERM=xterm-256color - - OPENCLAW_GATEWAY_BIND=${OPENCLAW_GATEWAY_BIND} - - OPENCLAW_GATEWAY_PORT=${OPENCLAW_GATEWAY_PORT} - - OPENCLAW_GATEWAY_TOKEN=${OPENCLAW_GATEWAY_TOKEN} - - GOG_KEYRING_PASSWORD=${GOG_KEYRING_PASSWORD} - - XDG_CONFIG_HOME=${XDG_CONFIG_HOME} - - PATH=/home/linuxbrew/.linuxbrew/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - volumes: - - ${OPENCLAW_CONFIG_DIR}:/home/node/.openclaw - - ${OPENCLAW_WORKSPACE_DIR}:/home/node/.openclaw/workspace - ports: - # Recommended: keep the Gateway loopback-only on the VPS; access via SSH tunnel. - # To expose it publicly, remove the `127.0.0.1:` prefix and firewall accordingly. - - "127.0.0.1:${OPENCLAW_GATEWAY_PORT}:18789" - command: - [ - "node", - "dist/index.js", - "gateway", - "--bind", - "${OPENCLAW_GATEWAY_BIND}", - "--port", - "${OPENCLAW_GATEWAY_PORT}", - "--allow-unconfigured", - ] -``` + + After the shared build and launch steps, tunnel from your laptop: -`--allow-unconfigured` is only for bootstrap convenience, it is not a replacement for a proper gateway configuration. Still set auth (`gateway.auth.token` or password) and use safe bind settings for your deployment. + ```bash + ssh -N -L 18789:127.0.0.1:18789 root@YOUR_VPS_IP + ``` ---- + Open: -## 7) Shared Docker VM runtime steps + `http://127.0.0.1:18789/` -Use the shared runtime guide for the common Docker host flow: + Paste your gateway token. -- [Bake required binaries into the image](/install/docker-vm-runtime#bake-required-binaries-into-the-image) -- [Build and launch](/install/docker-vm-runtime#build-and-launch) -- [What persists where](/install/docker-vm-runtime#what-persists-where) -- [Updates](/install/docker-vm-runtime#updates) - ---- - -## 8) Hetzner-specific access - -After the shared build and launch steps, tunnel from your laptop: - -```bash -ssh -N -L 18789:127.0.0.1:18789 root@YOUR_VPS_IP -``` - -Open: - -`http://127.0.0.1:18789/` - -Paste your gateway token. - ---- + + The shared persistence map lives in [Docker VM Runtime](/install/docker-vm-runtime#what-persists-where). @@ -249,3 +243,9 @@ For teams preferring infrastructure-as-code workflows, a community-maintained Te This approach complements the Docker setup above with reproducible deployments, version-controlled infrastructure, and automated disaster recovery. > **Note:** Community-maintained. For issues or contributions, see the repository links above. + +## Next steps + +- Set up messaging channels: [Channels](/channels) +- Configure the Gateway: [Gateway configuration](/gateway/configuration) +- Keep OpenClaw up to date: [Updating](/install/updating) diff --git a/docs/install/index.md b/docs/install/index.md index 7130cf9faac..8830e377059 100644 --- a/docs/install/index.md +++ b/docs/install/index.md @@ -9,158 +9,113 @@ title: "Install" # Install -Already followed [Getting Started](/start/getting-started)? You're all set — this page is for alternative install methods, platform-specific instructions, and maintenance. +## Recommended: installer script + +The fastest way to install. It detects your OS, installs Node if needed, installs OpenClaw, and launches onboarding. + + + + ```bash + curl -fsSL https://openclaw.ai/install.sh | bash + ``` + + + ```powershell + iwr -useb https://openclaw.ai/install.ps1 | iex + ``` + + + +To install without running onboarding: + + + + ```bash + curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard + ``` + + + ```powershell + & ([scriptblock]::Create((iwr -useb https://openclaw.ai/install.ps1))) -NoOnboard + ``` + + + +For all flags and CI/automation options, see [Installer internals](/install/installer). ## System requirements -- **[Node 24 (recommended)](/install/node)** (Node 22 LTS, currently `22.16+`, is still supported for compatibility; the [installer script](#install-methods) will install Node 24 if missing) -- macOS, Linux, or Windows -- `pnpm` only if you build from source +- **Node 24** (recommended) or Node 22.16+ — the installer script handles this automatically +- **macOS, Linux, or Windows** — both native Windows and WSL2 are supported; WSL2 is more stable. See [Windows](/platforms/windows). +- `pnpm` is only needed if you build from source - -On Windows, we strongly recommend running OpenClaw under [WSL2](https://learn.microsoft.com/en-us/windows/wsl/install). - +## Alternative install methods -## Install methods +### npm or pnpm - -The **installer script** is the recommended way to install OpenClaw. It handles Node detection, installation, and onboarding in one step. - - - -For VPS/cloud hosts, avoid third-party "1-click" marketplace images when possible. Prefer a clean base OS image (for example Ubuntu LTS), then install OpenClaw yourself with the installer script. - - - - - Downloads the CLI, installs it globally via npm, and launches onboarding. - - - - ```bash - curl -fsSL https://openclaw.ai/install.sh | bash - ``` - - - ```powershell - iwr -useb https://openclaw.ai/install.ps1 | iex - ``` - - - - That's it — the script handles Node detection, installation, and onboarding. - - To skip onboarding and just install the binary: - - - - ```bash - curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard - ``` - - - ```powershell - & ([scriptblock]::Create((iwr -useb https://openclaw.ai/install.ps1))) -NoOnboard - ``` - - - - For all flags, env vars, and CI/automation options, see [Installer internals](/install/installer). - - - - - If you already manage Node yourself, we recommend Node 24. OpenClaw still supports Node 22 LTS, currently `22.16+`, for compatibility: - - - - ```bash - npm install -g openclaw@latest - openclaw onboard --install-daemon - ``` - - - If you have libvips installed globally (common on macOS via Homebrew) and `sharp` fails, force prebuilt binaries: - - ```bash - SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install -g openclaw@latest - ``` - - If you see `sharp: Please add node-gyp to your dependencies`, either install build tooling (macOS: Xcode CLT + `npm install -g node-gyp`) or use the env var above. - - - - ```bash - pnpm add -g openclaw@latest - pnpm approve-builds -g # approve openclaw, node-llama-cpp, sharp, etc. - openclaw onboard --install-daemon - ``` - - - pnpm requires explicit approval for packages with build scripts. After the first install shows the "Ignored build scripts" warning, run `pnpm approve-builds -g` and select the listed packages. - - - - - Want the current GitHub `main` head with a package-manager install? +If you already manage Node yourself: + + ```bash - npm install -g github:openclaw/openclaw#main + npm install -g openclaw@latest + openclaw onboard --install-daemon + ``` + + + ```bash + pnpm add -g openclaw@latest + pnpm approve-builds -g + openclaw onboard --install-daemon ``` - ```bash - pnpm add -g github:openclaw/openclaw#main - ``` + + pnpm requires explicit approval for packages with build scripts. Run `pnpm approve-builds -g` after the first install. + - + + - - For contributors or anyone who wants to run from a local checkout. + + If `sharp` fails due to a globally installed libvips: - - - Clone the [OpenClaw repo](https://github.com/openclaw/openclaw) and build: +```bash +SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install -g openclaw@latest +``` - ```bash - git clone https://github.com/openclaw/openclaw.git - cd openclaw - pnpm install - pnpm ui:build - pnpm build - ``` - - - Make the `openclaw` command available globally: + - ```bash - pnpm link --global - ``` +### From source - Alternatively, skip the link and run commands via `pnpm openclaw ...` from inside the repo. - - - ```bash - openclaw onboard --install-daemon - ``` - - +For contributors or anyone who wants to run from a local checkout: - For deeper development workflows, see [Setup](/start/setup). +```bash +git clone https://github.com/openclaw/openclaw.git +cd openclaw +pnpm install && pnpm ui:build && pnpm build +pnpm link --global +openclaw onboard --install-daemon +``` - - +Or skip the link and use `pnpm openclaw ...` from inside the repo. See [Setup](/start/setup) for full development workflows. -## Other install methods +### Install from GitHub main + +```bash +npm install -g github:openclaw/openclaw#main +``` + +### Containers and package managers Containerized or headless deployments. - Rootless container: run `setup-podman.sh` once, then the launch script. + Rootless container alternative to Docker. - Declarative install via Nix. + Declarative install via Nix flake. Automated fleet provisioning. @@ -170,50 +125,32 @@ For VPS/cloud hosts, avoid third-party "1-click" marketplace images when possibl -## After install - -Verify everything is working: +## Verify the install ```bash +openclaw --version # confirm the CLI is available openclaw doctor # check for config issues -openclaw status # gateway status -openclaw dashboard # open the browser UI +openclaw gateway status # verify the Gateway is running ``` -If you need custom runtime paths, use: +## Hosting and deployment -- `OPENCLAW_HOME` for home-directory based internal paths -- `OPENCLAW_STATE_DIR` for mutable state location -- `OPENCLAW_CONFIG_PATH` for config file location +Deploy OpenClaw on a cloud server or VPS: -See [Environment vars](/help/environment) for precedence and full details. + + Any Linux VPS + Shared Docker steps + K8s + Fly.io + Hetzner + Google Cloud + Azure + Railway + Render + Northflank + -## Troubleshooting: `openclaw` not found - - - Quick diagnosis: - -```bash -node -v -npm -v -npm prefix -g -echo "$PATH" -``` - -If `$(npm prefix -g)/bin` (macOS/Linux) or `$(npm prefix -g)` (Windows) is **not** in your `$PATH`, your shell can't find global npm binaries (including `openclaw`). - -Fix — add it to your shell startup file (`~/.zshrc` or `~/.bashrc`): - -```bash -export PATH="$(npm prefix -g)/bin:$PATH" -``` - -On Windows, add the output of `npm prefix -g` to your PATH. - -Then open a new terminal (or `rehash` in zsh / `hash -r` in bash). - - -## Update / uninstall +## Update, migrate, or uninstall @@ -226,3 +163,21 @@ Then open a new terminal (or `rehash` in zsh / `hash -r` in bash). Remove OpenClaw completely. + +## Troubleshooting: `openclaw` not found + +If the install succeeded but `openclaw` is not found in your terminal: + +```bash +node -v # Node installed? +npm prefix -g # Where are global packages? +echo "$PATH" # Is the global bin dir in PATH? +``` + +If `$(npm prefix -g)/bin` is not in your `$PATH`, add it to your shell startup file (`~/.zshrc` or `~/.bashrc`): + +```bash +export PATH="$(npm prefix -g)/bin:$PATH" +``` + +Then open a new terminal. See [Node setup](/install/node) for more details. diff --git a/docs/install/installer.md b/docs/install/installer.md index 5859c22fd0d..f32fe2de198 100644 --- a/docs/install/installer.md +++ b/docs/install/installer.md @@ -180,7 +180,7 @@ Designed for environments where you want everything under a local prefix (defaul - Downloads a pinned supported Node tarball (currently default `22.22.0`) to `/tools/node-v` and verifies SHA-256. + Downloads a pinned supported Node LTS tarball (the version is embedded in the script and updated independently) to `/tools/node-v` and verifies SHA-256. If Git is missing, attempts install via apt/dnf/yum on Linux or Homebrew on macOS. diff --git a/docs/install/kubernetes.md b/docs/install/kubernetes.md index 577ff9d2df5..a11f0b6dcc5 100644 --- a/docs/install/kubernetes.md +++ b/docs/install/kubernetes.md @@ -138,7 +138,7 @@ OPENCLAW_NAMESPACE=my-namespace ./scripts/k8s/deploy.sh Edit the `image` field in `scripts/k8s/manifests/deployment.yaml`: ```yaml -image: ghcr.io/openclaw/openclaw:2026.3.1 +image: ghcr.io/openclaw/openclaw:latest # or pin to a specific version from https://github.com/openclaw/openclaw/releases ``` ### Expose beyond port-forward diff --git a/docs/install/macos-vm.md b/docs/install/macos-vm.md index 2bbd8e65051..2e4fd5184f1 100644 --- a/docs/install/macos-vm.md +++ b/docs/install/macos-vm.md @@ -155,17 +155,17 @@ nano ~/.openclaw/openclaw.json Add your channels: -```json +```json5 { - "channels": { - "whatsapp": { - "dmPolicy": "allowlist", - "allowFrom": ["+15551234567"] + channels: { + whatsapp: { + dmPolicy: "allowlist", + allowFrom: ["+15551234567"], }, - "telegram": { - "botToken": "YOUR_BOT_TOKEN" - } - } + telegram: { + botToken: "YOUR_BOT_TOKEN", + }, + }, } ``` @@ -209,15 +209,15 @@ Inside the VM: Add to your OpenClaw config: -```json +```json5 { - "channels": { - "bluebubbles": { - "serverUrl": "http://localhost:1234", - "password": "your-api-password", - "webhookPath": "/bluebubbles-webhook" - } - } + channels: { + bluebubbles: { + serverUrl: "http://localhost:1234", + password: "your-api-password", + webhookPath: "/bluebubbles-webhook", + }, + }, } ``` diff --git a/docs/install/migrating-matrix.md b/docs/install/migrating-matrix.md index d1e85c5ecd1..bd8772e29f6 100644 --- a/docs/install/migrating-matrix.md +++ b/docs/install/migrating-matrix.md @@ -204,7 +204,9 @@ If the old store reports room keys that were never backed up, OpenClaw warns ins - Meaning: OpenClaw found a helper file path that escapes the plugin root or fails plugin boundary checks, so it refused to import it. - What to do: reinstall the Matrix plugin from a trusted path, then rerun `openclaw doctor --fix` or restart the gateway. -`gateway: failed creating a Matrix migration snapshot; skipping Matrix migration for now: ...` +`- Failed creating a Matrix migration snapshot before repair: ...` + +`- Skipping Matrix migration changes for now. Resolve the snapshot failure, then rerun "openclaw doctor --fix".` - Meaning: OpenClaw refused to mutate Matrix state because it could not create the recovery snapshot first. - What to do: resolve the backup error, then rerun `openclaw doctor --fix` or restart the gateway. @@ -236,7 +238,7 @@ If the old store reports room keys that were never backed up, OpenClaw warns ins - Meaning: backup exists, but OpenClaw could not recover the recovery key automatically. - What to do: run `openclaw matrix verify backup restore --recovery-key ""`. -`Failed inspecting legacy Matrix encrypted state for account "...": ...` +`Failed inspecting legacy Matrix encrypted state for account "..." (...): ...` - Meaning: OpenClaw found the old encrypted store, but it could not inspect it safely enough to prepare recovery. - What to do: rerun `openclaw doctor --fix`. If it repeats, keep the old state directory intact and recover using another verified Matrix client plus `openclaw matrix verify backup restore --recovery-key ""`. diff --git a/docs/install/migrating.md b/docs/install/migrating.md index 64c136be425..49e8e7606bb 100644 --- a/docs/install/migrating.md +++ b/docs/install/migrating.md @@ -6,187 +6,105 @@ read_when: title: "Migration Guide" --- -# Migrating OpenClaw to a new machine +# Migrating OpenClaw to a New Machine -This guide migrates an OpenClaw Gateway from one machine to another **without redoing onboarding**. +This guide moves an OpenClaw gateway to a new machine without redoing onboarding. -The migration is simple conceptually: +## What Gets Migrated -- Copy the **state directory** (`$OPENCLAW_STATE_DIR`, default: `~/.openclaw/`) — this includes config, auth, sessions, and channel state. -- Copy your **workspace** (`~/.openclaw/workspace/` by default) — this includes your agent files (memory, prompts, etc.). +When you copy the **state directory** (`~/.openclaw/` by default) and your **workspace**, you preserve: -But there are common footguns around **profiles**, **permissions**, and **partial copies**. +- **Config** -- `openclaw.json` and all gateway settings +- **Auth** -- API keys, OAuth tokens, credential profiles +- **Sessions** -- conversation history and agent state +- **Channel state** -- WhatsApp login, Telegram session, etc. +- **Workspace files** -- `MEMORY.md`, `USER.md`, skills, and prompts -## Before you start (what you are migrating) + +Run `openclaw status` on the old machine to confirm your state directory path. +Custom profiles use `~/.openclaw-/` or a path set via `OPENCLAW_STATE_DIR`. + -### 1) Identify your state directory +## Migration Steps -Most installs use the default: + + + On the **old** machine, stop the gateway so files are not changing mid-copy, then archive: -- **State dir:** `~/.openclaw/` + ```bash + openclaw gateway stop + cd ~ + tar -czf openclaw-state.tgz .openclaw + ``` -But it may be different if you use: + If you use multiple profiles (e.g. `~/.openclaw-work`), archive each separately. -- `--profile ` (often becomes `~/.openclaw-/`) -- `OPENCLAW_STATE_DIR=/some/path` + -If you’re not sure, run on the **old** machine: + + [Install](/install) the CLI (and Node if needed) on the new machine. + It is fine if onboarding creates a fresh `~/.openclaw/` -- you will overwrite it next. + -```bash -openclaw status -``` + + Transfer the archive via `scp`, `rsync -a`, or an external drive, then extract: -Look for mentions of `OPENCLAW_STATE_DIR` / profile in the output. If you run multiple gateways, repeat for each profile. + ```bash + cd ~ + tar -xzf openclaw-state.tgz + ``` -### 2) Identify your workspace + Ensure hidden directories were included and file ownership matches the user that will run the gateway. -Common defaults: + -- `~/.openclaw/workspace/` (recommended workspace) -- a custom folder you created + + On the new machine, run [Doctor](/gateway/doctor) to apply config migrations and repair services: -Your workspace is where files like `MEMORY.md`, `USER.md`, and `memory/*.md` live. + ```bash + openclaw doctor + openclaw gateway restart + openclaw status + ``` -### 3) Understand what you will preserve + + -If you copy **both** the state dir and workspace, you keep: +## Common Pitfalls -- Gateway configuration (`openclaw.json`) -- Auth profiles / API keys / OAuth tokens -- Session history + agent state -- Channel state (e.g. WhatsApp login/session) -- Your workspace files (memory, skills notes, etc.) + + + If the old gateway used `--profile` or `OPENCLAW_STATE_DIR` and the new one does not, + channels will appear logged out and sessions will be empty. + Launch the gateway with the **same** profile or state-dir you migrated, then rerun `openclaw doctor`. + -If you copy **only** the workspace (e.g., via Git), you do **not** preserve: + + The config file alone is not enough. Credentials live under `credentials/`, and agent + state lives under `agents/`. Always migrate the **entire** state directory. + -- sessions -- credentials -- channel logins + + If you copied as root or switched users, the gateway may fail to read credentials. + Ensure the state directory and workspace are owned by the user running the gateway. + -Those live under `$OPENCLAW_STATE_DIR`. + + If your UI points at a **remote** gateway, the remote host owns sessions and workspace. + Migrate the gateway host itself, not your local laptop. See [FAQ](/help/faq#where-does-openclaw-store-its-data). + -## Migration steps (recommended) + + The state directory contains API keys, OAuth tokens, and channel credentials. + Store backups encrypted, avoid insecure transfer channels, and rotate keys if you suspect exposure. + + -### Step 0 - Make a backup (old machine) - -On the **old** machine, stop the gateway first so files aren’t changing mid-copy: - -```bash -openclaw gateway stop -``` - -(Optional but recommended) archive the state dir and workspace: - -```bash -# Adjust paths if you use a profile or custom locations -cd ~ -tar -czf openclaw-state.tgz .openclaw - -tar -czf openclaw-workspace.tgz .openclaw/workspace -``` - -If you have multiple profiles/state dirs (e.g. `~/.openclaw-main`, `~/.openclaw-work`), archive each. - -### Step 1 - Install OpenClaw on the new machine - -On the **new** machine, install the CLI (and Node if needed): - -- See: [Install](/install) - -At this stage, it’s OK if onboarding creates a fresh `~/.openclaw/` — you will overwrite it in the next step. - -### Step 2 - Copy the state dir + workspace to the new machine - -Copy **both**: - -- `$OPENCLAW_STATE_DIR` (default `~/.openclaw/`) -- your workspace (default `~/.openclaw/workspace/`) - -Common approaches: - -- `scp` the tarballs and extract -- `rsync -a` over SSH -- external drive - -After copying, ensure: - -- Hidden directories were included (e.g. `.openclaw/`) -- File ownership is correct for the user running the gateway - -### Step 3 - Run Doctor (migrations + service repair) - -On the **new** machine: - -```bash -openclaw doctor -``` - -Doctor is the “safe boring” command. It repairs services, applies config migrations, and warns about mismatches. - -Then: - -```bash -openclaw gateway restart -openclaw status -``` - -## Common footguns (and how to avoid them) - -### Footgun: profile / state-dir mismatch - -If you ran the old gateway with a profile (or `OPENCLAW_STATE_DIR`), and the new gateway uses a different one, you’ll see symptoms like: - -- config changes not taking effect -- channels missing / logged out -- empty session history - -Fix: run the gateway/service using the **same** profile/state dir you migrated, then rerun: - -```bash -openclaw doctor -``` - -### Footgun: copying only `openclaw.json` - -`openclaw.json` is not enough. Many providers store state under: - -- `$OPENCLAW_STATE_DIR/credentials/` -- `$OPENCLAW_STATE_DIR/agents//...` - -Always migrate the entire `$OPENCLAW_STATE_DIR` folder. - -### Footgun: permissions / ownership - -If you copied as root or changed users, the gateway may fail to read credentials/sessions. - -Fix: ensure the state dir + workspace are owned by the user running the gateway. - -### Footgun: migrating between remote/local modes - -- If your UI (WebUI/TUI) points at a **remote** gateway, the remote host owns the session store + workspace. -- Migrating your laptop won’t move the remote gateway’s state. - -If you’re in remote mode, migrate the **gateway host**. - -### Footgun: secrets in backups - -`$OPENCLAW_STATE_DIR` contains secrets (API keys, OAuth tokens, WhatsApp creds). Treat backups like production secrets: - -- store encrypted -- avoid sharing over insecure channels -- rotate keys if you suspect exposure - -## Verification checklist +## Verification Checklist On the new machine, confirm: -- `openclaw status` shows the gateway running -- Your channels are still connected (e.g. WhatsApp doesn’t require re-pair) -- The dashboard opens and shows existing sessions -- Your workspace files (memory, configs) are present - -## Related - -- [Doctor](/gateway/doctor) -- [Gateway troubleshooting](/gateway/troubleshooting) -- [Where does OpenClaw store its data?](/help/faq#where-does-openclaw-store-its-data) +- [ ] `openclaw status` shows the gateway running +- [ ] Channels are still connected (no re-pairing needed) +- [ ] The dashboard opens and shows existing sessions +- [ ] Workspace files (memory, configs) are present diff --git a/docs/install/nix.md b/docs/install/nix.md index 4f5823645b6..371cee007a2 100644 --- a/docs/install/nix.md +++ b/docs/install/nix.md @@ -9,90 +9,81 @@ title: "Nix" # Nix Installation -The recommended way to run OpenClaw with Nix is via **[nix-openclaw](https://github.com/openclaw/nix-openclaw)** — a batteries-included Home Manager module. +Install OpenClaw declaratively with **[nix-openclaw](https://github.com/openclaw/nix-openclaw)** -- a batteries-included Home Manager module. -## Quick Start + +The [nix-openclaw](https://github.com/openclaw/nix-openclaw) repo is the source of truth for Nix installation. This page is a quick overview. + -Paste this to your AI agent (Claude, Cursor, etc.): +## What You Get -```text -I want to set up nix-openclaw on my Mac. -Repository: github:openclaw/nix-openclaw - -What I need you to do: -1. Check if Determinate Nix is installed (if not, install it) -2. Create a local flake at ~/code/openclaw-local using templates/agent-first/flake.nix -3. Help me create a Telegram bot (@BotFather) and get my chat ID (@userinfobot) -4. Set up secrets (bot token, model provider API key) - plain files at ~/.secrets/ is fine -5. Fill in the template placeholders and run home-manager switch -6. Verify: launchd running, bot responds to messages - -Reference the nix-openclaw README for module options. -``` - -> **📦 Full guide: [github.com/openclaw/nix-openclaw](https://github.com/openclaw/nix-openclaw)** -> -> The nix-openclaw repo is the source of truth for Nix installation. This page is just a quick overview. - -## What you get - -- Gateway + macOS app + tools (whisper, spotify, cameras) — all pinned +- Gateway + macOS app + tools (whisper, spotify, cameras) -- all pinned - Launchd service that survives reboots - Plugin system with declarative config - Instant rollback: `home-manager switch --rollback` ---- +## Quick Start + + + + If Nix is not already installed, follow the [Determinate Nix installer](https://github.com/DeterminateSystems/nix-installer) instructions. + + + Use the agent-first template from the nix-openclaw repo: + ```bash + mkdir -p ~/code/openclaw-local + # Copy templates/agent-first/flake.nix from the nix-openclaw repo + ``` + + + Set up your messaging bot token and model provider API key. Plain files at `~/.secrets/` work fine. + + + ```bash + home-manager switch + ``` + + + Confirm the launchd service is running and your bot responds to messages. + + + +See the [nix-openclaw README](https://github.com/openclaw/nix-openclaw) for full module options and examples. ## Nix Mode Runtime Behavior -When `OPENCLAW_NIX_MODE=1` is set (automatic with nix-openclaw): +When `OPENCLAW_NIX_MODE=1` is set (automatic with nix-openclaw), OpenClaw enters a deterministic mode that disables auto-install flows. -OpenClaw supports a **Nix mode** that makes configuration deterministic and disables auto-install flows. -Enable it by exporting: +You can also set it manually: ```bash -OPENCLAW_NIX_MODE=1 +export OPENCLAW_NIX_MODE=1 ``` -On macOS, the GUI app does not automatically inherit shell env vars. You can -also enable Nix mode via defaults: +On macOS, the GUI app does not automatically inherit shell environment variables. Enable Nix mode via defaults instead: ```bash defaults write ai.openclaw.mac openclaw.nixMode -bool true ``` -### Config + state paths - -OpenClaw reads JSON5 config from `OPENCLAW_CONFIG_PATH` and stores mutable data in `OPENCLAW_STATE_DIR`. -When needed, you can also set `OPENCLAW_HOME` to control the base home directory used for internal path resolution. - -- `OPENCLAW_HOME` (default precedence: `HOME` / `USERPROFILE` / `os.homedir()`) -- `OPENCLAW_STATE_DIR` (default: `~/.openclaw`) -- `OPENCLAW_CONFIG_PATH` (default: `$OPENCLAW_STATE_DIR/openclaw.json`) - -When running under Nix, set these explicitly to Nix-managed locations so runtime state and config -stay out of the immutable store. - -### Runtime behavior in Nix mode +### What changes in Nix mode - Auto-install and self-mutation flows are disabled - Missing dependencies surface Nix-specific remediation messages -- UI surfaces a read-only Nix mode banner when present +- UI surfaces a read-only Nix mode banner -## Packaging note (macOS) +### Config and state paths -The macOS packaging flow expects a stable Info.plist template at: +OpenClaw reads JSON5 config from `OPENCLAW_CONFIG_PATH` and stores mutable data in `OPENCLAW_STATE_DIR`. When running under Nix, set these explicitly to Nix-managed locations so runtime state and config stay out of the immutable store. -``` -apps/macos/Sources/OpenClaw/Resources/Info.plist -``` - -[`scripts/package-mac-app.sh`](https://github.com/openclaw/openclaw/blob/main/scripts/package-mac-app.sh) copies this template into the app bundle and patches dynamic fields -(bundle ID, version/build, Git SHA, Sparkle keys). This keeps the plist deterministic for SwiftPM -packaging and Nix builds (which do not rely on a full Xcode toolchain). +| Variable | Default | +| ---------------------- | --------------------------------------- | +| `OPENCLAW_HOME` | `HOME` / `USERPROFILE` / `os.homedir()` | +| `OPENCLAW_STATE_DIR` | `~/.openclaw` | +| `OPENCLAW_CONFIG_PATH` | `$OPENCLAW_STATE_DIR/openclaw.json` | ## Related -- [nix-openclaw](https://github.com/openclaw/nix-openclaw) — full setup guide -- [Wizard](/start/wizard) — non-Nix CLI setup -- [Docker](/install/docker) — containerized setup +- [nix-openclaw](https://github.com/openclaw/nix-openclaw) -- full setup guide +- [Wizard](/start/wizard) -- non-Nix CLI setup +- [Docker](/install/docker) -- containerized setup diff --git a/docs/install/node.md b/docs/install/node.md index 9cf2f59ec77..6e2f7062c42 100644 --- a/docs/install/node.md +++ b/docs/install/node.md @@ -9,7 +9,7 @@ read_when: # Node.js -OpenClaw requires **Node 22.16 or newer**. **Node 24 is the default and recommended runtime** for installs, CI, and release workflows. Node 22 remains supported via the active LTS line. The [installer script](/install#install-methods) will detect and install Node automatically — this page is for when you want to set up Node yourself and make sure everything is wired up correctly (versions, PATH, global installs). +OpenClaw requires **Node 22.16 or newer**. **Node 24 is the default and recommended runtime** for installs, CI, and release workflows. Node 22 remains supported via the active LTS line. The [installer script](/install#alternative-install-methods) will detect and install Node automatically — this page is for when you want to set up Node yourself and make sure everything is wired up correctly (versions, PATH, global installs). ## Check your version diff --git a/docs/install/northflank.mdx b/docs/install/northflank.mdx index 03a41d1013b..18ca33345af 100644 --- a/docs/install/northflank.mdx +++ b/docs/install/northflank.mdx @@ -1,5 +1,9 @@ --- -title: Deploy on Northflank +summary: "Deploy OpenClaw on Northflank with one-click template" +read_when: + - Deploying OpenClaw to Northflank + - You want a one-click cloud deploy with browser-based setup +title: "Northflank" --- Deploy OpenClaw on Northflank with a one-click template and finish setup in your browser. @@ -34,20 +38,17 @@ and you configure everything via the `/setup` web wizard. If Telegram DMs are set to pairing, web setup can approve the pairing code. -## Getting chat tokens +## Connect a channel -### Telegram bot token +Paste your Telegram or Discord token into the `/setup` wizard. For setup +instructions, see the channel docs: -1. Message `@BotFather` in Telegram -2. Run `/newbot` -3. Copy the token (looks like `123456789:AA...`) -4. Paste it into `/setup` +- [Telegram](/channels/telegram) (fastest — just a bot token) +- [Discord](/channels/discord) +- [All channels](/channels) -### Discord bot token +## Next steps -1. Go to [https://discord.com/developers/applications](https://discord.com/developers/applications) -2. **New Application** → choose a name -3. **Bot** → **Add Bot** -4. **Enable MESSAGE CONTENT INTENT** under Bot → Privileged Gateway Intents (required or the bot will crash on startup) -5. Copy the **Bot Token** and paste into `/setup` -6. Invite the bot to your server (OAuth2 URL Generator; scopes: `bot`, `applications.commands`) +- Set up messaging channels: [Channels](/channels) +- Configure the Gateway: [Gateway configuration](/gateway/configuration) +- Keep OpenClaw up to date: [Updating](/install/updating) diff --git a/docs/install/oracle.md b/docs/install/oracle.md new file mode 100644 index 00000000000..892674b5431 --- /dev/null +++ b/docs/install/oracle.md @@ -0,0 +1,156 @@ +--- +summary: "Host OpenClaw on Oracle Cloud's Always Free ARM tier" +read_when: + - Setting up OpenClaw on Oracle Cloud + - Looking for free VPS hosting for OpenClaw + - Want 24/7 OpenClaw on a small server +title: "Oracle Cloud" +--- + +# Oracle Cloud + +Run a persistent OpenClaw Gateway on Oracle Cloud's **Always Free** ARM tier (up to 4 OCPU, 24 GB RAM, 200 GB storage) at no cost. + +## Prerequisites + +- Oracle Cloud account ([signup](https://www.oracle.com/cloud/free/)) -- see [community signup guide](https://gist.github.com/rssnyder/51e3cfedd730e7dd5f4a816143b25dbd) if you hit issues +- Tailscale account (free at [tailscale.com](https://tailscale.com)) +- An SSH key pair +- About 30 minutes + +## Setup + + + + 1. Log into [Oracle Cloud Console](https://cloud.oracle.com/). + 2. Navigate to **Compute > Instances > Create Instance**. + 3. Configure: + - **Name:** `openclaw` + - **Image:** Ubuntu 24.04 (aarch64) + - **Shape:** `VM.Standard.A1.Flex` (Ampere ARM) + - **OCPUs:** 2 (or up to 4) + - **Memory:** 12 GB (or up to 24 GB) + - **Boot volume:** 50 GB (up to 200 GB free) + - **SSH key:** Add your public key + 4. Click **Create** and note the public IP address. + + + If instance creation fails with "Out of capacity", try a different availability domain or retry later. Free tier capacity is limited. + + + + + + ```bash + ssh ubuntu@YOUR_PUBLIC_IP + + sudo apt update && sudo apt upgrade -y + sudo apt install -y build-essential + ``` + + `build-essential` is required for ARM compilation of some dependencies. + + + + + ```bash + sudo hostnamectl set-hostname openclaw + sudo passwd ubuntu + sudo loginctl enable-linger ubuntu + ``` + + Enabling linger keeps user services running after logout. + + + + + ```bash + curl -fsSL https://tailscale.com/install.sh | sh + sudo tailscale up --ssh --hostname=openclaw + ``` + + From now on, connect via Tailscale: `ssh ubuntu@openclaw`. + + + + + ```bash + curl -fsSL https://openclaw.ai/install.sh | bash + source ~/.bashrc + ``` + + When prompted "How do you want to hatch your bot?", select **Do this later**. + + + + + Use token auth with Tailscale Serve for secure remote access. + + ```bash + openclaw config set gateway.bind loopback + openclaw config set gateway.auth.mode token + openclaw doctor --generate-gateway-token + openclaw config set gateway.tailscale.mode serve + openclaw config set gateway.trustedProxies '["127.0.0.1"]' + + systemctl --user restart openclaw-gateway + ``` + + + + + Block all traffic except Tailscale at the network edge: + + 1. Go to **Networking > Virtual Cloud Networks** in the OCI Console. + 2. Click your VCN, then **Security Lists > Default Security List**. + 3. **Remove** all ingress rules except `0.0.0.0/0 UDP 41641` (Tailscale). + 4. Keep default egress rules (allow all outbound). + + This blocks SSH on port 22, HTTP, HTTPS, and everything else at the network edge. You can only connect via Tailscale from this point on. + + + + + ```bash + openclaw --version + systemctl --user status openclaw-gateway + tailscale serve status + curl http://localhost:18789 + ``` + + Access the Control UI from any device on your tailnet: + + ``` + https://openclaw..ts.net/ + ``` + + Replace `` with your tailnet name (visible in `tailscale status`). + + + + +## Fallback: SSH tunnel + +If Tailscale Serve is not working, use an SSH tunnel from your local machine: + +```bash +ssh -L 18789:127.0.0.1:18789 ubuntu@openclaw +``` + +Then open `http://localhost:18789`. + +## Troubleshooting + +**Instance creation fails ("Out of capacity")** -- Free tier ARM instances are popular. Try a different availability domain or retry during off-peak hours. + +**Tailscale will not connect** -- Run `sudo tailscale up --ssh --hostname=openclaw --reset` to re-authenticate. + +**Gateway will not start** -- Run `openclaw doctor --non-interactive` and check logs with `journalctl --user -u openclaw-gateway -n 50`. + +**ARM binary issues** -- Most npm packages work on ARM64. For native binaries, look for `linux-arm64` or `aarch64` releases. Verify architecture with `uname -m`. + +## Next steps + +- [Channels](/channels) -- connect Telegram, WhatsApp, Discord, and more +- [Gateway configuration](/gateway/configuration) -- all config options +- [Updating](/install/updating) -- keep OpenClaw up to date diff --git a/docs/install/podman.md b/docs/install/podman.md index 888bbc904b9..c21980b5c08 100644 --- a/docs/install/podman.md +++ b/docs/install/podman.md @@ -7,53 +7,64 @@ title: "Podman" # Podman -Run the OpenClaw gateway in a **rootless** Podman container. Uses the same image as Docker (build from the repo [Dockerfile](https://github.com/openclaw/openclaw/blob/main/Dockerfile)). +Run the OpenClaw Gateway in a **rootless** Podman container. Uses the same image as Docker (built from the repo [Dockerfile](https://github.com/openclaw/openclaw/blob/main/Dockerfile)). -## Requirements +## Prerequisites -- Podman (rootless) -- Sudo for one-time setup (create user, build image) +- **Podman** (rootless mode) +- **sudo** access for one-time setup (creating the dedicated user and building the image) ## Quick start -**1. One-time setup** (from repo root; creates user, builds image, installs launch script): + + + From the repo root, run the setup script. It creates a dedicated `openclaw` user, builds the container image, and installs the launch script: -```bash -./setup-podman.sh -``` + ```bash + ./scripts/podman/setup.sh + ``` -This also creates a minimal `~openclaw/.openclaw/openclaw.json` (sets `gateway.mode="local"`) so the gateway can start without running the wizard. + This also creates a minimal config at `~openclaw/.openclaw/openclaw.json` (sets `gateway.mode` to `"local"`) so the Gateway can start without running the wizard. -By default the container is **not** installed as a systemd service, you start it manually (see below). For a production-style setup with auto-start and restarts, install it as a systemd Quadlet user service instead: + By default the container is **not** installed as a systemd service -- you start it manually in the next step. For a production-style setup with auto-start and restarts, pass `--quadlet` instead: -```bash -./setup-podman.sh --quadlet -``` + ```bash + ./scripts/podman/setup.sh --quadlet + ``` -(Or set `OPENCLAW_PODMAN_QUADLET=1`; use `--container` to install only the container and launch script.) + (Or set `OPENCLAW_PODMAN_QUADLET=1`. Use `--container` to install only the container and launch script.) -Optional build-time env vars (set before running `setup-podman.sh`): + **Optional build-time env vars** (set before running `scripts/podman/setup.sh`): -- `OPENCLAW_DOCKER_APT_PACKAGES` — install extra apt packages during image build -- `OPENCLAW_EXTENSIONS` — pre-install extension dependencies (space-separated extension names, e.g. `diagnostics-otel matrix`) + - `OPENCLAW_DOCKER_APT_PACKAGES` -- install extra apt packages during image build. + - `OPENCLAW_EXTENSIONS` -- pre-install extension dependencies (space-separated names, e.g. `diagnostics-otel matrix`). -**2. Start gateway** (manual, for quick smoke testing): + -```bash -./scripts/run-openclaw-podman.sh launch -``` + + For a quick manual launch: -**3. Onboarding wizard** (e.g. to add channels or providers): + ```bash + ./scripts/run-openclaw-podman.sh launch + ``` -```bash -./scripts/run-openclaw-podman.sh launch setup -``` + -Then open `http://127.0.0.1:18789/` and use the token from `~openclaw/.openclaw/.env` (or the value printed by setup). + + To add channels or providers interactively: + + ```bash + ./scripts/run-openclaw-podman.sh launch setup + ``` + + Then open `http://127.0.0.1:18789/` and use the token from `~openclaw/.openclaw/.env` (or the value printed by setup). + + + ## Systemd (Quadlet, optional) -If you ran `./setup-podman.sh --quadlet` (or `OPENCLAW_PODMAN_QUADLET=1`), a [Podman Quadlet](https://docs.podman.io/en/latest/markdown/podman-systemd.unit.5.html) unit is installed so the gateway runs as a systemd user service for the openclaw user. The service is enabled and started at the end of setup. +If you ran `./scripts/podman/setup.sh --quadlet` (or `OPENCLAW_PODMAN_QUADLET=1`), a [Podman Quadlet](https://docs.podman.io/en/latest/markdown/podman-systemd.unit.5.html) unit is installed so the gateway runs as a systemd user service for the openclaw user. The service is enabled and started at the end of setup. - **Start:** `sudo systemctl --machine openclaw@ --user start openclaw.service` - **Stop:** `sudo systemctl --machine openclaw@ --user stop openclaw.service` @@ -62,11 +73,11 @@ If you ran `./setup-podman.sh --quadlet` (or `OPENCLAW_PODMAN_QUADLET=1`), a [Po The quadlet file lives at `~openclaw/.config/containers/systemd/openclaw.container`. To change ports or env, edit that file (or the `.env` it sources), then `sudo systemctl --machine openclaw@ --user daemon-reload` and restart the service. On boot, the service starts automatically if lingering is enabled for openclaw (setup does this when loginctl is available). -To add quadlet **after** an initial setup that did not use it, re-run: `./setup-podman.sh --quadlet`. +To add quadlet **after** an initial setup that did not use it, re-run: `./scripts/podman/setup.sh --quadlet`. ## The openclaw user (non-login) -`setup-podman.sh` creates a dedicated system user `openclaw`: +`scripts/podman/setup.sh` creates a dedicated system user `openclaw`: - **Shell:** `nologin` — no interactive login; reduces attack surface. - **Home:** e.g. `/home/openclaw` — holds `~/.openclaw` (config, workspace) and the launch script `run-openclaw-podman.sh`. @@ -87,7 +98,7 @@ To add quadlet **after** an initial setup that did not use it, re-run: `./setup- ## Environment and config -- **Token:** Stored in `~openclaw/.openclaw/.env` as `OPENCLAW_GATEWAY_TOKEN`. `setup-podman.sh` and `run-openclaw-podman.sh` generate it if missing (uses `openssl`, `python3`, or `od`). +- **Token:** Stored in `~openclaw/.openclaw/.env` as `OPENCLAW_GATEWAY_TOKEN`. `scripts/podman/setup.sh` and `run-openclaw-podman.sh` generate it if missing (uses `openssl`, `python3`, or `od`). - **Optional:** In that `.env` you can set provider keys (e.g. `GROQ_API_KEY`, `OLLAMA_API_KEY`) and other OpenClaw env vars. - **Host ports:** By default the script maps `18789` (gateway) and `18790` (bridge). Override the **host** port mapping with `OPENCLAW_PODMAN_GATEWAY_HOST_PORT` and `OPENCLAW_PODMAN_BRIDGE_HOST_PORT` when launching. - **Gateway bind:** By default, `run-openclaw-podman.sh` starts the gateway with `--bind loopback` for safe local access. To expose on LAN, set `OPENCLAW_GATEWAY_BIND=lan` and configure `gateway.controlUi.allowedOrigins` (or explicitly enable host-header fallback) in `openclaw.json`. @@ -99,7 +110,7 @@ To add quadlet **after** an initial setup that did not use it, re-run: `./setup- - **Ephemeral sandbox tmpfs:** if you enable `agents.defaults.sandbox`, the tool sandbox containers mount `tmpfs` at `/tmp`, `/var/tmp`, and `/run`. Those paths are memory-backed and disappear with the sandbox container; the top-level Podman container setup does not add its own tmpfs mounts. - **Disk growth hotspots:** the main paths to watch are `media/`, `agents//sessions/sessions.json`, transcript JSONL files, `cron/runs/*.jsonl`, and rolling file logs under `/tmp/openclaw/` (or your configured `logging.file`). -`setup-podman.sh` now stages the image tar in a private temp directory and prints the chosen base dir during setup. For non-root runs it accepts `TMPDIR` only when that base is safe to use; otherwise it falls back to `/var/tmp`, then `/tmp`. The saved tar stays owner-only and is streamed into the target user’s `podman load`, so private caller temp dirs do not block setup. +`scripts/podman/setup.sh` now stages the image tar in a private temp directory and prints the chosen base dir during setup. For non-root runs it accepts `TMPDIR` only when that base is safe to use; otherwise it falls back to `/var/tmp`, then `/tmp`. The saved tar stays owner-only and is streamed into the target user’s `podman load`, so private caller temp dirs do not block setup. ## Useful commands @@ -111,12 +122,12 @@ To add quadlet **after** an initial setup that did not use it, re-run: `./setup- ## Troubleshooting - **Permission denied (EACCES) on config or auth-profiles:** The container defaults to `--userns=keep-id` and runs as the same uid/gid as the host user running the script. Ensure your host `OPENCLAW_CONFIG_DIR` and `OPENCLAW_WORKSPACE_DIR` are owned by that user. -- **Gateway start blocked (missing `gateway.mode=local`):** Ensure `~openclaw/.openclaw/openclaw.json` exists and sets `gateway.mode="local"`. `setup-podman.sh` creates this file if missing. +- **Gateway start blocked (missing `gateway.mode=local`):** Ensure `~openclaw/.openclaw/openclaw.json` exists and sets `gateway.mode="local"`. `scripts/podman/setup.sh` creates this file if missing. - **Rootless Podman fails for user openclaw:** Check `/etc/subuid` and `/etc/subgid` contain a line for `openclaw` (e.g. `openclaw:100000:65536`). Add it if missing and restart. - **Container name in use:** The launch script uses `podman run --replace`, so the existing container is replaced when you start again. To clean up manually: `podman rm -f openclaw`. -- **Script not found when running as openclaw:** Ensure `setup-podman.sh` was run so that `run-openclaw-podman.sh` is copied to openclaw’s home (e.g. `/home/openclaw/run-openclaw-podman.sh`). +- **Script not found when running as openclaw:** Ensure `scripts/podman/setup.sh` was run so that `run-openclaw-podman.sh` is copied to openclaw’s home (e.g. `/home/openclaw/run-openclaw-podman.sh`). - **Quadlet service not found or fails to start:** Run `sudo systemctl --machine openclaw@ --user daemon-reload` after editing the `.container` file. Quadlet requires cgroups v2: `podman info --format '{{.Host.CgroupsVersion}}'` should show `2`. ## Optional: run as your own user -To run the gateway as your normal user (no dedicated openclaw user): build the image, create `~/.openclaw/.env` with `OPENCLAW_GATEWAY_TOKEN`, and run the container with `--userns=keep-id` and mounts to your `~/.openclaw`. The launch script is designed for the openclaw-user flow; for a single-user setup you can instead run the `podman run` command from the script manually, pointing config and workspace to your home. Recommended for most users: use `setup-podman.sh` and run as the openclaw user so config and process are isolated. +To run the gateway as your normal user (no dedicated openclaw user): build the image, create `~/.openclaw/.env` with `OPENCLAW_GATEWAY_TOKEN`, and run the container with `--userns=keep-id` and mounts to your `~/.openclaw`. The launch script is designed for the openclaw-user flow; for a single-user setup you can instead run the `podman run` command from the script manually, pointing config and workspace to your home. Recommended for most users: use `scripts/podman/setup.sh` and run as the openclaw user so config and process are isolated. diff --git a/docs/install/railway.mdx b/docs/install/railway.mdx index 1548069b4fd..fa1b4d8c089 100644 --- a/docs/install/railway.mdx +++ b/docs/install/railway.mdx @@ -1,5 +1,9 @@ --- -title: Deploy on Railway +summary: "Deploy OpenClaw on Railway with one-click template" +read_when: + - Deploying OpenClaw to Railway + - You want a one-click cloud deploy with browser-based setup +title: "Railway" --- Deploy OpenClaw on Railway with a one-click template and finish setup in your browser. @@ -72,23 +76,14 @@ Set these variables on the service: If Telegram DMs are set to pairing, web setup can approve the pairing code. -## Getting chat tokens +## Connect a channel -### Telegram bot token +Paste your Telegram or Discord token into the `/setup` wizard. For setup +instructions, see the channel docs: -1. Message `@BotFather` in Telegram -2. Run `/newbot` -3. Copy the token (looks like `123456789:AA...`) -4. Paste it into `/setup` - -### Discord bot token - -1. Go to [https://discord.com/developers/applications](https://discord.com/developers/applications) -2. **New Application** → choose a name -3. **Bot** → **Add Bot** -4. **Enable MESSAGE CONTENT INTENT** under Bot → Privileged Gateway Intents (required or the bot will crash on startup) -5. Copy the **Bot Token** and paste into `/setup` -6. Invite the bot to your server (OAuth2 URL Generator; scopes: `bot`, `applications.commands`) +- [Telegram](/channels/telegram) (fastest — just a bot token) +- [Discord](/channels/discord) +- [All channels](/channels) ## Backups & migration @@ -97,3 +92,9 @@ Download a backup at: - `https:///setup/export` This exports your OpenClaw state + workspace so you can migrate to another host without losing config or memory. + +## Next steps + +- Set up messaging channels: [Channels](/channels) +- Configure the Gateway: [Gateway configuration](/gateway/configuration) +- Keep OpenClaw up to date: [Updating](/install/updating) diff --git a/docs/install/raspberry-pi.md b/docs/install/raspberry-pi.md new file mode 100644 index 00000000000..49e3d63b8dc --- /dev/null +++ b/docs/install/raspberry-pi.md @@ -0,0 +1,159 @@ +--- +summary: "Host OpenClaw on a Raspberry Pi for always-on self-hosting" +read_when: + - Setting up OpenClaw on a Raspberry Pi + - Running OpenClaw on ARM devices + - Building a cheap always-on personal AI +title: "Raspberry Pi" +--- + +# Raspberry Pi + +Run a persistent, always-on OpenClaw Gateway on a Raspberry Pi. Since the Pi is just the gateway (models run in the cloud via API), even a modest Pi handles the workload well. + +## Prerequisites + +- Raspberry Pi 4 or 5 with 2 GB+ RAM (4 GB recommended) +- MicroSD card (16 GB+) or USB SSD (better performance) +- Official Pi power supply +- Network connection (Ethernet or WiFi) +- 64-bit Raspberry Pi OS (required -- do not use 32-bit) +- About 30 minutes + +## Setup + + + + Use **Raspberry Pi OS Lite (64-bit)** -- no desktop needed for a headless server. + + 1. Download [Raspberry Pi Imager](https://www.raspberrypi.com/software/). + 2. Choose OS: **Raspberry Pi OS Lite (64-bit)**. + 3. In the settings dialog, pre-configure: + - Hostname: `gateway-host` + - Enable SSH + - Set username and password + - Configure WiFi (if not using Ethernet) + 4. Flash to your SD card or USB drive, insert it, and boot the Pi. + + + + + ```bash + ssh user@gateway-host + ``` + + + + ```bash + sudo apt update && sudo apt upgrade -y + sudo apt install -y git curl build-essential + + # Set timezone (important for cron and reminders) + sudo timedatectl set-timezone America/Chicago + ``` + + + + + ```bash + curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash - + sudo apt install -y nodejs + node --version + ``` + + + + ```bash + sudo fallocate -l 2G /swapfile + sudo chmod 600 /swapfile + sudo mkswap /swapfile + sudo swapon /swapfile + echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab + + # Reduce swappiness for low-RAM devices + echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf + sudo sysctl -p + ``` + + + + + ```bash + curl -fsSL https://openclaw.ai/install.sh | bash + ``` + + + + ```bash + openclaw onboard --install-daemon + ``` + + Follow the wizard. API keys are recommended over OAuth for headless devices. Telegram is the easiest channel to start with. + + + + + ```bash + openclaw status + sudo systemctl status openclaw + journalctl -u openclaw -f + ``` + + + + On your computer, get a dashboard URL from the Pi: + + ```bash + ssh user@gateway-host 'openclaw dashboard --no-open' + ``` + + Then create an SSH tunnel in another terminal: + + ```bash + ssh -N -L 18789:127.0.0.1:18789 user@gateway-host + ``` + + Open the printed URL in your local browser. For always-on remote access, see [Tailscale integration](/gateway/tailscale). + + + + +## Performance tips + +**Use a USB SSD** -- SD cards are slow and wear out. A USB SSD dramatically improves performance. See the [Pi USB boot guide](https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#usb-mass-storage-boot). + +**Enable module compile cache** -- Speeds up repeated CLI invocations on lower-power Pi hosts: + +```bash +grep -q 'NODE_COMPILE_CACHE=/var/tmp/openclaw-compile-cache' ~/.bashrc || cat >> ~/.bashrc <<'EOF' # pragma: allowlist secret +export NODE_COMPILE_CACHE=/var/tmp/openclaw-compile-cache +mkdir -p /var/tmp/openclaw-compile-cache +export OPENCLAW_NO_RESPAWN=1 +EOF +source ~/.bashrc +``` + +**Reduce memory usage** -- For headless setups, free GPU memory and disable unused services: + +```bash +echo 'gpu_mem=16' | sudo tee -a /boot/config.txt +sudo systemctl disable bluetooth +``` + +## Troubleshooting + +**Out of memory** -- Verify swap is active with `free -h`. Disable unused services (`sudo systemctl disable cups bluetooth avahi-daemon`). Use API-based models only. + +**Slow performance** -- Use a USB SSD instead of an SD card. Check for CPU throttling with `vcgencmd get_throttled` (should return `0x0`). + +**Service will not start** -- Check logs with `journalctl -u openclaw --no-pager -n 100` and run `openclaw doctor --non-interactive`. + +**ARM binary issues** -- If a skill fails with "exec format error", check whether the binary has an ARM64 build. Verify architecture with `uname -m` (should show `aarch64`). + +**WiFi drops** -- Disable WiFi power management: `sudo iwconfig wlan0 power off`. + +## Next steps + +- [Channels](/channels) -- connect Telegram, WhatsApp, Discord, and more +- [Gateway configuration](/gateway/configuration) -- all config options +- [Updating](/install/updating) -- keep OpenClaw up to date diff --git a/docs/install/render.mdx b/docs/install/render.mdx index e7a8b26346d..5bb4fd953e2 100644 --- a/docs/install/render.mdx +++ b/docs/install/render.mdx @@ -1,5 +1,9 @@ --- -title: Deploy on Render +summary: "Deploy OpenClaw on Render with Infrastructure-as-Code" +read_when: + - Deploying OpenClaw to Render + - You want a declarative cloud deploy with Render Blueprints +title: "Render" --- Deploy OpenClaw on Render using Infrastructure as Code. The included `render.yaml` Blueprint defines your entire stack declaratively, service, disk, environment variables, so you can deploy with a single click and version your infrastructure alongside your code. @@ -157,3 +161,9 @@ Render expects a 200 response from `/health` within 30 seconds. If builds succee - Build logs for errors - Whether the container runs locally with `docker build && docker run` + +## Next steps + +- Set up messaging channels: [Channels](/channels) +- Configure the Gateway: [Gateway configuration](/gateway/configuration) +- Keep OpenClaw up to date: [Updating](/install/updating) diff --git a/docs/install/updating.md b/docs/install/updating.md index 0b88d91ed9e..bbe3e949d96 100644 --- a/docs/install/updating.md +++ b/docs/install/updating.md @@ -8,44 +8,35 @@ title: "Updating" # Updating -OpenClaw is moving fast (pre “1.0”). Treat updates like shipping infra: update → run checks → restart (or use `openclaw update`, which restarts) → verify. +Keep OpenClaw up to date. -## Recommended: re-run the website installer (upgrade in place) +## Recommended: `openclaw update` -The **preferred** update path is to re-run the installer from the website. It -detects existing installs, upgrades in place, and runs `openclaw doctor` when -needed. +The fastest way to update. It detects your install type (npm or git), fetches the latest version, runs `openclaw doctor`, and restarts the gateway. + +```bash +openclaw update +``` + +To switch channels or target a specific version: + +```bash +openclaw update --channel beta +openclaw update --tag main +openclaw update --dry-run # preview without applying +``` + +See [Development channels](/install/development-channels) for channel semantics. + +## Alternative: re-run the installer ```bash curl -fsSL https://openclaw.ai/install.sh | bash ``` -Notes: +Add `--no-onboard` to skip onboarding. For source installs, pass `--install-method git --no-onboard`. -- Add `--no-onboard` if you don’t want onboarding to run again. -- For **source installs**, use: - - ```bash - curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method git --no-onboard - ``` - - The installer will `git pull --rebase` **only** if the repo is clean. - -- For **global installs**, the script uses `npm install -g openclaw@latest` under the hood. -- Legacy note: `clawdbot` remains available as a compatibility shim. - -## Before you update - -- Know how you installed: **global** (npm/pnpm) vs **from source** (git clone). -- Know how your Gateway is running: **foreground terminal** vs **supervised service** (launchd/systemd). -- Snapshot your tailoring: - - Config: `~/.openclaw/openclaw.json` - - Credentials: `~/.openclaw/credentials/` - - Workspace: `~/.openclaw/workspace` - -## Update (global install) - -Global install (pick one): +## Alternative: manual npm or pnpm ```bash npm i -g openclaw@latest @@ -55,221 +46,83 @@ npm i -g openclaw@latest pnpm add -g openclaw@latest ``` -We do **not** recommend Bun for the Gateway runtime (WhatsApp/Telegram bugs). +## Auto-updater -To switch update channels (git + npm installs): +The auto-updater is off by default. Enable it in `~/.openclaw/openclaw.json`: -```bash -openclaw update --channel beta -openclaw update --channel dev -openclaw update --channel stable -``` - -Use `--tag ` for a one-off package target override. - -For the current GitHub `main` head via a package-manager install: - -```bash -openclaw update --tag main -``` - -Manual equivalents: - -```bash -npm i -g github:openclaw/openclaw#main -``` - -```bash -pnpm add -g github:openclaw/openclaw#main -``` - -You can also pass an explicit package spec to `--tag` for one-off updates (for example a GitHub ref or tarball URL). - -See [Development channels](/install/development-channels) for channel semantics and release notes. - -Note: on npm installs, the gateway logs an update hint on startup (checks the current channel tag). Disable via `update.checkOnStart: false`. - -### Core auto-updater (optional) - -Auto-updater is **off by default** and is a core Gateway feature (not a plugin). - -```json +```json5 { - "update": { - "channel": "stable", - "auto": { - "enabled": true, - "stableDelayHours": 6, - "stableJitterHours": 12, - "betaCheckIntervalHours": 1 - } - } + update: { + channel: "stable", + auto: { + enabled: true, + stableDelayHours: 6, + stableJitterHours: 12, + betaCheckIntervalHours: 1, + }, + }, } ``` -Behavior: +| Channel | Behavior | +| -------- | ------------------------------------------------------------------------------------------------------------- | +| `stable` | Waits `stableDelayHours`, then applies with deterministic jitter across `stableJitterHours` (spread rollout). | +| `beta` | Checks every `betaCheckIntervalHours` (default: hourly) and applies immediately. | +| `dev` | No automatic apply. Use `openclaw update` manually. | -- `stable`: when a new version is seen, OpenClaw waits `stableDelayHours` and then applies a deterministic per-install jitter in `stableJitterHours` (spread rollout). -- `beta`: checks on `betaCheckIntervalHours` cadence (default: hourly) and applies when an update is available. -- `dev`: no automatic apply; use manual `openclaw update`. +The gateway also logs an update hint on startup (disable with `update.checkOnStart: false`). -Use `openclaw update --dry-run` to preview update actions before enabling automation. +## After updating -Then: + + +### Run doctor ```bash openclaw doctor +``` + +Migrates config, audits DM policies, and checks gateway health. Details: [Doctor](/gateway/doctor) + +### Restart the gateway + +```bash openclaw gateway restart +``` + +### Verify + +```bash openclaw health ``` -Notes: + -- If your Gateway runs as a service, `openclaw gateway restart` is preferred over killing PIDs. -- If you’re pinned to a specific version, see “Rollback / pinning” below. +## Rollback -## Update (`openclaw update`) - -For **source installs** (git checkout), prefer: - -```bash -openclaw update -``` - -It runs a safe-ish update flow: - -- Requires a clean worktree. -- Switches to the selected channel (tag or branch). -- Fetches + rebases against the configured upstream (dev channel). -- Installs deps, builds, builds the Control UI, and runs `openclaw doctor`. -- Restarts the gateway by default (use `--no-restart` to skip). - -If you installed via **npm/pnpm** (no git metadata), `openclaw update` will try to update via your package manager. If it can’t detect the install, use “Update (global install)” instead. - -## Update (Control UI / RPC) - -The Control UI has **Update & Restart** (RPC: `update.run`). It: - -1. Runs the same source-update flow as `openclaw update` (git checkout only). -2. Writes a restart sentinel with a structured report (stdout/stderr tail). -3. Restarts the gateway and pings the last active session with the report. - -If the rebase fails, the gateway aborts and restarts without applying the update. - -## Update (from source) - -From the repo checkout: - -Preferred: - -```bash -openclaw update -``` - -Manual (equivalent-ish): - -```bash -git pull -pnpm install -pnpm build -pnpm ui:build # auto-installs UI deps on first run -openclaw doctor -openclaw health -``` - -Notes: - -- `pnpm build` matters when you run the packaged `openclaw` binary ([`openclaw.mjs`](https://github.com/openclaw/openclaw/blob/main/openclaw.mjs)) or use Node to run `dist/`. -- If you run from a repo checkout without a global install, use `pnpm openclaw ...` for CLI commands. -- If you run directly from TypeScript (`pnpm openclaw ...`), a rebuild is usually unnecessary, but **config migrations still apply** → run doctor. -- Switching between global and git installs is easy: install the other flavor, then run `openclaw doctor` so the gateway service entrypoint is rewritten to the current install. - -## Always Run: `openclaw doctor` - -Doctor is the “safe update” command. It’s intentionally boring: repair + migrate + warn. - -Note: if you’re on a **source install** (git checkout), `openclaw doctor` will offer to run `openclaw update` first. - -Typical things it does: - -- Migrate deprecated config keys / legacy config file locations. -- Audit DM policies and warn on risky “open” settings. -- Check Gateway health and can offer to restart. -- Detect and migrate older gateway services (launchd/systemd; legacy schtasks) to current OpenClaw services. -- On Linux, ensure systemd user lingering (so the Gateway survives logout). - -Details: [Doctor](/gateway/doctor) - -## Start / stop / restart the Gateway - -CLI (works regardless of OS): - -```bash -openclaw gateway status -openclaw gateway stop -openclaw gateway restart -openclaw gateway --port 18789 -openclaw logs --follow -``` - -If you’re supervised: - -- macOS launchd (app-bundled LaunchAgent): `launchctl kickstart -k gui/$UID/ai.openclaw.gateway` (use `ai.openclaw.`; legacy `com.openclaw.*` still works) -- Linux systemd user service: `systemctl --user restart openclaw-gateway[-].service` -- Windows (WSL2): `systemctl --user restart openclaw-gateway[-].service` - - `launchctl`/`systemctl` only work if the service is installed; otherwise run `openclaw gateway install`. - -Runbook + exact service labels: [Gateway runbook](/gateway) - -## Rollback / pinning (when something breaks) - -### Pin (global install) - -Install a known-good version (replace `` with the last working one): +### Pin a version (npm) ```bash npm i -g openclaw@ -``` - -```bash -pnpm add -g openclaw@ -``` - -Tip: to see the current published version, run `npm view openclaw version`. - -Then restart + re-run doctor: - -```bash openclaw doctor openclaw gateway restart ``` -### Pin (source) by date +Tip: `npm view openclaw version` shows the current published version. -Pick a commit from a date (example: “state of main as of 2026-01-01”): +### Pin a commit (source) ```bash git fetch origin git checkout "$(git rev-list -n 1 --before=\"2026-01-01\" origin/main)" -``` - -Then reinstall deps + restart: - -```bash -pnpm install -pnpm build +pnpm install && pnpm build openclaw gateway restart ``` -If you want to go back to latest later: - -```bash -git checkout main -git pull -``` +To return to latest: `git checkout main && git pull`. ## If you are stuck -- Run `openclaw doctor` again and read the output carefully (it often tells you the fix). +- Run `openclaw doctor` again and read the output carefully. - Check: [Troubleshooting](/gateway/troubleshooting) - Ask in Discord: [https://discord.gg/clawd](https://discord.gg/clawd) diff --git a/docs/nodes/index.md b/docs/nodes/index.md index f23a2c979cf..b333708b16d 100644 --- a/docs/nodes/index.md +++ b/docs/nodes/index.md @@ -36,6 +36,10 @@ openclaw nodes status openclaw nodes describe --node ``` +If a node retries with changed auth details (role/scopes/public key), the prior +pending request is superseded and a new `requestId` is created. Re-run +`openclaw devices list` before approving. + Notes: - `nodes status` marks a node as **paired** when its device pairing role includes `node`. @@ -115,6 +119,9 @@ openclaw devices approve openclaw nodes status ``` +If the node retries with changed auth details, re-run `openclaw devices list` +and approve the current `requestId`. + Naming options: - `--display-name` on `openclaw node run` / `openclaw node install` (persists in `~/.openclaw/node.json` on the node). diff --git a/docs/platforms/index.md b/docs/platforms/index.md index ec2663aefe4..37a0a47a6fb 100644 --- a/docs/platforms/index.md +++ b/docs/platforms/index.md @@ -29,6 +29,7 @@ Native companion apps for Windows are also planned; the Gateway is recommended v - Fly.io: [Fly.io](/install/fly) - Hetzner (Docker): [Hetzner](/install/hetzner) - GCP (Compute Engine): [GCP](/install/gcp) +- Azure (Linux VM): [Azure](/install/azure) - exe.dev (VM + HTTPS proxy): [exe.dev](/install/exe-dev) ## Common links diff --git a/docs/platforms/ios.md b/docs/platforms/ios.md index f64eba3fed0..fb37ae2d34f 100644 --- a/docs/platforms/ios.md +++ b/docs/platforms/ios.md @@ -42,6 +42,10 @@ openclaw devices list openclaw devices approve ``` +If the app retries pairing with changed auth details (role/scopes/public key), +the previous pending request is superseded and a new `requestId` is created. +Run `openclaw devices list` again before approval. + 4. Verify connection: ```bash diff --git a/docs/platforms/linux.md b/docs/platforms/linux.md index c03dba6f795..522218ddc72 100644 --- a/docs/platforms/linux.md +++ b/docs/platforms/linux.md @@ -21,7 +21,7 @@ Native Linux companion apps are planned. Contributions are welcome if you want t 4. From your laptop: `ssh -N -L 18789:127.0.0.1:18789 @` 5. Open `http://127.0.0.1:18789/` and paste your token -Step-by-step VPS guide: [exe.dev](/install/exe-dev) +Full Linux server guide: [Linux Server](/vps). Step-by-step VPS example: [exe.dev](/install/exe-dev) ## Install diff --git a/docs/platforms/windows.md b/docs/platforms/windows.md index e40d798604d..d0aef529f00 100644 --- a/docs/platforms/windows.md +++ b/docs/platforms/windows.md @@ -1,22 +1,22 @@ --- -summary: "Windows (WSL2) support + companion app status" +summary: "Windows support: native and WSL2 install paths, daemon, and current caveats" read_when: - Installing OpenClaw on Windows + - Choosing between native Windows and WSL2 - Looking for Windows companion app status -title: "Windows (WSL2)" +title: "Windows" --- -# Windows (WSL2) +# Windows -OpenClaw on Windows is recommended **via WSL2** (Ubuntu recommended). The -CLI + Gateway run inside Linux, which keeps the runtime consistent and makes -tooling far more compatible (Node/Bun/pnpm, Linux binaries, skills). Native -Windows might be trickier. WSL2 gives you the full Linux experience — one command -to install: `wsl --install`. +OpenClaw supports both **native Windows** and **WSL2**. WSL2 is the more +stable path and recommended for the full experience — the CLI, Gateway, and +tooling run inside Linux with full compatibility. Native Windows works for +core CLI and Gateway use, with some caveats noted below. Native Windows companion apps are planned. -## Install (WSL2) +## WSL2 (recommended) - [Getting Started](/start/getting-started) (use inside WSL) - [Install & updates](/install/updating) diff --git a/docs/providers/anthropic.md b/docs/providers/anthropic.md index d16d76f6315..a1f2e212463 100644 --- a/docs/providers/anthropic.md +++ b/docs/providers/anthropic.md @@ -57,7 +57,7 @@ OpenClaw's shared `/fast` toggle also supports direct Anthropic API-key traffic. agents: { defaults: { models: { - "anthropic/claude-sonnet-4-5": { + "anthropic/claude-sonnet-4-6": { params: { fastMode: true }, }, }, @@ -228,7 +228,7 @@ openclaw onboard --auth-choice setup-token ## Notes - Generate the setup-token with `claude setup-token` and paste it, or run `openclaw models auth setup-token` on the gateway host. -- If you see “OAuth token refresh failed …” on a Claude subscription, re-auth with a setup-token. See [/gateway/troubleshooting#oauth-token-refresh-failed-anthropic-claude-subscription](/gateway/troubleshooting#oauth-token-refresh-failed-anthropic-claude-subscription). +- If you see “OAuth token refresh failed …” on a Claude subscription, re-auth with a setup-token. See [/gateway/troubleshooting](/gateway/troubleshooting). - Auth details + reuse rules are in [/concepts/oauth](/concepts/oauth). ## Troubleshooting diff --git a/docs/providers/cloudflare-ai-gateway.md b/docs/providers/cloudflare-ai-gateway.md index 392a611e705..2a18e8d3c6f 100644 --- a/docs/providers/cloudflare-ai-gateway.md +++ b/docs/providers/cloudflare-ai-gateway.md @@ -12,7 +12,7 @@ Cloudflare AI Gateway sits in front of provider APIs and lets you add analytics, - Provider: `cloudflare-ai-gateway` - Base URL: `https://gateway.ai.cloudflare.com/v1///anthropic` -- Default model: `cloudflare-ai-gateway/claude-sonnet-4-5` +- Default model: `cloudflare-ai-gateway/claude-sonnet-4-6` - API key: `CLOUDFLARE_AI_GATEWAY_API_KEY` (your provider API key for requests through the Gateway) For Anthropic models, use your Anthropic API key. @@ -31,7 +31,7 @@ openclaw onboard --auth-choice cloudflare-ai-gateway-api-key { agents: { defaults: { - model: { primary: "cloudflare-ai-gateway/claude-sonnet-4-5" }, + model: { primary: "cloudflare-ai-gateway/claude-sonnet-4-6" }, }, }, } diff --git a/docs/providers/groq.md b/docs/providers/groq.md new file mode 100644 index 00000000000..cbbac8dbb59 --- /dev/null +++ b/docs/providers/groq.md @@ -0,0 +1,96 @@ +--- +title: "Groq" +summary: "Groq setup (auth + model selection)" +read_when: + - You want to use Groq with OpenClaw + - You need the API key env var or CLI auth choice +--- + +# Groq + +[Groq](https://groq.com) provides ultra-fast inference on open-source models +(Llama, Gemma, Mistral, and more) using custom LPU hardware. OpenClaw connects +to Groq through its OpenAI-compatible API. + +- Provider: `groq` +- Auth: `GROQ_API_KEY` +- API: OpenAI-compatible + +## Quick start + +1. Get an API key from [console.groq.com/keys](https://console.groq.com/keys). + +2. Set the API key: + +```bash +export GROQ_API_KEY="gsk_..." +``` + +3. Set a default model: + +```json5 +{ + agents: { + defaults: { + model: { primary: "groq/llama-3.3-70b-versatile" }, + }, + }, +} +``` + +## Config file example + +```json5 +{ + env: { GROQ_API_KEY: "gsk_..." }, + agents: { + defaults: { + model: { primary: "groq/llama-3.3-70b-versatile" }, + }, + }, +} +``` + +## Audio transcription + +Groq also provides fast Whisper-based audio transcription. When configured as a +media-understanding provider, OpenClaw uses Groq's `whisper-large-v3-turbo` +model to transcribe voice messages. + +```json5 +{ + media: { + understanding: { + audio: { + models: [{ provider: "groq" }], + }, + }, + }, +} +``` + +## Environment note + +If the Gateway runs as a daemon (launchd/systemd), make sure `GROQ_API_KEY` is +available to that process (for example, in `~/.openclaw/.env` or via +`env.shellEnv`). + +## Available models + +Groq's model catalog changes frequently. Run `openclaw models list | grep groq` +to see currently available models, or check +[console.groq.com/docs/models](https://console.groq.com/docs/models). + +Popular choices include: + +- **Llama 3.3 70B Versatile** - general-purpose, large context +- **Llama 3.1 8B Instant** - fast, lightweight +- **Gemma 2 9B** - compact, efficient +- **Mixtral 8x7B** - MoE architecture, strong reasoning + +## Links + +- [Groq Console](https://console.groq.com) +- [API Documentation](https://console.groq.com/docs) +- [Model List](https://console.groq.com/docs/models) +- [Pricing](https://groq.com/pricing) diff --git a/docs/providers/index.md b/docs/providers/index.md index be2b5154f61..93ccdf27635 100644 --- a/docs/providers/index.md +++ b/docs/providers/index.md @@ -31,6 +31,7 @@ Looking for chat channel docs (WhatsApp/Telegram/Discord/Slack/Mattermost (plugi - [Cloudflare AI Gateway](/providers/cloudflare-ai-gateway) - [GLM models](/providers/glm) - [Google (Gemini)](/providers/google) +- [Groq (LPU inference)](/providers/groq) - [Hugging Face (Inference)](/providers/huggingface) - [Kilocode](/providers/kilocode) - [LiteLLM (unified gateway)](/providers/litellm) diff --git a/docs/providers/openrouter.md b/docs/providers/openrouter.md index 5a9023481be..25d00825f05 100644 --- a/docs/providers/openrouter.md +++ b/docs/providers/openrouter.md @@ -24,7 +24,7 @@ openclaw onboard --auth-choice apiKey --token-provider openrouter --token "$OPEN env: { OPENROUTER_API_KEY: "sk-or-..." }, agents: { defaults: { - model: { primary: "openrouter/anthropic/claude-sonnet-4-5" }, + model: { primary: "openrouter/anthropic/claude-sonnet-4-6" }, }, }, } diff --git a/docs/providers/perplexity-provider.md b/docs/providers/perplexity-provider.md index c0945627e39..c93475efdd3 100644 --- a/docs/providers/perplexity-provider.md +++ b/docs/providers/perplexity-provider.md @@ -13,19 +13,25 @@ Search API or Perplexity Sonar via OpenRouter. This page covers the Perplexity **provider** setup. For the Perplexity -**tool** (how the agent uses it), see [Perplexity tool](/perplexity). +**tool** (how the agent uses it), see [Perplexity tool](/tools/perplexity-search). - Type: web search provider (not a model provider) - Auth: `PERPLEXITY_API_KEY` (direct) or `OPENROUTER_API_KEY` (via OpenRouter) -- Config path: `tools.web.search.perplexity.apiKey` +- Config path: `plugins.entries.perplexity.config.webSearch.apiKey` ## Quick start 1. Set the API key: ```bash -openclaw config set tools.web.search.perplexity.apiKey "pplx-xxxxxxxxxxxx" +openclaw configure --section web +``` + +Or set it directly: + +```bash +openclaw config set plugins.entries.perplexity.config.webSearch.apiKey "pplx-xxxxxxxxxxxx" ``` 2. The agent will automatically use Perplexity for web searches when configured. diff --git a/docs/reference/memory-config.md b/docs/reference/memory-config.md new file mode 100644 index 00000000000..a25f57dc868 --- /dev/null +++ b/docs/reference/memory-config.md @@ -0,0 +1,711 @@ +--- +title: "Memory configuration reference" +summary: "Full configuration reference for OpenClaw memory search, embedding providers, QMD backend, hybrid search, and multimodal memory" +read_when: + - You want to configure memory search providers or embedding models + - You want to set up the QMD backend + - You want to tune hybrid search, MMR, or temporal decay + - You want to enable multimodal memory indexing +--- + +# Memory configuration reference + +This page covers the full configuration surface for OpenClaw memory search. For +the conceptual overview (file layout, memory tools, when to write memory, and the +automatic flush), see [Memory](/concepts/memory). + +## Memory search defaults + +- Enabled by default. +- Watches memory files for changes (debounced). +- Configure memory search under `agents.defaults.memorySearch` (not top-level + `memorySearch`). +- Uses remote embeddings by default. If `memorySearch.provider` is not set, OpenClaw auto-selects: + 1. `local` if a `memorySearch.local.modelPath` is configured and the file exists. + 2. `openai` if an OpenAI key can be resolved. + 3. `gemini` if a Gemini key can be resolved. + 4. `voyage` if a Voyage key can be resolved. + 5. `mistral` if a Mistral key can be resolved. + 6. Otherwise memory search stays disabled until configured. +- Local mode uses node-llama-cpp and may require `pnpm approve-builds`. +- Uses sqlite-vec (when available) to accelerate vector search inside SQLite. +- `memorySearch.provider = "ollama"` is also supported for local/self-hosted + Ollama embeddings (`/api/embeddings`), but it is not auto-selected. + +Remote embeddings **require** an API key for the embedding provider. OpenClaw +resolves keys from auth profiles, `models.providers.*.apiKey`, or environment +variables. Codex OAuth only covers chat/completions and does **not** satisfy +embeddings for memory search. For Gemini, use `GEMINI_API_KEY` or +`models.providers.google.apiKey`. For Voyage, use `VOYAGE_API_KEY` or +`models.providers.voyage.apiKey`. For Mistral, use `MISTRAL_API_KEY` or +`models.providers.mistral.apiKey`. Ollama typically does not require a real API +key (a placeholder like `OLLAMA_API_KEY=ollama-local` is enough when needed by +local policy). +When using a custom OpenAI-compatible endpoint, +set `memorySearch.remote.apiKey` (and optional `memorySearch.remote.headers`). + +## QMD backend (experimental) + +Set `memory.backend = "qmd"` to swap the built-in SQLite indexer for +[QMD](https://github.com/tobi/qmd): a local-first search sidecar that combines +BM25 + vectors + reranking. Markdown stays the source of truth; OpenClaw shells +out to QMD for retrieval. Key points: + +### Prerequisites + +- Disabled by default. Opt in per-config (`memory.backend = "qmd"`). +- Install the QMD CLI separately (`bun install -g https://github.com/tobi/qmd` or grab + a release) and make sure the `qmd` binary is on the gateway's `PATH`. +- QMD needs an SQLite build that allows extensions (`brew install sqlite` on + macOS). +- QMD runs fully locally via Bun + `node-llama-cpp` and auto-downloads GGUF + models from HuggingFace on first use (no separate Ollama daemon required). +- The gateway runs QMD in a self-contained XDG home under + `~/.openclaw/agents//qmd/` by setting `XDG_CONFIG_HOME` and + `XDG_CACHE_HOME`. +- OS support: macOS and Linux work out of the box once Bun + SQLite are + installed. Windows is best supported via WSL2. + +### How the sidecar runs + +- The gateway writes a self-contained QMD home under + `~/.openclaw/agents//qmd/` (config + cache + sqlite DB). +- Collections are created via `qmd collection add` from `memory.qmd.paths` + (plus default workspace memory files), then `qmd update` + `qmd embed` run + on boot and on a configurable interval (`memory.qmd.update.interval`, + default 5 m). +- The gateway now initializes the QMD manager on startup, so periodic update + timers are armed even before the first `memory_search` call. +- Boot refresh now runs in the background by default so chat startup is not + blocked; set `memory.qmd.update.waitForBootSync = true` to keep the previous + blocking behavior. +- Searches run via `memory.qmd.searchMode` (default `qmd search --json`; also + supports `vsearch` and `query`). If the selected mode rejects flags on your + QMD build, OpenClaw retries with `qmd query`. If QMD fails or the binary is + missing, OpenClaw automatically falls back to the builtin SQLite manager so + memory tools keep working. +- OpenClaw does not expose QMD embed batch-size tuning today; batch behavior is + controlled by QMD itself. +- **First search may be slow**: QMD may download local GGUF models (reranker/query + expansion) on the first `qmd query` run. + - OpenClaw sets `XDG_CONFIG_HOME`/`XDG_CACHE_HOME` automatically when it runs QMD. + - If you want to pre-download models manually (and warm the same index OpenClaw + uses), run a one-off query with the agent's XDG dirs. + + OpenClaw's QMD state lives under your **state dir** (defaults to `~/.openclaw`). + You can point `qmd` at the exact same index by exporting the same XDG vars + OpenClaw uses: + + ```bash + # Pick the same state dir OpenClaw uses + STATE_DIR="${OPENCLAW_STATE_DIR:-$HOME/.openclaw}" + + export XDG_CONFIG_HOME="$STATE_DIR/agents/main/qmd/xdg-config" + export XDG_CACHE_HOME="$STATE_DIR/agents/main/qmd/xdg-cache" + + # (Optional) force an index refresh + embeddings + qmd update + qmd embed + + # Warm up / trigger first-time model downloads + qmd query "test" -c memory-root --json >/dev/null 2>&1 + ``` + +### Config surface (`memory.qmd.*`) + +- `command` (default `qmd`): override the executable path. +- `searchMode` (default `search`): pick which QMD command backs + `memory_search` (`search`, `vsearch`, `query`). +- `includeDefaultMemory` (default `true`): auto-index `MEMORY.md` + `memory/**/*.md`. +- `paths[]`: add extra directories/files (`path`, optional `pattern`, optional + stable `name`). +- `sessions`: opt into session JSONL indexing (`enabled`, `retentionDays`, + `exportDir`). +- `update`: controls refresh cadence and maintenance execution: + (`interval`, `debounceMs`, `onBoot`, `waitForBootSync`, `embedInterval`, + `commandTimeoutMs`, `updateTimeoutMs`, `embedTimeoutMs`). +- `limits`: clamp recall payload (`maxResults`, `maxSnippetChars`, + `maxInjectedChars`, `timeoutMs`). +- `scope`: same schema as [`session.sendPolicy`](/gateway/configuration-reference#session). + Default is DM-only (`deny` all, `allow` direct chats); loosen it to surface QMD + hits in groups/channels. + - `match.keyPrefix` matches the **normalized** session key (lowercased, with any + leading `agent::` stripped). Example: `discord:channel:`. + - `match.rawKeyPrefix` matches the **raw** session key (lowercased), including + `agent::`. Example: `agent:main:discord:`. + - Legacy: `match.keyPrefix: "agent:..."` is still treated as a raw-key prefix, + but prefer `rawKeyPrefix` for clarity. +- When `scope` denies a search, OpenClaw logs a warning with the derived + `channel`/`chatType` so empty results are easier to debug. +- Snippets sourced outside the workspace show up as + `qmd//` in `memory_search` results; `memory_get` + understands that prefix and reads from the configured QMD collection root. +- When `memory.qmd.sessions.enabled = true`, OpenClaw exports sanitized session + transcripts (User/Assistant turns) into a dedicated QMD collection under + `~/.openclaw/agents//qmd/sessions/`, so `memory_search` can recall recent + conversations without touching the builtin SQLite index. +- `memory_search` snippets now include a `Source: ` footer when + `memory.citations` is `auto`/`on`; set `memory.citations = "off"` to keep + the path metadata internal (the agent still receives the path for + `memory_get`, but the snippet text omits the footer and the system prompt + warns the agent not to cite it). + +### QMD example + +```json5 +memory: { + backend: "qmd", + citations: "auto", + qmd: { + includeDefaultMemory: true, + update: { interval: "5m", debounceMs: 15000 }, + limits: { maxResults: 6, timeoutMs: 4000 }, + scope: { + default: "deny", + rules: [ + { action: "allow", match: { chatType: "direct" } }, + // Normalized session-key prefix (strips `agent::`). + { action: "deny", match: { keyPrefix: "discord:channel:" } }, + // Raw session-key prefix (includes `agent::`). + { action: "deny", match: { rawKeyPrefix: "agent:main:discord:" } }, + ] + }, + paths: [ + { name: "docs", path: "~/notes", pattern: "**/*.md" } + ] + } +} +``` + +### Citations and fallback + +- `memory.citations` applies regardless of backend (`auto`/`on`/`off`). +- When `qmd` runs, we tag `status().backend = "qmd"` so diagnostics show which + engine served the results. If the QMD subprocess exits or JSON output can't be + parsed, the search manager logs a warning and returns the builtin provider + (existing Markdown embeddings) until QMD recovers. + +## Additional memory paths + +If you want to index Markdown files outside the default workspace layout, add +explicit paths: + +```json5 +agents: { + defaults: { + memorySearch: { + extraPaths: ["../team-docs", "/srv/shared-notes/overview.md"] + } + } +} +``` + +Notes: + +- Paths can be absolute or workspace-relative. +- Directories are scanned recursively for `.md` files. +- By default, only Markdown files are indexed. +- If `memorySearch.multimodal.enabled = true`, OpenClaw also indexes supported image/audio files under `extraPaths` only. Default memory roots (`MEMORY.md`, `memory.md`, `memory/**/*.md`) stay Markdown-only. +- Symlinks are ignored (files or directories). + +## Multimodal memory files (Gemini image + audio) + +OpenClaw can index image and audio files from `memorySearch.extraPaths` when using Gemini embedding 2: + +```json5 +agents: { + defaults: { + memorySearch: { + provider: "gemini", + model: "gemini-embedding-2-preview", + extraPaths: ["assets/reference", "voice-notes"], + multimodal: { + enabled: true, + modalities: ["image", "audio"], // or ["all"] + maxFileBytes: 10000000 + }, + remote: { + apiKey: "YOUR_GEMINI_API_KEY" + } + } + } +} +``` + +Notes: + +- Multimodal memory is currently supported only for `gemini-embedding-2-preview`. +- Multimodal indexing applies only to files discovered through `memorySearch.extraPaths`. +- Supported modalities in this phase: image and audio. +- `memorySearch.fallback` must stay `"none"` while multimodal memory is enabled. +- Matching image/audio file bytes are uploaded to the configured Gemini embedding endpoint during indexing. +- Supported image extensions: `.jpg`, `.jpeg`, `.png`, `.webp`, `.gif`, `.heic`, `.heif`. +- Supported audio extensions: `.mp3`, `.wav`, `.ogg`, `.opus`, `.m4a`, `.aac`, `.flac`. +- Search queries remain text, but Gemini can compare those text queries against indexed image/audio embeddings. +- `memory_get` still reads Markdown only; binary files are searchable but not returned as raw file contents. + +## Gemini embeddings (native) + +Set the provider to `gemini` to use the Gemini embeddings API directly: + +```json5 +agents: { + defaults: { + memorySearch: { + provider: "gemini", + model: "gemini-embedding-001", + remote: { + apiKey: "YOUR_GEMINI_API_KEY" + } + } + } +} +``` + +Notes: + +- `remote.baseUrl` is optional (defaults to the Gemini API base URL). +- `remote.headers` lets you add extra headers if needed. +- Default model: `gemini-embedding-001`. +- `gemini-embedding-2-preview` is also supported: 8192 token limit and configurable dimensions (768 / 1536 / 3072, default 3072). + +### Gemini Embedding 2 (preview) + +```json5 +agents: { + defaults: { + memorySearch: { + provider: "gemini", + model: "gemini-embedding-2-preview", + outputDimensionality: 3072, // optional: 768, 1536, or 3072 (default) + remote: { + apiKey: "YOUR_GEMINI_API_KEY" + } + } + } +} +``` + +> **Re-index required:** Switching from `gemini-embedding-001` (768 dimensions) +> to `gemini-embedding-2-preview` (3072 dimensions) changes the vector size. The same is true if you +> change `outputDimensionality` between 768, 1536, and 3072. +> OpenClaw will automatically reindex when it detects a model or dimension change. + +## Custom OpenAI-compatible endpoint + +If you want to use a custom OpenAI-compatible endpoint (OpenRouter, vLLM, or a proxy), +you can use the `remote` configuration with the OpenAI provider: + +```json5 +agents: { + defaults: { + memorySearch: { + provider: "openai", + model: "text-embedding-3-small", + remote: { + baseUrl: "https://api.example.com/v1/", + apiKey: "YOUR_OPENAI_COMPAT_API_KEY", + headers: { "X-Custom-Header": "value" } + } + } + } +} +``` + +If you don't want to set an API key, use `memorySearch.provider = "local"` or set +`memorySearch.fallback = "none"`. + +### Fallbacks + +- `memorySearch.fallback` can be `openai`, `gemini`, `voyage`, `mistral`, `ollama`, `local`, or `none`. +- The fallback provider is only used when the primary embedding provider fails. + +### Batch indexing (OpenAI + Gemini + Voyage) + +- Disabled by default. Set `agents.defaults.memorySearch.remote.batch.enabled = true` to enable for large-corpus indexing (OpenAI, Gemini, and Voyage). +- Default behavior waits for batch completion; tune `remote.batch.wait`, `remote.batch.pollIntervalMs`, and `remote.batch.timeoutMinutes` if needed. +- Set `remote.batch.concurrency` to control how many batch jobs we submit in parallel (default: 2). +- Batch mode applies when `memorySearch.provider = "openai"` or `"gemini"` and uses the corresponding API key. +- Gemini batch jobs use the async embeddings batch endpoint and require Gemini Batch API availability. + +Why OpenAI batch is fast and cheap: + +- For large backfills, OpenAI is typically the fastest option we support because we can submit many embedding requests in a single batch job and let OpenAI process them asynchronously. +- OpenAI offers discounted pricing for Batch API workloads, so large indexing runs are usually cheaper than sending the same requests synchronously. +- See the OpenAI Batch API docs and pricing for details: + - [https://platform.openai.com/docs/api-reference/batch](https://platform.openai.com/docs/api-reference/batch) + - [https://platform.openai.com/pricing](https://platform.openai.com/pricing) + +Config example: + +```json5 +agents: { + defaults: { + memorySearch: { + provider: "openai", + model: "text-embedding-3-small", + fallback: "openai", + remote: { + batch: { enabled: true, concurrency: 2 } + }, + sync: { watch: true } + } + } +} +``` + +## How the memory tools work + +- `memory_search` semantically searches Markdown chunks (~400 token target, 80-token overlap) from `MEMORY.md` + `memory/**/*.md`. It returns snippet text (capped ~700 chars), file path, line range, score, provider/model, and whether we fell back from local to remote embeddings. No full file payload is returned. +- `memory_get` reads a specific memory Markdown file (workspace-relative), optionally from a starting line and for N lines. Paths outside `MEMORY.md` / `memory/` are rejected. +- Both tools are enabled only when `memorySearch.enabled` resolves true for the agent. + +## What gets indexed (and when) + +- File type: Markdown only (`MEMORY.md`, `memory/**/*.md`). +- Index storage: per-agent SQLite at `~/.openclaw/memory/.sqlite` (configurable via `agents.defaults.memorySearch.store.path`, supports `{agentId}` token). +- Freshness: watcher on `MEMORY.md` + `memory/` marks the index dirty (debounce 1.5s). Sync is scheduled on session start, on search, or on an interval and runs asynchronously. Session transcripts use delta thresholds to trigger background sync. +- Reindex triggers: the index stores the embedding **provider/model + endpoint fingerprint + chunking params**. If any of those change, OpenClaw automatically resets and reindexes the entire store. + +## Hybrid search (BM25 + vector) + +When enabled, OpenClaw combines: + +- **Vector similarity** (semantic match, wording can differ) +- **BM25 keyword relevance** (exact tokens like IDs, env vars, code symbols) + +If full-text search is unavailable on your platform, OpenClaw falls back to vector-only search. + +### Why hybrid + +Vector search is great at "this means the same thing": + +- "Mac Studio gateway host" vs "the machine running the gateway" +- "debounce file updates" vs "avoid indexing on every write" + +But it can be weak at exact, high-signal tokens: + +- IDs (`a828e60`, `b3b9895a...`) +- code symbols (`memorySearch.query.hybrid`) +- error strings ("sqlite-vec unavailable") + +BM25 (full-text) is the opposite: strong at exact tokens, weaker at paraphrases. +Hybrid search is the pragmatic middle ground: **use both retrieval signals** so you get +good results for both "natural language" queries and "needle in a haystack" queries. + +### How we merge results (the current design) + +Implementation sketch: + +1. Retrieve a candidate pool from both sides: + +- **Vector**: top `maxResults * candidateMultiplier` by cosine similarity. +- **BM25**: top `maxResults * candidateMultiplier` by FTS5 BM25 rank (lower is better). + +2. Convert BM25 rank into a 0..1-ish score: + +- `textScore = 1 / (1 + max(0, bm25Rank))` + +3. Union candidates by chunk id and compute a weighted score: + +- `finalScore = vectorWeight * vectorScore + textWeight * textScore` + +Notes: + +- `vectorWeight` + `textWeight` is normalized to 1.0 in config resolution, so weights behave as percentages. +- If embeddings are unavailable (or the provider returns a zero-vector), we still run BM25 and return keyword matches. +- If FTS5 can't be created, we keep vector-only search (no hard failure). + +This isn't "IR-theory perfect", but it's simple, fast, and tends to improve recall/precision on real notes. +If we want to get fancier later, common next steps are Reciprocal Rank Fusion (RRF) or score normalization +(min/max or z-score) before mixing. + +### Post-processing pipeline + +After merging vector and keyword scores, two optional post-processing stages +refine the result list before it reaches the agent: + +``` +Vector + Keyword -> Weighted Merge -> Temporal Decay -> Sort -> MMR -> Top-K Results +``` + +Both stages are **off by default** and can be enabled independently. + +### MMR re-ranking (diversity) + +When hybrid search returns results, multiple chunks may contain similar or overlapping content. +For example, searching for "home network setup" might return five nearly identical snippets +from different daily notes that all mention the same router configuration. + +**MMR (Maximal Marginal Relevance)** re-ranks the results to balance relevance with diversity, +ensuring the top results cover different aspects of the query instead of repeating the same information. + +How it works: + +1. Results are scored by their original relevance (vector + BM25 weighted score). +2. MMR iteratively selects results that maximize: `lambda x relevance - (1-lambda) x max_similarity_to_selected`. +3. Similarity between results is measured using Jaccard text similarity on tokenized content. + +The `lambda` parameter controls the trade-off: + +- `lambda = 1.0` -- pure relevance (no diversity penalty) +- `lambda = 0.0` -- maximum diversity (ignores relevance) +- Default: `0.7` (balanced, slight relevance bias) + +**Example -- query: "home network setup"** + +Given these memory files: + +``` +memory/2026-02-10.md -> "Configured Omada router, set VLAN 10 for IoT devices" +memory/2026-02-08.md -> "Configured Omada router, moved IoT to VLAN 10" +memory/2026-02-05.md -> "Set up AdGuard DNS on 192.168.10.2" +memory/network.md -> "Router: Omada ER605, AdGuard: 192.168.10.2, VLAN 10: IoT" +``` + +Without MMR -- top 3 results: + +``` +1. memory/2026-02-10.md (score: 0.92) <- router + VLAN +2. memory/2026-02-08.md (score: 0.89) <- router + VLAN (near-duplicate!) +3. memory/network.md (score: 0.85) <- reference doc +``` + +With MMR (lambda=0.7) -- top 3 results: + +``` +1. memory/2026-02-10.md (score: 0.92) <- router + VLAN +2. memory/network.md (score: 0.85) <- reference doc (diverse!) +3. memory/2026-02-05.md (score: 0.78) <- AdGuard DNS (diverse!) +``` + +The near-duplicate from Feb 8 drops out, and the agent gets three distinct pieces of information. + +**When to enable:** If you notice `memory_search` returning redundant or near-duplicate snippets, +especially with daily notes that often repeat similar information across days. + +### Temporal decay (recency boost) + +Agents with daily notes accumulate hundreds of dated files over time. Without decay, +a well-worded note from six months ago can outrank yesterday's update on the same topic. + +**Temporal decay** applies an exponential multiplier to scores based on the age of each result, +so recent memories naturally rank higher while old ones fade: + +``` +decayedScore = score x e^(-lambda x ageInDays) +``` + +where `lambda = ln(2) / halfLifeDays`. + +With the default half-life of 30 days: + +- Today's notes: **100%** of original score +- 7 days ago: **~84%** +- 30 days ago: **50%** +- 90 days ago: **12.5%** +- 180 days ago: **~1.6%** + +**Evergreen files are never decayed:** + +- `MEMORY.md` (root memory file) +- Non-dated files in `memory/` (e.g., `memory/projects.md`, `memory/network.md`) +- These contain durable reference information that should always rank normally. + +**Dated daily files** (`memory/YYYY-MM-DD.md`) use the date extracted from the filename. +Other sources (e.g., session transcripts) fall back to file modification time (`mtime`). + +**Example -- query: "what's Rod's work schedule?"** + +Given these memory files (today is Feb 10): + +``` +memory/2025-09-15.md -> "Rod works Mon-Fri, standup at 10am, pairing at 2pm" (148 days old) +memory/2026-02-10.md -> "Rod has standup at 14:15, 1:1 with Zeb at 14:45" (today) +memory/2026-02-03.md -> "Rod started new team, standup moved to 14:15" (7 days old) +``` + +Without decay: + +``` +1. memory/2025-09-15.md (score: 0.91) <- best semantic match, but stale! +2. memory/2026-02-10.md (score: 0.82) +3. memory/2026-02-03.md (score: 0.80) +``` + +With decay (halfLife=30): + +``` +1. memory/2026-02-10.md (score: 0.82 x 1.00 = 0.82) <- today, no decay +2. memory/2026-02-03.md (score: 0.80 x 0.85 = 0.68) <- 7 days, mild decay +3. memory/2025-09-15.md (score: 0.91 x 0.03 = 0.03) <- 148 days, nearly gone +``` + +The stale September note drops to the bottom despite having the best raw semantic match. + +**When to enable:** If your agent has months of daily notes and you find that old, +stale information outranks recent context. A half-life of 30 days works well for +daily-note-heavy workflows; increase it (e.g., 90 days) if you reference older notes frequently. + +### Hybrid search configuration + +Both features are configured under `memorySearch.query.hybrid`: + +```json5 +agents: { + defaults: { + memorySearch: { + query: { + hybrid: { + enabled: true, + vectorWeight: 0.7, + textWeight: 0.3, + candidateMultiplier: 4, + // Diversity: reduce redundant results + mmr: { + enabled: true, // default: false + lambda: 0.7 // 0 = max diversity, 1 = max relevance + }, + // Recency: boost newer memories + temporalDecay: { + enabled: true, // default: false + halfLifeDays: 30 // score halves every 30 days + } + } + } + } + } +} +``` + +You can enable either feature independently: + +- **MMR only** -- useful when you have many similar notes but age doesn't matter. +- **Temporal decay only** -- useful when recency matters but your results are already diverse. +- **Both** -- recommended for agents with large, long-running daily note histories. + +## Embedding cache + +OpenClaw can cache **chunk embeddings** in SQLite so reindexing and frequent updates (especially session transcripts) don't re-embed unchanged text. + +Config: + +```json5 +agents: { + defaults: { + memorySearch: { + cache: { + enabled: true, + maxEntries: 50000 + } + } + } +} +``` + +## Session memory search (experimental) + +You can optionally index **session transcripts** and surface them via `memory_search`. +This is gated behind an experimental flag. + +```json5 +agents: { + defaults: { + memorySearch: { + experimental: { sessionMemory: true }, + sources: ["memory", "sessions"] + } + } +} +``` + +Notes: + +- Session indexing is **opt-in** (off by default). +- Session updates are debounced and **indexed asynchronously** once they cross delta thresholds (best-effort). +- `memory_search` never blocks on indexing; results can be slightly stale until background sync finishes. +- Results still include snippets only; `memory_get` remains limited to memory files. +- Session indexing is isolated per agent (only that agent's session logs are indexed). +- Session logs live on disk (`~/.openclaw/agents//sessions/*.jsonl`). Any process/user with filesystem access can read them, so treat disk access as the trust boundary. For stricter isolation, run agents under separate OS users or hosts. + +Delta thresholds (defaults shown): + +```json5 +agents: { + defaults: { + memorySearch: { + sync: { + sessions: { + deltaBytes: 100000, // ~100 KB + deltaMessages: 50 // JSONL lines + } + } + } + } +} +``` + +## SQLite vector acceleration (sqlite-vec) + +When the sqlite-vec extension is available, OpenClaw stores embeddings in a +SQLite virtual table (`vec0`) and performs vector distance queries in the +database. This keeps search fast without loading every embedding into JS. + +Configuration (optional): + +```json5 +agents: { + defaults: { + memorySearch: { + store: { + vector: { + enabled: true, + extensionPath: "/path/to/sqlite-vec" + } + } + } + } +} +``` + +Notes: + +- `enabled` defaults to true; when disabled, search falls back to in-process + cosine similarity over stored embeddings. +- If the sqlite-vec extension is missing or fails to load, OpenClaw logs the + error and continues with the JS fallback (no vector table). +- `extensionPath` overrides the bundled sqlite-vec path (useful for custom builds + or non-standard install locations). + +## Local embedding auto-download + +- Default local embedding model: `hf:ggml-org/embeddinggemma-300m-qat-q8_0-GGUF/embeddinggemma-300m-qat-Q8_0.gguf` (~0.6 GB). +- When `memorySearch.provider = "local"`, `node-llama-cpp` resolves `modelPath`; if the GGUF is missing it **auto-downloads** to the cache (or `local.modelCacheDir` if set), then loads it. Downloads resume on retry. +- Native build requirement: run `pnpm approve-builds`, pick `node-llama-cpp`, then `pnpm rebuild node-llama-cpp`. +- Fallback: if local setup fails and `memorySearch.fallback = "openai"`, we automatically switch to remote embeddings (`openai/text-embedding-3-small` unless overridden) and record the reason. + +## Custom OpenAI-compatible endpoint example + +```json5 +agents: { + defaults: { + memorySearch: { + provider: "openai", + model: "text-embedding-3-small", + remote: { + baseUrl: "https://api.example.com/v1/", + apiKey: "YOUR_REMOTE_API_KEY", + headers: { + "X-Organization": "org-id", + "X-Project": "project-id" + } + } + } + } +} +``` + +Notes: + +- `remote.*` takes precedence over `models.providers.openai.*`. +- `remote.headers` merge with OpenAI headers; remote wins on key conflicts. Omit `remote.headers` to use the OpenAI defaults. diff --git a/docs/start/getting-started.md b/docs/start/getting-started.md index bd3f554cdc4..22a5fe80914 100644 --- a/docs/start/getting-started.md +++ b/docs/start/getting-started.md @@ -8,29 +8,28 @@ title: "Getting Started" # Getting Started -Goal: go from zero to a first working chat with minimal setup. +Install OpenClaw, run onboarding, and chat with your AI assistant — all in +about 5 minutes. By the end you will have a running Gateway, configured auth, +and a working chat session. - -Fastest chat: open the Control UI (no channel setup needed). Run `openclaw dashboard` -and chat in the browser, or open `http://127.0.0.1:18789/` on the -gateway host. -Docs: [Dashboard](/web/dashboard) and [Control UI](/web/control-ui). - +## What you need -## Prereqs - -- Node 24 recommended (Node 22 LTS, currently `22.16+`, still supported for compatibility) +- **Node.js** — Node 24 recommended (Node 22.16+ also supported) +- **An API key** from a model provider (Anthropic, OpenAI, Google, etc.) — onboarding will prompt you -Check your Node version with `node --version` if you are unsure. +Check your Node version with `node --version`. +**Windows users:** both native Windows and WSL2 are supported. WSL2 is more +stable and recommended for the full experience. See [Windows](/platforms/windows). +Need to install Node? See [Node setup](/install/node). -## Quick setup (CLI) +## Quick setup - + - + ```bash curl -fsSL https://openclaw.ai/install.sh | bash ``` @@ -48,7 +47,7 @@ Check your Node version with `node --version` if you are unsure. - Other install methods and requirements: [Install](/install). + Other install methods (Docker, Nix, npm): [Install](/install). @@ -57,79 +56,61 @@ Check your Node version with `node --version` if you are unsure. openclaw onboard --install-daemon ``` - Onboarding configures auth, gateway settings, and optional channels. - See [Onboarding (CLI)](/start/wizard) for details. + The wizard walks you through choosing a model provider, setting an API key, + and configuring the Gateway. It takes about 2 minutes. + + See [Onboarding (CLI)](/start/wizard) for the full reference. - - If you installed the service, it should already be running: - + ```bash openclaw gateway status ``` + You should see the Gateway listening on port 18789. + - + ```bash openclaw dashboard ``` + + This opens the Control UI in your browser. If it loads, everything is working. + + + + Type a message in the Control UI chat and you should get an AI reply. + + Want to chat from your phone instead? The fastest channel to set up is + [Telegram](/channels/telegram) (just a bot token). See [Channels](/channels) + for all options. + - -If the Control UI loads, your Gateway is ready for use. - - -## Optional checks and extras - - - - Useful for quick tests or troubleshooting. - - ```bash - openclaw gateway --port 18789 - ``` - - - - Requires a configured channel. - - ```bash - openclaw message send --target +15555550123 --message "Hello from OpenClaw" - ``` - - - - -## Useful environment variables - -If you run OpenClaw as a service account or want custom config/state locations: - -- `OPENCLAW_HOME` sets the home directory used for internal path resolution. -- `OPENCLAW_STATE_DIR` overrides the state directory. -- `OPENCLAW_CONFIG_PATH` overrides the config file path. - -Full environment variable reference: [Environment vars](/help/environment). - -## Go deeper +## What to do next - - Full CLI onboarding reference and advanced options. + + WhatsApp, Telegram, Discord, iMessage, and more. - - First run flow for the macOS app. + + Control who can message your agent. + + + Models, tools, sandbox, and advanced settings. + + + Browser, exec, web search, skills, and plugins. -## What you will have + + If you run OpenClaw as a service account or want custom paths: -- A running Gateway -- Auth configured -- Control UI access or a connected channel +- `OPENCLAW_HOME` — home directory for internal path resolution +- `OPENCLAW_STATE_DIR` — override the state directory +- `OPENCLAW_CONFIG_PATH` — override the config file path -## Next steps - -- DM safety and approvals: [Pairing](/channels/pairing) -- Connect more channels: [Channels](/channels) -- Advanced workflows and from source: [Setup](/start/setup) +Full reference: [Environment variables](/help/environment). + diff --git a/docs/start/hubs.md b/docs/start/hubs.md index 260ec771de1..7e530f769b5 100644 --- a/docs/start/hubs.md +++ b/docs/start/hubs.md @@ -17,7 +17,6 @@ Use these hubs to discover every page, including deep dives and reference docs t - [Index](/) - [Getting Started](/start/getting-started) -- [Quick start](/start/quickstart) - [Onboarding](/start/onboarding) - [Onboarding (CLI)](/start/wizard) - [Setup](/start/setup) diff --git a/docs/start/onboarding-overview.md b/docs/start/onboarding-overview.md index 1e60ce9cef5..fe768a8393f 100644 --- a/docs/start/onboarding-overview.md +++ b/docs/start/onboarding-overview.md @@ -9,43 +9,59 @@ sidebarTitle: "Onboarding Overview" # Onboarding Overview -OpenClaw supports multiple onboarding paths depending on where the Gateway runs -and how you prefer to configure providers. +OpenClaw has two onboarding paths. Both configure auth, the Gateway, and +optional channels — they just differ in how you interact with the setup. -## Choose your onboarding path +## Which path should I use? -- **CLI onboarding** for macOS, Linux, and Windows (via WSL2). -- **macOS app** for a guided first run on Apple silicon or Intel Macs. +| | CLI onboarding | macOS app onboarding | +| -------------- | -------------------------------------- | ------------------------- | +| **Platforms** | macOS, Linux, Windows (native or WSL2) | macOS only | +| **Interface** | Terminal wizard | Guided UI in the app | +| **Best for** | Servers, headless, full control | Desktop Mac, visual setup | +| **Automation** | `--non-interactive` for scripts | Manual only | +| **Command** | `openclaw onboard` | Launch the app | + +Most users should start with **CLI onboarding** — it works everywhere and gives +you the most control. + +## What onboarding configures + +Regardless of which path you choose, onboarding sets up: + +1. **Model provider and auth** — API key, OAuth, or setup token for your chosen provider +2. **Workspace** — directory for agent files, bootstrap templates, and memory +3. **Gateway** — port, bind address, auth mode +4. **Channels** (optional) — WhatsApp, Telegram, Discord, and more +5. **Daemon** (optional) — background service so the Gateway starts automatically ## CLI onboarding -Run onboarding in a terminal: +Run in any terminal: ```bash openclaw onboard ``` -Use CLI onboarding when you want full control of the Gateway, workspace, -channels, and skills. Docs: +Add `--install-daemon` to also install the background service in one step. -- [Onboarding (CLI)](/start/wizard) -- [`openclaw onboard` command](/cli/onboard) +Full reference: [Onboarding (CLI)](/start/wizard) +CLI command docs: [`openclaw onboard`](/cli/onboard) ## macOS app onboarding -Use the OpenClaw app when you want a fully guided setup on macOS. Docs: +Open the OpenClaw app. The first-run wizard walks you through the same steps +with a visual interface. -- [Onboarding (macOS App)](/start/onboarding) +Full reference: [Onboarding (macOS App)](/start/onboarding) -## Custom Provider +## Custom or unlisted providers -If you need an endpoint that is not listed, including hosted providers that -expose standard OpenAI or Anthropic APIs, choose **Custom Provider** in the -CLI onboarding. You will be asked to: +If your provider is not listed in onboarding, choose **Custom Provider** and +enter: -- Pick OpenAI-compatible, Anthropic-compatible, or **Unknown** (auto-detect). -- Enter a base URL and API key (if required by the provider). -- Provide a model ID and optional alias. -- Choose an Endpoint ID so multiple custom endpoints can coexist. +- API compatibility mode (OpenAI-compatible, Anthropic-compatible, or auto-detect) +- Base URL and API key +- Model ID and optional alias -For detailed steps, follow the CLI onboarding docs above. +Multiple custom endpoints can coexist — each gets its own endpoint ID. diff --git a/docs/start/openclaw.md b/docs/start/openclaw.md index 3bb0b454b25..647877ad225 100644 --- a/docs/start/openclaw.md +++ b/docs/start/openclaw.md @@ -8,13 +8,13 @@ title: "Personal Assistant Setup" # Building a personal assistant with OpenClaw -OpenClaw is a WhatsApp + Telegram + Discord + iMessage gateway for **Pi** agents. Plugins add Mattermost. This guide is the "personal assistant" setup: one dedicated WhatsApp number that behaves like your always-on agent. +OpenClaw is a self-hosted gateway that connects WhatsApp, Telegram, Discord, iMessage, and more to AI agents. This guide covers the "personal assistant" setup: a dedicated WhatsApp number that behaves like your always-on AI assistant. ## ⚠️ Safety first You’re putting an agent in a position to: -- run commands on your machine (depending on your Pi tool setup) +- run commands on your machine (depending on your tool policy) - read/write files in your workspace - send messages back out via WhatsApp/Telegram/Discord/Mattermost (plugin) @@ -36,7 +36,7 @@ You want this: ```mermaid flowchart TB A["Your Phone (personal)

Your WhatsApp
+1-555-YOU"] -- message --> B["Second Phone (assistant)

Assistant WA
+1-555-ASSIST"] - B -- linked via QR --> C["Your Mac (openclaw)

Pi agent"] + B -- linked via QR --> C["Your Mac (openclaw)

AI agent"] ``` If you link your personal WhatsApp to OpenClaw, every message to you becomes “agent input”. That’s rarely what you want. diff --git a/docs/start/setup.md b/docs/start/setup.md index 70da5578c08..1b36e46b412 100644 --- a/docs/start/setup.md +++ b/docs/start/setup.md @@ -13,8 +13,6 @@ If you are setting up for the first time, start with [Getting Started](/start/ge For onboarding details, see [Onboarding (CLI)](/start/wizard). -Last updated: 2026-01-01 - ## TL;DR - **Tailoring lives outside the repo:** `~/.openclaw/workspace` (workspace) + `~/.openclaw/openclaw.json` (config). @@ -23,7 +21,7 @@ Last updated: 2026-01-01 ## Prereqs (from source) -- Node `>=22` +- Node 24 recommended (Node 22 LTS, currently `22.16+`, still supported) - `pnpm` - Docker (optional; only for containerized setup/e2e — see [Docker](/install/docker)) diff --git a/docs/start/showcase.md b/docs/start/showcase.md index 6ebcbdb2bcb..9b382a0e2f7 100644 --- a/docs/start/showcase.md +++ b/docs/start/showcase.md @@ -1,6 +1,5 @@ --- title: "Showcase" -description: "Real-world OpenClaw projects from the community" summary: "Community-built projects and integrations powered by OpenClaw" read_when: - Looking for real OpenClaw usage examples diff --git a/docs/tools/acp-agents.md b/docs/tools/acp-agents.md index d8ac5b5f7d3..76c7847a8cc 100644 --- a/docs/tools/acp-agents.md +++ b/docs/tools/acp-agents.md @@ -415,7 +415,7 @@ Some controls depend on backend capabilities. If a backend does not support a co | `/acp cwd` | Set runtime working directory override. | `/acp cwd /Users/user/Projects/repo` | | `/acp permissions` | Set approval policy profile. | `/acp permissions strict` | | `/acp timeout` | Set runtime timeout (seconds). | `/acp timeout 120` | -| `/acp model` | Set runtime model override. | `/acp model anthropic/claude-opus-4-5` | +| `/acp model` | Set runtime model override. | `/acp model anthropic/claude-opus-4-6` | | `/acp reset-options` | Remove session runtime option overrides. | `/acp reset-options` | | `/acp sessions` | List recent ACP sessions from store. | `/acp sessions` | | `/acp doctor` | Backend health, capabilities, actionable fixes. | `/acp doctor` | diff --git a/docs/tools/brave-search.md b/docs/tools/brave-search.md new file mode 100644 index 00000000000..12cd78c358f --- /dev/null +++ b/docs/tools/brave-search.md @@ -0,0 +1,93 @@ +--- +summary: "Brave Search API setup for web_search" +read_when: + - You want to use Brave Search for web_search + - You need a BRAVE_API_KEY or plan details +title: "Brave Search" +--- + +# Brave Search API + +OpenClaw supports Brave Search API as a `web_search` provider. + +## Get an API key + +1. Create a Brave Search API account at [https://brave.com/search/api/](https://brave.com/search/api/) +2. In the dashboard, choose the **Search** plan and generate an API key. +3. Store the key in config or set `BRAVE_API_KEY` in the Gateway environment. + +## Config example + +```json5 +{ + plugins: { + entries: { + brave: { + config: { + webSearch: { + apiKey: "BRAVE_API_KEY_HERE", + }, + }, + }, + }, + }, + tools: { + web: { + search: { + provider: "brave", + maxResults: 5, + timeoutSeconds: 30, + }, + }, + }, +} +``` + +Provider-specific Brave search settings now live under `plugins.entries.brave.config.webSearch.*`. +Legacy `tools.web.search.apiKey` still loads through the compatibility shim, but it is no longer the canonical config path. + +## Tool parameters + +| Parameter | Description | +| ------------- | ------------------------------------------------------------------- | +| `query` | Search query (required) | +| `count` | Number of results to return (1-10, default: 5) | +| `country` | 2-letter ISO country code (e.g., "US", "DE") | +| `language` | ISO 639-1 language code for search results (e.g., "en", "de", "fr") | +| `ui_lang` | ISO language code for UI elements | +| `freshness` | Time filter: `day` (24h), `week`, `month`, or `year` | +| `date_after` | Only results published after this date (YYYY-MM-DD) | +| `date_before` | Only results published before this date (YYYY-MM-DD) | + +**Examples:** + +```javascript +// Country and language-specific search +await web_search({ + query: "renewable energy", + country: "DE", + language: "de", +}); + +// Recent results (past week) +await web_search({ + query: "AI news", + freshness: "week", +}); + +// Date range search +await web_search({ + query: "AI developments", + date_after: "2024-01-01", + date_before: "2024-06-30", +}); +``` + +## Notes + +- OpenClaw uses the Brave **Search** plan. If you have a legacy subscription (e.g. the original Free plan with 2,000 queries/month), it remains valid but does not include newer features like LLM Context or higher rate limits. +- Each Brave plan includes **\$5/month in free credit** (renewing). The Search plan costs \$5 per 1,000 requests, so the credit covers 1,000 queries/month. Set your usage limit in the Brave dashboard to avoid unexpected charges. See the [Brave API portal](https://brave.com/search/api/) for current plans. +- The Search plan includes the LLM Context endpoint and AI inference rights. Storing results to train or tune models requires a plan with explicit storage rights. See the Brave [Terms of Service](https://api-dashboard.search.brave.com/terms-of-service). +- Results are cached for 15 minutes by default (configurable via `cacheTtlMinutes`). + +See [Web tools](/tools/web) for the full web_search configuration. diff --git a/docs/tools/browser.md b/docs/tools/browser.md index dc044450742..4797bc7409b 100644 --- a/docs/tools/browser.md +++ b/docs/tools/browser.md @@ -581,7 +581,7 @@ Notes: - `--format ai` (default when Playwright is installed): returns an AI snapshot with numeric refs (`aria-ref=""`). - `--format aria`: returns the accessibility tree (no refs; inspection only). - `--efficient` (or `--mode efficient`): compact role snapshot preset (interactive + compact + depth + lower maxChars). - - Config default (tool/CLI only): set `browser.snapshotDefaults.mode: "efficient"` to use efficient snapshots when the caller does not pass a mode (see [Gateway configuration](/gateway/configuration#browser-openclaw-managed-browser)). + - Config default (tool/CLI only): set `browser.snapshotDefaults.mode: "efficient"` to use efficient snapshots when the caller does not pass a mode (see [Gateway configuration](/gateway/configuration-reference#browser)). - Role snapshot options (`--interactive`, `--compact`, `--depth`, `--selector`) force a role-based snapshot with refs like `ref=e12`. - `--frame "