BaihuBaihu
Architecture

architecture overview

trait-based pluggable subsystems

design

every subsystem is a trait. swap implementations with a config change, zero code changes.

subsystemtraitships withextend
AI modelsProvider22+ providerscustom:https://your-api.com
channelsChannelCLI, telegram, discord, slack, iMessage, matrix, whatsapp, webhookany messaging API
memoryMemorySQLite hybrid search + LZ4any persistence backend
toolsToolshell, file_read, file_write, memory_store, memory_recall, browser, composioany capability
observabilityObservernoop, log, multiprometheus, OTEL
securitySecurityPolicypairing, sandbox, allowlists, SSRF, encrypted secrets-
tunnelTunnelcloudflare, tailscale, ngrok, customany tunnel binary

modules

src/
├── agent/        # conversation loop, tool dispatch
├── channels/     # channel trait + 8 implementations
├── config/       # toml config, env var overrides
├── cron/         # scheduled tasks
├── daemon/       # full runtime with JoinSet
├── doctor/       # system diagnostics
├── gateway/      # HTTP API server
├── health/       # health check endpoints
├── heartbeat/    # periodic task engine
├── integrations/ # 74 integration definitions
├── memory/       # SQLite hybrid search
├── migration/    # legacy format migration
├── observability/# logging, metrics
├── onboard/      # setup wizard
├── providers/    # AI provider trait + implementations
├── runtime/      # native runtime adapter
├── security/     # pairing, secrets, sandbox, policy
├── service/      # OS service management
├── skills/       # skill loader
├── tools/        # tool trait + implementations
└── tunnel/       # tunnel trait + implementations

tech stack

layertech
languagerust, 100%
allocatormimalloc
mutexparking_lot (1 byte vs 40)
concurrencytokio JoinSet
memorySQLite + FTS5 + vector cosine + LZ4
encryptionChaCha20-Poly1305 AEAD + DPAPI
HTTPaxum + tower
cachingDashMap concurrent hashmap
buildopt-level=z, LTO, panic=abort

On this page