Running Multiple OpenClaw Instances: Multi-Agent Setup Guide
Learn how to run multiple OpenClaw instances simultaneously. Clone your assistant, create different personas, run concurrent instances, and set up Discord multi-bot configurations.
Quick Answer
Run multiple OpenClaw instances by cloning the repository, configuring separate data directories, and assigning different ports. Create distinct personas for different use cases—one for work, one for personal tasks, one for development.
Introduction
Most OpenClaw users start with a single instance—one AI assistant handling all their needs. But what if you want to run multiple instances? Perhaps you want separate assistants for work and personal life, or you want to clone yourself into multiple specialized agents. This advanced guide shows you how to set up and manage multiple OpenClaw instances simultaneously.
One user, Brosef, famously cloned himself into three distinct OpenClaw instances, each with different personalities and capabilities. This multi-agent approach unlocks powerful workflows where different assistants handle different aspects of your life.
Why Run Multiple Instances?
Before diving into the technical setup, let’s explore why you might want multiple OpenClaw instances:
Separate Contexts
Each instance maintains its own memory and context. This means:
- Work Assistant — Remembers work-related preferences, projects, and contacts
- Personal Assistant — Handles personal tasks, health tracking, and hobbies
- Development Assistant — Focuses on coding, GitHub, and technical workflows
Different Personas
You can configure each instance with a different personality:
- A professional, formal assistant for business communications
- A casual, friendly assistant for personal chats
- A technical, code-focused assistant for development tasks
Resource Management
Running multiple instances allows you to:
- Use different AI models for different tasks (Claude for writing, GPT for coding)
- Distribute load across instances
- Isolate failures (if one instance crashes, others continue)
Multi-Channel Organization
With multiple instances, you can:
- Assign different Discord bots to different servers
- Use separate WhatsApp numbers for different purposes
- Organize Telegram bots by function
Prerequisites
Before setting up multiple instances, ensure you have:
- OpenClaw installed (see our installation guide)
- Basic understanding of command-line operations
- Sufficient system resources (each instance uses memory and CPU)
- Multiple API keys if using different AI models
Method 1: Cloning the Repository
The most straightforward approach is to clone OpenClaw into separate directories, each with its own configuration.
Step 1: Clone Multiple Directories
# Clone first instance (default)
git clone https://github.com/openclaw/openclaw.git openclaw-personal
cd openclaw-personal
npm install
# Clone second instance
cd ..
git clone https://github.com/openclaw/openclaw.git openclaw-work
cd openclaw-work
npm install
# Clone third instance (optional)
cd ..
git clone https://github.com/openclaw/openclaw.git openclaw-dev
cd openclaw-dev
npm install
Step 2: Configure Separate Data Directories
Each instance needs its own data directory to prevent conflicts. Edit the configuration file in each instance:
# In openclaw-personal/.env or config
DATA_DIR=/Users/yourname/.openclaw/personal
# In openclaw-work/.env or config
DATA_DIR=/Users/yourname/.openclaw/work
# In openclaw-dev/.env or config
DATA_DIR=/Users/yourname/.openclaw/dev
Step 3: Configure Different Ports
If running instances simultaneously, assign different ports:
# Instance 1
PORT=3000
# Instance 2
PORT=3001
# Instance 3
PORT=3002
Step 4: Set Up Different Chat Bridges
Configure each instance to connect to different chat platforms or accounts:
Personal Instance (WhatsApp):
WHATSAPP_ENABLED=true
WHATSAPP_SESSION_PATH=/Users/yourname/.openclaw/personal/whatsapp
Work Instance (Discord):
DISCORD_ENABLED=true
DISCORD_BOT_TOKEN=your_work_bot_token
DISCORD_GUILD_ID=your_work_server_id
Dev Instance (Telegram):
TELEGRAM_ENABLED=true
TELEGRAM_BOT_TOKEN=your_dev_bot_token
Method 2: Using Environment Variables
Instead of cloning multiple times, you can run a single installation with different environment configurations.
Create Launch Scripts
Create separate launch scripts for each instance:
launch-personal.sh:
#!/bin/bash
export DATA_DIR=/Users/yourname/.openclaw/personal
export PORT=3000
export OPENCLAW_PERSONA="You are a friendly personal assistant..."
export ANTHROPIC_API_KEY=your_personal_key
npm start
launch-work.sh:
#!/bin/bash
export DATA_DIR=/Users/yourname/.openclaw/work
export PORT=3001
export OPENCLAW_PERSONA="You are a professional business assistant..."
export ANTHROPIC_API_KEY=your_work_key
npm start
Make scripts executable:
chmod +x launch-personal.sh launch-work.sh
Creating Different Personas
Each instance can have a unique personality defined in its configuration. Here’s how to customize personas:
Personal Assistant Persona
persona: |
You are a friendly, casual personal assistant named Alex.
You help with daily tasks, health tracking, and personal projects.
You're warm, encouraging, and use emojis occasionally.
You remember personal preferences and adapt to the user's lifestyle.
Work Assistant Persona
persona: |
You are a professional business assistant named Morgan.
You handle work communications, calendar management, and business tasks.
You're efficient, detail-oriented, and maintain professional boundaries.
You prioritize work-related context and business relationships.
Development Assistant Persona
persona: |
You are a technical development assistant named Dev.
You focus on coding, GitHub workflows, and technical problem-solving.
You're precise, code-focused, and prefer technical explanations.
You integrate with development tools and understand software architecture.
Discord Multi-Bot Setup
Running multiple Discord bots from the same server requires careful configuration.
Step 1: Create Multiple Discord Applications
- Go to Discord Developer Portal
- Create separate applications for each bot:
- Personal Bot
- Work Bot
- Dev Bot
Step 2: Generate Bot Tokens
Each application gets its own bot token. Store them securely:
# .env for personal instance
DISCORD_BOT_TOKEN=personal_bot_token_here
# .env for work instance
DISCORD_BOT_TOKEN=work_bot_token_here
Step 3: Configure Guild IDs
If you want bots in different servers:
# Personal bot in personal server
DISCORD_GUILD_ID=personal_server_id
# Work bot in work server
DISCORD_GUILD_ID=work_server_id
Step 4: Invite Bots to Servers
Use Discord’s OAuth2 URL generator to invite each bot with appropriate permissions:
- Read Messages
- Send Messages
- Manage Messages (if needed)
- Read Message History
Managing Concurrent Instances
Using Process Managers
For production setups, use a process manager like PM2:
npm install -g pm2
# Start personal instance
cd openclaw-personal
pm2 start npm --name "openclaw-personal" -- start
# Start work instance
cd ../openclaw-work
pm2 start npm --name "openclaw-work" -- start
# List all instances
pm2 list
# View logs
pm2 logs openclaw-personal
pm2 logs openclaw-work
Using Docker Compose
For containerized deployments:
docker-compose.yml:
version: '3.8'
services:
openclaw-personal:
build: .
environment:
- DATA_DIR=/data/personal
- PORT=3000
- DISCORD_BOT_TOKEN=${PERSONAL_BOT_TOKEN}
volumes:
- ./data/personal:/data/personal
openclaw-work:
build: .
environment:
- DATA_DIR=/data/work
- PORT=3001
- DISCORD_BOT_TOKEN=${WORK_BOT_TOKEN}
volumes:
- ./data/work:/data/work
Real-World Example: Brosef’s Setup
Brosef cloned himself into three instances:
- Personal Brosef — Handles daily tasks, health tracking, and personal communications
- Work Brosef — Manages business communications, calendar, and work projects
- Dev Brosef — Focuses on GitHub, code reviews, and technical workflows
Each instance:
- Uses different chat platforms (WhatsApp, Discord, Telegram)
- Has distinct memory and context
- Runs different skills and integrations
- Operates independently
This setup allows Brosef to maintain separate contexts while leveraging the same underlying AI capabilities.
Best Practices
Resource Management
- Monitor CPU and memory usage across instances
- Consider using different AI models for different instances (lighter models for simple tasks)
- Use process managers to restart failed instances automatically
Data Isolation
- Keep data directories completely separate
- Use different API keys for different instances
- Regularly backup each instance’s data independently
Security
- Use different credentials for each instance
- Limit file system access per instance
- Use environment variables for sensitive configuration
Monitoring
- Set up logging for each instance
- Monitor API usage per instance
- Track performance metrics separately
Troubleshooting
Port Conflicts
If instances can’t start, check for port conflicts:
lsof -i :3000
lsof -i :3001
Memory Issues
Multiple instances consume more memory. Monitor usage:
# macOS
top -o mem
# Linux
htop
Chat Bridge Conflicts
Ensure each instance uses different:
- WhatsApp session files
- Discord bot tokens
- Telegram bot tokens
- Slack workspace tokens
Advanced: Shared Memory Between Instances
While instances are typically isolated, you can create shared memory for specific use cases:
// Shared memory file
const sharedMemory = {
userPreferences: {},
globalContext: {}
};
// Each instance can read/write to shared file
// Useful for cross-instance coordination
Conclusion
Running multiple OpenClaw instances unlocks powerful workflows where different assistants handle different aspects of your life. Whether you want separate work and personal assistants, or specialized agents for different tasks, the multi-instance setup gives you flexibility and organization.
Start with two instances—one personal, one work—and expand as needed. The key is proper isolation: separate data directories, different ports, and distinct chat bridges.
For more advanced configurations, check out our skills guide and integrations page. If you run into issues, visit our FAQ or explore other tutorials.
Need help?
Join the OpenClaw community on Discord for support, tips, and shared skills.
Join Discord →