360 Secure SkillHub
360 安全技能中心

Context Cleanup

核心功能为分析OpenClaw workspace的memory日志,识别低价值内容生成归档计划,经用户确认后执行归档(默认不删除)。适用于上下文冗余、需维护整理的场景。通过bash脚本调用,支持指定截止日期、预览、非交互等参数;输出可选可读文本或JSON格式,需按分析-计划-确认流程操作,不处理指定核心文件。

irideas
irideas
热度 68.09
最近更新 2026-05-11 17:29:08
分类:效率依赖:代码执行应用场景:任务管理 / 工作流 / 自动化脚本 / 模板

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add context-cleanup
Metadata
name
context-cleanup
description
Analyze and archive low-value memory notes in OpenClaw workspace to reduce context bloat and improve responsiveness. 适用于上下文冗余、维护整理场景;默认流程为 analyze → plan → confirm → archive,归档优先于删除。
user-invocable
true
metadata
{"openclaw":{"emoji":"🧹","requires":{"bins":["bash"]}},"version":"0.3","updatedAt":"2026-03-06 20:47 Asia/Shanghai"}

Context Cleanup

用于整理 workspace 的 memory 日志,降低冗余上下文负担。

关键资源

  • 脚本:cleanup.sh
  • 策略:references/policy.md

标准流程(必须)

  1. 分析现状
./skills/context-cleanup/cleanup.sh analyze
  1. 生成计划(不执行)
./skills/context-cleanup/cleanup.sh plan
  1. 用户确认后执行归档
./skills/context-cleanup/cleanup.sh archive

可选参数

# 指定截止日期(早于该日期的记录可归档)
./skills/context-cleanup/cleanup.sh archive 2026-03-01

# 仅预览,不执行
./skills/context-cleanup/cleanup.sh archive --dry-run

# 非交互执行(需谨慎)
./skills/context-cleanup/cleanup.sh archive --yes

# 机器可读输出
./skills/context-cleanup/cleanup.sh analyze --json
./skills/context-cleanup/cleanup.sh plan --json

执行规则

  • 默认归档,不做永久删除
  • 先 plan 后 archive
  • 归档前必须获得用户确认(除非用户明确同意 --yes)
  • 不处理 MEMORY.md、specs/、AGENTS.md

输出模板

🧹 上下文清理计划

- Memory 文件:X
- 低价值候选:A
- 归档候选:B

是否按计划执行归档?

发布前自检

./skills/context-cleanup/cleanup.sh analyze
./skills/context-cleanup/cleanup.sh plan
./skills/context-cleanup/cleanup.sh archive --dry-run