OpenClaw 速查表
快速查阅 OpenClaw 常用命令和配置。
安装命令
# 一键安装(Windows PowerShell)
iwr -useb https://openclaw.ai/install.ps1 | iex
# 一键安装(macOS/Linux)
curl -fsSL https://openclaw.ai/install.sh | bash
# npm 安装
npm install -g openclaw@latest
# Homebrew 安装(macOS)
brew tap openclaw/tap
brew install openclaw
# 验证安装
openclaw --version
# 更新到最新版本
npm update -g openclaw
Gateway 命令
# 启动服务
openclaw gateway start
# 停止服务
openclaw gateway stop
# 重启服务
openclaw gateway restart
# 查看状态
openclaw gateway status
# 查看日志
openclaw gateway logs
# 查看配置
openclaw config show
渠道命令
# 查看渠道列表
openclaw channels list
# 添加 Telegram 渠道
openclaw channels add telegram --token YOUR_BOT_TOKEN
# 添加 Discord 渠道
openclaw channels add discord --token YOUR_BOT_TOKEN --client-id YOUR_CLIENT_ID
# 添加飞书渠道
openclaw channels add feishu --app-id YOUR_APP_ID --app-secret YOUR_APP_SECRET
# 添加 Slack 渠道
openclaw channels add slack --token xoxb-YOUR-TOKEN
# 测试渠道连接
openclaw channels status --probe
# 移除渠道
openclaw channels remove telegram
技能命令
# 搜索技能
openclaw skill search weather
# 安装技能
openclaw skill install weather
# 查看已安装技能
openclaw skill list
# 查看技能详情
openclaw skill info weather
# 更新技能
openclaw skill update weather
# 更新所有技能
openclaw skill update --all
# 卸载技能
openclaw skill uninstall weather
# 创建自定义技能
openclaw skills create my-skill
# 重载技能
openclaw skill reload
# 扫描技能安全
openclaw skill scan weather
记忆命令
# 编辑 MEMORY.md
openclaw memory edit
# 查看记忆
openclaw memory show
# 添加记忆条目
openclaw memory add "用户喜欢简洁的回复风格"
# 搜索记忆
openclaw memory search "工作习惯"
# 导出记忆
openclaw memory export backup.json
# 导入记忆
openclaw memory import backup.json
# 编辑 SOUL.md
openclaw soul edit
# 编辑 HEARTBEAT.md
openclaw heartbeat edit
# 查看心跳状态
openclaw heartbeat status
# 手动触发心跳
openclaw heartbeat trigger
定时任务命令
# 查看定时任务
openclaw cron list
# 添加定时任务
openclaw cron add daily-report "0 9 * * *" "生成昨日工作总结"
# 启用任务
openclaw cron enable daily-report
# 禁用任务
openclaw cron disable daily-report
# 手动执行任务
openclaw cron run daily-report
# 删除任务
openclaw cron remove daily-report
# 查看执行历史
openclaw cron history daily-report
Agent 命令
# 列出所有 Agent
openclaw agent list
# 创建新 Agent
openclaw agent create writer
# 查看 Agent 详情
openclaw agent info writer
# 编辑 Agent 配置
openclaw agent edit writer
# 删除 Agent
openclaw agent remove writer
# 复制 Agent
openclaw agent copy writer writer-backup
# 测试 Agent
openclaw agent test writer --message "测试消息"
浏览器命令
# 启动浏览器
openclaw browser start
# 启动无界面浏览器
openclaw browser start --headless
# 停止浏览器
openclaw browser stop
# 列出标签页
browser tabs
# 切换标签
tab select --index 1
# 扫描页面元素
snapshot
# 导航到 URL
navigate https://example.com
# 点击元素
click --selector "#button"
# 输入文本
type --selector "#input" --text "Hello"
# 截图
browser screenshot --output screenshot.png
# 生成 PDF
browser pdf --output page.pdf
配置命令
# 查看所有配置
openclaw config show
# 设置配置项
openclaw config set model.provider claude
openclaw config set model.api_key sk-xxx
# 编辑配置文件
openclaw config edit
# 重置配置
openclaw config reset
# 显示 Token
openclaw config --show-token
备份命令
# 创建备份
openclaw backup create --output backup.tar.gz
# 恢复备份
openclaw backup restore backup.tar.gz
# 查看备份列表
openclaw backup list
诊断命令
# 诊断网络
openclaw diagnose network
# 诊断模型
openclaw diagnose model
# 查看日志
openclaw logs --tail 100
# 查看错误日志
openclaw logs --level error
Cron 表达式速查
| 表达式 | 含义 |
|---|---|
* * * * * | 每分钟 |
*/5 * * * * | 每 5 分钟 |
0 * * * * | 每小时整点 |
0 9 * * * | 每天早上 9:00 |
0 18 * * * | 每天下午 18:00 |
0 9 * * 1-5 | 周一到周五早上 9:00 |
0 9 * * 1 | 每周一早上 9:00 |
0 9 1 * * | 每月 1 号早上 9:00 |
0 0 * * 0 | 每周日午夜 |
配置文件位置
| 文件 | 路径 | 说明 |
|---|---|---|
| 主配置 | ~/.openclaw/config.json | 全局配置 |
| 记忆 | ~/.openclaw/memory/ | 记忆文件目录 |
| 技能 | ~/.openclaw/skills/ | 技能目录 |
| 工作空间 | ~/.openclaw/workspaces/ | Agent 工作空间 |
| 日志 | ~/.openclaw/logs/ | 日志文件 |
环境变量
| 变量 | 说明 |
|---|---|
OPENCLAW_CONFIG_PATH | 配置文件路径 |
OPENCLAW_DATA_PATH | 数据存储路径 |
OPENCLAW_LOG_LEVEL | 日志级别 |
MODEL_API_KEY | 模型 API Key |
常用端口
| 端口 | 服务 |
|---|---|
| 18789 | Web UI / Gateway |
| 18792 | Extension Relay |
| 9222 | Headless Chrome |
| 8080 | 健康检查 |
| 9090 | Prometheus 指标 |
常见问题快速解决
服务无法启动
# 检查端口占用
lsof -i :18789
# 检查日志
openclaw logs --tail 50
# 重置配置
openclaw config reset
模型调用失败
# 检查 API Key
openclaw config show model.api_key
# 测试模型连接
openclaw diagnose model
# 查看错误日志
openclaw logs --level error
渠道连接失败
# 测试连接
openclaw channels status --probe
# 查看渠道日志
openclaw channels logs telegram
# 重新配置
openclaw channels remove telegram
openclaw channels add telegram --token NEW_TOKEN
记忆不生效
# 验证记忆文件
openclaw memory validate
# 查看记忆内容
openclaw memory show
# 重新加载
openclaw memory reload