# 桐哥作息配置 - Active Learning + Rest Mode **版本:** 1.0 **日期:** 2026-03-07 **维护者:** Eason (陈医生) --- ## 功能概述 **时区:** Asia/Hong_Kong (UTC+8) | 功能 | 时段 (香港时间) | 说明 | |------|----------------|------| | **主动学习** | 7:00-23:00 (每小时) | 桐哥主动学习一个话题,记录到记忆 | | **休息模式** | 23:00-7:00 | 自动回复"在睡觉",不处理消息 | | **紧急穿透** | 24 小时 | 包含"紧急"等关键词的消息正常处理 | --- ## 文件位置 | 文件 | 路径 | 用途 | |------|------|------| | 学习技能 | `/root/.openclaw/workspace/skills/active-learning/` | 技能定义和脚本 | | Cron 配置 | `/etc/cron.d/tongge-learning` | 每小时触发学习 | | 休息模式 | `/root/.openclaw/workspace/skills/active-learning/rest-mode.js` | 休息自动回复 | | 学习日志 | `/root/.openclaw/workspace/agents/tongge-workspace/memory/learning/` | 每日学习记录 | | 系统日志 | `/var/log/tongge-learning.log` | Cron 运行日志 | --- ## 配置详情 ### 主动学习 (Cron) **触发时间:** 每小时整点 (7:00, 8:00, ..., 23:00) **Cron 表达式:** ```cron 0 7-23 * * * root /www/server/nodejs/v24.13.1/bin/node /root/.openclaw/workspace/skills/active-learning/learn.js ``` **学习流程:** 1. 检查是否休息时间(是则跳过) 2. 随机选择一个学习话题 3. 调用 tavily 搜索学习 4. 写入学习日志到 `memory/learning/YYYY-MM-DD.md` **学习话题:** - 编程技术 - 设计美学 - 心理学 - 生活方式 - 艺术文化 - 科技发展 - 历史文化 - 健康养生 --- ### 休息模式 **休息时间:** 23:00 - 07:00 **自动回复语料:** ``` - "桐哥在睡觉呢~ 明天再聊吧 😴" - "夜深了,桐哥去休息啦,有话明天说~" - "桐哥已经睡了,留言明天会回复的 🌙" - "现在是桐哥的休息时间,明天找你聊哦~" - "桐哥充电中🔋,明天满血复活再聊!" ``` **紧急关键词(穿透休息模式):** - 中文:`紧急`, `急事`, `救命` - 英文:`help`, `emergency` --- ## 管理命令 ### 查看学习日志 ```bash # 今天的学习日志 cat /root/.openclaw/workspace/agents/tongge-workspace/memory/learning/$(date +%Y-%m-%d).md # 实时查看 Cron 日志 tail -f /var/log/tongge-learning.log ``` ### 测试学习脚本 ```bash # 手动触发学习(非休息时间) node /root/.openclaw/workspace/skills/active-learning/learn.js # 测试休息模式 node /root/.openclaw/workspace/skills/active-learning/rest-mode.js ``` ### 检查 Cron 状态 ```bash # 查看 cron 服务状态 systemctl status cron # 查看桐哥的学习 cron 日志 grep tongge /var/log/syslog # 验证 cron 配置 crontab -l | grep tongge # 如果是用户 cron cat /etc/cron.d/tongge-learning # 系统 cron ``` ### 修改作息时间 编辑 `/root/.openclaw/workspace/skills/active-learning/rest-mode.js`: ```javascript const REST_START = 23; // 修改开始时间 const REST_END = 7; // 修改结束时间 ``` 编辑 `/etc/cron.d/tongge-learning`: ```cron # 修改学习时段(例如 9-21 点) 0 9-21 * * * root ... ``` --- ## 故障排查 ### 学习没有触发 1. 检查 cron 服务:`systemctl status cron` 2. 检查 cron 日志:`grep tongge /var/log/syslog` 3. 手动运行脚本:`node /root/.openclaw/workspace/skills/active-learning/learn.js` ### 休息时间没有自动回复 1. 确认当前时间:`date` 2. 测试休息模式脚本:`node /root/.openclaw/workspace/skills/active-learning/rest-mode.js` 3. 检查 Telegram Bot 是否正常:`curl https://api.telegram.org/bot/getWebhookInfo` ### 紧急消息被拦截 1. 检查关键词配置:`grep URGENCY_KEYWORDS rest-mode.js` 2. 添加更多关键词到 `URGENCY_KEYWORDS` 数组 --- ## 未来扩展 - [ ] 学习内容自动分享到 Telegram(如果有趣) - [ ] 学习主题推荐(基于最近的对话) - [ ] 学习进度追踪(每周/月总结) - [ ] 和用户一起学习(邀请用户参与话题) - [ ] 根据桐哥的兴趣动态调整学习话题权重 --- ## 变更记录 | 日期 | 变更 | 操作者 | |------|------|--------| | 2026-03-07 | 初始版本:主动学习 + 休息模式 | Eason |