网站首页 全球最实用的IT互联网站!

人工智能P2P分享Wind搜索发布信息网站地图标签大全

当前位置:诺佳网 > 人工智能 > 人形机器人 >

OpenClaw CLI 的核心可以抽象为 5 层:模型(Models)

时间:2026-03-23 09:04

人气:

作者:admin

标签:

导读:OpenClaw CLI 的核心可以抽象为 5 层:模型(Models)↓Agent(智能体)↓Gateway(网关)↓Channels(渠道)↓用户Plugins(扩展能力)Hooks(自动化)Memory(记忆 / RAG)Nodes(远程执行)???? 本质...

在使用 openclaw-cn(中文社区版)openclaw(官方版) 时,CLI 是最核心的操作入口。

两者命令完全一致,唯一差别只是二进制名称:


openclaw-cn # 中文版
openclaw # 官方版

???? 本文统一使用 openclaw-cn


???? 一、安装与初始化

1️⃣ 全局安装


sudo npm i -g openclaw-cn

2️⃣ 安装不同版本


# 稳定版
sudo npm i -g openclaw-cn@latest

# 测试版
sudo npm i -g openclaw-cn@beta

3️⃣ 初始化(强烈推荐)


# 交互式(推荐)
openclaw-cn onboard

# 快速模式
openclaw-cn onboard --flow quickstart

# 自动化(CI/CD)
openclaw-cn onboard --non-interactive \
--auth-choice token \
--token-provider anthropic \
--token "$TOKEN"


⚙️ 二、配置管理(Config)

查询配置


openclaw-cn config get agents.defaults.model.primary
openclaw-cn config get gateway.port

修改配置


openclaw-cn config set agents.defaults.model.primary "doubao-code"
openclaw-cn config set gateway.port 19001 --json

删除配置


openclaw-cn config unset tools.web.search.apiKey


???? 三、网关(Gateway)

???? 核心组件,所有消息/Agent 都依赖它

启动网关


openclaw-cn gateway run --bind loopback --port 18789

强制启动(端口占用时)


openclaw-cn gateway run --force

后台运行(生产环境)


nohup openclaw-cn gateway run --bind loopback --port 18789 --force \
> /tmp/clawdbot-gateway.log 2>&1 &


服务化管理


openclaw-cn gateway install
openclaw-cn gateway start
openclaw-cn gateway stop
openclaw-cn gateway restart


状态检查


openclaw-cn gateway status
openclaw-cn gateway health
openclaw-cn gateway probe


日志查看


openclaw-cn logs --follow
openclaw-cn logs --limit 200 --json


???? 四、模型管理(Models)

查看状态


openclaw-cn models status
openclaw-cn models status --probe

列出模型


openclaw-cn models list

设置默认模型


openclaw-cn models set volcengine/doubao-code


Token 管理


openclaw-cn models auth add
openclaw-cn models auth paste-token


自动扫描模型


openclaw-cn models scan --set-default


???? 五、渠道(Channels)

支持:Telegram / Discord / Slack / WhatsApp

添加渠道


openclaw-cn channels add --channel telegram --token "$TOKEN"

查看状态


openclaw-cn channels status --probe

删除渠道


openclaw-cn channels remove --channel telegram


???? 六、Agent(代理)

创建 Agent


openclaw-cn agents add work --workspace ~/clawd-work

单次调用


openclaw-cn agent --message "你好"

设置身份


openclaw-cn agents set-identity --name "Clawd" --emoji "????"


???? 七、消息发送

发消息


openclaw-cn message send \
--channel telegram \
--target "123456" \
--message "你好"

发文件


openclaw-cn message send --media ./photo.jpg


???? 八、诊断与运维(重点)

一键健康检查


openclaw-cn doctor
openclaw-cn status --deep
openclaw-cn models status --probe

???? 推荐组合:


openclaw-cn doctor && \
openclaw-cn status --deep && \
openclaw-cn models status --probe


???? 九、插件系统(Plugins)

安装插件


openclaw-cn plugins install <plugin>

启用 / 禁用


openclaw-cn plugins enable <plugin-id>
openclaw-cn plugins disable <plugin-id>


???? 十、Hooks(自动化关键)


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

???? 常用:

Hook 作用
session-memory 自动记忆
boot-md 启动执行脚本
command-logger 审计日志

⏰ 十一、定时任务(Cron)


# 每天执行
openclaw-cn cron add --every 24h --system-event "生成日报"

# 指定时间
openclaw-cn cron add --at "2026-03-03T09:00:00" --message "开会提醒"


???? 十二、语义记忆(Memory)


openclaw-cn memory index
openclaw-cn memory search "发布流程"

???? 本质:RAG(向量检索)


???? 十三、沙盒(Sandbox)


openclaw-cn sandbox list
openclaw-cn sandbox recreate --all

???? 用于安全执行代码


???? 十四、浏览器自动化


openclaw-cn browser open https://example.com
openclaw-cn browser screenshot --full-page


????️ 十五、远程节点(Nodes)


openclaw-cn nodes list
openclaw-cn nodes run --node <id> -- ls -la

???? 类似远程 Agent 执行器


???? 十六、更新与重置


# 更新
openclaw-cn update

# 重置配置
openclaw-cn reset --scope config

# 完全重置
openclaw-cn reset --scope full --yes


???? 十七、实用工具


openclaw-cn dashboard # Web UI
openclaw-cn tui # 终端 UI
openclaw-cn docs "Telegram"


???? 十八、常见运维操作(高频)

✅ 重启网关


pkill -9 -f clawdbot-gateway || true

nohup openclaw-cn gateway run \
--bind loopback --port 18789 --force \
> /tmp/clawdbot-gateway.log 2>&1 &


✅ 验证运行状态


openclaw-cn channels status --probe
ss -ltnp | grep 18789
tail -n 120 /tmp/clawdbot-gateway.log


✅ 一键安装


sudo npm i -g openclaw-cn && openclaw-cn onboard


???? 配置路径说明

类型 路径
配置文件 ~/.openclaw/openclaw.json
凭证 ~/.openclaw/credentials/
会话 ~/.openclaw/sessions/
工作区 ~/clawd
日志 /tmp/clawdbot-gateway.log

???? 总结

OpenClaw CLI 的核心可以抽象为 5 层:


模型(Models)

Agent(智能体)

Gateway(网关)

Channels(渠道)

用户

再叠加:

  • Plugins(扩展能力)
  • Hooks(自动化)
  • Memory(记忆 / RAG)
  • Nodes(远程执行)

???? 本质就是一个 本地 AI 操作系统(AI OS)

温馨提示:以上内容整理于网络,仅供参考,如果对您有帮助,留下您的阅读感言吧!
相关阅读
本类排行
相关标签
本类推荐

CPU | 内存 | 硬盘 | 显卡 | 显示器 | 主板 | 电源 | 键鼠 | 网站地图

Copyright © 2025-2035 诺佳网 版权所有 备案号:赣ICP备2025066733号
本站资料均来源互联网收集整理,作品版权归作者所有,如果侵犯了您的版权,请跟我们联系。

关注微信