context-compression

Compress long agent conversation histories into structured summaries preserving files, decisions, and next steps.

Updated Aug 7, 2026
One-click install
npx skills add https://github.com/Sambhav242005/Major-Project --skill context-compression-sambhav242005
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-compression
Source: https://github.com/Sambhav242005/Major-Project/tree/main/.agents/skills/context-compression
Command: npx skills add https://github.com/Sambhav242005/Major-Project --skill context-compression-sambhav242005

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Long-running AI agent sessions exceed context window limits, and naive summarization loses critical details like file paths, error messages, and decision rationale, forcing agents to wastefully re-fetch information. ## Core Features & Use Cases - Anchored Iterative Summarization: Maintain persistent structured summaries with dedicated sections for session intent, files modified, decisions, and next steps, merging new content incrementally instead of regenerating from scratch. - Probe-Based Evaluation: Test compression quality with recall, artifact, continuation, and decision probes scored across six dimensions including accuracy and artifact trail. - Use Case: A coding agent debugging a 401 error across 178 messages compresses its history into a structured summary that retains the exact endpoint, root cause, modified files, and remaining test failures so work continues without re-reading files. ## Quick Start Ask the agent to compress the current session history into a structured summary with sections for intent, files modified, decisions, and next steps.

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 conversation history without losing context?

Use anchored iterative summarization: maintain a persistent structured summary with sections for intent, files modified, decisions, and next steps, then merge only newly truncated content on each compression trigger. This prevents the cumulative detail loss caused by regenerating summaries from scratch.

What is the best compression strategy for coding agents?

Anchored iterative summarization scores highest for coding agents because it preserves file paths, function names, and decision rationale. Sliding window triggers at 70-80% context utilization provide the best balance of predictability and quality.

How do I evaluate whether compression lost important information?

Use probe-based evaluation instead of metrics like ROUGE. After compression, ask recall, artifact, continuation, and decision questions, then score responses across six dimensions including accuracy, artifact trail, and continuity.

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

General summarization cannot reliably maintain artifact trails, which benchmark as the weakest dimension across all methods. Implement a separate artifact index or explicit file-state tracking outside the summarizer to preserve file paths and changes.

When should I not use aggressive context compression?

Avoid aggressive or opaque compression when debugging, file tracking, or verification matters, since it sacrifices interpretability and forces costly re-fetching. Also never compress tool definitions, code blocks, or early turns containing task constraints.