AI coding
Claude Code
Cursor
tokens
developer tools
rtk
caveman

Stop Paying Your AI to Read Passing Tests: 5 Ways to Cut AI Coding Tokens

By Job Fit Studio · · 9 min read

Run go test on a project with 326 tests and the raw output is about 10,561 tokens. Almost all of it is lines that say PASS. Your coding agent reads every one of them, and then re-sends them with each message after that.

Most token bills aren't driven by the hard questions you ask. They're driven by noise: test logs, long diffs, stale chat history and instruction files that load whether you need them or not. This guide covers two open-source tools and three free habits that cut that noise, with copy-paste commands for each.

One rule throughout: every number here comes from the tool's own README or the Claude Code docs, and we point out where those sources say the savings are smaller than the hype.

In this guide

  1. The 5 tips at a glance
  2. Tip 1: rtk, shrink what your agent reads
  3. Tip 2: caveman, or just "Answer concisely."
  4. Tip 3: /clear between tasks
  5. Tip 4: Keep CLAUDE.md under 200 lines
  6. Tip 5: Right model, right job
  7. Bonus: 5 more habits from the Claude Code docs
  8. Where your tokens actually go
  9. Your 10-minute setup
  10. Sources

The 5 tips at a glance

#TipWhat it cutsThe number
1rtkCommand output the agent reads (tests, git, logs, builds)Up to 90% less command output; git status goes from 40 lines to a 3-line summary
2"Answer concisely." (or caveman)What the agent writes back6,983 → 4,334 output tokens with one line; /caveman gets to 4,119
3/clearOld chat history re-sent with every message/clear costs nothing
4CLAUDE.md under 200 linesInstructions loaded every sessionSpecialized steps move to skills, which load only when used
5Sonnet by defaultPrice per tokenSonnet handles most coding and costs less than Opus

Tip 1: rtk, shrink what your agent reads

What it is: rtk (Rust Token Killer) is an open-source CLI that sits between your agent and the shell. When the agent runs git status, rtk runs rtk git status and hands back a short summary instead of the full output. It's a single Rust binary with 86k+ GitHub stars.

What it claims: up to 90% less command output across 100+ commands, adding under 25 ms per command. Some examples from the README:

CommandWhat the agent reads with rtk
cargo test / npm test / pytest / go testFailures only, with their assertion. Passing tests are collapsed to a count
git status / git diff / git logCompact status, reduced diff context, one line per commit
git add / commit / pushOne confirmation line instead of progress output
ls / tree / grep / rgTrees with counts, matches grouped by file
eslint / ruff check / cargo clippyGrouped by rule and file

Set it up (2 minutes):

brew install rtk              # macOS, or Linux with Homebrew
winget install rtk-ai.rtk     # Windows
rtk init -g                   # hooks it into Claude Code; restart Claude Code after
rtk gain                      # see what it saved

For other agents use rtk init -g --agent cursor, --codex, --gemini or --copilot. It supports 18 tools in total.

The honest part: rtk's README says it plainly: "a 90% cut in command output is not a 90% cut in cost." Command output is one part of your input tokens, and input tokens are one part of your bill. Token counts are also estimated (bytes ÷ 4).

Gotchas:

  • An unrelated "rtk" exists on crates.io. If rtk gain doesn't show a savings dashboard, you installed the wrong one.
  • Need the full output once? Run rtk bypass <command>.
  • It doesn't touch built-in tools like Read or Grep out of the box. Only shell commands are compressed unless you add a pipeline.

Tip 2: caveman, or just "Answer concisely."

What it is: caveman started as a joke skill that makes your agent "talk like a caveman" and hit #1 on Hacker News. It now has 119k+ stars. It cuts what the agent says:

Normal agent (63 tokens): "The reason your React component is re-rendering is likely because you're 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…"

Caveman (20 tokens): "New object ref each render, so React re-renders. Wrap the prop in useMemo."

Same fix, a third of the tokens. Code, commands, paths and error messages are kept exactly as they are.

The honest part, which is the real tip: caveman's own benchmark on 10 dev questions shows where most of the savings come from:

InstructionOutput tokens
None6,983
Answer concisely.4,334
/caveman4,119
/ultracave2,693

One plain sentence does most of the work. The README says so too: "'Be concise' is the real baseline; new models already know it." /caveman adds about 3% on top at the median, and /ultracave about 35%.

So, in order:

  1. Free: add Answer concisely. to your CLAUDE.md.

  2. Want more? Install the skill:

    npx skills add JuliusBrussee/caveman -g
    # then type /caveman, or /ultracave; say "stop caveman" to go back
    
  3. Want the whole toolkit? npx @caveman-ai/cli@latest (needs Node.js 22.13+) also shrinks logs, JSON, CSV and test output before the agent reads them. Their benchmark across 54 Claude Code runs showed 33.2% fewer input tokens per session, with 18 of 18 answers still correct.

Gotchas:

  • The caveman rules themselves cost about 1,160 input tokens.
  • If you pay per request (like GitHub Copilot), shorter answers save you nothing.
  • Caveman deliberately never rewrites your prompt. Research it cites found that cavemanning prompts makes answers worse.

Tip 3: /clear between tasks

Here is the part most people miss: Claude Code sends your full conversation with every request. If you fixed a CSS bug an hour ago and are now writing a migration, that whole CSS conversation rides along with every new message.

From the Claude Code docs:

  • /clear starts fresh when you switch to unrelated work. "Stale context wastes tokens on every subsequent message." It costs nothing.
  • /rename the session before clearing, then /resume to come back to it later.
  • /compact summarizes the chat instead of wiping it. It's useful when you need continuity, but "compacting a large context is itself a large request." You can steer it: /compact Focus on the API changes.
  • /usage shows where your tokens went and recommends fixes for anything behind 10% or more of your recent usage.

Rule of thumb: new task, new context. Use /clear by default, and /compact only when the history matters.


Tip 4: Keep CLAUDE.md under 200 lines

Your CLAUDE.md loads into context at the start of every session, on every task. If it holds a 40-line PR review checklist and a database migration guide, you pay for those even when you're renaming a variable.

The Claude Code docs recommend: "Aim to keep CLAUDE.md under 200 lines by including only essentials." Move workflow-specific instructions into skills, which load only when they're used.

What stays in CLAUDE.md:

  • Stack and versions
  • How to build and run tests
  • Hard rules ("no new dependencies without asking", "all tests green before a PR")
  • Answer concisely. (see Tip 2)

What moves to skills (.claude/skills/<name>/SKILL.md):

  • PR review steps
  • Database migration guides
  • Release or deploy checklists
  • Anything you only need a few times a week

Bonus: caveman's /caveman-compress <file> can shrink memory files like CLAUDE.md. In its benchmark it went from 6,198 to 4,138 tokens across five files, keeping headings, code blocks and paths intact.


Tip 5: Right model, right job

Not every task needs the biggest model. From the Claude Code docs: "Sonnet handles most coding tasks well and costs less than Opus. Reserve Opus for complex architectural decisions or multi-step reasoning."

TaskModel
Writing a function, fixing a test, refactoring, docsSonnet
System design, gnarly multi-file bugs, tricky migrationsOpus

Switch mid-session with /model, or set a default in /config. One catch: subagents that inherit your session's model switch with it, so a jump to Opus applies to them too.

You can also lower the effort level (/effort) for simple tasks. Thinking tokens are billed as output, and the default budget can be tens of thousands of tokens per request.


Bonus: 5 more habits from the Claude Code docs

  1. Send noisy work to a subagent. Running tests, reading docs or processing logs in a subagent keeps the verbose output in its context. Only a summary comes back to your main chat.
  2. Prefer CLI tools over MCP servers when both exist. Tools like gh, aws and gcloud don't add a per-tool listing to context. Run /context to see what's taking up space.
  3. Be specific. "Improve this codebase" triggers broad scanning. "Add input validation to the login function in auth.ts" lets the agent read only what it needs.
  4. Plan before big changes. Press Shift+Tab for plan mode, so a wrong direction is caught before tokens go into building it. Press Esc early if it heads the wrong way, and use /rewind to roll back.
  5. Watch idle sessions. After a break longer than the cache lifetime, your next message reprocesses the full context at full price. Scheduled tasks and agent teammates keep using tokens while you're away. Agent teams can use about 7x more tokens than a standard session.

Where your tokens actually go

It helps to picture the bill as three buckets:

BucketWhat fills itWhat fixes it
What the agent readsTest output, diffs, logs, files, MCP tool lists, CLAUDE.mdrtk, caveman's "read less", subagents, a short CLAUDE.md
What gets re-sentThe whole conversation, on every message/clear, /compact, one task per session
What the agent writesExplanations, recaps, thinking"Answer concisely.", caveman, lower effort

And on top of all three, which model sets the price per token.

Most people only attack the third bucket because it's the one they can see. The first two are usually bigger.


Your 10-minute setup

  • brew install rtk && rtk init -g, then restart your agent
  • Add Answer concisely. to CLAUDE.md
  • Trim CLAUDE.md to under 200 lines and move workflows into .claude/skills/
  • Set Sonnet as your default in /config
  • Make /clear a habit every time you switch tasks
  • After a week, run rtk gain and /usage to see what changed

Optional: npx skills add JuliusBrussee/caveman -g if you want answers even shorter.


Sources

Checked 2026-11-13.

  • rtk README: github.com/rtk-ai/rtk · site: rtk-ai.app ("up to 90% less command output", 100+ commands, under 25 ms, git status 40 lines → 3, "a 90% cut in command output is not a 90% cut in cost", install commands).
  • caveman README: github.com/JuliusBrussee/caveman · site: caveman.so (63 → 20 token example; 10-question benchmark 6,983 / 4,334 / 4,119 / 2,693, measured on the 3.1.0 rules; 33.2% fewer input tokens over 54 Claude Code runs; go test with 326 tests = 10,561 raw tokens; CLAUDE.md compress 6,198 → 4,138; rules cost ~1,160 tokens).
  • Claude Code docs, "Manage costs effectively": code.claude.com/docs/en/costs (/clear, /compact, /usage, CLAUDE.md under 200 lines, skills load on demand, Sonnet vs Opus, effort level, subagents, CLI over MCP, plan mode, cache misses, agent teams ~7x).

The tools' numbers are their own benchmarks, and your results will vary with your stack and how you work.

More guides