Context Compressor for Openclaw

Context Compressor intelligently condenses conversations, source code, and logs to fit more information into limited AI context windows without losing core meaning.

besty0121
v1.0.0
Apr 2, 2026
0
908
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install ctx-compress

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install ctx-compress using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Context Compressor?

Context Compressor is a high-performance utility designed to solve the common problem of context window overflow in AI agent workflows. Unlike standard truncation which simply cuts off text and loses vital information, this skill uses content-aware strategies to strip away noise while preserving decisions, logic, and key events.

By integrating this tool into your Openclaw Skills library, you can significantly reduce token consumption and improve the focus of your AI coding agents. It supports multiple compression levels and automatically identifies the type of content—whether it is a complex chat history, a verbose log file, or a large source code module—to apply the most effective reduction algorithm.

Context Compressor Use Cases

  • Compressing long dialogue histories to maintain long-term memory in active sessions.
  • Summarizing 20+ rounds of trial-and-error debugging logs into a single concise error-fix report.
  • Passing the essential 'essence' of a project between different AI sessions using chain compression.
  • Reducing source code size for rapid review by stripping comments, docstrings, and non-essential whitespace.

How Context Compressor Works

  1. The user or agent provides input via file path, terminal pipe, or inline text string.
  2. The skill automatically detects the content category (chat, code, log, or text) using file extensions or content pattern matching.
  3. The user selects a compression level: light (removal of whitespace/comments), medium (noise reduction and summarization), or aggressive (core information only).
  4. The script executes the specific logic for that content type, such as extracting JSON-formatted decisions or error-fix pairs.
  5. The tool outputs a summary showing the compression ratio and the optimized text, ready for injection into the AI prompt.

Context Compressor Setup

Context Compressor is a zero-dependency Python script, making it easy to add to any Openclaw Skills environment. Ensure you have Python installed and run the script directly from your terminal:

# Basic compression command
python scripts/ctxcompress.py compress --input yourfile.txt --level medium

# Check stats and compression potential
python scripts/ctxcompress.py stats --input big_log_file.log

Context Compressor Data Schema & Taxonomy

The skill can output structured metadata for advanced agent reasoning. When using the extract command, it generates data in the following format:

Key Description
decisions An array of key architectural or logic decisions identified in the text.
errors_and_fixes A list of objects mapping specific errors to their corresponding resolutions.
commands Shell or CLI commands detected within the input.
urls Hyperlinks and documentation references.
key_terms A list of technical identifiers, variable names, or domain-specific terminology.

Context Compressor Advanced Features

  • Chain Compression: Merge and summarize multiple files of different types (e.g., .py + .log + .txt) into a single cohesive context block.
  • Change Extraction: Use the diff command to identify only what was added, deleted, or modified between two versions to minimize update tokens.
  • Lossy-but-Core-Preserved Logic: Uses a strategy similar to JPEG compression for text, ensuring the 'image' of the data remains clear while the file size drops.
  • Pipeline Support: Seamlessly integrates with other Openclaw Skills via standard input/output streams for automated agent workflows.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*