caveman-compress

Compress natural language memory files into shorter caveman format to reduce input tokens.

1|Updated May 3, 2021
One-click install
npx skills add https://github.com/leogurja/dotfiles --skill caveman-compress-leogurja
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: caveman-compress
Source: https://github.com/leogurja/dotfiles/tree/main/home/dot_agents/skills/caveman-compress
Command: npx skills add https://github.com/leogurja/dotfiles --skill caveman-compress-leogurja

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires anthropic, tiktoken, and includes scripts (resource) components.

What problem does it solve? Large project memory files like CLAUDE.md, todo lists, and preference notes are loaded into context on every session start, repeatedly consuming input tokens. This Skill compresses those natural language files into a terse caveman format while preserving code blocks, URLs, headings, and file paths exactly, cutting token usage by roughly 40-60% on benchmarked fixtures. ## Core Features & Use Cases - Token-reducing compression: Rewrites prose by removing articles, filler, hedging, and pleasantries while keeping technical terms, commands, and structure intact. - Safe in-place overwrite with backup: The original is saved byte-for-byte to an out-of-tree data directory as <filename>.original.md, so skill auto-loaders never re-ingest the backup. - Structural validation with targeted repair: Headings, code blocks, URLs, file paths, and inline code are validated after compression; only broken parts are sent back for fixing, never a full recompression. - Use Case: A developer with a 1,100-token CLAUDE.md runs the skill once, gets a ~600-token compressed version loaded every session, and edits the human-readable backup whenever the source needs updating. ## Quick Start Ask the assistant to run /caveman-compress on your CLAUDE.md file to shrink it and keep a readable backup.

Frequently Asked Questions about caveman-compress

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

FAQPage Schema
How do I compress a CLAUDE.md file to save tokens?▼

Run /caveman-compress followed by the file path, for example /caveman-compress CLAUDE.md. The skill compresses the prose in place and writes the original to a backup directory under $XDG_DATA_HOME/caveman-compress/backups so you can edit and re-compress later.

What file types can be compressed with caveman-compress?▼

Natural language files are supported: .md, .mdc, .txt, .markdown, .rst, .typ, .typst, .tex, and extensionless prose files. Code and config files like .py, .js, .json, .yaml, and .toml are detected and skipped automatically.

Does compression preserve code blocks and URLs?▼

Yes. Fenced and indented code blocks, inline backtick code, URLs, file paths, headings, and commands are preserved exactly. A validator compares these elements between original and compressed output, and any mismatch triggers a targeted fix pass.

Where is the original file backed up after compression?▼

The original is saved as <filename>.original.md in an out-of-tree data directory: $XDG_DATA_HOME/caveman-compress/backups/<parent-dir-name>/ on macOS and Linux, or %LOCALAPPDATA%\caveman-compress\backups on Windows. It is kept outside the source tree so auto-loaders do not read it twice.

Why does caveman-compress refuse to compress some files?▼

Files over 500KB, files that are not valid UTF-8, empty files, and files whose names or paths suggest secrets (credentials, .env, SSH keys, .aws paths) are refused. Sensitive files are blocked because compression sends content to the Anthropic API.

What are the limitations of caveman file compression?▼

Compression only works on natural language prose, not code or configuration. Validation confirms structural preservation of headings, code, URLs, and paths, but does not guarantee full semantic equivalence, and each compression requires at least one Claude API call.