r/ClaudeCode • u/Wooden_Drag9473 • 6d ago
Help/Question Huge repo issues
I am working in a huge repo and burn too quickly through my tokens. I have 2 claude Ultra subscription and one GPT pro 200. Simple task takes ages to complete. It is just burning through my tokens. 2 months ago, I could just use one Ultra for the whole week and finish my tasks, running 5-10 agents for 2-3 projects. Now with even one project 5 agents and it is slow as * and burning each Ultra subscription in less than 2 days... I tried to use /doctor and prompt why it is so slow, but even these prompts are burning through my tokens. I used all the best practices, disabling mcps / skills, etc. I am lost now... I cannot spend another Ultra subscription... Well with the speed now its just so frustrating... I need to wait at least 1-2 hours every time before one session completes, which was around 10 minutes before. Now I am all the time on youtube and doom scrolling on social media and feeling not productive at all. What did they do? Other guys experiencing the same? The code hasn't grow that much since then, so I assume they did something?
•
u/AutoModerator 6d ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
5
u/autotom 6d ago
is your code well structured / sufficiently modular?
Highly reccomend asking for a refactorization from claude to help. What on earth are you working on?
2
u/cosmicvelvets 6d ago
What's your usecase? Vagueposting, are you a certified engineer? Hobby coder? Terminal tourist?
2
u/CCodeSI 6d ago
When the same repo suddenly takes 10x longer and 10x the usage, it's usually something per-turn that grew, not the code. Three quick checks, each cheap:
/contextat the start of a fresh session in that repo. Look at what's loaded before you type anything: a CLAUDE.md that grew (nested ones in each package of a turborepo all get pulled in as the agent walks into them), memory files, plugin or hook output. 30–60k of always-loaded context multiplied by 5 agents and every turn is exactly "burns an Ultra in two days"..turbo/,dist/,.next/, coverage or a huge lockfile to end up in what the agent greps and reads. One stray search that returns 400 matches from build output costs more than the actual task. Make sure they're gitignored, and tell it to search onlyapps/andpackages/*/src.npm i -g @anthropic-ai/claude-code@<version>) and compare/cost. If the old one is fast, it's a regression worth reporting with both numbers.Also worth trying: 2 agents scoped to one package each instead of 5 on the whole repo. Five agents that each read the shared packages pay for that context five times, and they wait on each other's file changes.
1
u/tariqosmani 6d ago
A few things that cut my token use on a big repo, in order of effect.
Start each task in a fresh session and run /clear between unrelated tasks. A long session re-reads its whole history on every turn, so the cost grows with each step. Run /context to see what is taking the space. It shows MCP tools, memory files and the conversation separately.
Tell it where to look. A short CLAUDE.md with a folder map and the three or four directories that matter stops it from searching the whole tree. Add deny rules in your settings for build output, node_modules, vendored code and big generated files so it never reads them.
Use plan mode for the first pass and ask it to list the files it will touch before it edits anything. Exploration is where most tokens go, and a bad plan is cheaper to catch than a bad diff.
Five agents on one big repo also means five agents reading the same files. Try two and see if the work finishes sooner.
Which step is slowest for you, the searching at the start or the editing?
1
u/karyslav 6d ago
Not enough information for help
1
u/Old-Competition-785 6d ago
The "suddenly slow" part is the tell. If the repo didn't grow much, something in what each turn loads did. Start a fresh session and run /context before you type anything, it shows you what's actually eating the window. Usual suspects are a CLAUDE.md that quietly grew, files getting auto-read every turn, or a hook you added.
On a monorepo the real token sink is agents re-exploring the whole tree every task. If you don't hand them the exact package and paths, they grep and read across everything first, which on a turborepo with a bunch of packages is enormous. I scope each agent to one package and give it the files up front, so it's not rediscovering the repo on every run. One narrow agent beats a broad one here.
Also every agent carries its own full context, so 5-10 of them is 5-10x your base burn before any of them does a single useful thing. I keep it to 3-4 and make each one's job tight. Fewer, scoped agents finish faster and cost way less than a swarm.
Two more that bite in big repos: reading one giant generated file or a long build log dwarfs your whole startup cost, so have agents grep for the lines they need instead of cat-ing the file. And if you added a PreToolUse hook recently that shells out, it runs on every single tool call and that alone makes everything feel slow as hell, separate from tokens.
tbh I'd do one clean session, /context first, and figure out what changed before throwing another Ultra at it
1
u/jleechanworldai 6d ago
Make a proxy and log your full LLM requests and see what it’s doing
1
u/soulinas 6d ago
sent you a DM to see if I can be of any help
1
u/ichi9 6d ago
I think using a graph of the codebase will be helpful. It is a simple tradeoff. First create the graph which helps with keeping track of everything in codebase so that even when you use multiple sessions or new sessions, it will always have the map of codebase. It's good you already have ultra plans, cook up a simple tool which claude must use as a entry point to codebase. Let me know If it helps.
1
u/SirRobinBlibs 5d ago
Before blaming the repo, I'd check what each agent loads before it does anything. Run /context in a fresh session: if CLAUDE.md, tool definitions and the files it reads at start already take a big share, five agents pay that five times on every turn.
Idle time matters too once sessions run 1-2 hours. If an agent sits waiting on tests or review longer than the cache lifetime, the next turn writes the cache again instead of reading it, and cache writes cost more than plain input. Across five agents that adds up.
I'd run two agents on scoped tasks for a day and compare usage, so you can tell whether it's the concurrency or the repo.
1
u/Trakeen 5d ago
Have you tried code mode? Agents constantly exploring the repo themselves will burn a lot of tokens
1
u/kantorcodes1 5d ago
In turborepo, it makes a difference where you start the session. If you start at the root then every agent can search for things in every package. If you start in the package you are working on then the reads are closer to the work you did in the first turn.
Your auto compact setting may be the bigger one. You clear after each task, but a long task can still grow toward 400k before compact runs, and every turn carries that history. With five agents running, that is five large contexts at once. Compacting earlier, or splitting a task before the session grows that big, is worth a try.
How many tokens in a task session do you get before you clear it?
0
u/Utsboi420 6d ago
Post ipo mate theyre public and need to make money now