memory-defrag · basicmachines-co — Claude Code skill: what it does, how to install
This skill tidies a Basic Memory project by splitting bloated notes, consolidating facts, and flagging contradictions for review.
npx skills add basicmachines-co/basic-memory --skill memory-defrag -a claude-codeWhat memory-defrag does
memory-defrag audits a Basic Memory project for notes that have grown across several topics, repeat the same facts, contain stale work, or disagree with other notes. Its audit uses bm_find, bm_project, and bm_search to inspect the project, review recent activity, search one topic, and find due commitments that may still be hanging around.
The skill writes a plan before changing anything. The plan can propose focused notes, consolidated facts, dated changes backed by a source, or items that need review. Splitting, preserving source notes, and updating status can be applied directly; deletion, merging, dropping facts, and resolving an undated contradiction require explicit permission. Before an edit, it reads the note as JSON and passes expected_checksum, then records what happened in the plan.
memory-defrag handles note content, while memory-curate handles links, relations, and tags. Raw meeting notes, daily logs, and captures are kept. That matters when the project contains conflicting records: unless a dated source explains the change, the skill leaves both claims in the plan for review.
What it helps with
- split a note that covers several topics
- consolidate one topic’s facts across scattered notes
- date a decision change from a supporting source
- retire completed work and move it toward an archive
- surface an undated contradiction for review
Example prompts for the agent
- Run memory-defrag on my Basic Memory project and write the review plan before making changes.
- Audit the notes about “launch plan”, find overlap and contradictions, and do not delete anything.
- Apply only changes that preserve the information, then update the defrag plan with the result.
How to install memory-defrag
1Skills CLI (Vercel)
npx skills add basicmachines-co/basic-memory --skill memory-defrag -a claude-code2Manually: put the files in place
~/.claude/skills/memory-defrag/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/memory-defrag/
1Skills CLI (Vercel)
npx skills add basicmachines-co/basic-memory --skill memory-defrag -a codex2Manually: put the files in place
.agents/skills/memory-defrag/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add basicmachines-co/basic-memory --skill memory-defrag -a cursor2Manually: put the files in place
.cursor/skills/memory-defrag/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install basicmachines-co/basic-memory memory-defrag2Manually: put the files in place
.github/skills/memory-defrag/SKILL.md1Skills CLI (Vercel)
npx skills add basicmachines-co/basic-memory --skill memory-defrag -a gemini-cli2Platform CLI
gemini skills install https://github.com/basicmachines-co/basic-memory --path skills/memory-defragManually: put the files in place
.devin/skills/memory-defrag/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add basicmachines-co/basic-memory --skill memory-defrag -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about memory-defrag
How do I install memory-defrag in Claude Code?
Run npx skills add basicmachines-co/basic-memory --skill memory-defrag -a claude-code, then run the same command again. The skill file will be available at ~/.claude/skills/memory-defrag/SKILL.md.
What does memory-defrag do?
It audits a Basic Memory project, finds bloated, duplicate, stale, and contradictory notes, and writes a plan for cleanup. It does not choose a winner for an undated conflict or remove content without explicit permission.
Does memory-defrag delete raw notes?
No. Meeting notes, daily logs, and captures are kept as source material. Deleting, merging, dropping facts, and resolving undated contradictions stay proposed until someone authorizes those changes.
Similar skills
All skills for Agent setup: memory, context, orchestration →memory-defrag by other authors comes first.