省75%token的骚操作:给Claude Code装个caveman插件,写代码再也不废话了

3 阅读1分钟

问题

用Claude Code写代码,最烦的一件事是什么?

它太能说了。

你问它一个React组件为什么重复渲染,它给你回一大段:

"The reason your React component is re-rendering is likely because you are creating a new object reference on each render cycle. When you pass an inline object as a prop, React's shallow comparison sees it as a different object every time, which triggers a re-render. I would recommend using useMemo to memoize the object."

1180个token。其中有用的信息就一句:内联对象每次渲染都是新引用,用useMemo。

我算了一笔账,每天跟Claude Code对话大概200轮,每轮平均浪费30-40个token在"I'd be happy to help"和"Let me take a look"上。一天下来白烧6000-8000个token。一个月20万token,换算成钱大概50刀。

caveman是什么

GitHub上一个叫JuliusBrussee的人做了个插件叫caveman(github.com/JuliusBruss…),思路很简单:让Claude说话像个原始人——砍掉所有废话,只留核心信息。

装完之后,同样的问题:

"New object ref each render. Inline object prop = new ref = re-render. Wrap in useMemo."

159个token。省了87%。

实际测试数据

我拿10个常见编程问题跑了一遍benchmark(他的repo里有benchmark脚本,可以自己复现):

  • 解释React重渲染bug:1180 → 159,省87%
  • 修auth middleware token过期:704 → 121,省83%
  • 搭PostgreSQL连接池:2347 → 380,省84%
  • 解释git rebase vs merge:702 → 292,省58%
  • 重构callback到async/await:387 → 301,省22%
  • 微服务vs单体架构:446 → 310,省30%
  • PR安全审查:678 → 398,省41%
  • Docker多阶段构建:1042 → 290,省72%
  • 调试PostgreSQL竞态:1200 → 232,省81%
  • 实现React Error Boundary:3454 → 456,省87%

平均省65%。 范围从22%到87%不等。越是需要长篇解释的场景,省得越多。纯代码修改的场景省得少——因为代码本身没法"caveman化",它只压缩自然语言部分。

装法

一行命令:

npx skills add JuliusBrussee/caveman

如果你用的是Cursor、Copilot、Cline这些,指定一下agent:

npx skills add JuliusBrussee/caveman -a cursor
npx skills add JuliusBrussee/caveman -a copilot

已经有superpowers的直接从marketplace装:

claude plugin install caveman@superpowers-marketplace

装完用/caveman开启,stop caveman关闭。

三个档位

不是只有全开和全关。它有三个强度:

  • lite:去掉废话但保留语法,看着还像正常人说话。日常推荐
  • full:默认档,砍掉冠词、省略主语,读起来像电报
  • ultra:极限压缩,能缩写的全缩写,适合你只想看结论的时候

lite档例子:

"Your component re-renders because you create a new object reference each render. Inline object props fail shallow comparison every time. Wrap it in useMemo."

full档:

"New object ref each render. Inline object prop = new ref = re-render. Wrap in useMemo."

ultra档:

"Inline obj prop → new ref → re-render. useMemo."

同一个答案。你选。

它不压缩什么

代码块原样保留。技术术语不变(polymorphism还是polymorphism)。错误信息原文引用。git commit和PR message正常写。

只压缩自然语言——就是那些"I'd be happy to help you with that"和"The reason this is happening is because"之类的填充语。

一个冷知识

今年3月有篇论文(arxiv.org/abs/2604.00025)发现:限制大模型用简短回复,在某些benchmark上准确率反而提高了26个百分点。不是"差不多",是"更好"。

原因可能是:强制简短回复让模型没法用废话来"对冲"不确定性,必须给出明确答案。啰嗦反而是一种逃避。

配合caveman compress省输入token

caveman压缩输出。但你的CLAUDE.md每次会话都要加载,这也是token消耗大头。

/caveman-compress CLAUDE.md可以把你的项目配置文件也"caveman化"——压缩自然语言部分,保留代码和技术内容。

实测:

  • 项目偏好文件:706 → 285 token,省60%
  • 项目笔记:1145 → 535,省53%
  • TODO清单:627 → 388,省38%

平均省45%的输入token。输出省65%+输入省45%,两头一算,一个月能省不少。

我的实际用法

  1. 日常开发用lite——看着舒服,省得够多
  2. 调试bug的时候用full——只给结论,不要解释
  3. 写代码review的时候关掉——review需要完整的语境
  4. CLAUDE.md用compress压过一遍,省了大概500 token/session

用了两周了。除了偶尔需要Claude详细解释的时候要记得先stop caveman,没啥毛病。


折腾完以后算了一下,每月大概能省40-50刀的API费用(如果你是按token付费的话)。Max订阅用户没有直接省钱,但是响应速度快了——生成的token少了,回复就快了。