context-compression

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

Updated Jul 10, 2026
One-click install
npx skills add https://github.com/CodeCrafterAdi2006/Ink-and-Code --skill context-compression-codecrafteradi2006
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-compression
Source: https://github.com/CodeCrafterAdi2006/Ink-and-Code/tree/main/Skills/Context_Compression
Command: npx skills add https://github.com/CodeCrafterAdi2006/Ink-and-Code --skill context-compression-codecrafteradi2006

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Long-running agent sessions exceed context window limits, and naive compression loses critical information like file paths, error messages, and decision rationale, forcing costly re-exploration. ## Core Features & Use Cases - Anchored Iterative Summarization: Maintain structured summaries with explicit sections for session intent, files modified, decisions, and next steps, merging new spans incrementally instead of regenerating. - Probe-Based Evaluation: Generate recall, artifact, continuation, and decision probes from conversation history, then score responses across six dimensions (accuracy, context awareness, artifact trail, completeness, continuity, instruction following). - Use Case: A debugging session reaches 89,000 tokens across 178 messages. Use this Skill to compress the history into a structured summary preserving the root cause, modified files, and failing tests, then validate the compression with automated probes. ## 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 structured summary with explicit sections for session intent, files modified, decisions, and next steps. On each compression trigger, summarize only the newly truncated span and merge it into existing sections rather than regenerating the whole summary.

How do I evaluate context compression quality?

Use probe-based evaluation instead of lexical metrics like ROUGE. Generate recall, artifact, continuation, and decision probes from the original history, collect model responses using the compressed context, and score them across six dimensions including accuracy and artifact trail.

What is the difference between anchored iterative, regenerative, and opaque compression?

Anchored iterative summarization merges new spans into persistent structured sections and scores highest on quality (3.70). Regenerative summaries regenerate fully each cycle and suit sessions with clear phase boundaries. Opaque compression achieves the highest ratio (99.3%) but sacrifices interpretability and verifiability.

When should I trigger context compression in an agent session?

Default to a sliding window trigger at 70-80% context utilization for coding agents, keeping recent turns plus a structured summary. Use task-boundary triggers when sessions have clear phase transitions such as research, implementation, and testing.

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

Artifact trail is the weakest dimension across all compression methods, scoring 2.19-2.45 in benchmarks. General summarization cannot reliably track file operations, so implement a separate artifact index or explicit file-state tracking outside the summarizer.

What should never be compressed in agent context?

Never compress tool definitions, function call schemas, or API specs, since summarizing parameter names or types breaks tool invocation entirely. Also protect early turns containing task constraints and preserve code blocks, file paths, and error codes verbatim.