Skip to content

zmzhace/microclaw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MicroClaw 🦞

A lightweight, extensible AI agent framework with multi-agent support and tool calling capabilities.

Python 3.12+ License: MIT

✨ Features

πŸš€ Core Features

  • Multi-Agent Support: Create multiple specialized AI agents with independent workspaces and configurations
  • Intelligent Conversations: LLM-based natural language interaction with multi-turn dialogue
  • Tool Calling: Built-in filesystem, shell, web search tools with parallel execution
  • MCP Protocol: Model Context Protocol support for extensible external tools
  • Session Management: Auto-compress history messages and generate conversation summaries
  • Command System: Built-in commands for agent management and system control
  • Event Bus: Lightweight async event system for extensibility
  • Tool Policy: Fine-grained tool access control per agent
  • Skills System: Pluggable skill modules with custom extensions
  • Memory Mechanism: Persistent memory across sessions

🎯 Technical Highlights

  • Orchestrator Layer: Smart request routing and command handling
  • System Prompt Caching: Smart caching based on file mtime for better performance
  • Streaming Response: Real-time streaming output support
  • Async Architecture: Built on asyncio for efficient concurrent request handling
  • Structured Logging: Using loguru with detailed execution logs
  • Systemd Integration: Auto-start on boot, auto-restart, production-ready

πŸ“‘ Multi-Channel Support

  • Telegram
  • WeChat Work (Bot + App)
  • Discord
  • Slack
  • Webhook
  • More coming soon...

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Channel Adapters                            β”‚
β”‚  Telegram, WeChat Work, Discord, Slack, Webhook                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚ Request + Context
                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Orchestrator                                  β”‚
β”‚  - Command Router                                               β”‚
β”‚  - Agent Router                                                 β”‚
β”‚  - Event Bus                                                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Agent Runtime                                 β”‚
β”‚  - Multi-Agent Support                                          β”‚
β”‚  - Session Manager                                              β”‚
β”‚  - Tool Policy                                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Tools + Providers                             β”‚
β”‚  - Enhanced Tools                                               β”‚
β”‚  - Memory System                                                β”‚
β”‚  - MCP Support                                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Install Dependencies

cd microclaw
pip install -r requirements.txt

Configuration

Copy the example config and modify:

cp config.example.yaml config.yaml
vim config.yaml

Configuration example:

core:
  workspace: ~/.microclaw
  log_level: INFO
  default_model: qwen

models:
  - name: qwen
    provider: openai
    base_url: https://dashscope.aliyuncs.com/compatible-mode/v1
    api_key: sk-your-api-key
    model: qwen-plus

channels:
  telegram:
    enabled: true
    settings:
      token: "your-bot-token"
      allowed_users: ["123456789"]

Run

Direct Run

python3 main.py

Using Systemd (Recommended)

# Install service
sudo cp microclaw.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable microclaw
sudo systemctl start microclaw

# Check status
sudo systemctl status microclaw

# View logs
sudo journalctl -u microclaw -f

πŸ“– Documentation

πŸ€– Multi-Agent Usage

Create Specialized Agents

# Coding assistant - file and shell access only
app.agent_manager.create_agent(
    agent_id="coding",
    description="Coding assistant",
    allowed_tools=["read_file", "write_file", "list_directory", "exec"],
)

# Research assistant - web and memory access only
app.agent_manager.create_agent(
    agent_id="research",
    description="Research assistant",
    allowed_tools=["web_search", "web_fetch", "read_memory", "update_memory"],
)

Use Commands

In any channel:

/status                    # Show session status
/agent list                # List all agents
/agent info coding         # Show agent details
/new                       # Reset session
/help                      # Show help

πŸ› οΈ Built-in Tools

  • Filesystem: read_file, write_file, list_directory
  • Shell: exec (with timeout control)
  • Web: web_search (DuckDuckGo), web_fetch
  • Memory: update_memory, read_memory
  • MCP: Extensible external tools via Model Context Protocol

πŸ”Œ MCP Support

MCP (Model Context Protocol) allows integration with external tool servers.

Configuration example:

mcp:
  servers:
    filesystem:
      command: "npx"
      args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
    
    github:
      command: "npx"
      args: ["-y", "@modelcontextprotocol/server-github"]
      env:
        GITHUB_TOKEN: "your-token"

πŸ“Š Performance

  • Startup Time: ~2s
  • Memory Usage: ~100MB
  • Response Latency: ~100ms (excluding LLM)
  • Concurrency: Supports multi-channel concurrency

πŸ§ͺ Testing

# Test all features
python3 test_features.py

# Test multi-agent functionality
python3 test_multi_agent.py

# Test skills integration
python3 test_skills_integration.py

# Test basic functionality
python3 test_basic.py

πŸ—ΊοΈ Roadmap

Phase 1: Core Enhancement βœ… (Completed)

  • Multi-Agent support
  • Orchestrator layer
  • Event bus
  • Tool policy
  • Command system

Phase 2: Tools and Policy (Week 3-4)

  • Tool policy system with groups
  • Agent communication tools
  • Session management tools
  • Semantic memory (optional)

Phase 3: Plugin System (Week 5)

  • Lightweight plugin system
  • Lifecycle hooks
  • Built-in plugins

Phase 4: Channels and Infrastructure (Week 6-7)

  • Channel plugin system
  • Lightweight Gateway (optional)
  • Health checks and metrics

Phase 5: Optimization and Polish (Week 8)

  • Performance optimization
  • Testing and documentation
  • Production readiness

🀝 Contributing

Issues and Pull Requests are welcome!

πŸ“„ License

MIT License

πŸ™ Credits

  • Inspired by OpenClaw
  • Implementation: ACE

πŸ“ˆ Project Status

βœ… Production Ready (Phase 1 Complete)

  • Multi-agent support: βœ…
  • Command system: βœ…
  • Event bus: βœ…
  • Tool policy: βœ…
  • Backward compatible: βœ…

Last Updated: 2026-03-05


Note: This is a lightweight implementation inspired by OpenClaw, focusing on core functionality with minimal dependencies and codebase (~4,100 lines vs OpenClaw's ~50,000 lines).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors