TaskFlow
DashboardFreewriteWhiteboardsProjectsCRMTasksNotificationsSettingsAgent TowerAPI Docs
OpenClaw Docs
?

User

Member

Caricamento in corso...

Home
Progetti
Task
Notifiche
CRM

    OpenClaw

    Documentation Mirror

    Documentation Overview

    Docs

    Auth credential semantics
    Scheduled tasks
    Hooks
    Automation & tasks
    Standing orders
    Task flow
    Background tasks
    BlueBubbles
    Broadcast groups
    Channel routing
    Discord
    Feishu
    Google Chat
    Group messages
    Groups
    iMessage
    Chat channels
    IRC
    LINE
    Channel location parsing
    Matrix
    Matrix migration
    Matrix push rules for quiet previews
    Mattermost
    Microsoft Teams
    Nextcloud Talk
    Nostr
    Pairing
    QA channel
    QQ bot
    Signal
    Slack
    Synology Chat
    Telegram
    Tlon
    Channel troubleshooting
    Twitch
    WeChat
    WhatsApp
    Yuanbao
    Zalo
    Zalo personal
    CI pipeline
    ACP
    Agent
    Agents
    Approvals
    Backup
    Browser
    Channels
    Clawbot
    `openclaw commitments`
    Completion
    Config
    Configure
    Cron
    Daemon
    Dashboard
    Devices
    Directory
    DNS
    Docs
    Doctor
    Flows (redirect)
    Gateway
    Health
    Hooks
    CLI reference
    Inference CLI
    Logs
    MCP
    Memory
    Message
    Migrate
    Models
    Node
    Nodes
    Onboard
    Pairing
    Plugins
    Proxy
    QR
    Reset
    Sandbox CLI
    Secrets
    Security
    Sessions
    Setup
    Skills
    Status
    System
    `openclaw tasks`
    TUI
    Uninstall
    Update
    Voicecall
    Webhooks
    Wiki
    Active memory
    Agent runtime
    Agent loop
    Agent runtimes
    Agent workspace
    Gateway architecture
    Channel docking
    Inferred commitments
    Compaction
    Context
    Context engine
    Delegate architecture
    Dreaming
    Experimental features
    Features
    Markdown formatting
    Memory overview
    Builtin memory engine
    Honcho memory
    QMD memory engine
    Memory search
    Messages
    Model failover
    Model providers
    Models CLI
    Multi-agent routing
    OAuth
    OpenClaw App SDK
    Presence
    QA overview
    Matrix QA
    Command queue
    Steering queue
    Retry policy
    Session management
    Session pruning
    Session tools
    SOUL.md personality guide
    Streaming and chunking
    System prompt
    Timezones
    TypeBox
    Typing indicators
    Usage tracking
    Date and time
    Node + tsx crash
    Diagnostics flags
    Authentication
    Background exec and process tool
    Bonjour discovery
    Bridge protocol
    CLI backends
    Configuration — agents
    Configuration — channels
    Configuration — tools and custom providers
    Configuration
    Configuration examples
    Configuration reference
    Diagnostics export
    Discovery and transports
    Doctor
    Gateway lock
    Health checks
    Heartbeat
    Gateway runbook
    Local models
    Gateway logging
    Multiple gateways
    Network model
    OpenAI chat completions
    OpenResponses API
    OpenShell
    OpenTelemetry export
    Gateway-owned pairing
    Prometheus metrics
    Gateway protocol
    Remote access
    Remote gateway setup
    Sandbox vs tool policy vs elevated
    Sandboxing
    Secrets management
    Secrets apply plan contract
    Security audit checks
    Security
    Tailscale
    Tools invoke API
    Troubleshooting
    Trusted proxy auth
    Debugging
    Environment variables
    FAQ
    FAQ: first-run setup
    FAQ: models and auth
    GPT-5.5 / Codex agentic parity
    GPT-5.5 / Codex parity maintainer notes
    Help
    Scripts
    Testing
    Testing: live suites
    General troubleshooting
    OpenClaw
    Ansible
    Azure
    Bun (experimental)
    ClawDock
    Release channels
    DigitalOcean
    Docker
    Docker VM runtime
    exe.dev
    Fly.io
    GCP
    Hetzner
    Hostinger
    Install
    Installer internals
    Kubernetes
    macOS VMs
    Migration guide
    Migrating from Claude
    Migrating from Hermes
    Nix
    Node.js
    Northflank
    Oracle Cloud
    Podman
    Railway
    Raspberry Pi
    Render
    Uninstall
    Updating
    Logging
    Network
    Audio and voice notes
    Camera capture
    Image and media support
    Nodes
    Location command
    Media understanding
    Talk mode
    Node troubleshooting
    Voice wake
    Pi integration architecture
    Pi development workflow
    Android app
    Platforms
    iOS app
    Linux app
    Gateway on macOS
    Canvas
    Gateway lifecycle
    macOS dev setup
    Health checks (macOS)
    Menu bar icon
    macOS logging
    Menu bar
    Peekaboo bridge
    macOS permissions
    Remote control
    macOS signing
    Skills (macOS)
    Voice overlay
    Voice wake (macOS)
    WebChat (macOS)
    macOS IPC
    macOS app
    Windows
    Plugin internals
    Plugin architecture internals
    Building plugins
    Plugin bundles
    Codex Computer Use
    Codex harness
    Community plugins
    Plugin compatibility
    Google Meet plugin
    Plugin hooks
    Plugin manifest
    Memory LanceDB
    Memory wiki
    Message presentation
    Agent harness plugins
    Building channel plugins
    Channel turn kernel
    Plugin entry points
    Plugin SDK migration
    Plugin SDK overview
    Building provider plugins
    Plugin runtime helpers
    Plugin setup and config
    Plugin SDK subpaths
    Plugin testing
    Skill workshop plugin
    Voice call plugin
    Webhooks plugin
    Zalo personal plugin
    OpenProse
    Alibaba Model Studio
    Anthropic
    Arcee AI
    Azure Speech
    Amazon Bedrock
    Amazon Bedrock Mantle
    Chutes
    Claude Max API proxy
    Cloudflare AI gateway
    ComfyUI
    Deepgram
    Deepinfra
    DeepSeek
    ElevenLabs
    Fal
    Fireworks
    GitHub Copilot
    GLM (Zhipu)
    Google (Gemini)
    Gradium
    Groq
    Hugging Face (inference)
    Provider directory
    Inferrs
    Inworld
    Kilocode
    LiteLLM
    LM Studio
    MiniMax
    Mistral
    Model provider quickstart
    Moonshot AI
    NVIDIA
    Ollama
    OpenAI
    OpenCode
    OpenCode Go
    OpenRouter
    Perplexity
    Qianfan
    Qwen
    Runway
    SGLang
    StepFun
    Synthetic
    Tencent Cloud (TokenHub)
    Together AI
    Venice AI
    Vercel AI gateway
    vLLM
    Volcengine (Doubao)
    Vydra
    xAI
    Xiaomi MiMo
    Z.AI
    Default AGENTS.md
    Release policy
    API usage and costs
    Credits
    Device model database
    Full release validation
    Memory configuration reference
    OpenClaw App SDK API design
    Prompt caching
    Rich output protocol
    RPC adapters
    SecretRef credential surface
    Session management deep dive
    AGENTS.md template
    BOOT.md template
    BOOTSTRAP.md template
    HEARTBEAT.md template
    IDENTITY template
    SOUL.md template
    TOOLS.md template
    USER template
    Tests
    Token use and costs
    Transcript hygiene
    Onboarding reference
    Contributing to the threat model
    Threat model (MITRE ATLAS)
    Formal verification (security models)
    Network proxy
    Agent bootstrapping
    Docs directory
    Getting started
    Docs hubs
    OpenClaw lore
    Onboarding (macOS app)
    Onboarding overview
    Personal assistant setup
    Setup
    Showcase
    Onboarding (CLI)
    CLI automation
    CLI setup reference
    ACP agents
    ACP agents — setup
    Agent send
    apply_patch tool
    Brave search
    Browser (OpenClaw-managed)
    Browser control API
    Browser troubleshooting
    Browser login
    WSL2 + Windows + remote Chrome CDP troubleshooting
    BTW side questions
    ClawHub
    Code execution
    Creating skills
    Diffs
    DuckDuckGo search
    Elevated mode
    Exa search
    Exec tool
    Exec approvals
    Exec approvals — advanced
    Firecrawl
    Gemini search
    Grok search
    Image generation
    Tools and plugins
    Kimi search
    LLM task
    Lobster
    Tool-loop detection
    Media overview
    MiniMax search
    Multi-agent sandbox and tools
    Music generation
    Ollama web search
    PDF tool
    Perplexity search
    Plugins
    Reactions
    SearXNG search
    Skills
    Skills config
    Slash commands
    Sub-agents
    Tavily
    Thinking levels
    Tokenjuice
    Trajectory bundles
    Text-to-speech
    Video generation
    Web search
    Web fetch
    Linux server
    Control UI
    Dashboard
    Web
    TUI
    WebChat

    OpenAPI Specs

    openapi
    TaskFlow
    docs/openclaw
    Original Docs

    Real-time Synchronized Documentation

    Last sync: 01/05/2026 07:02:50

    Note: This content is mirrored from docs.openclaw.ai and is subject to their terms and conditions.

    OpenClaw Docs

    v2.4.0 Production

    Last synced: Today, 22:00

    Technical reference for the OpenClaw framework. Real-time synchronization with the official documentation engine.

    Use this file to discover all available pages before exploring further.

    TypeBox

    TypeBox as protocol source of truth

    Last updated: 2026-01-10

    TypeBox is a TypeScript-first schema library. We use it to define the Gateway WebSocket protocol (handshake, request/response, server events). Those schemas drive runtime validation, JSON Schema export, and Swift codegen for the macOS app. One source of truth; everything else is generated.

    If you want the higher-level protocol context, start with Gateway architecture.

    Mental model (30 seconds)

    Every Gateway WS message is one of three frames:

    • Request:
      text
      { type: "req", id, method, params }
    • Response:
      text
      { type: "res", id, ok, payload | error }
    • Event:
      text
      { type: "event", event, payload, seq?, stateVersion? }

    The first frame must be a

    text
    connect
    request. After that, clients can call methods (e.g.
    text
    health
    ,
    text
    send
    ,
    text
    chat.send
    ) and subscribe to events (e.g.
    text
    presence
    ,
    text
    tick
    ,
    text
    agent
    ).

    Connection flow (minimal):

    text
    Client Gateway |---- req:connect -------->| |<---- res:hello-ok --------| |<---- event:tick ----------| |---- req:health ---------->| |<---- res:health ----------|

    Common methods + events:

    CategoryExamplesNotes
    Core
    text
    connect
    ,
    text
    health
    ,
    text
    status
    text
    connect
    must be first
    Messaging
    text
    send
    ,
    text
    agent
    ,
    text
    agent.wait
    ,
    text
    system-event
    ,
    text
    logs.tail
    side-effects need
    text
    idempotencyKey
    Chat
    text
    chat.history
    ,
    text
    chat.send
    ,
    text
    chat.abort
    WebChat uses these
    Sessions
    text
    sessions.list
    ,
    text
    sessions.patch
    ,
    text
    sessions.delete
    session admin
    Automation
    text
    wake
    ,
    text
    cron.list
    ,
    text
    cron.run
    ,
    text
    cron.runs
    wake + cron control
    Nodes
    text
    node.list
    ,
    text
    node.invoke
    ,
    text
    node.pair.*
    Gateway WS + node actions
    Events
    text
    tick
    ,
    text
    presence
    ,
    text
    agent
    ,
    text
    chat
    ,
    text
    health
    ,
    text
    shutdown
    server push

    Authoritative advertised discovery inventory lives in

    text
    src/gateway/server-methods-list.ts
    (
    text
    listGatewayMethods
    ,
    text
    GATEWAY_EVENTS
    ).

    Where the schemas live

    • Source:
      text
      src/gateway/protocol/schema.ts
    • Runtime validators (AJV):
      text
      src/gateway/protocol/index.ts
    • Advertised feature/discovery registry:
      text
      src/gateway/server-methods-list.ts
    • Server handshake + method dispatch:
      text
      src/gateway/server.impl.ts
    • Node client:
      text
      src/gateway/client.ts
    • Generated JSON Schema:
      text
      dist/protocol.schema.json
    • Generated Swift models:
      text
      apps/macos/Sources/OpenClawProtocol/GatewayModels.swift

    Current pipeline

    • text
      pnpm protocol:gen
      • writes JSON Schema (draft‑07) to
        text
        dist/protocol.schema.json
    • text
      pnpm protocol:gen:swift
      • generates Swift gateway models
    • text
      pnpm protocol:check
      • runs both generators and verifies the output is committed

    How the schemas are used at runtime

    • Server side: every inbound frame is validated with AJV. The handshake only accepts a
      text
      connect
      request whose params match
      text
      ConnectParams
      .
    • Client side: the JS client validates event and response frames before using them.
    • Feature discovery: the Gateway sends a conservative
      text
      features.methods
      and
      text
      features.events
      list in
      text
      hello-ok
      from
      text
      listGatewayMethods()
      and
      text
      GATEWAY_EVENTS
      .
    • That discovery list is not a generated dump of every callable helper in
      text
      coreGatewayHandlers
      ; some helper RPCs are implemented in
      text
      src/gateway/server-methods/*.ts
      without being enumerated in the advertised feature list.

    Example frames

    Connect (first message):

    json
    { "type": "req", "id": "c1", "method": "connect", "params": { "minProtocol": 3, "maxProtocol": 3, "client": { "id": "openclaw-macos", "displayName": "macos", "version": "1.0.0", "platform": "macos 15.1", "mode": "ui", "instanceId": "A1B2" } } }

    Hello-ok response:

    json
    { "type": "res", "id": "c1", "ok": true, "payload": { "type": "hello-ok", "protocol": 3, "server": { "version": "dev", "connId": "ws-1" }, "features": { "methods": ["health"], "events": ["tick"] }, "snapshot": { "presence": [], "health": {}, "stateVersion": { "presence": 0, "health": 0 }, "uptimeMs": 0 }, "policy": { "maxPayload": 1048576, "maxBufferedBytes": 1048576, "tickIntervalMs": 30000 } } }

    Request + response:

    json
    { "type": "req", "id": "r1", "method": "health" }
    json
    { "type": "res", "id": "r1", "ok": true, "payload": { "ok": true } }

    Event:

    json
    { "type": "event", "event": "tick", "payload": { "ts": 1730000000 }, "seq": 12 }

    Minimal client (Node.js)

    Smallest useful flow: connect + health.

    ts
    import { WebSocket } from "ws"; const ws = new WebSocket("ws://127.0.0.1:18789"); ws.on("open", () => { ws.send( JSON.stringify({ type: "req", id: "c1", method: "connect", params: { minProtocol: 3, maxProtocol: 3, client: { id: "cli", displayName: "example", version: "dev", platform: "node", mode: "cli", }, }, }), ); }); ws.on("message", (data) => { const msg = JSON.parse(String(data)); if (msg.type === "res" && msg.id === "c1" && msg.ok) { ws.send(JSON.stringify({ type: "req", id: "h1", method: "health" })); } if (msg.type === "res" && msg.id === "h1") { console.log("health:", msg.payload); ws.close(); } });

    Worked example: add a method end-to-end

    Example: add a new

    text
    system.echo
    request that returns
    text
    { ok: true, text }
    .

    1. Schema (source of truth)

    Add to

    text
    src/gateway/protocol/schema.ts
    :

    ts
    export const SystemEchoParamsSchema = Type.Object( { text: NonEmptyString }, { additionalProperties: false }, ); export const SystemEchoResultSchema = Type.Object( { ok: Type.Boolean(), text: NonEmptyString }, { additionalProperties: false }, );

    Add both to

    text
    ProtocolSchemas
    and export types:

    ts
    SystemEchoParams: SystemEchoParamsSchema, SystemEchoResult: SystemEchoResultSchema,
    ts
    export type SystemEchoParams = Static<typeof SystemEchoParamsSchema>; export type SystemEchoResult = Static<typeof SystemEchoResultSchema>;
    1. Validation

    In

    text
    src/gateway/protocol/index.ts
    , export an AJV validator:

    ts
    export const validateSystemEchoParams = ajv.compile<SystemEchoParams>(SystemEchoParamsSchema);
    1. Server behavior

    Add a handler in

    text
    src/gateway/server-methods/system.ts
    :

    ts
    export const systemHandlers: GatewayRequestHandlers = { "system.echo": ({ params, respond }) => { const text = String(params.text ?? ""); respond(true, { ok: true, text }); }, };

    Register it in

    text
    src/gateway/server-methods.ts
    (already merges
    text
    systemHandlers
    ), then add
    text
    "system.echo"
    to
    text
    listGatewayMethods
    input in
    text
    src/gateway/server-methods-list.ts
    .

    If the method is callable by operator or node clients, also classify it in

    text
    src/gateway/method-scopes.ts
    so scope enforcement and
    text
    hello-ok
    feature advertising stay aligned.

    1. Regenerate
    bash
    pnpm protocol:check
    1. Tests + docs

    Add a server test in

    text
    src/gateway/server.*.test.ts
    and note the method in docs.

    Swift codegen behavior

    The Swift generator emits:

    • text
      GatewayFrame
      enum with
      text
      req
      ,
      text
      res
      ,
      text
      event
      , and
      text
      unknown
      cases
    • Strongly typed payload structs/enums
    • text
      ErrorCode
      values and
      text
      GATEWAY_PROTOCOL_VERSION

    Unknown frame types are preserved as raw payloads for forward compatibility.

    Versioning + compatibility

    • text
      PROTOCOL_VERSION
      lives in
      text
      src/gateway/protocol/schema.ts
      .
    • Clients send
      text
      minProtocol
      +
      text
      maxProtocol
      ; the server rejects mismatches.
    • The Swift models keep unknown frame types to avoid breaking older clients.

    Schema patterns and conventions

    • Most objects use
      text
      additionalProperties: false
      for strict payloads.
    • text
      NonEmptyString
      is the default for IDs and method/event names.
    • The top-level
      text
      GatewayFrame
      uses a discriminator on
      text
      type
      .
    • Methods with side effects usually require an
      text
      idempotencyKey
      in params (example:
      text
      send
      ,
      text
      poll
      ,
      text
      agent
      ,
      text
      chat.send
      ).
    • text
      agent
      accepts optional
      text
      internalEvents
      for runtime-generated orchestration context (for example subagent/cron task completion handoff); treat this as internal API surface.

    Live schema JSON

    Generated JSON Schema is in the repo at

    text
    dist/protocol.schema.json
    . The published raw file is typically available at:

    • https://raw.githubusercontent.com/openclaw/openclaw/main/dist/protocol.schema.json

    When you change schemas

    1. Update the TypeBox schemas.
    2. Register the method/event in
      text
      src/gateway/server-methods-list.ts
      .
    3. Update
      text
      src/gateway/method-scopes.ts
      when the new RPC needs operator or node scope classification.
    4. Run
      text
      pnpm protocol:check
      .
    5. Commit the regenerated schema + Swift models.

    Related

    • Rich output protocol
    • RPC adapters

    © 2024 TaskFlow Mirror

    Powered by TaskFlow Sync Engine