配置说明
配置文件位置
默认配置文件:
text
~/.clawgo/config.json调试模式下会使用当前目录下的:
text
.clawgo/config.json配置加载策略:
- 先构造
DefaultConfig() - 再读取 JSON
- 使用严格解码,未知字段会报错
- 最后再用环境变量覆盖带
envtag 的字段
这意味着配置是“有 schema 的”,不是自由 JSON。
顶层结构
顶层 Config 包含:
agentschannelsprovidersgatewaycrontoolsloggingsentinelmemory
agents
agents.defaults
全局默认值,影响运行时的基础行为。
关键字段:
workspace: 工作区路径proxy: 默认 provider 名称proxy_fallbacks: provider fallback 链max_tokenstemperaturemax_tool_iterationsheartbeatcontext_compactionexecutionsummary_policy
heartbeat
enabledevery_secack_max_charsprompt_template
开启后 Gateway 会启动 heartbeat service,定期记录心跳状态。
context_compaction
enabledmodetrigger_messageskeep_recent_messagesmax_summary_charsmax_transcript_chars
支持的 mode:
summaryresponses_compacthybrid
如果使用 responses_compact,当前激活的 provider 必须显式声明 supports_responses_compact: true。
execution
run_state_ttl_secondsrun_state_maxtool_parallel_safe_namestool_max_parallel_calls
这部分决定:
- 工具并发上限
- 哪些工具可安全并发
- 运行态缓存保留多久
summary_policy
用于约束系统任务总结格式,例如:
markercompleted_prefixchanges_prefixoutcome_prefix
如果你希望输出格式更稳定,这部分很关键。
agents.router
ClawGo 的路由器支持基于关键字的主 agent 派发。
关键字段:
enabledmain_agent_idstrategypolicy.intent_max_input_charspolicy.max_rounds_without_userrulesallow_direct_agent_chatmax_hopsdefault_timeout_secdefault_wait_replysticky_thread_owner
当前 strategy 允许:
rules_firstround_robinmanual
agents.communication
负责 agent 间线程化消息协作:
modepersist_threadspersist_messagesmax_messages_per_threaddead_letter_queuedefault_message_ttl_sec
默认值倾向于保留线程和消息,以便恢复和审计。
agents.subagents
每个 subagent 都是一个独立声明项。
常用字段:
enabledtypetransportnode_idparent_agent_idnotify_main_policydisplay_nameroledescriptionsystem_promptsystem_prompt_filememory_namespaceaccept_fromcan_talk_torequires_main_mediationdefault_reply_totools.allowlisttools.denylistruntime.proxyruntime.modelruntime.temperatureruntime.timeout_secruntime.max_retriesruntime.retry_backoff_msruntime.max_task_charsruntime.max_result_charsruntime.max_parallel_runs
注意:
- 启用的本地 subagent 建议设置
system_prompt_file - 使用
transport: "node"时必须有node_id和parent_agent_id
channels
当前支持的通道配置:
telegramdiscordfeishudingtalkwhatsappqqmaixcam
公共去重配置:
inbound_message_id_dedupe_ttl_secondsinbound_content_dedupe_window_secondsoutbound_dedupe_window_seconds
部分通道特性示例:
- Telegram 支持
streaming - Telegram/Feishu 支持群聊 mention 约束
- WhatsApp 依赖 bridge URL
- MaixCam 使用 host/port 本地服务
providers
结构上分为:
providers.proxyproviders.proxies.<name>
字段包括:
api_keyapi_basemodelssupports_responses_compactauthtimeout_secresponses
responses 进一步包含:
web_search_enabledweb_search_context_sizefile_search_vector_store_idsfile_search_max_num_resultsincludestream_include_usage
gateway
hostporttoken
Gateway 同时负责:
- API 服务
- WebUI 宿主
- 节点注册
默认端口是 18790。
cron
min_sleep_secmax_sleep_secretry_backoff_base_secretry_backoff_max_secmax_consecutive_failure_retriesmax_workers
这部分控制的是 Cron Runtime 行为,不是单个 Cron Job 的表达式。
tools
当前顶层配置较少,主要是:
tools.shelltools.webtools.filesystem
tools.shell
enabledworking_dirtimeoutauto_install_missingsandbox.enabledsandbox.image
tools.web.search
api_keymax_results
logging
enableddirfilenamemax_size_mbretention_days
默认日志启用,默认文件是:
text
~/.clawgo/logs/clawgo.logsentinel
enabledinterval_secauto_healnotify_channelnotify_chat_id
Sentinel 用来做周期性巡检和自动恢复。
memory
layeredrecent_dayslayers.profilelayers.projectlayers.procedures
这部分控制 layered memory 的启用范围。
配置校验
执行:
bash
clawgo config check校验器会检查:
- 数值上下界
- provider 是否存在
- fallback provider 是否有效
- router rule 中的 agent 是否存在
- 通道启用时是否填写必要凭据
responses_compact与 provider 能力是否匹配
热更新
两种方式:
bash
clawgo config set channels.telegram.enabled true
clawgo config reloadconfig set 会在成功写入后尝试触发 Gateway 热更新;如果热更新失败且网关正在运行,代码会尝试从备份回滚。