Architecture
OpenPollen uses a layered architecture that decouples message ingestion, routing, Agent execution, and storage.
Architecture Diagram
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ WebChat │ │ DingTalk │ │ WeCom │
│ (built-in) │ │ (plugin) │ │ (plugin) │
└──────┬──────┘ └──────┬──────┘ └──────┬──────┘
│ │ │
└────────────────┼────────────────┘
│
┌───────▼───────┐
│ Gateway │
│ HTTP Server │
│ /health │
│ /api/status │
│ /api/chat │
└───────┬───────┘
│
┌───────▼───────┐
│ MessageRouter │
│ Session mgmt │
│ Concurrency │
│ Commands │
└───────┬───────┘
│
┌─────────▼─────────┐
│ SessionManager │
│ Lifecycle mgmt │
│ Timeout GC │
└─────────┬─────────┘
│
┌───────▼───────┐
│ AgentRunner │
│ Claude SDK │
│ Skill inject │
│ Tool assign │
└───────┬───────┘
│
┌─────────────┼─────────────┐
│ │ │
┌──────▼──────┐ ┌───▼────┐ ┌─────▼─────┐
│ SkillManager│ │ Memory │ │ Plugins │
│ Discovery │ │ SQLite │ │ Registry │
└─────────────┘ │ File │ │ Lifecycle │
└────────┘ └───────────┘Message Flow
- Ingestion: User messages arrive from channels (WebChat / DingTalk / HTTP API)
- Routing: MessageRouter finds or creates a Session by channel type and user ID
- Concurrency: Only one message per session is processed at a time
- Execution: AgentRunner invokes Claude Agent SDK with injected skills and tools
- Streaming: Agent replies are streamed as chunks in real-time (WebChat)
- Memory: Conversation summaries are stored per user namespace for cross-session context
Core Modules
Gateway Server
HTTP server providing REST API endpoints:
GET /health— Health checkGET /api/status— Runtime status (active sessions, processing count, uptime)POST /api/chat— Send message (supports API Key / JWT auth)
MessageRouter
Core message routing, responsible for:
- Session lookup and creation
- Request deduplication and concurrency control
- Built-in command parsing (
/new,/resume,/market) - Conversation summary storage
SessionManager
Manages all active session lifecycles:
- Sessions identified by channelType + userId + conversationType
- Automatic timeout GC (default 30 minutes)
- Maximum concurrent session limit (default 50)
AgentRunner
Agent execution engine:
- Integrates Claude Agent SDK
- Injects installed skill SKILL.md content into system prompts
- Assigns available tools per configuration
- Supports multi-model switching and budget control
PluginRegistry
Plugin registration center:
- Auto-scans
plugins/directory for plugins - Manages plugin initialize, start, stop lifecycle
- Supports 4 slots: channel / skill / provider / memory