context-compression

Implements structured summarization strategies to compress long agent conversation histories.

Updated Apr 13, 2026
One-click install
npx skills add https://github.com/scoots31/engineering-playbook --skill context-compression-scoots31
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-compression
Source: https://github.com/scoots31/engineering-playbook/tree/main/references/context-compression
Command: npx skills add https://github.com/scoots31/engineering-playbook --skill context-compression-scoots31

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Long-running AI agent sessions accumulate millions of tokens of conversation history, exceeding context windows and causing agents to forget which files they modified, what errors occurred, and what decisions were made. This Skill provides production-tested compression strategies that minimize total tokens per task rather than tokens per request. ## Core Features & Use Cases - Three Compression Methods: Choose between anchored iterative summarization, opaque compression, and regenerative full summaries based on session length and quality requirements. - Structured Summary Templates: Mandatory sections for session intent, files modified, decisions, and next steps prevent silent information loss during compression. - Probe-Based Evaluation: Test compression quality with recall, artifact, continuation, and decision probes scored across six dimensions using an LLM judge. - Use Case: A debugging agent hits 80% context utilization after 178 messages. Apply anchored iterative summarization to compress history into a structured summary preserving file paths, error codes, and root cause, then verify with probes before continuing. ## Quick Start Ask the AI to compress the current conversation history using anchored iterative summarization with structured sections for files modified and decisions made.

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, and decisions, then summarize only newly truncated content on each compression trigger and merge it into the existing summary. This prevents the drift that occurs when summaries are regenerated from scratch.

What is the best context compression method for coding agents?

Anchored iterative summarization scores highest at 3.70 overall with 98.6% compression, compared to 3.44 for regenerative summaries and 3.35 for opaque compression. It performs best on accuracy and context awareness, which matter most for coding tasks.

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

Artifact trail is the weakest dimension across all compression methods, scoring only 2.2-2.5 out of 5. General summarization cannot reliably track file operations, so implement a separate artifact index or explicit file-state tracking in the agent scaffolding.

When should I trigger context compression in an agent session?

Default to a sliding window approach that keeps the last N turns plus a structured summary, or trigger at 70-80% context utilization. Use task-boundary triggers when sessions have clear phase transitions like research, implementation, and testing.

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 with an LLM judge across six dimensions including accuracy and artifact trail.

What should never be compressed in agent context?

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