From memento
Scans .memory_bank/**/*.md files for redundancy, creates backup, optimizes files with >10% redundancy (target 30-50% reduction), and reports metrics summary.
How this command is triggered — by the user, by Claude, or both
Slash command
/memento:optimize-memory-bankThe summary Claude sees in its command listing — used to decide when to auto-load this command
# 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...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%)
npx claudepluginhub mderk/memento --plugin memento/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.
/compress-allRecursively discovers and compresses all matching Markdown files repo-wide using batched, auto-approved processing. Defaults to lossy mode; supports --lossless flag.
/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.