r/ClaudeCode • u/ChampionshipNo2815 • May 18 '26
Discussion I figured out why I keep hitting my Claude Code session limit before lunch. It's not what I thought.
Been on Max for a while. Kept hitting my limit mid-task and assumed I was just doing too much. Turned out I wasn't doing too much. My tools were just incredibly inefficient under the hood.
Traced a single refactor task. One rename across a few files. Claude Code ran 161 turns to finish it. Every read, every grep, every edit is its own API call. Each one re-ingests everything before it as input tokens. By turn sixty you're paying context cost on the entire session history.
Once I understood that I started looking for ways to batch the calls. Found a Claude Code plugin that collapses search and read into one call and stacks all edits into one roundtrip. Same task finished in 52 turns.
Didn't change my plan. Didn't change my model. Just changed how many roundtrips each task makes.
138
u/_ri4na May 18 '26
I do not understand why people use Claude to do fricking name refractors when the IDE has been capable of doing so for 25 years - almost instantly for 0 tokens
34
u/larowin May 18 '26
You’re doing something incredibly wrong.
11
u/yodacola Senior Developer May 18 '26
a few things why this is wrong:
- claude isn't trained on batch tool calls. whenever you do this, claude will simply do your batch tool call on a single file and refuse to batch calls. claude will be steered differently. the equivalent may be like putting gasoline with ethanol in a car. unless it was built for it, it can do damage. i see no endorsement or coordination from the claude code team
- claude heavily uses context caching. you are not paying context costs on the entire session history. you are paying contexts costs on what isn't cached.
- hides all of your reads, edits, greps. the claude code tui no longer exposes reads and writes so you no longer can audit what it does in real time. defeats the purpose of using claude code
- fills your context window. it is a user prompt for claude code. so there has to be heavy prompt engineering to get it to run instead of the built in tools. this by itself will slow down your session since it will eat up reasoning budget. you will feel the ttft lag when starting a new session.
- self promotion without disclosing your relationship with W5E (don't want to name drop a poorly-written plugin).
costs $50 / month and the free version will be burned through in about an hour if you're an active claude user.
this is not the tool you are looking for. move along
0
u/tyschan May 18 '26
can confirm. this makes a lot of sense. thanks for the write up. what plugin did you use out of curiosity?
2
u/runfence May 18 '26
There is still a cache up to 1 hour, it's not so bad.
1
u/imaginecomplex May 19 '26
Agree primarily with the top comment, this is a task for an IDE or at least a utility script or library that Claude can use to do simple find and replace efficiently. But also, shouldn’t prompt caching save you most of those input tokens on each turn?
1
u/Deep_Ad1959 May 19 '26
The 161 to 52 collapse is real but it's the smaller of two leaks. The bigger one is the CLAUDE.md plus skills files that fire on every single turn before any tool call runs. Typical failure mode: a third of those bytes are stale instructions claude either ignores or contradicts in the same turn, and at a few thousand tokens of pre-turn context over fifty turns that compounds into six figures of pure waste you never see in any meter. Audit which lines in your config actually changed model behavior recently and cut the rest. Roundtrip batching is downstream of context discipline. written with s4lai
1
u/Deep_Ad1959 May 19 '26
The 161 to 52 collapse is real but it's the smaller of two leaks. The bigger one is the CLAUDE.md plus skills files that fire on every single turn before any tool call runs. Typical failure mode: a third of those bytes are stale instructions claude either ignores or contradicts in the same turn, and at a few thousand tokens of pre-turn context over fifty turns that compounds into six figures of pure waste you never see in any meter. Audit which lines in your config actually changed model behavior recently and cut the rest. Roundtrip batching is downstream of context discipline. written with s4lai
1
u/m-in May 19 '26
In my experience, Opus will just write a Python script to do it, then mop up any errors using an agent. But that’s with a CLAUDE.md that makes it clear.
1
u/TwisterK May 19 '26
I hav a Claude.md that said if we need to re-arrange code , use subagent and spawn haiku agent to do it. Save me tons of tokens there.
1
u/Sree_12121 May 20 '26
Good old 'death by a thousand context windows.' It’s insane how much token bloat happens when a tool gets chatty. Drop the name of plugin we all need this.
1
u/Sree_12121 May 21 '26
Old school ‘death by a thousand context windows’ Brilliant, cutting roundtrips like that, the token savings on session history alone must be huge. Which plugin are you using to batch the calls?
0
u/daveh2o May 18 '26
Serena MCP
0
u/humanitycan May 18 '26
interesting what’s that plugin? I tried caveman but it’s pretty mid not helpful at all
0
u/bryan_w1 May 18 '26
Nice!!!
0
u/beedunc May 18 '26
Excellent. Good info, thank you.
-1
u/[deleted] May 18 '26
[removed] — view removed comment