Architecture Overview
System Architecture
Section titled “System Architecture”Clawdbot follows a modular architecture that separates concerns and enables extensibility.
┌─────────────────────────────────────────────────────────────┐│ Clawdbot Core │├─────────────────────────────────────────────────────────────┤│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ││ │ WhatsApp │ │ Telegram │ │ Discord │ │ Slack │ ││ │ Channel │ │ Channel │ │ Channel │ │ Channel │ ││ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬─────┘ ││ │ │ │ │ ││ └─────────────┼─────────────┼─────────────┘ ││ ▼ ││ ┌──────────────┐ ││ │ Gateway │ ││ │ (Router) │ ││ └──────┬───────┘ ││ │ ││ ┌─────────────┼─────────────┐ ││ ▼ ▼ ▼ ││ ┌────────┐ ┌──────────┐ ┌────────┐ ││ │ Hooks │ │ Plugins │ │ Tools │ ││ └────────┘ └──────────┘ └────────┘ ││ │ ││ ▼ ││ ┌──────────────┐ ││ │ Claude │ ││ │ API │ ││ └──────────────┘ │└─────────────────────────────────────────────────────────────┘Core Components
Section titled “Core Components”Channels
Section titled “Channels”Channels handle communication with external platforms:
- WhatsApp: Via WhatsApp Web protocol
- Telegram: Using Bot API
- Discord: Discord.py integration
- Slack: Bolt SDK
- iMessage: macOS automation
Gateway
Section titled “Gateway”The central router that:
- Receives messages from all channels
- Applies middleware and hooks
- Routes to appropriate handlers
- Manages conversation context
Plugins & Tools
Section titled “Plugins & Tools”Extend functionality:
- Plugins: Add new features
- Tools: Provide capabilities to Claude
- Hooks: Intercept and modify behavior
Claude API Integration
Section titled “Claude API Integration”Handles communication with Anthropic:
- Message formatting
- Context management
- Response processing
Data Flow
Section titled “Data Flow”- Message Received: Channel receives user message
- Pre-processing: Hooks run, message normalized
- Context Loading: Conversation history retrieved
- API Call: Message sent to Claude
- Post-processing: Response processed by hooks
- Delivery: Response sent back via channel
Configuration
Section titled “Configuration”Clawdbot uses layered configuration:
.env (secrets) → config.yaml (settings) → CLI args (overrides)