TO

Reduces token consumption by compressing large log files and text blocks while keeping high-signal information.

Install

mkdir -p .claude/skills/token-compressor && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/11631" && unzip -o skill.zip -d .claude/skills/token-compressor && rm skill.zip

Installs to .claude/skills/token-compressor

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Deterministically compresses long logs/text into high-signal excerpts to free context window.
93 charsno explicit “when” trigger
Beginner

Key capabilities

  • Keep lines matching specific keywords (error, exception, traceback, fail, warning, fatal)
  • Preserve the first N and last M lines of input
  • Collapse repeated consecutive lines
  • Collapse repeated blocks of text
  • Replace large omitted blocks with a short note

How it works

The skill deterministically compresses long text inputs by applying a series of rules: keeping evidence lines, preserving structure, deduplicating noise, and summarizing omitted blocks.

Inputs & outputs

You give it
Long logs, stack traces, or large text files
You get back
A compressed excerpt with high-signal information and omitted block notes

When to use token-compressor

  • Shrinking huge stack traces
  • Compressing extensive system logs
  • Managing large context window usage

About this skill

Token Compressor

This skill reduces token overhead by compressing bulky inputs (logs, stack traces, long docs) while preserving evidence.

When to Use

  • The user pastes long logs.
  • Tool output is huge.
  • A file is too large to read fully.

Compression Rules (Deterministic)

Apply these tactics in order:

  1. Keep evidence lines

    • Always keep lines matching: error, exception, traceback, fail, warning, fatal.
  2. Keep structure

    • Keep the first N lines (header/context) and last M lines (final error).
  3. Deduplicate noise

    • Collapse repeated consecutive lines.
    • Collapse repeated blocks (same line repeated many times).
  4. Summarize the rest

    • Replace large omitted blocks with a short note: (… 3,421 lines omitted …).

Tooling

If available, use the bundled compressor script:

python3 ~/.ai-context/skills/token-compressor/scripts/compress_text.py --help

Output Format

## Compressed Context

- Source: …
- Original: X lines
- Kept: Y lines
- Notes: …

```text
…compressed excerpt…

## Anti-Patterns

- Removing the exact error line.
- Keeping only a summary with no evidence.
- Dumping the entire log into the reasoning window.

When not to use it

  • When the exact error line must be preserved without any modification
  • When only a summary is needed without any evidence

Limitations

  • Removing the exact error line is an anti-pattern
  • Keeping only a summary with no evidence is an anti-pattern
  • Dumping the entire log into the reasoning window is an anti-pattern

How it compares

This skill provides a deterministic, rule-based approach to text compression that prioritizes retaining critical evidence, unlike general text summarization that might omit important details.

Compared to similar skills

token-compressor side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
token-compressor (this skill)03moReviewBeginner
grepai47moReviewBeginner
claude05moReviewIntermediate
python-testing-patterns772moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry