--- name: memory-manager description: "Automates memory maintenance: weekly consolidation of daily notes into MEMORY.md, archival of old files (30+ days), and periodic cleanup. Use when needing to organize, summarize, or prune memory storage." --- # Memory Manager Skill This skill automates the management of OpenClaw memory files, ensuring important information persists while keeping storage tidy. ## What It Does - **Weekly consolidation**: Summarizes the past week's daily memory entries and appends a structured summary to `MEMORY.md` - **Archival**: Moves daily memory files older than 30 days to `memory/archive/` (compressed) - **Orphan cleanup**: Removes empty or corrupted memory files - **Space reporting**: Logs disk usage before/after operations ## When to Use - As a scheduled cron job (recommended: weekly) - Manually when memory files are cluttered - Before a system backup to reduce size - After a long session to preserve important insights ## Configuration The skill respects these environment variables: - `MEMORY_DIR`: Path to memory directory (default: `./memory` in workspace) - `MEMORY_ARCHIVE`: Archive directory (default: `memory/archive`) - `MAX_AGE_DAYS`: Age threshold for archival (default: 30) These can be set in the cron job definition or agent environment. ## Quick Start ### Manual run ```bash python scripts/consolidate_memory.py ``` ### Scheduled run (cron) ```bash openclaw cron add \ --name "memory-consolidation" \ --schedule '{"kind":"cron","expr":"0 3 * * 0"}' \ --payload '{"kind":"systemEvent","text":"Run memory-manager weekly consolidation"}' \ --sessionTarget main ```