Install
openclaw skills install @thcjp/asset-cleanup-dailyopenclaw skills install @thcjp/asset-cleanup-daily版本: v1.0.0 | 优先级: P2(基础设施维护) | 所属层: 基础设施层(资产清理)
来源: T2-6素材清理 | 05文档§五L1096 | BUG-ASSET-CLEANUP-SKILL-MISSING修复 Cron配置: data/cron_tasks.json
asset-cleanup-daily(schedule:0 3 * * *)
cron_tasks.json中已配置asset-cleanup-daily Cron任务(schedule: 0 3 * * *),但对应的Skill未创建,导致Cron触发时OpenClaw找不到Skill执行清理逻辑。
初始化清理环境
python skills/asset-cleanup-daily/scripts/asset_cleanup.py [--dry-run]清理过期临时文件
清理旧日志文件
清理无效缓存和锁文件
清理过期素材(可选,PG可用时执行)
输出清理报告
{
"dry_run": false
}
参数说明:
dry_run(可选): true时只扫描不删除,默认false{
"success": true,
"data": {
"temp_files": {
"scanned": 15,
"deleted": 12,
"freed_bytes": 245678,
"errors": []
},
"log_files": {
"scanned": 18,
"deleted": 3,
"freed_bytes": 1024000,
"errors": []
},
"cache_files": {
"scanned": 5,
"deleted": 2,
"freed_bytes": 512,
"errors": []
},
"assets": {
"cleaned": true,
"expired_count": 5,
"deleted_records": 5,
"deleted_files": 4,
"freed_bytes": 8192000,
"skipped": "PG不可用时为null"
},
"total_freed_bytes": 9457190,
"total_freed_human": "9.0MB",
"report_path": "data/audit/asset_cleanup_2026-07-14.json"
},
"error": null,
"code": null
}
data/temp_*.txt - 临时文本片段data/test_*.txt / data/test_*.json / data/test_*.out - 测试产物data/kanban/test.* - 看板测试文件data/ops/_vacuum_temp.sql - PG真空临时SQLdata/*.jsonl - JSONL格式日志(排除活跃日志:alert_queue.jsonl, budget_alerts.jsonl, tenant_notifications.jsonl, mcp_pending_tasks.jsonl)data/*.lock - 过期锁文件(超过1天视为僵尸锁)*.bak / *.backup - 旧备份文件(超过7天)本Skill实现R72.1: asset-cleanup-daily(基础设施层资产清理)为05文档§五L1096要求的Cron编排组件。
python skills/asset-cleanup-daily/scripts/asset_cleanup.py
输出:
{
"success": true,
"data": {
"temp_files": {"scanned": 5, "deleted": 3, "freed_bytes": 1024, "errors": []},
"log_files": {"scanned": 18, "deleted": 1, "freed_bytes": 512000, "errors": []},
"cache_files": {"scanned": 2, "deleted": 1, "freed_bytes": 256, "errors": []},
"assets": {"cleaned": true, "expired_count": 0, "deleted_records": 0, "deleted_files": 0, "freed_bytes": 0},
"total_freed_bytes": 513280,
"total_freed_human": "501.2KB",
"report_path": "data/audit/asset_cleanup_2026-07-14.json"
},
"error": null,
"code": null
}
python skills/asset-cleanup-daily/scripts/asset_cleanup.py --dry-run
输出同上,deleted字段表示待删除数量(实际未删除),dry_run标记为true。
PG连接失败时,assets字段降级:
{
"assets": {"cleaned": false, "expired_count": 0, "skipped": "PG不可用,跳过素材清理"}
}