r/ClaudeCode • • 17h ago

Help/Question New features and sub agent

So my code i apparently 40k lines.

How do i make the features not take 4 hours each? They are a bit complex (PO System) but not that complex. What am I doing wrong? CC will always ask me do you want me to deploy agents all at once, one at a time (sub gets reviewed by current session) or should i do it myself? I usually go for one at a time but it takes so much time. Can someone help?

2 Upvotes

15 comments sorted by

•

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

1

u/hieuphung97 17h ago

The bottleneck is full-repo discovery scans. On a 40k LOC codebase, Claude Code burns hours if you let it scout unguided. Pass the exact target files and module boundaries in your prompt instead of letting subagents grep everything.

2

u/IncursivePsychonaut 14h ago

What? 40k LOC codebase is tiny. One of our codebase at work is ~20x as big and Claude still works relatively efficiently. I think the important thing here is to have a clear architecture and overall system design, that way Claude has to spend much less time orienting itself.

1

u/hieuphung97 14h ago

Fair point on architecture. In a well-modularized monorepo with clear package boundaries, Claude navigates 800k LOC easily. The trap OP described is unguided root agents grepping a flat, coupled layout without explicit file paths.

1

u/calunicornia 17h ago

I let the agents approve everything.

1

u/EducatorOne7130 15h ago

tbh for a 40k loc repo, spinning up sequential subagents one by one is usually slower than just doing it in the main session. each subagent starts cold and re-reads half the repo, so I just use plan mode first and only split into subagents when two tasks don't overlap at all.

1

u/2bluenucleus 15h ago

Two things that usually cut that time a lot on a repo that size, on top of the plan-first advice above:

  • Write the map down once. Put a short section in CLAUDE.md that lists each module and its key files (where the PO models, services, API routes and UI live), the naming conventions, and the exact commands to run tests and lint. Every new session and every subagent reads that instead of rediscovering 40k lines, which is where a lot of those hours go.
  • Check how much of the 4 hours is waiting on you. If it keeps stopping for permission to run tests, builds or lint, allow-list those commands in your settings so it can run them without asking. Then give each feature a finish line it can check itself: "done when these tests pass and the build is clean". It will run the tests, read the failures and fix them in one go instead of handing back half-done work.

For a PO feature specifically, ask it to write the spec first: data model changes, endpoints, the screens, and the tests that prove it works. Review that for five minutes, then let it build in the main session. Splitting into parallel agents only pays off when the pieces touch different files.

1

u/Responsible-Box-7053 15h ago

On a ~40k LoC repo, my rule of thumb is: parallelize reads, keep writes in one session.

Having multiple subagents write tightly coupled code usually loses time to cold-start exploration and interface mismatches. What actually sped things up for me is using parallel subagents upfront only for read-only codebase mapping (keeping grep noise out of the main window), writing the feature in one main thread, and spawning a fresh session at the end just to review the diff with clean eyes.

1

u/suspiciousyogi 14h ago

Are you using Claude mem or graphify? Do you have an agents MD?

1

u/orbital_trace 13h ago

Are you 100% vibe coding it? If you want I can look at what you are doing and offer some advice. Just dm me. I'm interested in learning where people are getting stuck.

1

u/Future_AGI 13h ago

open one of the 4-hour runs in the transcript viewer (Ctrl+O) and see where the time actually went. Long thinking, subagents re-reading the same files, and a full test suite after every edit each need a different fix.

1

u/Competitive_Boot6914 11h ago

Before changing the agent count, I'd check whether they're spending time rediscovering the same parts of the project. For one PO feature, give every session the same scope, business rules and architecture context, with links to the relevant code.

That's one of the reasons we built Reqode. Requirements, data, API and UI specs are linked to the implementation. You can give Claude Code a Change Request ID, and it can retrieve that feature's specs, mapped files and architecture rules through MCP. I'd try it on one feature and compare where the time goes.

1

u/xqianliu 9h ago

On a 40k-line repo I'd try parallelizing only the parts that can land independently. If two subagents need the same interface changed, you still have to reconcile their work afterward, and that can eat the time parallelism saves.

I give each coding task its own issue and worktree, then review the finished diff against that issue before merging. For your PO feature, I'd keep the tightly coupled steps in one task and split off only the pieces you can verify on their own.

1

u/ParsaKhaz 21m ago

id spend more of the 4 hours up front, let it interview you and write the plan before any code. one at a time is fine once the plan is solid