Set limits before asking agents to fan out

A developer asked Claude Code to compare open-source UI options, but the agent chain ballooned and consumed the session budget.

Done with Claude Code· Advanced· Jun 2026

What they did
The developer used Claude Code to gather information on open-source UI frameworks for an AI-built interface feature. It started with two general-purpose agents, and that mode could launch the Agent tool, so the process kept branching until it hit the nesting ceiling. After checking the transcript log, the user added a PreToolUse hook to stop general-purpose launches while still allowing Explore and Plan.
How it went
The run generated 339 sub-agent transcript files in about 10 minutes, and the full turn lasted 26 minutes 25 seconds. Out of those 339 agents, 295 hit rate limits and returned no output, and the session still drained the MAX 5-hour quota.
Tips
If an agent can spawn more agents, add a hard stop before the first run and make sure the default mode cannot recurse freely. Hook-level controls are useful when you want to block one agent type without disabling the safer ones.

Try it yourself with Claude Code

Check open-source UI frameworks for [feature I’m building]. Use sub-agents sparingly, and stop once you reach [N] spawned agents unless I explicitly approve more. Return a comparison table with maturity, license, fit for [my requirement], and a recommendation; before any step that would use a lot of quota or create additional agents, pause and ask me to continue.

Fill in the [brackets]. Agents can make mistakes, so review anything before it is sent, paid or deleted.

Get 3 agent uses like this every morning

With the day's top AI news. Free, and one click to unsubscribe.