Caveman 5: How to Cut Claude Code Token Costs by 40% Caveman 5, an open-source tool that has passed 123,000 GitHub stars, cut total Claude Sonnet 5.5 session cost by 42.9% in the project's own 32-task benchmark, even though input tokens fell only 16.3%, because the savings come from fewer expensive cache writes. Version 5.0 shifts the tool from shortening agent replies to reducing what agents read, adding the local 3.6-megabyte Trim 2 filter for tool output, a free auto model router that reportedly matches Opus-level results at roughly 46% of the cost in an early benchmark, and Blocks caching for scripts agents regenerate. The Apache 2.0-licensed tool installs via a single npx command across roughly 30 coding agents, sends usage telemetry by default, and its optional cloud router sends parts of conversations off-device. Caveman 5: How to Cut Claude Code Token Costs by 40% Caveman 5 install guide and breakdown of Trim 2, auto model routing, and Blocks, open-source tools that cut AI coding agent costs up to 43%. What is Caveman 5? Caveman 5 is the latest version of an open-source tool that cuts token costs for AI coding agents like Claude Code, Codex, and Gemini CLI. It started as a joke that made agents talk in short, clipped “caveman” sentences to save output tokens, and it has since passed 123,000 stars on GitHub. Version 5.0 shifted the project’s focus from making agents write less to making them read less, which is where most of the token bill actually lives. Version 5.1 followed the next morning with reliability fixes. TL;DR - Caveman 5 now targets input tokens, not output tokens , because independent testing found that shortening an agent’s replies barely moves the needle on total cost. - A new local model called Trim 2 filters tool output logs, test results, file reads down to only the lines relevant to the question being asked, with everything else recoverable on demand. - In the project’s own 32-task benchmark on Claude Sonnet 5.5, Caveman cut total session cost by 42.9% while input tokens only dropped 16.3%, because the savings come from reducing expensive cache writes, not raw token count. - A free auto model router picks the model and effort level per request, reportedly matching Opus-level results at roughly 46% of the cost in an early, half-finished benchmark. - A feature called Blocks caches scripts agents keep rewriting from scratch, since one study found agents regenerating the same script 394 times in a single week . - Installation is a single npx command that supports Mac, Linux, and Windows, and it works across roughly 30 coding agents without touching your actual prompts. - The tool is Apache 2.0 licensed and free, though it sends usage telemetry by default and the optional cloud-based auto router sends parts of your conversation off-device. Build a credit limitreview app for800 relationshipmanagers One prompt. Role-based access, audit trail and SSO come built in. Why did Caveman shift from “say less” to “read less”? The original caveman voice trick got real attention this year. Adobe Research found that caveman-style output cut costs by 1.4 to 2.4 times across eight models, and Elastic reported a 63.6% drop in response tokens after rebuilding the approach for Elasticsearch. But JetBrains ran a controlled A/B test across 86 real coding tasks and found something less flattering: no quality loss, but only an 8.5% drop in output tokens. The reason is straightforward. In a typical agent session, the agent’s own replies are a small slice of the total token bill. Most tokens come from code, tool calls, logs, and test output that the agent has to read, and that history gets resent on every turn. A shorter voice only shaves the part of the bill that was never that large to begin with. Adobe also found that compressing the user’s own prompt rather than the agent’s reply actually hurt answer quality, which is why Caveman never touches your prompt. That data pushed the project to build six components, which the team calls “rocks”: the caveman voice itself, a read-less compressor, automatic model routing, Blocks for cached scripts, a waste-finder for token usage, and a browser tool that compresses web pages before the agent sees them. How does Trim 2 actually cut token costs? Trim 2 is a 3.6-megabyte model that runs locally and filters tool output before it ever reaches the AI model. It reads the user’s question, then scans each line of a tool result and keeps only the lines relevant to answering that question. Kept lines stay byte-for-byte identical and in their original order. Dropped lines aren’t deleted: they go into a local recovery store, and the agent can pull any of them back with a single tool call if needed. The project’s own example: a 404-line Kubernetes log where 400 lines say a checkout request was served quickly and one line reports a payment client hitting a database timeout. Asking an agent “why did the payment fail” normally means resending all roughly 10,600 tokens of that log on every subsequent turn. Trim 2 narrows it to nine lines the error, the surrounding stack frame, and a few requests on each side for timing context , landing at 216 tokens. Notably, the team’s own writeup shows Trim 2 losing on that exact example. Caveman’s older log compressor, which handles repetitive templated lines, gets the same file down to 169 tokens because most of the 400 lines share a template. So in practice, the proxy runs both methods and sends whichever produces fewer tokens. Trim 2 is built for cases the old compressor can’t handle well, like build logs where every line differs or grep results scattered across many files. Build a claims triage app for 4,000 insurance adjusters One prompt. Role-based access, audit trail and SSO come built in. Under the hood, Trim 2 uses two forests of decision trees rather than an LLM: one with 701 trees scoring each line across 134 features including things like function-name matches against the question , and a second with 641 trees scoring 174 features based on how each line relates to its surrounding context. Running as decision trees rather than a language model keeps it fast enough to run locally on every tool call. What do the benchmark numbers actually show? The team ran 32 coding tasks through Claude Sonnet 5.5 twice, once plain and once through Caveman. Both runs passed all 32 tasks. Total session cost dropped from a baseline indexed at roughly 1.66 down to about 0.95, a 42.9% reduction. But input tokens only fell 16.3%, which is a much smaller drop than the cost savings suggest. The gap comes down to prompt caching mechanics on Anthropic’s API. System prompts and tool definitions are already cached on both sides, and cached reads cost a tenth of the normal rate. But every fresh tool result gets written to the cache at 1.25 times the normal price, and that’s exactly what Caveman’s read-less filtering shrinks. Cache writes fell 57.2% in the benchmark, which is where most of the dollar savings actually originate. The team also disclosed limitations: this was one run per task on one model, not production billing data. Three recovery calls pulling back dropped lines occurred, all on legal and finance tasks rather than coding tasks. When asked for a full file review, Caveman correctly kept everything and cost 2.5% more than the baseline. Savings concentrate in noisy logs and large documents; short, dense, handwritten code saves less. Is the auto model router worth turning on? Once a free Caveman account is created, an “auto” option appears in the agent’s model picker. It selects both the model and the effort level per request, aiming for high effort on hard problems and minimal effort on easy ones. In an 85-task comparison against Claude Opus 5.5 https://goremy.ai/blog/articles/claude-api-cost-management-caching-batch-model-matching run at maximum effort on every request, Opus solved 44.3% of tasks at roughly $7.83 per attempt. Auto, restricted to Claude models only, solved 43.7% at $3.59 per attempt and finished in under half the time, about 0.46 times the cost for a near-identical solve rate. The team itself flagged this as preliminary: the benchmark run was only half complete, the score gap is within noise at that sample size, and most of the savings came from cutting effort on easy requests. Anyone already running models at medium effort rather than maximum should expect smaller gains. What is Blocks, and does it always help? Blocks addresses a specific waste pattern: agents using “code mode” write small scripts to accomplish tasks, then rewrite nearly identical scripts in later sessions. The team found agents writing the same script 394 times in a single week. Blocks saves these scripts in the repository and hands them back instead of regenerating them. One example: running a Go test suite with 326 tests produces 10,561 tokens of raw output. Piping that into tail -20 typically gets it to 397 tokens. A dedicated test-summary Block gets it down to 76 tokens. But the team also published a case where Blocks loses: a grep Block produced 489 tokens versus 250 for a plain grep command. Blocks is still pre-release, Python-only, and runs without a sandbox, so it’s worth treating as experimental. Build a credit limit review app for 800 relationship managers Role-based access, audit trail and SSO built in. How do you install Caveman 5, and what should you watch for? Installation is a single command: npx @caveman-ai/cli@latest , requiring Node 22.3 or later on Mac, Linux, or Windows. It detects installed agents, previews changes, and applies them after confirmation. It covers Claude Code, Codex, Gemini CLI, OpenCode, and roughly 30 other agents, running locally with either your own API keys or a Claude Pro/Max login. A lighter version that installs only the voice skill, without the token-saving proxy, is available separately for anyone who just wants shorter agent replies. Two things worth knowing before installing. First, the CLI sends usage telemetry by default, including commands run, token counts, OS, and IP address, though not prompts, code, or file paths. It can be disabled with a telemetry-off command. Second, enabling the auto router sends the latest request and parts of the conversation to Caveman’s cloud service to pick a model, and the free plan may retain that data. Anyone working with private or sensitive code should weigh that tradeoff before turning auto on. Frequently Asked Questions Does Caveman actually reduce AI coding costs, or just make responses shorter? Both, but the cost savings come almost entirely from reducing what the agent reads logs, tool output, file contents , not from shortening what it writes. The project’s own benchmark showed a 42.9% total cost reduction against only a 16.3% drop in input tokens, with the difference explained by reduced prompt-cache write costs. What is Trim 2 and how is it different from an LLM-based summarizer? Trim 2 is a small 3.6 MB local model built from decision tree forests, not a language model. It scores each line of tool output against the user’s question and context, keeping relevant lines unchanged and storing the rest in a local recovery cache that the agent can query if needed. Is Caveman 5 free and open source? Yes, the core project is Apache 2.0 licensed and free to install. Optional features like the cloud-based auto model router use a separate account and may involve data handling tradeoffs on the free tier. Which coding agents work with Caveman 5? The project supports Claude Code, Codex, Gemini CLI, OpenCode, and roughly 30 other coding agents, and works across Anthropic, OpenAI, AWS Bedrock, and Google Vertex backends. Does using Caveman risk losing important information from logs or files? The project’s compression features keep a recovery store of anything removed from the context sent to the model, and the agent can retrieve dropped lines with one additional tool call. The team’s own benchmark reported this recovery mechanism triggering only three times across 32 tasks, mostly on non-coding legal and finance tasks.