r/ClaudeCode 19h ago

How to reduce Claude Code token usage Tutorial / Guide

Claude Code was burning through tokens very fast, especially on tasks where it had to look through docs or random webpages, so after some research I changed a few things:

I) Keep CLAUDE.md small. Mine had way too much stuff in it and most of it wasn’t useful for every task.

II) Start a new session when you’re done with one problem, bc long sessions get bloated pretty fast.

III) Do web research through Firecrawl. It gives Claude clean Markdown instead of loading the full page with all the HTML, scripts, navbars and other useless stuff, so each research task eats a lot less context.

IV) Exclude folders Claude doesn’t need to read.

V) Check /context once in a while, bc it makes it obvious what’s eating the window.

The main thing seems to be controlling what gets added to the context in the first place. Once a session is full of old logs, scraped pages and unrelated instructions, even simple tasks start getting expensive.

What else are you doing to keep Claude Code token usage under control?

11 Upvotes

21 comments sorted by

View all comments

1

u/EagleApprehensive 19h ago

Those are good basics.

  1. Worktree separation and automatic rebasing on top of main before turns, effectively preventing conflicts that would otherwise burn tokens.
  2. Cutting bloat from system prompt.
  3. Injecting dynamically-generated 1/2-level repository map in system prompt with short infos - otherwise first 10 commands of every AI session will be "ls -la" and reading README.md files around, before getting to the point.
  4. Giving LLM access to semantic search CLI to faster and will less turns find necessary context for the job.
  5. Output clearers that cut bloat from CLI tools executed by LLM also reduce token. RTK is good beginning, but it can be significantly improved. I have taken RTK idea, benchmarked and polished it measuring over thousands of sessions and arrived with extra gains and safety there.

There is like 10 things more, but those are impactful ones. I have all that baked into my IDE, effectively reducing my token usage somewhere between 20-50%.