memory-doctor

Consolidates Claude Code auto-memory files to reduce per-session token costs.

Updated Jul 22, 2026
One-click install
npx skills add https://github.com/Trigent-Software-Pvt-Ltd/trigen-aidlc --skill memory-doctor-trigent-software-pvt-ltd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: memory-doctor
Source: https://github.com/Trigent-Software-Pvt-Ltd/trigen-aidlc/tree/main/plugins/memory-doctor/skills/memory-doctor
Command: npx skills add https://github.com/Trigent-Software-Pvt-Ltd/trigen-aidlc --skill memory-doctor-trigent-software-pvt-ltd

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Claude Code's auto-memory system grows noisy over time: MEMORY.md is preloaded into every session's system prompt, so bloat costs tokens on every run, while noisy individual memory files dilute the signal used to decide what to load. This Skill audits and consolidates the entire memory store in one pass and reports the token savings. ## Core Features & Use Cases - MEMORY.md Consolidation: Shrinks the preloaded index using detection and apply rules defined in reference documents. - Memory Body Trimming: Trims individual user, feedback, project, and reference memory files that load on demand. - Snapshot-Based Safety: Takes a full snapshot before any write, supports atomic tempfile-plus-rename writes, and offers a single end-of-run keep/undo decision with automatic rollback on failure. - Use Case: Your sessions feel heavy and memory files look noisy. Run /memory-doctor to consolidate everything, review the token savings summary, and confirm or undo with one reply. ## Quick Start Ask Claude to run /memory-doctor to audit and consolidate your auto-memory storage, then reply confirm or undo after reviewing the summary.

Frequently Asked Questions about memory-doctor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce Claude Code memory token usage?

Run /memory-doctor to consolidate MEMORY.md and trim individual memory file bodies in one pass. It reports token savings per phase and lets you keep or undo all changes with a single reply.

How do I clean up MEMORY.md in Claude Code?

Use the /memory-doctor command, which applies consolidation rules to the MEMORY.md index automatically. A snapshot is taken before any write, so you can revert everything by replying undo at the end-of-run prompt.

Can I undo changes made to my memory files?

Yes, the skill snapshots the entire memory directory before any modification. Reply undo at the decision prompt to restore from the snapshot, or confirm to delete the snapshot and keep the changes.

Where does Claude Code store auto-memory files?

Memory files live in the path set by autoMemoryDirectory in ~/.claude/settings.json, or by default in ~/.claude/projects/<encoded-cwd>/memory/ where the cwd path has slashes replaced by dashes. The skill resolves this location automatically during preflight.

What happens if memory-doctor fails partway through?

On a write failure or MEMORY.md parse error, the run aborts and the memory directory is automatically restored from the snapshot. Individual memory file parse errors are logged and skipped without stopping the run.