1 安装与启动
# npm安装
npm install -g openclaw
openclaw --version
# Docker启动
docker pull openclaw/openclaw:latest
docker run -d \
--name openclaw \
-p 8080:8080 \
-v $(pwd)/config:/app/config \
-e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
openclaw/openclaw:latest
# 查看运行状态
docker logs openclaw -f
docker ps | grep openclaw
# 重启
docker restart openclaw
# 停止
docker stop openclaw
2 配置管理
# 验证配置文件
openclaw config validate
# 查看当前配置
openclaw config show
# 设置环境变量
openclaw config set ANTHROPIC_API_KEY "sk-ant-xxx"
# 重载配置(不需要重启)
openclaw config reload
# 备份配置
openclaw config export > backup-$(date +%Y%m%d).json
# 恢复配置
openclaw config import backup-20260310.json
3 技能管理
# 列出已安装技能
openclaw skill list
# 安装技能(ClawHub)
openclaw skill install seo-analyzer
# 安装特定版本
openclaw skill install seo-analyzer@2.0.0
# 更新技能
openclaw skill update seo-analyzer
# 更新所有技能
openclaw skill update --all
# 卸载技能
openclaw skill uninstall seo-analyzer
# 查看技能详情
openclaw skill info seo-analyzer
# 本地开发技能
openclaw skill dev ./my-skill#
发布技能
openclaw skill publish
4 Agent 管理
# 列出所有Agent
openclaw agent list
# 查看Agent状态
openclaw agent status my-agent
# 启动Agent
openclaw agent start my-agent
# 停止Agent
openclaw agent stop my-agent
# 重启Agent
openclaw agent restart my-agent
# 查看Agent日志(查看最后100行)
openclaw agent logs my-agent --tail 100
# 给Agent发送消息(CLI模式)
openclaw agent chat my-agent "你好,今天有什么任务?"
5 监控与诊断
# 查看系统状态
openclaw status
# 查看资源使用
openclaw stats
# 查看今日成本
openclaw cost today
# 查看本月成本
openclaw cost month
# 实时日志
openclaw logs --follow
# 导出日志
openclaw logs --export logs-$(date +%Y%m%d).txt
# 诊断常见问题
openclaw doctor
# 重置(慎用!会清除所有配置)
openclaw reset --confirm
6 外部工具后端管理
OpenClaw 不使用 MCP 作为核心协议,而是通过 Skills + CLI 管理工具;如需对接外部工具服务器,可使用 mcporter。
# 安装 ClawHub 上的技能
clawhub install <skill-slug>
# 更新所有已安装的技能
clawhub update --all
# 同步(扫描 + 发布更新)
clawhub sync --all
国内最大OpenClaw Skills商店:https://hub.cocoloop.cn/