caveman-compress
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCaveman Compress
Caveman Compress
Purpose
用途
Compress natural language files (CLAUDE.md, todos, preferences) into caveman-speak to reduce input tokens. Compressed version overwrites original. Human-readable backup saved as .
<filename>.original.md将自然语言文件(CLAUDE.md、待办事项、偏好设置)压缩为极简表述以减少输入tokens。压缩版本会覆盖原文件,人类可读的备份将保存为。
<filename>.original.mdTrigger
触发方式
/caveman-compress <filepath>/caveman-compress <filepath>Process
执行流程
-
This SKILL.md lives alongsidein the same directory. Find that directory.
memory/ -
Run:
cd <directory_containing_this_SKILL.md> && python3 -m scripts <absolute_filepath> -
The CLI will:
- detect file type (no tokens)
- call Claude to compress
- validate output (no tokens)
- if errors: cherry-pick fix with Claude (targeted fixes only, no recompression)
- retry up to 2 times
-
Return result to user
-
此SKILL.md与目录位于同级路径,找到该目录。
memory/ -
运行:
cd <directory_containing_this_SKILL.md> && python3 -m scripts <absolute_filepath> -
CLI将执行以下操作:
- 检测文件类型(无token消耗)
- 调用Claude执行压缩
- 验证输出(无token消耗)
- 若出现错误:使用Claude进行定向修复(仅针对性修复,不重新压缩)
- 最多重试2次
-
向用户返回结果
Compression Rules
压缩规则
Remove
需移除的内容
- Articles: a, an, the
- Filler: just, really, basically, actually, simply, essentially, generally
- Pleasantries: "sure", "certainly", "of course", "happy to", "I'd recommend"
- Hedging: "it might be worth", "you could consider", "it would be good to"
- Redundant phrasing: "in order to" → "to", "make sure to" → "ensure", "the reason is because" → "because"
- Connective fluff: "however", "furthermore", "additionally", "in addition"
- 冠词:a、an、the
- 填充词:just、really、basically、actually、simply、essentially、generally
- 礼貌用语:"sure"、"certainly"、"of course"、"happy to"、"I'd recommend"
- 模糊表述:"it might be worth"、"you could consider"、"it would be good to"
- 冗余表述:"in order to" → "to"、"make sure to" → "ensure"、"the reason is because" → "because"
- 冗余连接词:"however"、"furthermore"、"additionally"、"in addition"
Preserve EXACTLY (never modify)
需完全保留的内容(禁止修改)
- Code blocks (fenced ``` and indented)
- Inline code ()
backtick content - URLs and links (full URLs, markdown links)
- File paths (,
/src/components/...)./config.yaml - Commands (,
npm install,git commit)docker build - Technical terms (library names, API names, protocols, algorithms)
- Proper nouns (project names, people, companies)
- Dates, version numbers, numeric values
- Environment variables (,
$HOME)NODE_ENV
- 代码块(使用```包裹的围栏代码块和缩进代码块)
- 行内代码()
反引号包裹的内容 - URL和链接(完整URL、markdown链接)
- 文件路径(、
/src/components/...)./config.yaml - 命令(、
npm install、git commit)docker build - 技术术语(库名、API名称、协议、算法)
- 专有名词(项目名、人名、公司名)
- 日期、版本号、数值
- 环境变量(、
$HOME)NODE_ENV
Preserve Structure
需保留的结构
- All markdown headings (keep exact heading text, compress body below)
- Bullet point hierarchy (keep nesting level)
- Numbered lists (keep numbering)
- Tables (compress cell text, keep structure)
- Frontmatter/YAML headers in markdown files
- 所有markdown标题(保留标题原文,仅压缩下方正文内容)
- 项目符号层级(保留嵌套级别)
- 有序列表(保留编号)
- 表格(压缩单元格文本,保留结构)
- markdown文件中的Frontmatter/YAML头部
Compress
压缩规则
- Use short synonyms: "big" not "extensive", "fix" not "implement a solution for", "use" not "utilize"
- Fragments OK: "Run tests before commit" not "You should always run tests before committing"
- Drop "you should", "make sure to", "remember to" — just state the action
- Merge redundant bullets that say the same thing differently
- Keep one example where multiple examples show the same pattern
CRITICAL RULE:
Anything inside must be copied EXACTLY.
Do not:
...- remove comments
- remove spacing
- reorder lines
- shorten commands
- simplify anything
Inline code () must be preserved EXACTLY.
Do not modify anything inside backticks.
...If file contains code blocks:
- Treat code blocks as read-only regions
- Only compress text outside them
- Do not merge sections around code
- 使用短同义词:用"big"代替"extensive",用"fix"代替"implement a solution for",用"use"代替"utilize"
- 允许使用短句片段:用"Run tests before commit"代替"You should always run tests before committing"
- 省略"you should"、"make sure to"、"remember to",直接陈述动作
- 合并表述不同但含义相同的冗余列表项
- 多个示例展示同一规则时,仅保留1个示例
关键规则:
所有包裹的内容必须完全原样复制。
禁止:
...- 移除注释
- 移除空格
- 调整行顺序
- 缩短命令
- 简化任何内容
行内代码()必须完全保留。
禁止修改反引号内的任何内容。
...如果文件包含代码块:
- 将代码块视为只读区域
- 仅压缩代码块外的文本内容
- 不要合并代码块周围的章节
Pattern
示例
Original:
You should always make sure to run the test suite before pushing any changes to the main branch. This is important because it helps catch bugs early and prevents broken builds from being deployed to production.
Compressed:
Run tests before push to main. Catch bugs early, prevent broken prod deploys.
Original:
The application uses a microservices architecture with the following components. The API gateway handles all incoming requests and routes them to the appropriate service. The authentication service is responsible for managing user sessions and JWT tokens.
Compressed:
Microservices architecture. API gateway route all requests to services. Auth service manage user sessions + JWT tokens.
原文:
You should always make sure to run the test suite before pushing any changes to the main branch. This is important because it helps catch bugs early and prevents broken builds from being deployed to production.
压缩后:
推送至main分支前运行测试,尽早发现bug,避免生产环境部署损坏的构建。
原文:
The application uses a microservices architecture with the following components. The API gateway handles all incoming requests and routes them to the appropriate service. The authentication service is responsible for managing user sessions and JWT tokens.
压缩后:
微服务架构。API网关将所有请求路由至对应服务,鉴权服务管理用户会话和JWT tokens。
Boundaries
适用边界
- ONLY compress natural language files (.md, .txt, extensionless)
- NEVER modify: .py, .js, .ts, .json, .yaml, .yml, .toml, .env, .lock, .css, .html, .xml, .sql, .sh
- If file has mixed content (prose + code), compress ONLY the prose sections
- If unsure whether something is code or prose, leave it unchanged
- Original file is backed up as FILE.original.md before overwriting
- Never compress FILE.original.md (skip it)
- 仅压缩自然语言文件(.md、.txt、无后缀文件)
- 禁止修改以下类型文件:.py、.js、.ts、.json、.yaml、.yml、.toml、.env、.lock、.css、.html、.xml、.sql、.sh
- 如果文件包含混合内容(文本+代码),仅压缩文本部分
- 如果无法确定内容是代码还是文本,保留原样不修改
- 覆盖原文件前会将原文件备份为FILE.original.md
- 永远不要压缩FILE.original.md(直接跳过)