🦞 你的 AI 助理,现在不需要 $3,499 的头显也能用了。
版本: OpenClaw 2026.2.14
1. Gateway 网关管理
Gateway 作为 OpenClaw 的核心服务,其职责是桥接各类 AI 模型与外部工具。以下命令帮助你有效地管理网关服务。
# 查看网关状态
openclaw gateway status
# 启动网关服务
openclaw gateway start
# 停止网关服务
openclaw gateway stop
# 重启网关服务
openclaw gateway restart
# 指定端口
openclaw gateway --port 18789
# 开发模式
openclaw --dev gateway
# 安装为系统服务
openclaw gateway install
# 卸载服务
openclaw gateway uninstall
# 健康检查
openclaw gateway health
2. Sessions 会话管理
这部分命令用于管理你与 AI 的对话会话,方便你回溯历史对话或检查资源消耗情况。
# 列出所有会话
openclaw sessions
# 只显示最近 2 小时活跃的会话
openclaw sessions --active 120
# 以 JSON 格式输出
openclaw sessions --json
3. Agents 多智能体
OpenClaw 支持配置多种专业角色的 AI 智能体,你可以像管理一个团队一样管理它们,例如产品经理、架构师、开发工程师等。这些会话管理的核心操作都在这里。
# 列出所有已配置的智能体
openclaw agents list
# 添加新的智能体
openclaw agents add
# 删除智能体
openclaw agents delete
# 更新智能体身份
openclaw agents set-identity
可用智能体角色
| Agent ID |
角色 |
用途 |
main |
主协调员 |
日常对话和任务协调 |
productmanager |
产品经理 |
需求分析、PRD 文档 |
architect |
架构师 |
技术方案设计 |
seniordev |
资深开发 |
核心代码实现 |
testengineer |
测试工程师 |
测试用例、测试报告 |
devops |
运维工程师 |
CI/CD、部署配置 |
调用智能体
当你需要特定专业的智能体处理任务时,可以使用如下命令进行调用:
openclaw sessions_spawn \
--agent-id productmanager \
--task “分析用户管理系统需求”
4. Message 消息收发
通过配置好的渠道(如 Telegram、Discord 等)发送和管理消息,实现自动化的通知与交互。
# 发送文本消息
openclaw message send \
--target +15555550123 \
--message “Hello!”
# 带媒体文件发送
openclaw message send \
--target +15555550123 \
--message “看这张照片” \
--media photo.jpg
# 通过 Telegram 发送
openclaw message send \
--channel telegram \
--target @mychat \
--message “大家好”
# 读取最近消息
openclaw message read \
--channel telegram \
--target @mychat
# 编辑消息
openclaw message edit \
--message-id 12345 \
--message “更新后的内容”
# 删除消息
openclaw message delete \
--message-id 12345
# 添加表情反应
openclaw message react \
--channel discord \
--message-id 456 \
--emoji “✅”
# 创建投票
openclaw message poll \
--channel discord \
--target channel:123 \
--poll-question “吃什么?” \
--poll-option “披萨” \
--poll-option “寿司”
5. Browser 浏览器控制
控制一个专用浏览器实例进行网页自动化操作,比如数据抓取、自动化测试或截图。
# 查看浏览器状态
openclaw browser status
# 启动浏览器
openclaw browser start
# 停止浏览器
openclaw browser stop
# 列出所有标签页
openclaw browser tabs
# 打开新标签页
openclaw browser open https://example.com
# 截取屏幕截图
openclaw browser screenshot
# 截取完整页面
openclaw browser screenshot --full-page
# 捕获页面快照
openclaw browser snapshot
# 点击元素
openclaw browser click 12
# 输入文本
openclaw browser type 23 “hello”
# 按键
openclaw browser press Enter
# 保存页面为 PDF
openclaw browser pdf
# 执行 JavaScript
openclaw browser evaluate \
--fn ‘(el) => el.textContent’ \
--ref 7
6. Cron 定时任务
用于设置和管理周期性自动执行的任务,类似于系统的 cron 服务。
# 查看调度器状态
openclaw cron status
# 列出所有任务
openclaw cron list
# 添加新任务
openclaw cron add
# 编辑任务
openclaw cron edit
# 启用/禁用任务
openclaw cron enable
openclaw cron disable
# 删除任务
openclaw cron rm
# 立即执行任务
openclaw cron run <jobId>
# 查看执行历史
openclaw cron runs <jobId>
7. Skills 技能管理
OpenClaw 的功能可以通过安装“技能”来扩展。这里管理着你已安装和可用的技能。
# 列出所有可用技能
openclaw skills list
# 查看技能详细信息
openclaw skills info <skill-name>
# 检查技能依赖
openclaw skills check
使用 ClawHub 安装技能
ClawHub 是 OpenClaw 的技能市场,你可以从中搜索和安装社区贡献的丰富技能。
# 搜索技能
clawhub search wechat
# 安装技能
clawhub install wechat-publisher
# 更新所有技能
clawhub sync
8. Config 配置管理
管理 OpenClaw 的运行时配置,可以动态调整各项参数而无需重启服务。
# 启动配置向导
openclaw config
# 获取配置值
openclaw config get gateway.port
# 设置配置值
openclaw config set gateway.port 18789
# 删除配置值
openclaw config unset gateway.port
📚 参考资料
希望这份命令指南能帮助你更高效地驾驭 OpenClaw。如果你在实践过程中有更多心得或疑问,欢迎到各类开发者社区交流分享。🦞