caveman-compress
压缩记忆文件以降低token成本
像CLAUDE.md这样的大型记忆文件会在每次AI会话启动时浪费token。这个技能可以将它们压缩约46%,同时保留所有技术内容。
下载技能 ZIP
在 Claude 中上传
前往 设置 → 功能 → 技能 → 上传技能
开启并开始使用
测试它
正在使用“caveman-compress”。 一个706个token的CLAUDE.md文件,包含TypeScript偏好、测试指南和以完整散文编写的项目约定。
预期结果:
一个285个token的压缩版本,保留了所有技术指令的直接穴居人风格文本。标题、代码示例和URL保持不变。原始文件保存为CLAUDE.original.md。
正在使用“caveman-compress”。 一个1145个token的项目笔记文件,包含架构描述、部署步骤和团队约定。
预期结果:
一个535个token的压缩文件。所有章节标题精确保留。代码块和URL完整。冗余解释被压缩为关键事实。备份保存为project-notes.original.md。
安全审计
低风险Static analysis flagged 107 potential issues across 10 files with a risk score of 100/100. After semantic evaluation, all flagged patterns are false positives. The external_commands findings (74 locations) are primarily markdown backticks in documentation files misidentified as shell execution. The one real subprocess call in scripts/compress.py uses hardcoded arguments with stdin input and no shell interpolation. Network findings (2 locations) are static URLs in README.md documentation, not runtime requests. Filesystem findings (2 locations) are standard path resolution for a file-processing tool. Environment access findings (9 locations) are legitimate ANTHROPIC_API_KEY and CAVEMAN_MODEL configuration for API usage. The critical heuristic finding about code execution plus network plus credential access is a false positive describing the normal operation of an Anthropic API client. No prompt injection attempts, data exfiltration patterns, or malicious intent detected. The tool has appropriate safeguards including file size limits (500KB), automatic backups, and retry logic with rollback on failure.
低风险问题 (3)
风险因素
⚙️ 外部命令 (1)
🔑 环境变量 (1)
质量评分
你能构建什么
降低日常会话成本
将CLAUDE.md项目记忆文件压缩一次。较小的文件会在每次会话启动时加载,每次使用AI工作时都能节省token。
优化团队文档
压缩共享的偏好文件、风格指南和项目约定。团队成员获得相同的指令,但每次会话的输入token更少。
精简长期项目笔记
将积累的待办事项、会议记录和决策日志压缩为关键事实。保留所有信息但去除冗长的开销。
试试这些提示
将CLAUDE.md文件压缩为穴居人格式。
压缩以下记忆文件:CLAUDE.md、todos.md和preferences.txt。
我用新的编码标准更新了CLAUDE.original.md。请再次压缩它以替换CLAUDE.md。
将CAVEMAN_MODEL设置为claude-haiku并压缩CLAUDE.md。
最佳实践
- 编辑.origi nal.md备份文件,然后再压缩。这样可以让你的人类可读格式的真相来源保持不变。
- 在记忆文件进行重大更新后运行压缩。新编辑的内容通常会添加冗长的解释,这些内容压缩效果很好。
- 在依赖压缩输出之前先检查。由于验证会检查技术内容,但风格变化可能会影响细节。
避免
- 不要压缩代码文件、配置文件或任何以代码内容为主的文件。该工具会自动跳过这些文件。
- 不要删除.origi nal.md备份。这是你的人类可读真相来源和恢复点。
- 不要对未更改的文件重复运行压缩。每次运行都会消耗API token。仅在有意义的编辑后进行压缩。