
Memory Defrag
Runs maintenance on your agent's memory files when they get messy. Splits bloated files over 300 lines into focused topics, merges duplicates, prunes stale task references and outdated project statuses, and cleans up directory structures. The guide suggests running it weekly or when MEMORY.md hits 500 lines. Nice touch that it preserves raw daily notes as an audit trail and includes a planning step before making changes. Basically defragmentation for knowledge files. If you're working with agents that accumulate memory over time, this keeps things from turning into an unsearchable mess.
- skills.sh installs
- 643
- GitHub stars
- 23
- last updated
- Aug 21, 2026
Install
$ npx -y skills add basicmachines-co/basic-memory-skills --skill memory-defrag --agent claude-codeInstalls into .claude/skills of the current project.
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:
Sponsors
Details
- Repository
- github.com/basicmachines-co/basic-memory-skills
- Categories
- Git & Pull Requests, AI & Agent Building
- First seen
- Jun 3, 2026