Agent skill
memory-compact
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.
Install this agent skill to your Project
npx add-skill https://github.com/Fr-e-d/GAAI-framework/tree/main/.gaai/core/skills/cross/memory-compact
Metadata
Additional technical details for this skill
- id
- SKILL-MEMORY-COMPACT-001
- track
- cross-cutting
- author
- gaai-framework
- status
- stable
- version
- 1.0
- category
- cross
- updated at
- 1772323200
SKILL.md
Memory Compact
Purpose / When to Activate
Activate when:
- Context window pressure is high
- Memory has grown across many sessions
- A single targeted compression pass is needed
More focused than memory-refresh — this is a single-pass compression operation.
Process
-
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. -
Classify entries by durability (R7 gate). Before compacting, classify each entry:
- Durable (decisions, patterns, project, ops, contacts, domains): only entries with explicit supersession markers (
> SUPERSEDED by DEC-XX,> RETRACTED,> OBSOLETE — {reason}) may be archived. All other entries are ACTIVE and MUST NOT be archived regardless of file size. Note: decisions are already individual ADR files (decisions/DEC-{N}.md). For other oversized durable files → domain-split, not archive. - Ephemeral (sessions): standard compaction applies — summarize and archive.
- Durable (decisions, patterns, project, ops, contacts, domains): only entries with explicit supersession markers (
-
Extract key decisions, constraints, priorities
-
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}
-
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. -
Update memory index
Outputs
contexts/memory/summaries/{category}.summary.mdcontexts/memory/archive/{category}-{YYYY-MM-DD}.archive.mdcontexts/memory/index.md(updated — mandatory)
Quality Checks
- One summary replaces many files
- Context remains precise and small
- No active constraints are lost
- Index reflects current state
- Summary preserves all active decisions and constraints from the originals
- Archive files are never deleted — only moved
- No active durable memory entry archived — only superseded/retracted entries may be archived (R7/R7b)
Non-Goals
This skill must NOT:
- Create new project knowledge
- Invent or reinterpret decisions
- Delete (only archive) source files
One summary replaces many files. Context stays precise and small.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
ci-watch-and-fix
Watch GitHub Actions CI after PR creation, detect failures, extract logs, apply minimal fixes, and re-push — keeping the delivery session alive until CI resolves or escalating after 3 cycles. Activate immediately after gh pr create and before marking the story done.
qa-review
Validate that implemented code fully satisfies Story acceptance criteria, respects rules, and introduces no regressions. This is the hard quality gate — no pass means no delivery. Activate after implementation is complete.
compose-team
Assemble the context bundles for each sub-agent based on evaluate-story output. Produces spawn-ready packages for Planning, Implementation, QA, or MicroDelivery sub-agents. Activate after evaluate-story, before spawning any sub-agent.
coordinate-handoffs
Validate sub-agent handoff artefacts, sequence phase transitions, and manage retry and escalation logic. Activate after each sub-agent terminates to determine next action.
implement
Generate correct, minimal, maintainable code that satisfies a validated Story's acceptance criteria against an execution plan. Activate when a Story is validated, a plan exists, and all prerequisites are unambiguous.
delivery-high-level-plan
Transform validated Stories into a clear, minimal, governed execution plan. Used by the Planning Sub-Agent as the first planning pass before prepare-execution-plan for Tier 2/3, or as the sole planning output for simple Stories.
Didn't find tool you were looking for?