Memory compact

From Fr-e-d/GAAI-framework · View interactive version

Memory compact is an AI agent skill from the GitHub repository Fr-e-d/GAAI-framework. Emergency single-pass memory compression when context window pressure is high mid-task. Activate when approaching token limits during active work. For scheduled end-of-phase cleanup, use memory-refresh instead.

How to use this skill

Skill file

Memory Compact

Purpose / When to Activate

Activate when:

More focused than memory-refresh — this is a single-pass compression operation.


Process

  1. Select memory by category or tags. Read contexts/memory/index.md. Prioritize categories by: (a) largest file count first, (b) oldest entries first, (c) categories not referenced by the current task last. Under extreme pressure, compact the single largest category only.
  1. Classify entries by durability (R7 gate). Before compacting, classify each entry:
  1. Extract key decisions, constraints, priorities
  1. Generate a single summary file replacing multiple entries. Produce one summary file per compacted category using bullet format: one bullet per decision, constraint, or durable fact. Target ≤20% of the original token count. Use the format:
# {Category} — Compact Summary
> Compacted from {N} files on {YYYY-MM-DD}
> Original token estimate: ~{X} | Summary: ~{Y}

## Key Decisions
- {decision 1}
- {decision 2}

## Active Constraints
- {constraint 1}

## Current State
- {fact 1}
  1. Archive detailed originals (ephemeral and superseded only). Archive originals to contexts/memory/archive/{category}-{YYYY-MM-DD}.archive.md. If multiple compactions happen on the same day for the same category, append a sequence number: {category}-{YYYY-MM-DD}-02.archive.md.
  1. Update memory index

Outputs


Quality Checks


Non-Goals

This skill must NOT:

One summary replaces many files. Context stays precise and small.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.