context-compression

Implements structured summarization and probe-based evaluation for compressing long agent conversation histories.

1|Updated May 16, 2026
One-click install
npx skills add https://github.com/ludotype/game-adventurertown --skill context-compression-ludotype
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: context-compression
Source: https://github.com/ludotype/game-adventurertown/tree/main/.agent/skills/context-compression
Command: npx skills add https://github.com/ludotype/game-adventurertown --skill context-compression-ludotype

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Long-running agent sessions generate millions of tokens of conversation history that exceed context windows, and naive compression loses critical details like file paths, error messages, and decision rationale, forcing costly re-exploration. ## Core Features & Use Cases - Anchored Iterative Summarization: Maintains persistent structured summaries with explicit sections for session intent, file modifications, decisions, and next steps, merging new content incrementally instead of regenerating from scratch. - Probe-Based Evaluation: Generates recall, artifact, continuation, and decision probes from conversation history, then scores responses across six dimensions including accuracy and artifact trail. - Structured Summarizer Script: The compression_evaluator.py script provides ProbeGenerator, CompressionEvaluator, and StructuredSummarizer classes for end-to-end compression quality checks. - Use Case: A coding agent debugging a 401 error across 178 messages hits the context limit; this Skill compresses the history into a structured summary preserving the root cause, modified files, and failing tests so work continues without re-reading files. ## Quick Start Ask the agent to compress the current conversation history into a structured summary and evaluate whether critical file and decision details survived compression.

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: maintain a persistent structured summary with 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.

What is the best context compression method for coding agents?▼

Anchored iterative summarization scores highest (3.70 overall) for coding agents because it preserves file tracking and decision rationale. Opaque compression achieves the best ratio (99.3%) but sacrifices interpretability, making it suitable only for short sessions with low re-fetching costs.

How do I evaluate whether compression lost important information?▼

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

When should compression be triggered in an agent session?▼

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

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 files, so implement a separate artifact index or explicit file-state tracking in the agent scaffolding.

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.