Phase 2 / Ep 08: Configuration Management —— config get/set and openclaw.json Deep Dive
🎯 Learning Objectives: Master the hierarchical relationships of the configuration system and common configuration items.
1. Configuration Priority
graph TD
A["1️⃣ CLI Arguments\nHighest Priority"] --> B["2️⃣ Environment Variables\nOPENCLAW_*"]
B --> C["3️⃣ Agent-level Configuration\nagent.json"]
C --> D["4️⃣ Global Configuration\nopenclaw.json"]2. config Command
# Read configuration
openclaw config get llm.provider
# → anthropic
# Write configuration
openclaw config set llm.provider anthropic
openclaw config set llm.model claude-sonnet-4-20250514
openclaw config set tools.profile coding
# List all configurations
openclaw config list
3. openclaw.json Key Fields
{
"gateway": {
"port": 3377,
"host": "127.0.0.1",
"logLevel": "info"
},
"llm": {
"provider": "anthropic",
"model": "claude-sonnet-4-20250514",
"maxTokens": 4096,
"temperature": 0.7
},
"tools": {
"profile": "standard",
"allowedCommands": [],
"blockedCommands": ["rm -rf /", "shutdown"]
},
"channels": {
"telegram": {
"enabled": true,
"token": "${TELEGRAM_BOT_TOKEN}",
"allowedUsers": [123456789]
}
},
"agents": {
"default": "personal"
}
}
4. Sensitive Configuration Management
NEVER hardcode API Keys in openclaw.json. Use environment variables:
# .env file
ANTHROPIC_API_KEY=sk-ant-xxx
TELEGRAM_BOT_TOKEN=7123456789:AAH...
OPENAI_API_KEY=sk-xxx
# Reference in openclaw.json
"token": "${TELEGRAM_BOT_TOKEN}"
5. CLI vs Telegram Comparison
| Operation | CLI | Telegram |
|---|---|---|
| Read Configuration | openclaw config get llm.model |
/config llm.model |
| Modify Configuration | openclaw config set llm.model xxx |
/config set llm.model xxx |
| List All | openclaw config list |
/config list |
Next Episode Preview: Ep 09 delves into the Skills command—discover, install, and manage skills from ClawHub, unlocking new capabilities for your Agent.