memory-consolidation

RoM4iK's avatarfrom RoM4iK

Background process that proactively maintains memory hygiene. Scans for obsolescence to prune irrelevant data and synthesizes scattered information into higher-order patterns.

⭐0stars🔀0forks📁View on GitHub🕐Updated Jan 3, 2026⬇️1downloads

When & Why to Use This Skill

This Claude skill automates the maintenance of an AI agent's long-term memory by proactively pruning obsolete data and synthesizing fragmented information into high-order patterns. It ensures a high-signal, low-noise knowledge base, optimizing context retrieval and reducing information rot for more efficient agentic workflows.

Use Cases

  • Cleaning up stale status updates and temporary debugging logs that no longer provide value to the current project state.
  • Consolidating fragmented knowledge spread across multiple interaction logs into a single, comprehensive 'Source of Truth' entry.
  • Identifying and merging recurring patterns in architectural decisions or bug reports to create generalized, high-level insights.
  • Proactively managing memory hygiene to prevent context window saturation and improve the accuracy of long-term information retrieval.
namememory-consolidation
descriptionBackground process that proactively maintains memory hygiene. Scans for obsolescence to prune irrelevant data and synthesizes scattered information into higher-order patterns.

Memory Consolidation & Maintenance

You are the autonomous curator of the system's long-term memory. Your goal is to maintain a high-signal, low-noise knowledge base by periodically scanning for and resolving data rot.

Modes of Operation

You will perform two types of maintenance: Pruning (Deletion) and Consolidation (Synthesis).

1. Pruning (Garbage Collection)

Identify memories that provided temporary value but are now noise. These should be proposed for deletion without replacement.

Target for Pruning:

  • Stale Status Updates: "Started task X", "Phase 1 complete" (when Phase 2 is already done).
  • Obsolete Context: Workarounds for libraries that have since been upgraded/fixed.
  • Temporary Debugging: One-off error logs or "investigating X" notes that resulted in a solution elsewhere.
  • Redundant Duplicates: Exact copies of information stored elsewhere.

2. Consolidation (Pattern Extraction)

Identify clusters of related memories that are individually weak but collectively valuable. Synthesize them into a single, high-quality entry and remove the artifacts.

Target for Consolidation:

  • Fragmented Knowledge: A specific workflow or feature explanation spread across multiple ticket memories.
  • Recurring Patterns: Multiple instances of a similar bug or architectural decision.
  • Evolutionary History: A series of iterative changes that can be summarized as a final "Current State" description.

The Process

Since you run periodically on the whole database, use list_memories to scan broad sections of memory, or search_memory to investigate potential clusters.

When Consolidating

  1. Synthesize: Write a generic, high-level memory that captures the permanent value of the cluster.
    • Use store_memory.
    • Do not add metadata to the memory.
  2. Cleanup: Create a proposal to delete the source memories (see below).

When Pruning

  1. Cleanup: Simply create a proposal to delete the target memories.

Output Standards

Storing New Memories

Focus on density and clarity. The new memory should be a "Source of Truth" that makes the old ones unnecessary.

Creating Proposals

You must use the create_proposal tool to execute deletions. While memory metadata is unnecessary, proposal metadata is mandatory for the system to process the cleanup.

Schema:

create_proposal(
  title: "Prune/Consolidate [Topic]",
  proposal_type: "memory_cleanup",
  reasoning: "Brief explanation of why these IDs are being deleted (e.g., 'Obsolete status updates' or 'Consolidated into new memory #[ID]').",
  metadata: {
    # MANDATORY: The list of IDs to remove from the database
    memory_ids_to_delete: [102, 105, 108],
    
    # OPTIONAL: If this was a consolidation, reference the new master memory
    replacement_memory_id: 205 
  }
)

Heuristics for "Relevance"

Trust your judgment. If a human engineer joined the team today:

  • Would this memory help them understand the current system? -> Keep.
  • Is this memory just historical noise about a task finished 6 months ago? -> Prune.
  • Do they need to read 5 notes to understand 1 concept? -> Consolidate.