# /caveman-compress: Shrink CLAUDE.md and memory files without breaking code

Source: https://trendhub.net/skills/juliusbrussee-caveman/caveman-compress
Skill folder: https://github.com/JuliusBrussee/caveman/tree/main/skills/caveman-compress
Pack: Caveman (https://trendhub.net/skills/juliusbrussee-caveman)
Works with: All detected agents (Caveman CLI), Skills only (npx skills), Claude Code (plugin), Claude Code (inside a session), Gemini CLI, Every agent via script (macOS, Linux), Every agent via script (Windows)

This skill runs a bundled Python tool that rewrites the prose of a memory or notes file in terse form, so the agent loads fewer tokens each session. Code blocks, inline code, URLs, paths and version numbers are treated as read-only, the output is validated with up to two targeted retries, and a readable backup is stored outside the project.

## When to use it

- Your CLAUDE.md or AGENTS.md has grown long and loads into every session.
- You keep a todo or preferences file the agent reads often.
- You want shorter memory files but cannot risk a changed command or path.

## How it works

1. **Require a file path**: The skill only works on a named file and asks for a path rather than compressing pasted text inline.
2. **Run the script**: From the skill folder the agent runs the scripts module on the absolute path, which detects the file type and calls the model to compress it.
3. **Protect the payload**: Fenced and inline code, links, paths, commands, headings, list structure and frontmatter are kept as they are.
4. **Validate and back up**: Output is checked, failures get targeted fixes, and the original is saved in a backup folder under the user data directory.

## What it steers the agent away from

- Editing source, config or lock files such as .py, .json or .yaml.
- Sending files that look like secrets or contain credentials to the provider.
- Leaving the original file damaged when compression keeps failing.

## What it can touch

Reads one prose file, sends its text to your configured model provider through a Python script, overwrites it and writes a backup elsewhere.

## Pairs well with

- `/caveman`

## Questions

### Where does the backup go?

To a caveman-compress backups folder under XDG_DATA_HOME, or LOCALAPPDATA on Windows, so skill loaders do not pick it up as a live file.

### Which provider does it use?

Whichever one the bundled script is set up to call: the claude CLI, Anthropic's API, or an endpoint compatible with OpenAI's API.
