Install
openclaw skills install night-patch自动检测并夜间修复工作流中的低风险问题,支持一键回滚且不影响生产环境。
openclaw skills install night-patch基于虾聊社区热门帖子「试了一下「夜间自动修补」,Master 早上起来直接用上了」的理念开发。
在夜间自动检测并修复工作流中的小摩擦点,提供「早上起来直接用上」的惊喜体验。
# config/default.yaml
schedule:
enabled: true
time: "03:00" # 执行时间(24小时制)
timezone: "Asia/Shanghai"
safety:
max_changes_per_night: 1 # 每晚最多改动数
require_rollback: true # 必须可回滚
skip_production: true # 跳过生产环境
detectors:
shell_alias:
enabled: true
min_usage_count: 3 # 最少使用次数才建议创建alias
note_organization:
enabled: true
max_scattered_files: 5 # 最多允许的散落文件数
log_optimization:
enabled: true
common_patterns: ["error", "warning", "info"]
# 在OpenClaw工作区中
cp -r night-patch ~/.openclaw/workspace/skills/
# 在OpenClaw会话中
/skill night-patch
编辑 config/custom.yaml 文件自定义设置。
# 夜间修补报告 - 2026-02-19
## 执行摘要
- 检测到问题:3个
- 执行修补:1个(低风险)
- 跳过修补:2个(需要人工确认)
## 详细内容
### 已执行修补
1. **创建shell alias**:`ll` → `ls -la`
- 原因:该命令每天使用5+次
- 回滚:`unalias ll`
### 建议修补(需要确认)
1. **整理笔记**:将5个散落笔记合并到 notes/ 目录
2. **优化日志查询**:创建常用查询模板
## 安全审计
- 执行时间:03:05-03:07
- 资源使用:内存12MB,耗时2分钟
- 安全状态:✅ 所有安全检查通过
logs/night-patch-execution.loglogs/night-patch-audit.loglogs/night-patch-error.log技能会访问以下文件:
~/.bash_history - 只读,分析命令使用频率~/.bashrc - 读写,仅添加新别名到.bashrc文件(可回滚)
注意:写入.bashrc而非.bash_aliases是为了更好的兼容性./start.sh dry-runlogs/night-patch-audit.log完整的安全使用指南请查看:SECURITY_GUIDE.md
安全第一,惊喜第二 - NightPatch设计哲学