memory-cleanup
Use this skill when performing manual memory consolidation (Dream-equivalent). Reviews, consolidates, and prunes memory files under…
от Kanevry★ 53 звезды на GitHub
Установить memory-cleanup в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Memory Cleanup — Manual Dream Process
Plugin root:
${CLAUDE_PLUGIN_ROOT}. Claude Code replaces this with the plugin's absolute path when it loads this file. Where it appears unreplaced — in a file this skill reads with the Read tool, or on Codex, Cursor or Pi — the plugin root is the directory that contains this skill'sskills/folder (two levels above the folder of this SKILL.md). Write that absolute path literally into every command that starts a plugin script: the Bash tool has no plugin variable, and shell variables do not survive between tool calls.
Invocation
The user invoked /memory-cleanup with arguments: $ARGUMENTS. Parse them before anything else — two optional, mutually-exclusive flags are recognised (--dry-run, --apply-pending, see PRD #502); passing both is an error, and the absence of both selects the legacy interactive 4-phase mode. The per-flag behaviour, the exact status lines and the exit codes are in § Argument Handling (Phase 0) below; the interactive default runs Phases 1-4 (Orient → Gather Signal → Consolidate → Prune & Index) against ~/.claude/projects/<encoded-cwd>/memory/ and reports per § Output.
Sidecar producer/consumer contract: session-start's maintenance-due probe uses scripts/lib/auto-dream.mjs to report when cleanup is due; the former session-end Phase 3.6.5 nudge was retired in #1288. Neither path generates the sidecar. The only real producer of .orchestrator/pending-dream.md is a manual /memory-cleanup --dry-run run; --apply-pending is the operator-confirmed consumer in a later session. The sidecar file is single-writer — concurrent sessions cannot collide because the writer holds the session-lock.
Implements the 4-phase memory consolidation process modelled after Claude Code's Auto Dream feature. Run after major refactors, framework migrations, or every 5+ sessions in a repo.
The memory system lives at ~/.claude/projects/<encoded-cwd>/memory/ and consists of:
MEMORY.md— index file (must stay under 200 lines; lines after 200 are truncated by the harness).- Topic files — one Markdown file per memory entry with YAML frontmatter (
name,description,metadata.type).
The four memory types are user, feedback, project, reference (see global auto memory instructions for semantics). This skill never invents new types.
Argument Handling (Phase 0)
This skill accepts two optional flags. Default (no flag) runs the interactive 4-phase consolidation defined below.
| Flag | Behavior |
|---|---|
--dry-run |
Run Phases 1-3 read-only; instead of mutating MEMORY.md / topic files, write a complete-body MEMORY.md proposal (single fenced block — never a unified-diff) to .orchestrator/pending-dream.md (atomic). Exit 0. |
--apply-pending |
Read .orchestrator/pending-dream.md; refuse if older than 14 days (stale) or if MEMORY.md changed since the producing --dry-run (stale-index, #788); apply diff; delete pending file; print auto-dream applied: -<X> lines, +<Y> entries. Exit 0. |
Flags are mutually exclusive — passing both is an error. Absence of both = legacy interactive mode (Phases 1-4 below).
--dry-run flow:
- Read MEMORY.md and topic files (read-only).
- Produce the same internal plan the interactive mode would (merges, prunes, rewrites).
- Serialisation contract (#717 — load-bearing, read before writing the proposal):
applyPendingDream()inscripts/lib/auto-dream.mjsconsumes ONLY the FIRST fenced code block in the sidecar body and writes it VERBATIM as the complete new MEMORY.md. It does NOT parse or apply git-style diff hunks. Therefore the proposal MUST ALWAYS be the complete new MEMORY.md body, in EXACTLY ONE fenced```markdownblock — never git-style unified-diff hunks (---/+++/@@ … @@lines), and never multiple fences for MEMORY.md itself. Any topic-file (non-MEMORY.md) change needed by the plan CANNOT be carried inside that single fence — instead, append it AFTER the fence as a separate, clearly-delimited machine-readable section per topic file, using the heading### Topic-file change: <path>followed by plain-language instruction text (not a diff). These sections are for a human to apply by hand;applyPendingDream()never reads past the first fence. If a### Topic-file change:section needs to show illustrative code, use 4-space-indented code text, never a fenced ``` block —countFencedBlocks()counts every fence in the raw sidecar body (not just MEMORY.md's), so a second fence anywhere in the document trips the >1-fence unsupported-format guard and blocks the whole apply. - Call
writePendingDream({ repoRoot, diff, sourceSession, memoryLinesBefore, proposedLinesAfter })fromscripts/lib/auto-dream.mjs, passing the single-fence MEMORY.md body (plus any### Topic-file change:sections) asdiff. - Print one-line status:
pending-dream written: <N> lines proposed(or `
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл memory-cleanup?
Use this skill when performing manual memory consolidation (Dream-equivalent). Reviews, consolidates, and prunes memory files under ~/.claude/projects/*/memory/. Run after major refactors, every 5+ sessions, or when memory quality degrades (broken links, stale references, contradictions, MEMORY.md > 200 lines). Invoke with /memory-cleanup.
Как установить скилл memory-cleanup?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл memory-cleanup запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…