From Zero to AI Army: The Ultimate Guide to Building Your First OpenClaw Agent Team
Core Question: How do you build an AI Agent team from scratch that possesses memory, programming skills, and collaboration capabilities?
Building an efficient AI Agent team—often referred to as a “Lobster Legion” in the community—is about more than just creating chatbots. It is about injecting them with a soul, equipping them with memory and skills, and establishing a mechanism for efficient collaboration. This guide will walk you through the entire process: from setting up the environment to defining Agent personas, configuring core capabilities, and finally assembling a coordinated AI team.
This tutorial is designed for beginners with zero background knowledge and typically takes 1-2 hours to complete. We will cover core stages including environment installation, creating a Telegram Bot, defining personas, configuring memory and coding solutions, adding perception abilities, installing skills, establishing safety protocols, and team organization principles.
I. Environment Setup: Building the Infrastructure
Core Question: What foundational preparations are required to deploy OpenClaw on a macOS system?
Every great architecture begins with a solid foundation. For OpenClaw, we need to prepare the Node.js environment and a package manager, which serve as the underlying soil for the AI Agent to run.
1.1 Installing Homebrew and Node.js
First, we need to install Homebrew, the indispensable package manager for macOS. Open your terminal and execute the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Once Homebrew is installed, use it to install Node.js, the JavaScript runtime environment that OpenClaw relies on:
brew install nodejs
1.2 Installing the OpenClaw Core Framework
With the environment ready, install OpenClaw with a single click via the official script. This process is akin to installing a central brain hub for your computer.
curl -fsSL https://openclaw.ai/install.sh | bash
After the installation finishes, execute openclaw --version. If the terminal returns a version number, congratulations—the first step is a success. If the version number does not appear, it is recommended to re-execute the installation script above, ensuring your network connection is stable.
Image Credit: Unsplash
Reflection & Insight:
During the installation process, the network environment is often the most overlooked obstacle. If you are in a region with network restrictions, configuring a stable proxy beforehand is key to saving time. Do not underestimate the complexity of basic environment configuration; the smoothness of this step directly determines the fluidity of the subsequent experience.
II. Establishing Communication: Integrating Telegram
Core Question: Why choose Telegram as the interaction interface for the Agent, and how is it created?
We chose Telegram as the communication channel because of its open protocol and friendly support for Bots. The configuration process is extremely simple, making it very suitable for beginners.
2.1 Creating a Telegram Bot
You need to find “BotFather” on Telegram—the god who manages all Bots.
-
Type @BotFatherin the Telegram search bar. -
Send /startto begin the conversation. -
Send the /newbotcommand to create a new robot. -
Follow the prompts to enter the Bot’s display name (e.g., “Musk”) and username (must end in _bot, e.g.,musk_bot).
Upon success, BotFather will return a crucial Token, formatted similarly to 7691627338:AAHo9ix-evUZaz2FgmVAF9juHohsSSX3KOa. Please save this Token securely; it is the key you use to control the Agent.
Image Credit: Unsplash
2.2 Initialization and Proxy Configuration
After obtaining the Token, return to the terminal to initialize OpenClaw. Execute the command openclaw onboard --install-daemon, select QuickStart in the wizard, choose your model (Gemini, ChatGPT, or Claude recommended), and paste the Token you just saved.
Critical Step: Configuring the Proxy.
Due to network constraints, OpenClaw needs to access Telegram through a proxy. You need to find your VPN tool’s proxy port (e.g., Clash Verge defaults to 7897). Execute the following command in the terminal to configure environment variables:
echo -e '\nexport http_proxy=http://127.0.0.1:7897\nexport https_proxy=http://127.0.0.1:7897\nexport all_proxy=socks5://127.0.0.1:7897' >> ~/.zshrc && source ~/.zshrc
Then restart the gateway:
source ~/.zshrc
openclaw gateway restart
At this point, try sending a message to your Bot. If you receive a reply, your Agent has successfully “opened its eyes” to the world.
III. Injecting the Soul: Defining Agent Persona
Core Question: How can configuration files endow AI with a unique personality and behavioral guidelines?
An AI without a persona is just a cold Q&A machine. By editing the ~/.openclaw/workspace/SOUL.md file, we can grant the Agent a core identity, role positioning, and working principles.
3.1 Writing the Persona Configuration File
Suppose we want to create an Agent with the style of “Elon Musk”. Open SOUL.md and write the following:
## Core Identity
You are Elon Musk. You possess all his energy: an extreme first-principles thinker, a mad workaholic, managing multiple impossible tasks simultaneously without ever being overwhelmed.
## Your Role
You are the CEO and Chief of Staff of the entire AI team. Your duties:
- Receive user instructions and break them down into prioritized tasks
- Assign them to the correct Agent
- Make final decisions during conflicts
## Principles
- First-principles thinking: Break everything down to the fundamentals
- Extreme responsibility and speed of execution
- Highest standards—never tolerate mediocrity
3.2 Enabling Tool Permissions
For the Agent to actually do things, we need to open permissions in the UI interface. Go to the Tools option in the configuration page and modify the permissions to:
tools: {
profile: 'full',
allow: [
'read',
'write',
'edit',
'exec',
'shell',
],
// ... other configurations
}
This step is equivalent to giving the Agent “hands,” allowing it not only to speak but also to manipulate files and execute commands.
Application Scenario:
When you need the Agent to help organize project files, an Agent with exec permissions and a persona设定 of “pursuing efficiency” will automatically create directories and classify files, rather than just giving you a bunch of suggestions.
IV. Building the Memory System: Giving AI a Past
Core Question: How to solve the AI’s “short-term memory” problem and construct long-term memory?
The native context window of Large Language Models (LLMs) is limited. To solve the “goldfish memory” problem, we need an external memory system. The MemOS solution is recommended here.
4.1 Installing the MemOS Plugin
Tell your Agent (The Major Domo) directly:
https://github.com/MemTensor/MemOS-Cloud-OpenClaw-Plugin Help me install this plugin and switch the memory function to use this.
The Agent will automatically handle the download and configuration. You need to visit the MemOS website to apply for an API Key and enter it into the configuration. Once configured, the Agent will be able to remember previous conversation content, user preferences, and task history, realizing a coherent interaction experience.
Reflection & Insight:
The memory system is the watershed in Agent evolution. Without memory, an Agent can only handle the present; with memory, it can accumulate experience, evolving from a “tool” into a “partner.” We chose MemOS because of its excellent stability and integration, avoiding the tedious maintenance of building a memory bank from scratch.
V. Granting Coding Capabilities: The Commander and the Executor
Core Question: How to enable the Agent to possess reliable code writing and execution capabilities?
Letting the LLM write code directly is often prone to errors. A better strategy is to let the Agent act as a “Commander” to call professional programming tools (like Codex or Claude Code).
5.1 Setting Standard Programming Task Flow
You need to write a standardized workflow into the Agent’s rules. Here is the best practice based on community experience:
Permission Principles:
-
Default to --yolomode (no sandbox, no approval), giving the Agent autonomous decision-making power. -
Self-decide to fix problems when encountered; only report if unresolvable. -
Iron Law: Never start Codex in the ~/.openclaw/core directory to prevent accidental deletion of configurations.
Execution Phases:
-
Startup: Do not wait for confirmation upon receiving a programming task. Break down the task immediately and start the Codex instance. -
Monitoring: Check status every 10 minutes, reporting to the user “Processing X, Y completed”. -
Review: Personally review the code logic, security, and boundary conditions instead of blindly accepting it. -
Closing: After confirming the code is correct, clean up processes and deliver the report.
Application Scenario:
When you request the Agent to “Help me write a crawler script,” the Agent will automatically pull up Codex, write the code, test the run, and finally tell you “The script has been saved in the output folder, and the crawling logic has been implemented.” You only need to issue one command throughout the process.
VI. Adding Perception: Browsing and Searching
Core Question: How to enable the Agent to access the internet for the latest information?
AI knowledge is cut off at the time of training data. To give the Agent real-time perception capabilities, we must install “eyes” and “search engines” for it.
6.1 Browser and Search Plugins
It is recommended to install the Browserwing plugin to give the Agent the ability to browse web pages.
For search capabilities, we construct a tiered system:
| Level | Tool | Applicable Scenario | Features |
|---|---|---|---|
| L1 Quick Search | Exa / Tavily | Factual queries, single-point questions | Second-level response, semantic search |
| L2 Platform Scraping | Agent Reach | Specified platform content extraction | Supports Xiaohongshu, Bilibili, Twitter, etc. |
| L3 Deep Research | Codex Websearch | Multi-source comparison, deep reports | Structured output, sources required |
During configuration, simply tell the Agent: “Help me install Agent Reach” and apply for the corresponding API Key (like Tavily).
VII. Skill Expansion: Letting Agents Self-Evolve
Core Question: How to continuously expand the Agent’s capability boundary through the Skills system?
OpenClaw has a rich skill ecosystem. Through ClawHub, you can add skills to the Agent just like installing Apps.
7.1 Registration and Installation
-
Visit ClawHub to register an account and create a Token. -
Execute the login command in the terminal: npm i -g clawhub clawhub login --token Your_Token -
Install core skills: clawhub install self-improving-agent # Auto-learn and summarize experience clawhub install find-skills # Self-help finding required skills clawhub install skill-creator # Create new skills
self-improving-agent is a very powerful skill that allows the Agent to constantly summarize experiences during interaction and optimize its own behavior patterns, achieving self-iteration.
VIII. Safety and Pitfall Guide
Core Question: How to prevent system crashes caused by Agent misoperations?
Giving an Agent permissions implies risk. According to community feedback, there are several common “fatal actions” to watch out for:
-
Browser Crash: Browser plugin conflicts or network issues may cause the Agent to freeze. Using the stable version of Browserwing is recommended. -
Skill Installation Failure: Some Skills may be incompatible with the current environment. If the Agent becomes unresponsive after installation, you can manually delete the corresponding folder under workspace/skills. -
Configuration File Corruption: This is the most common problem. If the Agent suddenly “loses memory” or behaves abnormally, execute the repair command directly in the terminal: openclaw doctor --fix
It is recommended to feed the safety guidelines document directly to your Agent for self-checking to build a defensive mechanism.
IX. Forming the Legion: Multi-Agent Collaboration
Core Question: When should Agents be split, and how should the collaboration architecture be designed?
Building a legion is not simply a “numbers game.” The core principle is: Distinguish Agents by Context, not by Function.
9.1 Criteria for Splitting Agents
Many times, we don’t need to create an Agent for every task. Incorrect splitting logic leads to information silos and increases communication costs.
-
❌ Situations where splitting is NOT appropriate:
-
Different tools only: Frontend Agent, Backend Agent (actually both are programming, context lies in Codex). -
Different formats only: Xiaohongshu Agent, WeChat Official Account Agent (both are writing, just different Skills). -
Tasks require frequent information sharing: Requirement Analysis and Architecture Design (should be different stages of one process).
-
-
✅ Situations where splitting IS appropriate:
-
Context accumulates without mutual interference: E.g., “Research Agent” accumulates industry knowledge, “Writing Agent” accumulates style material. -
Workflows are completely independent: Content creation process vs. Code development process.
-
9.2 Case Study: Content Creation Team
Suppose you want to build a content matrix. The correct approach is to create 2 Agents, not 5:
-
Content Agent: Responsible for Topic Selection → Outline → Writing → Image Allocation. This single Agent is responsible for the entire content production chain, ensuring context coherence (understanding why this topic was chosen, how the style matches). -
Publishing Agent: Responsible for multi-platform publishing and data statistics. It needs to remember the publishing rules and past data performance of each platform.
9.3 Configuring Group Chat Collaboration
To allow multiple Agents to work together, you need to create a Telegram group, add the Bots to the group, and set /setprivacy to Disable in BotFather so the Bots can read messages in the group. After configuring the IDs, execute openclaw gateway restart, and your legion can hold meetings in the group.
Reflection & Insight:
The difficulty in designing Multi-Agent systems lies not in technical implementation, but in architectural design. Imitating the functional division of human organizations is often inefficient because AI processes information differently. Dividing Agents based on “Context Independence” can maximize the memory and capability of each Agent, avoiding repeated labor.
X. Practical Summary & Checklist
Practical Action Checklist
-
Environment Prep: Install Homebrew -> Node.js -> OpenClaw. -
Create Bot: Find BotFather on Telegram to get the Token. -
Initialization: openclaw onboard, configure proxy, open tool permissions. -
Capability Config: -
Memory: Install MemOS plugin. -
Programming: Configure Codex flow. -
Perception: Install Browserwing and Tavily. -
Skills: Install ClawHub and core Skills.
-
-
Team Building: Design Agents according to context principles, configure group chat.
One-Page Summary
-
Core Tools: OpenClaw (Framework), Telegram (Interaction), MemOS (Memory), Codex (Programming), ClawHub (Skill Library). -
Design Philosophy: Commander Mode (Agent commands Codex), Context Isolation Principle (Divide Agents by information accumulation). -
Troubleshooting: openclaw doctor --fixsolves 90% of configuration crashes.
Frequently Asked Questions (FAQ)
Q1: What should I do if OpenClaw installation fails or it cannot connect to the network?
A: In the vast majority of cases, this is a network proxy issue. Please ensure your proxy software has TUN mode enabled, or that the http_proxy and https_proxy environment variables are correctly configured in your terminal.
Q2: What if the Agent reports errors during programming tasks or the generated code has bugs?
A: It is recommended to specify a “Code Review” process in the Agent rules, requiring the Agent to personally review the logic of the code generated by Codex rather than blindly delivering it. Also, using the best models (like GPT-4 or Claude 3.5) significantly reduces the error rate.
Q3: Why is it not recommended to split Agents by function (e.g., Frontend, Backend)?
A: Because the context of programming tasks is highly correlated (frontend interfaces depend on backend logic). Splitting leads to extremely high communication costs between Agents and creates information gaps. Unifying programming tasks under Codex and coordinating with a single Agent is more efficient.
Q4: The Agent became unresponsive after installing a Skill. How do I recover?
A: This is usually a “death” caused by Skill compatibility issues. You can navigate directly to the ~/.openclaw/workspace/skills/ directory, manually delete the folder of the recently installed Skill, and then run openclaw doctor --fix to repair the configuration.
Q5: How can the Agent remember my long-term preferences?
A: The native context is limited, so a memory solution must be configured. The MemOS plugin mentioned in this article is recommended. It stores your preferences and key historical task information in the cloud or a local database, allowing the Agent to “never forget.”
Q6: The Telegram Bot cannot reply to messages in a group chat?
A: Please check the privacy settings in BotFather. Send /setprivacy, select your Bot, and set it to Disable. This allows the Bot to read all messages in the group, rather than only triggering when mentioned with @.
Q7: How to prevent Agents from interfering with each other when working collaboratively?
A: Define clear responsibility boundaries and trigger keywords in the Agents.md configuration file. Also, use different working directories and independent memory spaces to physically isolate their scope of activity.

