OpenClaw: From Intermediate to Advanced — A Complete Tutorial
Mastering OpenClaw: A Complete Guide to Workflow Standards, Memory Optimization, Sub-Agents, Cron Jobs, Skill Development, Multi-Channel Deployment, and Performance Tuning
Source: Twitter @onehopeA9 | Last Updated: February 2026 | Applicable Version: OpenClaw v2.23+
This is a super detailed intermediate to advanced OpenClaw tutorial, covering a complete learning path from basics to mastery.
Table of Contents
- Tutorial Overview: Who is this for
- Learning Path: From Basics to Advanced
- Core Configuration: AGENTS.md Work Standards
- Memory Optimization: Building a Reliable Memory System
- Sub-Agent Application: Team Collaboration Mode
- Scheduled Tasks: Cron Automation Practice
- Skill Development: Extending AI Capabilities
- Multi-Channel Deployment: Full-Platform Access Solution
- Performance Tuning: Configuration Parameters Explained
- Practical Exercise Checklist
- Troubleshooting
- Advanced Learning Resources
Tutorial Overview: Who is this for
Prerequisites
This tutorial is for users who have already completed the basic OpenClaw configuration. Before starting, please confirm that you have:
- ✅ Successfully installed OpenClaw and it is running normally
- ✅ Created basic configuration files (SOUL.md / USER.md / IDENTITY.md)
- ✅ Understood the basic concepts of the memory system (MEMORY.md and memorySearch)
- ✅ Familiarized yourself with the workspace directory structure
- ✅ Possess basic command-line operation skills
Technical Requirements
- OpenClaw installed and running
- At least one AI model API (Claude or GPT)
- Understanding of JSON and Markdown formats
- Basic file system operation capabilities
What You Will Learn
After completing this tutorial, your OpenClaw will achieve the following capability improvements:
- Establish a complete work standard system
- Build a reliable long-term memory system
- Implement parallel task processing
- Master scheduled automation
- Develop custom Skills
- Configure multi-channel access
- Optimize performance and costs
Learning Path: From Basics to Advanced
Recommended Learning Order
Phase 1: Establishing Work Standards (30-60 mins)
- Create AGENTS.md work manual
- Define session startup process
- Set memory writing standards
- Configure safety boundaries
Phase 2: Memory System Optimization (60-120 mins)
- Enable memoryFlush to prevent information loss
- Optimize log formats to improve retrieval precision
- Configure automatic maintenance mechanisms
- Adjust embedding models
Phase 3: Advanced Feature Application (120-240 mins)
- 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
Learning Advice
- Step-by-Step: Don’t skip basic steps; every configuration has its purpose.
- Practice & Verify: Immediately test and verify results after completing each configuration.
- Record Issues: Document problems as they arise for future troubleshooting.
- Backup Configs: Back up configuration files before making important changes.
Core Configuration: AGENTS.md AI Work Guidelines
Why AGENTS.md is Needed
In the basic tutorial, we created SOUL.md to describe the AI’s personality, USER.md to describe user information, and IDENTITY.md to define identity. However, these files only solved the “Who is the AI” and “Who is the user” problems, without telling the AI “How to work”.
The role of AGENTS.md is to define the AI’s workflow and behavioral guidelines, similar to an employee handbook. It tells the AI:
- Which files to read upon each startup
- How memory should be organized and stored
- Which operations require user confirmation
- How to handle different types of tasks
Analogy Explanation
- SOUL.md → Personality Profile
- USER.md → Service Target Information
- IDENTITY.md → Identity Card
- AGENTS.md → Workflow Handbook
Session Startup Configuration
OpenClaw is in an “initial state” every time it starts a new session and needs to read files to restore memory and context. A reasonable startup process ensures the AI quickly enters working mode.
Configuration File Location: workspace/AGENTS.md
## Session Startup Workflow
Automatically execute in the following order at the start of every session:
1. Read `SOUL.md` - Load personality and behavioral style
2. Read `USER.md` - Understand user background and preferences
3. Read `memory/YYYY-MM-DD.md` - Load today and yesterday's logs
4. If main session: Additionally read `MEMORY.md` - Load core memory index
The above operations are automatic and do not require inquiry.
Memory Management Standards
OpenClaw’s memory system uses a layered design, storing different types of information in different files.
## Memory Layers
| Layer | File | Purpose |
|------|------|------|
| Index Layer | `MEMORY.md` | About user, capability overview, memory index. Keep lean (<40 lines) |
| Project Layer | `memory/projects.md` | Current status and todos for each project |
| Infrastructure Layer | `memory/infra.md` | Quick reference for servers, APIs, deployments, etc. |
| Lessons Layer | `memory/lessons.md` | Potholes encountered, categorized by severity |
| Log Layer | `memory/YYYY-MM-DD.md` | Daily raw records |
Writing Rules
- Events of the day → Write to
memory/YYYY-MM-DD.md - Project status changes → Sync update to
memory/projects.md - Problems and solutions encountered → Record in
memory/lessons.md - Core information changes → Update
MEMORY.mdindex
Core Principles:
- Record conclusions, not processes
- Use tags for easy retrieval
- Keep MEMORY.md lean (<40 lines)
- Information to be remembered must be written to files; do not rely on “remembering in mind”
Log Format
Efficient Log Example:
### [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`
- **Lesson Learned**: upstream must use 127.0.0.1 instead of localhost (avoid IPv6 issues)
- **Search Tags**: #nginx #deploy #webapp #reverse-proxy
Safety and Permission Boundaries
## Safety Standards
### Basic Principles
- Do not leak private data and sensitive information
- Must confirm before executing destructive operations
- Use `trash` instead of `rm` for file deletion (recoverable > permanent)
- When uncertain, ask the user first
### Operation Permission Classification
**Operations that can be freely executed:**
- Read files, browse directories
- Search web information
- Query calendar and email
- Work inside the workspace
**Operations requiring user confirmation:**
- Send emails, tweets, public messages
- Any operation that sends data externally
- Delete or modify important files
- Operations with uncertain consequences
Memory Optimization: Building a Reliable Memory System
Status Analysis
After completing the basic tutorial, your OpenClaw already possesses basic memory functions:
- Layered memory structure (MEMORY.md + memory/*.md)
- Semantic retrieval function (memorySearch)
However, in actual use, you may encounter the following problems:
Problem 1: AI “Amnesia” after long conversations When conversation content exceeds the context window limit, OpenClaw automatically compresses old conversations. This process may cause important information loss.
Problem 2: Suboptimal retrieval hit rates Inconsistent log formats, missing tags, and low information density make it difficult for memorySearch to find relevant content.
Problem 3: Lack of memory file maintenance Over time, expired information accumulates, noise increases, and retrieval quality is affected.
Enabling memoryFlush Feature
Problem Scenario: You have a long, deep discussion with the AI and make important decisions. Suddenly, you notice the AI’s replies start becoming “forgetful,” as if forgetting the previously discussed content.
Solution: Enable the memoryFlush feature. This feature instructs the AI to write important information to files before compression is triggered.
Configuration Method:
{
"agents": {
"defaults": {
"compaction": {
"reserveTokensFloor": 20000,
"memoryFlush": {
"enabled": true,
"softThresholdTokens": 4000
}
}
}
}
}
Parameter Explanation:
- softThresholdTokens: 4000 means memoryFlush is triggered when remaining space is less than 4000 tokens
- Too small (e.g., 1000): AI doesn’t have enough space to write detailed information
- Too large (e.g., 10000): Triggers frequently, affecting performance
- 4000 is a tested balance value
Optimizing Log Format to Improve Retrieval Precision
memorySearch uses vector semantic retrieval technology, converting search terms and log content into vectors, then calculating similarity.
Key Factors to Improve Retrieval Precision:
- Use Tags: Tags (like #deploy, #nginx) can significantly improve recall rate
- Structured Format: Fixed formats concentrate key information, making matching easier
- Single Topic: One log entry records only one thing to avoid information mixing
Configuring the Embedding Model
{
"memorySearch": {
"enabled": true,
"provider": "openai",
"remote": {
"baseUrl": "https://api.siliconflow.cn/v1",
"apiKey": "Your_SiliconFlow_API_Key"
},
"model": "BAAI/bge-m3"
}
}
Why choose bge-m3:
- Cost: SiliconFlow offers free quotas sufficient for personal use
- Multilingual: Good support for Chinese and English mixed text
- Performance: 1024 vector dimensions, striking a balance between precision and speed
Sub-Agent Application: Team Collaboration Mode
What is a Sub-Agent
In basic configuration, OpenClaw works in a single-threaded manner: you propose a task, and the AI completes it from start to finish. But for complex tasks, this mode is inefficient.
Concept of Sub-Agent: A Sub-Agent is an independent working process derived from the main Agent, capable of executing different sub-tasks in parallel.
Analogy:
- Single Agent Mode: You are a project manager, doing all the work yourself
- Multi-Agent Mode: You are a project manager, dispatching team members to work in parallel
Applicable Scenarios
Scenario 1: Information Gathering Tasks
- Single Agent: Visit 5 websites sequentially, taking 10 minutes
- Multi-Agent: Dispatch 5 Sub-Agents to gather in parallel, taking 2 minutes
Scenario 2: Data Processing Tasks
- Single Agent: Process one by one, taking a long time
- Multi-Agent: Assign to 10 Sub-Agents, each processing 10 files
Scenario 3: Monitoring Tasks
- Single Agent: Polling check, slow response
- Multi-Agent: Assign one monitoring Agent for each service
Configuring Sub-Agents
{
"agents": {
"defaults": {
"subAgents": {
"enabled": true,
"maxConcurrent": 3,
"timeout": 300000
}
}
}
}
Parameter Explanation:
- maxConcurrent: Recommend 3-5 to balance performance and cost
- Too small (e.g., 1): Cannot leverage parallel advantages
- Too large (e.g., 10): May trigger API rate limits and increase costs
Sub-Agent Best Practices
-
Reasonable Task Decomposition
- Good: Break “Analyze 100 files” into 10 sub-tasks
- Bad: Break “Write an article” into multiple sub-tasks (writing requires coherence)
-
Set Reasonable Timeout
- Simple query: 60 seconds
- Data analysis: 5 minutes
- Complex processing: 10 minutes
Scheduled Tasks: Cron Automation Practice
Cron Task Overview
Cron is OpenClaw’s scheduled task feature, allowing the AI to automatically execute tasks at specified times without manual triggering.
Typical Application Scenarios:
- Daily Briefing: Send weather, schedule, and news summary every morning
- Regular Backup: Automatically back up important files weekly
- Monitoring Alerts: Check service status every hour, notify on anomalies
- Timed Reminders: Remind to finish work at 6 PM on workdays
Cron Expressions
Format: Minute Hour Day Month Weekday
Common Examples:
| Expression | Meaning |
|---|---|
| 0 8 * * * | Every day at 8 AM |
| 0 18 * * 1-5 | 6 PM on workdays |
| 0 17 * * 5 | Every Friday at 5 PM |
| */30 * * * * | Every 30 minutes |
Online Tool: crontab.guru can help you generate and verify cron expressions.
Example Task
Daily Morning Briefing:
{
"name": "morning-briefing",
"schedule": "0 8 * * *",
"timezone": "Asia/Shanghai",
"task": {
"type": "message",
"content": "Good morning! Today's briefing:\n1. Check weather\n2. Read today's schedule\n3. Summarize yesterday's work log\n4. Remind today's todo items"
},
"enabled": true
}
Managing Cron Tasks
# View all tasks
openclaw cron list
# Enable/Disable tasks
openclaw cron enable daily-briefing
openclaw cron disable daily-briefing
# Manually trigger task (for testing)
openclaw cron run daily-briefing
Skill Development: Extending AI Capabilities
Skill System Overview
Skill is OpenClaw’s capability extension mechanism, similar to plugins or apps. Each Skill defines a specific set of tasks and workflows.
Role of Skills:
- Encapsulate complex workflows
- Define task templates for professional domains
- Provide reusable capability modules
Skill Types:
- Official Skills: Standard Skills maintained by the OpenClaw team
- Community Skills: Third-party Skills shared by users
- Custom Skills: Skills developed by yourself
Skill File Structure
workspace/skills/my-skill/
├── SKILL.md # Skill documentation
├── config.json # Configuration file
└── templates/ # Template files (optional)
Creating a Simple Skill Example
Create file workspace/skills/weather-check/SKILL.md:
# Weather Query Skill
## Feature Description
Query weather information for a specified city and format the output.
## Usage Method
User: Query Beijing weather
AI Execution Flow:
1. Call Weather API to get data
2. Extract key info: temperature, condition, air quality
3. Format output
## Output Format
📍 Beijing Weather
🌡️ Temperature: 15°C
☁️ Condition: Cloudy
💨 Wind: Level 3
🌫️ Air Quality: Good
## Configuration Requirements
Need to configure Weather API Key:
- Provider: OpenWeatherMap
- Config Path: config.json
Multi-Channel Deployment: Full-Platform Access Solution
Multi-Channel Access Overview
OpenClaw supports accessing multiple messaging platforms simultaneously, achieving the effect of “one AI, available everywhere.”
Supported Platforms:
- Instant Messaging: Telegram, Discord, Slack, WhatsApp
- Social Media: Twitter, WeChat (via third-party bridges)
- Web Interface: WebChat, HTTP API
- Local Interface: CLI command line
Telegram Access Configuration
- Search for @BotFather in Telegram
- Send command /newbot
- Set Bot name and username as prompted
- Get Bot Token
{
"gateways": {
"telegram": {
"enabled": true,
"token": "Your_Bot_Token",
"allowedUsers": ["Your_Telegram_User_ID"]
}
}
}
Discord Access Configuration
- Visit Discord Developer Portal
- Create New Application
- Create Bot on the Bot page and get Token
- Generate invite link on OAuth2 page, add Bot to server
{
"gateways": {
"discord": {
"enabled": true,
"token": "Your_Discord_Bot_Token",
"allowedChannels": ["Channel_ID"],
"commandPrefix": "!"
}
}
}
Performance Tuning: Configuration Parameters Explained
Model Selection and 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 Advice:
- 0.3-0.5: Code generation, data analysis (requires precision)
- 0.7-0.8: Daily conversation, content creation (balanced)
- 0.9-1.0: Creative writing, brainstorming (creative)
Token Usage Optimization
- Enable Caching
{
"agents": {
"defaults": {
"cache": {
"enabled": true,
"ttl": 3600,
"maxSize": 100
}
}
}
}
- Use Cheaper Models
{
"agents": {
"simple-tasks": {
"model": {
"provider": "openai",
"name": "gpt-4o-mini"
}
}
}
}
Cost Control
{
"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%), the system will send alerts.
Practical Exercise Checklist
Basic Configuration (Mandatory)
- Task 1: Create AGENTS.md work standards
- Task 2: Optimize memory system (memoryFlush + log format)
- Task 3: Configure Sub-Agents and complete parallel tasks
- Task 4: Create at least 2 Cron scheduled tasks
- Task 5: Develop a custom Skill
- Task 6: Configure multi-channel access (at least 2 platforms)
- Task 7: Performance optimization and cost control
Advanced Projects (Recommended)
- Project 1: Build an automated morning briefing system
- Project 2: Email auto-classification system
- Project 3: Multi-platform message aggregation
- Project 4: Service monitoring and alerting system
- Project 5: Knowledge base management system
Troubleshooting
Q1: What if memoryFlush doesn’t trigger?
- Check if memoryFlush.enabled is true in openclaw.json
- Enable verbose mode: Send /verbose command
- Conduct long conversation test (100+ rounds) to observe if it triggers
Q2: Sub-Agent execution failed
- Lower maxConcurrent value
- Increase timeout time
- Check if the task is suitable for parallel processing
Q3: Cron task not executing
- Use crontab.guru to verify expression
- Check timezone field
- Run openclaw cron list to view task status
Q4: memorySearch finds no content
- Check memorySearch configuration
- Rewrite logs following optimized format
- Add relevant tags
Q5: API costs too high
- Enable caching to reduce repeated calls
- Use cheaper models for simple tasks
- Optimize system prompt to reduce fixed costs
- Set daily limits to prevent overspending
Advanced Learning Resources
Official Resources
- Official Website: openclaw.ai
- GitHub Repository: github.com/openclaw/openclaw
- Official Documentation: docs.openclaw.ai
- Skill Market: clawhub.com
Community Resources
- Reddit: r/clawdbot, r/AiForSmallBusiness
- Discord: OpenClaw Official Discord Server
- GitHub Discussions
Summary
After completing this tutorial, your OpenClaw has moved from “easy to use” to “even better to use,” or even “can’t live without.”
You have mastered:
- ✅ Complete work standard system (AGENTS.md)
- ✅ Reliable memory management mechanism
- ✅ Efficient parallel task processing
- ✅ Precise scheduled automation
- ✅ Autonomous capability extension
- ✅ Full-platform access solution
- ✅ Optimized performance configuration
Next Steps:
- Deep Practice: Choose a practical project and apply learned knowledge to real scenarios
- Continuous Optimization: Constantly adjust configurations based on usage
- Join Community: Share your experience and help other users
- Explore Innovation: Try developing unique Skills and workflows
Original Author: @onehopeA9 Last Updated: February 2026 Version: 2.0 Applicable to: OpenClaw v2.23+
keywords: [“OpenClaw”, “Agent”, “Tutorial”, “Sub-Agent”, “Memory Optimization”, “Cron Tasks”, “Skill Development”, “Multi-Channel Deployment”, “Performance Tuning”]