Xpersona
O

OpenClaw Config

CLAWHUB · Unverified

Edit and validate OpenClaw Gateway config (openclaw.json / JSON5). Covers all config areas — gateway, agents, channels, models, auth, tools, commands, sessio... Skill: OpenClaw Config Owner: aqbjqtd Summary: Edit and validate OpenClaw Gateway config (openclaw.json / JSON5). Covers all config areas — gateway, agents, channels, models, auth, tools, commands, sessio... Tags: latest:1.3.3 Version history: v1.3.3 | 2026-04-04T10:14:41.219Z | user 补充受保护路径说明 v1.3.2 | 2026-04-03T11:57:08.844Z | user 合并本地增强:Telegram/飞书详细配置模板(安全模式+开放模式)、AppSecret 安全存储、channels-config.md 新增 v1.3.1 | 20

62
Rank
84
Safety
1.0k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s176hcamdc143tsm5n5zzqq6f583h359:openclaw-config-master
  1. Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-aqbjqtd-openclaw-config-master/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

146,666 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: openclaw-config-master
description: Edit and validate OpenClaw Gateway config (openclaw.json / JSON5). Covers all config areas — gateway, agents, channels, models, auth, tools, commands, session, hooks, secrets, acp, messages, plugins, skills, $include. Use when adding/changing config keys or diagnosing openclaw doctor/config validation errors, to avoid schema mismatches that prevent the Gateway from starting or weaken security policies.
---

# OpenClaw Config

## 一句话

用 schema-first 工作流安全编辑 OpenClaw 配置文件,验证先行,避免无效 key 导致 Gateway 无法启动或安全策略被破坏。

---

## 核心要点(5条)

1. **Schema 先行** — 不猜 key,用 `gateway config.schema.lookup path="目标路径"` 获取权威 schema
2. **在线修改** — 优先用 `gateway config.patch` 在线修改(自动验证+重启),备选 `openclaw config set` CLI
3. **验证不可跳** — `config.patch` 自动验证;手动编辑后必须跑 `openclaw doctor`
4. **严格模式** — 大多数对象是 `.strict()`,未知 key 会导致 Gateway 拒绝启动
5. **不轻易用 --fix** — `openclaw doctor --fix/--yes` 会写文件,需用户明确同意
6. **受保护路径** — 部分敏感路径(如 `tools.exec.ask`)`config.patch` 无法修改,会返回 `cannot change protected config paths` 错误。遇此情况需直接编辑 `openclaw.json` 后 `openclaw gateway restart`

---

## 配置覆盖范围(全部顶层 key)

| 顶层 key | 子模块 | 说明 |
|---------|--------|------|
| `gateway` | port, mode, bind, auth, tailscale, nodes, controlUi | 网关核心:端口、模式、认证、Tailscale、节点策略 |
| `agents` | defaults, list | Agent 配置:默认模型/工具/工作区 + agent 列表 |
| `channels` | telegram, feishu, discord, slack, whatsapp, signal, imessage, ... | 渠道配置:每个渠道的连接、策略、审批 |
| `models` | providers, mode, bedrockDiscovery | 模型目录:提供者定义、合并模式、Bedrock 发现 |
| `auth` | profiles | 认证配置:API Key / OAuth 认证档案 |
| `tools` | exec, web, fs, media, links, sessions, loopDetection, message, agentToAgent, elevated, subagents, sandbox, sessions_spawn, profile, allow, alsoAllow, deny, byProvider | 工具策略:执行、网络、文件系统、媒体、沙箱、子代理 |
| `commands` | bash, config, mcp, plugins, debug, restart, text, native, nativeSkills, allowFrom, ownerDisplay, ... | 命令控制:聊天命令开关、权限、提权规则 |
| `session` | scope, dmScope, reset, resetByType, resetByChannel, store, typingMode, identityLinks, threadBindings, maintenance, sendPolicy, agentToAgent, ... | 会话管理:路由、重置策略、存储、线程绑定、维护 |
| `hooks` | internal, external | 钩子:内部钩子(session-memory)+ 外部钩子 |
| `secrets` | providers | 密钥管理:文件/环境变量等密钥提供者 |
| `acp` | enabled, backend, defaultAgent, allowedAgents | ACP 后端:Agent 托管运行时配置 |
| `messages` | ackReactionScope | 消息行为:确认反应范围等 |
| `plugins` | enabled, allow, deny, load, slots, entries, installs | 插件系统:启用/禁用、加载路径、安装记录 |
| `skills` | (skills 配置) | 技能配置 |
| `meta` | lastTouchedVersion, lastTouchAt | 系统元数据(自动管理) |
| `wizard` | lastRunAt, lastRunVersion, lastRunCommand, lastRunMode | 向导元数据(自动管理) |
| `$include` | — | 模块化配置:分割到多个 JSON5 文件 |

---

## 工作流程

> **重要**:在提供任何配置指导之前,必须按以下步骤执行前置检查。

### 第一步:查官方文档(必做)

**每次修改配置前,必须先查阅官方最新文档确认字段和用法。** 技能内的文档可能滞后于官方更新。

#### 在线文档(权威来源)

| 文档 | 链接 | 用途 |
|------|------|------|
| **配置指南** | https://docs.openclaw.ai/gateway/configuration | 所有配置项的完整说明 |
| **配置参考** | https://docs.openclaw.ai/gateway/configuration-reference | 字段类型、默认值、示例 |
| **Config

_meta.json

{
  "ownerId": "kn72kjjmbvf833pefavr1cs05n832zf1",
  "slug": "openclaw-config-master",
  "version": "1.3.3",
  "publishedAt": 1775297681219
}

references/channels-config.md

# Channels Configuration — OpenClaw 2026.4.1

> **完整配置文档** — 本文件涵盖所有 channel provider 的配置字段。
> Feishu 的完整文档另见 [飞书插件技能](../openclaw-lark/skills/)。

---

## 通用 Channel 字段

### DM / Group 访问策略

所有 channel 都支持 DM 策略和 Group 策略:

| DM policy | 行为 |
|-----------|------|
| `pairing`(默认)| 未知发送者获得一次性配对码;所有者需审批 |
| `allowlist` | 仅 `allowFrom` 中的发送者(或已配对)可交互 |
| `open` | 允许所有入站 DM(需 `allowFrom: ["*"]`)|
| `disabled` | 忽略所有入站 DM |

| Group policy | 行为 |
|-------------|------|
| `allowlist`(默认)| 仅匹配允许列表的群组 |
| `open` | 绕过群组白名单(仍需 mention) |
| `disabled` | 屏蔽所有群组消息 |

### 通用 Channel 字段

| 字段 | 类型 | 描述 |
|------|------|------|
| `enabled` | boolean | 是否启用该 channel |
| `dmPolicy` | enum | DM 策略:`pairing` \| `allowlist` \| `open` \| `disabled` |
| `allowFrom` | array | DM 白名单(open_id / userId / `"*"`)|
| `groupPolicy` | enum | Group 策略:`allowlist` \| `open` \| `disabled` |
| `groupAllowFrom` | array | Group 白名单 |
| `groups` | object | Per-group 配置:`{ "*": { requireMention: true } }` |
| `mediaMaxMb` | number | 媒体文件最大 MB |
| `historyLimit` | integer | 历史消息加载条数 |
| `reactionNotifications` | enum | 消息反应通知:`off` \| `own` \| `all` \| `allowlist` |
| `requireMention` | boolean | 群组中是否必须 @mention 才响应 |
| `typingIndicator` | enum | 打字指示器:`off` \| `message` \| `indicator` |
| `resolveSenderNames` | boolean | 解析发送者姓名 |
| `webhookPath` | string | Webhook 路径 |
| `connectionMode` | enum | 连接模式:`websocket`(飞书专属)|

---

## Telegram

```json5
"channels": {
  "telegram": {
    "enabled": true,
    "botToken": "YOUR_BOT_TOKEN",
    "dmPolicy": "allowlist",
    "allowFrom": ["577958597"],
    "groups": {
      "*": {
        "requireMention": true
      }
    },
    "groupPolicy": "allowlist",
    "replyToMode": "first",
    "linkPreview": true,
    "streaming": "partial",
    "actions": {
      "reactions": true,
      "sendMessage": true
    },
    "reactionNotifications": "own",
    "mediaMaxMb": 100,
    "retry": {
      "attempts": 3,
      "minDelayMs": 400,
      "maxDelayMs": 30000,
      "jitter": 0.1
    },
    "network": {
      "autoSelectFamily": true,
      "dnsResultOrder": "ipv4first"
    },
    "proxy": "socks5://localhost:9050",
    "webhookUrl": "https://example.com/telegram-webhook",
    "webhookSecret": "secret",
    "webhookPath": "/telegram-webhook",
    "customCommands": [
      { "command": "backup", "description": "Git backup" },
      { "command": "generate", "description": "Create an image" }
    ],
    "historyLimit": 50,
    "configWrites": false,
    "modelByChannel": {
      "-1001234567890": "minimax/MiniMax-M2.7-highspeed"
    }
  }
}
```

### 完整字段索引

| 字段 | 类型 | 默认值 | 描述 |
|------|------|--------|------|
| `enabled` | boolean | true | 启用 Telegram |
| `botToken` | string | **必填** | Bot Token |
| `dmPolicy` | enum | `pairing` | DM 策略 |
| `allowFrom` | array | `[]` | DM 白名单 |
| `groups` | object | `{}` | Per-group 配置 |
| `groups.*.requireMention` | boolean | true | 群组是否需要 @mention |
| `groups.*.allowFrom` | array | `[]` | 群组白名单 |
| `groups.*.systemPro

references/common-errors.md

# 常见配置错误模式字典

本文档详细列出了 OpenClaw 配置系统中最常见的错误模式,帮助快速诊断和解决配置问题。

---

## 📋 目录

1. [Unknown key(未知键名)](#1-unknown-key未知键名)
2. [Type mismatch(类型不匹配)](#2-type-mismatch类型不匹配)
3. [Missing required field(缺少必需字段)](#3-missing-required-field缺少必需字段)
4. [Cross-field constraint failure(跨字段约束失败)](#4-cross-field-constraint-failure跨字段约束失败)
5. [Circular $include(循环引用)](#5-circular-include循环引用)
6. [Array concatenation surprise(数组拼接意外)](#6-array-concatenation-surprise数组拼接意外)
7. [Version mismatch(版本不一致)](#7-version-mismatch版本不一致)

---

## 1. Unknown key(未知键名)

### 🔍 错误类型识别

配置文件中使用了不被系统识别的键名。

### 📤 openclaw doctor 输出示例

```bash
$ openclaw doctor

🔍 Configuration Error
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
File: /path/to/config/base.yaml
Error: Unknown key 'environmet' in section 'server'

Valid keys for 'server':
  • environment
  • host
  • port
  • workers

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 Did you mean: 'environment'?
```

### 🎯 根本原因分析

**常见原因:**
1. **拼写错误** - 键名拼写不正确(如 `environmet` → `environment`)
2. **版本不匹配** - 使用了已废弃的键名或使用了新版本的键名
3. **配置迁移** - 从旧版本迁移时键名发生变化
4. **自定义扩展** - 使用了未注册的自定义键名

### ✅ 解决步骤

1. **验证拼写**
   ```bash
   # 使用 doctor 命令检查拼写建议
   openclaw doctor --check-spelling

   # 查看所有可用键
   openclaw schema list-keys
   ```

2. **检查版本兼容性**
   ```bash
   # 查看当前版本
   openclaw version

   # 检查配置文件版本要求
   openclaw schema version-check
   ```

3. **修正键名**
   ```yaml
   # 错误示例
   server:
     environmet: production
     host: 0.0.0.0

   # 正确示例
   server:
     environment: production
     host: 0.0.0.0
   ```

4. **验证修复**
   ```bash
   openclaw validate
   ```

### 🛡️ 预防措施

**开发阶段:**
```yaml
# 1. 使用 IDE 自动补全
# 安装 OpenClaw YAML Schema
# vscode: ext install openclaw.schema-support

# 2. 启用严格模式
openclaw init --strict-mode

# 3. 添加预提交钩子
#!/bin/bash
# .git/hooks/pre-commit
openclaw validate || exit 1
```

**CI/CD 集成:**
```yaml
# .github/workflows/config-check.yml
name: Config Validation
on: [push, pull_request]
jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Validate Config
        run: |
          openclaw doctor
          openclaw validate --strict
```

---

## 2. Type mismatch(类型不匹配)

### 🔍 错误类型识别

配置值的类型与预期不符(如字符串代替数字、列表代替对象等)。

### 📤 openclaw doctor 输出示例

```bash
$ openclaw doctor

🔍 Configuration Error
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
File: /path/to/config/database.yaml
Path: database.postgresql.port
Error: Type mismatch

Expected: integer (port number)
Received: string "5432"

Schema definition:
  port:
    type: integer
    range: [1, 65535]

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 Quick fix: Remove quotes around the number
```

### 🎯 根本原因分析

**常见原因:**
1. **YAML 引号滥用** - 将数字或布尔值用引号包裹
2. **类型混淆** - 列表、对象、字符串混用
3. **环境变量注入** - 环境变量始终是字符串类型
4. **动态类型转换失败** - 表达式计算结果类型错误

### ✅ 解决步骤

1. **识别类型要求**
   ```bash
   # 查看字段类型定义
   openclaw schema inspect database.postgresql.port

   # 输出示例
   Type: integer
   Range: 1-65535
   Required: true
  

references/complex-operations.md

# OpenClaw 复杂配置操作指南

本指南提供 OpenClaw 配置文件 `~/.openclaw/openclaw.json` 的复杂操作步骤,包括前置条件、详细步骤、验证方法和常见错误处理。

## 📋 目录

1. [添加新的模型提供者](#1-添加新的模型提供者)
2. [配置新的频道](#2-配置新的频道)
3. [修改 Agent 工具配置](#3-修改-agent-工具配置)
4. [调整诊断和日志设置](#4-调整诊断和日志设置)
5. [配置 ACP 运行时](#5-配置-acp-运行时)
6. [配置 MCP 服务器](#6-配置-mcp-服务器)
7. [配置审批策略](#7-配置审批策略)

---

## 1. 添加新的模型提供者

### 一句话

在 `models.providers` 中注册新提供者,在 `agents.defaults.model` 中启用。

### 核心要点

- API Key 优先使用环境变量引用(`env:VAR_NAME`)
- `api` 字段必须与提供者兼容(`openai-completions` / `anthropic-messages` 等)
- 模型 `id` 必须与提供者 API 中的实际模型 ID 完全一致
- 建议设置 `fallbacks` 链确保高可用

### 详细内容

#### 前置条件检查

- [ ] 已获取模型提供者的 API Key 或 OAuth 凭证
- [ ] 已确认提供者的 API 端点 URL
- [ ] 已确认 API 兼容类型(OpenAI Completions / Anthropic Messages 等)
- [ ] 已了解模型的参数限制(上下文窗口、最大 Token 数等)
- [ ] OpenClaw Gateway 已停止运行

#### 操作步骤

**步骤 1: 添加认证配置**

在 `auth.profiles` 部分添加新的认证配置:

```json
{
  "auth": {
    "profiles": {
      "yourprovider:default": {
        "provider": "yourprovider",
        "mode": "api_key"
      }
    }
  }
}
```

**可选认证模式**:
- `api_key`: 使用 API 密钥认证
- `oauth`: 使用 OAuth 认证

**步骤 2: 配置环境变量(如需要)**

如果使用 API Key,在 `env.vars` 部分添加:

```json
{
  "env": {
    "vars": {
      "YOURPROVIDER_API_KEY": "your-api-key-here"
    }
  }
}
```

**步骤 3: 添加模型提供者配置**

在 `models.providers` 部分添加新提供者:

```json
{
  "models": {
    "mode": "merge",
    "providers": {
      "yourprovider": {
        "baseUrl": "https://api.yourprovider.com/v1",
        "apiKey": "env:YOURPROVIDER_API_KEY",
        "api": "openai-completions",
        "models": [
          {
            "id": "model-name",
            "name": "Display Name",
            "reasoning": true,
            "input": ["text"],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 128000,
            "maxTokens": 4096
          }
        ]
      }
    }
  }
}
```

**关键字段说明**:
- `baseUrl`: API 端点 URL
- `apiKey`: 认证密钥,支持 `env:VAR_NAME` 引用环境变量,也支持 `{ source: "env"|"file"|"exec", provider, id }` 高级格式
- `api`: API 类型(`openai-completions` / `anthropic-messages` 等)
- `models`: 模型列表数组

**步骤 4: 在 Agent 默认配置中注册模型**

在 `agents.defaults.models` 部分添加新模型:

```json
{
  "agents": {
    "defaults": {
      "model": {
        "primary": "yourprovider/model-name",
        "fallbacks": ["zai/glm-5"]
      },
      "models": {
        "yourprovider/model-name": {}
      }
    }
  }
}
```

**步骤 5: 启动 Gateway 并验证**

```bash
# 启动 Gateway
openclaw gateway

# 在另一个终端验证配置
openclaw doctor

# 测试模型调用
openclaw gateway call chat --params '{"message":"测试"}'
```

#### 验证方法

1. **配置验证**:
   ```bash
   openclaw doctor
   ```
   检查输出中是否包含新提供者信息

2. **模型可用性**:
   ```bash
   openclaw gateway call models.list --params '{}'
   ```
   确认新模型出现在列表中

3. **实际调用测试**:
   发送测试消息,验证模型响应

#### 常见错误

| 错误信息 | 原因 | 解决方法 |
|---------|------|---------|
| `Unknown provider` | 提供者 ID 拼写错误 | 检查 `auth.profiles` 和 `models.providers` 中的 ID 一致性 |
| `Invalid API key` |

Sponsored

Ads related to OpenClaw Config and adjacent AI workflows.