context-compression

Compress long-running agent session contexts into structured persistent summaries.

Updated Dec 5, 2025
One-click install
npx skills add https://github.com/mhismail3/dotfiles --skill context-compression
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-compression
Source: https://github.com/mhismail3/dotfiles/tree/main/claude/skills/context-compression
Command: npx skills add https://github.com/mhismail3/dotfiles --skill context-compression

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

As agents run long, context balloons. Compression saves tokens per task by preserving signals while trimming noise.

Core Features & Use Cases

  • Anchored Iterative Summarization
  • Opaque Compression
  • Regenerative Full Summary

Quick Start

Configure a compression policy that merges new summaries with a persistent anchor and produces a compact per-task summary.

Frequently Asked Questions about context-compression

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

FAQPage Schema
How do I compress long agent context to reduce token usage?

Context compression minimizes tokens in long-running agent sessions by preserving critical signals while trimming noise. Use anchored iterative summarization to merge new summaries with a persistent anchor, producing compact per-task summaries that balance fidelity against reconstruction cost.

What happens to file modifications when agent context gets compressed?

Artifact tracking explicitly logs created, modified, and read files within compressed contexts. This prevents debugging cases where file changes are forgotten after summarization, maintaining visibility into agent state across session boundaries.

Can I compress context while preserving conversation history?

Yes. Structured, persistent summaries with explicit sections enable context compression while retaining essential conversation signals. Three production-ready variants—anchored iterative summarization, opaque compression, and regenerative full summarization—offer different trade-offs between compression ratio and reconstruction fidelity.

When should I use context compression in agent design?

Apply compression when agents face context window limits, designing conversation summarization strategies or evaluating compression approaches. It's essential for debugging forgotten modifications and building evaluation frameworks for compression quality in coding or debugging sessions.

What's the difference between opaque compression and regenerative summarization?

Opaque compression encodes context densely without explicit structure, minimizing size at the cost of reconstruction complexity. Regenerative full summarization rebuilds complete context on demand, prioritizing fidelity and debuggability over compression ratio in trade-off scenarios.