memory-spring-cleaning — Claude Code command: clean project memory
Walks through CLAUDE.md and markdown docs, checks the rules written there against the actual code, and drops what no longer holds.
npx claude-code-templates@latest --command team/memory-spring-cleaningWhat memory-spring-cleaning does
The command scans the project for memory files — CLAUDE*.md and the rest of the markdown documentation — then compares what they say with how the code looks today. Mismatched conventions, stale examples and wrong stack references come back as implementation drift.
It runs in six stages: file discovery, implementation analysis, pattern validation, content cleanup, synchronization, quality assurance. The toolset is narrow: Read, Write, Edit, Glob. Nothing gets built or executed.
Scope comes from the argument. --claude-md limits the run to memory files, --documentation covers the rest of the docs, --outdated-patterns hunts stale patterns, --implementation-sync lines the notes up with the code. With no argument it takes on everything. Edits land directly in your files, so commit before you run it — otherwise there is nothing to roll back to.
What it helps with
- strip rules from
CLAUDE.mdthat no longer match the code - find duplicated sections across several memory files
- check doc examples against the real project API
- refresh the build and test commands after a refactor
- verify links and markdown formatting in the docs
Example prompts for the agent
- /memory-spring-cleaning --claude-md
- /memory-spring-cleaning --implementation-sync
- /memory-spring-cleaning --outdated-patterns
How to install memory-spring-cleaning
1claude-code-templates
npx claude-code-templates@latest --command team/memory-spring-cleaning2Manually: put the files in place
.claude/commands/memory-spring-cleaning.mdCall it with /memory-spring-cleaning. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/memory-spring-cleaning.mdCall it with /prompts:memory-spring-cleaning. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/memory-spring-cleaning.prompt.mdManually: put the files in place
.gemini/commands/memory-spring-cleaning.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about memory-spring-cleaning
How do I install memory-spring-cleaning in Claude?
Through the templates: npx claude-code-templates@latest --command team/memory-spring-cleaning. The command file then sits at .claude/commands/memory-spring-cleaning.md.
What does memory-spring-cleaning do?
It locates memory files and documentation, compares them with the current code, and rewrites what is out of date. You get cleaned files with updated patterns plus maintenance recommendations.
Which arguments does the command take?
[scope], --claude-md, --documentation, --outdated-patterns and --implementation-sync. The first two narrow the target to memory files or the rest of the docs; the others pick the mode.
Source text
memory-spring-cleaning.md · MIT
---
allowed-tools: Read, Write, Edit, Glob
argument-hint: "[scope] | --claude-md | --documentation | --outdated-patterns | --implementation-sync"
description: Clean and organize project memory files with implementation synchronization and pattern updates
---
# Memory Spring Cleaning
Clean and synchronize project memory with current implementation patterns: **$ARGUMENTS**
## Current Memory Context
- Memory files: !`find . -name "CLAUDE*.md" | wc -l` CLAUDE.md files in project
- Documentation: !`find . -name "README*" -o -name "*.md" | wc -l` total documentation files
- Last update: !`find . -name "CLAUDE.md" -exec stat -c "%y" {} \; 2>/dev/null | head -1 || echo "No CLAUDE.md found"`
- Implementation drift: Analysis of documented vs actual patterns
## Task
Execute comprehensive memory cleanup with implementation synchronization:
**Cleanup Scope**: Use $ARGUMENTS to focus on CLAUDE.md files, general documentation, outdated pattern identification, or implementation synchronization
**Memory Cleaning Framework**:
1. **Memory File Discovery** - Locate all CLAUDE.md and documentation files, assess hierarchy and organization, identify redundant content
2. **Implementation Analysis** - Compare documented patterns with actual code, identify implementation drift, assess accuracy gaps
3. **Pattern Validation** - Verify documented conventions, validate code examples, check dependency accuracy, assess technology stack alignment
4. **Content Optimization** - Remove outdated information, consolidate duplicate content, improve organization structure, enhance clarity
5. **Synchronization Updates** - Update development commands, refresh technology stack references, sync architectural patterns, validate workflows
6. **Quality Assurance** - Ensure consistency across files, validate markdown formatting, check link integrity, maintain version alignment
**Advanced Features**: Automated pattern detection, implementation drift analysis, cross-reference validation, documentation health scoring.
**Memory Health**: Content freshness metrics, accuracy validation, usage pattern analysis, maintenance scheduling recommendations.
**Output**: Cleaned and synchronized memory files with updated patterns, validated implementations, and maintenance recommendations.
© davila7 · MIT · davila7/claude-code-templates