# memory-defrag

This skill tidies a Basic Memory project by splitting bloated notes, consolidating facts, and flagging contradictions for review.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1200 installs · ★ 4357
- Author: basicmachines-co
- License: AGPL-3.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/basicmachines-co/basic-memory/tree/HEAD/skills/memory-defrag/SKILL.md
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/skills/memory-defrag

## What it 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.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add basicmachines-co/basic-memory --skill memory-defrag -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/memory-defrag/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/memory-defrag/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add basicmachines-co/basic-memory --skill memory-defrag -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/memory-defrag/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add basicmachines-co/basic-memory --skill memory-defrag -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/memory-defrag/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install basicmachines-co/basic-memory memory-defrag
```

2. **Manually: put the files in place**
- File: `.github/skills/memory-defrag/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add basicmachines-co/basic-memory --skill memory-defrag -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/basicmachines-co/basic-memory --path skills/memory-defrag
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/memory-defrag/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add basicmachines-co/basic-memory --skill memory-defrag -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/basicmachines-co/basic-memory/tree/HEAD/skills/memory-defrag/SKILL.md

## When to use it
- 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
- 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.

## Similar
- [memory-intake](https://affpapa.org/en/nevibecode/skills/memory-intake.md) — skill · 766 installs
- [memory-reflect](https://affpapa.org/en/nevibecode/skills/basicmachines-co-memory-reflect.md) — skill · 746 installs
- [memory-lifecycle](https://affpapa.org/en/nevibecode/skills/basicmachines-co-memory-lifecycle.md) — skill · 546 installs
- [memory-spring-cleaning](https://affpapa.org/en/nevibecode/commands/memory-spring-cleaning.md) — command · 391 installs
- [archive](https://affpapa.org/en/nevibecode/skills/archive.md) — skill · 1200 installs
- [para-memory-files](https://affpapa.org/en/nevibecode/skills/para-memory-files.md) — skill · 1800 installs

## Other versions with the same name
- [memory-defrag · basicmachines-co](https://affpapa.org/en/nevibecode/skills/basicmachines-co-memory-defrag.md) — 632 installs

From the same set: [basicmachines-co/basic-memory](https://affpapa.org/en/nevibecode/by/basicmachines-co/basic-memory.md) — 14 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
