caveman-compress

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

Updated Mar 30, 2026
One-click install
npx skills add https://github.com/TrayMachi/dotfiles --skill caveman-compress-traymachi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: caveman-compress
Source: https://github.com/TrayMachi/dotfiles/tree/main/agents/skills/caveman-compress
Command: npx skills add https://github.com/TrayMachi/dotfiles --skill caveman-compress-traymachi

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 session, and verbose prose inflates token costs repeatedly. This Skill rewrites those files into a terse caveman style while preserving all technical substance, cutting context tokens by roughly 46% on average. ## Core Features & Use Cases - Token-reducing compression: Rewrites natural language Markdown, text, reStructuredText, and TeX files into compact fragments while preserving code blocks, inline code, URLs, file paths, headings, and commands exactly. - Validated pipeline with retries: Detects file type, compresses via Claude, validates headings/code/URLs/paths against the original, applies targeted fixes for up to 2 retries, and restores the original on failure. - Safe backups and guardrails: Saves a human-readable FILE.original.md backup, refuses files over 500KB, skips code/config files, and blocks sensitive paths like credentials, secrets, or SSH keys. - Use Case: Run it on a 700-token CLAUDE.md preferences file to produce a ~285-token version that loads every session, with the original kept alongside for editing. ## Quick Start Ask the assistant to run /caveman-compress on your CLAUDE.md file to shrink it into caveman format with a backup saved automatically.

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, and writes the compressed version in place with a FILE.original.md backup.

What file types can be compressed with caveman-compress?

It compresses natural language files: .md, .txt, .markdown, .rst, .typ, .typst, .tex, and 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 treated as read-only and validated against the original after compression. Any mismatch triggers a targeted fix pass.

What happens if compression validation fails?

The skill sends only the listed validation errors back to Claude for a targeted fix, retrying up to 2 times without recompressing. If it still fails, the original file is restored and the backup is removed.

Can I compress files containing secrets or credentials?

No. The skill refuses files whose names or paths suggest secrets, credentials, keys, or directories like .ssh and .aws, because compression sends content to the Anthropic API. Rename the file if it is a false positive.

Does caveman-compress require an Anthropic API key?

An API key is optional. If ANTHROPIC_API_KEY is set it uses the Anthropic Python SDK; otherwise it falls back to the claude CLI using existing desktop authentication. Python 3.10+ is required.