简介
Self Updater
原始描述
⭐ OPEN SOURCE! GitHub: github.com/GhostDragon124/openclaw-self-updater ⭐ ONLY skill with Cron-aware + Idle detection! Auto-updates OpenClaw core & skills, an...
通过你的 Agent 添加
安装目录:self-updater/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: self-updater
version: 1.2.0
description: |
Intelligent OpenClaw auto-updater with smart scheduling. Automatically checks for updates to both OpenClaw core AND installed skills, analyzes cron schedules to avoid user task windows, waits for system idle time, performs AI-powered impact assessment, sends notifications via configured channels, and ensures gateway restarts smoothly. Use when: (1) Weekly maintenance, (2) User requests update check, (3) Heartbeat health checks, (4) Automated self-maintenance with intelligent timing
Self Updater
Intelligent OpenClaw auto-updater with smart scheduling.
Features
- Cron-aware: Reads ~/.openclaw/cron/jobs.json to avoid user task windows
- Smart Scheduling: Intelligently chooses optimal update windows based on system idle time
- Auto-detect Port: Reads gateway port from ~/.openclaw/openclaw.json
- Health Monitoring: Uses HTTP health checks instead of CLI (more reliable)
- Auto-restart: Automatically restarts gateway after update
- Dual Updates: Updates both OpenClaw core AND installed skills
- AI Impact Assessment: Evaluates update risk based on multiple factors
- Smart Notification: Auto-detects messaging channels and sends reports
- Dry-run Mode: Check for updates without applying them
- Flexible Timing: Can run on schedule or on-demand
- Quiet Mode: Minimal output for scheduled runs
- Proper Versioning: Uses semver comparison for accurate version detection
Usage
Basic check (no update):
powershell -ExecutionPolicy Bypass -File scripts/self-updater.ps1
Auto-update mode:
powershell -ExecutionPolicy Bypass -File scripts/self-updater.ps1 -AutoUpdate
Smart update (wait for idle + avoid cron tasks):
powershell -ExecutionPolicy Bypass -File scripts/self-updater.ps1 -AutoUpdate -SmartTiming
Update skills only:
powershell -ExecutionPolicy Bypass -File scripts/self-updater.ps1 -UpdateSkillsOnly
Quiet mode (for cron/scheduled runs):
powershell -ExecutionPolicy Bypass -File scripts/self-updater.ps1 -AutoUpdate -Quiet
Help:
powershell -ExecutionPolicy Bypass -File scripts/self-updater.ps1 -Help
Parameters
Parameter
Type
Default
Description
AutoUpdate
switch
false
Automatically apply updates
UpdateSkillsOnly
switch
false
Only update skills, skip OpenClaw core
SmartTiming
switch
false
Wait for system idle and check cron schedules
Quiet
switch
false
Minimal output
NoNotify
switch
false
Skip sending notifications
Port
int
auto
Gateway port (auto-detected if omitted)
IdleThreshold
int
5
Minutes of idle before update
CronLookAhead
int
60
Minutes to look ahead for scheduled tasks
MaxWait
int
30
Max minutes to wait for conditions
Help
switch
false
Show help message
AI Impact Assessment
| Parameter | Type | Default | Description |
|---|---|---|---|
| AutoUpdate | switch | false | Automatically apply updates |
| UpdateSkillsOnly | switch | false | Only update skills, skip OpenClaw core |
| SmartTiming | switch | false | Wait for system idle and check cron schedules |
| Quiet | switch | false | Minimal output |
| NoNotify | switch | false | Skip sending notifications |
| Port | int | auto | Gateway port (auto-detected if omitted) |
| IdleThreshold | int | 5 | Minutes of idle before update |
| CronLookAhead | int | 60 | Minutes to look ahead for scheduled tasks |
| MaxWait | int | 30 | Max minutes to wait for conditions |
| Help | switch | false | Show help message |
The updater evaluates the following factors to determine update risk:
| Factor | Weight | Description |
|---|---|---|
| Version Impact | 30% | Major/Minor/Patch level changes |
| Skills Count | 25% | Number of skills to update |
| Gateway Restart | 20% | Impact of gateway restart |
| Time Since Last Update | 15% | How long since last update |
| Cron Proximity | 10% | Distance to next scheduled task |
Risk Levels:
- 🟢 Low: Patch update, <3 skills, >4 hours since last update
- 🟡 Medium: Minor update, 3-5 skills, 2-4 hours since last update
- 🔴 High: Major update, >5 skills, <2 hours since last update
Smart Notification
Automatically detects configured messaging channels from ~/.openclaw/openclaw.json:
Supported channels:
- Telegram: Sends via bot API
- Feishu: Sends via app API
Notification includes:
- Update summary (core + skills)
- Impact assessment (risk level)
- Changes made
- Gateway status
Smart Timing Logic
When -SmartTiming is enabled:
- Reads cron jobs from ~/.openclaw/cron/jobs.json
- Parses all schedule types (cron, every, at)
- Checks next scheduled task times
- Only proceeds if no task in next $CronLookAhead minutes
- Checks system idle time using Windows API
- Only proceeds if idle > threshold
- Retries check every minute until conditions met
- Max wait time: $MaxWait minutes (then proceeds anyway)
What It Does
- Auto-detects gateway port from config
- Analyzes cron schedules to avoid user task windows
- Optionally waits for system idle (smart timing)
- Checks OpenClaw core version vs latest npm
- Checks installed skills for updates via clawhub
- Performs AI impact assessment
- Sends notification with assessment (if not -NoNotify)
- Performs updates if needed (with -AutoUpdate)
- Restarts gateway after update
- Verifies gateway health is restored
- Sends completion notification
Updates Both
- OpenClaw Core: Via
npm update -g openclaw
- Installed Skills: Via
clawhub update --all
Scheduling
- OpenClaw Core: Via
npm update -g openclaw - Installed Skills: Via
clawhub update --all
Scheduling
For weekly maintenance with smart timing:
# Add to HEARTBEAT.md Friday tasks
- Run self-updater with -AutoUpdate -SmartTiming
Or create a cron job:
openclaw cron add "0 9 * * 5" "self-updater"
Requirements
- PowerShell 5.1+
- npm access
- clawhub CLI
- Windows (uses Windows idle detection API)
- Reads config from ~/.openclaw/openclaw.json
- Reads cron jobs from ~/.openclaw/cron/jobs.json
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。