# Context Cleanup

> DEPRECATED: Please use `context-cleanup` (same owner). This legacy slug is retained only for compatibility. 已废弃，请迁移到 `context-cleanup`。

- Skill: `dvcrn/context-cleanup-2` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add dvcrn/context-cleanup-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/dvcrn/context-cleanup-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: dvcrn (https://skillmd.com/u/dvcrn)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/dvcrn/context-cleanup-2

---


# Context Cleanup

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

## 关键资源

- 脚本：`cleanup.sh`
- 策略：`references/policy.md`

## 标准流程（必须）

1. 分析现状
```bash
./skills/context-cleanup/cleanup.sh analyze
```

2. 生成计划（不执行）
```bash
./skills/context-cleanup/cleanup.sh plan
```

3. 用户确认后执行归档
```bash
./skills/context-cleanup/cleanup.sh archive
```

## 可选参数

```bash
# 指定截止日期（早于该日期的记录可归档）
./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`

## 输出模板

```markdown
🧹 上下文清理计划

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

是否按计划执行归档？
```

## 发布前自检

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

