OpenClaw 指令使用方法详解
OpenClaw 指令使用方法详解一、OpenClaw 简介OpenClaw 是一个开源的个人 AI 助手框架支持通过命令行界面CLI进行全面的配置、管理和操作。OpenClaw 能够在本地设备运行并通过多种通信渠道回复消息包括 WhatsApp、Telegram、Slack、Discord、Google Chat、Signal、iMessage 等。此外它还支持在 macOS/iOS/Android 上进行语音交互并提供实时画布界面供用户控制。核心特点支持多种通信平台WhatsApp、Telegram、Discord 等本地运行响应速度快始终在线支持语音唤醒和对话模式高度可扩展的技能系统二、安装配置2.1 环境要求在安装 OpenClaw 之前需要确保满足以下前置条件要求说明操作系统macOS、Linux、Windows通过 WSL2Node.js版本必须 22包管理器npm、pnpm 或 bun网络连接用于下载依赖和配置通信渠道推荐Brave Search API 密钥用于网页搜索2.2 安装步骤Linux/macOS 系统安装curl-fsSLhttps://openclaw.ai/install.sh|bashWindows 系统安装PowerShelliwr-usebhttps://openclaw.ai/install.ps1|iex替代方案全局 npm 安装npminstall-gopenclawlatest# 或pnpmadd-gopenclawlatest2.3 初始化配置安装完成后运行引导设置工具进行初始化配置openclaw onboard --install-daemon该命令会完成以下配置创建必要的配置文件设置工作区安装为守护进程在后台自动运行配置网关令牌向导会提示设置本地或远程网关、认证信息支持 OpenAI Codex 订阅或 API 密钥、通信频道WhatsApp QR 登录、Telegram/Discord 机器人令牌等、后台服务配置。2.4 启动 Gateway配置完成后启动 OpenClaw Gateway# 检查网关状态openclaw gateway status# 手动前台运行openclaw gateway--port18789--verboseGateway 启动后可以通过以下地址访问 Dashboardhttp://127.0.0.1:18789/三、全局选项OpenClaw CLI 提供以下全局选项选项说明--dev在~/.openclaw-dev下隔离状态并转移默认端口--profile name在~/.openclaw-name下隔离状态--no-color禁用 ANSI 颜色输出--update执行openclaw update更新程序-V,--version打印版本信息并退出四、核心指令系统4.1 设置与入门命令命令说明使用场景openclaw setup初始化配置和工作区首次安装时设置基础配置openclaw onboard交互式向导设置完整引导配置过程openclaw configure交互式配置向导配置模型、频道、技能、网关openclaw config非交互式配置get/set/unset 操作openclaw doctor健康检查和快速修复诊断和修复问题setup 常用选项openclaw setup--workspacepath# 指定工作区路径默认 ~/.openclaw/workspaceopenclaw setup--wizard# 运行入门向导openclaw setup --non-interactive# 无提示运行openclaw setup--modemode# 向导模式openclaw setup --remote-urlurl# 远程 Gateway URLopenclaw setup --remote-tokentoken# 远程 Gateway tokenconfig 子命令使用方法# 查看配置值openclaw config getkey# 设置配置值openclaw configsetkeyvalue# 移除配置openclaw configunsetkey4.2 消息与代理命令命令说明openclaw message统一出站消息和频道操作openclaw agent通过 Gateway 运行单个 agent 回合openclaw agents管理隔离的 agentsopenclaw status显示链接会话健康状况和最近收件人openclaw health从运行中的 Gateway 获取健康状态openclaw sessions列出存储的对话会话openclaw acp运行连接 IDEs 到 Gateway 的 ACP 桥接message 子命令包括# 发送消息openclaw message send--target15555550123--messageHello from OpenClaw# 读取消息openclaw messageread# 搜索消息openclaw message searchquery# 消息反应openclaw message reactmessage-idemoji# 编辑消息openclaw message editmessage-idnew-content# 删除消息openclaw message deletemessage-id# 置顶消息openclaw message pinmessage-idopenclaw message unpinmessage-id# 消息超时设置openclaw messagetimeoutchannelseconds# 踢出成员openclaw message kickmember-id# 封禁成员openclaw message banmember-id# 线程操作openclaw message threadthreadId# Emoji 操作openclaw message emojiemojiId# 贴纸操作openclaw message stickerstickerId# 角色操作openclaw message roleroleId# 频道操作openclaw message channelchannelId# 成员信息openclaw message member info# 语音状态openclaw message voice status# 事件操作openclaw message eventeventIdagent 命令使用# 基本用法openclaw agent--messagetext--torecipient# 完整选项openclaw agent--messagetext--torecipient\--session-idid\--thinkingtext\# GPT-5.2 Codex 模型专用--verbose\--channelchannel\--local\# 嵌入式本地运行--deliver\--json\--timeoutsecondsstatus 命令选项openclaw status--json# JSON 格式输出openclaw status--all# 完整诊断openclaw status--deep# 探测频道openclaw status--usage# 显示模型使用量openclaw status--timeoutsecondsopenclaw status--verboseopenclaw status--debugagents 子命令# 列出 agentsopenclaw agents list[--json][--bindings]# 添加新 agentopenclaw agentsadd[name]# 删除 agentopenclaw agents deleteid[--force]4.3 Gateway 管理命令命令说明openclaw gateway运行 WebSocket Gatewayopenclaw logs通过 RPC 尾随 Gateway 文件日志gateway 常用选项# 指定端口和地址openclaw gateway--port18789--bind0.0.0.0# 指定认证令牌openclaw gateway--tokenyour-token# 启用认证openclaw gateway--auth--passwordpassword# 启用 Tailscaleopenclaw gateway--tailscale# 重置配置openclaw gateway--reset# 强制执行openclaw gateway--force# 详细输出openclaw gateway--verbose# Claude CLI 日志openclaw gateway --claude-cli-logs# WebSocket 日志openclaw gateway --ws-logpath# 紧凑输出openclaw gateway--compact# 原始流openclaw gateway --raw-stream openclaw gateway --raw-stream-pathpathgateway service 子命令openclaw gateway status# 查看状态openclaw gatewayinstall# 安装服务openclaw gateway uninstall# 卸载服务openclaw gateway start# 启动服务openclaw gateway stop# 停止服务openclaw gateway restart# 重启服务logs 命令使用openclaw logs--follow# 实时跟踪日志openclaw logs--limit200# 限制输出行数openclaw logs--plain# 纯文本格式openclaw logs--json# JSON 格式输出openclaw logs --no-color# 禁用颜色4.4 模型管理命令命令说明openclaw models等同于models statusopenclaw models list列出可用模型openclaw models status显示模型状态和认证信息openclaw models set model设置默认主模型openclaw models set-image model设置默认图像模型openclaw models scan扫描可用模型openclaw models auth管理模型认证models 子命令# 列出所有模型openclaw models list--allopenclaw models list--localopenclaw models list--providernameopenclaw models list--jsonopenclaw models list--plain# 查看模型状态openclaw models status--jsonopenclaw models status--plainopenclaw models status--checkopenclaw models status--probe# 设置默认模型openclaw modelssetclaude-3-5-sonnet-20241022 openclaw models set-image claude-3-5-sonnet-20241022# 模型别名管理openclaw models aliases list openclaw models aliasesaddaliasmodelopenclaw models aliases removealias# 回退模型管理openclaw models fallbacks list openclaw models fallbacksaddmodelopenclaw models fallbacks removemodelopenclaw models fallbacksclear# 图像回退模型管理openclaw models image-fallbacks list openclaw models image-fallbacksaddmodelopenclaw models image-fallbacks removemodelopenclaw models image-fallbacksclear# 扫描可用模型openclaw models scan --min-paramsnopenclaw models scan --max-age-daysnopenclaw models scan--providernameopenclaw models scan --set-default openclaw models scan --set-image# 认证管理openclaw models authaddopenclaw models auth setup-token openclaw models auth paste-token# 认证顺序openclaw models auth order get openclaw models auth ordersetorderopenclaw models auth orderclear4.5 频道管理命令OpenClaw 支持多种通信频道包括 WhatsApp、Telegram、Discord、Google Chat、Slack、Mattermost、Signal、iMessage、Microsoft Teams 等。命令说明openclaw channels list列出所有配置的频道openclaw channels status查看频道状态openclaw channels logs查看频道日志openclaw channels add添加新频道openclaw channels remove移除频道openclaw channels login频道登录QR 码openclaw channels logout频道登出添加频道示例# 添加 Telegram 频道openclaw channelsadd--channeltelegram--accountalerts--nameAlerts Bot--token$TELEGRAM_BOT_TOKEN# 添加 Discord 频道openclaw channelsadd--channeldiscord--accountwork--nameWork Bot--token$DISCORD_BOT_TOKEN# 添加 WhatsAppopenclaw channelsadd--channelwhatsapp--accountpersonal# 添加 Slackopenclaw channelsadd--channelslack--accountteam--token$SLACK_BOT_TOKEN# 检查频道连接状态openclaw channels status--probeWhatsApp 登录openclaw channels login# 然后扫描 QR 码设置 → 已关联的设备4.6 技能管理命令Skills技能是赋予 OpenClaw 执行特定任务能力的插件。命令说明openclaw skills list列出可用技能openclaw skills info skill查看技能详情openclaw skills check检查技能状态openclaw skills list openclaw skills infoskill-nameopenclaw skills check[--eligible][--json][-v]4.7 插件管理命令命令说明openclaw plugins list列出已安装插件openclaw plugins info plugin查看插件详情openclaw plugins install plugin安装插件openclaw plugins enable plugin启用插件openclaw plugins disable plugin禁用插件openclaw plugins doctor诊断插件问题4.8 内存管理命令命令说明openclaw memory status显示索引统计openclaw memory index重新索引内存文件openclaw memory search query语义搜索内存4.9 定时任务命令命令说明openclaw cron status查看定时任务状态openclaw cron list列出所有定时任务openclaw cron add添加新定时任务openclaw cron edit id编辑定时任务openclaw cron rm id删除定时任务openclaw cron enable id启用定时任务openclaw cron disable id禁用定时任务openclaw cron runs --id id查看任务执行记录openclaw cron run id手动执行定时任务添加定时任务示例# 使用 at 指定时间openclawcronadd--namedaily-report--at0 9 * * *--system-eventdaily-report# 使用 every 指定间隔openclawcronadd--namecheck-updates--every1h--messagecheck-updates# 使用 cron 表达式openclawcronadd--nameweekly-task--cron0 10 * * 1--system-eventweekly-task4.10 节点管理命令命令说明openclaw nodes status查看节点状态openclaw nodes list列出所有节点openclaw nodes describe --node id查看节点详情openclaw nodes pending查看待批准节点openclaw nodes approve id批准节点openclaw nodes reject id拒绝节点openclaw nodes rename重命名节点openclaw nodes invoke调用节点命令openclaw nodes run在节点上运行命令openclaw nodes notify通知节点openclaw nodes camera节点相机控制openclaw nodes canvas节点画布控制openclaw nodes screen节点屏幕控制openclaw nodes location获取节点位置node 子命令openclawnoderun--hosthost--port18789openclawnodestatus openclawnodeinstall[--hosthost][--portport][--tls]openclawnodeuninstall openclawnodestop openclawnoderestart4.11 浏览器控制命令OpenClaw 提供强大的浏览器控制功能命令说明openclaw browser status查看浏览器状态openclaw browser start启动浏览器openclaw browser stop停止浏览器openclaw browser reset-profile重置浏览器配置openclaw browser tabs查看标签页openclaw browser open url打开网址openclaw browser focus targetId聚焦标签页openclaw browser close关闭标签页openclaw browser profiles管理浏览器配置openclaw browser create-profile创建配置openclaw browser delete-profile删除配置浏览器检查和操作命令# 截图openclaw browser screenshot[targetId]openclaw browser snapshot# 导航和操作openclaw browser navigateurlopenclaw browser resizewidthheightopenclaw browser clickxyopenclaw browsertypetextopenclaw browser presskeyopenclaw browser hoverxyopenclaw browser dragstartendopenclaw browserselectselectopenclaw browser uploadfileopenclaw browser fill--fieldsjson# 对话框处理openclaw browser dialog --accept|--dismiss# 等待和执行openclaw browserwaitopenclaw browser evaluate--fnfunctionopenclaw browser console# 导出openclaw browser pdf4.12 系统命令命令说明openclaw system event入队系统事件并触发心跳openclaw system heartbeat心跳控制openclaw system presence列出系统在线状态openclaw system event--texttext[--modemode][--json]openclaw system heartbeat last|enable|disable openclaw system presence4.13 审批管理命令命令说明openclaw approvals get获取审批设置openclaw approvals set设置审批配置openclaw approvals allowlist add添加到允许列表openclaw approvals allowlist remove从允许列表移除4.14 沙箱命令命令说明openclaw sandbox list列出沙箱openclaw sandbox recreate重新创建沙箱openclaw sandbox explain解释沙箱4.15 钩子管理命令命令说明openclaw hooks list列出钩子openclaw hooks info hook显示钩子详情openclaw hooks check检查钩子openclaw hooks enable启用钩子openclaw hooks disable禁用钩子openclaw hooks install安装钩子openclaw hooks update更新钩子4.16 其他常用命令命令说明openclaw docs [query]搜索实时文档openclaw tui打开终端 UIopenclaw reset重置本地配置openclaw uninstall卸载程序openclaw update更新 OpenClawopenclaw security audit安全审计openclaw pairing管理跨频道 DM 配对openclaw webhooks gmailGmail Webhook 设置tui 命令选项openclaw tui--urlurlopenclaw tui--tokentokenopenclaw tui--passwordpasswordopenclaw tui--sessionsessionopenclaw tui--deliveropenclaw tui--thinkingtextopenclaw tui--messagetextopenclaw tui --timeout-msmsopenclaw tui --history-limitnreset 命令选项openclaw reset--scopescopeopenclaw reset--yesopenclaw reset --non-interactive openclaw reset --dry-rununinstall 命令选项openclaw uninstall--serviceopenclaw uninstall--stateopenclaw uninstall--workspaceopenclaw uninstall--appopenclaw uninstall--allopenclaw uninstall--yesopenclaw uninstall --non-interactive openclaw uninstall --dry-run安全审计openclaw security audit# 基本审计openclaw security audit--deep# 深度审计配对管理openclaw pairing list whatsapp openclaw pairing approve whatsappmessage-id五、快速验证步骤安装配置完成后可以通过以下命令验证系统状态# 检查整体状态openclaw status# 检查健康状态openclaw health# 安全审计openclaw security audit--deep# 发送测试消息openclaw message send--target15555550123--messageHello from OpenClaw# 查看模型状态openclaw models status# 检查频道连接openclaw channels status--probe六、命令树汇总openclaw [--dev] [--profile name] ├── setup ├── onboard ├── configure ├── config │ ├── get key │ ├── set key value │ └── unset key ├── doctor ├── security │ └── audit ├── reset ├── uninstall ├── update ├── channels │ ├── list │ ├── status │ ├── logs │ ├── add │ ├── remove │ ├── login │ └── logout ├── skills │ ├── list │ ├── info │ └── check ├── plugins │ ├── list │ ├── info │ ├── install │ ├── enable │ ├── disable │ └── doctor ├── memory │ ├── status │ ├── index │ └── search ├── message │ ├── send │ ├── poll │ ├── react │ ├── read │ ├── edit │ ├── delete │ ├── pin/unpin │ ├── search │ ├── timeout │ ├── kick │ ├── ban │ ├── thread │ ├── emoji │ ├── sticker │ ├── role │ ├── channel │ ├── member │ └── voice ├── agent ├── agents │ ├── list │ ├── add │ └── delete ├── acp ├── status ├── health ├── sessions ├── gateway │ ├── call │ ├── health │ ├── status │ ├── probe │ ├── discover │ ├── install/uninstall/start/stop/restart/run │ └── logs ├── system │ ├── event │ ├── heartbeat │ └── presence ├── models │ ├── list │ ├── status │ ├── set │ ├── set-image │ ├── aliases │ ├── fallbacks │ ├── image-fallbacks │ ├── scan │ └── auth ├── sandbox │ ├── list │ ├── recreate │ └── explain ├── cron │ ├── status │ ├── list │ ├── add/edit/rm │ ├── enable/disable │ └── runs/run ├── nodes │ ├── status │ ├── describe │ ├── list │ ├── pending │ ├── approve/reject │ ├── rename │ ├── invoke │ ├── run │ ├── notify │ ├── camera │ ├── canvas │ ├── screen │ └── location ├── node │ ├── run │ ├── status │ ├── install/uninstall/start/stop/restart ├── browser │ ├── status/start/stop/reset-profile │ ├── tabs/open/focus/close │ ├── profiles │ ├── screenshot/snapshot │ └── navigate/click/type/press/hover/drag/select... ├── approvals │ ├── get/set │ └── allowlist ├── docs ├── dns │ └── setup ├── tui ├── hooks │ ├── list/info/check/enable/disable/install/update ├── webhooks │ └── gmail setup/run └── pairing ├── list └── approve七、常见问题处理7.1 配置问题如果遇到配置文件问题可以运行诊断openclaw doctor7.2 频道连接问题检查频道状态并重新探测openclaw channels status openclaw channels status--probe7.3 模型认证问题检查模型认证状态openclaw models status--checkopenclaw models authadd7.4 环境变量说明环境变量说明OPENCLAW_HOME配置根目录OPENCLAW_STATE_DIR状态目录OPENCLAW_CONFIG_PATH配置文件路径八、参考链接OpenClaw 官网https://openclaw.ai/官方文档https://docs.openclaw.ai/CLI 参考https://docs.openclaw.ai/cli入门指南https://docs.openclaw.ai/start/getting-startedClawHub 技能市场https://clawhub.com九、输出样式说明ANSI 颜色和进度指示器仅在 TTY 会话中渲染OSC-8 超链接在支持的终端中可点击--json和--plain禁用样式--no-color禁用 ANSI 样式NO_COLOR1环境变量也被支持颜色调色板名称颜色值用途accent#FF5A2D标题、标签、主要高亮accentBright#FF7A3D命令名称、强调accentDim#D14A22次要高亮文本info#FF8A5B信息值success#2FBF71成功状态warn#FFB020警告、回退、注意力error#E23D2D错误、失败muted#8B7F77降强调、元数据本文档基于 OpenClaw 官方文档整理欢迎访问 https://docs.openclaw.ai/ 获取最新信息。
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2422687.html
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!