Install
openclaw skills install @lokix94/memory-optimizer-2Analyzes AI agent memory files to detect duplicates, stale info, missing indexes, and structure issues, generating detailed reports and auto-fix options.
openclaw skills install @lokix94/memory-optimizer-2Version: 1.0.0 | Price: $3.99 | Author: Peru 🇵🇪
Analyzes an AI agent's memory files (MEMORY.md, memory/*.md), detects duplicates, stale information, missing indexes, and structural issues. Generates an optimization report with specific recommendations and can auto-fix common issues.
python3 (3.8+)difflib (stdlib), re (stdlib), pathlib (stdlib)Copy this skill folder to your workspace. No pip install needed.
chmod +x analyze.py optimize.py
# Analyze current workspace (auto-detects MEMORY.md and memory/ folder)
python3 analyze.py
# Analyze a specific directory
python3 analyze.py --path /path/to/workspace
# Output report to file
python3 analyze.py --output report.md
# JSON output
python3 analyze.py --json
# Preview changes (dry run — default)
python3 optimize.py
# Apply all recommended fixes
python3 optimize.py --apply
# Apply only deduplication
python3 optimize.py --apply --only dedup
# Apply only re-indexing
python3 optimize.py --apply --only reindex
# Backup before applying
python3 optimize.py --apply --backup
analyze.py [OPTIONS]
--path DIR Workspace directory to analyze (default: current dir)
--output FILE Save report to file
--json Output as JSON
--verbose Show detailed analysis
--help Show help
optimize.py [OPTIONS]
--path DIR Workspace directory (default: current dir)
--apply Apply fixes (default: dry run)
--only TYPE Only apply: dedup, reindex, stale, structure
--backup Create .bak files before modifying
--help Show help
# 🧠 Memory Optimization Report
Workspace: /root/.openclaw/workspace
Analyzed: 2026-02-14 03:00 UTC
## Memory Efficiency Score: 72/100
### Summary
- Files scanned: 15
- Total entries: 234
- Duplicates found: 12
- Stale entries: 8
- Missing indexes: 3
- Structure issues: 5
## 🔴 Critical Issues
1. **12 duplicate entries** across MEMORY.md and memory/2026-02-10.md
- "GitHub token configured" appears 3 times
- "TTS setup complete" appears 2 times
## 🟡 Warnings
1. **8 stale entries** with dates older than 30 days
- memory/2025-12-15.md: "Current project: X" (60 days old)
## 🟢 Suggestions
1. Consider merging memory/2026-02-01.md through memory/2026-02-05.md (low activity)
2. Add table of contents to MEMORY.md (>50 entries)
## Recommended Actions
- [ ] Remove 12 duplicate entries (saves ~2.4KB)
- [ ] Archive 8 stale entries
- [ ] Add index headers to 3 files
- [ ] Fix 5 structural issues
$ python3 analyze.py --path /root/.openclaw/workspace
🧠 Agent Memory Optimizer v1.0.0
Scanning workspace: /root/.openclaw/workspace
Found 12 memory files (45.2 KB total)
Analyzing...
Memory Efficiency Score: 72/100 ⚠️
Issues found:
🔴 Critical: 2
🟡 Warning: 5
🟢 Suggestion: 3
Report saved to: memory_report.md
Run `python3 optimize.py --apply` to fix issues.