caveman-compress

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

Updated Jun 16, 2022
One-click install
npx skills add https://github.com/SimonZimmer/dotfiles --skill caveman-compress-simonzimmer
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: caveman-compress
Source: https://github.com/SimonZimmer/dotfiles/tree/main/.config/opencode/skills/caveman-compress
Command: npx skills add https://github.com/SimonZimmer/dotfiles --skill caveman-compress-simonzimmer

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Project memory files like CLAUDE.md, todos, and preference notes are loaded into context on every AI session, and large files waste input tokens repeatedly. This Skill compresses those natural language files into a terse caveman style while preserving all technical substance, cutting token usage by roughly 46% on average. ## Core Features & Use Cases - Token-reducing compression: Rewrites prose by removing articles, filler, hedging, and pleasantries while keeping meaning intact. - Strict preservation guarantees: Code blocks, inline code, URLs, file paths, commands, headings, and YAML frontmatter are preserved exactly, with automated validation and targeted retry fixes. - Safe backup workflow: The original file is saved as a .original.md backup outside the source directory before the compressed version overwrites it, and sensitive files like credentials or keys are refused. - Use Case: A developer with a 1000-token CLAUDE.md runs the skill once, and every subsequent session loads the compressed version, saving hundreds of tokens per session. ## Quick Start Ask the AI to run /caveman-compress on your CLAUDE.md file to compress it and create a human-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, or invoke the CLI with python3 -m scripts <filepath>. The skill compresses the prose, validates the output, writes the compressed version in place, and saves the original as a .original.md backup.

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

Natural language files with extensions .md, .txt, .rst, .typ, .typst, and .tex are compressible, along with extensionless prose files. Code and config files like .py, .js, .json, .yaml, and .sh are detected and skipped.

Does compression preserve code blocks and URLs?▼

Yes. Fenced code blocks, inline backtick code, URLs, file paths, commands, and headings are preserved exactly. A validation step compares the original and compressed output and triggers targeted fixes if anything is lost.

What happens to my original file after compression?▼

The original content is backed up as a .original.md file in a platform-aware backup directory outside the source tree before the compressed version overwrites the file. If validation fails after retries, the original is restored automatically.

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

Files larger than 500KB, empty files, and files whose names suggest secrets or credentials (like .env, credentials, or id_rsa) are refused. Compression sends content to the Anthropic API, so sensitive files are blocked as a safety measure.

Do I need an API key to use caveman-compress?▼

Not necessarily. If ANTHROPIC_API_KEY is set, the skill uses the Anthropic Python SDK directly. Otherwise it falls back to the claude CLI, which uses your existing Claude desktop authentication.