Skip to content

命令参考 ​

以下示例以 OpenClaw 全局 CLI 为例。QClaw 下请把 openclaw 替换为 QClaw 提供的 wrapper。

认证 ​

bash
openclaw ntf auth set-api-key "ock_xxx"
openclaw ntf auth show
openclaw ntf auth clear

set-token 是 set-api-key 的兼容别名(历史命名),两者行为完全一致。api-key 写入宿主状态目录下的 credentials.json(0600 权限),支持多把 key(apiKeys[],其中一把标记为 default);YOOOCLAW_API_KEY 环境变量可覆盖文件中的值。

通知查询 ​

bash
openclaw ntf search
openclaw ntf search --app wechat --from 2026-03-01T00:00:00+08:00 --to 2026-03-09T23:59:59+08:00
openclaw ntf search --keyword "开会" --limit 20
openclaw ntf search --sender "张三"
openclaw ntf summary --limit 700
openclaw ntf stats --dim app --from 2026-03-01

通知同步 ​

bash
openclaw ntf sync scan
openclaw ntf sync fetch --date 2026-03-09
openclaw ntf sync commit --date 2026-03-09

# 迭代器写法:自动挑下一个待处理批次,直接给出可执行的 commit 命令
openclaw ntf sync next
openclaw ntf sync next --all
openclaw ntf sync next --from-date 2026-03-01 --to-date 2026-03-09

sync next 是给记忆同步流程用的便捷封装:自动定位下一个未处理的日期/批次,返回里带一条现成的 commitCommand,不用自己算 --date / --end-index。

通知监控 ​

bash
openclaw ntf monitor create boss-alert \
  --description "监控重点微信消息" \
  --match-rules '{"appName":"wechat","senderKeywords":["张总"]}' \
  --schedule "*/30 * * * *"

openclaw ntf monitor list
openclaw ntf monitor show boss-alert
openclaw ntf monitor enable boss-alert
openclaw ntf monitor disable boss-alert
openclaw ntf monitor delete boss-alert --yes

录音 ​

bash
openclaw ntf rec list
openclaw ntf rec status <recording-id>
openclaw ntf rec storage-path
openclaw ntf rec setup

录音结果只通过 Gateway WebSocket 方法 recordings.result.write 写入;HTTP POST /recordings 自 1.18.0 起停用,保留路由但固定返回 410 Gone(Tailscale 等直连客户端也改走 Gateway RPC)。写入响应只代表已受理,客户端应通过 recording.status 事件或 recordings.status 查询确认 audio_status=downloaded 且 audioFile 非空。请求顶层可带可选的 ossTaskId(上传服务返回的任务 ID):下载遇到 403 时插件会用它向云端换一次新的签名 URL 再试,并在响应、事件和查询结果里回显。

网页同步查询(浏览器扩展) ​

浏览器扩展抓取的网页正文经 webPages.save(Gateway Native)或 POST /web-pages 投递到插件,纯读本地已收藏索引,不访问互联网:

bash
openclaw ntf synced-web-page list
openclaw ntf synced-web-page list --from 2026-03-01T00:00:00+08:00 --to 2026-03-09T23:59:59+08:00
openclaw ntf synced-web-page search "关键词" --limit 20
openclaw ntf synced-web-page path <urlHash>
openclaw ntf synced-web-page storage-path

list 的 --from 包含起点、--to 不包含终点,按 capturedAt 过滤,时间参数需带明确时区;path 支持至少 8 位的唯一哈希前缀。

灯效 ​

bash
openclaw ntf light setup-tools
openclaw ntf light send \
  --segments '[{"mode":"wave","duration_s":4,"brightness":192,"color":{"r":255,"g":0,"b":0}}]'

只想在带屏幕的二代硬件上显示文字时,可以不传 --segments,只传 --title / --reason:

bash
openclaw ntf light send --title "会议提醒" --reason "15:00 产品评审"

light send 最多支持 MAX_LIGHT_SEGMENTS 段(超出会报 light_control supports 1-N segments),repeat_times 必须是 >=0 的整数。

云端待办 ​

bash
openclaw ntf todo list --is-done false
openclaw ntf todo get <id>
openclaw ntf todo create --title "产品评审" --due-at 2026-10-10T15:00:00+08:00 --is-full-day false
openclaw ntf todo update <id> --is-done true     # false 为恢复未完成
openclaw ntf todo delete <id> --yes

与原生 Agent 工具 ai_todo_list / ai_todo_get / ai_todo_create / ai_todo_update / ai_todo_delete 共用同一个 Client,复用 App 待办服务和插件 API Key。--due-at 是开始时间:定时用带时区 ISO,全天用日期,无时间传 null。list 还支持 --start-time / --end-time / --keyword / --page-no / --page-size;create 结果不确定时用返回的 --request-key 加相同参数重放;create / update 也可以用 --json-file 传一个 JSON 对象。

数据迁移 ​

在两个环境之间搬运通知、录音转写、摘要和收藏网页(可选音频 / 图片 / HTML 存档),源数据保留、目标已有记录不覆盖;记忆、配置和凭据不迁移。包格式与独立 CLI 的 yoooclaw transfer 互通。

bash
# 云端中转(1.18.0 起,默认推荐)
openclaw ntf transfer export --via oss                # 打包上传,返回 taskId 与可复制的导入话术
openclaw ntf transfer import --task <taskId>          # 接收端:自动下载、校验并导入
openclaw ntf transfer import --task <taskId> --dry-run
openclaw ntf transfer complete --task <taskId> --object-key <objectKey>   # 上传确认失败时重试

# 本地包
openclaw ntf transfer capabilities --out ./target-capabilities.json      # 在目标端执行
openclaw ntf transfer export --dry-run
openclaw ntf transfer export --out ./transfer-package.tar.gz --target-capabilities ./target-capabilities.json
openclaw ntf transfer import --file ./transfer-package.tar.gz            # 只暂存 + 预览
openclaw ntf transfer import --local <localTransferId> --plan <planId> [--resume]
  • 范围:--include notifications,recordings,web-pages,images、--from / --to(含时区,左闭右开)、--with-audio / --with-images / --with-html(音频默认不带)。
  • --out 以 .tar.gz / .tgz 结尾生成单个压缩包(1.18.0 起),否则生成包目录;低于 1.18.0 的目标端只能导入包目录。压缩包只是打包,内容仍是明文。
  • 云端中转使用插件 API Key,源 / 目标必须同账号同环境;上传走阿里云 SDK 分片续传且 STS 凭据自动续期,下载走插件的 Range 下载器,续传只在本次命令内有效。客户端单包上限 5 GiB,创建任务每天最多 3 次且不自动重试。云端包由服务端在上传完成 24 小时后自动删除,插件不提供删除命令;下载地址只在命令内部使用,不进入消息或日志。
  • 导入经本机运行中的插件进程执行:迁入的历史通知按目标时区落盘并跳过自动记忆消费(所有使用该存储的 ntf sync 消费者需升级到 1.16.0+)。成功后自动清理本地暂存;部分成功或失败时在 plugins/phone-notifications/transfers/ 保留暂存包与报告供重试——该目录含明文数据,不要当作可公开的日志分享。
  • 网页会话中 Agent 会用 ntf transfer export --via oss --delivery-reference 只拿到交付编号(如 [[transfer:1]]),再通过原生工具 result_deliver 在本轮结束后发送隐私提醒和可复制的导入话术;真实任务 ID 不经模型转述。

环境切换 ​

bash
openclaw ntf env show             # 当前环境(development / test / production)及对应接口地址
openclaw ntf env switch test      # 切换环境,会自动触发一次 gateway 重载

切到不存在的环境名会报 无效的环境名称: <env>,可选值: development, test, production,不影响当前环境。

诊断与运维 ​

bash
openclaw ntf doctor
openclaw ntf doctor --json
openclaw ntf doctor --fix         # 自动修复可自动修复的项(如 stateDir 权限位、危险 flag)
openclaw ntf storage-path
openclaw ntf tunnel-status
openclaw ntf log --keyword error
openclaw ntf log --keyword relay --from 2026-03-01 --to 2026-03-09 --limit 100
openclaw ntf update
openclaw ntf update --beta        # 切到 beta 频道;beta 构建的日志不脱敏,便于排错
openclaw ntf update --accept-capabilities   # 新版本新增了能力声明、返回 CAPABILITY_CONSENT_REQUIRED 时,审阅后明确授权

ntf update 复用宿主原生安装器完成升级,日志和结果落在 <stateDir>/extensions/.phone-notifications-update/,详见更新与升级 · OpenClaw 插件。