context-compression

Compress long-running agent session context with anchored iterative summarization.

4|Updated Dec 23, 2025
One-click install
npx skills add https://github.com/ken-cavanagh-glean/fieldkit --skill context-compression-ken-cavanagh-glean
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-compression
Source: https://github.com/ken-cavanagh-glean/fieldkit/tree/main/plugins/context-engineering/skills/context-engineering/context-compression
Command: npx skills add https://github.com/ken-cavanagh-glean/fieldkit --skill context-compression-ken-cavanagh-glean

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Long-running agent sessions often generate huge conversation histories that exceed context windows, waste tokens, and impair memory of important decisions. This skill provides structured context compression to keep essential signals while reducing payload size.

Core Features & Use Cases

  • Anchored Iterative Summarization: maintain persistent, sectioned summaries and merge new content incrementally to preserve decisions, file changes, and intent.
  • Opaque vs Regenerative Approaches: choose between high compression with fidelity trade-offs or full summaries for interpretability.
  • Use Case: debugging a 1000+ turn session by extracting a concise state and prioritized next steps without re-reading the entire history.

Quick Start

Trigger the compression process when context utilization approaches the context window, then merge the new summary with existing state for seamless continuation.

Frequently Asked Questions about context-compression

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

FAQPage Schema
How do I reduce token usage in long-running agent sessions?

Context compression reduces token usage by summarizing conversation history into structured sections while preserving essential decisions, file changes, and next steps. Apply anchored iterative summarization to merge new content incrementally, avoiding full regeneration and maintaining artifact trails across extended sessions.

What's the best way to preserve agent memory when context windows are exhausted?

Structured context compression maintains memory through persistent, sectioned summaries that capture intent, decisions, and file state. Incremental merging preserves continuity without re-reading full history, enabling seamless task resumption when conversation logs exceed available context.

Can I compress context without losing critical information?

Anchored iterative summarization balances compression fidelity by choosing between opaque high-compression or regenerative full-summary approaches. The skill extracts prioritized signals—decisions, changes, and next steps—while reducing payload, so you retain what matters for task continuity.

When should I trigger context compression in an agent workflow?

Trigger compression when context utilization approaches your context window limit. Merge the new summary with existing state to maintain a concise, actionable snapshot. This prevents token waste and memory loss in debugging, analysis, or multi-turn problem-solving scenarios.

How does incremental merging work compared to regenerating summaries from scratch?

Incremental merging appends new conversation content to existing sectioned summaries instead of regenerating them entirely. This approach preserves decision trails and reduces computational cost while maintaining fidelity, making it efficient for sustained agent sessions.