π¦ MClaw
Ultra-lightweight personal AI assistant inspired by OpenClaw, built on PicoClaw.
Multi-channel Β· Multi-LLM Β· Intelligent Memory Β· Single Go binary.
β¨ Features
| Feature |
Description |
| π Multi-Channel |
Telegram, Discord, WhatsApp, Feishu (Lark) |
| π€ Multi-LLM |
OpenAI, Claude, Gemini, Groq, DeepSeek, ZhiPu, OpenRouter, vLLM |
| π Model Fallback |
Auto-switch to fallback models on 429 rate limits, daily reset |
| π Streaming + Thinking |
Real-time SSE with thinking display (Gemini 2.5, Claude Opus) |
| π οΈ Tool Use |
File I/O, shell, web search (Brave / Google), web fetch, headless browser |
| π§ Intelligent Memory |
Mem0-lite β auto-extracts & recalls facts across sessions |
| π Skills |
Modular knowledge packs, install from GitHub |
| ποΈ Voice |
Speech-to-text via Groq Whisper |
| πΎ Sessions |
Persistent history with auto-summarization |
| β° Cron |
Scheduled recurring tasks with delivery |
| π Heartbeat |
Item-based periodic notes & reminders |
ποΈ Architecture
How the Agent Loop works:
- Chat Apps (Telegram, Discord, WhatsApp, Feishu) send messages through the Message Bus
- The Agent Loop passes messages to the LLM for processing
- The LLM can invoke Tools (file ops, shell, web search, browser)
- Context (Memory + Skills) enriches every request automatically
- Response is streamed back to the originating channel
π Quick Start
Option 1: Download pre-built binary
Download from Releases and run:
macOS (Apple Silicon)
curl -LO https://github.com/ntminh611/mclaw/releases/latest/download/mclaw-darwin-arm64
chmod +x mclaw-darwin-arm64
mv mclaw-darwin-arm64 mclaw
./mclaw start
macOS (Intel)
curl -LO https://github.com/ntminh611/mclaw/releases/latest/download/mclaw-darwin-amd64
chmod +x mclaw-darwin-amd64
mv mclaw-darwin-amd64 mclaw
./mclaw start
Linux (x86_64)
curl -LO https://github.com/ntminh611/mclaw/releases/latest/download/mclaw-linux-amd64
chmod +x mclaw-linux-amd64
mv mclaw-linux-amd64 mclaw
./mclaw start
Windows
# Download mclaw-windows-amd64.exe from Releases page
# Rename to mclaw.exe, then:
.\mclaw.exe start
Android (Termux)
# Install Termux from F-Droid, then:
curl -LO https://github.com/ntminh611/mclaw/releases/latest/download/mclaw-android-arm64
chmod +x mclaw-android-arm64
mv mclaw-android-arm64 mclaw
./mclaw start
π‘ Tip: DΓΉng Δiα»n thoαΊ‘i Android cΕ© + Termux lΓ m mini server chαΊ‘y MClaw 24/7 β miα»
n phΓ, tiαΊΏt kiα»m Δiα»n!
Setup (recommended)
After downloading, run the setup script to install optional dependencies and create config:
chmod +x setup.sh
./setup.sh
The script will:
- β
Detect your OS (macOS, Linux, Termux)
- β
Check & install Chrome/Chromium (optional β for browser tool)
- β
Create
config.json next to the binary from example
- β
Initialize workspace directories
Option 2: Build from source
git clone https://github.com/ntminh611/mclaw.git
cd mclaw
make build
./setup.sh # Optional: install dependencies
./mclaw start
Create config.json next to the mclaw binary (or copy from config.example.json):
./
βββ mclaw # executable
βββ config.json # configuration (API keys, channels)
βββ mclawdata/ # runtime data (auto-created)
βββ workspace/
βββ sessions/
βββ memory.db
{
"agents": {
"defaults": {
"model": "gemini/gemini-2.5-pro",
"fallback_models": ["gemini/gemini-2.5-flash"], // auto-switch on 429
"max_tokens": 128000,
"temperature": 0.75
}
},
"channels": {
"telegram": {
"enabled": true,
"token": "YOUR_BOT_TOKEN",
"allow_from": ["YOUR_USER_ID"]
}
},
"providers": {
"gemini": { "api_key": "YOUR_GEMINI_KEY" }
},
"memory": {
"enabled": true
},
"heartbeat": {
"enabled": true,
"interval_minutes": 10
}
}
Tip: If no config file exists, MClaw starts with default settings. You only need to add your API keys.
Run
./mclaw start # Server mode β all channels + cron + heartbeat
./mclaw agent # Interactive CLI mode
./mclaw agent -m "Hi" # One-shot CLI
π CLI Commands
| Command |
Description |
mclaw start |
Start server (all channels + cron + heartbeat) |
mclaw agent |
Interactive CLI chat |
mclaw agent -m "..." |
One-shot message |
mclaw status |
Show service status |
mclaw cron |
Manage scheduled tasks |
mclaw skills |
Install / list / remove skills |
mclaw version |
Print version |
π§ Mem0-lite: Intelligent Memory
MClaw automatically remembers important facts about users across sessions β no manual configuration needed.
User: "TΓ΄i thΓch cΓ phΓͺ Δen vΓ Δang hα»c Rust"
Bot: [responds normally]
[background: saves 2 facts β preference: cΓ phΓͺ Δen, learning: Rust]
--- reset session ---
User: "TΓ΄i thΓch uα»ng gΓ¬ nhα»?"
Bot: "BαΊ‘n thΓch cΓ phΓͺ Δen!" β recalled from long-term memory
How it works:
- Before LLM call β embed query β find related memories (cosine similarity) β inject into prompt
- After response β async extract facts β embed β consolidate (ADD/UPDATE/DELETE) β save to SQLite
- Across sessions β memories persist in
memory.db, survive session resets
| Config Key |
Default |
Description |
enabled |
false |
Enable Mem0-lite |
top_k |
5 |
Max memories recalled per query |
min_score |
0.3 |
Minimum cosine similarity threshold |
max_memories |
1000 |
Limit per user (auto-prune) |
Note: Memory uses Gemini text-embedding-004 for embeddings (free). If memory.api_key is empty, it falls back to providers.gemini.api_key.
π€ Supported LLM Providers
| Prefix |
Provider |
Example |
gemini/ |
Google Gemini |
gemini/gemini-2.5-pro |
openai/ |
OpenAI |
openai/gpt-4o |
anthropic/ |
Anthropic Claude |
anthropic/claude-sonnet-4-20250514 |
groq/ |
Groq |
groq/llama-3.1-70b |
deepseek/ |
DeepSeek |
deepseek/deepseek-chat |
openrouter/ |
OpenRouter |
openrouter/auto |
zhipu/ |
ZhiPu |
zhipu/glm-4 |
vllm/ |
vLLM (self-hosted) |
vllm/your-model |
Thinking models (Gemini 2.5 Pro, Claude Opus) display π thinking process on Telegram before responding.
Set custom endpoints via api_base for proxies or self-hosted models.
| Tool |
Description |
read_file |
Read file contents |
write_file |
Write / create files |
list_dir |
List directory contents |
exec |
Execute shell commands |
web_search |
Search web (Brave or Google) |
web_fetch |
Fetch & extract text from URLs |
browser |
Headless Chrome β auto-disabled if Chrome not installed |
cron |
Add / list / remove scheduled jobs |
heartbeat |
Add / list / remove / enable / disable periodic notes |
Note: The browser tool requires Chrome/Chromium installed on the system. If not found, it auto-disables gracefully and suggests using web_fetch instead.
π Web Search Configuration
MClaw supports two search providers: Brave Search (default) and Google Custom Search.
Brave Search (default):
"tools": {
"web": {
"search": {
"provider": "brave", // or omit β brave is default
"api_key": "YOUR_BRAVE_KEY", // Get at https://brave.com/search/api/
"max_results": 5
}
}
}
Google Custom Search:
"tools": {
"web": {
"search": {
"provider": "google",
"max_results": 5,
"google": {
"api_key": "YOUR_GOOGLE_KEY", // Google Cloud API key
"cx": "YOUR_SEARCH_ENGINE_ID" // Programmable Search Engine ID
}
}
}
}
How to get Google Search credentials
- Go to Google Cloud Console
- Create a project β APIs & Services β Library β Enable Custom Search API
- APIs & Services β Credentials β Create Credentials β API key β copy as
google.api_key
- Go to Programmable Search Engine β Add β enable "Search the entire web" β copy Search engine ID as
google.cx
Free tier: 100 queries/day. Additional: $5/1000 queries.
π¦ Skills
Modular knowledge packs that teach specialized tasks.
mclaw skills list # List installed
mclaw skills install <github-url> # Install from GitHub
mclaw skills remove <skill-name> # Remove
mclaw skills search <keyword> # Search available skills
Create your own
mclawdata/workspace/skills/my-skill/
βββ SKILL.md # Required β instructions + YAML frontmatter
βββ scripts/ # Optional β helper scripts
βββ references/ # Optional β reference docs
βββ assets/ # Optional β templates, images
Built-in skills: github Β· skill-creator Β· summarize Β· tmux Β· weather
π¬ Telegram Commands
| Command |
Action |
/start |
Welcome + model info |
/help |
List commands |
/reset |
Clear conversation history |
/status |
Bot status |
/cron |
Scheduled jobs |
/heartbeat |
Health check status |
π³ Docker
# Build
docker build -t mclaw .
# Run (mount config + data)
docker run -d --name mclaw \
-v ./config.json:/app/config.json \
-v ./mclawdata:/app/mclawdata \
mclaw
π¨ Build
make build # Build for current platform
make dist # Cross-compile all platforms (macOS/Linux/Windows)
make test # Run tests
make clean # Clean build artifacts
make run # Build & start server
Manual cross-compile
GOOS=linux GOARCH=amd64 go build -o dist/mclaw-linux-amd64 ./cmd/mclaw
GOOS=darwin GOARCH=arm64 go build -o dist/mclaw-darwin-arm64 ./cmd/mclaw
GOOS=windows GOARCH=amd64 go build -o dist/mclaw-windows.exe ./cmd/mclaw
Note: MClaw compiles with CGO_ENABLED=0 β no C dependencies, cross-compile anywhere.
π Project Structure
./
βββ mclaw Binary
βββ config.json Configuration (API keys, channels, tools)
cmd/mclaw/ CLI entry point & commands
pkg/
βββ agent/ Agent loop, model switcher, tool execution
βββ bus/ Message bus (inbound/outbound)
βββ channels/ Telegram, Discord, WhatsApp, Feishu
βββ config/ Configuration loading & defaults
βββ cron/ Cron job scheduler
βββ heartbeat/ Periodic health checks
βββ logger/ Structured logging
βββ memory/ π§ Mem0-lite memory engine
β βββ store.go SQLite store (pure Go, no CGO)
β βββ embedder.go Gemini/OpenAI embedding client
β βββ extractor.go LLM fact extraction
β βββ consolidator.go ADD/UPDATE/DELETE/NOOP logic
β βββ engine.go Pipeline orchestrator
βββ providers/ LLM provider (SSE streaming)
βββ session/ Session persistence & auto-summarization
βββ skills/ Skills loader & installer
βββ tools/ Tool registry (browser, cron, etc.)
βββ voice/ Groq Whisper transcription
skills/ Built-in skill definitions
docs/ Banner & architecture images
mclawdata/ Runtime data (workspace, sessions, memory.db)
π License
MIT β see LICENSE for details.
Built with β€οΈ and Go Β· Inspired by OpenClaw Β· Built on PicoClaw