Skill

claw-compactor

by aeromomo

AI Summary

Claw Compactor is a 6-layer token compression skill for OpenClaw agents that reduces workspace token spend by 50–97% through deterministic rules and an LLM-driven memory system called Engram. It's designed for developers building token-efficient AI agents who need automatic cost optimization at session start.

Install

# Add to your project root as SKILL.md
curl -o SKILL.md "https://raw.githubusercontent.com/aeromomo/claw-compactor/main/SKILL.md"

Description

Claw Compactor — 6-layer token compression skill for OpenClaw agents. Cuts workspace token spend by 50–97% using deterministic rule-engines plus Engram: a real-time, LLM-driven Observational Memory system. Run at session start for automatic savings reporting.

Overview

Claw Compactor reduces token usage across the full OpenClaw workspace using 6 compression layers: | Layer | Name | Cost | Notes | |-------|------|------|-------| | 1 | Rule Engine | Free | Dedup, strip filler, merge sections | | 2 | Dictionary Encoding | Free | Auto-codebook, $XX substitution | | 3 | Observation Compression | Free | Session JSONL → structured summaries | | 4 | RLE Patterns | Free | Path/IP/enum shorthand | | 5 | Compressed Context Protocol | Free | Format abbreviations | | 6 | Engram | LLM API | Real-time Observational Memory | Skill location: skills/claw-compactor/ Entry point: scripts/mem_compress.py Engram CLI: scripts/engram_cli.py ---

Prerequisites

`bash export ANTHROPIC_API_KEY=sk-ant-... # Preferred

Auto Mode (Recommended — Run at Session Start)

`bash python3 skills/claw-compactor/scripts/mem_compress.py <workspace> auto ` Automatically compresses all workspace files, tracks token counts between runs, and reports savings. Run this at the start of every session. ---

Full Pipeline (All Layers)

`bash python3 scripts/mem_compress.py <workspace> full ` Runs all 5 deterministic layers in optimal order. Typical: 50%+ combined savings.

Quality Score

C

Acceptable

68/100

Standard Compliance45
Documentation Quality52
Usefulness68
Maintenance Signal100
Community Signal100
Scored Yesterday

GitHub Signals

Stars1.3k
Forks110
Issues3
UpdatedToday
View on GitHub

Trust & Transparency

Open Source — MIT

Source code publicly auditable

Verified Open Source

Hosted on GitHub — publicly auditable

Actively Maintained

Last commit Today

1.3k stars — Strong Community

110 forks

My Fox Den

Community Rating

Works With

Claude Code