← Back to Blog

OpenClaw Comprehensive Guide: From Beginner to Master

OpenClaw is more than just a command-line tool; it's an intelligent entity residing in your system. It has memory, can think, uses tools, and can even help you automate complex task pipelines. Built on Node.js, it acts as a local message router and Agent runtime, connecting mainstream AI models (especially the Anthropic Claude series) with system tools and 50+ integrations. This enables autonomous task execution without sending sensitive data to the cloud.

But this doesn't mean it's hard to get started. In fact, OpenClaw's design philosophy is progressive enhancement. You can treat it as a smarter CLI, or configure it as a super butler for automated operations.

This article will guide you from installation and configuration, gradually mastering workspace customization, multi-channel integration, Cron automation, Skill extension, and finally delving into custom Skill development and multi-Agent architecture design.


Phase One: Installation and Configuration

1. Environment Requirements

  • Node.js >= 22 (nvm recommended for version management)
  • Operating System: macOS, Linux, Windows (WSL) are all supported
  • An API Key for an AI model (Anthropic, OpenAI, or Google)

2. Install Gateway

npm install -g openclaw
openclaw onboard --install-daemon

The onboard wizard will guide you through the initial setup, including installing the Gateway daemon (launchd on macOS, systemd user service on Linux) to ensure it runs continuously in the background.

3. Configure AI Model

openclaw models auth setup-token   # Configure Anthropic API Key (recommended)
openclaw models set <model>        # Set primary model
openclaw models aliases add <alias> <model>  # Create model alias

OpenClaw has a built-in automatic failover mechanism: when the primary model is unavailable, it automatically switches to a fallback model, with cooldown times incrementally increasing from 1 minute to 5 minutes, then to 1 hour.


Phase Two: Establishing Connection (Beginner Level)

When first encountering OpenClaw, the most important thing is to get used to "conversing" with it, rather than "typing commands."

1. Natural Language Interaction

Forget complex parameters. Just tell it what you want to do:

"Compress all PNG images in this folder." "Go find out what the latest Node.js LTS version is."

2. Context Awareness

OpenClaw has a good memory. You don't need to repeat the subject of every sentence:

User: "Read README.md." Agent: (Reading file...) User: "Fix the typo on line 5." (It knows which file you're referring to)

3. Workspace File Overview

OpenClaw's core configuration is stored in the workspace directory (~/.openclaw/workspace). Here is a complete list of files:

File Purpose
AGENTS.md Agent's operational instructions, defining behavior rules
SOUL.md Defines the Agent's personality, tone, and behavioral boundaries
USER.md Stores your personal information and preferences
IDENTITY.md Agent's name, Emoji, and theme settings
MEMORY.md Curated long-term memories (only loaded in DM sessions)
memory/YYYY-MM-DD.md Daily appended log; reads today's and yesterday's content on system startup
TOOLS.md Local tool documentation
HEARTBEAT.md Task list for automatic heartbeat checks
BOOT.md Startup initialization checklist

Among them, SOUL.md is the most interesting — do you want your Agent to be serious, lively, or like a pirate? All are possible.

4. Overview of Built-in Tools

OpenClaw provides a rich set of built-in tools that the Agent can call at any time:

Tool Function
exec Execute shell commands in the workspace, supports timeouts and automatic backgrounding
read / write / edit File system operations
browser Control a dedicated browser instance, supports snapshots, screenshots, UI interaction
web_search Internet search (based on Brave Search API)
web_fetch Fetch web content and convert it to Markdown
image Image analysis (requires imageModel configuration)
pdf PDF document analysis, supports page ranges and multiple documents
message Cross-platform message sending (Discord, Slack, Telegram, WhatsApp, etc.)
nodes Discover and control paired devices
sessions_spawn Generate sub-Agents to handle background tasks
cron Manage scheduled tasks
canvas Drive Canvas for presentations and A2UI interaction

Phase Three: Multi-Channel Integration

One of OpenClaw's major highlights is its multi-channel inbox — it supports almost every instant messaging platform you can think of:

Supported Channels: WhatsApp, Telegram, Slack, Discord, Google Chat, Signal, BlueBubbles (iMessage), IRC, Microsoft Teams, Matrix, Feishu, LINE, Mattermost, Nextcloud Talk, Nostr, Synology Chat, Twitch, WebChat, etc.

Connect Channels

openclaw channels login              # WhatsApp QR code pairing
openclaw channels add --token <TOKEN> # Telegram / Discord / Slack

Session Scope

For multi-user scenarios, it is recommended to configure session.dmScope to prevent context leakage:

Mode Description
main Default, all messages share one session
per-peer Each contact has an independent session
per-channel-peer Each channel + contact has an independent session (Recommended)
per-account-channel-peer Most granular isolation

Session reset modes support daily (4 AM every day) or idle (after a certain number of idle minutes).


Phase Four: Automation and Division of Labor (Intermediate Level)

Once you're familiar with basic operations, you'll realize it's a waste not to let it actively work.

1. Cron Scheduled Tasks

Let the Agent become your 24-hour butler.

openclaw cron add     # Add a scheduled task
openclaw cron list    # View all tasks
openclaw cron run <id>  # Manually trigger

Scenario Example: Check GitHub Trending every morning at 9 AM, summarize, and send to a Slack channel.

2. Skill System

Skills are OpenClaw's "skill packs" — Skills are textbooks, Tools are basic abilities. Tools empower the Agent to read files, execute commands, and browse the web; Skills teach it how to disciplinedly combine these abilities to complete specific tasks.

Common built-in Skills:

  • coding-agent: Specialized in writing code, with stricter logic
  • web_search: Internet search, no more making things up
  • healthcheck: Checks system security
  • gog: Google Workspace integration (mail, calendar)
  • obsidian: Note management
  • github: Repository management and PR operations

Through ClawHub, you can get 5400+ community-contributed Skills:

clawhub install <skill-slug>   # Install community Skill
clawhub update --all           # Update all installed Skills

3. Sub-Agent

When a task is too complex (e.g., "research 10 competitors and write a report"), the main session will be blocked.

# Use in conversation
sessions_spawn(task="Research the performance comparison of React vs Vue vs Svelte, and write a report")

It will work silently in the background and report back to you when finished, without occupying your main window. Related management tools:

  • sessions_list — View all sessions
  • sessions_history — View session history
  • sessions_send — Send messages to other sessions
  • agents_list — List available Agent IDs

4. Hooks (Event Hooks)

Hooks allow you to automatically trigger actions when specific events occur:

Event Description
command:new New session started
command:reset Session reset
command:stop Session stopped
gateway:startup Gateway started
agent:bootstrap Agent initialized
openclaw hooks enable <name>   # Enable Hook

The built-in session-memory Hook automatically saves session context every time /new is used.


Phase Five: Custom Skill Development (Advanced Level)

When you start writing your own Skills, you enter the advanced domain.

1. Why Custom Skills?

When you find yourself repeatedly doing the same thing — writing blog posts in a specific format, automating deployments, calling a specific API — it's time to encapsulate it as a Skill.

Benefits of Skills:

  • Standardization: Avoid omissions from manual operations
  • Reusability: Agents can call them at any time
  • Clear Context: The Skill's Description and Prompt guide the Agent to use it correctly

2. Skill Loading Priority

Skills are loaded from three locations, with priority from high to low:

  1. Workspace Skills (<workspace>/skills/) — Highest priority
  2. Managed Skills (~/.openclaw/skills/) — Shared by all Agents
  3. Built-in Skills — Included with installation
  4. Extra Directories (configured via skills.load.extraDirs) — Lowest priority

In case of name conflicts, higher priority overrides lower priority.

3. SKILL.md Explained

The core of a Skill is its SKILL.md file. OpenClaw only recognizes YAML Frontmatter.

Minimum Structure:

---
name: my-awesome-skill
description: This skill does awesome things.
---

# My Awesome Skill

Detailed usage instructions and Prompt...

Complete Frontmatter Fields:

Field Description
name Skill identifier
description Human-readable description
homepage Optional website URL
user-invocable Boolean; whether to expose as a slash command (default true)
disable-model-invocation Boolean; exclude from model prompts (default false)
command-dispatch Set to tool to bypass model routing
command-tool Name of the tool for direct dispatch
metadata Single-line JSON, for environment gating and configuration

4. Metadata Gating

Control Skill loading conditions via the metadata field:

metadata: {"openclaw":{"emoji":"📊","requires":{"bins":["bash","date"],"env":["MY_API_KEY"],"os":["linux","darwin"]}}}

Gating options:

  • always: true — Load unconditionally
  • os — Restrict operating system (darwin, linux, win32)
  • requires.bins — Required command-line tools
  • requires.env — Required environment variables
  • requires.configopenclaw.json config path that must be true
  • primaryEnv — Associated environment variable for skills.entries.<name>.apiKey

5. Elements of Writing High-Quality Skills

A qualified Skill should be like an "operations manual handed to an on-call engineer at 3 AM" — precise, defensive, and executable. It should include:

  • Applicable Scenarios: When to use this Skill
  • Input Requirements: Necessary paths, URLs, credentials
  • Workflow: Numbered steps with exact commands
  • Output Format: Consistent result structure
  • Guardrails: Safety constraints and anti-hallucination measures
  • Failure Handling: Error recovery steps
  • Examples: Typical queries and expected output

6. Development Process

Three ways to create:

  1. Conversational Drafting: Describe your automation needs, let the Agent generate a SKILL.md framework, then refine it into a formal version.
  2. Manual Creation: Create a folder, directly write SKILL.md, and validate with openclaw skills list.
  3. Fork + Narrow: Copy an existing community Skill and add your own guardrails (often the fastest way).
# Verify if the Skill is loaded correctly
openclaw skills list --verbose
openclaw skills info my-skill

7. Configure Skills in openclaw.json

{
  skills: {
    entries: {
      "my-skill": {
        enabled: true,
        apiKey: { source: "env", provider: "default", id: "MY_API_KEY" },
        env: { MY_API_KEY: "your-key-here" }
      }
    },
    load: {
      watch: true,          // Watch for SKILL.md changes, auto-refresh
      watchDebounceMs: 250
    }
  }
}

8. Token Cost

Each active Skill is injected into the system prompt. Cost estimation:

  • Base cost (with at least 1 Skill): approx. 195 characters
  • Per Skill: approx. 97 characters + name/description length
  • Rough estimate: approx. 24 tokens per Skill

Recommendation: Keep descriptions concise, disable unused Skills, and mark manually triggered Skills with disable-model-invocation.


Phase Six: Multi-Agent and Security (Architect Level)

1. Multi-Agent Architecture

Each Agent has an independent state space, stored under ~/.openclaw/agents/<id>/.

openclaw agents list           # List all Agents
openclaw agents add            # Add new Agent
openclaw agents list --bindings  # View routing bindings

Message routing can be allocated based on peer, guildId (Discord), teamId (Slack), accountId, or channel.

2. Sandbox Mode

OpenClaw uses Docker containers to provide execution isolation:

Mode Description
off Executes directly on the host machine
non-main Non-main sessions use the sandbox (Default)
all All sessions run in the sandbox

Scope options: session (per-session isolation), agent (per-Agent isolation), shared (shared container).

3. Heartbeat System

Configure heartbeat.every (default 30 minutes), and the Agent will periodically execute the checklist defined in HEARTBEAT.md and report its status.

4. Complex Pipelines

Using Cron's payload parameter, you can design an automated flow:

  1. Trigger: Cron scheduled trigger
  2. Action: Wake up a dedicated Writer Agent
  3. Delivery: After writing the article, automatically push to a Git repository and trigger a build script

5. Security Best Practices

  • Review Third-Party Skills: Treat every SKILL.md like a Code Review
  • Do Not Trust Obfuscated Shell Commands: Malicious software disguised as Skills has appeared in the community
  • Use Environment Variable Gating: Do not paste secrets into conversations
  • Limit Permission Scope: Only declare necessary tools and network calls

6. Diagnostic Commands

When encountering issues, these commands are your saviors:

openclaw doctor --deep --yes    # Comprehensive diagnosis
openclaw status --all --deep    # System status
openclaw security audit --fix   # Security audit with auto-fix
openclaw logs --follow          # Real-time logs

Summary

OpenClaw's power lies in its malleability.

  • Newcomers use it as an enhanced CLI
  • Intermediate users use it to connect multiple channels and run scheduled tasks
  • Experienced users use it for automated operations and developing custom Skills
  • Geeks use it to build multi-Agent collaborative JARVIS systems

No matter what stage you are at, remember to consult the documentation (openclaw help), browse ClawHub to discover new Skills, and try writing your own.

Happy Hacking with OpenClaw!


References:

Official Resources:

Chinese Community & Tutorials: