Maintenance — File Hygiene, Reviews, and Upgrades
How to keep the memory system healthy over time.
Writing Effective Memory Files
Memory files are your searchable corpus. Their quality directly affects recall quality.
Good practices
- Use clear headings —
## API Access,## Camera Names— these become search anchors. - Front-load key info — put the most important facts in the first few lines.
- Use consistent naming — e.g.
memory/technical/frigate.mdrather than long ad-hoc names. - Include keywords — if someone might search “Frigate password”, make sure both words appear near each other.
- Keep files focused — one topic per file; avoid mega-docs.
- Use tables for structured data — camera lists, entity IDs, API endpoints chunk better than long prose.
Bad practices
- Huge monolithic files (>5000 chars) — harder to chunk meaningfully.
- Files with only links and no content — nothing to embed.
- Duplicating info across files — creates conflicting search results.
- Stale files never reviewed — outdated info pollutes recall.
- Putting reference data in bootstrap files — wastes context tokens every turn.
File size guidelines
| File type | Target size | Why |
|---|---|---|
| Bootstrap files (TOOLS.md, MEMORY.md, etc.) | <3000 chars | Loaded every turn, context cost |
| Memory files (technical, projects) | 500–3000 chars | Fits well in 500-token chunks |
| Decision logs | Any size | Append-only, searched by date |
| People profiles | 500–1500 chars | Focused, rarely massive |
Periodic Review
Use your HEARTBEAT.md checklist or a periodic reminder:
- Read recent
memory/YYYY-MM-DD.mddaily files. - Identify significant events, lessons, insights worth keeping long-term.
- Update relevant
memory/files with distilled learnings. - Update
MEMORY.mdindex if new files were created. - Remove outdated info from files that’s no longer relevant.
- Archive completed projects: move from
memory/projects/tomemory/archive/.
MEMORY.md as root index
Keep it as a lightweight pointer file: links to active projects, people, technical docs; status emojis. No detailed content — just enough to orient the agent. Keep under ~3k tokens.
Daily files (memory/YYYY-MM-DD.md)
Raw session logs. Write what happened, decisions made, issues found. Searchable via memorySearch, source material for periodic reviews, not loaded at bootstrap.
Deploying to a New or Existing System
Use this flow whether the system is brand new, a few days old, or has been running for months:
- Workspace: Create or use workspace root.
- memory/ layout: Create subdirs:
people/,projects/,technical/,companies/,decisions/,archive/. - Bootstrap files: Create or update AGENTS.md (include Memory Protocol), SOUL.md, USER.md, TOOLS.md, MEMORY.md, HEARTBEAT.md, IDENTITY.md.
- Plugin: Install per QUICKSTART.md.
- Config: Merge CONFIGURATION.md settings into
openclaw.json. - Restart:
openclaw gateway stopthenopenclaw gateway start. - Optional — Backfill: See QUICKSTART.md § Backfill.
- Verify:
openclaw hybrid-mem verify.
Backfill from session logs
If you’ve been running OpenClaw without memory files, spawn a sub-agent:
“Scan my recent session logs (last 30 days) at
~/.openclaw/agents/main/sessions/. Creatememory/projects/,memory/technical/,memory/people/, andmemory/companies/files from what you find. UpdateMEMORY.mdindex.”
Then run the backfill script to seed the plugin DBs from the new files.
Upgrading OpenClaw
Important: After every OpenClaw upgrade (e.g. npm update -g openclaw), the memory-hybrid plugin’s native dependencies can break. You must reinstall extension deps and restart the gateway.
→ Full guide: UPGRADE-OPENCLAW.md
Recommended: upgrade scripts + alias
- Copy
scripts/post-upgrade.shandscripts/upgrade.shfrom this repo into~/.openclaw/scripts/. - Make executable:
chmod +x ~/.openclaw/scripts/*.sh - Add alias to
~/.bashrc:alias openclaw-upgrade='~/.openclaw/scripts/upgrade.sh' - Run
openclaw-upgradefor one-command upgrades.
Why this is needed
Global npm upgrades reinstall the top-level openclaw package without re-running npm install inside extension directories. The plugin depends on native modules (better-sqlite3, @lancedb/lancedb) that need to be reinstalled in the extension dir.
If you upgrade by other means, run ~/.openclaw/scripts/post-upgrade.sh manually, then restart.
Related docs
- UPGRADE-OPENCLAW.md — What to do after every OpenClaw upgrade
- UPGRADE-PLUGIN.md — Upgrading the hybrid-memory plugin
- BACKUP.md — What to back up and how to restore
- UNINSTALL.md — Uninstalling the solution
- OPERATIONS.md — Background jobs, cron, scripts, upgrading
- EXAMPLES.md — Monthly maintenance routine and other recipes
- QUICKSTART.md — Installation
- CONFIGURATION.md — Config reference
- TROUBLESHOOTING.md — Common issues
- CLI-REFERENCE.md — All CLI commands
- SESSION-DISTILLATION.md — Session distillation pipeline