# Memory Consolidation

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

- Skill: `majiayu000/memory-consolidation` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds add majiayu000/memory-consolidation`
- Raw SKILL.md: https://api.skillmd.com/api/skills/majiayu000/memory-consolidation/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: majiayu000 (https://skillmd.com/u/majiayu000)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/majiayu000/memory-consolidation

---


# 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:**
```ruby
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**.
