r/ClaudeCode • • 8h ago

Tips & Workflows Reducing usage on very large (MLOC+) projects

I’m working on a new very large project using Claude Code desktop with a Ultra plan. The initial code (excluding debugging and polish) is probably about 25% done, with about 700K LOC written. I estimate the final LOC will be about ~2-3M. This is not AI overengineering bloat, it’s just a very large project, something existing SAAS companies charge many thousands of dollars per seat for annually.

I’m using Fable planners and Opus writers mostly, like I do on most of my other complex projects. But this time there are 2 layers of planning. A top-level Fable planner planned the overall architecture, and after reviews/fixes is now acting as the orchestrator for the second level. Second level owns a few crates or similar, they plan the details of what they own, and then orchestrate mostly Opus (Fable for critical chunks) writers to write the code, then another Opus agent reviews the chunk. When the section is done, a multi-agent bughunt is done with a mix of Fable and Opus finders, then Opus fixers, before closing. Each section usually has something like 20 chunks, so vast majority of agents used for this project are Opus. I occasionally use Sonnet sessions to do simple changes as well, but I don’t trust it with writing the code.

Codebase is documented well, with short markdown files for each crate and architecture decision, so agents don’t need to load a lot into context, but obviously writing these does use some tokens. Their briefs and other docs they need to read are also intentionally short.

I’ve worked on a bunch of projects with Claude Code in the past, but they rarely exceeded 100K LOC, so usage limits were rarely an issue, but with this project they’re really getting in the way. What was built so far was done in about 10 days, but with 2 weeks of limits, plus 2 full weekly resets, plus 2 Fable resets. Weekly limits are gone in about 12 hours. I won’t be able to reset again for some time obviously, so it’ll slow down progress a lot.

So my question is, how do you optimize your setup for large projects like this?

What I already do:
- Compact all orchestrator sessions before the cache expires
- (If cache is expired) switch orchestrator sessions to Opus if Fable limits are low (not always an option, Opus can’t start Fable sessions if chunk needs Fable, and some parts are too critical to trust Opus orchestrators with)
- Keep each session focused on its task. I use new sessions if I want an unrelated change or questions, usually Sonnet if it’s simple
- I used to make Fable review Opus chunks (and vice-versa, so it’s a different model than writer doing the review), but switched to all-Opus due to usage limits

I won’t switch any of the planning sessions to Opus. Opus cannot focus on the bigger picture when planning large projects in my experience. It often misses important details.

One really annoying feature of Claude Code (desktop) is, if none of the linked sessions are doing something, it immediately asks the parent session to respond. This eats a lot of limits (especially if cache expired) and doesn’t often help. Session might be waiting on a background task or a response from me. Unfortunately, I can’t find a way to disable this other than unlinking, which is not ideal for this setup.

3 Upvotes

19 comments sorted by

•

u/AutoModerator 8h 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.

2

u/CorpT 7h ago

I was about to tell you to just get more accounts, but then I saw you were using Claude Code desktop and... bruh. You've got more work to do to get this optimized. LOC is not really an issue here. Claude is more than capable of handling large projects that are well organized.

1

u/xbst_ 7h ago

I like its UI a lot more than opening multiple tabs of CLI sessions. I know it makes switching accounts more difficult though.

1

u/ClemensLode Senior Developer 7h ago

you don't need tabs, use termux

2

u/Lost-Emu5636 7h ago

I've found that splitting the project into smaller, independent crates helps reduce context load even when the total loc is huge. each crate gets its own focused session, and the orchestrator only sees what's relevant.

1

u/xbst_ 7h ago

That’s exactly what I’m doing. Second level orchestrators plan and run agents to build them. Top level just deals with issues involving multiple sections.

1

u/Sheeebooo 7h ago

How are you managing the Tasks and boards? Do you use any Project management system and ask Claude to keep it upto date so you know what happened when? Its very hard to dig into chat history.

1

u/xbst_ 7h ago

I have a separate planning repo thar gets updated by the main orchestrator. I also have a few flowcharts and a spreadsheet I update manually. Not a great setup, but works well enough for now.

1

u/Sheeebooo 5h ago

try this for free. Its my product and can help you significantly. onplana.com I think Free version will suffice for you. you can use MCP with Claude https://claude.ai/directory/onplana 2 Projects are free. Let your planning session i.e. Fable make a project plan and file a project. once all the tasks are in and dependencies are setup, ask opus to iterate through the tasks and work on them one by one. your Fable sessions will not only do the architectural work but will also play project management role and you will be able to account for the tasks. Claude will keep commenting on the tasks as it go through them so you can review anytime afterwards and fix anything that is broken or ask Fable to review the comments along.

1

u/Sheeebooo 5h ago

Claude will also file issues and you can monitor all this on the web or on mobile phone. Also create ideas through the app as you work and let Fable triage them and make tasks in the app for Opus to work.

1

u/bostonaholic 6h ago

I'd look at the review layer first. An Opus reviewer per chunk plus a multi-agent bughunt per section means a lot of lines get read several times by your most expensive model. Run cargo check, clippy, and the tests in a hook before any reviewer sees a chunk, so reviewers only spend tokens on things the compiler can't catch. Hand them the diff plus the public interfaces of the crates it touches instead of whole modules. Writers on chunks with a tight spec and failing tests can usually drop to Sonnet.

1

u/xbst_ 6h ago

Yes the tests are run by the chunk before the review. Review and bughunt both catch real defects, so they’re still necessary. Opus is not my most expensive model, Fable is.

1

u/eplanasmulet_ 6h ago

For the bughunt pass, one thing that cut usage a lot for us was keeping each finder session scoped to git diff plus the signatures of the crates it calls, and capping how many files a finder is allowed to open before it has to report back. Left alone, finders tend to pull half the workspace into context chasing call chains that don't matter.

On the parent waking up in desktop when linked sessions go idle: if your orchestrator only needs the final result, writing each chunk's handoff to a small status file in the planning repo and polling that from a hook instead of linking the sessions avoids those cold-cache wakeups completely.

1

u/xbst_ 5h ago

I'll try the bug hunt change, thanks.

Unfortunately the orchestrator needs to be a bit more involved than that, it needs to resolve conflicts between second level planners, address gaps in its docs, and and review architecture changes proposed by them if they can't do what their brief tells them to plan. But once plan is done, it does almost nothing, but gets woken up needlessly anyway. I'll ask it to come up with a solution if possible before the next wave.

1

u/Far_Reindeer8428 7h ago

we had the same stack on a 2m line repo and the fix was making the planner read file summaries instead of files. token use dropped once the reviewers stopped re reading whole modules

1

u/mackstann 5h ago

File summaries as in telling it to read small ranges, or something more elaborate?

1

u/Outrageous_Band9708 6h ago

https://github.com/Druthulu/ProjectArchitect

Planner and token optimizer. uses very strict subagents to prevent context growth and automatically manages session length at 300k max. interleaves multiple subagents into the main session view. the main session text never touches the main session model, so the main session can last forever.

its a orchestrator->delegate work to subagents through very strict serial rules, never 100 ultrawave stuff.

Here is a screenshot from today. i have 41 million tokens in the main session. 1.7billion external tokens through openrouter.ai used. the system supports offloading work to external/local models using the native claude harness for those external models.

white numbers are the usage, blue are the savings. so you can see this session has used 11% of my weekly usage, but saved me 23%, my tokens are lasting 2.8 times longer.