How clawdbot Works: Architecture, System Design & Code Deep Dive
Project Overview
Clawdbot is an AI assistant platform designed to provide a unified control plane (the Gateway) for managing AI agents and integrating them across multiple communication channels and interfaces. It features a powerful command-line interface (CLI) for initial setup and configuration, a web-based user interface (Control UI) for ongoing management, and supports various messaging platforms like LINE and WhatsApp. Developers use the CLI for onboarding, while administrators leverage the Control UI, and end-users interact with the AI assistant through their preferred messaging channels.
- Category
- Agent System
- Difficulty
- advanced
- Tech Stack
- TypeScript, Node.js, Docker
- Tags
- application, agents
How clawdbot Works
Clawdbot is an AI assistant platform designed to provide a unified control plane (the Gateway) for managing AI agents and integrating them across multiple communication channels and interfaces. It features a powerful command-line interface (CLI) for initial setup and configuration, a web-based user interface (Control UI) for ongoing management, and supports various messaging platforms like LINE and WhatsApp. Developers use the CLI for onboarding, while administrators leverage the Control UI, and end-users interact with the AI assistant through their preferred messaging channels.
Data Flow
Data flows primarily through the Clawdbot Gateway. Incoming requests, whether from CLI commands, webhooks (e.g., LINE, WhatsApp via Twilio), or the Control UI, are first processed by the Express.js server. Configuration data is loaded from `src/config/config.ts` which aggregates from environment variables and local JSON files (`models.json` managed by `src/agents/models-config.ts`). User input or configuration changes are validated and may update these persistent configuration files. For AI interactions, messages are routed through the Gateway to external AI model APIs (e.g., OpenAI, Anthropic). Responses from these external services are then processed by the relevant channel module (e.g., `src/line/index.ts`) and sent back to the originating platform. The `src/gateway/config-reload.ts` module continuously monitors configuration changes, triggering dynamic reloads or restarts as needed, ensuring runtime adaptability.
Key Modules & Components
- Clawdbot Gateway Orchestration: Provides a unified control plane for managing AI agents and integrating them across multiple channels. This module handles request routing, configuration management, and integration with external services and messaging platforms.
Key files: src/index.ts, src/gateway/server-runtime-config.ts, src/config/config.ts - Configuration Management and Persistence: Handles the loading, validation, persistence, and hot-reloading of application configuration data, including gateway settings, authentication profiles, and AI model configurations. It provides a simplified interface for managing complex configuration logic.
Key files: src/config/config.ts, src/agents/models-config.ts, src/agents/models-config.providers.ts - Command-Line Interface (CLI) Configuration Wizard: Offers an interactive command-line interface for initial setup and configuration of the Clawdbot platform. It guides users through essential setup steps, such as configuring the Gateway's network settings and defining authentication profiles.
Key files: src/index.ts, src/commands/configure.ts, src/commands/configure.wizard.ts - LINE Messaging Channel Integration: Enables Clawdbot to communicate with users via the LINE messaging platform. This module handles webhook reception, message parsing, AI agent routing, and response formatting for LINE's Messaging API.
Key files: src/line/index.ts - Control UI Management Interface: Provides a web-based user interface for administrators to manage and monitor the Clawdbot platform. It interacts with the Clawdbot Gateway to fetch application states or configure platform settings.
Key files: ui/src/main.ts, src/browser/routes/index.ts, src/browser/routes/types.ts
Explore the full interactive analysis of clawdbot on Revibe — architecture diagrams, module flow, execution paths, and code-level insights.