A comprehensive intermediate to advanced tutorial for OpenClaw, covering memory systems, sub-agents, cron automation, skill development, and multi-channel deployment.
OpenClaw Complete Tutorial - From Intermediate to Advanced
Last Updated: February 2026
Table of Contents
- Tutorial Overview: Who This Is For
- Learning Path: From Basics to Advanced
- Core Configuration: AGENTS.md Workspace Standards
- Memory Optimization: Building a Reliable Memory System
- Sub-Agent Applications: Team Collaboration Mode
- Scheduled Tasks: Cron Automation Practice
- Skill Development: Extending AI Capabilities
- Multi-Channel Deployment: Full Platform Access
- Performance Tuning: Configuration Parameters
- Practice Checklist
- Troubleshooting
- Advanced Learning Resources
Tutorial Overview: Who This Is For
Prerequisites
This tutorial is for users who have completed OpenClaw basic configuration. Before starting, please confirm you have:
- Successfully installed OpenClaw and can run it normally
- Completed basic configuration file creation (openclaw.json / SOUL.md / USER.md)
- Understand basic memory system concepts (memoryGet and memorySearch)
- Familiar with workspace directory structure
- Have basic command-line operation capabilities
What You'll Learn
After completing this tutorial, your OpenClaw will achieve the following capability improvements:
- ✅ Complete workspace standard system (AGENTS.md)
- ✅ Reliable memory management mechanism
- ✅ Efficient task parallel processing
- ✅ Precise scheduled automation
- ✅ Autonomous capability extension
- ✅ Full-platform access solution
- ✅ Optimized performance configuration
Learning Path: From Basics to Advanced
Recommended Learning Order
Phase 1: Workspace Standards (30-60 minutes)
- Create AGENTS.md workspace manual
- Define session startup process
- Set memory writing standards
- Configure security boundaries
Phase 2: Memory System Optimization (60-120 minutes)
- Enable memoryFlush to prevent information loss
- Optimize log format to improve retrieval accuracy
- Configure automatic maintenance mechanisms
- Adjust embedding model
Phase 3: Advanced Feature Applications (120-240 minutes)
- Deploy sub-agents for task distribution
- Create Cron scheduled tasks
- Develop custom Skills
- Configure multi-channel access
Phase 4: Performance Tuning (1-2 days)
- Adjust model parameters
- Optimize token usage
- Configure caching strategies
- Monitor system performance
Core Configuration: AGENTS.md - AI Working Standards
Why AGENTS.md Is Needed
In basic tutorials, we created SOUL.md describing AI personality, USER.md describing user information, and IDENTITY.md defining identity. But these files only solve "who the AI is" and "who the user is" — they don't tell the AI "how to work".
AGENTS.md defines AI's workflow and behavior standards, similar to an employee handbook. It tells the AI:
- Which files to read on each startup
- How memories should be organized and stored
- Which operations require user confirmation
- How to handle different types of tasks
Session Startup Configuration
OpenClaw starts each new session in a "fresh state" and needs to restore memory and context by reading files. A reasonable startup process ensures the AI quickly enters working state.
Configuration File Location: workspace/AGENTS.md
Startup Process Configuration:
# AGENTS.md - Workspace Standards
This is your workspace. Please work according to the following standards.
## Session Startup Process
At the start of each session, automatically execute in this order:
1. Read `SOUL.md` - Load personality and behavior style
2. Read `USER.md` - Understand user background and preferences
3. Read `memory/YYYY-MM-DD.md` - Load today's and yesterday's logs
4. If main session: additionally read `MEMORY.md` - Load core memory index
Above operations execute automatically without asking.
## Memory Management Standards
You start fresh each session. These files are your memory continuity.
| Layer | File Path | Storage Content |
|-------|-----------|-----------------|
| Index | `MEMORY.md` | Core information and memory index, keep concise |
| Project | `memory/projects.md` | Current status and todos of each project |
| Lessons | `memory/lessons.md` | Problem solutions, graded by importance |
| Logs | `memory/YYYY-MM-DD.md` | Daily detailed records |
### Writing Rules
- Logs written to `memory/YYYY-MM-DD.md`, record conclusions not processes
- Update `memory/projects.md` when project changes
- Record to `memory/lessons.md` when encountering problems
- Update MEMORY.md only when index changes
- Important information must be written to files, don't rely on memory
### Log Format[Project: Name] Event Title
Result: One-sentence summary
Related Files: File path
Lessons: Key points (if any)
Search Tags: #tag1 #tag2
## Security Standards
- Do not leak private data
- Confirm before destructive operations
- Use `trash` instead of `rm`
- Ask when uncertain
**Free to execute:** Read files, search, organize, work within workspace
**Require confirmation:** Send emails/messages, any external data operations
## Group Chat Standards
You can access user's files and memories, but cannot share them in group chat.
In group chat, you are a participant, not the user's spokesperson.
## Tool Usage
Skills provide your tool capabilities. When needing a tool, check its SKILL.md documentation.Memory Optimization: Building a Reliable Memory System
Current Situation Analysis
After completing basic tutorials, your OpenClaw already has basic memory functions:
- Layered memory structure (MEMORY.md + memory/*.md)
- Semantic retrieval (memorySearch)
But in actual use, you may encounter these problems:
Problem 1: AI "Amnesia" After Long Conversations
When conversation content exceeds context window limits, OpenClaw automatically compresses old conversations. This process may lose important information.
Problem 2: Poor Retrieval Hit Rate
Inconsistent log formats, missing tags, low information density make memorySearch difficult to find relevant content.
Problem 3: Memory Files Lack Maintenance
Over time, expired information accumulates, noise increases, affecting retrieval quality.
Enable memoryFlush Feature
Problem Scenario:
You have a long in-depth discussion with AI, making important decisions. Suddenly notice AI's replies start becoming "forgetful", seeming to forget previously discussed content.
Cause Analysis:
Every AI model has context window limits (e.g., Claude is 200K tokens). When conversation approaches this limit, OpenClaw triggers automatic compaction, summarizing old conversations to free space. Compression may lose detail information.
Solution:
Enable memoryFlush feature. This triggers before compression, letting AI write important information to files before executing compaction.
Configuration Method:
Edit openclaw.json, add:
{
"agents": {
"defaults": {
"compaction": {
"reserveTokensFloor": 20000,
"memoryFlush": {
"enabled": true,
"softThresholdTokens": 4000
}
}
}
}
}Optimize Log Format for Better Retrieval
memorySearch uses vector semantic retrieval, converting search terms and log content to vectors, then calculating similarity.
Key Factors for Improving Retrieval Accuracy:
- Use tags: Tags (like #nginx #deploy) significantly improve recall
- Structured format: Fixed format concentrates key information for easier matching
- Single topic: One log records one thing, avoiding information mixing
Comparison:
❌ Low-quality log (low hit rate):
Today's work: Morning handled database backup issues, noon deployed new version,
afternoon modified nginx config, evening wrote some docs. Nginx side changed reverse proxy
config, specifics not clear, but finally got it running.✅ High-quality log (high hit rate):
### [Project: WebApp] Nginx Reverse Proxy Configuration
- **Result**: Successfully configured Nginx reverse proxy, app accessible via port 443
- **Related Files**: `/etc/nginx/sites-available/webapp.conf`
- **Lessons**: upstream must use 127.0.0.1 not localhost (avoid IPv6 issues)
- **Search Tags**: #nginx #deploy #webapp #reverse-proxyConfigure Automatic Memory Maintenance
Problem:
As usage time increases, log files accumulate. Some information is expired (temporary debugging records, completed one-time tasks). This "noise" interferes with memorySearch results.
Solution:
Configure periodic automatic maintenance tasks, let AI organize its own memory.
Implementation:
Add maintenance task in workspace/HEARTBEAT.md:
## Memory Maintenance Task (Weekly Execution)
Check `memory/heartbeat-state.json` for `lastMemoryMaintenance` field.
If more than 7 days old, execute:
1. Read recent 7 days log files `memory/YYYY-MM-DD.md`
2. Extract long-term value info, archive to corresponding files:
- Project decisions and status → `memory/projects.md`
- Problem solutions → `memory/lessons.md`
3. Compress completed one-time tasks to one-line summaries
4. Delete completely expired temporary information
5. Update `heartbeat-state.json` `lastMemoryMaintenance` to current dateCreate status tracking file workspace/memory/heartbeat-state.json:
{
"lastMemoryMaintenance": "2026-02-26"
}Configure Embedding Model
memorySearch relies on embedding models to convert text to vectors. Choosing appropriate models improves retrieval quality and reduces costs.
Recommended Configuration:
{
"memorySearch": {
"enabled": true,
"provider": "openai",
"remote": {
"baseUrl": "https://api.siliconflow.cn/v1",
"apiKey": "Your_SiliconFlow_API_Key"
},
"model": "BAAI/bge-m3"
}
}Why bge-m3:
- Cost: SiliconFlow offers free quota, sufficient for personal use
- Multilingual: Good support for Chinese-English mixed text
- Performance: 1024 vector dimension, balance between accuracy and speed
Sub-Agent Applications: Team Collaboration Mode
What Are Sub-Agents
In basic configuration, OpenClaw works single-threaded: you propose a task, AI completes it from start to finish. But for complex tasks, this mode is inefficient.
Sub-Agent Concept:
Sub-agents are independent working processes spawned by the main agent, can execute different subtasks in parallel.
Analogy:
- Single Agent mode: You're project manager, doing all work yourself
- Multi-Agent mode: You're project manager, can dispatch team members to work in parallel
Applicable Scenarios
Scenario 1: Information Collection Task
Task: Collect feature comparisons of 5 competitors
- Single Agent: Visit 5 websites sequentially, takes 10 minutes
- Multi-Agent: Dispatch 5 sub-agents to collect in parallel, takes 2 minutes
Scenario 2: Data Processing Task
Task: Analyze content of 100 files
- Single Agent: Process one by one, takes long time
- Multi-Agent: Distribute to 10 sub-agents, each processes 10 files
Configuration:
{
"agents": {
"defaults": {
"subAgents": {
"enabled": true,
"maxConcurrent": 3,
"timeout": 300000
}
}
}
}Scheduled Tasks: Cron Automation Practice
Cron Task Overview
Cron is OpenClaw's scheduled task feature, letting AI automatically execute tasks at specified times without manual triggering.
Typical Application Scenarios:
- Daily briefing: Send weather, schedule, news summary every morning
- Regular backups: Automatically backup important files weekly
- Monitoring alerts: Check service status hourly, notify when abnormal
- Timed reminders: Remind to end work at 6 PM on workdays
Creating Cron Tasks
Method 1: Create Through Conversation
User: Create a scheduled task to send today's briefing every morning at 8 AM
AI: I'll create the scheduled task for you...
- Task name: daily-briefing
- Execution time: Daily 08:00
- Task content: Send weather, schedule, news summary
Created successfully!Method 2: Manual Configuration
Edit workspace/crons/daily-briefing.json:
{
"name": "daily-briefing",
"schedule": "0 8 * * *",
"timezone": "Asia/Shanghai",
"task": {
"type": "message",
"content": "Send today's briefing: weather, schedule, important news"
},
"enabled": true
}Cron Expression Format: minute hour day month weekday
Common examples:
0 8 * * *- Daily at 8:00 AM0 18 * * 1-5- Weekdays at 6:00 PM0 9 * * 1- Every Monday at 9:00 AM*/30 * * * *- Every 30 minutes
Skill Development: Extending AI Capabilities
Skill System Overview
Skill is OpenClaw's capability extension mechanism, similar to plugins or apps. Each Skill defines specific tasks and workflows.
Skill Functions:
- Encapsulate complex workflows
- Define domain-specific task templates
- Provide reusable capability modules
Skill Types:
- Official Skills: Standard Skills maintained by OpenClaw team
- Community Skills: Third-party Skills shared by users
- Custom Skills: Skills you develop yourself
Creating Simple Skills
Example: Weather Check Skill
Create file workspace/skills/weather-check/SKILL.md:
# Weather Check Skill
## Function Description
Query weather information for specified city and format output.
## Usage Method
User: Check Beijing weather
AI Execution Flow:
1. Call weather API to get data
2. Extract key info: temperature, weather condition, air quality
3. Format output
## Output Format
📍 Beijing Weather
🌡️ Temperature: 15°C
☁️ Weather: Cloudy
💨 Wind: Level 3
🌫️ Air Quality: Good
## Configuration Requirements
Need to configure weather API Key:
- Provider: OpenWeatherMap
- Configuration path: config.jsonCreate configuration file workspace/skills/weather-check/config.json:
{
"name": "weather-check",
"version": "1.0.0",
"description": "Query city weather information",
"author": "Your name",
"config": {
"apiKey": "Your_API_Key",
"apiUrl": "https://api.openweathermap.org/data/2.5/weather",
"defaultCity": "Beijing"
}
}Multi-Channel Deployment: Full Platform Access
Multi-Channel Access Overview
OpenClaw supports simultaneous connection to multiple messaging platforms, achieving "one AI, multiple access points" effect.
Supported Platforms:
- Instant Messaging: Telegram, Discord, Slack, WhatsApp
- Social Media: Twitter, WeChat (via third-party bridge)
- Web Interface: WebChat, HTTP API
- Local Interface: CLI command line
Telegram Access Configuration
Step 1: Create Bot
- Search @BotFather in Telegram
- Send
/newbotcommand - Set bot name and username (must end with 'bot')
- Get Bot Token
Step 2: Configure OpenClaw
{
"gateways": {
"telegram": {
"enabled": true,
"token": "Your_Bot_Token",
"allowedUsers": ["Your_Telegram_User_ID"]
}
}
}Discord Access Configuration
Step 1: Create Discord Application
- Visit Discord Developer Portal
- Create New Application
- Create Bot in Bot page, get Token
- Generate invite link in OAuth2 page, add bot to server
Step 2: Configure OpenClaw
{
"gateways": {
"discord": {
"enabled": true,
"token": "Your_Discord_Bot_Token",
"allowedChannels": ["Channel_ID"],
"commandPrefix": "!"
}
}
}WebChat Access Configuration
WebChat provides browser access interface, suitable for local use.
Configuration:
{
"gateways": {
"webchat": {
"enabled": true,
"port": 3000,
"host": "localhost",
"auth": {
"enabled": true,
"username": "admin",
"password": "Your_password"
}
}
}
}Access:
After startup, visit http://localhost:3000 to use web interface.
Performance Tuning: Configuration Parameters
Model Selection and Configuration
Different tasks suit different models. Reasonable selection balances performance and cost.
Recommended Configuration:
{
"agents": {
"defaults": {
"model": {
"provider": "anthropic",
"name": "claude-3-5-sonnet-20241022",
"temperature": 0.7,
"maxTokens": 4096
},
"fallback": {
"enabled": true,
"models": [
{
"provider": "openai",
"name": "gpt-4o"
}
]
}
}
}
}Temperature Selection:
- 0.3-0.5: Code generation, data analysis (needs precision)
- 0.7-0.8: Daily conversation, content creation (balanced)
- 0.9-1.0: Creative writing, brainstorming (creativity)
Token Usage Optimization
Tokens are the main source of API costs. Optimizing token usage significantly reduces fees.
Optimization Strategies:
- Enable Caching
{
"agents": {
"defaults": {
"cache": {
"enabled": true,
"ttl": 3600,
"maxSize": 100
}
}
}
}- Use Cheaper Models for Simple Tasks
{
"agents": {
"simple-tasks": {
"model": {
"provider": "openai",
"name": "gpt-4o-mini"
}
}
}
}- Limit Context Length
{
"agents": {
"defaults": {
"compaction": {
"targetTokens": 50000
}
}
}
}Cost Control
Set Daily Limits:
{
"billing": {
"limits": {
"daily": 10.00,
"monthly": 200.00
},
"alerts": {
"enabled": true,
"thresholds": [0.5, 0.8, 0.95]
}
}
}When usage reaches thresholds (50%, 80%, 95%), system sends alerts.
Summary
After completing this tutorial, your OpenClaw has evolved from "usable" to "essential".
You have mastered:
- ✅ Complete workspace standard system (AGENTS.md)
- ✅ Reliable memory management mechanism
- ✅ Efficient task parallel processing
- ✅ Precise scheduled automation
- ✅ Autonomous capability extension
- ✅ Full-platform access solution
- ✅ Optimized performance configuration
Next Steps:
- Deep practice: Choose a practical project, apply knowledge to real scenarios
- Continuous optimization: Adjust configuration based on usage
- Community participation: Share your experience, help other users
- Exploration and innovation: Try developing unique Skills and workflows
OpenClaw's potential goes far beyond this. As you deepen your understanding of the system, you'll discover more possibilities.
Happy exploring with your AI assistant! 🚀