/install memory-doctor
memory-doctor — keep agent memory healthy
Memory skills write memory; almost none maintain it. Over time a store grows long, contradicts itself, sprouts dead links, and its index drifts — the agent then burns tokens parsing stale history instead of acting. That is context rot. This skill governs an existing store; it does not produce memory.
Producers write, memory-doctor keeps it alive. Complements memory skills, doesn't replace them. Source & issues: \x3Chttps://github.com/casperkwok/memory-doctor>
When to use
- A memory store exists (a
MEMORY.md+*.mdnotes, or a*.mnemefile) and the user wants to check or clean it: "记忆体检 / 整理记忆 / memory health / cleanup / dedup / fix the index". - Memory has clearly grown long, repetitive, or the index no longer matches the files.
How to run (zero deps, Python ≥ 3.9)
# read-only — safe anytime; print the health card first
python scripts/curate.py report --dir \x3Cmemory-dir>
# auto-memory only: preview then apply the index reconciliation (snapshots first)
python scripts/curate.py lint --dir \x3Cmemory-dir>
python scripts/curate.py lint --dir \x3Cmemory-dir> --fix
# revert the last write
python scripts/curate.py undo --dir \x3Cmemory-dir>
The format is auto-detected (*.mneme present → mneme, else auto-memory); override with
--format auto-memory|mneme.
What the report checks
- dead links, stale notes, oversized files, lexical duplicate candidates, and a freshness score (per-type exponential decay).
- auto-memory: index drift (MEMORY.md vs files) and orphans (no inbound link, unindexed).
- mneme: history cells (superseded/retired/proposed) excluded from active health, and
supersede back-link symmetry; freshness uses each cell's
seendate.
What it fixes (v0.1 — deterministic & reversible only)
- Index reconciliation (auto-memory): add missing
MEMORY.mdentries, drop dangling ones, preserving your hand-written hooks. A full-directory snapshot is taken first;undoreverts. - mneme's spine is derived, so there is no index to reconcile — use
report.
Semantic fixes that need a model — true duplicate merge, contradiction reconcile, oversized compaction — are flagged in v0.1 and resolved in v0.2 (no embeddings; manual-apply, snapshot-backed). Never auto-edit memory content on the user's behalf without confirmation.
Safety
Every write snapshots the whole directory to .memory-doctor/snapshots/\x3Cts>/ and logs to
.memory-doctor/changelog.md; undo restores it. v0.1 only ever rewrites the index file.
Optional: a read-only health nudge
hooks/health_nudge.py (in the repo) can be wired to a Claude Code SessionStart hook to print
a one-line nudge when health drops. It is read-only and never edits anything. Opt-in.
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install memory-doctor - After installation, invoke the skill by name or use
/memory-doctor - Provide required inputs per the skill's parameter spec and get structured output
What is memory-doctor?
Keep an LLM agent's long-term memory healthy — the cure for context rot. Use when a memory store exists and the user wants to check or tidy it ("记忆体检", "整理记忆... It is an AI Agent Skill for Claude Code / OpenClaw, with 38 downloads so far.
How do I install memory-doctor?
Run "/install memory-doctor" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is memory-doctor free?
Yes, memory-doctor is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does memory-doctor support?
memory-doctor is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created memory-doctor?
It is built and maintained by Casper (@casperkwok); the current version is v0.1.2.