frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

AI Agents and the Refactoring That Never Happens

https://www.rosenfeld.page/articles/programming/2026_09_02_ai_agents_and_the_refactoring_that_never_happens/
24•rosenfeld•1h ago

Comments

dgellow•1h ago
> AI agents don’t get lost

Thats… not my experience. Like, not at all. They very regularly get lost

SoftTalker•9m ago
Yes and they go down rabbit holes, and have to be yanked back to focus on the actual goal.
Ancalagon•7m ago
Same.

Also this article reads like it was written by Sonnet.

Sivart13•59m ago
> Here’s the problem. AI agents are not bound by human context limits in the same way. An agent can read the tangled function, trace every caller, and make sense of the mess that would have stopped a human cold. It can add the next branch correctly, and the one after that, working confidently inside code that no human on the team fully understands anymore.

They're not bound by the same limits but they're still bound by some limits, yeah?

I'm not an AI expert, so I don't honestly understand why LLM driven agents are as good as they are. But my impression is "trace every caller", most of the time, is still an approximation. Once the code has gotten convoluted enough, cases are going to get dropped.

dgellow•30m ago
They also very often do not actually read the fucking files! Even after specifying to „read in full the fucking files“. LLMs are so lazy, they take any shortcut they can.

Sorry, just thinking about it is reviving my frustration…

simonw•58m ago
I've found that access to coding agents has helped me be far less tolerant of bad code patterns that can be refactored.

Refactoring used to have a very real cost - it was substantial amounts of time that would have to be carved away from working on new features.

Now I can spot a potential refactor, fire off a prompt in an asynchronous coding agent (or on a worktree or whatever), then come back 20 minutes later and either accept it, poke it a bit, or abandon it. Costs me almost nothing.

rafaelRiv•52m ago
And for me, it has created a giant pile of unmaintainable code from my coworkers because of stupid management people that think they can code.

Refactoring was never a substantial amounts of time for me before llms. Before I could spot a potential refactor and refactor it in 20 minutes and less. Never abandon it. Just constant improvement to the point the previous tech startup that I was working for just drive from itself (I am still paid a a few hours per months for it)

simonw•42m ago
Does that code at least come with tests?
nijave•10m ago
Gotta get IT to slip superpowers or at least the TDD skill into MDM/enterprise controls
Kiro•37m ago
I've never met a single developer saying refactors are easy. It's always a minefield.

In the only scenario where that could actually be true you wouldn't have coworkers creating unmaintainable code with LLMs now.

beastman82•58m ago
I've had the opposite experience where we're refactoring the gnarliest shit anyone's ever seen because AI can actually understand it well enough to decompose, test, refactor, etc.
glaslong•50m ago
I find the basic premise for low level code quality to be true, in my experience, but counterintuitively I can now police the overall structure and system architecture MUCH more heavily.

As ever, no one is willing to allocate time for this, but (with unlimited work tokens) I can parallel path massive cleanup refactors all the time now.

_superposition_•50m ago
This is pretty spot on imo. Although otoh I feel like I don't need to be able to reason as deeply about a system because of the ability of an agent to dig through a code base. Personally I believe I'm still looking for that new balance. It's a little like driving a car in a neighborhood you know, vs one where you constantly need to be looking down at a map or gps. It's much more comfortable driving around the places you're familiar with, but you can't know everywhere.
taude•47m ago
I don't know, our backlog of refactoring, before AI, never really happened either.

I've yet to work at a place that bothered with much refactoring over adding the thirtieth conditional to new feature....

moezd•45m ago
AI agents get lost all the time, particularly if the codebase is already sprawling out of control.

Your discipline only pays off if you already understand your code and/or established clear baseline for your standards before launching into a feature development mania. And it needs to be enforced every turn, or the firehose of code generation knocks the front door down easily.

joshstrange•36m ago
Meanwhile I'm over here refactoring as much as I can from years (or decades) of human-slung code. Turning the mess I either inherited, helped create, or built on top of into something clean and pristine might be my favorite LLM use. Same for personal projects, codebases that evolved over many years when I happened to have time that weren't kept quite as "clean" as I wish that finally been cleaned up.

I've always _wanted_ my code to be clean and easy to follow but life, deadlines, shifting-priorities, etc have stood in the way of that. Now I can finally realize my personal nirvana.

That said, I've had to steer models away from too-heavy of abstraction or similar because it made the code too hard to follow.

nijave•12m ago
It's been fun reviving some abandoned personal/side projects and seeing them through. I have a bunch of random partially completed code that I never got around to finishing and it's fun seeing it work even if I have no use for it. Tons of "proof of concepts" left at "concept" that never reached "proof" ha
_fat_santa•28m ago
I've personally adopted doing multiple refactoring passes after any large code implementation done by AI. In pretty much any scenario where I'm adding code using AI, it's 1 turn to add the feature and and then another 4-5 turns to refactor and clean everything up.

Often times it's not even that the code is bad but rather that it's overengineered. I see it happen so much that I'm tempted to actually go the other way on a toy project. Like what would Claude or Codex come up with if I told it I wanted an enterprise grade, globally scalable, compliant and auditable tic-tac-toe game.

goldenarm•15m ago
Reminds me of the "entreprise grade fizzbuzz"

https://github.com/enterprisequalitycoding/fizzbuzzenterpris...

tunesmith•17m ago
Let's say that tomorrow, due to an improved model or whatever, we realize that the most efficient form of code of an app - for an llm to understand and work with - is for it to be in one long spaghetti file.

Why wouldn't we do that? I think there's a point where this comes down to values instead of facts. If you want it to be human readable, that's fine and there are a bunch of therefores from that point. But if you don't necessarily want that for a particular codebase, why refactor if the LLMs can handle it?

odo1242•13m ago
I'd argue the things that make a codebase more human-readable is also what makes it more agent-readable though. Agents are trained on human data, after all.

The position in the article is reasonable because what would end up happening otherwise is:

- Agents increase complexity, humans can't read it anymore

- Agents increase complexity, agent can't read it's own code anymore

- Agent unable to keep making updates without looping forever (the complexity of the code exceeds the agent's context length). Human doesn't understand either so can't fix.

This isn't hypothetical either, it's basically what ends up happening to most vibe-coded software if the person doing the vibe coding doesn't know how to review the outputs being produced.

joshka•16m ago
A lot of this feels like it comes down to the training of the agents to produce code that satisfies the various benchmarks combined with reactions to things which were previously maladaptive. I.e. things which were explicitly trained out of the model in post training. I think there's a lot of missing long term software engineering principles that don't seem to be baked into the way the models tend to write code by default.

I have some speculation that maybe the people doing the model post-training tend to be younger researchers that haven't worked on large complex software systems, so their taste isn't as developed in this regard about what things are important here.

But this is an area that can be steered with appropriate early instructions ("When choosing tradeoffs of implementation, build for long term maintainability and understandability of code over implementing just the exact code necessary to solve the issues. etc. chain of thought often includes information that would have to be repeated in a future agent session, make sure to persist it to code or external docs so that future sessions and user understanding is respected.")

It can also be done as a post-change step with similar effects. And you can use your agents to build this layer into your general modus operandi for dealing with the crimes of generated code. But one of the things that all AI labs should be doing is looking at AGENTS.md on real project as being hard expressions of what failure modes real projects have noticed in models generally. Don't wait fo the bugs to be raised on these things, use express preferences that show that there's a problem. Go trawl github for these in bulk to use for future post-training.

TimTheTinker•8m ago
> The same modularity that keeps a system inside a human’s head keeps each change inside a well-defined boundary the agent can reason about reliably.

Not only that. Good modularity also:

- improves code reusability, reduces unnecessary code duplication

- helps agents and engineers make better data model, data structure, design pattern, naming, and algorithm choices

- surfaces incorrect irregularities or outdated exceptions to a rule

- enables clean, independent upgrades of parts of a system to improve performance

- reduces stale references in code and comments (and the confusion that results, both from agents and humans)

Bad modularity is basically a summary of what constitutes pathological LLM code. How often have you tried to grok an AI-built project and found trivially unreusable code, unnecessary duplication (everywhere!), bad data structure and algorithm choices, and stale references?

gnoack•6m ago
When project leads and directors only ask for features, the humans start to eventually push back, but agents do as you please, no matter what the cost.

They were trained to do what you ask, but unlike with humans, you need to ask for the refactoring yourself. -- They won't necessarily come up with it on their own.

(They also tend to not be around for long enough to live through the consequences of their tech debt actions.)

heyitsdaad•5m ago
This is what you get for getting rid of header files.
mohamedkoubaa•5m ago
This'll be resolved by a selection process. Code that gets quadratically more complex will at some point fail to advance even with access to hundreds of genies.
SoftTalker•15m ago
If you were fortunate enough to be working in a project with very good test coverage, refactors were easier (maybe not easy) in the sense that you were at least fairly confident that nothing broke.

But I've personally never worked on code with test coverage that good. Refactors were always risky.

teaearlgraycold•49m ago
All sorts of efforts that used to be put off indefinitely can now be handled largely by LLMs. Yesterday I took a codebase (~50 source files) and spawned a sub-agent (GLM 5.3 Flash) for every single file. Each file was analyzed for test coverage issues, inconsistencies between comments and implementations, and all call sites against the implementation. Then issues were aggregated. I reviewed the list manually, had Opus and K3 review as well to prune the list, and then had a commit made for every minor issue found. 70 commits with maybe 30 minutes of manual work.

Not exactly a refactor, but high degrees of consistency are what I strive for in a codebase. LLMs get confused by inconsistencies, as do humans.

nottorp•12m ago
> then had a commit made for every minor issue found

Interesting choice of words. Not a fix. Not a refactor. A commit.

boron1006•20m ago
Do you work with other, potentially unmotivated devs/managers a lot? I wonder how much of this is an incentive issue. I don’t think refactoring itself is as much of an issue than working with 2-3 other engineers that DGAF and a manager who is only looking at LOC to determine who to promote.

But it also doesn’t mean these things aren’t problems, they’re obviously huge problems.

Muse Spark 1.3

https://developer.meta.com/ai/models/muse-spark/
193•bvaldivielso•1h ago•107 comments

I wanna live an NPC life

https://signalundefied.bearblog.dev/i-wanna-live-an-npc-life/
75•conferza•1h ago•46 comments

Gemini 3.8 Flash and 3.8 Flash Cyber

https://blog.google/innovation-and-ai/models-and-research/gemini-models/3-8-flash-and-3-8-flash-c...
690•bratao•6h ago•405 comments

Google avoids a breakup of its ad tech business

https://www.nytimes.com/2026/09/02/technology/google-ad-tech-remedies.html
129•donohoe•6h ago•60 comments

Fable 5.1 World Modeling

https://github.com/PhiloLabs/fable51-worlds
42•surreal_•1h ago•10 comments

Nango (YC W23) is hiring across eng, product and GTM (SF and remote)

https://nango.dev/careers
1•bastienbeurier•12m ago

Wendell Berry has died

https://www.nytimes.com/2026/08/31/us/wendell-berry-dead.html
80•Curiositry•1d ago•36 comments

Can I opt out of my input or output data being used for training?

https://help.mistral.ai/en/articles/455207-can-i-opt-out-of-my-input-or-output-data-being-used-fo...
328•teekert•8h ago•139 comments

AI Agents and the Refactoring That Never Happens

https://www.rosenfeld.page/articles/programming/2026_09_02_ai_agents_and_the_refactoring_that_nev...
26•rosenfeld•1h ago•31 comments

Biggest dark matter detector spots a single weird particle

https://www.science.org/content/article/world-s-biggest-dark-matter-detector-spots-single-weird-p...
210•randycupertino•7h ago•60 comments

Qantas Airbus A380 engine failure in 2010 (2023)

https://admiralcloudberg.medium.com/a-matter-of-millimeters-the-story-of-qantas-flight-32-bdaa62d...
36•gumby•2h ago•12 comments

Embedded Rust RTOS vs. C RTOS

https://tweedegolf.nl/en/blog/65/async-rust-vs-rtos-showdown/
34•kooi•2h ago•13 comments

Exit the Cave

https://turtlespace.blog/p/exit-the-cave
170•akkartik•6h ago•45 comments

Altair Basic Interpreter Source Code (1975) [pdf]

https://images.gatesnotes.com/12514eb8-7b51-008e-41a9-512542cf683b/34d561c8-cf5c-4e69-af47-3782ea...
11•Eridanus2•1h ago•2 comments

Aging Brains Blend Memories Together Instead of Just Forgetting Them

https://studyfinds.com/aging-brains-blend-memories-together-instead-of-forgetting-them-study-finds/
158•mdp2021•8h ago•74 comments

A practical guide to running 8x RTX PRO 6000's

https://www.gpupartner.com/blog/a-practical-guide-to-running-8x-rtx-pro-6000s
17•Retell15•2d ago•25 comments

Commodore 64 released September 1, 1982

https://dfarq.homeip.net/commodore-64-released-september-1-1982/
300•giuliomagnifico•12h ago•156 comments

Introducing Muse Spark 1.3

https://research.meta.ai/blog/introducing-muse-spark-1-3
51•scrlk•1h ago•10 comments

SteamdDB Joins Nexus Mods

https://www.nexusmods.com/news/15597
86•HelloUsername•5h ago•47 comments

We could save petabytes of cache storage with Zstandard and Pingora

https://blog.cloudflare.com/cache-transcoding/
40•torutofu•1d ago•13 comments

Using Cloudflare Workers and reCAPTCHA v3 for a Static Site Contact Form

https://nooshu.com/blog/2026/03/09/using-cloudflare-workers-and-recaptcha-v3-for-a-static-site-co...
15•speckx•2h ago•3 comments

A Selection of Los Alamos Rolodex Business Cards

https://clui.org/collections/los-alamos-business-cards/selection-cards
119•1970-01-01•2d ago•25 comments

Reverse Engineering Unknown File Formats with ImHex

https://werwolv.net/posts/file_format_reverse_engineering/
5•carlos-menezes•2d ago•0 comments

Poisson Disk Sampling

https://stripeacross.com/posts/poisson-disk-sampling/
103•vismit2000•7h ago•16 comments

Making the Internet Boring

https://cemrehancavdar.com/2026/08/30/making-the-internet-boring/
43•zdw•3d ago•25 comments

Paint.net 5.2 alpha now runs on Linux

https://forums.paint.net/topic/134562-paintnet-52-alpha-build-9739/
152•judah•3h ago•122 comments

A note on subscription prices from LWN

https://lwn.net/Articles/1090585/
650•rwky•7h ago•128 comments

WebLLM: high-performance in-browser LLM inference engine

https://github.com/mlc-ai/web-llm
67•saikatsg•7h ago•16 comments

Show HN: FrontierHarness Eval – 9 harness, same model, cost per pass varies 17x

https://frontierharness.org
60•shiqimei•4h ago•34 comments

Three sites made 215,128 “best software” pages for AI. Perplexity cites them

https://trellner.com/reports/manufactured-sources-behind-ai-recommendations/
253•jakobgreenfeld•7h ago•118 comments