Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add basicmachines-co/basic-memory --skill memory-defrag -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/memory-defrag/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/memory-defrag/

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.

From the same set14

memory-notes Guides coding agents on structuring markdown notes for Basic Memory knowledge graphs. It covers YAML metadata, categorized observations, and wiki-style note relations. CX Codex +1 1,300installs memory-research Researches companies, people, and tools across the web and synthesizes findings into Basic Memory notes. Useful when you need to record structured facts about an external subject. CX Codex +1 1,200installs memory-literary-analysis Turns a complete literary work into a Basic Memory knowledge graph with schemas, chapter notes, linked entities, and validation. CX Codex +1 1,200installs memory-lifecycle Automates note status transitions in Basic Memory. It archives completed work into appropriate folders and updates frontmatter without deleting records. CX Codex +1 1,200installs memory-tasks Keeps work-in-progress as notes in the Basic Memory knowledge graph, so you can find active tasks and resume them after compaction or a restart. CX Codex +1 1,200installs memory-schema Manages note schemas in Basic Memory by finding untyped entries, generating schema definitions, checking field consistency, and catching structural drift. CX Codex +1 1,200installs memory-metadata-search Search Basic Memory notes by YAML frontmatter fields, from status and tags to nested values. Useful when a text query alone cannot narrow the results. CX Codex +1 1,200installs memory-reflect The skill reviews what changed in Basic Memory and carries the durable parts into the notes where they belong. Run it daily or after a burst of work. CX Codex +1 1,200installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor