Articles

Cut your AI agent's cost: 5 tactics to stop burning tokens

September 12, 2026 · 2 min read

You use AI to code every day, but do you know what you're really paying for? Here are five tactics to stop burning tokens.

The problem: the model reads everything, and you pay

A command like git diff or npm test spits out thousands of lines of logs. The agent processes all that junk and charges for every character:

Raw terminal output (e.g. 5,000 tokens)
> error: undefined method 'map'...
> at line 42... (2000 lines of stacktrace omitted)

1. RTK: the surgical filter

The Rust Token Killer intercepts your commands and cleans the output before the text reaches the agent.

# Without RTK (default): ~4,200 tokens sent to the model
git diff

# With RTK: ~450 tokens sent to the model
rtk git diff

2. Watch out for the coffee break

Claude's cache expires after 5 minutes of inactivity. If you take a while to reply, the next message forces the model to rewrite the entire history of the conversation.

Long session + 5-minute pause generates a massive cache_write of everything accumulated. Your cost explodes when you come back.

3. Compact before you pause

In Claude Code, don't let the session expire with a full cache:

  • About to pause? Run /compact. It compresses the history and reduces the volume of tokens that will be rewritten when you return.
  • Switched tasks? Run /clear. Short, focused sessions always cost less than a long, fragmented one.

4. Productive laziness: Pony Tail

A plugin that teaches the agent "productive laziness": it forces the model to think before spitting out new code.

  1. Reuses what already exists. Avoids recreating functions already in the project.
  2. Prefers native resources. Uses the stdlib before installing new dependencies.

Warning: use the lite or full modes. The ultra mode can compress too much and remove essential error handling.

5. Pick the right model

Smart architecture beats brute force. Smaller models cost a fraction of a cent and solve most daily tasks.

  • Fast models (like Haiku or 4o-mini): extracting data, validating JSON, formatting logs.
  • Heavy models (like the Sonnet line): only for refactoring and complex architecture.

In short

Filter what goes into the context, don't let the cache expire full, compact or clear the session, make the agent reuse what exists and use the right model for each task.

Lofi to codeHit play and keep browsing.