Claw Compactor: Compress LLM Tokens 54% with Zero Dependencies

2026-03-18T13:46:41.000Z·2 min read
Open-source 14-stage compression pipeline achieves 54% average token reduction across code, JSON, logs, and agent conversations with zero LLM inference cost. Outperforms LLMLingua-2 by up to 88% at aggressive compression ratios.

Claw Compactor is an open-source LLM token compression engine that achieves an average 54% reduction in token usage across code, JSON, logs, and agent conversations — with zero LLM inference cost and zero dependencies.

The Fusion Pipeline

The engine chains 14 specialized compression stages through an immutable data flow architecture:

  1. QuantumLock — KV-cache alignment
  2. Cortex — Content type and language auto-detection (16 languages)
  3. Photon — Base64 path stripping
  4. RLE — Run-length encoding
  5. SemanticDedup — SimHash-based deduplication
  6. Ionizer — JSON statistical sampling with reversible storage
  7. LogCrunch — Log folding
  8. SearchCrunch — Result deduplication
  9. DiffCrunch — Context-aware diff folding
  10. StructuralCollapse — Import merging
  11. Neurosyntax — AST compression via tree-sitter
  12. Nexus — ML token classification
  13. TokenOpt — Token format optimization
  14. Abbrev — Natural language abbreviation (text only)

Performance Benchmarks

Content TypeLegacyClaw CompactorImprovement
Python source7.3%25.0%3.4x
JSON (100 items)12.6%81.9%6.5x
Build logs5.5%24.1%4.4x
Agent conversation5.7%31.0%5.4x
Git diff6.2%15.0%2.4x
Search results5.3%40.7%7.7x

vs LLMLingua-2

Compression RateClaw CompactorLLMLingua-2Delta
0.3 (aggressive)65.3% preserved34.6% preserved+88.2%
0.5 (balanced)72.3% preserved57.0% preserved+26.8%

Claw Compactor preserves significantly more semantic content at the same compression ratio, with zero LLM inference cost.

Key Design Principles

Installation

git clone https://github.com/open-compress/claw-compactor.git
cd claw-compactor
python3 scripts/mem_compress.py /path/to/workspace benchmark

Requirements: Python 3.9+. Optional: pip install tiktoken for exact token counts. 1,676 tests included.

Source: GitHub — open-compress/claw-compactor | Hacker News

↗ Original source
← Previous: Google DeepMind Proposes Cognitive Framework for Measuring AGI ProgressNext: ProPublica Investigation: Federal Experts Called Microsoft's Cloud 'A Pile of Shit' — Then Approved It Anyway →
Comments0