compact-memory

Compress memory session files and prune obsolete decisions while syncing facts to the memory graph.

4|4|Updated Apr 6, 2026
One-click install
npx skills add https://github.com/Roentek/Claude_Code_Boilerplate_Framework --skill compact-memory
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compact-memory
Source: https://github.com/Roentek/Claude_Code_Boilerplate_Framework/tree/main/.claude/skills/compact-memory
Command: npx skills add https://github.com/Roentek/Claude_Code_Boilerplate_Framework --skill compact-memory

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents Claude Code sessions from getting slower and noisier by cleaning up stale and redundant memory artifacts while preserving important facts for future use.

Core Features & Use Cases

  • Archive old memory sessions: Compresses .claude/rules/memory-sessions.md by keeping the 4 most recent entries and moving entries older than 30 days into a clearly labeled ## Archive block.
  • Prune dead memory decisions: Audits .claude/rules/memory-decisions.md to remove entries tied to tools, files, or patterns that no longer exist in the project.
  • Sync durable facts to the memory graph: Extracts 3–5 high-signal project facts and writes them as entities to the memory MCP graph via mcp__memory__create_entities so future sessions can query them without loading the full files.

Quick Start

Run /compact-memory to perform a full memory hygiene cycle, report what changed, and sync key facts to the memory MCP graph.

Frequently Asked Questions about compact-memory

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I clean up stale Claude Code memory rules and reduce context bloat?

To reduce context bloat, you can compress memory rule files by archiving session entries older than 30 days and pruning obsolete decisions that reference deleted project files. This memory hygiene process keeps your workspace queryable and lean.

What is the best way to archive old memory sessions in Claude Code projects?

The best way to archive old memory sessions is to retain the 4 most recent entries in your memory rules file while moving entries older than 30 days into a designated Archive block. This preserves recent context while clearing stale session bloat.

How does syncing project facts to a memory graph improve session performance?

Syncing project facts to a memory graph improves performance by extracting high-signal facts into queryable entities. This allows future sessions to retrieve essential project knowledge without loading and processing large, bloated memory rule files.

How do I prune dead memory decisions that reference non-existent files?

To prune dead memory decisions, audit your memory rules file and remove entries tied to tools, files, or patterns that no longer exist in the project. This ensures your context only retains decisions relevant to the current codebase.

Do I need an MCP memory server to sync durable project facts to a knowledge graph?

Yes, syncing durable facts to a memory graph requires an MCP memory server. The process uses the memory MCP to create 3 to 5 queryable entities, allowing future sessions to access key project facts without reloading full memory rule files.

When should I compress memory rule files to maintain context hygiene?

You should compress memory rule files when context grows over time and older sessions degrade performance or relevance. If your project accumulates stale decisions and long-term session bloat, running a memory hygiene cycle restores queryability.