乐于分享
好东西不私藏

openclaw配置大全/注释

openclaw配置大全/注释
花了几天,终于把openclaw的全数配置弄清楚,这里共享给大家。

配置侧重点

  1. 多智能体并存
  2. 多智能体相互调用
  3. 飞书接收信息/编写飞书文档
  4. 上下文窗口自动清除
  5. 接收邮件/返回总结
  6. 高级命令可通过飞书审批
  7. 任务失败等,飞书通知
使用方法
  1. 使用的是环境变量,请大家自行替换为环境变量或直接修改为key
  2. 沙盒和删除系统等拦截,没有设定,需要的自行添加
  3. 根据个人需求,可以根据注释进行修改
  4. json不能存在注释,使用前自行去除
{  "meta": {    // 配置最后编辑版本标记    "lastTouchedVersion": "2026.3.28",    // 配置最后修改UTC时间戳    "lastTouchedAt": "2026-03-29T10:45:46.641Z"  },  "env": {    "shellEnv": {      // 启用Shell系统环境变量读取能力      "enabled": true    }  },  "logging": {    // 全局日志基础级别    "level": "info",    // 日志文件本地持久化存储路径    "file": "~/.openclaw/log/openclaw.log",    // 控制台输出日志级别    "consoleLevel": "info",    // 控制台日志美化输出格式    "consoleStyle": "pretty",    "redactSensitive": "tools"  },  "auth": {    "profiles": {      // LongCat 主认证链路配置别名      "longcat-main": {        // 绑定模型厂商标识        "provider": "longcat",        // 鉴权模式:API密钥模式        "mode": "api_key",        // 前端展示别名        "displayName": "LongCat"      }    },    "order": {      // LongCat 故障转移优先级队列:主实例+备用实例兜底      "longcat-failover": [        "[\"longcat-main\", \"longcat-backup\"]"      ]    }  },  "models": {    // 模型聚合模式:合并多提供商统一调度    "mode": "merge",    "providers": {      // OpenRouter 全局中转服务商配置      "openrouter": {        "baseUrl": "https://openrouter.ai/api/v1",        // 环境变量注入API密钥        "apiKey": "${OPENROUTER_API_KEY}",        // 协议兼容:标准OpenAI补全接口        "api": "openai-completions",        "headers": {          // 本地代理标记请求头          "X-Proxy": "local"        },        // 自动携带鉴权Header        "authHeader": true,        // 小米MiMo系列模型池定义        "models": [          {            "id": "xiaomi/mimo-v2-pro",            "name": "MiMo V2 Pro (小米思考模型)",            "api": "openai-completions",            // 开启深度推理链路            "reasoning": true,            // 仅支持文本输入模态            "input": ["text"],            "cost": {"input": 0, "output": 0},            "contextWindow": 32768,            "maxTokens": 4096          },          {            "id": "xiaomi/mimo-v2-omni",            "name": "MiMo V2 Omni (小米全模态)",            "api": "openai-completions",            "reasoning": false,            // 文本+图片多模态输入            "input": ["text", "image"],            "cost": {"input": 0, "output": 0},            "contextWindow": 32768,            "maxTokens": 4096          },          {            "id": "xiaomi/mimo-v2-tts",            "name": "MiMo V2 TTS (小米语音合成)",            "api": "openai-completions",            "reasoning": false,            "input": ["text"],            "cost": {"input": 0, "output": 0},            "contextWindow": 8192,            "maxTokens": 2096          }        ]      },      // LongCat 私有推理接口集群      "longcat": {        "baseUrl": "https://api.longcat.chat/openai",        "apiKey": "${LONGCAT_API_KEY}",        "api": "openai-completions",        "headers": {"X-Proxy": "local"},        "authHeader": true,        "models": [          {"id": "LongCat-Flash-Chat","name": "LongCat Flash Chat (通用对话)","api": "openai-completions","reasoning": false,"input": ["text"],"cost": {"input": 0,"output": 0,"cacheRead": 0,"cacheWrite": 0},"contextWindow": 262144,"maxTokens": 8192},          {"id": "LongCat-Flash-Thinking-2601","name": "LongCat Flash Thinking (深度推理)","api": "openai-completions","reasoning": true,"input": ["text"],"cost": {"input": 0,"output": 0,"cacheRead": 0,"cacheWrite": 0},"contextWindow": 32000,"maxTokens": 4096},          {"id": "LongCat-Flash-Lite","name": "LongCat Flash Lite (轻量高效)","api": "openai-completions","reasoning": false,"input": ["text"],"cost": {"input": 0,"output": 0,"cacheRead": 0,"cacheWrite": 0},"contextWindow": 32000,"maxTokens": 4096},          {"id": "LongCat-Flash-Omni-2603","name": "LongCat Flash Omni (全模态)","api": "openai-completions","reasoning": false,"input": ["text", "image"],"cost": {"input": 0,"output": 0,"cacheRead": 0,"cacheWrite": 0},"contextWindow": 32000,"maxTokens": 4096}        ]      },      // 阿里百炼Dashscope兼容接口      "dashscope": {        "baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",        "apiKey": "${DASHSCOPE_API_KEY}",        "api": "openai-completions",        "headers": {"X-Proxy": "local"},        "authHeader": true,        "models": [          {            "id": "Kimi-K2.5",            "name": "Kimi K2.5 (深度思考模型)",            "api": "openai-completions",            "reasoning": true,            "input": ["text", "image"],            "cost": {"input": 0,"output": 0,"cacheRead": 0,"cacheWrite": 0},            "contextWindow": 128000,            "maxTokens": 8192          }        ]      },      // 智谱GLM编码推理服务商      "zai": {        "baseUrl": "https://open.bigmodel.cn/api/coding/paas/v4",        "apiKey": "${ZAI_API_KEY}",        "api": "openai-completions",        "headers": {"X-Proxy": "local"},        "authHeader": true,        "models": [          {"id": "glm-5","name": "GLM-5","reasoning": true,"input": ["text"],"cost": {"input": 1,"output": 3.2,"cacheRead": 0.2,"cacheWrite": 0},"contextWindow": 202800,"maxTokens": 131100},          {"id": "glm-4.7-flash","name": "GLM-4.7 Flash","reasoning": true,"input": ["text"],"cost": {"input": 0.07,"output": 0.4,"cacheRead": 0,"cacheWrite": 0},"contextWindow": 200000,"maxTokens": 131072}        ]      }    }  },  "agents": {    // Agent全局默认基础参数模板    "defaults": {      "model": {        // 主推理默认模型:LongCat深度思考版        "primary": "longcat/LongCat-Flash-Thinking-2601",        // 多级故障回落备用模型队列        "fallbacks": ["openrouter/xiaomi/mimo-v2-pro","longcat/LongCat-Flash-Chat"]      },      "imageModel": {        // 图像理解固定全模态模型        "primary": "longcat/LongCat-Flash-Omni-2603"      },      // 全局注册可用模型清单汇总      "models": {        "longcat/LongCat-Flash-Chat": {},        "longcat/LongCat-Flash-Thinking-2601": {},        "longcat/LongCat-Flash-Lite": {},        "longcat/LongCat-Flash-Omni-2603": {},        "openrouter/xiaomi/mimo-v2-pro": {},        "openrouter/xiaomi/mimo-v2-omni": {},        "dashscope/Kimi-K2.5": {},        "zai/glm-5": {},        "zai/glm-4.7-flash": {}      },      // Agent工作目录根路径      "workspace": "~/.openclaw/workspace",      // 启动上下文最大加载字符限制      "bootstrapMaxChars": 200000,      // 超长提示截断告警策略:始终提醒      "bootstrapPromptTruncationWarning": "always",      // 系统时区:东八区北京时间      "userTimezone": "Asia/Shanghai",      "timeFormat": "auto",      // 会话耗时展示开启      "envelopeElapsed": "on",      // 基础上下文Token配额      "contextTokens": 12288,      "memorySearch": {        // 记忆检索额外文档目录挂载        "extraPaths": ["../team-docs","/srv/shared-notes"],        // 向量嵌入服务商:Gemini        "provider": "gemini",        "remote": {"apiKey": "${GEMINI_API_KEY}"},        "model": "gemini-embedding-001"      },      "contextPruning": {        // 上下文裁剪关闭,完整保留会话        "mode": "off",        "ttl": "86400",        "keepLastAssistants": 1,        "softTrimRatio": 0.7,        "hardClearRatio": 0.8,        "minPrunableToolChars": 100,        "hardClear": {"enabled": true,"placeholder": "[历史消息已清理]"}      },      // 默认思考深度:中等      "thinkingDefault": "medium",      // 详细日志默认开启      "verboseDefault": "on",      // 高权限操作默认放行      "elevatedDefault": "on",      // 流式输出阻塞默认关闭      "blockStreamingDefault": "off",      "blockStreamingBreak": "text_end",      "blockStreamingChunk": {"minChars": 100,"maxChars": 500,"breakPreference": "paragraph"},      "blockStreamingCoalesce": {"idleMs": 1000},      "humanDelay": {"mode": "off"},      // 全局请求超时秒数      "timeoutSeconds": 6000,      // 媒体文件最大限制MB      "mediaMaxMb": 5,      "typingIntervalSeconds": 2,      "typingMode": "message",      // 最大并发Agent实例数      "maxConcurrent": 5,      "subagents": {        // 子代理嵌套最大深度        "maxSpawnDepth": 1,        // 单父代理最大子节点数量        "maxChildrenPerAgent": 5,        // 闲置会话归档超时分钟        "archiveAfterMinutes": 60,        "model": {"primary": "longcat/LongCat-Flash-Thinking-2601","fallbacks": ["longcat/LongCat-Flash-Lite"]},        "thinking": "medium",        "runTimeoutSeconds": 600,        "announceTimeoutMs": 5000      },      // 沙箱安全隔离配置      "sandbox": {        "mode": "off",        "perSession": true,        "workspaceRoot": "~/.openclaw/sandboxes",        "docker": {"image": "openclaw-sandbox:bookworm-slim","workdir": "/workspace","readOnlyRoot": true,"tmpfs": ["/tmp","/var/tmp","/run"],"network": "none","user": "0:0"},        "browser": {"enabled": true}      }    },    // 自定义业务Agent实例列表    "list": [      {        "id": "main",        "identity": {          // 助手展示昵称          "name": "老余",          // 人设风格定义          "theme": "专业严谨,简洁高效,不废话,直奔主题",          "emoji": "🦞"        },        "groupChat": {          // 群聊唤醒@匹配规则          "mentionPatterns": ["@老余"]        },        "tools": {          // 工具权限基线:编码开发权限集          "profile": "coding",          // 额外放行飞书全系列多维表格/文档/会话权限          "alsoAllow": ["canvas","message","agents_list","feishu_bitable_create_app","feishu_bitable_create_field","feishu_bitable_create_record","feishu_bitable_get_meta","feishu_bitable_get_record","feishu_bitable_list_fields","feishu_bitable_list_records","feishu_bitable_update_record","feishu_chat","feishu_doc","feishu_drive","feishu_wiki"]        }      }    ]  },  "tools": {    // 全局工具基础权限模板    "profile": "coding",    // 系统读写/执行补丁基础能力放行    "allow": ["exec","process","read","write","edit","apply_patch"],    "deny": [],    "web": {"search": {"enabled": true,"provider": "duckduckgo"}},    "media": {      "concurrency": 1,      "audio": {"enabled": true,"maxBytes": 20971520,"timeoutSeconds": 120,"models": [{"provider": "openai","model": "gpt-4o-mini-transcribe"}]},      "video": {"enabled": true,"maxBytes": 52428800,"models": [{"provider": "google","model": "gemini-3-flash-preview"}]}    },    "links": {"enabled": true,"maxLinks": 10,"timeoutSeconds": 10,"models": [{"type": "cli","command": "longcat/LongCat-Flash-Lite","args": [],"timeoutSeconds": 20},{"type": "cli","command": "longcat/LongCat-Flash-Omni-2603","timeoutSeconds": 60}]},    "sessions": {"visibility": "tree"},    // 循环调用死链检测防护    "loopDetection": {"enabled": true,"historySize": 30,"warningThreshold": 10,"criticalThreshold": 20,"globalCircuitBreakerThreshold": 30},    "agentToAgent": {"enabled": true,"allow": []},    // 高权限操作白名单(飞书指定用户ID,敏感已留存结构)    "elevated": {      "enabled": true,      "allowFrom": {        "feishu": ["ou_xxxxxxxxxxxxxxxxxxxxxxxx"]      }    },    "exec": {"ask": "always","backgroundMs": 30000,"timeoutSec": 900,"cleanupMs": 900000,"notifyOnExit": true}  },  "messages": {    // 全局消息统一前缀标识    "messagePrefix": "[openclaw]",    // 回复个性化Emoji前缀    "responsePrefix": "🦞",    "groupChat": {"mentionPatterns": ["@老余"],"historyLimit": 30},    "queue": {"mode": "collect","byChannel": {"whatsapp": "collect","telegram": "collect","discord": "collect","slack": "collect","signal": "collect","imessage": "collect","webchat": "collect"},"debounceMs": 2000,"cap": 10,"drop": "summarize"},    "ackReaction": "✅",    "ackReactionScope": "group-mentions"  },  "commands": {"native": "auto","nativeSkills": true,"bashForegroundMs": 2000,"restart": true,"ownerDisplay": "raw"},  "approvals": {    // 执行操作人工审批流绑定飞书指定人员    "exec": {"enabled": true,"mode": "both","sessionFilter": [],"targets": [{"channel": "@openclaw/feishu","to": "ou_xxxxxxxxxxxxxxxxxxxxxxxx"}]},    // 插件加载审批流同账号权限    "plugin": {"enabled": true,"mode": "both","targets": [{"channel": "@openclaw/feishu","to": "ou_xxxxxxxxxxxxxxxxxxxxxxxx"}]}  },  "session": {    "scope": "per-sender","dmScope": "per-channel-peer","resetTriggers": ["/new","/reset"],"idleMinutes": 30,"reset": {"mode": "idle","atHour": 3,"idleMinutes": 120},"resetByChannel": {"discord": {"mode": "idle","idleMinutes": 10080}},"store": "~/.openclaw/agents/default/sessions/sessions.json","typingIntervalSeconds": 5,"typingMode": "instant","parentForkMaxTokens": 8192,"sendPolicy": {"default": "allow","rules": [{"action": "allow","match": {"channel": "discord","chatType": "group"}}]},"agentToAgent": {"maxPingPongTurns": 5},"maintenance": {"mode": "warn","pruneAfter": "30d","maxEntries": 1000,"rotateBytes": "100mb","maxDiskBytes": "500mb"}}  },  "cron": {    // 定时任务调度总开关    "enabled": true,    "store": "~/.openclaw/cron/cron.json",    "maxConcurrentRuns": 2,    "retry": {"backoffMs": [30000,60000,300000]},    "runLog": {"maxBytes": 2000000,"keepLines": 20000},    // 定时失败告警推送指定飞书用户    "failureAlert": {"enabled": true,"after": 1,"cooldownMs": 300000,"mode": "announce","accountId": "ou_xxxxxxxxxxxxxxxxxxxxxxxx"},    "failureDestination": {"channel": "@openclaw/feishu","to": "ou_xxxxxxxxxxxxxxxxxxxxxxxx","mode": "announce"}  },  "hooks": {    // WebHook回调总开关    "enabled": true,    "path": "/hooks",    // 原固定密钥占位替换    "token": "[HOOK_SECRET_PLACEHOLDER]",    "allowedAgentIds": [],    "presets": ["gmail"],    "transformsDir": "~/.openclaw/hooks/transforms",    "mappings": [{"id": "qqmail-hook","match": {"path": "qqmail"},"action": "agent","wakeMode": "now","name": "QQ邮箱","sessionKey": "hook:qqmail:{{messages[0].id}}","messageTemplate": "📩 新邮件来自:{{messages[0].from}}\n📝 主题:{{messages[0].subject}}","textTemplate": "{{messages[0].snippet}}","deliver": true,"channel": "last","to": "ou_xxxxxxxxxxxxxxxxxxxxxxxx","thinking": "low","timeoutSeconds": 300,"transform": {"module": "./transforms/gmail.js","export": "transformGmail"}}],    "gmail": {      // QQ邮箱账号掩码留存结构      "account": "xxx@qq.com",      "label": "INBOX",      "topic": "projects/<project-id>/topics/gog-gmail-watch",      "subscription": "gog-gmail-watch-push",      // 推送令牌      "pushToken": "[GMAIL_PUSH_TOKEN_PLACEHOLDER]",      "hookUrl": "http://127.0.0.1:18789/hooks/gmail",      "includeBody": true,"maxBytes": 20000,"renewEveryMinutes": 720,"serve": {"bind": "127.0.0.1","port": 8788,"path": "/"},"tailscale": {"mode": "funnel","path": "/gmail-pubsub"}    },    "internal": {"enabled": true,"entries": {"boot-md": {"enabled": true},"command-logger": {"enabled": true},"session-memory": {"enabled": true}}}  },  "channels": {    // 飞书多维表格/会话深度集成通道配置    "feishu": {      "appId": "${FEISHU_APP_ID}",      "appSecret": "${FEISHU_APP_SECRET}",      "dmPolicy": "pairing",      "allowFrom": ["ou_xxxxxxxxxxxxxxxxxxxxxxxx"],      "groupPolicy": "allowlist",      "groupAllowFrom": ["ou_xxxxxxxxxxxxxxxxxxxxxxxx"],      "groups": {"*": {"requireMention": true}},"domain": "feishu","connectionMode": "websocket","webhookPath": "/feishu/events","reactionNotifications": "own","typingIndicator": true,"resolveSenderNames": true    }  },  "gateway": {    // 本地网关监听端口    "port": 18789,    "mode": "local","bind": "loopback","controlUi": {"enabled": true,"basePath": "/openclaw"},    "auth": {      "mode": "token",      // 网关管理密钥占位      "token": "[GATEWAY_AUTH_TOKEN_PLACEHOLDER]",      "allowTailscale": true    },    "channelHealthCheckMinutes": 5,"channelStaleEventThresholdMinutes": 15,"channelMaxRestartsPerHour": 5,"tailscale": {"mode": "serve","resetOnExit": true},    "remote": {      // 远程链路身份      "url": "ws://gateway.tailnet:18789",      "transport": "ssh",      "token": "[REMOTE_GW_TOKEN_PLACEHOLDER]",      "sshTarget": "[SSH_USER_HOST_PLACEHOLDER]"    },    "reload": {"mode": "hybrid","debounceMs": 300},"http": {"securityHeaders": {"strictTransportSecurity": "max-age=31536000; includeSubDomains"}},"nodes": {"denyCommands": []}  },  "memory": {"backend": "builtin","citations": "on"},  "skills": {"allowBundled": ["gemini","peekaboo"],"load": {"extraDirs": ["~/Projects/agent-scripts/skills"],"watch": true,"watchDebounceMs": 500},"install": {"preferBrew": true,"nodeManager": "npm"},"limits": {"maxCandidatesPerRoot": 5,"maxSkillsLoadedPerSource": 10,"maxSkillsInPrompt": 10,"maxSkillsPromptChars": 2048,"maxSkillFileBytes": 3145728}},  "plugins": {"entries": {"feishu": {"enabled": true,"config": {}}}}}

回首页,搜索你想要的文档

在首页搜索框输入关键词,快速定位资料

文库首页搜索指引 立即搜索

相关学习资料