graph TB
    subgraph "外部消息平台"
        TG[Telegram]
        SL[Slack]
        DC[Discord]
        WA[WhatsApp]
        SG[Signal]
        FS[飞书]
        MORE[30+ 其他平台...]
    end

    subgraph "OpenClaw 核心运行时"
        subgraph "Gateway 网关层"
            WS[WebSocket Server<br/>端口 18789]
            AUTH[认证中间件<br/>Ed25519 设备身份]
            PROTO[协议处理器<br/>AJV Schema 校验]
            RL[速率限制]
        end

        subgraph "通道管理"
            CM[Channel Manager]
            CP1[Telegram Plugin]
            CP2[Slack Plugin]
            CP3[Discord Plugin]
            CPN[... N 个通道插件]
        end

        subgraph "路由层"
            RT[Route Resolver<br/>消息 → Agent 映射]
            SK[Session Key Parser<br/>会话键解析]
        end

        subgraph "ACP 协议层"
            ACP_SVR[ACP Server]
            ACP_TR[ACP Translator<br/>协议翻译器]
            ACP_SM[ACP Session Manager<br/>会话管理器 + Actor 队列]
        end

        subgraph "Agent 运行时"
            PI[Pi Agent Runner<br/>LLM 推理引擎]
            TC[Tool Catalog<br/>工具注册表]
            SKL[Skills System<br/>技能加载器]
            SA[Subagent Registry<br/>子 Agent 注册]
            AP[Auth Profiles<br/>模型凭证管理]
        end

        subgraph "记忆系统"
            MM[Memory Index Manager]
            VEC[向量检索<br/>sqlite-vec]
            FTS[全文搜索<br/>SQLite FTS5]
            EMB[Embedding Providers<br/>OpenAI/Gemini/Voyage/Ollama]
        end

        subgraph "心跳系统"
            HB[Heartbeat Runner<br/>定时唤醒]
            HMD[HEARTBEAT.md<br/>任务配置文件]
        end

        subgraph "存储层"
            SS[Session Store<br/>JSON/JSONL 文件]
            CF[Config Store<br/>config.json]
            DI[Device Identity<br/>密钥对存储]
        end
    end

    subgraph "LLM 提供商"
        CLAUDE[Claude / Anthropic]
        GPT[GPT / OpenAI]
        GEM[Gemini / Google]
        QWEN[Qwen / 通义]
        OL[Ollama 本地模型]
        MORE_LLM[Grok/Groq/Azure/...]
    end

    TG & SL & DC & WA & SG & FS & MORE --> CM
    CM --> CP1 & CP2 & CP3 & CPN
    CP1 & CP2 & CP3 & CPN --> RT
    RT --> SK --> ACP_SM
    WS --> AUTH --> PROTO --> ACP_SVR
    ACP_SVR --> ACP_TR --> ACP_SM
    ACP_SM --> PI
    PI --> TC & SKL & SA
    PI --> MM
    MM --> VEC & FTS
    VEC & FTS --> EMB
    PI --> AP --> CLAUDE & GPT & GEM & QWEN & OL & MORE_LLM
    PI --> SS
    HB --> HMD --> PI
    ACP_SM --> SS

    style WS fill:#4A90D9,color:#fff
    style PI fill:#E74C3C,color:#fff
    style MM fill:#27AE60,color:#fff
    style HB fill:#F39C12,color:#fff
    style CM fill:#8E44AD,color:#fff