News for hackers. Stuff that matters.
Re:Less human AI agents, please by SoftTalker on Tuesday April 21, 2026 @10:33AM (#47849391)
> changing a commonly used fn to take a locale parameter

I have to ask, is this the sort of thing people use agents/AI for?

Because I'd probably reach for sed or awk.

Re:Less human AI agents, please by pavel_lishin on Tuesday April 21, 2026 @10:57AM (#47849720)
I think about half the IDEs I've ever used just had this as a feature. Right-click on function, click on "change signature", wait a few seconds, verify with `git diff`.
Re:Less human AI agents, please by unshavedyak on Tuesday April 21, 2026 @11:27AM (#47850174)
I actually still like LLMs for this. I use rust LSP (rust analyzer) and it supports this, but LLMs will additionally go through and reword all of the documentation, doc links, comments, var names in other funcs in one go, etc.

Are they perfect? Far from it. But it's more comprehensive. Additionally simple refactors like this are insanely fast to review and so it's really easy to spot a bad change or etc. Plus i'm in Rust so it's typed very heavily.

In a lot of scenarios i'd prefer an AST grep over an LSP rename, but hat also doesn't cover the docs/comments/etc.

Re:Less human AI agents, please by mikestorrent on Tuesday April 21, 2026 @12:50PM (#47851330)
Shouldn't the LLM have some tool that gives it AST access, LSP access, and the equiv of sed/grep/awk? It doesn't necessarily need to read every file and do the change "by hand".
Re:Less human AI agents, please by nextaccountic on Tuesday April 21, 2026 @03:19PM (#47853255)
I linked this elsewhere but, the agent could have a skill to use https://ast-grep.github.io/ to perform such mechanical code changes
Re:Less human AI agents, please by unshavedyak on Tuesday April 21, 2026 @03:02PM (#47853024)
That's correct, though you'll still end up needing more than AST/LSP/etc for the same reason AST/LSP/etc isn't enough for me (the human lol), ie comments/docs/etc.
Re:Less human AI agents, please by ep103 on Tuesday April 21, 2026 @11:02AM (#47849815)
yeah, and this has the advantage of both being deterministic, and only updating things that are actually linked as opposed to also accidentally updating naming collisions
Re:Less human AI agents, please by mrbnprck on Tuesday April 21, 2026 @11:16AM (#47850027)
Arguably its only a matter of making lsp features available to the coding agent via tool calls (CLI, MCP) to prevent the model start doing such changes "manually" but rather use the deterministic tools.
Re:Less human AI agents, please by paradox460 on Tuesday April 21, 2026 @11:59PM (#47858804)
Part of why I'm not terribly fond of CLI harnesses, and prefer ones built into editors like zed. They can (but sadly rarely do) access structured information about your codebase, that's more sophisticated than looking for all strings that match
Re:Less human AI agents, please by jxf on Tuesday April 21, 2026 @10:40AM (#47849477)
It's not always amenable to grepping. But this is a great use case for AST searches, and is part of the reason that LSP tools should really be better integrated with agents.
Re:Less human AI agents, please by skydhash on Tuesday April 21, 2026 @11:17AM (#47850039)
Programming language are formal, so unless you’re doing magic stuff (eval and reflection), you can probably grep into a file, eliminate false positive cases, then do a bit of awk or shell scripting with sed. Or use Vim or Emacs tooling.
Re:Less human AI agents, please by philipwhiuk on Tuesday April 21, 2026 @10:51AM (#47849637)
Ah yes, don't fix the agents, fix the tools.

What a ridiculously backwards approach.

We were supposed to get agents who could use human tooling. Instead we are apparently told to write interfaces for this stumbling expensive mess to use.

Maybe, just maybe, if the human can know to, and use, the AST tool fine, the problem is not the tool but the agent.

Re:Less human AI agents, please by jxf on Tuesday April 28, 2026 @10:53AM (#47935482)
It's much harder to search using an AST tool for a human. It's certainly harder than grepping, for example. I use AST tools myself, but it takes a while to represent a complex structure in a big codebase when I need to look for that.
Re:Less human AI agents, please by esafak on Tuesday April 21, 2026 @12:28PM (#47851037)
Agents do use LSPs.
Re:Less human AI agents, please by PaulDavisThe1st on Tuesday April 21, 2026 @12:48PM (#47851308)
Works fine in algol-like languages (C, C++ for a start) by just changing the function prototype and finding all instances from the compiler errors, using your compiler as the AST explorer ...
Re:Less human AI agents, please by scottlamb on Tuesday April 21, 2026 @10:45AM (#47849541)
In general, yes, I might use an LLM for a tedious refactor. In this case I might try <https://github.com/ast-grep/ast-grep> though.
Re:Less human AI agents, please by Arch485 on Tuesday April 21, 2026 @10:58AM (#47849743)
Or the "find all references" feature almost every code editor has...
Re:Less human AI agents, please by nextaccountic on Tuesday April 21, 2026 @03:19PM (#47853251)
The proper tool for this is ast-grep (sg) https://ast-grep.github.io/

And an agent can learn to use sg with a skill too. (Or they can use sed)

The issue is, at every point you do a replace, you need to verify if it was the right thing to do or if it was a false positive.

If you are doing this manually, there's the time to craft the sed or sg query, then for each replacement you need to check it. If there are dozens, that's probably okay. If there are hundreds, it's less appealing to check them manually. (Then there's the issue of updating docs, and other things like this)

People use agents because not only they don't want to write the initial sed script, they also don't want to verify at each place if it was correctly applied, and much less update docs. The root of this is laziness, but for decades we have hailed laziness as a virtue in programming.