OpenClaw Deep Dive Guide: Self-Host Your Own AI Agent on Any VPS (2026)

Dev.to / 2026/4/13

💬 オピニオンDeveloper Stack & InfrastructureIdeas & Deep AnalysisTools & Practical Usage

要点

  • OpenClaw is an open-source, self-hosted AI agent orchestration platform that helps turn multiple LLM options (Claude, GPT, Gemini, and local models) into persistent assistants that retain context across sessions.
  • Unlike typical chatbots, OpenClaw emphasizes autonomous execution, including scheduled/cron-driven tasks and the ability to perform real actions on the user’s own VPS.
  • The platform supports multi-channel interaction by enabling agents to communicate through messaging platforms such as Discord, Telegram, and Zalo, and can also connect to companion apps on mobile and macOS.
  • OpenClaw is designed with modular architecture and persistence-based “long-term memory,” enabling file-based storage and sub-agent spawning for parallel work.
  • The guide outlines full setup, architecture, features, and practical developer use cases for running AI agents 24/7 while keeping data on the user’s infrastructure.

Originally published on NextFuture

TL;DR: OpenClaw is a self-hosted AI agent orchestration platform that turns Claude, GPT, Gemini, and local models into persistent, memory-aware assistants. Unlike chatbots that forget everything between sessions, OpenClaw agents remember context, run scheduled tasks, respond across Discord/Telegram/Zalo, and execute real work on your server — all from a single VPS. This guide covers the full architecture, setup, features, and practical use cases for developers who want to run their own AI agent 24/7.

Why Self-Hosted AI Agents Matter in 2026

The AI landscape in 2026 is flooded with chatbot wrappers. ChatGPT, Claude, Gemini — they all do one thing well: answer questions in a browser tab. But the moment you close that tab, the conversation is gone. The context is gone. The work is gone.

For developers and power users, this isn't enough. You need an AI that:

- **Remembers** your projects, preferences, and past decisions across sessions

- **Runs autonomously** — writing content, checking systems, sending reports — even when you're asleep

- **Lives where you work** — Discord, Telegram, your terminal — not just a browser tab

- **Respects your data** — everything stays on your server, not in someone else's cloud

This is exactly what OpenClaw does. It's not another chatbot UI. It's the infrastructure layer that turns any LLM into a persistent, autonomous agent that runs on your hardware.

What Is OpenClaw?

OpenClaw is an open-source AI agent orchestration platform designed for self-hosting. You install it on a VPS (or any Linux machine), connect your preferred AI models, and get a persistent agent that can:

- Chat with you across multiple messaging platforms simultaneously

- Execute scheduled tasks via a built-in cron system

- Maintain long-term memory using a file-based persistence layer

- Run code, manage files, and interact with external APIs

- Spawn sub-agents for parallel work

- Connect to companion apps on Android, iOS, and macOS

"OpenClaw isn't trying to be a better chatbot. It's trying to be the operating system for your AI agent." — OpenClaw Documentation

Architecture Overview

OpenClaw follows a modular architecture with clear separation of concerns:

    Layer
    Role
    Examples




    **Model Layer**
    LLM reasoning engine
    Claude Opus/Sonnet, GPT-5-mini, Gemini Flash, Ollama (local)


    **Agent Layer**
    Session management, memory, identity
    Main agent, ClaudeCode agent, isolated cron agents


    **Skill Layer**
    Reusable capabilities
    GitHub ops, copywriting, frontend design, weather


    **Channel Layer**
    Multi-platform communication
    Discord, Telegram, Zalo, QQ Bot, terminal


    **Gateway Layer**
    Device control and pairing
    Companion apps, Tailscale networking


    **Scheduler Layer**
    Autonomous task execution
    Cron jobs, heartbeats, delivery queues

Everything runs from a single directory — ~/.openclaw/ — with JSON configuration files and markdown-based memory. No database required for the platform itself.

Core Features Deep Dive

1. Multi-Model Flexibility

OpenClaw doesn't lock you into a single AI provider. You configure model profiles with fallback chains, and the platform automatically switches if your primary model is unavailable:

{
  "agents": {
    "main": {
      "model": "claude-sonnet-4-6",
      "fallbacks": ["claude-opus-4-6", "gpt-5-mini"],
      "plugins": ["anthropic", "github-copilot", "google"]
    }
  }
}

Supported providers include:

- **Anthropic:** Claude Opus 4.6, Sonnet 4.6, Haiku 4.5

- **GitHub Copilot:** GPT-5-mini, Claude models via Copilot token

- **Google:** Gemini Flash, Gemini Flash Lite, Gemma-4-26b-it

- **Ollama:** Any local model (Qwen3, Llama, Mistral, etc.)

The key insight: you can assign different models to different tasks. Use Opus for long-form content generation (where reasoning depth matters), Sonnet for daily reports (fast and cheap), and Haiku for quick lookups. This isn't just cost optimization — it's matching the right brain to the right job.

2. Persistent Memory System

This is where OpenClaw fundamentally differs from every chatbot. The memory system has three layers:

    Layer
    File
    Purpose
    Lifespan




    **Identity**
    SOUL.md, IDENTITY.md
    Who the agent is, boundaries, personality
    Permanent


    **Long-term**
    MEMORY.md + memory/*.md
    User preferences, project context, credentials, decisions
    Months to years


    **Session**
    Session history
    Current conversation context
    Single session

The MEMORY.md file acts as an index — a curated knowledge base that the agent reads at the start of every session. Individual memory files store detailed context organized by type:

- **User memories:** Who you are, your role, preferences, expertise level

- **Feedback memories:** How you want the agent to behave (corrections and confirmations)

- **Project memories:** Ongoing work, deadlines, decisions, constraints

- **Reference memories:** Pointers to external systems (Linear boards, Grafana dashboards, Slack channels)

Here's what this looks like in practice: you tell the agent once that you prefer integration tests over mocks, and it remembers that in every future session. You mention a code freeze on Thursday, and it factors that into suggestions all week. This isn't magic — it's structured file-based persistence that the agent maintains itself.

3. Cron Scheduling with Isolated Sessions

OpenClaw's cron system is one of its most powerful features. Unlike simple task schedulers, each cron job runs in an isolated agent session — meaning scheduled tasks don't pollute your main conversation context.

{
  "id": "content-engine",
  "schedule": { "kind": "cron", "expression": "0 1,13 * * *" },
  "prompt": "Write a new SEO-optimized article...",
  "model": "claude-opus-4-6",
  "thinking": "medium",
  "sessionTarget": "isolated",
  "delivery": {
    "mode": "announce",
    "targets": [{ "channel": "discord", "id": "channel-id" }]
  }
}

Key scheduling features:

- **Cron expressions:** Standard 5-field cron with timezone awareness

- **Model overrides:** Each job can use a different model and thinking level

- **Session isolation:** Jobs run in their own context, keeping your main session clean

- **Delivery routing:** Results can be announced to Discord, sent via webhook, or kept silent

- **Failure tracking:** Consecutive error counts, cooldown periods, alert routing

- **Extended thinking:** Configure reasoning depth per job (high/medium/low)

Real-world example: you can set up a content engine that writes two SEO articles per day at 1 AM and 1 PM, a weekly deep-dive guide on Saturdays, and a daily traffic report at 11 PM — all running autonomously while you sleep.

4. Skills Ecosystem (ClawHub)

Skills are reusable capability modules that extend what your agent can do. Think of them as plugins with context — each skill comes with domain knowledge, not just tool definitions.

Skills are defined in SKILL.md files with YAML frontmatter:

---
name: github
description: "GitHub operations via gh CLI"
metadata:
  version: 1.0.0
---

# GitHub Skill

Use gh CLI for issues, PRs, CI runs, code review...

OpenClaw ships with 20+ pre-built skills from ClawHub:

    Category
    Skills




    **Development**
    github, coding-agent, claude-api, simplify


    **Content**
    copywriting, frontend-design, web-design-guidelines


    **Design**
    product-designer, UI/UX pro


    **Operations**
    healthcheck, schedule, loop, tmux


    **Integrations**
    discord, weather, gh-issues, node-connect


    **Workflow**
    taskflow, taskflow-inbox-triage, skill-creator

You can also create custom skills for your specific workflows. The skill-creator meta-skill even helps you build new skills interactively.

5. Multi-Channel Communication

Your agent isn't trapped in a single interface. OpenClaw supports simultaneous connections to multiple messaging platforms:

- **Discord:** Full guild/channel support with @mention detection, group/DM policies, per-channel scoping

- **Telegram:** Bot API integration with update offset tracking

- **Zalo:** Vietnamese messaging platform support

- **QQ Bot:** Chinese messaging platform support

- **Terminal:** Direct CLI access via Claude Code

Each channel has configurable policies:

- **Group policy:** Allowlist or denylist specific channels

- **DM policy:** Open, closed, or allowlist-only

- **Session scoping:** Per-channel-peer isolation for privacy

This means you can have a public Discord bot for your community that uses the same agent brain as your private Telegram assistant — but with different permission levels and conversation contexts.

6. Device Gateway and Companion Apps

OpenClaw includes a gateway system for connecting companion apps on Android, iOS, and macOS. Once paired, your agent can interact with your devices — reading notifications, checking calendars, or triggering automations.

The gateway runs on a configurable port with token-based authentication and a command denylist for safety:

{
  "gateway": {
    "port": 18789,
    "mode": "local",
    "denyCommands": [
      "camera.snap", "camera.clip", "screen.record",
      "contacts.add", "sms.send", "sms.search"
    ]
  }
}

Safety is built in: sensitive commands like camera access and SMS are denied by default. You explicitly opt in to what you're comfortable with.

7. Heartbeat System

Instead of creating dozens of separate cron jobs for small checks, OpenClaw uses a heartbeat system. The agent periodically wakes up and runs through a checklist of quick tasks — checking email, monitoring mentions, reviewing weather — all in a single session.

This is more efficient than individual cron jobs because:

- One session handles multiple checks (less API cost)

- Checks can be dynamically prioritized

- The agent decides what's worth reporting vs. silently noting

8. Extended Thinking Per Task

Not every task needs the same depth of reasoning. OpenClaw lets you configure thinking levels per cron job or interaction:

    Thinking Level
    Use Case
    Token Cost




    **High**
    Long-form guides, complex analysis, architecture decisions
    Higher


    **Medium**
    SEO articles, code reviews, technical writing
    Moderate


    **Low**
    Quick reports, status checks, simple lookups
    Lower

This means your 2,500-word Saturday guide gets deep reasoning while your daily status report stays fast and cheap.

Setting Up OpenClaw: A Practical Walkthrough

Prerequisites

- A Linux VPS (2 CPU / 2 GB RAM minimum — a $12/month DigitalOcean droplet works fine)

- Node.js 22+

- At least one AI provider API key (Anthropic, OpenAI, Google, or a local Ollama instance)

Step 1: Install OpenClaw

# Install via npm (recommended)
npm install -g @anthropic-ai/claude-code

# Or use the standalone installer
curl -fsSL https://openclaw.dev/install.sh | bash

Step 2: Bootstrap Your Agent

On first run, OpenClaw creates the workspace structure:

~/.openclaw/
├── openclaw.json          # Main configuration
├── workspace/
│   ├── SOUL.md            # Agent personality
│   ├── IDENTITY.md        # Agent identity
│   ├── USER.md            # Your context
│   ├── MEMORY.md          # Long-term memory index
│   ├── HEARTBEAT.md       # Periodic check tasks
│   ├── skills/            # Custom skills
│   └── memory/            # Detailed memory files
├── agents/                # Agent sessions
├── cron/                  # Scheduled jobs
├── credentials/           # Auth tokens
└── devices/               # Paired companions

Step 3: Configure Your Models

Edit openclaw.json to add your preferred AI providers:

{
  "version": "2026.4.10",
  "agents": {
    "main": {
      "model": "claude-sonnet-4-6",
      "fallbacks": ["claude-haiku-4-5"],
      "auth": {
        "anthropic": { "type": "oauth" },
        "google": { "type": "api-key", "key": "your-key" }
      }
    }
  }
}

Step 4: Connect Messaging Channels

Add Discord, Telegram, or other channels to your configuration. Each channel gets its own section with policy controls:

{
  "channels": {
    "discord": {
      "enabled": true,
      "guilds": {
        "your-guild-id": {
          "enabledChannels": ["channel-1", "channel-2"],
          "mentionConfig": { "respondToMentions": true }
        }
      },
      "dmPolicy": "open"
    }
  }
}

Step 5: Set Up Cron Jobs

Define your scheduled tasks in ~/.openclaw/cron/jobs.json. Start with something simple — like a daily summary:

{
  "id": "daily-report",
  "enabled": true,
  "schedule": { "kind": "cron", "expression": "0 23 * * *" },
  "timezone": "Asia/Saigon",
  "prompt": "Generate a daily summary of today's work and key metrics.",
  "model": "claude-sonnet-4-6",
  "sessionTarget": "isolated",
  "delivery": {
    "mode": "announce",
    "targets": [{ "channel": "discord", "id": "your-channel" }]
  }
}

Real-World Use Cases

Content Automation Pipeline

Set up cron jobs that research trending topics, write SEO-optimized articles, and publish them to your blog — twice a day, fully automated. The agent uses its memory to maintain consistent voice and avoid duplicate topics.

DevOps Assistant

Monitor your infrastructure, run health checks, and get proactive alerts in Discord when something looks wrong. The heartbeat system checks server metrics, SSL certificates, and deployment status on a schedule you define.

Multi-Platform Community Manager

Run a single agent that manages your Discord server, responds to Telegram messages, and handles support queries — with shared context across all platforms. The agent remembers each user's history regardless of which platform they're on.

Personal Research Assistant

Use the agent to track topics you care about, summarize papers, and maintain a knowledge base that grows over time. Skills like web search and GitHub integration let it pull information from multiple sources.

OpenClaw vs. Alternatives

    Feature
    OpenClaw
    LangGraph
    AutoGen
    Custom Claude API




    Self-hosted
    Yes
    Yes
    Yes
    Yes


    Persistent memory
    Built-in (file-based)
    Manual setup
    Limited
    You build it


    Multi-model support
    4+ providers + local
    Via adapters
    OpenAI-focused
    Anthropic only


    Cron scheduling
    Built-in with isolation
    External (Celery, etc.)
    No
    You build it


    Multi-channel chat
    Discord, Telegram, Zalo, QQ
    No
    No
    You build it


    Skills/plugins
    ClawHub marketplace
    LangChain tools
    Skills
    Tool use API


    Device gateway
    Yes (companion apps)
    No
    No
    No


    Setup complexity
    Low (npm install + config)
    Medium (Python + infra)
    Medium
    High (build everything)


    Agent identity/personality
    SOUL.md, IDENTITY.md
    System prompt only
    System prompt only
    System prompt only

Cost Breakdown

Running OpenClaw is surprisingly affordable:

    Component
    Cost
    Notes




    VPS (DigitalOcean 2CPU/2GB)
    ~$12/month
    Runs OpenClaw + your apps


    Claude API (moderate usage)
    ~$20-50/month
    Depends on cron frequency and model choice


    Domain + DNS
    ~$10/year
    Optional for gateway access


    **Total**
    **~$35-65/month**
    For a 24/7 AI agent with full capabilities

Compare this to managed solutions that charge $100+/month for far less flexibility. The trade-off is that you manage the server — but for developers, that's a feature, not a bug.

Tips for Getting the Most Out of OpenClaw

- Invest in SOUL.md early. The better you define your agent's personality and boundaries, the more consistent its behavior will be across sessions.

  • Use model tiers strategically. Don't use Opus for everything. Match model capability to task complexity — it saves money and often produces better results.

  • Keep MEMORY.md curated. Think of it as a Wikipedia article about your working relationship, not a chat log. Remove outdated entries, merge duplicates, and keep it under 200 lines.

  • Start with one cron job. Get a daily report working perfectly before adding more. It's tempting to automate everything at once, but reliability beats quantity.

  • Use isolated sessions for cron. Always set sessionTarget: "isolated" for scheduled tasks. Mixing cron output into your main conversation creates noise.

  • Build custom skills for repeated workflows. If you find yourself giving the same instructions across multiple sessions, that's a skill waiting to be created.




What's Coming Next

OpenClaw is actively developed with several features on the roadmap:

- TaskFlow orchestration: Multi-step workflows with conditional branching and human-in-the-loop checkpoints

  • ClawHub marketplace expansion: Community-contributed skills with versioning and updates

  • Enhanced device gateway: Deeper integration with mobile companion apps

  • Multi-agent collaboration: Multiple agents working together on complex projects




FAQ

Is OpenClaw free?

The platform itself is open-source. You pay for the AI model API usage (Anthropic, OpenAI, Google) and your server hosting. There's no platform fee.

Can I run it without a cloud API key?

Yes — you can use Ollama with local models like Qwen3, Llama, or Mistral. Performance depends on your hardware, but it works for lighter tasks.

How much RAM does it need?

OpenClaw itself is lightweight — 2 GB RAM is sufficient. The AI models run remotely via API, so your server doesn't need a GPU.

Can multiple people use the same agent?

Yes. Multi-channel support with per-user session scoping means different users can interact with the same agent without seeing each other's conversations.

How is this different from just using Claude Code?

Claude Code is one of the runtimes OpenClaw can use. OpenClaw adds persistent memory, cron scheduling, multi-channel communication, device gateway, and skills on top of the base Claude Code experience. Think of Claude Code as the engine — OpenClaw is the full vehicle.

What happens if my server goes down?

All state is file-based, so recovery is straightforward — restart the service and the agent picks up where it left off. Memory and configuration survive reboots.

Can I use it for production workloads?

Many developers use OpenClaw for content automation, DevOps monitoring, and community management in production. The cron system includes failure tracking and alert routing for reliability.

This article was originally published on NextFuture. Follow us for more fullstack & AI engineering content.