arrow_back
Artificial intelligence

OpenClaw: installation and configuration

Andrew Dorokhov Andrew Dorokhov schedule 4 min read

Notes on installing and configuring open_in_new OpenClaw — a personal AI assistant.

Installation

Option 1: Using npm

OpenClaw is available as a package in the npm registry. So we can install it using npm:

npm install -g openclaw

After installation, we can start the Gateway and run the onboarding wizard:

openclaw onboard --install-daemon
openclaw gateway install # without running the onboarding wizard

Option 2: Using a script

There is a script that checks and installs all the requirements and then installs OpenClaw:

curl -fsSL https://openclaw.ai/install.sh | bash

This script installs the latest version of OpenClaw, starts the Gateway, and runs the onboarding wizard (openclaw onboard). More simple than using npm.

Option 3: from scratch

If we want to install OpenClaw from scratch, we can use the following commands:

git clone https://github.com/openclaw/openclaw.git .
pnpm install && pnpm build && pnpm ui:build
pnpm link --global
openclaw onboard --install-daemon

Option 4: using Docker

There’s a script in the repo that installs OpenClaw using Docker:

./scripts/docker/setup.sh

This script does the following:

  • Checks if Docker and Docker Compose are installed.
  • Determines the Docker socket.
  • Creates directories on the host machine:
~/.openclaw/
~/.openclaw/workspace/
~/.openclaw-auth-profile-secrets/
~/.openclaw/identity/
~/.openclaw/agents/main/agent/
~/.openclaw/agents/main/sessions/
  • Looks for Gateway token (in OPENCLAW_GATEWAY_TOKEN variable, openclaw.json, .env file), creates a new one if not found.
  • Builds the Gateway image either using Dockerfile or by pulling it from the registry (based on the IMAGE_NAME environment variable).
  • Changes the owner of the .openclaw directory to node:node.
  • Runs the onboarding wizard.

Pre configuration and installation:

git clone https://github.com/openclaw/openclaw.git .

export OPENCLAW_IMAGE="ghcr.io/openclaw/openclaw:latest"
export OPENCLAW_CONFIG_DIR="$(pwd)/volumes/openclaw"
export OPENCLAW_WORKSPACE_DIR="$(pwd)/volumes/openclaw/workspace"
export OPENCLAW_AUTH_PROFILE_SECRET_DIR="$(pwd)/volumes/openclaw-auth-profile-secrets"

bash scripts/docker/setup.sh

As a resul, we can leave the following files in the project:

.env
docker-compose.yml
volumes/

Checking the installation

Verify that the Gateway is running:

openclaw gateway status
docker compose run --rm openclaw-cli gateway status

Configuration

Approve Telegram channel access:

docker compose run --rm openclaw-cli pairing approve telegram YOURCODE

Configuring the models and providers

In openclaw.json you can configure the default model:

{
  "agents": {
    "defaults": {
      "workspace": "/home/node/.openclaw/workspace",
      "models": {
        "anthropic/claude-opus-4-8": {},
        "anthropic/claude-sonnet-4-6": {},
        "anthropic/claude-haiku-4-5": {}
      },
      "model": {
        "primary": "anthropic/claude-haiku-4-5"
      },
      "sandbox": {
        "mode": "off"
      }
    }
  },
}

agents.defaults.models is the allowlist/catalog of models OpenClaw can use.

If you want to add a custom model or provider, you can do it like this:

{
    "models": {
        "providers": {
            "anthropic": {
                "models": [
                    {
                        "id": "claude-haiku-4-5",
                        "name": "Claude Haiku 4.5"
                    }
                ]
            }
        }
    }
}

List all available models and providers:

docker compose run --rm openclaw-cli models list

Authenticate with a model provider:

docker compose run --rm openclaw-cli models auth login
docker compose run --rm openclaw-cli models auth login --provider anthropic

Set the default model:

docker compose run --rm openclaw-cli models set anthropic/claude-haiku-4-5

Working with agents

Show help for the agent command:

docker compose run --rm openclaw-cli agent --help

List all agents:

docker compose run --rm openclaw-cli agents list

Debugging

Follow the logs:

docker compose run --rm openclaw-cli logs --follow

Workspace structure

  • AGENTS.md - the main system prompt.
  • SOUL.md - this file describes who the agent is.
  • USER.md - this file describes whom the agent serves.

Context

Context is the data that the agent uses to generate a response.

Context consists of the following parts:

  • System prompt (OpenClaw-built): rules, tools, skills list, time/runtime, and injected workspace files.
  • Conversation history: your messages + the assistant’s messages for this session.
  • Tool calls/results + attachments: command output, file reads, images/audio, etc.

You can use these five commands to check the context:

  • /status - show the current status.
  • /context - show the available commands for context management.
  • /context list - show the short breakdown.
  • /context detail - show the detailed breakdown (per-file + per-tool + per-skill + system prompt size + compactable transcript counts).
  • /context map - show the treemap image.

This way you can check what files are injected into the context.

Interesting commands:

  • /usage tokens - append per-reply usage footer to normal replies.
code

Need Help with Development?

Happy to help — reach out via the contacts or go straight to my Upwork profile.

work View Upwork Profile arrow_forward
article Contents (1)