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

Installs 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

More from basicmachines-co/basic-memory-skills

All 10
1dig1t avatarluau-best-practicesdig1t/skillsLuau best practices and clean code patterns for Roblox development. Use this skill when: - Writing new Luau modules, services, or controllers - Reviewing code f643skills.sh installs
2alirezarezvani avatarprompt-engineer-toolkitalirezarezvani/claude-skillsTurns marketing prompts into tested, versioned production assets: A/B prompt evaluation against structured test cases, immutable prompt version history with dif638skills.sh installs
3alirezarezvani avatarincident-commanderalirezarezvani/claude-skillsComprehensive incident response framework from detection through resolution and post-incident review. Battle-tested SRE/DevOps practices: severity classificatio627skills.sh installs
4dotnet avatarmcp-csharp-debugdotnet/skillsRun and debug C# MCP servers locally. Covers IDE configuration, MCP Inspector testing, GitHub Copilot Agent Mode integration, logging setup, and troubleshooting626skills.sh installs
5mohitmishra786 avatarrust-securitymohitmishra786/low-level-dev-skillsRust security skill for supply chain safety and memory-safe development. Use when auditing dependencies with cargo-audit, enforcing policies with cargo-deny, re624skills.sh installs
6alirezarezvani avatarboard-meetingalirezarezvani/claude-skillsMulti-agent board meeting protocol for strategic decisions. Runs a structured 6-phase deliberation: context loading, independent C-suite contributions (isolated622skills.sh installs