Caveman for coding agents
Your harness. Any model.Half the bill.
Keep Claude Code, Codex or OpenCode. Caveman trims what every turn reads and writes, and hands each task to the cheapest model that gets it right.
$npx @caveman-ai/cli
01 Starred by engineers at
02 How it works
Three ways every turn gets cheaper.
- Fig 1.1SCANNER
HOVER TO SCRUBtest.log · 18,240 → 201 tok Reads less.
Logs, test output, JSON and diffs shrink before the model reads them. The original stays on disk if it asks.
33.2% fewer input tokenswhole sessions, 18 of 18 answers right
- Fig 1.2SHREDDER
HOVER TO FEED FASTERwords 30 → 8 Says less.
Answers drop the filler. Code, commands and errors come back byte for byte.
65% less readable output≈ −10% of total tokens on long-horizon coding tasks
- Fig 1.3GATE
HOVER TO SLOW TIMErate 1.00× Picks the model.
Adaptive model selection gives every turn the cheapest model and effort that gets it right. Hard work still gets the frontier one.
0.46× the cost per taskSWE-Interact + SWE-Together, 85 paired tasks vs always-Opus, same solve rate
03 Open source
It started as a joke that made agents talk like cavemen. Then it went to #1 on Hacker News and #1 on GitHub Trending.
- 108,463 stars
- 904 points on Hacker News
- 30+ agents
- MIT licensed
04 Adaptive model selection
The first router that isn't a benchmark trick.Every model, right where you are.
It picks the model and the effort for every turn from what your agent is actually doing, then checks whether the work passed. Built by engineers who run coding agents all day.
The priciest modelis sometimes the cheapest.
A cheap model that loops for fourteen turns costs more than a frontier one that finishes in three. The router prices the whole task.
05 Blocks
Pre-releaseWhy many scriptwhen few do trick.
skills.sh for code mode. Agent write same script every session, throw it away, write it again. Blocks keep it in your repo, check it every PR, hand it back.
python3 - <<'EOF'
import json
ops=json.load(open('cloud/agent-surface/generated/operations.json'))
print(type(ops), (list(ops.keys())[:5] if isinstance(ops,dict) else len(ops)))
items = ops['operations'] if isinstance(ops,dict) and 'operations' in ops else ops
print(json.dumps(items[0] if isinstance(items,list) else list(items.items())[0], indent=1)[:800])
EOF$ caveman-blocks run json-peek --path cloud/agent-surface/generated/operations.json
{"kind": "object", "keys": ["schema_version", "contract_sha256",
"operations", "exclusions", "operations[].id", … 15 more],
"rows": 1, "sample": {"schema_version": 1, …}, "truncated": true}Same question. 101 token become 21.Every session after, still 21.
A real script from a Claude Code transcript, rerun on the same 1.4 MB file (251,893 tokens). Token counts: tiktoken o200k.
- 01 init
Eight rules and a one-line-per-block index go into AGENTS.md.
- 02 hint
› Blocks: json-peek covers this.A heredoc a block covers gets one line back. A new one becomes a candidate. Nothing is denied or rewritten.
- 03 verify
$ caveman-blocks verify ✓ stampedEvery block runs its own example. CI re-checks on every PR. A broken block drops out of the index.
Blocks against what agents type now
tokens, tiktoken o200k| Task | Raw output | Agents now | Block |
|---|---|---|---|
| go test -v ./...326 tests | 10,561 | 397| tail -20 | 76test-summary |
| 1.4 MB JSONone file | 251,893 | 236their own heredoc | 227json-peek |
| 366-line Go filefind definitions | 3,111 | 250grep -n "^func |^type " | 489grep-defsloses |
grep-defs loses to a bare grep. It labels every definition with file, kind, name and line.
06 Savings
Put a dollar on it.Your team. Your spend.
Estimate · saved per month
$104,394 a year · bill $12,500 → $3,801
How we count
Each layer has its own basis, below. Here the layers are multiplied, one after another. They were not measured together.
- Reads less 33.2%
- Fewer input tokens. Whole sessions, 6 tasks, 18 of 18 answers right.
- Says less ≈10%
- 65% fewer readable output tokens on a 10-prompt benchmark. Readable output is a small part of a long coding task, so the calculator counts ≈10% of total tokens on long-horizon coding tasks, our own estimate.
- Picks the model 0.46×
- The cost per task, with adaptive model selection. Measured on SWE-Interact and SWE-Together: 85 paired agentic coding tasks, routed Claude Code vs always-Opus 5.5 at max effort, same solve rate. Interim run, list-price estimates.
- Keeps the script up to 9.57%
- Of task cost. Purdue's published ceiling for the share spent rewriting scripts. Blocks is pre-release.
Assumes 80% of agent spend is input tokens and 20% is output. If your team already runs models cheaper than Opus at max effort, routing saves less.
$12,500 × (0.8 × 0.668 + 0.2) × 0.9 × 0.46 = $3,801
The new Caveman
Get the full optimization stack.
Reads less. Says less. Picks the model. Keeps the script. One install, in the agent you already run.
$npx @caveman-ai/cli
Free · MIT · Claude Code, Codex, OpenCode and 30+ more