context-compression

Implements structured summarization strategies to compress long agent conversation histories.

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/TECH-HY/SKILLS --skill context-compression-tech-hy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-compression
Source: https://github.com/TECH-HY/SKILLS/tree/main/skills/context-compression
Command: npx skills add https://github.com/TECH-HY/SKILLS --skill context-compression-tech-hy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Long-running agent sessions generate millions of tokens of conversation history that exceed context window limits, causing agents to forget file modifications, decisions, and error details. This Skill provides compression strategies that optimize tokens-per-task rather than tokens-per-request, preventing costly re-fetching of lost context. ## Core Features & Use Cases - Anchored Iterative Summarization: Maintain structured summaries with explicit sections for session intent, files modified, decisions, and next steps, merging new content incrementally instead of regenerating. - Compression Strategy Selection: Compare anchored iterative, opaque, and regenerative approaches with concrete compression ratios and quality scores to pick the right trade-off. - Probe-Based Evaluation: Test compression quality functionally with recall, artifact, continuation, and decision probes instead of unreliable lexical metrics like ROUGE. - Use Case: A coding agent debugging a 401 authentication error across 178 messages compresses its history into a structured summary preserving the endpoint, root cause, modified files, and test status, then continues work without re-reading any files. ## Quick Start Use the context-compression skill to design a structured summarization strategy for my agent session that is exceeding its context window.

Frequently Asked Questions about context-compression

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

FAQPage Schema
How do I compress conversation history for long-running AI agents?

Use anchored iterative summarization: define explicit summary sections for session intent, files modified, decisions, and next steps, then summarize only newly truncated content and merge it into the existing summary. Trigger compression at 70-80% context utilization.

What is the best context compression strategy for coding agents?

Anchored iterative summarization scores highest on quality (3.70) with 98.6% compression, compared to regenerative (3.44) and opaque (3.35) methods. Structure forces preservation because dedicated sections act as checklists the summarizer must populate.

Why does my agent forget which files it modified after compression?

Artifact trail integrity is the weakest dimension across all compression methods, scoring 2.2-2.5 out of 5.0. General summarization struggles with file tracking, so use a separate artifact index or explicit file-state tracking in the agent scaffolding.

How do I evaluate context compression quality?

Use probe-based evaluation instead of ROUGE or embedding similarity. Ask recall, artifact, continuation, and decision questions after compression; if the agent answers correctly, the compression preserved the right information.

When should I use opaque compression instead of structured summaries?

Use opaque compression when maximum token savings are required (99%+ ratios), sessions are relatively short, and re-fetching costs are low. It sacrifices interpretability, so you cannot verify what was preserved.