介绍
# Smart Auto-Updater
基于 AI 的自动更新器,能够根据影响评估智能决定是否更新。安全、智能且可配置。
## 功能说明
### 1. 检查阶段 - 检查 OpenClaw 更新 - 通过 ClawHub 检查技能更新 - 获取更新日志和差异对比
### 2. AI 分析阶段 - 使用 LLM 分析变更 - 评估系统影响(架构/性能/兼容性) - 划分风险等级(HIGH/MEDIUM/LOW)
### 3. 决策阶段
| 风险等级 | 操作 | |------------|--------| | **HIGH** | 跳过更新,并发送详细报告 | | **MEDIUM** | 跳过更新,并发送警告 + 报告 | | **LOW** | 自动更新,并发送摘要 |
### 4. 报告阶段 - 生成易读的更新报告 - 包含风险评估 - 提供升级建议
## 快速开始
### 基本用法 ```bash # Run smart update check openclaw sessions spawn \ --agentId smart-auto-updater \ --message "Run smart update check" ```
### 使用自定义参数 ```bash openclaw sessions spawn \ --agentId smart-auto-updater \ --message "Check updates with custom settings: auto-update LOW risk, report MEDIUM risk" ```
## 配置
### 环境变量
```bash # AI Model (optional, defaults to configured model) export SMART_UPDATER_MODEL="minimax-portal/MiniMax-M2.1"
# Auto-update threshold (default: LOW) # Options: NONE (report only), LOW, MEDIUM export SMART_UPDATER_AUTO_UPDATE="LOW"
# Risk tolerance (default: MEDIUM) # HIGH: Only auto-update LOW risk # MEDIUM: Auto-update LOW + MEDIUM risk # LOW: Auto-update all export SMART_UPDATER_RISK_TOLERANCE="MEDIUM"
# Report level (default: detailed) # Options: brief, detailed, full export SMART_UPDATER_REPORT_LEVEL="detailed" ```
## 报告格式
### 高风险报告 ``` 🔴 Smart Auto-Updater Report
Update Available: v1.2.3 → v1.3.0
⚠️ Risk Level: HIGH
📋 Changes Summary: - Breaking API changes detected - Database migration required - 3 files modified
🏗️ Impact Assessment: - Architecture: MAJOR changes to core components - Performance: Potential impact on startup time - Compatibility: Breaks backward compatibility
🚫 Decision: SKIPPED
💡 Recommendations: 1. Review changelog manually 2. Test in staging environment 3. Schedule maintenance window
🗓️ Next Check: 24 hours ```
### 低风险自动更新 ``` 🟢 Smart Auto-Updater Report
Updated: v1.2.3 → v1.2.4
✅ Risk Level: LOW
📋 Changes: - Bug fixes (2) - Performance improvements (1)
🏗️ Impact Assessment: - Architecture: No changes - Performance: Minor improvement - Compatibility: Fully compatible
✅ Decision: AUTO-UPDATED
📊 Summary: - OpenClaw: v1.2.3 → v1.2.4 - Skills updated: 2 - Skills unchanged: 15 - Errors: none
⏱️ Next Check: 24 hours ```
## 架构
``` ┌──────────────────┐ │ Trigger (Cron) │ └────────┬─────────┘ │ ▼ ┌──────────────────┐ │ Check Updates │ ← clawhub update --dry-run └────────┬─────────┘ │ ▼ ┌──────────────────┐ │ AI Analysis │ ← Analyze changes, assess risk └────────┬─────────┘ │ ┌────┴────┐ │ │ ▼ ▼ ┌───────┐ ┌───────┐ │ HIGH │ │ MEDIUM│ │ Skip │ │ Skip │ └───┬───┘ └───┬───┘ │ │ ▼ ▼ ┌───────┐ ┌───────┐ │ LOW │ │ Report│ │ Update│ │ Only │ └───┬───┘ └───────┘ │ │ └────┬─────┘ │ ▼ ┌──────────────────┐ │ Generate Report │ ← Send summary └──────────────────┘ ```
## 安全特性
1. **优先试运行** - 操作前始终进行检查 2. **风险分类** - 基于 AI 的影响评估 3. **可配置阈值** - 自定义您的风险承受能力 4. **详细日志** - 记录每一个决策 5. **手动覆盖** - 更新前始终可以审查
## 故障排除
### 更新一直被跳过 - 检查风险承受度设置 - 确认 AI 模型是否可用 - 手动审查更新日志
### 误报(过多 HIGH 风险) - 降低风险承受度 - 检查 AI 模型提示词 - 审查特定的变更模式
### 报告未送达 - 验证投递渠道配置 - 检查网关状态 - 审查会话配置
## 参考文献 - `references/risk-assessment.md` → AI 风险评估方法论 - `references/report-templates.md` → 报告格式示例 - `references/integration.md` → 与 cron/jobs 的集成