请添加图片描述

一、对话框中可直接使用的命令(Slash Commands)

基于 slash-commands.md 和源码分析,OpenClaw 提供以下可在聊天界面直接输入的命令:

📊 信息查询类命令

命令 功能 示例
/help 显示帮助信息 /help
/commands 列出所有可用命令 /commands
/status 显示当前状态,包含提供商使用配额 /status
/whoami/id 显示你的发送者 ID /whoami
/context [list|detail|json] 显示上下文详情,detail 显示每个文件/工具/skill 的大小 /context detail
/usage [off|tokens|full|cost] 控制每响应 token/cost 的显示 /usage tokens

🔄 会话管理类命令

命令 功能 示例
/new [model] 开始新会话,可选模型提示 /new/new anthropic/claude-opus-4
/reset 重置当前会话 /reset
/session ttl <duration|off> 管理会话级别设置(如 TTL) /session ttl 24h
/kill <id|#|all> 立即中止一个或所有运行中的子代理 /kill all
/compact [instructions] 压缩会话上下文 /compact

🎛️ 行为控制类命令

命令 功能 示例
/think <off|minimal|low|medium|high|xhigh> 动态设置思考级别(别名 /thinking, /t /think high
/verbose on|full|off 启用详细输出(别名 /v /verbose on
/reasoning on|off|stream 单独显示推理内容(别名 /reason /reasoning on
/elevated on|off|ask|full 提升权限级别(别名 /elev /elevated on
/model <name> 选择模型(别名 /models /model list/model opus
/queue <mode> 控制队列模式 /queue 查看当前设置

📦 插件与工具类命令

命令 功能 示例
/skill <name> [input] 按名称运行 skill /skill my-skill arg1
/exec [host=<sandbox|gateway|node>] [security=<deny|allowlist|full>] [ask=<off|on-miss|always>] 发送 exec 到指定目标 /exec 查看当前设置
/bash <command> 在主机上运行 shell 命令(需 commands.bash: true /bash ls -la
!<command> !<command> 的别名 !ls -la

🔧 配置管理类命令

命令 功能 示例
/config show|get|set|unset 持久化配置到磁盘(需 commands.config: true /config show
/debug show|set|unset|reset 运行时配置覆盖(需 commands.debug: true /debug show

🌐 渠道控制类命令

命令 功能 示例
/dock-telegram 切换回复到 Telegram /dock-telegram
/dock-discord 切换回复到 Discord /dock-discord
/dock-slack 切换回复到 Slack /dock-slack
/activation mention|always 群组中设置激活方式 /activation mention
/send on|off|inherit 控制发送策略 /send on

📋 子代理相关命令

命令 功能 示例
/subagents list|kill|log|info|send|steer|spawn 检查、控制或生成子代理 /subagents list
/agents 列出线程绑定的代理 /agents
/focus <target> 绑定线程到会话/子代理目标 /focus my-agent
/unfocus 移除当前线程绑定 /unfocus
/steer <id|#> <message>/tell <id|#> <message> 引导运行中的子代理 /steer 1 继续执行

🔌 其他实用命令

命令 功能 示例
/allowlist 列出/添加/删除允许列表条目 /allowlist list
/approve <id> allow-once|allow-always|deny 解决 exec 批准提示 /approve 123 allow-once
/export-session [path] 导出会话到 HTML(别名 /export /export-session ~/session.html
/stop 停止当前运行 /stop
/restart 重启网关 /restart
/tts off|always|inbound|tagged|status|provider|limit|summary|audio 控制 TTS /tts status

📝 特殊格式说明

  • 命令参数分隔符:命令和参数之间可以使用可选的 :(如 /think: high
  • 指令模式:单独的指令消息会持久化到会话并回复确认
  • 内联快捷方式:部分命令也可以嵌入普通消息中(如 hey /status

二、终端运行的 CLI 命令(openclaw <command>

基于 CLI 文档,OpenClaw 提供以下终端命令:

🚀 核心管理命令

命令 功能 示例
openclaw setup 初始化配置和工作区 openclaw setup --workspace ~/.openclaw/workspace
openclaw onboard 交互式设置向导 openclaw onboard --mode local
openclaw configure 交互式配置(凭证、设备、代理默认值) openclaw configure
openclaw dashboard 打开 Control UI openclaw dashboard --no-open
openclaw doctor 健康检查和修复 openclaw doctor --repair --deep
openclaw update 更新 OpenClaw openclaw update --channel beta
openclaw reset 重置本地状态 openclaw reset --dry-run
openclaw uninstall 卸载网关服务和本地数据 openclaw uninstall --all --yes

⚙️ 配置命令

命令 功能 示例
openclaw config get <path> 获取配置值 openclaw config get gateway.port
openclaw config set <path> <value> 设置配置值 openclaw config set gateway.port 19001 --strict-json
openclaw config unset <path> 移除配置 openclaw config unset agents.defaults.heartbeat

🌐 网关服务命令

命令 功能 示例
openclaw gateway run 前台运行网关 openclaw gateway run --port 19001
openclaw gateway status 网关状态 openclaw gateway status --json
openclaw gateway health 健康检查 openclaw gateway health --url ws://127.0.0.1:18789
openclaw gateway probe 探测所有网关 openclaw gateway probe
openclaw gateway call <method> 低级 RPC 调用 openclaw gateway call status
openclaw gateway install 安装网关服务 openclaw gateway install --port 18789
openclaw gateway start/stop/restart 服务生命周期 openclaw gateway restart

💬 渠道管理命令

命令 功能 示例
openclaw channels list 列出配置的渠道 openclaw channels list
openclaw channels status 渠道状态 openclaw channels status
openclaw channels add --channel <name> 添加渠道账号 openclaw channels add --channel telegram --token <bot-token>
openclaw channels remove --channel <name> 移除渠道 openclaw channels remove --channel whatsapp --delete
openclaw channels login --channel <name> 交互式登录 openclaw channels login --channel whatsapp
openclaw channels resolve --channel <name> <targets> 解析名称到 ID openclaw channels resolve --channel slack "#general" "@jane"
openclaw channels logs --channel all 查看渠道日志 openclaw channels logs --channel all

🤖 代理(Agent)管理命令

命令 功能 示例
openclaw agents list 列出所有代理 openclaw agents list
openclaw agents add <id> --workspace <path> 添加代理 openclaw agents add work --workspace ~/.openclaw/workspace-work
openclaw agents delete <id> 删除代理 openclaw agents delete work
openclaw agents set-identity 设置代理身份 openclaw agents set-identity --from-identity

💬 会话管理命令

命令 功能 示例
openclaw sessions 列出存储的会话 openclaw sessions --all-agents
openclaw sessions --active <minutes> 列出活跃会话 openclaw sessions --active 120
openclaw sessions cleanup --dry-run 预览会话清理 openclaw sessions cleanup --dry-run
openclaw sessions cleanup --enforce 执行会话清理 openclaw sessions cleanup --enforce

🤖 模型管理命令

命令 功能 示例
openclaw models status 模型状态 openclaw models status --probe
openclaw models list 列出可用模型 openclaw models list
openclaw models set <model-or-alias> 设置默认模型 openclaw models set anthropic/claude-opus-4-6
openclaw models scan 扫描可用模型 openclaw models scan
openclaw models aliases list 列出模型别名 openclaw models aliases list
openclaw models fallbacks list 列出回退模型 openclaw models fallbacks list
openclaw models auth add 添加模型认证 openclaw models auth add

🧠 记忆管理命令

命令 功能 示例
openclaw memory status 显示索引状态 openclaw memory status --deep
openclaw memory index 重新索引记忆文件 openclaw memory index --verbose
openclaw memory search "<query>" 语义搜索记忆 openclaw memory search "release checklist"

定时任务命令

命令 功能 示例
openclaw cron status Cron 状态 openclaw cron status
openclaw cron list 列出所有 cron 作业 openclaw cron list
openclaw cron add <options> 添加 cron 作业 openclaw cron add --name "daily" --every "24h" --message "Check in"
openclaw cron edit <job-id> 编辑 cron 作业 openclaw cron edit <job-id> --announce
openclaw cron rm <job-id> 删除 cron 作业 openclaw cron rm my-job
openclaw cron enable/disable <job-id> 启用/禁用作业 openclaw cron disable daily-report
openclaw cron runs <job-id> 查看作业运行记录 openclaw cron runs daily-report
openclaw cron run <job-id> 立即运行作业 openclaw cron run my-job

📊 日志与监控命令

命令 功能 示例
openclaw logs 尾随网关日志 openclaw logs --follow --json
openclaw logs --limit <n> 限制日志行数 openclaw logs --limit 500
openclaw health 健康检查 openclaw health --verbose
openclaw status 诊断状态 openclaw status --deep --usage

🌳 节点管理命令

命令 功能 示例
openclaw nodes list 列出节点 openclaw nodes list --connected
openclaw nodes pending 待批准的节点 openclaw nodes pending
openclaw nodes approve <requestId> 批准节点 openclaw nodes approve abc123
openclaw nodes status 节点状态 openclaw nodes status --connected
openclaw nodes invoke --node <id> --command <cmd> 调用节点命令 openclaw nodes invoke --node my-node --command system.info
openclaw nodes run --node <id> --raw "<command>" 在节点上运行命令 openclaw nodes run --node server1 --raw "git status"

🖥️ 节点主机命令

命令 功能 示例
openclaw node run --host <host> --port <port> 前台运行节点主机 openclaw node run --host 192.168.1.100 --port 18789
openclaw node install --host <host> --port <port> 安装节点服务 openclaw node install --host 192.168.1.100
openclaw node status/start/stop/restart 服务生命周期 openclaw node restart
openclaw node uninstall 卸载节点服务 openclaw node uninstall

🔐 安全与权限命令

命令 功能 示例
openclaw security audit 安全审计 openclaw security audit --deep
openclaw security audit --fix 修复安全问题 openclaw security audit --fix --json
openclaw approvals get 获取 exec 批准 openclaw approvals get
openclaw approvals set --file <path> 从文件设置批准 openclaw approvals set --file ./approvals.json
openclaw approvals allowlist add "<pattern>" 添加批准白名单 openclaw approvals allowlist add "~/Projects/**/bin/rg"
openclaw approvals allowlist remove "<pattern>" 移除白名单条目 openclaw approvals allowlist remove "~/Projects/**/bin/rg"
openclaw pairing list <channel> 列出配对请求 openclaw pairing list telegram
openclaw pairing approve <channel> <code> 批准配对 openclaw pairing approve telegram ABC123
openclaw devices list 列出设备 openclaw devices list
openclaw devices approve [requestId] 批准设备 openclaw devices approve
openclaw devices reject <requestId> 拒绝设备 openclaw devices reject abc123
openclaw devices clear --yes 清除所有设备 openclaw devices clear --yes

🐳 沙箱管理命令

命令 功能 示例
openclaw sandbox list 列出沙箱容器 openclaw sandbox list --json
openclaw sandbox explain 显示有效沙箱策略 openclaw sandbox explain --json
openclaw sandbox recreate --all 重建所有沙箱 openclaw sandbox recreate --all --force
openclaw sandbox recreate --session <key> 重建特定会话沙箱 openclaw sandbox recreate --session main
openclaw sandbox recreate --browser 仅重建浏览器沙箱 openclaw sandbox recreate --browser

🛠️ 工具与插件命令

命令 功能 示例
openclaw plugins list 列出插件 openclaw plugins list
openclaw plugins info <id> 插件详情 openclaw plugins info my-plugin
openclaw plugins install <spec> 安装插件 openclaw plugins install ./my-plugin.tgz
openclaw plugins enable/disable <id> 启用/禁用插件 openclaw plugins enable my-plugin
openclaw plugins doctor 诊断插件加载 openclaw plugins doctor
openclaw hooks list 列出钩子 openclaw hooks list --verbose
openclaw hooks info <name> 钩子详情 openclaw hooks info session-memory
openclaw skills list 列出技能 openclaw skills list --eligible
openclaw skills info <name> 技能详情 openclaw skills info my-skill
openclaw skills check 检查技能可用性 openclaw skills check

🌐 Web 和 API 命令

命令 功能 示例
openclaw message send --channel <name> --target <dest> --message "<text>" 发送消息 openclaw message send --channel telegram --target 123456 --message "Hello"
openclaw hooks list/info/check/enable/disable/install/update Hook 管理 openclaw hooks list
openclaw webhooks gmail setup|run Gmail Webhook openclaw webhooks gmail setup
openclaw acp --url <url> --token <token> ACP 桥接 openclaw acp --url wss://gateway:18789 --token xxx
openclaw acp client ACP 客户端调试 openclaw acp client

🌐 发现和目录命令

命令 功能 示例
openclaw directory peers list --channel <name> 列出联系人 openclaw directory peers list --channel slack
openclaw directory groups list --channel <name> 列出群组 openclaw directory groups list --channel discord
openclaw directory self --channel <name> 获取自身信息 openclaw directory self --channel zalouser
openclaw dns setup DNS 设置 openclaw dns setup --apply

🖥️ 浏览器控制命令

命令 功能 示例
openclaw browser tabs 列出标签页 openclaw browser --browser-profile openclaw tabs
openclaw browser open <url> 打开 URL openclaw browser open https://example.com
openclaw browser screenshot 截图 openclaw browser screenshot
openclaw browser snapshot 页面快照 openclaw browser snapshot
openclaw browser navigate <url> 导航 openclaw browser navigate https://example.com
openclaw browser click <ref> 点击元素 openclaw browser click button-submit
openclaw browser type <ref> "<text>" 输入文本 openclaw browser type input-name "hello"
openclaw browser profiles 列出浏览器配置 openclaw browser profiles
openclaw browser create-profile --name <name> 创建配置 openclaw browser create-profile --name work --color "#FF5A36"
openclaw browser extension install 安装扩展 openclaw browser extension install
openclaw browser extension path 扩展路径 openclaw browser extension path

🔧 系统命令

命令 功能 示例
openclaw system event --text "<message>" --mode now 发送系统事件 openclaw system event --text "Check updates" --mode now
openclaw system heartbeat enable/disable 心跳控制 openclaw system heartbeat disable
openclaw system heartbeat last 上次心跳 openclaw system heartbeat last
openclaw system presence 系统存在列表 openclaw system presence --json

📚 文档和帮助命令

命令 功能 示例
openclaw docs <query> 搜索文档 openclaw docs browser extension
openclaw qr 生成 iOS 配对 QR openclaw qr --json
openclaw qr --setup-code-only 仅显示设置码 openclaw qr --setup-code-only
openclaw completion --shell zsh --install 安装 shell 补全 openclaw completion --shell zsh --install

📋 Legacy/其他命令

命令 功能 示例
openclaw daemon status/start/stop/restart/install/uninstall 守护进程管理(legacy) openclaw daemon status
openclaw clawbot qr Clawbot QR(legacy) openclaw clawbot qr
openclaw voicecall 语音通话(插件) openclaw voicecall

🔧 全局选项

所有命令支持以下全局选项:

选项 功能
--dev 隔离状态到 ~/.openclaw-dev,默认端口改为 19001
--profile <name> 隔离状态到 ~/.openclaw-<name>
--no-color 禁用 ANSI 颜色
--json 机器可读的 JSON 输出
-V, --version 打印版本
-v, --verbose 详细输出
Logo

小龙虾开发者社区是 CSDN 旗下专注 OpenClaw 生态的官方阵地,聚焦技能开发、插件实践与部署教程,为开发者提供可直接落地的方案、工具与交流平台,助力高效构建与落地 AI 应用

更多推荐