←back to thread

280 points zachwills | 1 comments | | HN request time: 0.252s | source
1. a_bonobo ◴[] No.45236830[source]
Fun little story I recently had using Subagents in Claude Code:

I was working on a large-ish R analysis. In R, people generally start with loading entire libraries like

library(a)

library(b)

etc., leading to namespace clashes. It's better practice to replace all calls to package-functions with package namespaces, i.e., it's better to do

a::function_a()

b::function_b()

than to load both libraries and then blindly trusting that function_a() and function_b() come from a and b.

I asked Claude Code to take a >1000 LOC R script and replace all function calls with their model-namespace function call. It ran one subagent to look for function calls, identified >40 packages, and then started one subagent per package call for >40 subagents. Cost-wise (and speed-wise!) it was mayhem as every subagent re-read the script. It was far faster and cheaper, but a bit harder to judge, to just copy paste the R script into regular Claude and ask it to carry out the same action. The lesson is that subagents are often costly overkill.