OpenClaw Complete Guide: From Basic Installation to Turning Your AI Agent into a Reliable Digital Employee
This guide answers the core question every builder asks: What exactly is OpenClaw, and how do you go from a simple local install to a memory-smart, always-available AI agent that never forgets, never loses progress, and can run complex projects on its own — all while keeping everything private on your own machine?
OpenClaw is a locally run AI gateway. It runs a Gateway process on your computer that connects your favorite chat apps (Telegram, Discord, WhatsApp) to powerful models like Claude, GPT, or DeepSeek. You chat with your AI exactly where you already work, and every memory, preference, and file stays in ~/.openclaw/ on your hard drive — no cloud, no privacy leaks, no monthly surprises.
The journey breaks into three clear stages:
• Foundation – make it work
• Intermediate – make it reliable
• Advanced – make it autonomous
Below is the complete, step-by-step playbook that thousands of builders have followed in 2026.
Foundation: Install and Configure OpenClaw So It Works in 30 Minutes
This section answers the most common first question: “How do I install OpenClaw and get it talking to me in Telegram without getting stuck?”
OpenClaw runs on Mac natively, Windows via WSL2 (Ubuntu 22.04 recommended), or any Linux distro. For 24/7 operation, a Mac Mini or a $12/month VPS works perfectly.
1. Prepare Your API Keys and Network
Recommended model providers in 2026:
-
ChatGPT Plus ($20/month) – simplest -
OpenRouter or AI/ML API – pay-as-you-go -
Local Ollama – zero cost
You also need a stable proxy (Clash Verge recommended) with TUN mode enabled. Quick test:
curl -I https://api.telegram.org
If you get 200 OK, you’re ready.
2. One-Command Installation
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install nodejs
curl -fsSL https://get.openclaw.dev | bash
openclaw --version
3. Run the Onboarding Wizard
openclaw onboard --install-daemon
The --install-daemon flag makes it survive restarts.
During the wizard:
-
Choose your model provider (or Skip for third-party) -
Pick Telegram (fastest for beginners) -
Create a bot in BotFather (/newbot) and paste the token
4. Add Your Model (Web UI Way – Recommended)
Open http://127.0.0.1:18789 → Settings → Models → Add Provider.
Fill in Base URL, API Key, and Model ID. Done.
5. Fix the Proxy (The #1 Reason Bots Go Silent)
Add to ~/.zshrc:
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
export all_proxy=socks5://127.0.0.1:7891
Then source ~/.zshrc && openclaw restart.
6. Essential Safety Settings
Always set:
-
Daily API budget cap in your provider dashboard -
approvalRequired: truefor exec and email tools -
Keep Gateway listening only on 127.0.0.1
Common fixes:
-
Bot silent? → openclaw logs --tail 50 -
Port 18789 in use? → lsof -i:18789 && kill -9 <pid>
Personal lesson I learned the hard way: Forgetting TUN mode wasted 40 minutes of debugging. That single check is now the first line in every new setup I do.
(Image credit: original OpenClaw community)
With these steps, you can literally type “Hey, summarize my last meeting” in Telegram and get an answer in seconds. Monthly cost: ~150 (OpenRouter + VPS).
Intermediate: Build Memory, Smart Search, and Unbreakable Tasks
This section answers: “Why does my fresh OpenClaw agent forget everything after a few hours, waste tokens on failed searches, and drop long tasks mid-way — and how do I fix it permanently?”
The secret is three simple upgrades: remember everything, find anything instantly, and never lose progress.
Remember Everything – Three-Tier Memory System
Tier 1: Raw logs (memory/learning/ – append only)
Tier 2: Daily summary (memory/YYYY-MM-DD.md – auto-generated)
Tier 3: Core wisdom (≤100 lines, loaded every session)
Seven sacred files (never duplicate information):
-
How I work -
Who I am -
Who I serve -
How to operate tools -
What I remember -
Where I failed -
Team consensus
Iron rule: Never use “write” on existing files — always “edit” append. One tragic 345 KB learning note got overwritten to 9.9 KB by a single mistaken write command. That rule now lives in ERRORS.md and SHARED.md so every new agent knows it on day one.
Heartbeat (built-in every 30 min) runs a 6-hour deep consolidation: read recent logs → clean outdated info → distill new insights. Result? Yesterday’s React Hooks lesson is automatically continued today.
My biggest takeaway: Agent memory isn’t in the LLM — it’s in your filesystem. Externalize everything important and you get a brain that never forgets.
Find Anything Instantly – Search Decision Tree
Agents used to waste 5–10 minutes and 30–50 % of tokens trying web_fetch → fail → curl → browser.
My decision tree (documented in SHARED.md):
-
Needs JS or login? → browser -
No? → free semantic search tool (covers 80 % of cases) -
Fail? → curl for SSRF, web_fetch otherwise
Special rules: GitHub → browser only; Bilibili → browser only.
Every new agent reads the tree at startup. One pitfall documented saves the whole team hours.
Never Lose Progress – Plan File Pattern
Context windows compress long conversations and delete old tool results. Solution: externalize state.
When a complex task arrives, create temp/task-name-plan.md with:
-
Goal (one sentence) -
Checkbox steps -
Current progress -
Issues -
Next action
Every step updates the file. Heartbeat checks it automatically. Even if context compresses three times overnight, the agent wakes up, reads the plan, and continues at step 15 exactly where it left off.
Real scenario: You sleep. A 20-step research task runs. Context compresses twice. Morning comes — agent picks up exactly where it stopped. No re-explaining, no lost work.
The full intermediate handbook includes 7 write rules, exact decision-tree parameters, plan-file template, Heartbeat code, 4 real scenarios, and 8 Q&A.
Advanced: Skill, Hook, MCP, and Autonomous Tasks — Turn Your Agent into a Real Employee
This section answers: “Now that my agent remembers and searches well, why do I still have to micromanage every step — and how do I make it run entire projects independently?”
You upgrade from “intern” to “full-time employee” with four tools.
Skill – On-the-Job Training Manual
Skills live in skills/ and load only when triggered.
Example: Daily Report Skill
Create skills/daily-report/SKILL.md:
---
name: daily-report
triggers: ["daily report", "日报", "write report"]
---
1. Read memory/YYYY-MM-DD.md
2. Extract tasks, decisions, issues
3. Output exactly: Completed work / Key decisions / Problems / Tomorrow’s plan
Now you type only “write report” and get perfect output every time — across sessions.
Hook – Automatic SOPs (No LLM Thinking)
Hooks run real TypeScript code on events.
Example: Auto-load today’s diary on new session
hooks/session-loader/handler.ts:
import { readFileSync, existsSync } from "fs";
import { join } from "path";
const handler = async (event) => {
if (event.type !== "command" || event.action !== "new") return;
const today = new Date().toISOString().split("T")[0];
const path = join(process.cwd(), "memory", `${today}.md`);
if (existsSync(path)) {
const content = readFileSync(path, "utf-8");
event.messages.push(`Today's diary loaded: ${content}`);
}
};
export default handler;
The sentence “first read today’s plan” disappears forever from your vocabulary.
Other killer hooks: auto-save before context compression, block dangerous write operations.
MCP – Model Context Protocol (AI’s USB Port)
One config file lets you plug in filesystems, databases, browsers, etc.
Simplest filesystem MCP:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp/mcp-test"]
}
}
}
Then your agent can read/write files with one sentence. No custom code needed.
Autonomous Tasks – Goal-Driven Execution
Give one goal. Agent:
-
Creates its own plan file -
Breaks it into steps with checkboxes -
Executes -
Updates progress -
Survives context compression and session restarts
Real example: I gave the goal “collect material for 6 advanced topics.” The agent created the plan, ran 6 stages, output 160 KB of finished files — all while I slept.
Practical Checklist (Copy-Paste Ready)
-
Foundation: Node.js + curl install + onboard –install-daemon + Telegram token + proxy -
Intermediate: 3-tier memory + 7 core files + edit-only rule + search tree + plan.md -
Advanced: Skill folder + Hook TypeScript + mcporter.json + goal → self-created plan
One-Page Summary
OpenClaw = local AI gateway
Foundation = works in Telegram
Intermediate = remembers, finds, never drops tasks
Advanced = Skill (knows), Hook (auto), MCP (tools), Autonomous (owns projects)
Core philosophy: Put critical state in files, document every pitfall in SHARED.md, let every agent inherit the team’s wisdom.
FAQ – Quick Answers
Q1: Does OpenClaw work on Windows?
Yes — install WSL2 with Ubuntu 22.04 and follow the same commands.
Q2: Why does my agent forget yesterday’s conversation?
You haven’t built the three-tier memory system yet. Add the 7 core files and the edit-only rule.
Q3: Searches waste too many tokens. Fix?
Build and document the search decision tree in SHARED.md — every agent reads it at startup.
Q4: Long tasks get interrupted halfway. Why?
Context compression. Fix: externalize state to temp/plan.md and let Heartbeat monitor it.
Q5: What’s the difference between Skill and Hook?
Skill = trigger-loaded knowledge (LLM reads it). Hook = real code that runs automatically on events.
Q6: Do I need extra API keys for MCP?
No. Local filesystem MCP is completely free and runs with three lines of config.
Q7: How do I make the agent plan and execute on its own?
Give it a goal, let it create the plan file, then combine with Heartbeat — goal-driven mode activated.
Q8: I’m new to terminals — will I get stuck?
Use the Web UI for models, run the curl proxy test first, and openclaw logs for any issue. Most people finish foundation in under one hour.
Start with the foundation today. In a weekend you’ll have an agent that remembers your entire workflow, searches intelligently, finishes overnight tasks, and eventually runs entire projects while you sleep.
That’s the real power of OpenClaw in 2026 — not just another chatbot, but your personal digital employee that actually scales with you.
Ready to begin? Open your terminal and run the first curl command. Your future self will thank you.

