OpenClaw 实用用法速查
2026/6/26 16:40:29 网站建设 项目流程

OpenClaw 实用用法速查

OpenClaw v2026.6.1 · 适用于日常开发运维


一、常用状态查看

# 总览:Gateway 运行状态、当前模型、会话信息、上下文用量openclaw status# 只看当前会话详情(模型、Token、上下文比例等)openclaw session status# 实时查看 Gateway 日志(看机器人执行过程)journalctl-uopenclaw-f--no-hostname-ocat# 或 tail 日志文件tail-f~/.openclaw/logs/*.log

二、模型相关

# 查看当前默认模型及 Provider 状态openclaw models status# 切换默认模型openclaw modelsset<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 skillsinstall/path/to/skill-dir# 从本地目录安装并指定 slug 别名openclaw skillsinstall--as<alias>/path/to/skill-dir# 强制覆盖安装(更新已存在的技能)openclaw skillsinstall--force/path/to/skill-dir# 搜索 ClawHub 上的公开技能openclaw skills search<keyword># 更新 ClawHub 安装的技能openclaw skills update

四、频道(Channels)配置

# 列出已配置的聊天频道openclaw channels list# 查看频道连接状态openclaw channels status# 添加频道(交互式引导)openclaw channelsadd# 非交互式添加飞书频道openclaw channelsadd--channelfeishu --app-id<xxx>--app-secret<xxx># 查看频道日志openclaw channels logs# 列出频道 capabilities(支持的功能)openclaw channels capabilities# 登录/登出频道openclaw channels login--channelwhatsapp openclaw channelslogout--channeltelegram# 删除频道openclaw channels remove

五、配置管理

# 查看当前配置文件路径openclaw configfile# 读取某个配置项openclaw config get gateway.port openclaw config get agents.defaults.model# 设置配置项openclaw configsetgateway.port19001# 批量修改配置(JSON5 文件)openclaw config patch--file./patch.json5# 删除配置项openclaw configunsetgateway.port# 校验配置文件是否有语法错误openclaw config validate# 查看完整配置 schemaopenclaw 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# 发现局域网内其他 Gatewayopenclaw gateway discover# 查看 Gateway 稳定性诊断openclaw gateway stability# 查看用量/费用openclaw gateway usage-cost

七、Cron 定时任务

# 列出所有定时任务openclawcronlist# 添加定时任务(交互式)openclawcronadd# 查看某个任务详情openclawcronshow<job-id># 立即触发某个任务(调试用)openclawcronrun<job-id># 查看任务执行历史openclawcronruns<job-id># 启用/禁用任务openclawcronenable<job-id>openclawcrondisable<job-id># 编辑任务openclawcronedit<job-id># 删除任务openclawcronrm<job-id>

八、Memory 记忆管理

# 查看记忆索引状态openclaw memory status# 搜索记忆内容openclaw memory search"关键词"# 限制搜索结果数量openclaw memory search--query"部署"--max-results20# 重新索引记忆文件openclaw memory index--force# 查看短期记忆晋升候选(将重要内容写入长期记忆)openclaw memory promote--limit10--min-score0.75# 执行晋升(将候选写入 MEMORY.md)openclaw memory promote--apply

九、会话(Sessions)管理

# 列出所有会话openclaw sessions list# 仅查看最近活跃会话openclaw sessions--active120# 查看某个会话详情(Token 用量等)openclaw sessions show<session-id># 只显示最新的 N 条会话openclaw sessions--limit20# 导出会话轨迹(用于调试/分享)openclaw sessions export-trajectory<session-id># 实时跟踪当前会话进度openclaw sessionstail# 清理过期会话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--channeltelegram--target@mychat--message"你好"# 更新 OpenClawopenclaw 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}

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询