OpenClaw on a Lean VPS

Complete Optimization Guide for 1 vCPU, 2 GB RAM

Generated: April 20, 2026  ยท  Research by Babu AI

๐Ÿ“„ Deep Research Report  ยท  1 CPU  ยท  2 GB RAM

Table of Contents

TL;DR โ€” The Golden Rules 1. Channels: Resource Cost Analysis 2. Skills: What to Install (and What to Skip) 3. Config Tweaks for Small VPS 4. Background Process Management 5. Memory & Swap Management 6. Monitoring & Alerting 7. What to Absolutely Avoid 8. Recovery from Resource Exhaustion 9. Final Checklist

TL;DR โ€” The Golden Rules โ˜…

If you do nothing else, do this:


1. Channels: Resource Cost Analysis

Your choice of messaging channel is the single biggest runtime variable after config. Some channels maintain persistent WebSockets; others are purely webhook-driven. Here's the full breakdown for a 1 CPU / 2 GB VPS:

ChannelRAM (MB)PatternVerdict
webchat 10โ€“30 WebSocket / SSE per session BEST Zero external dependency
Telegram (webhook) 20โ€“40 Webhook-driven, no polling RECOMMENDED Very lightweight with webhook mode
Email (IMAP IDLE) 15โ€“40 Persistent IDLE connection EXCELLENT Event-driven, near-zero polling
Slack (webhook) 40โ€“80 Webhook callbacks, no persistent socket FINE Light if using Bolt webhook mode
Discord 50โ€“120 Persistent WebSocket gateway VIABLE Moderate overhead from WebSocket state
Matrix 50โ€“100 Client-server WebSocket / long-poll VIABLE Use Conduit/Dendrite over Synapse
SMS (Twilio) 5โ€“20 Webhook inbound, REST outbound LIGHT Inbound is webhook-only, but costs per message
WhatsApp (official API) 20โ€“50 Webhook-driven VIABLE Official API only โ€” unofficial libs are 150โ€“250 MB+
WhatsApp (Baileys / unofficial) 100โ€“250+ Persistent WebSocket + session sync AVOID Session state alone consumes 150+ MB
Signal 150โ€“250+ Signal protocol is CPU/RAM heavy AVOID No official bot API; experimental workarounds

Channel Verdict for Small VPS

๐Ÿฅ‡ BEST webchat

Minimal overhead. No external API dependencies. No rate limits. No persistent connections to manage. Scales predictably with concurrent users.

๐Ÿฅˆ EXCELLENT Telegram (webhook mode)

Set up a webhook endpoint and Telegram sends you message events โ€” zero polling. Very low RAM footprint. Requires a public HTTPS URL though.

AVOID MULTI-CHANNEL More than one channel simultaneously

Every additional channel adds a persistent connection, its own event queue, and memory overhead. On 1 CPU / 2 GB: run exactly one channel.


2. Skills: What to Install (and What to Skip)

What Makes a Skill Heavy

Recommended Minimum Skill Set

On 1 CPU / 2 GB, install only what you use every day. A lean setup looks like:

Everything else: install on demand, then uninstall or disable after use.

Skills to Skip on 2 GB VPS

SkillWhy to SkipRAM Impact
deep-research Spawns 5โ€“8 parallel subagents, each running full model inference with long context. Can saturate 2 GB alone. VERY HIGH
skill-creator Runs heavy tooling, file operations, may trigger sandbox image builds. HIGH
superpowers-planning / brainstorming / review These are fine in isolation, but combined with other skills they add up. Use one at a time. MEDIUM
Any Playwright/browser skill Each browser instance consumes 100โ€“300 MB. With no sandbox memory limits enforced, this is dangerous. VERY HIGH
blogwatcher Runs continuous feed monitoring subprocess. Best avoided on constrained RAM. MEDIUM

Skill Loading Overhead

Skills are loaded into the Node.js process at startup and kept resident. Each skill typically adds 5โ€“50 MB of RAM depending on dependencies. Loading 10 skills could consume 200โ€“400 MB of your 2 GB before doing anything.


3. Config Tweaks for Small VPS

The following openclaw.json changes are the most impactful for running lean on 1 CPU / 2 GB RAM:

Concurrency Limits โ€” The Big Ones

{
  "agents": {
    "defaults": {
      "maxConcurrent": 1,                    // <-- CRITICAL: one conversation at a time
      "subagents": {
        "maxConcurrent": 1,                  // <-- CRITICAL: one subagent task at a time
        "maxChildrenPerAgent": 2,             // limit parallel child subagents
        "maxSpawnDepth": 1,                   // no recursive subagent spawning
        "archiveAfterMinutes": 30              // auto-clean subagent sessions fast
      },
      "heartbeat": {
        "isolatedSession": true,              // stateless heartbeat โ€” no context carry
        "lightContext": true,                  // only HEARTBEAT.md loaded
        "every": "60m"                         // 60 min instead of default 30 min
      }
    }
  }
}

Session Pruning โ€” Don't Let History Grow

{
  "session": {
    "maintenance": {
      "pruneAfter": "7d",        // evict sessions older than 7 days
      "maxEntries": 100,        // cap session store entries
      "rotateBytes": 5000000,    // rotate at 5 MB
      "maxDiskBytes": "100mb"    // per-agent session disk budget
    },
    "idleMinutes": 30,
    "store": "jsonl"
  }
}

Cron Jobs โ€” Sequential Only

{
  "cron": {
    "maxConcurrentRuns": 1,       // <-- CRITICAL: never run cron jobs in parallel
    "sessionRetention": "1h",     // prune cron run sessions after 1 hour
    "runLog": {
      "maxBytes": 500000,         // 500 KB max per cron run log
      "keepLines": 500            // truncate aggressively
    }
  }
}

Context Limits โ€” Stay Lean Per Turn

{
  "agents": {
    "defaults": {
      "contextLimits": {
        "memoryGetMaxChars": 6000,      // truncate memory reads at 6K chars
        "toolResultMaxChars": 8000,     // truncate tool outputs at 8K
        "postCompactionMaxChars": 900   // minimal context after compaction
      },
      "compaction": {
        "reserveTokensFloor": 4000,
        "truncateAfterCompaction": true  // wipe raw transcript after summarization
      },
      "contextPruning": {
        "mode": "cache-ttl",
        "softTrim": { "maxChars": 2000 }
      }
    }
  }
}

Logging โ€” Reduce I/O and Memory

{
  "logging": {
    "level": "warn",           // drop info/debug to reduce log volume
    "maxFileBytes": 10000000,  // 10 MB cap per log file
    "consoleLevel": "error"    // minimal console output
  }
}

Experimental Lean Mode

{
  "agents": {
    "defaults": {
      "experimental": {
        "localModelLean": true   // drop heavyweight default tools
      }
    }
  },
  "tools": {
    "profile": "minimal"         // load only essential tools
  }
}

4. Background Process Management

Heartbeat

The heartbeat runs a lightweight agent turn on a timer to check for pending work (emails, calendar, notifications). Each heartbeat:

Set heartbeat.every to "60m" โ€” the default 30 minutes is too frequent for a constrained box. On a lean VPS, checking every hour is plenty. Make sure lightContext: true is set so only HEARTBEAT.md is loaded, not the full workspace bootstrap.

Cron Jobs

Subagents

Each subagent process costs approximately 400 MB RSS. With a 2 GB total budget:

Keep maxConcurrent: 1 and maxChildrenPerAgent: 2 at most. On a truly lean 2 GB VPS, consider setting maxChildrenPerAgent: 1.


5. Memory & Swap Management

Node.js Heap: The #1 Tuning Knob

OpenClaw runs on Node.js. By default it may be configured with --max-old-space-size=2048 โ€” fine on a 4 GB+ machine, but deadly on 2 GB. You need to cap it so the Node heap doesn't consume the entire RAM, leaving no headroom for the OS, disk cache, or kernel buffers.

Recommended: Set these Node.js flags

Set via environment or in your systemd service override:

NODE_OPTIONS="--max-old-space-size=1536"

For subagents specifically (if exposed via config):

--max-old-space-size=768

This leaves ~500 MB for the OS, buffer cache, and kernel โ€” critical on a 2 GB VPS.

Swappiness

Linux default swappiness=60 is too aggressive for a VPS where disk I/O is slow. When Node.js heap pages get swapped out, performance collapses.

# Set temporarily
sysctl vm.swappiness=10

# Set permanently
echo "vm.swappiness=10" >> /etc/sysctl.conf

Swap โ€” Safety Valve, Not Primary Memory

Add a 1โ€“2 GB swap file as emergency headroom. Do NOT treat it as usable memory โ€” any process that hits swap on a VPS will effectively stall.

fallocate -l 2G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile none swap sw 0 0" >> /etc/fstab

Systemd Memory Guard

Set a hard memory limit on the OpenClaw gateway process via systemd. This makes the kernel prefer killing the OpenClaw process group via cgroup OOM before the system-wide OOM killer fires unpredictably.

# Create override
sudo systemctl edit openclaw-gateway

# Add:
[Service]
MemoryMax=2G
MemorySwapMax=1G

OOM Recovery Priority

If you want subagents to be killed before the gateway when OOM fires, adjust the OOM score:

# In systemd override:
[Service]
OOMScoreAdjust=-200   # makes gateway less likely to be killed

6. Monitoring & Alerting

Key Metrics to Watch

MetricCommandAlert Threshold
Gateway RSSps aux | grep openclaw-gatewayAlert if > 1.2 GB
System MemAvailablefree -mAlert if < 300 MB
Subagent RSSps aux | grep "node.*openclaw"Each subagent > 500 MB = problem
CPU usagetop -bn1 | grep nodeAlert if > 80% sustained
OOM eventsdmesg | grep -i oomAny OOM = immediate review
Disk for sessionsdu -sh ~/.openclaw/agents/Alert if > 500 MB

OpenClaw Built-in Status Commands

openclaw gateway status        # gateway health, memory, active sessions
openclaw status                # overall system status
openclaw logs                  # recent log entries
openclaw health                # deep health check with token
systemctl --user show openclaw-gateway  # MemoryCurrent vs MemoryMax

Recommended Monitoring Setup

A minimal, lean monitoring stack for a 2 GB VPS:

  1. Watch MemAvailable โ€” the most important number. Alert when below 300 MB.
  2. Check dmesg | grep -i kill after any suspected OOM event.
  3. Set up a lightweight cron health check โ€” every 15 minutes, run free -m and alert if MemAvailable < 350 MB.
  4. Log rotation โ€” set logging.maxFileBytes: 10000000 so logs don't consume disk.

Alert Thresholds


7. What to Absolutely Avoid

โš  Anti-Patterns That Will Kill Your VPS

Anti-PatternImpactFix
Multiple channels at once RAM EXHAUSTION Run exactly one channel. Telegram webhook alone is plenty.
Sandbox mode (Docker) DOUBLES RAM FOOTPRINT Set agents.defaults.sandbox.mode: "off"
deep-research skill OOM TRIGGER Never run on 2 GB. If needed, run manually in isolated session.
cron.maxConcurrentRuns > 1 PARALLEL OOM SPIKE Always set to 1 on constrained VPS.
WhatsApp + Baileys 150โ€“250 MB+ Use official WhatsApp Business API webhook only, or skip WhatsApp.
Signal NO OFFICIAL API Avoid entirely. No viable bot API, heavy encryption overhead.
Browser automation / Playwright 100โ€“300 MB/browser Never run on 2 GB without explicit memory caps.
Large channel history limits CONTEXT BLOAT Keep history limit โ‰ค 20 messages per channel.
Heartbeat every 30 minutes FREQUENT CONTENTION Set to 60 minutes on lean VPS.
Docker install on 1 GB VPS PNPM OOM KILLED Use non-Docker install. 2 GB minimum for Docker builds.

8. Recovery from Resource Exhaustion

If your VPS runs out of memory, here's the recovery sequence in order:

  1. Restart the gateway:
    openclaw gateway stop && openclaw gateway start
    This frees all held memory and resets session state.
  2. Check if OOM killed:
    dmesg | grep -i oom
    Exit 137 = OOM kill confirmation.
  3. Clear cron run logs (these accumulate fast):
    find ~/.openclaw/cron/runs/ -type f -delete
  4. Prune session transcripts โ€” reduce session.maintenance.maxEntries and restart.
  5. Reduce running channels โ€” disable all but one in openclaw.json, restart.
  6. Disable sandbox if enabled โ€” set agents.defaults.sandbox.mode: "off".
  7. Lower cron concurrency โ€” set cron.maxConcurrentRuns: 1.
  8. Clear media cache:
    rm -rf ~/.openclaw/media/
  9. Add swap as a safety valve if not already present.
  10. Monitor going forward:
    openclaw gateway status && free -m
    Run this after every restart until stable.

9. Final Checklist

Before You Run OpenClaw on 2 GB โ€” Confirm Each Item

The Survival Formula for 2 GB

One channel + Sequential sessions + No sandbox + 1536 MB heap cap + Swap + 60-min heartbeat = survivable on 2 GB.

Any deviation from this formula requires compensating adjustments elsewhere. The tighter you run, the more headroom you have for the work that actually matters.

Research compiled by Babu AI for Thota ยท April 20, 2026 ยท OpenClaw on Lean VPS Project