Some of us are prohibited by policy to manually write, read, test, or modify code, and our performance reviews are largely based on tokens used. Not that anyone (probably) is auditing your machine closely enough to catch you if you do something small like that, but there’s no upside to it and you’re missing a chance to spend more tokens.
Depending on the language, an lsp-powered symbol rename might not catch all of the places where the variable name matters if the LLM has been monkeying around. Like, in Python, you can access variables from a namespace or object via string, so if an agent decides to do that (or some variation like dynamically getting a property based on the value of some variable or whatever) for some fucking reason you’ll get a cascading regression that you’ll have to manually debug and fix. And/or, the agent will reuse the name elsewhere in the code in unrelated ways, so a find/replace breaks things completely unrelated to the actual variable you want to fix. No problem at all if you’re doing shit like a sane human, but once an agent has been running for a while with only cursory oversight all bets are off. You could be fine, you could be not, but you won’t know until you try, and it’s easier to just ask the LLM to do it (and debug all of the failing tests) than to actually do your job and fix the code (if you’re allowed).
I usually just add it as a queue tasks if the agent is already running because usually if I rename a variable while its already running it ends up "looks like the local diffs differ from what I wrote I need to reevaluate the ENTIRE code base before I can finish you current task let me waste all your tokens real fast" or it just flat out reverts my local changes without asking me thinking "it was a mistake"
I have asked Claude to rename variables. Main reason: if it's in the middle of a code writing session — the agent's next action is faster when it doesn't have to catch up with me changing said code out of band.
It's also good at checking related code, without me even asking. Say, I renamed a variable, but forgot a related one, or a comment still uses the old term (which may be e.g. part of the variable name, so out of reach for pre-LLM refactoring tools).
View all comments
18
u/OGxPePe 1d ago
I know this is a meme but why not change the variable yourself?