mclaw

module
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2026 License: MIT

README ΒΆ

MClaw Banner

🦞 MClaw

Ultra-lightweight personal AI assistant inspired by OpenClaw, built on PicoClaw.
Multi-channel Β· Multi-LLM Β· Intelligent Memory Β· Single Go binary.

Go License Size CGO

Telegram Discord WhatsApp Feishu


✨ 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

MClaw Architecture

How the Agent Loop works:

  1. Chat Apps (Telegram, Discord, WhatsApp, Feishu) send messages through the Message Bus
  2. The Agent Loop passes messages to the LLM for processing
  3. The LLM can invoke Tools (file ops, shell, web search, browser)
  4. Context (Memory + Skills) enriches every request automatically
  5. 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!

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

Configure

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:

  1. Before LLM call β€” embed query β†’ find related memories (cosine similarity) β†’ inject into prompt
  2. After response β€” async extract facts β†’ embed β†’ consolidate (ADD/UPDATE/DELETE) β†’ save to SQLite
  3. 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.


πŸ› οΈ Built-in Tools

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
  1. Go to Google Cloud Console
  2. Create a project β†’ APIs & Services β†’ Library β†’ Enable Custom Search API
  3. APIs & Services β†’ Credentials β†’ Create Credentials β†’ API key β†’ copy as google.api_key
  4. 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

Directories ΒΆ

Path Synopsis
cmd
mclaw command
pkg
bus

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL