mcpField
O
openclaw-cli

openclaw-cli

github.com/irangareddyAgent 工作流0485 次安装37 周前更新
代码仓库

关于 openclaw-cli

openclaw-cli 是用于操作 OpenClaw 的命令行参考技能,面向管理 OpenClaw 的用户。它涵盖网关、Agent、频道、技能及自动化配置与维护。

主要功能

  1. 01网关设置与健康检查
  2. 02Agent 和频道管理
  3. 03技能、钩子与插件管理
  4. 04模型与身份验证设置
  5. 05消息、浏览器与节点控制
  6. 06定时任务、记忆、日志与安全

适用场景

  1. 01设置 OpenClaw 网关和频道
  2. 02配置 Agent、身份及模型回退项
  3. 03检查日志并诊断网关或频道问题

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/irangareddy/openclaw-essentials --skill openclaw-cli

安装后在 Claude Code 中输入/openclaw-cli确认已加载。

附带文件README.md

详细介绍

OpenClaw 命令行界面

openclaw 命令行界面操作完整参考。

适用场景

管理 OpenClaw 网关、Agent、频道、技能、钩子和自动化。

核心命令

设置与入门

初始设置:

# Quick onboarding with daemon install
openclaw onboard --install-daemon

# Setup workspace and config
openclaw setup --workspace ~/.openclaw/workspace

# Interactive configuration
openclaw configure

健康检查:

openclaw doctor
网关管理

运行网关:

# Interactive mode
openclaw gateway

# With specific port
openclaw gateway --port 18789

# With tailscale
openclaw gateway --tailscale serve

网关服务:

# Install as system service
openclaw gateway install

# Control service
openclaw gateway start
openclaw gateway stop
openclaw gateway restart
openclaw gateway status

网关健康状态:

openclaw status
openclaw status --deep     # Probe channels
openclaw health
Agent 管理

列出 Agent:

openclaw agents list
openclaw agents list --bindings    # Show routing

添加 Agent:

# Interactive wizard
openclaw agents add <name>

# Non-interactive
openclaw agents add dev \
  --workspace ~/.openclaw/workspace-dev \
  --model claude-sonnet-4.5 \
  --non-interactive

删除 Agent:

openclaw agents delete <id>

设置身份:

# From IDENTITY.md
openclaw agents set-identity --agent main --from-identity

# Explicit values
openclaw agents set-identity --agent main \
  --name "MyAgent" \
  --emoji "🤖" \
  --avatar avatars/bot.png
技能管理

列出技能:

openclaw skills list
openclaw skills list --eligible    # Only ready skills
openclaw skills list --json        # JSON output

技能信息:

openclaw skills info <skill-name>

检查资格:

openclaw skills check
钩子管理

列出钩子:

openclaw hooks list
openclaw hooks list --eligible
openclaw hooks list --verbose      # Show missing requirements

钩子信息:

openclaw hooks info <hook-name>

启用/停用:

openclaw hooks enable session-memory
openclaw hooks disable command-logger

安装钩子:

# From npm
openclaw hooks install @openclaw/my-hooks

# Local directory
openclaw hooks install ./my-hooks

# Link (development)
openclaw hooks install -l ./my-hooks

更新钩子:

openclaw hooks update <id>
openclaw hooks update --all
频道管理

列出频道:

openclaw channels list

频道状态:

openclaw channels status
openclaw channels status --probe

添加频道:

# Interactive
openclaw channels add

# Telegram bot
openclaw channels add --channel telegram \
  --account alerts \
  --name "Alerts Bot" \
  --token $TELEGRAM_BOT_TOKEN

# Discord
openclaw channels add --channel discord \
  --account work \
  --token $DISCORD_BOT_TOKEN

移除频道:

openclaw channels remove --channel telegram --account alerts
openclaw channels remove --channel discord --account work --delete

WhatsApp 登录:

openclaw channels login --channel whatsapp

频道日志:

openclaw channels logs
openclaw channels logs --channel whatsapp --lines 100
模型与身份验证

状态:

openclaw models status
openclaw models status --probe               # Live check
openclaw models status --probe-provider anthropic

列出模型:

openclaw models list
openclaw models list --all
openclaw models list --provider anthropic

设置默认模型:

openclaw models set claude-sonnet-4.5
openclaw models set-image claude-sonnet-4.5

身份验证设置:

# Anthropic (recommended)
claude setup-token
openclaw models auth setup-token --provider anthropic

# Or paste token
openclaw models auth paste-token --provider anthropic

回退选项:

openclaw models fallbacks list
openclaw models fallbacks add claude-opus-4.6
openclaw models fallbacks remove claude-haiku-4.5
openclaw models fallbacks clear

扫描模型:

openclaw models scan
openclaw models scan --set-default
消息

发送消息:

openclaw message send \
  --target +15555550123 \
  --message "Hello from OpenClaw"

# Discord channel
openclaw message send \
  --channel discord \
  --target channel:123456 \
  --message "Deployment complete"

发送投票:

openclaw message poll \
  --channel discord \
  --target channel:123 \
  --poll-question "Lunch?" \
  --poll-option "Pizza" \
  --poll-option "Sushi"

其他消息操作:

openclaw message read --target +15555550123
openclaw message react --target <id> --emoji "👍"
openclaw message edit --target <id> --message "Updated"
openclaw message delete --target <id>
浏览器控制

状态与控制:

openclaw browser status
openclaw browser start
openclaw browser stop
openclaw browser tabs

导航:

openclaw browser open https://example.com
openclaw browser navigate https://example.com --target-id <id>

交互:

openclaw browser click "#submit-button"
openclaw browser type "#email" "[email protected]"
openclaw browser press Enter

捕获:

openclaw browser screenshot
openclaw browser screenshot --full-page
openclaw browser snapshot --format ai

配置文件:

openclaw browser profiles
openclaw browser create-profile --name dev
openclaw browser delete-profile --name old
节点与设备

列出节点:

openclaw nodes list
openclaw nodes status --connected

节点操作:

# Describe node
openclaw nodes describe --node <id>

# Run command on node
openclaw nodes run --node <id> --cwd /path -- ls -la

# Notify (macOS)
openclaw nodes notify --node <id> \
  --title "Build Complete" \
  --body "Success" \
  --sound default

摄像头:

openclaw nodes camera list --node <id>
openclaw nodes camera snap --node <id> --facing front
openclaw nodes camera clip --node <id> --duration 10s

画布:

openclaw nodes canvas snapshot --node <id>
openclaw nodes canvas present --node <id> --target index.html
openclaw nodes canvas hide --node <id>

屏幕录制:

openclaw nodes screen record --node <id> --duration 30s
系统命令

系统事件:

openclaw system event --text "Deployment complete" --mode now

心跳:

openclaw system heartbeat last
openclaw system heartbeat enable
openclaw system heartbeat disable

在线状态:

openclaw system presence
定时任务

列出任务:

openclaw cron list
openclaw cron list --all
openclaw cron status

添加任务:

# System event every hour
openclaw cron add \
  --name "hourly-check" \
  --every "1h" \
  --system-event "Hourly check"

# Message at specific time
openclaw cron add \
  --name "morning-reminder" \
  --at "09:00" \
  --message "Good morning!"

管理任务:

openclaw cron enable <id>
openclaw cron disable <id>
openclaw cron rm <id>
openclaw cron run <id>

任务运行记录:

openclaw cron runs --id <id> --limit 10
配置

获取/设置配置:

# Get value
openclaw config get agents.defaults.model.primary

# Set value
openclaw config set agents.defaults.model.primary "claude-sonnet-4.5"

# Unset value
openclaw config unset some.config.path
记忆操作

记忆状态:

openclaw memory status

索引记忆:

openclaw memory index

搜索记忆:

openclaw memory search "GraphQL implementation patterns"
日志

追踪日志:

openclaw logs
openclaw logs --follow
openclaw logs --limit 200
openclaw logs --json
沙盒

列出沙盒:

openclaw sandbox list

重新创建沙盒:

openclaw sandbox recreate
安全

安全审计:

openclaw security audit
openclaw security audit --deep
openclaw security audit --fix
插件

列出插件:

openclaw plugins list
openclaw plugins list --json

插件信息:

openclaw plugins info <plugin-id>

安装插件:

openclaw plugins install <path-or-spec>

启用/停用:

openclaw plugins enable <id>
openclaw plugins disable <id>

插件健康状态:

openclaw plugins doctor
更新与维护

更新 OpenClaw:

openclaw update

重置配置:

openclaw reset --scope config
openclaw reset --scope config+creds+sessions
openclaw reset --scope full

卸载:

openclaw uninstall --service
openclaw uninstall --state
openclaw uninstall --workspace
openclaw uninstall --all

全局标志

所有位置均可用:

--dev               # Use ~/.openclaw-dev for isolation
--profile <name>    # Use ~/.openclaw-<name>
--no-color         # Disable ANSI colors
--json             # Machine-readable output
-V, --version      # Show version

常见工作流

首次设置
# 1. Onboard with daemon
openclaw onboard --install-daemon

# 2. Pair WhatsApp (or other channel)
openclaw channels login

# 3. Start gateway
openclaw gateway

# 4. Test with message
openclaw message send --target +1234567890 --message "Test"
多 Agent 设置
# 1. Add agent
openclaw agents add work --workspace ~/.openclaw/workspace-work

# 2. Set identity
openclaw agents set-identity --agent work --from-identity

# 3. Add binding (in openclaw.json)
# bindings: [{ agentId: "work", match: { channel: "discord" } }]

# 4. List to verify
openclaw agents list --bindings
钩子自动化
# 1. Enable session memory hook
openclaw hooks enable session-memory

# 2. Enable command logger
openclaw hooks enable command-logger

# 3. Verify
openclaw hooks check

# 4. Restart gateway
openclaw gateway restart
频道设置
# 1. Add Telegram bot
openclaw channels add --channel telegram \
  --account alerts \
  --token $TELEGRAM_BOT_TOKEN

# 2. Verify
openclaw channels status

# 3. Send test message
openclaw message send --channel telegram \
  --target <chat-id> \
  --message "Bot online"
模型配置
# 1. Setup auth
claude setup-token

# 2. Set default model
openclaw models set claude-sonnet-4.5

# 3. Add fallbacks
openclaw models fallbacks add claude-opus-4.6
openclaw models fallbacks add claude-haiku-4.5

# 4. Verify
openclaw models status

调试

检查网关状态:

openclaw status --deep
openclaw doctor
openclaw health

查看日志:

openclaw logs --follow
openclaw channels logs --lines 200

测试频道:

openclaw channels status --probe

检查技能/钩子:

openclaw skills check
openclaw hooks check
openclaw plugins doctor

提示

  1. 使用 --json 编写脚本 - 所有命令都支持 JSON 输出
  2. 隔离配置文件 - 使用 --profile 进行测试,不影响主配置
  3. Doctor 修复 - 定期运行 openclaw doctor 以发现问题
  4. 日志位置 - 文件日志位于 ~/.openclaw/logs/
  5. 配置位置 - ~/.openclaw/openclaw.json
  6. 工作区 - ~/.openclaw/workspace(或自定义路径)

资源

评论

支持 Markdown