context-compression

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

2|Updated May 30, 2026
One-click install
npx skills add https://github.com/virahitvin8/crafty-gis --skill context-compression-virahitvin8
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-compression
Source: https://github.com/virahitvin8/crafty-gis/tree/main/GIT_STAR/assignment-generator/antigravity-skills-main/antigravity-skills-main/skills/context-compression
Command: npx skills add https://github.com/virahitvin8/crafty-gis --skill context-compression-virahitvin8

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: Maintains persistent structured summaries with dedicated sections for session intent, file modifications, decisions, and next steps, merging new content incrementally instead of regenerating from scratch. - Probe-Based Quality Evaluation: Tests compression quality with recall, artifact, continuation, and decision probes scored across six dimensions including accuracy and artifact trail. - Three-Phase Workflow for Large Codebases: Compresses multi-million-token codebases through research, planning, and implementation phases into compact specifications. - Use Case: A debugging session reaches 89,000 tokens and 178 messages. Use this Skill to compress the history into a structured summary that preserves the root cause, modified files, test status, and next steps 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 with explicit sections for session intent, files modified, decisions, and next steps. Summarize only newly truncated content and merge it into the existing summary rather than regenerating from scratch, which prevents cumulative detail loss.

What is the best context compression strategy for coding agents?

Anchored iterative summarization scores highest for coding agents because it preserves artifact trails and decision rationale. Opaque compression achieves higher ratios but sacrifices interpretability, while regenerative summaries lose details across repeated cycles.

How do I evaluate whether compression preserved 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.

When should context compression be triggered in an agent session?

Trigger compression at 70-80% context utilization as a default, or use a sliding window keeping the last N turns plus a summary. Task-boundary triggers work well when sessions have clear phase transitions like research then implementation.

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

General summarization cannot reliably maintain artifact trails, which benchmark as the weakest dimension across all methods. Implement a separate artifact index tracking file paths, function names, and error messages outside the summarizer.

What should never be compressed in agent context?

Never compress tool definitions, function schemas, or API specs, since summarizing parameter names destroys the agent's ability to invoke tools. Also protect early session turns containing task constraints and preserve code blocks verbatim.