News / guide
Cutting token costs in Cursor, Codex CLI and Gemini CLI
The same two levers as Claude Code, the exact install for each agent, and the meters where token savings do not help.
- Author
- Julius Brussee
- Published
- 7 September 2026
- Length
- 5 min read
Most writing about agent costs is about Claude Code. The mechanics are the same everywhere: the agent resends its whole context every turn, tool output is the bulk of it, and the reply is the expensive part per token. What differs between agents is how you install a fix and which meter your plan runs on.
This guide covers the agents people ask about most. Before any of it, check one thing.
First, which meter are you on
Token-side fixes only help token-side bills. If your plan charges per request or per message, a shorter answer is the same request.
| Agent | Typical meter | Token fixes help |
|---|---|---|
| Codex CLI with an API key | Tokens | Yes |
| Codex CLI with ChatGPT login | Plan allowance | Indirectly, by using less of it |
| Gemini CLI with an API key | Tokens | Yes |
| Cursor | Depends on plan and model | Check your plan's usage page |
| GitHub Copilot | Premium requests | No, for output length |
| Windsurf, Cline, Continue, Roo | Usually your own API key | Yes |
When in doubt, run the same task twice and look at the provider's usage page, not the agent's own counter.
Lever one: shorter output, the skill
The Caveman skill is a rule file that makes the agent answer tersely while leaving code, commands and errors byte for byte intact. On ten measured prompts it cut output tokens by 65 percent. It costs about 1,000 to 1,500 input tokens per turn for its own rules, so on already short sessions it can lose; see the honest write-up.
Install per agent. Where a row says per session, type /caveman when you
want it on.
| Agent | Install | Activates |
|---|---|---|
| Codex CLI | npx skills add JuliusBrussee/caveman -a codex | Per session |
| Gemini CLI | gemini extensions install https://github.com/JuliusBrussee/caveman | Automatically |
| Cursor | npx skills add JuliusBrussee/caveman -a cursor -g | Per session; add --with-init for an always-on rule file |
| Windsurf | npx skills add JuliusBrussee/caveman -a windsurf | Per session; --with-init for always-on |
| Cline | npx skills add JuliusBrussee/caveman -a cline | Per session; --with-init for always-on |
| Continue, Kilo, Roo, Augment, Amp | npx skills add JuliusBrussee/caveman -a <id> | Say /caveman |
One trap with Cursor. npx skills add without -g writes into the current
directory, and Cursor reads a fixed home folder, so the install prints success
and Cursor never sees it. The -g flag is not optional there.
The one-line installer detects every supported agent on the machine and runs each one's native path:
curl -fsSL https://raw.githubusercontent.com/JuliusBrussee/caveman/v2.6.0/install.sh | bashLever two: compressed context, the proxy
The proxy runs on your machine between the agent and the provider, shrinks tool output before it re-enters context, and keeps the original on disk with a recovery handle. On the pinned Claude Code benchmark it cut provider input tokens by 33.2 percent across 18 paired runs with every exact-answer check passing, and one HTML case where it cost 9.9 percent more.
Wrap profiles exist for ten agents. One command launches the agent through the proxy and touches none of its config files.
npm install -g @caveman-ai/cli && caveman setup --install
caveman codex # env vars with an API key; ephemeral CODEX_HOME with ChatGPT login
caveman gemini # env vars
caveman aider # env vars
caveman opencode # inline config via env, your opencode.json untouched
caveman kilo # KILO_CONFIG_CONTENT, your kilo.json untouched
caveman qwen # temporary settings overlay
caveman hermes # --provider custom plus env
caveman openclaw # ephemeral merged config
caveman pi # bundled native extension
caveman claude # env vars, OAuth passes throughCursor, Windsurf and Cline do not have a wrap profile. They route model calls through their own backends or through settings that do not expose a base URL in a way a launcher can set. For those, lever one is what is available, plus the MCP tools below.
Codex CLI skips the command-output shrink hook because its runtime rejects the rewrite. Compression of tool results still applies.
Lever three: the same tools over MCP
Any MCP host, including Cursor and Windsurf, can register the Caveman MCP server and get five tools: compress, retrieve, stats, and TOON encode and decode. That gives an agent a way to compress a large payload on request and recover it later, without a proxy in the path. It is opt-in per call rather than automatic, so the savings depend on the agent choosing to use it.
The server is not on npm yet. Build it from the public source and register the
binary in the host's mcpServers config; for Claude Code and Qwen the CLI can
write that config for you with caveman tools mcp install. The
MCP page has the build line and the tool
table.
Check what your agent is really sending
caveman learn reads local session history for Claude Code, Codex, Gemini
CLI and opencode, and ranks token sinks worst-first with a suggested fix
behind each. It runs read-only and needs no account. Aider is supported with
an environment variable pointing at its history.
caveman learnQuestions people ask
Does the Caveman skill work in Cursor?
Yes. Install with npx skills add JuliusBrussee/caveman -a cursor -g. The
-g flag matters because Cursor reads a fixed home folder. By default it is
per session; pass --with-init to write an always-on rule file. Whether it
lowers your bill depends on your plan's meter, so check the usage page after a
day.
Can I wrap Codex CLI with the Caveman proxy?
Yes. caveman codex launches Codex through the local proxy. With an API key
it sets environment variables. With a ChatGPT login it uses an ephemeral
CODEX_HOME so your real one is untouched.
Does Gemini CLI support the skill?
Yes, as a native extension. gemini extensions install with the repository
URL, and it activates automatically. caveman gemini wraps it through the
proxy as well.
Why does none of this help with GitHub Copilot?
Copilot bills premium requests, not tokens. A shorter answer is the same request. The skill still shortens replies if you prefer them that way, but it will not change the invoice.
Which agents have a proxy wrap profile?
Ten today: Claude Code, Codex CLI, Gemini CLI, Aider, Kilo Code, Qwen Code,
opencode, Hermes, OpenClaw and Pi. Anything else can be launched with
caveman run -- <command>, which supplies the proxy environment but cannot
set a host's native hooks.
Sources
- Install table, all agents.
- Wrap an agent, the profile table.
- Honest numbers, the per-request pricing cases.
Replies go to contact@caveman.ac
All news