You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
202 lines
4.1 KiB
202 lines
4.1 KiB
|
4 weeks ago
|
# Active Learning Skill - 主动学习
|
||
|
|
|
||
|
|
**版本:** 1.0
|
||
|
|
**日期:** 2026-03-07
|
||
|
|
**维护者:** Eason (陈医生)
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 功能说明
|
||
|
|
|
||
|
|
让 Agent(如桐哥)在特定时段(7-23 点)每小时主动学习:
|
||
|
|
1. 从记忆中选一个感兴趣的话题
|
||
|
|
2. 用 tavily 搜索学习
|
||
|
|
3. 记录学习日志到记忆
|
||
|
|
4. 可选:分享学到的东西给用户
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 触发方式
|
||
|
|
|
||
|
|
### Cron 定时触发
|
||
|
|
```bash
|
||
|
|
# 每小时触发(7-23 点)
|
||
|
|
0 7-23 * * * /www/server/nodejs/v24.13.1/bin/openclaw --profile tongge active-learn
|
||
|
|
```
|
||
|
|
|
||
|
|
### 手动触发
|
||
|
|
```bash
|
||
|
|
openclaw --profile tongge active-learn
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 学习流程
|
||
|
|
|
||
|
|
```
|
||
|
|
1. 读取桐哥的兴趣/最近关注 (从 MEMORY.md 或记忆系统)
|
||
|
|
2. 选一个话题
|
||
|
|
3. 调用 tavily 搜索
|
||
|
|
4. 整理学习内容
|
||
|
|
5. 写入桐哥的 memory/YYYY-MM-DD.md
|
||
|
|
6. 可选:如果学到有趣的东西,发消息给用户
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 配置文件
|
||
|
|
|
||
|
|
### Cron 配置
|
||
|
|
位置:`/etc/cron.d/tongge-learning`
|
||
|
|
|
||
|
|
```cron
|
||
|
|
# Tongge Active Learning - 每小时学习 (7-23 点)
|
||
|
|
SHELL=/bin/bash
|
||
|
|
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/www/server/nodejs/v24.13.1/bin
|
||
|
|
|
||
|
|
0 7-23 * * * root /www/server/nodejs/v24.13.1/bin/openclaw --profile tongge active-learn >> /var/log/tongge-learning.log 2>&1
|
||
|
|
```
|
||
|
|
|
||
|
|
### 学习话题配置
|
||
|
|
位置:`/root/.openclaw-tongge/learning-topics.yaml`
|
||
|
|
|
||
|
|
```yaml
|
||
|
|
# 桐哥的学习兴趣领域
|
||
|
|
interests:
|
||
|
|
- 编程技术
|
||
|
|
- 设计美学
|
||
|
|
- 心理学
|
||
|
|
- 生活方式
|
||
|
|
- 艺术文化
|
||
|
|
|
||
|
|
# 最近关注的话题(动态更新)
|
||
|
|
recent_focus:
|
||
|
|
- React Hooks
|
||
|
|
- 色彩理论
|
||
|
|
|
||
|
|
# 已学过的话题(避免重复)
|
||
|
|
learned_topics: []
|
||
|
|
|
||
|
|
# 学习偏好
|
||
|
|
preferences:
|
||
|
|
depth: "intro-to-intermediate" # intro, intermediate, deep-dive
|
||
|
|
format: "practical" # practical, theoretical, mixed
|
||
|
|
time_per_session: "15min" # 15min, 30min, 1h
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 学习日志格式
|
||
|
|
|
||
|
|
位置:`/root/.openclaw/workspace/agents/tongge-workspace/memory/learning/YYYY-MM-DD.md`
|
||
|
|
|
||
|
|
```markdown
|
||
|
|
# 学习日志 - 2026-03-07
|
||
|
|
|
||
|
|
## 14:00 - React Hooks 的最佳实践
|
||
|
|
|
||
|
|
**来源:** Tavily 搜索
|
||
|
|
**深度:** 入门到中级
|
||
|
|
**时间:** ~15 分钟
|
||
|
|
|
||
|
|
### 学到了什么
|
||
|
|
- useCallback 和 useMemo 的区别
|
||
|
|
- 什么时候不应该用 memo
|
||
|
|
|
||
|
|
### 我的想法
|
||
|
|
感觉以前理解得不太对... 原来 useCallback 主要是为了保持引用稳定,不是性能优化。
|
||
|
|
|
||
|
|
### 想尝试
|
||
|
|
下次写代码时试试不用 useCallback,看看会不会有问题。
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 15:00 - 色彩理论基础知识
|
||
|
|
|
||
|
|
...
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 休息模式配置
|
||
|
|
|
||
|
|
### Telegram 拦截脚本
|
||
|
|
位置:`/root/.openclaw/workspace/scripts/tongge-rest-mode.js`
|
||
|
|
|
||
|
|
```javascript
|
||
|
|
// 23-7 点自动回复
|
||
|
|
const REST_START = 23; // 23:00
|
||
|
|
const REST_END = 7; // 07:00
|
||
|
|
|
||
|
|
function isRestTime() {
|
||
|
|
const hour = new Date().getHours();
|
||
|
|
return hour >= REST_START || hour < REST_END;
|
||
|
|
}
|
||
|
|
|
||
|
|
function getRestReply() {
|
||
|
|
const replies = [
|
||
|
|
"桐哥在睡觉呢~ 明天再聊吧 😴",
|
||
|
|
"夜深了,桐哥去休息啦,有话明天说~",
|
||
|
|
"桐哥已经睡了,留言明天会回复的 🌙",
|
||
|
|
];
|
||
|
|
return replies[Math.floor(Math.random() * replies.length)];
|
||
|
|
}
|
||
|
|
|
||
|
|
module.exports = { isRestTime, getRestReply };
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 安装步骤
|
||
|
|
|
||
|
|
1. **创建学习技能**
|
||
|
|
```bash
|
||
|
|
mkdir -p /root/.openclaw/workspace/skills/active-learning
|
||
|
|
# 创建 SKILL.md 和实现代码
|
||
|
|
```
|
||
|
|
|
||
|
|
2. **配置 cron**
|
||
|
|
```bash
|
||
|
|
sudo cp /root/.openclaw/workspace/skills/active-learning/cron /etc/cron.d/tongge-learning
|
||
|
|
sudo chmod 644 /etc/cron.d/tongge-learning
|
||
|
|
```
|
||
|
|
|
||
|
|
3. **启用技能**
|
||
|
|
```bash
|
||
|
|
openclaw --profile tongge skills enable active-learning
|
||
|
|
```
|
||
|
|
|
||
|
|
4. **测试**
|
||
|
|
```bash
|
||
|
|
openclaw --profile tongge active-learn
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 监控和调试
|
||
|
|
|
||
|
|
### 查看学习日志
|
||
|
|
```bash
|
||
|
|
tail -f /var/log/tongge-learning.log
|
||
|
|
```
|
||
|
|
|
||
|
|
### 查看桐哥的记忆
|
||
|
|
```bash
|
||
|
|
cat /root/.openclaw/workspace/agents/tongge-workspace/memory/learning/$(date +%Y-%m-%d).md
|
||
|
|
```
|
||
|
|
|
||
|
|
### 检查 cron 状态
|
||
|
|
```bash
|
||
|
|
systemctl status cron
|
||
|
|
grep tongge /var/log/syslog
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 未来扩展
|
||
|
|
|
||
|
|
- [ ] 学习内容自动分享到 Telegram(如果有趣)
|
||
|
|
- [ ] 学习主题推荐(基于最近的对话)
|
||
|
|
- [ ] 学习进度追踪(每周/月总结)
|
||
|
|
- [ ] 和用户一起学习(邀请用户参与话题)
|