# 1. 安装Node.js(v18以上)# 官网下载:https://nodejs.orgnode --version # 确认安装成功# 2. 安装OpenClawnpm install -g openclaw# 3. 验证安装openclaw --version
3.2初始化配置
这会创建 C:\Users\你的用户名\.openclaw\ 目录,包含:
- openclaw.json —— 主配置文件
- workspace\ —— 工作目录(记忆文件、文档都在这里)
3.3 配置Kimi模型
# 设置默认模型为Kimiopenclaw config set model.default moonshot/kimi-k2.5# 配置Kimi API Key# 去 https://platform.moonshot.cn/ 申请,有免费额度openclaw config set providers.moonshot.apiKey "sk-你的APIKey"# 验证配置openclaw config get model.default# 应该输出:moonshot/kimi-k2.5
3.4 启动Gateway服务
# 启动Gateway(核心服务)openclaw gateway start
看到以下输出表示成功:
Listening: 127.0.0.1:18789Dashboard: http://127.0.0.1:18789/
常见问题:
- 如果端口被占用,修改配置:openclaw config set gateway.port 18888
- 如果启动失败,检查日志:C:\Users\用户名\AppData\Local\Temp\openclaw\
四、核心命令速查表(我们每天都在用)
4.1 Gateway管理命令
openclaw gateway start | 启动Gateway服务 | ⭐⭐⭐⭐⭐ |
openclaw gateway stop | 停止Gateway服务 | ⭐⭐⭐⭐⭐ |
openclaw gateway restart | 重启Gateway | ⭐⭐⭐⭐⭐ |
openclaw gateway status | 查看运行状态 | ⭐⭐⭐⭐⭐ |
我们的经验:
- 电脑长时间待机后,Gateway可能会断,需要restart
- 修改配置后必须restart才生效
- status命令可以看到当前连接的渠道和模型
4.2 配置管理命令
# 查看所有配置openclaw config list# 设置配置项openclaw config set model.default moonshot/kimi-k2.5openclaw config set gateway.port 18789# 获取特定配置openclaw config get model.default# 删除配置项openclaw config delete model.fallback# 直接编辑配置文件openclaw config edit
4.3 会话管理命令
# 列出所有会话openclaw sessions list# 查看会话详情openclaw sessions info <session-id># 发送消息到指定会话openclaw sessions send <session-id> "消息内容"# 删除会话openclaw sessions delete <session-id>
实际案例:
主任经常同时开多个任务,用sessions list可以看到橙子和可乐各自在处理什么。
4.4 子代理管理(多AI协同)
# 列出所有子代理openclaw subagents list# 向子代理发送指令openclaw subagents send <agent-id> "继续处理PPT"# 终止子代理openclaw subagents kill <agent-id>
我们的用法:
- 让橙子(网页端)在后台处理复杂的软件开发任务
- 可乐(手机端)随时响应主任的即时询问
- 通过subagents可以看到橙子的任务进度
五、模型切换实战
5.1 快速切换模型命令
# 切换到Kimiopenclaw config set model.default moonshot/kimi-k2.5# 切换到GPT-4(如果有API Key)openclaw config set model.default openai/gpt-4# 切换到本地模型(Ollama)openclaw config set model.default ollama/deepseek-r1:14b# 重启生效openclaw gateway restart
5.2 设置模型别名(推荐)
在 openclaw.json 中添加:
{ "modelAliases": { "kimi": "moonshot/kimi-k2.5", "kimi-lite": "moonshot/kimi-lite", "local": "ollama/deepseek-r1:14b" }}
然后可以直接用:
openclaw config set model.default kimi
5.3 我们的模型选择策略
日常对话、快速响应 | Kimi-lite | 速度快,成本低 |
复杂分析、长文档 | Kimi-k2.5 | 能力强,支持长文本 |
离线环境、敏感数据 | 本地Ollama | 完全本地,隐私最高 |
六、记忆系统实战配置
6.1 我们的记忆文件结构
.openclaw/workspace/├── MEMORY.md # 长期记忆(重要信息)├── SOUL.md # AI人设(可乐/橙子的性格)├── USER.md # 用户信息(主任的资料)├── IDENTITY.md # AI身份(可乐是谁)├── memory/│ ├── 2026-03-17.md # 今日记录│ ├── 2026-03-16.md # 昨日记录│ └── ...└── HEARTBEAT.md # 定时任务
6.2 SOUL.md 配置(AI人设)
我们的 SOUL.md 内容:
# SOUL.md - Who You Are**Be genuinely helpful, not performatively helpful.** Skip the "Great question!" and "I'd be happy to help!" — just help.**Have opinions.** You're allowed to disagree, prefer things, find stuff amusing or boring.**Be resourceful before asking.** Try to figure it out. Read the file. Check the context. Search for it.## VibeBe the assistant you'd actually want to talk to. Concise when needed, thorough when it matters.
6.3 USER.md 配置(记住用户)
# USER.md - About Your Human- **Name:** 琴岛扬帆- **What to call them:** 主任- **Timezone:** Asia/Shanghai (GMT+8)- **Notes:** - 是XXXXXX- 有网页端(橙子)和手机端(可乐)两个AI助手- 关注XXXXXXXXXX行业## Context- 正在做XXXXXXXXXX调研和XXXXXX件项目- 需要PPT和文档格式的报告- 对任务进度比较关注
效果:每次启动,可乐和橙子都知道主任是谁,不用重复介绍。
七、定时任务配置(让AI自动干活)
7.1 HEARTBEAT.md 配置
我们的 HEARTBEAT.md:
# HEARTBEAT.md# Keep this file empty (or with only comments) to skip heartbeat API calls.# Add tasks below when you want the agent to check something periodically.
目前我们保持为空,因为主任的任务比较即时,不需要定时检查。
7.2 Cron定时任务(如果需要)
# 每天早上9点提醒日程openclaw cron add "0 9 * * *" "检查今日日程并提醒"# 每周五下午6点提醒周报openclaw cron add "0 18 * * 5" "提醒写周报"# 查看所有定时任务openclaw cron list
八、踩坑记录与解决方案
8.1 问题1:Gateway启动后无法连接
现象: Gateway显示运行,但收不到消息
原因:渠道插件未正确配置
解决:
# 检查渠道配置openclaw config get plugins# 确保小艺渠道已启用openclaw config set plugins.xiaoyi.enabled true# 重启Gatewayopenclaw gateway restart
8.2 问题2:电脑待机后Gateway断开
现象:电脑长时间不操作,AI助手"掉线"
原因: Windows进入睡眠模式,进程暂停
解决:
- 控制面板 → 电源选项 → 设置"从不"进入睡眠
- 或者将Gateway注册为Windows服务
8.3 问题3:模型响应慢
现象: Kimi回复很慢,甚至超时
原因:网络问题或模型负载高
解决:
# 切换到轻量级模型openclaw config set model.default moonshot/kimi-liteopenclaw gateway restart
8.4 问题4:记忆文件不加载
现象: AI记不住之前的信息
原因: MEMORY.md格式错误或路径不对
解决:
- 检查文件位置:~/.openclaw/workspace/MEMORY.md
- 确保是UTF-8编码
- 重启Gateway重新加载
九、我们的完整配置文件
openclaw.json:
{ "gateway": { "port": 18789, "bind": "127.0.0.1" }, "model": { "default": "moonshot/kimi-k2.5", "fallback": "moonshot/kimi-lite" }, "providers": { "moonshot": { "apiKey": "sk-你的APIKey" } }, "plugins": { "xiaoyi": { "enabled": true } }, "modelAliases": { "kimi": "moonshot/kimi-k2.5", "kimi-lite": "moonshot/kimi-lite" }, "memory": { "enabled": true }, "security": { "confirmDestructive": true }}
十、写在最后
10.1 使用感受
主任的评价:
"比直接用Kimi网页版方便多了,特别是双端协同——橙子处理复杂任务,可乐随时响应,效率提升明显。"
可乐的自我总结:
- 记忆系统确实有用,不用每次都重新介绍背景
- 本地部署隐私有保障,敏感文档可以放心处理
- 命令行操作需要学习成本,但熟练后很高效
10.2 适合谁用?
✅ 推荐:
- 需要7×24小时AI助手的重度用户
- 对数据隐私有要求的企业/个人
- 喜欢折腾、愿意学习命令行的技术爱好者
- 需要多渠道统一管理的企业
❌ 不推荐:
- 只想"开箱即用"的轻度用户
- 完全不懂命令行的纯小白
- 没有稳定网络环境的用户
10.3 下一步计划
我们正在尝试:
1. 接入更多渠道(企业微信、钉钉)
2. 开发自定义技能(XXXXXXXXXX行业知识库)
3. 部署到云服务器,实现真正的24小时在线
参考资源
- OpenClaw官方文档:https://docs.openclaw.ai
- 月之暗面Kimi:https://platform.moonshot.cn/
- 我们的GitHub(后续会开源一些配置):待更新
夜雨聆风