Skip to content

Structured process for auditing, splitting, merging, and pruning agent memory files on a schedule or on demand.

CCM score
60 of 100
skills.sh installs
664
GitHub stars
23
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers an audit of memory files, a problem table (bloat, duplicates, stale entries, orphans, inconsistencies), a written plan, and a logged execution step
  • Includes a guideline set: preserve raw daily notes, target 15 to 25 focused files, and keep one level of directories
  • Enforces a conservative rule: uncertain information is kept with a (review needed) tag rather than deleted
  • Designed for agents with growing MEMORY.md files, running weekly via cron or triggered when a file passes about 500 lines

Install

$ npx -y skills add basicmachines-co/basic-memory-skills --skill memory-defrag -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Memory Defrag

Reorganize memory files for clarity, efficiency, and relevance. Like filesystem defragmentation but for knowledge.

When to Run

  • Periodic: Weekly or biweekly via cron (recommended)
  • On demand: User asks to clean up, reorganize, or defrag memory
  • Threshold: When MEMORY.md exceeds ~500 lines or daily notes accumulate without consolidation

Process

1. Audit Current State

Inventory all memory files:

MEMORY.md           — long-term memory
memory/             — daily notes, tasks, topical files
memory/tasks/       — active and completed tasks

For each file, note: line count, last modified, topic coverage, staleness.

2. Identify Problems

Look for these common issues:

Details

Repository
github.com/basicmachines-co/basic-memory-skills
Category
Memory & Context
First seen
Jun 3, 2026

Questions

What does the memory-defrag skill do?

memory-defrag reorganizes agent memory files by splitting bloated files, merging duplicates, removing stale information, and restructuring the memory hierarchy. It works on MEMORY.md, the memory/ folder and its task notes, and is meant to run weekly or on demand.

When should I run memory-defrag?

memory-defrag suggests running periodically, weekly or biweekly via cron, or on demand when you ask to clean up memory. It also recommends a run once MEMORY.md exceeds about 500 lines or daily notes pile up without consolidation.

How do I install memory-defrag?

Install it with npx -y skills add basicmachines-co/basic-memory-skills --skill memory-defrag -y, run in a project. Once installed, the agent can audit memory files, plan changes, and log each defrag pass in the day's note.

Where does memory-defrag sit among memory skills?

memory-defrag belongs to the Memory & Context category on Claude Marketplaces, alongside handoff and the caveman skills. Unlike those, it targets memory file upkeep itself, keeping daily notes intact as an audit trail.

More from basicmachines-co/basic-memory-skills

All 10

Similar to Memory Defrag

More Memory & Context