context-compression

Compress agent session context into structured summaries with anchored merging.

Updated Apr 15, 2025
One-click install
npx skills add https://github.com/khrore/nix-config --skill context-compression-khrore
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-compression
Source: https://github.com/khrore/nix-config/tree/main/dotfiles/common/.config/opencode/skills/context-compression
Command: npx skills add https://github.com/khrore/nix-config --skill context-compression-khrore

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Context-heavy AI sessions risk token overflow and forgetting critical details. This skill provides structured compression strategies to preserve essential information while reducing token usage across long-lived agent tasks.

Core Features & Use Cases

  • Anchored Iterative Summarization: Maintain persistent, sectioned summaries that merge new content without losing history.
  • Opaque Compression: Produce highly compact representations for maximum token savings, with interpretability trade-offs.
  • Regenerative Full Summary: Regenerate detailed summaries on each compression to support review and auditing.
  • Evaluation & Metrics: Guide compression quality using probe-based evaluation and artifact tracking.
  • Safety & Guardrails: Enforce deterministic merges and explicit file-state tracking to reduce drift.

Quick Start

Activate the compression workflow on an active session and generate a structured summary suitable for the next task.

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 for long-running agent sessions when token budgets are tight?

Compress context by producing token-efficient, structured summaries that retain critical files, decisions, and next steps. This ensures long-running agent sessions avoid token overflow and prevent forgetting critical details.

What is anchored iterative summarization for code review tasks?

Anchored iterative summarization maintains persistent, sectioned summaries that merge new content without losing history. It enforces deterministic merges and explicit file-state tracking to reduce drift during code review tasks.

How do I evaluate the trade-offs between compression ratio and information fidelity?

Evaluate compression trade-offs using probe-based evaluation and artifact tracking. This quantifies information fidelity against token savings to determine if opaque compression or regenerative full summaries suit your task.

Can I use opaque compression for maximum token savings in multi-step debugging?

Opaque compression produces highly compact representations for maximum token savings during multi-step debugging. It involves interpretability trade-offs, meaning the compressed output is less human-readable but preserves critical session data.

When should I use regenerative full summaries instead of anchored merging?

Use regenerative full summaries when you need to support review and auditing. This approach regenerates detailed summaries on each compression cycle, contrasting with anchored merging which maintains persistent sectioned summaries incrementally.