OpenClaw 实用用法速查
·
OpenClaw 实用用法速查
OpenClaw v2026.6.1 · 适用于日常开发运维
一、常用状态查看
# 总览:Gateway 运行状态、当前模型、会话信息、上下文用量
openclaw status
# 只看当前会话详情(模型、Token、上下文比例等)
openclaw session status
# 实时查看 Gateway 日志(看机器人执行过程)
journalctl -u openclaw -f --no-hostname -o cat
# 或 tail 日志文件
tail -f ~/.openclaw/logs/*.log
二、模型相关
# 查看当前默认模型及 Provider 状态
openclaw models status
# 切换默认模型
openclaw models set <model-name>
# 切换图片模型
openclaw models set-image <model-name>
# 管理模型别名(方便用简短名称调用不同模型)
openclaw models aliases
# 设置模型 fallback(主模型不可用时自动降级)
openclaw models fallbacks
三、技能(Skills)管理
# 列出所有已安装技能(含状态:ready/disabled)
openclaw skills list
# 查看某个技能的详细信息(触发条件、用法)
openclaw skills info <skill-name>
# 检查技能依赖是否满足
openclaw skills check
# 从本地目录安装技能
openclaw skills install /path/to/skill-dir
# 从本地目录安装并指定 slug 别名
openclaw skills install --as <alias> /path/to/skill-dir
# 强制覆盖安装(更新已存在的技能)
openclaw skills install --force /path/to/skill-dir
# 搜索 ClawHub 上的公开技能
openclaw skills search <keyword>
# 更新 ClawHub 安装的技能
openclaw skills update
四、频道(Channels)配置
# 列出已配置的聊天频道
openclaw channels list
# 查看频道连接状态
openclaw channels status
# 添加频道(交互式引导)
openclaw channels add
# 非交互式添加飞书频道
openclaw channels add --channel feishu --app-id <xxx> --app-secret <xxx>
# 查看频道日志
openclaw channels logs
# 列出频道 capabilities(支持的功能)
openclaw channels capabilities
# 登录/登出频道
openclaw channels login --channel whatsapp
openclaw channels logout --channel telegram
# 删除频道
openclaw channels remove
五、配置管理
# 查看当前配置文件路径
openclaw config file
# 读取某个配置项
openclaw config get gateway.port
openclaw config get agents.defaults.model
# 设置配置项
openclaw config set gateway.port 19001
# 批量修改配置(JSON5 文件)
openclaw config patch --file ./patch.json5
# 删除配置项
openclaw config unset gateway.port
# 校验配置文件是否有语法错误
openclaw config validate
# 查看完整配置 schema
openclaw config schema
六、Gateway 管理
# 启动 Gateway(前台)
openclaw gateway run
# 强制启动(杀掉已占用的端口)
openclaw gateway run --force
# 查看 Gateway 服务状态
openclaw gateway status
# 查看 Gateway 健康状态
openclaw gateway health
# 重启 Gateway 服务(systemd)
openclaw gateway restart
# 停止 Gateway 服务
openclaw gateway stop
# 发现局域网内其他 Gateway
openclaw gateway discover
# 查看 Gateway 稳定性诊断
openclaw gateway stability
# 查看用量/费用
openclaw gateway usage-cost
七、Cron 定时任务
# 列出所有定时任务
openclaw cron list
# 添加定时任务(交互式)
openclaw cron add
# 查看某个任务详情
openclaw cron show <job-id>
# 立即触发某个任务(调试用)
openclaw cron run <job-id>
# 查看任务执行历史
openclaw cron runs <job-id>
# 启用/禁用任务
openclaw cron enable <job-id>
openclaw cron disable <job-id>
# 编辑任务
openclaw cron edit <job-id>
# 删除任务
openclaw cron rm <job-id>
八、Memory 记忆管理
# 查看记忆索引状态
openclaw memory status
# 搜索记忆内容
openclaw memory search "关键词"
# 限制搜索结果数量
openclaw memory search --query "部署" --max-results 20
# 重新索引记忆文件
openclaw memory index --force
# 查看短期记忆晋升候选(将重要内容写入长期记忆)
openclaw memory promote --limit 10 --min-score 0.75
# 执行晋升(将候选写入 MEMORY.md)
openclaw memory promote --apply
九、会话(Sessions)管理
# 列出所有会话
openclaw sessions list
# 仅查看最近活跃会话
openclaw sessions --active 120
# 查看某个会话详情(Token 用量等)
openclaw sessions show <session-id>
# 只显示最新的 N 条会话
openclaw sessions --limit 20
# 导出会话轨迹(用于调试/分享)
openclaw sessions export-trajectory <session-id>
# 实时跟踪当前会话进度
openclaw sessions tail
# 清理过期会话
openclaw sessions cleanup
十、诊断与修复
# 运行健康检查(只检查不修复)
openclaw doctor --lint
# 检查并自动修复
openclaw doctor --fix
# 深度检查(扫描 systemd 服务等)
openclaw doctor --deep --fix
# 升级后检查插件兼容性
openclaw doctor --post-upgrade
# 检查并审计密钥配置
openclaw secrets audit
# 重新加载密钥(修改后热生效)
openclaw secrets reload
# 查看后台任务状态
openclaw tasks list
# 取消卡住的任务
openclaw tasks cancel <task-id>
十一、其他常用
# 查看版本
openclaw --version
# 交互式首次设置
openclaw setup
openclaw onboard
# 打开 TUI 终端界面
openclaw tui
# 发起一次 Agent 调用(API 风格)
openclaw agent --to +15555550123 --message "帮我查天气" --deliver
# 发送消息(通过频道)
openclaw message send --channel telegram --target @mychat --message "你好"
# 更新 OpenClaw
openclaw update
# 查看 MCP 配置
openclaw mcp
# 查看插件列表
openclaw plugins list
# 查看 API 调用日志(调试)
openclaw channels logs
十二、快速定位问题
| 症状 | 排查命令 |
|---|---|
| 机器人不回复 | openclaw status + openclaw doctor --lint |
| 模型调用失败 | openclaw models status |
| 频道消息收不到 | openclaw channels status --probe |
| 技能不执行 | openclaw skills check |
| 定时任务没跑 | openclaw cron list + openclaw cron runs <id> |
| 配置改坏了 | openclaw config validate |
| Gateway 起不来 | openclaw gateway status + journalctl -u openclaw -n 50 |
| 内存泄漏/高负载 | openclaw gateway stability |
提示: 大部分命令支持
--help查看详细用法,例如openclaw cron add --help。
{
"claudeCode.environmentVariables": [
{
"name": "ANTHROPIC_AUTH_TOKEN",
"value": "sk-siuU4kTfpTTBf"
},
{
"name": "ANTHROPIC_BASE_URL",
"value": "https://llm..com"
},
{
"name": "ANTHROPIC_API_KEY",
"value": ""
},
{
"name": "ANTHROPIC_MODEL",
"value": "ts-deepseek-v4-flash"
}
],
"claudeCode.preferredLocation": "panel",
"git.openRepositoryInParentFolders": "never",
"extensions.ignoreRecommendations": true,
"window.confirmSaveUntitledWorkspace": false,
"remote.autoForwardPortsSource": "hybrid",
"workbench.editor.tabSizing": "shrink",
"workbench.editor.wrapTabs": true
}
更多推荐


所有评论(0)