Help us improve
Share bugs, ideas, or general feedback.
From session-orchestrator
Reviews, consolidates, and prunes Claude Code memory files under ~/.claude/projects/*/memory/. Run after major refactors, every 5+ sessions, or when memory quality degrades.
npx claudepluginhub kanevry/session-orchestrator --plugin session-orchestratorHow this skill is triggered — by the user, by Claude, or both
Slash command
/session-orchestrator:memory-cleanupsonnetThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
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.
Organizes, extracts, prunes, and verifies Claude Code persistent memory files: MEMORY.md index, topic extraction, staleness detection, accuracy checks. Use near 200-line limit, after insights, or project changes.
Audits Claude Code auto-memory (MEMORY.md, topic files) for promotion candidates to CLAUDE.md, stale entries, duplicates, consolidation opportunities, and health metrics.
Optimizes Claude Code memory files in 4 interactive steps: removes duplicates by cross-referencing CLAUDE.md/rules, migrates entries to persistent configs, compresses, and validates with cleanup. Run in main conversation to declutter memory.
Share bugs, ideas, or general feedback.
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).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.
Understand the current memory state before making changes.
List all files in the memory directory:
ls -la ~/.claude/projects/*/memory/ 2>/dev/null | grep "$(basename "$(pwd)")"
Or directly list the project's memory dir (the path is in the auto memory system instructions).
Read MEMORY.md (the index file) — note its line count:
wc -l <memory-dir>/MEMORY.md
Skim each topic file referenced in the index. Build a mental map:
Goal: Improve existing files, never create duplicates.
Find what's changed since the last consolidation.
Git history — recent commits give the timeline for "did this fact change?":
git log --oneline -20
Stale references — for each file/function/symbol mentioned in memory, verify it still exists:
grep -rn "specific-file-or-function" src/ lib/ scripts/ 2>/dev/null
Relative dates — find temporal references that need conversion:
grep -rni "yesterday\|today\|tomorrow\|last week\|this week\|gestern\|heute\|morgen\|letzte woche" <memory-dir>/
Version drift — package versions stored in memory vs reality:
cat package.json | grep '"version"'
Test/issue-count drift — claims like "5001 passed" or "8 open issues" age fast. Cross-check with current state if mentioned.
Apply maintenance operations to memory files.
If multiple files or entries describe the same thing, combine them into one authoritative entry. Update inbound [[wiki-link]]s accordingly.
"Yesterday we decided X" → "On 2026-03-24 we decided X". Always use ISO date format (YYYY-MM-DD). This rule applies on write, but cleanup catches what slipped through.
git log --diff-filter=R surfaces renames).decisions.md-style note that the decision was reversed, with the reason — don't silently overwrite).If two memory entries conflict, check the codebase to determine which is current. Delete the outdated entry. Never leave contradictions.
Keep MEMORY.md clean and under the 200-line limit.
Check line count:
wc -l <memory-dir>/MEMORY.md
If over 180 lines, extract detailed content into topic files. Suggested naming:
project_sessions.md or session-YYYY-MM-DD-<slug>.mdreference_decisions.mdreference_packages.md{type}_{topic}.mdTopic file frontmatter (required):
---
name: descriptive-name
description: one-line description for relevance matching
metadata:
type: project # one of: user | feedback | project | reference
---
Update the index:
MEMORY.md is an index, not a dump.- [Title](file.md) — hook entries.Final verification:
wc -l <memory-dir>/MEMORY.md # must be < 200
# verify all index links resolve to existing files
grep -oP '\]\(([^)]+\.md)\)' <memory-dir>/MEMORY.md | sed 's/](\(.*\))/\1/' | while read f; do
[ -f "<memory-dir>/$f" ] || echo "BROKEN: $f"
done
After completing all four phases, report:
MEMORY.md line count (before → after).AskUserQuestion rather than guessing).user, feedback, project, reference) is load-bearing for the relevance heuristic.MEMORY.md if line-count is already healthy. Re-ordering for its own sake creates churn without value.