Memory Maintenance
by @maxlauriehutchinson
Intelligent memory management for OpenClaw agents. Reviews daily notes, suggests MEMORY.md updates, maintains directory health, and auto-cleans old files. Recommended for agents with growing memory footprints.
clawhub install memory-maintenanceπ About This Skill
name: memory-maintenance version: 1.0.0 description: "Intelligent memory management for OpenClaw agents. Reviews daily notes, suggests MEMORY.md updates, maintains directory health, and auto-cleans old files. Recommended for agents with growing memory footprints." homepage: https://github.com/MaxLaurieHutchinson/memory-maintenance author: name: "Max Hutchinson" email: "max.hutchinson258@gmail.com" url: "https://github.com/MaxLaurieHutchinson" tags: ["memory", "maintenance", "automation", "agent-improvement", "workflow"] metadata: openclaw: emoji: π§Ή requires: bins: ["gemini", "jq"] env: ["GEMINI_API_KEY"] install: - id: setup kind: script script: ./scripts/install.sh label: "Install memory maintenance"
Memory Maintenance Skill
Intelligent memory management for OpenClaw agents. Reviews daily notes, suggests MEMORY.md updates, maintains directory health, and auto-cleans old files.
Why This Exists
Agents wake up fresh every session. Without maintenance:
This skill automates the tedious work of keeping your agent's memory organized and actionable.
Features
Recommended Model
This skill works well with lightweight models. We recommend:
gemini-2.5-flash (fast, cost-effective)gemini-2.5-flash-lite (if rate limits hit)Both handle the structured output and analysis tasks efficiently.
Quick Start
# Install the skill
clawhub install memory-maintenanceConfigure (optional)
Edit config/settings.json to customize schedule, retention, etc.
Run manually
openclaw skill memory-maintenance runOr let it run automatically via cron (configured during install)
Architecture
Daily Session Notes (memory/YYYY-MM-DD.md)
β
Review Agent (scheduled daily)
β
Structured Suggestions (JSON)
β
Human Review (markdown report)
β
Approved Updates β MEMORY.md
β
Auto-Cleanup (archive old files)
Workflow
1. Daily Review (23:00 by default) - Scans configurable lookback period (default: 7 days) - Checks memory/ directory health - Generates suggestions via LLM - Outputs structured JSON + human-readable markdown
2. Human Review
- Read agents/memory/review-v2-YYYY-MM-DD.md
- Approve/reject suggestions
3. Apply Changes
# Dry run (preview)
openclaw skill memory-maintenance apply --dry-run 2026-02-05
# Apply safe changes (archiving, cleanup)
openclaw skill memory-maintenance apply --safe 2026-02-05
# Apply all (requires confirmation)
openclaw skill memory-maintenance apply --all 2026-02-05
4. Auto-Cleanup (runs after successful review) - Archives reviews older than configured threshold - Deletes archive files older than retention period - Cleans up error logs
Configuration
Edit config/settings.json:
{
"schedule": {
"enabled": true,
"time": "23:00",
"timezone": "Europe/London"
},
"review": {
"lookback_days": 7,
"model": "gemini-2.5-flash",
"max_suggestions": 10
},
"maintenance": {
"archive_after_days": 7,
"retention_days": 30,
"consolidate_fragments": true,
"auto_archive_safe": true
},
"safety": {
"require_approval_for_content": true,
"require_approval_for_delete": true,
"trash_instead_of_delete": true
}
}
Safety
--safe--all + confirmationagents/memory/.trash/ (recoverable for retention period)Commands
# Run review manually
openclaw skill memory-maintenance reviewApply changes
openclaw skill memory-maintenance apply [--dry-run|--safe|--all] DATERun cleanup
openclaw skill memory-maintenance cleanupCheck status
openclaw skill memory-maintenance statusView stats
openclaw skill memory-maintenance stats
Integration with MEMORY.md
The skill suggests updates to standard MEMORY.md sections:
Files
Output
agents/memory/review-v2-YYYY-MM-DD.json β Structured suggestionsagents/memory/review-v2-YYYY-MM-DD.md β Human-readable reportagents/memory/stats.json β Aggregate statisticsArchive
agents/memory/archive/YYYY-MM/ β Monthly bucketsagents/memory/.trash/ β Recoverable deletionsRequirements
brew install gemini-cli)brew install jq)Troubleshooting
"Gemini failed"
β Check GEMINI_API_KEY is set in .env or environment
"No suggestions generated"
β Check daily notes exist in memory/YYYY-MM-DD.md
β Review error logs in agents/memory/error-*.txt
"Too many maintenance tasks"
β Run openclaw skill memory-maintenance apply --safe to archive old files
β Adjust archive_after_days in config
Author
Built by Max Hutchinson as part of an AI agent infrastructure exploration.
License
MIT β Free to use, modify, distribute.
*Part of the Hybrid Agent Architecture. Built for agents that improve over time.*
π‘ Examples
# Install the skill
clawhub install memory-maintenanceConfigure (optional)
Edit config/settings.json to customize schedule, retention, etc.
Run manually
openclaw skill memory-maintenance runOr let it run automatically via cron (configured during install)
βοΈ Configuration
Edit config/settings.json:
{
"schedule": {
"enabled": true,
"time": "23:00",
"timezone": "Europe/London"
},
"review": {
"lookback_days": 7,
"model": "gemini-2.5-flash",
"max_suggestions": 10
},
"maintenance": {
"archive_after_days": 7,
"retention_days": 30,
"consolidate_fragments": true,
"auto_archive_safe": true
},
"safety": {
"require_approval_for_content": true,
"require_approval_for_delete": true,
"trash_instead_of_delete": true
}
}
π Tips & Best Practices
"Gemini failed"
β Check GEMINI_API_KEY is set in .env or environment
"No suggestions generated"
β Check daily notes exist in memory/YYYY-MM-DD.md
β Review error logs in agents/memory/error-*.txt
"Too many maintenance tasks"
β Run openclaw skill memory-maintenance apply --safe to archive old files
β Adjust archive_after_days in config