OpenClaw 配置文件详解:掌握 hugo.toml 的每一个参数

··
OpenClaw 技术团队
专注于 OpenClaw 小龙虾框架的技术研究与分享

配置文件概述
#

OpenClaw 的核心配置存储在 hugo.toml 文件中。这个文件控制着 AI 助手的行为、模型选择、技能加载等各个方面。

基础配置
#

1
2
3
4
[openclaw]
  name = "我的助手"
  default_model = "gpt-4"
  language = "zh-CN"

模型配置
#

1
2
3
4
5
6
7
8
9
[openclaw.models]
  [[openclaw.models.providers]]
    name = "openai"
    api_key = "${OPENAI_API_KEY}"
    base_url = "https://api.openai.com/v1"
    
  [[openclaw.models.providers]]
    name = "anthropic"
    api_key = "${ANTHROPIC_API_KEY}"

技能系统配置
#

1
2
3
4
5
6
7
8
[openclaw.skills]
  auto_load = true
  directory = "./skills"
  
  [openclaw.skills.enabled]
    filesystem = true
    web_search = true
    code_execution = false  # 安全考虑

记忆系统配置
#

1
2
3
4
5
6
7
8
[openclaw.memory]
  enabled = true
  backend = "sqlite"  # 或 "redis"
  retention_days = 90
  
  [openclaw.memory.embedding]
    provider = "openai"
    model = "text-embedding-3-small"

安全与权限
#

1
2
3
4
[openclaw.security]
  allow_shell_execution = false
  allowed_paths = ["/home/user/documents", "/home/user/projects"]
  blocked_commands = ["rm -rf /", "format", "dd"]

多用户配置
#

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
[openclaw.multi_user]
  enabled = true
  authentication = "jwt"
  
  [[openclaw.multi_user.users]]
    username = "admin"
    role = "administrator"
    
  [[openclaw.multi_user.users]]
    username = "guest"
    role = "restricted"

总结
#

合理配置 hugo.toml 可以让你的 OpenClaw 助手更加智能、安全、高效。建议根据实际需求调整各项参数。