Maintenance CLI for the Claude Code / OpenClaw file-based memory system.
Project description
memory-doctor
Maintenance CLI for the Claude Code / OpenClaw file-based memory system. Four verbs:
memory-doctor status # read-only summary
memory-doctor lint # find dead [[wiki-links]]; exit 1 if any
memory-doctor ingest [--apply] # promote pending handoffs into cards
memory-doctor compact [--apply] # flatten multi-line MEMORY.md entries into topic files
ingest and compact default to dry-run; pass --apply to actually write.
Install
pipx install git+https://github.com/solomonneas/memory-doctor
Or from a local clone:
git clone https://github.com/solomonneas/memory-doctor && cd memory-doctor
pipx install .
Requires Python 3.10+. No runtime dependencies beyond stdlib.
Configuration
| What | Flag | Env | Default |
|---|---|---|---|
| Memory dir (cards + MEMORY.md) | --memory-dir PATH |
MEMORY_DOCTOR_MEMORY_DIR |
~/.claude/projects/<project-scope>/memory |
| Handoffs dir | --handoffs-dir PATH |
MEMORY_DOCTOR_HANDOFFS_DIR |
~/.openclaw/workspace/.claude/memory-handoffs |
| MEMORY.md threshold (lines) | --max-lines N |
MEMORY_DOCTOR_MAX_LINES |
180 |
<project-scope> is the dash-prefixed home-dir path Claude Code uses to scope per-project memory (e.g. -home-alice for user alice, -home-bob for user bob). The defaults are tuned for the OpenClaw layout. Override via flags or env for other setups.
What each verb does
status
Prints memory dir path, card count, MEMORY.md line+byte count, threshold status, dead-link count, handoffs dir path, pending + processed counts, oldest pending age. Exits 0. --json for a structured payload.
lint
Walks every .md in the memory dir, extracts [[wiki-link]] references, checks whether each target exists. Reports dead links grouped by source file with a closest-match suggestion (Levenshtein distance ≤ 3). Exits 0 if zero dead links, 1 if any (so you can gate a pre-commit hook on it).
ingest
Sweeps the handoffs dir for unprocessed *.md files matching the standard handoff template. For each one:
Recommended memory action: create-cardwrites a new card to the memory dir; skips on conflict (use--forceto overwrite)Recommended memory action: update-cardappends the suggested content to an existing card; errors if the target is missingRecommended memory action: no-cardjust moves the handoff toprocessed/
Successful handoffs are moved into <handoffs-dir>/processed/. Dry-run by default; --apply writes.
compact
Reads MEMORY.md, counts lines. If above the threshold, identifies multi-line entries (bullets whose detail spans more than one line) and proposes flattening them: keep the one-liner in the index, append the detail to the target topic file under a ## From index (YYYY-MM-DD) section. Dry-run by default; --apply writes (topic files first, MEMORY.md last). Refuses if a target topic file is missing (would orphan content). Warns if compaction alone won't bring MEMORY.md under threshold.
Examples
# Daily morning check:
memory-doctor status
# Drain the inbox:
memory-doctor ingest --apply
# Bring MEMORY.md back under threshold:
memory-doctor compact --apply
# Pre-push hook:
memory-doctor lint
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file memory_doctor-0.1.0.tar.gz.
File metadata
- Download URL: memory_doctor-0.1.0.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a95207f1a3e26c70855ca420c03e1ec61f999b75a74c992486a06f20cc2f3b5f
|
|
| MD5 |
e4576f1930b936530b57a077663a986e
|
|
| BLAKE2b-256 |
ddddc5dc30f695dff7a7b89e3c4db4801bdf32a357484889250055e193f3af6e
|
File details
Details for the file memory_doctor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: memory_doctor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6ac1e3e45ecd9344190d22a034106272864342caf6e92b75add0427bcae739c
|
|
| MD5 |
69452a55a9c1b8e677a7a68211b24ef6
|
|
| BLAKE2b-256 |
9674b1f5e67fc608f03563fcc062255703c65913be93a1079d042555aaaeaaf3
|