context-compression

Compress long-running agent session context into anchored iterative summaries.

Updated Feb 14, 2026
One-click install
npx skills add https://github.com/Shakudo-io/opencode-skills --skill context-compression-shakudo-io
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-compression
Source: https://github.com/Shakudo-io/opencode-skills/tree/main/context-optimization/skills/context-compression
Command: npx skills add https://github.com/Shakudo-io/opencode-skills --skill context-compression-shakudo-io

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

When agent sessions generate millions of tokens, compression becomes mandatory to stay within context limits. The approach emphasizes tokens-per-task over tokens-per-request and uses structured, anchored summaries to preserve critical information.

Core Features & Use Cases

  • Anchored Iterative Summarization: maintain persistent summaries with explicit sections and merge new content incrementally.
  • Opaque Compression: achieve high compression ratios while potentially sacrificing interpretability.
  • Regenerative Full Summary: produce detailed summaries on each compression, ensuring readability and traceability.
  • Artifact tracking and evaluation: capture file modifications, decisions, and next steps; supports probe-based evaluation.

Quick Start

Initiate a compression cycle on a long-running session to generate a structured, anchor-based summary that preserves essential state.

Frequently Asked Questions about context-compression

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I compress context history to reduce token usage in long-running agent sessions?

Compress context history by initiating a compression cycle that generates anchored, structured summaries. This reduces token usage while preserving essential state information for long-running agent sessions and coding workflows.

What is anchored iterative summarization for managing agent context?

Anchored iterative summarization maintains persistent summaries with explicit sections, merging new content incrementally. It preserves critical state information across long sessions without losing track of decisions or file modifications.

How do I track artifacts and file modifications during context compression?

Track artifacts during context compression by capturing file modifications, decisions, and next steps within structured summaries. This maintains an artifact trail ensuring readability and traceability throughout the compression process.

Can I evaluate context compression quality using probe-based rubrics?

Yes, you can evaluate context compression quality using probe-based rubrics. The evaluation mechanism tests whether compressed summaries maintain essential information and satisfy requirements for maintainable state management.

What's the best way to preserve critical information when compressing millions of tokens?

The best way to compress millions of tokens is using regenerative full summaries that produce detailed, structured outputs on each compression cycle. This emphasizes tokens-per-task over tokens-per-request to maintain traceability.

Does context compression work without external dependencies for state management?

Yes, context compression operates without external dependencies, relying on included scripts and references. It supports structured state management and incremental merging natively within the compression workflow.