Skip to content

OpenClaw CLI 参数参考 ​

来源:openclaw_ui_integration/package.json 与 openclaw_ui_integration/scripts/openclaw-*.mjs。所有命令默认在 openclaw_ui_integration/ 下运行。npm 形式的脚本参数需要放在 -- 后面。

脚本对照 ​

npm 脚本脚本文件用途
openclaw:contextscripts/openclaw-context.mjs能力发现、运行时上下文
verify:phonescripts/verify-phone-agent.ps1手机 Agent 自检
phone:agentscripts/openclaw-phone-agent.mjs自然语言手机 Agent 任务
phone:fleetscripts/openclaw-phone-fleet.mjs多设备编队
phone:visionscripts/openclaw-phone-vision.mjs取帧、视觉状态、单步动作
phone:videoscripts/openclaw-phone-video.mjs录屏、列出和下载视频
phone:imagescripts/openclaw-image-phone.mjsAI 生图或图片导入手机
phone:image:editscripts/openclaw-image-phone.mjs --mode edit图像编辑
phone:gamescripts/openclaw-phone-game.mjs游戏模式单步
phone:publishscripts/openclaw-publish-phone.mjs平台发布
phone:relayscripts/openclaw-publish-relay.mjs发布中继
phone:relay:checkscripts/openclaw-publish-relay-check.mjs中继状态检查
phone:relay:smokescripts/openclaw-publish-relay-smoke.mjs中继冒烟测试
phone:demo:shoppingscripts/openclaw-phone-demo.mjs shopping购物演示
phone:demo:readscripts/openclaw-phone-demo.mjs read阅读演示
phone:demo:gamescripts/openclaw-phone-demo.mjs game游戏演示
desktop:agentscripts/openclaw-desktop-agent.mjs桌面 Agent 状态、启停、截图、点击、输入
desktop:replyscripts/openclaw-desktop-agent.mjs reply桌面观察和显式单次回复

通用选项:--json、--device-id、--phone-url、--phone-token。Token 参数仅用于调试,不应写入日志。

openclaw:context ​

powershell
npm run openclaw:context -- --json
npm run openclaw:context -- --probe --write --json
选项说明
--root PATH启动器或 OpenClawFiles 根目录,默认当前项目根
--device-id ID选择一个已配置的 APKClaw 设备
--phone-url URL本次刷新使用的手机 Agent 地址
--phone-token TOKEN本次刷新使用的手机 Token,不写入上下文文件
--phone-album NAME默认手机相册名
--probe存在 URL 与 Token 时探测手机状态
--write写入 data/.openclaw/workspace/runtime-context.json
--json输出 JSON

输出包含 agentCli、visionCli、videoCli、publishCli、fleetCli、desktopAgent.agentCli、desktopAgent.replyCli 等字段。

phone:agent ​

powershell
npm run phone:agent -- run --prompt "读取当前屏幕" --mode observe --json
npm run phone:agent -- submit --prompt "打开设置页" --mode safe --json
npm run phone:agent -- status --task-id TASK_ID --json
npm run phone:agent -- cancel --task-id TASK_ID --json
npm run phone:agent -- history --limit 20 --json
npm run phone:agent -- enqueue --prompt "稍后检查屏幕" --mode observe --json
npm run phone:agent -- queue --json
npm run phone:agent -- drain --json
选项默认说明
--prompt TEXT无run、submit、enqueue 必填
--task-id ID无status、cancel 必填
`--mode observesafefull`
--timeout-sec N600手机端任务超时
--max-rounds N60Agent 回合预算
--max-wait-sec N615run 的 CLI 等待窗口
--poll-ms N1800轮询间隔
--priority N0队列优先级,数值越大越优先
--queue-id ID无指定队列任务
--limit N20历史条数

任务历史写入 data/.openclaw/logs/phone-agent-history.jsonl,本地队列写入 data/.openclaw/launcher/phone-agent-queue.json。

phone:vision ​

powershell
npm run phone:vision -- status --json
npm run phone:vision -- frame --out ./data/phone-frames/frame.jpg --json
npm run phone:vision -- action --action-body "{\"action\":\"tap\",\"gridCell\":\"C7\",\"targetLabel\":\"设置按钮\",\"reason\":\"打开设置面板\"}" --json
命令说明
status读取视觉链路状态
frame抓取当前屏幕帧
action执行一个视觉动作

动作体字段通常包含 action、gridCell、targetLabel、reason。--force-action 会跳过确认,只能在明确授权后使用。

phone:video ​

powershell
npm run phone:video -- start --max-seconds 60 --filename demo.mp4 --json
npm run phone:video -- status --json
npm run phone:video -- stop --json
npm run phone:video -- list --json
npm run phone:video -- download --latest --out-dir ./data/phone-videos --json
选项说明
--max-seconds N录屏时长上限
--filename NAME手机端录屏文件名
--fps N帧率,手机端会夹到支持范围
--bit-rate N码率,手机端会夹到支持范围
--latest下载最近一条视频
--out-dir PATH下载目录

Android 录屏通常需要手机端确认屏幕录制授权。

phone:image 与 phone:image:edit ​

powershell
npm run phone:image -- --prompt "产品图标,清晰边缘" --json
npm run phone:image:edit -- --reference-image ./input.png --prompt "改成深色科技风" --json
npm run phone:image -- --image ./ready.png --json
选项说明
--prompt TEXT生图或编辑提示词
--mode edit编辑模式,phone:image:edit 已内置
--reference-image PATH编辑参考图
--image PATH将已有图片导入手机

phone:publish ​

powershell
npm run phone:publish -- --platform xiaohongshu --title "标题" --body "正文" --image ./a.png --json
npm run phone:publish -- --transport reverse --platform douyin --packet-out ./publish-packet.json --json
选项默认说明
`--platform xiaohongshudouyinwechat
`--transport directreverse`direct
--title TEXT无标题
--body TEXT无正文
--hashtags TEXT无话题标签
--notes TEXT无给 Agent 的额外说明
--album NAMEOpenClaw Publish手机相册
--image PATH无可重复传入图片
--video PATH无可重复传入视频
--file PATH无可重复传入通用媒体
--relay-url URL无反向中继端点
--relay-token TOKEN环境变量中继鉴权令牌
--channel-id ID无中继通道
--wait-relay关闭等待中继回执
--packet-out PATH无写出 reverse packet

phone:fleet ​

powershell
npm run phone:fleet -- list --json
npm run phone:fleet -- status --target all --json
npm run phone:fleet -- run --target redmi-k70,pixel-01 --prompt "检查当前屏幕" --mode observe --json
命令说明
list列出已配置设备
status --target all批量读取状态
run --target ID,ID --prompt TEXT批量执行手机 Agent 任务

phone:game 与 phone:demo ​

powershell
npm run phone:game -- run --goal "查看当前游戏画面" --json
npm run phone:game -- act --plan-body "{\"action\":\"tap\",\"gridCell\":\"C7\",\"targetLabel\":\"按钮\",\"reason\":\"确认\"}" --json
npm run phone:demo:shopping -- --query "高性价比商品" --json
npm run phone:demo:read --json
npm run phone:demo:game -- --goal "安全查看当前画面" --json

desktop:agent ​

powershell
npm run desktop:agent -- status --json
npm run desktop:agent -- health --json
npm run desktop:agent -- start --json
npm run desktop:agent -- stop --json
npm run desktop:agent -- screenshot --out ./data/desktop.png --json
npm run desktop:agent -- click --x 100 --y 200 --confirmed --json
npm run desktop:agent -- type --text "输入内容" --confirmed --json
npm run desktop:agent -- wechat unread --json
npm run desktop:agent -- wechat send --text "收到,稍后回复" --confirmed --json
选项默认说明
--root PATH自动发现启动器或 OpenClawFiles 根目录
--python PATHbundled 或系统 PythonPython executable
--bridge-timeout-sec N20临时 Bridge 启动等待
--wait-sec N15start 等待 sidecar health
--timeout-ms N45000HTTP 请求超时
--text TEXT无输入或发送文本
--x N --y N无点击坐标
--out PATH无截图保存路径
--agent-dir PATH无Luminode agent 目录
--port N21900Luminode HTTP API 端口
--app-type NAMEweixinwechat、dingtalk、lark、generic 等
--enabled / --disabled无开关桌面 Agent
`--allow-click truefalse`无
`--allow-type truefalse`无
`--allow-wechat-send truefalse`无
`--send-mode draft_onlyauto_enter`draft_only
--confirmed / --yesfalse真实动作或危险策略必需
--no-screenshotfalsereply observe 跳过截图

默认策略通常只允许截图。点击、输入、发送消息需要启动器配置放行,并且请求带 --confirmed。

desktop:reply ​

powershell
npm run desktop:reply -- observe --json
npm run desktop:reply -- once --text "回复内容" --confirmed --json
命令说明
observe汇总 status、health、未读状态和截图摘要
once先观察,再发送一条显式给定的回复

reply auto 不是默认能力。没有侧边端点和用户授权时,不要自动生成并发送回复。

故障矩阵 ​

现象建议
找不到设备在启动器手机控制页保存设备,或先跑 phone:fleet list --json
Invalid Lumi signatureToken、配对状态或签名通道不一致,重新配对并刷新配置
Missing value检查 npm 脚本参数前是否有 --
任务超时拆成更小任务,或调整 --max-wait-sec、--timeout-sec
桌面 401使用 CLI 自动拉起 Bridge,不手写端口和 Token
桌面 403 / blocked=true策略未放行;在启动器配置并带 --confirmed
输出无法解析增加 --json,只读 JSON 字段

直接 Node 调用 ​

powershell
node scripts/openclaw-context.mjs --json
node scripts/openclaw-phone-agent.mjs run --prompt "读取屏幕" --mode observe --json
node scripts/openclaw-desktop-agent.mjs status --json

直接 Node 调用不需要 npm 的 -- 分隔符,其余参数一致。

HEANG 帮助中心 · 星钥 StarKey 与 LOOM 启动器