From memento
Scans .memory_bank/**/*.md files for redundancy, creates backup, optimizes files with >10% redundancy (target 30-50% reduction), and reports metrics summary.
npx claudepluginhub mderk/memento --plugin memento# Optimize Memory Bank for Redundancy
## Safety: Create Backup
**CRITICAL**: Before any changes:
Backup created at: `.memory_bank.backup.YYYYMMDD_HHMMSS`
## Optimization Process
1. **Load redundancy patterns ONCE** (reuse for all files):
- Load common redundancy patterns and detection rules
- Prepare optimization strategies for identified patterns
2. **Scan files**: Find all `.memory_bank/**/*.md` files using Glob
3. **For EACH file** (sequential, no subagents):
a. **Read and analyze**:
- Read file content
- Count lines (before_lines)
- Report: `๐ Checki.../compressCompresses CLAUDE.md or specified memory files at light/medium/aggressive levels with protected-span safety. Reports token savings, validation status, and backup location.
/memory-consolidateCleans .memory/ directory: deduplicates entries, removes stale/contradictory/derivable info, rebuilds index. Generates report of changes; supports --dry-run.
/compressCompresses natural language in .md/.txt file to caveman format, saving input tokens. Preserves code blocks, URLs, structure; creates backup.
/memory-spring-cleaningReviews all CLAUDE.md and CLAUDE.local.md files in the project: verifies content against codebase, removes obsolete/duplicate info, consolidates, and relocates to appropriate hierarchy locations.
Share bugs, ideas, or general feedback.
CRITICAL: Before any changes:
cp -r .memory_bank .memory_bank.backup.$(date +%Y%m%d_%H%M%S)
Backup created at: .memory_bank.backup.YYYYMMDD_HHMMSS
Load redundancy patterns ONCE (reuse for all files):
Scan files: Find all .memory_bank/**/*.md files using Glob
For EACH file (sequential, no subagents):
a. Read and analyze:
๐ Checking [filename] (X lines)...b. Check redundancy:
c. Optimize if needed:
((before - after) / before) * 100โ
Optimized [filename]: X โ Y lines (-Z%)โ
[filename] already optimald. Track metrics: Add to running totals (files_optimized, total_lines_saved)
Final report: Show summary with before/after metrics
Typical outcomes:
Report example:
โ Scanned 28 files
โ Optimized 12 files (43%)
โ Saved 1,850 lines (38% average reduction)
โ Backup: .memory_bank.backup.20251114_143022
Top improvements:
- tech_stack.md: 648 โ 301 lines (-54%)
- ai-agent-handbook.md: 404 โ 251 lines (-38%)
- architecture.md: 520 โ 310 lines (-40%)