context-compressor

Select context fragments to keep, cut, or compress within token budgets.

7|2|Updated Mar 5, 2026
One-click install
npx skills add https://github.com/AndurilCode/craftwork --skill context-compressor-andurilcode
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-compressor
Source: https://github.com/AndurilCode/craftwork/tree/main/skills/context-compressor
Command: npx skills add https://github.com/AndurilCode/craftwork --skill context-compressor-andurilcode

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the problem of overflowing agent context windows by deciding what information to keep, cut, or compress so the model still has enough decision-relevant signal to complete the task well.

Core Features & Use Cases

  • Budget-aware context triage: Computes available token budget after accounting for system prompt, tools, history, and reserved output, then selects content accordingly.
  • Entropy- and redundancy-based scoring: Ranks fragments by self-information, redundancy overlap, and token efficiency, cutting low-value or duplicative content.
  • Lossless and lossy compression modes: Uses lossless reformulation/deduplication when feasible, and applies carefully logged lossy reductions (e.g., scope narrowing or abstraction) when tokens are scarce.
  • Verification of task adequacy: Checks that critical high self-information fragments remain at full fidelity and that cuts won’t change required behavior.

Quick Start

Ask the AI to optimize the context it is assembling for your current task by using the context-compressor to fit within your token budget while preserving decision-critical information.

Frequently Asked Questions about context-compressor

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

FAQPage Schema
How do I optimize agent context windows when my prompt exceeds the token budget?

To optimize context windows and fit a tight token budget, the context-compressor scores fragments by entropy and redundancy, then cuts or compresses low-value content. It preserves critical high-signal fragments at full fidelity while reducing overflow.

How does lossy prompt compression differ from lossless deduplication for token budgeting?

Lossless prompt compression deduplicates and reformulates text without losing data, whereas lossy compression narrows scope or abstracts details to save tokens. Lossy reductions are logged to verify what information was discarded.

What is the best way to deduplicate multi-file context before assembling an agent prompt?

The best way to deduplicate multi-file context is to score fragments by self-information and redundancy overlap. This ranks content by token efficiency, removing duplicative text while verifying that critical information remains unchanged.

Can I calculate available token capacity dynamically when curating context for agent orchestration?

Yes, you can calculate available token capacity dynamically. The context-compressor computes the remaining budget after subtracting the system prompt, tools, history, and reserved output, then selects context fragments to fit that exact capacity.

What are the limitations of lossy compression when optimizing a CLAUDE.md or AGENTS.md system file?

The limitation of lossy compression on system files is that abstraction or scope narrowing might alter required agent behavior. To mitigate this, the compressor verifies that critical high self-information fragments remain at full fidelity within the available capacity.