AI coding is a nightmare. Am I the only one experiencing this?

43 points by sollawen ↗ HN
Here are my biggest gripes with AI coding assistants right now: Obsessed with reinventing the wheel. You'll often find it writing three duplicate functions for the exact same feature in a single file. Why? Because it's terrified of blowing up the context window, so it only reads a fraction of a large file and completely misses the existing functionality. Why are files so bloated in the first place? Because AI prefers adding new code over modifying existing code, and it rarely deletes anything. After a few iterations, your codebase becomes a mountain of dead code. Zero holistic awareness. It hyper-focuses on the current task and couldn't care less if its changes break other parts of the system. If you point out that the original logic is now broken, it treats it as a brand-new task. It’ll fix that specific bug, but whether its newly written code still works after the fix? "Not my problem." The context window is painfully short. If you try to solve the issues above by dumping all the necessary context into the prompt, you'll hit the 200k token limit in no time. After just two more turns, it triggers auto-compacting, and suddenly it turns back into an idiot. Long context = instant brain damage. Just when you've painstakingly stuffed the perfect amount of context into the window, the model completely loses its mind. The longer the context, the more incoherent its responses become. Logical reasoning is practically non-existent. A simple feature that would take a human dev 3-5 lines of code to tweak in an existing function? The AI will insist on designing an entirely new system architecture for it. The more you tune it, the dumber it gets. You burn through millions of tokens, and every time it replies with "I understand!" or "I've got it completely!", the code it spits out still refuses to run.

52 comments

[ 2.8 ms ] story [ 53.7 ms ] thread
What model are you running? With what settings?
mostly I am using GLM5, with miniMax-3 to do some easy work.
Sounds like more of a rant than a question and for that you get a ranty reply. Ask the AI how to improve your results.
The post is decidedly a question. It is a forum, people come to interact with humans and exchange opinions.
If you model starves because of small context window (your described symptoms), then I would suggest: a) Split the job between agents, each with it's own context window; b) Use advanced model as orchestrator for multiple coding/testing/reviewing agents; c) Use code indexers like https://github.com/ory/lumen or/and https://github.com/defendend/Claude-ast-index-search d) Use planning and detailed specifications preparation before the coding phase.
Worst negative pattern I've seen is hyper defensive programing. E.g.

  try:
    something_that_should_not_fail_and_if_it_does_our_assumptions_are_all_wrong()
  except:
    fallback_that_will_not_result_in_correct_behavior_but_make_failure_hard_to_detect()
But, of course, it depends a lot on which models you're using and how you instruct them.
My convention file says no mass rewrites. Plan. Assess. Spec. Code review. Depends on your model I guess
Yeah. That drives me crazy too! function addData() {..... function addDataNew() {.... function addDataForAddData {.... function addDataForNewAddData {...
Sorry you're struggling. There are tons of resources out there from people who've been through the same pain and built up techniques to mitigate them. Matt Pocock's YouTube channel is one good starting place, there are many others. One key tip though is - you own the architecture of your application. If your files have become bloated over several rounds of LLM-generated code, that is primarily your responsibility to observe and push back on that, to ensure your repo as a brief but firm AGENTS.md or CLAUDE.md to describe architectural non-negotiables and some kind of /code-review skill that you give to a second agent to review the first agent's work against those standards. Worried about LLM changes introducing regressions? That's why you have a test suite, and you read what the agent changes to ensure the tests themselves are still checking for correct behaviour.
Your comment comes off as patronising, I don’t know if you intended that or not. These issues are not a matter of ‘holding it wrong’, they’re fundamental to agentic coding.
I don't have those experiences with Codex (5.5 xhigh).
What a pitiful state of programming affairs ... Just couple of years ago we have been discussing new libraries and tech architectures and algos. Today we discuss how to "shoehorn" some 3rd party crap into making your life miserable. Best case scenario: it will get smart(er) and replace you. (Yeah, the cope of "owning your architecture") Worst case: you redo all that shite by hand and still get replaced. And the tragedy? We ceased being programmers. We don't even qualify as code monkeys anymore ...
The most painful part is the “add instead of change/delete” habit. The real test for AI coding assistants isn’twhether they can generate code, but whether they can understand the existing system, reuse the right abstraction,remove bad code, and own the whole call chain after the change.
You are right, my solution is to implement real world software engineering process, something closer to a real Software engineering team.I split multi agents into one repo and gives them different tasks"requirements check, product/spec, architecture, coding, review, tests/evals, and overall management.

Scope adjudication is extremely important in vibe coding, or agent can easily break your whole system with not applicable features.

How did you find way to fix, i have the same issue, been trying to implement rules above it, repo focused memory, etc and still having the same issue over, as you say it always prefer create new code or files instead or modifying the existing ones then end up creatomg problems that wasnt there before…
Spec driven development can help some, even for brownfield projects. You can have an LLM swallow up your entire project and spit out a spec, and then review that yourself.

For any issue, start a brand new context, point it to the spec, explain the issue and explain if it's a regression.

Also on it might seem like an obvious one, the more test coverage you have, the more your llm can tell if something has broken or if there's been a regression without needing to eat up context.

All of these things can help but there's no perfect solution.

try using a harness. i provide one in Yaw Mode and you can copy it and modify and use a modified if you wanted to learn and tweak yours.

i use the skills /yaw-review excessively sometimes multiple times in a row on the same pr or session. followed by most often /yaw-address-all and then /yaw-coverage to add tests and /yaw-ship-ready to make production ready.

after a few rounds of these they are not needed every time on the same codebase.

if you are desperately wishing programming to go back to the before times it will never. or it will always be there but expect to be incredibly less productive than your peers.

You are not suggesting harness will replace the need of programmer's review aren't you? The thing might go in the totally wrong direction and no harness will stop it. Surely unless you write harness for every specific task at hand but then why is it any better than writing or at least reviewing the code itself?
it is not, it just helps to not go in the wrong direction as much. even in my comment i mentioned reviewing the code multiple times. so i do agree reviewing is essential.
Yes I've experienced everything you stated. Here's what helped me:

Problem 1: "Obsessed with reinventing the wheel" " three duplicate functions":

Suggestion: plan then implement.

Tell LLM to scan your project and crete markdown file plan to solve the task first. DO NOT try to selve tasks in a single shot without planning. Review the plan file then, IN A NEW SESSION with clean context, tell LLM to read the implementation plan file and implement the plan according to the file.

---

Problem 2: "hyper-focuses on the current task and couldn't care less if its changes break other parts of the system"

Suggestion: add instructions to AGENTS.md file teaching LLMs how to run unit tests and other kinds of tests so it can make sure nothing broke. And also add to AGENTS.md that LLMs MUST run tests before marking the task done.

---

Problem 3: "you'll hit the 200k token limit in no time" "Long context = instant brain damage"

Suggestion: use 1 million context window LLMs. Also plan then implement will keep your context shorter.

If you can, use better LLM services which offer 1million context window. If you can't afford Anthropic or OpenAI, use DeepSeek V4 Flash or MiMo 2.5 for example. A $10/mo OpenCode Go subscription plan offers $60 in LLM credits which is A LOT for these cheap LLMs.

Also, planning phase is when the LLM has to scan the entire project to understand what needs changing. This is where the context bloat comes from. If you split tasks into planning + implementation, the scanning phase is condensed into a single markdown file which keeps context lean.

Bonus tip: Tell LLMs to use subagents when doing exploration.

---

Problem 4: The longer the context, the more incoherent its responses.

Suggestion: yeah, LLMs get dumber as their working memory fills up (just like me). If your session reaches 200k+ tokens, it's usually a sign you could have planned the feature better or split it up. It might be worth restarting with more clarification.

>Problem 3: "you'll hit the 200k token limit..." ... Suggestion: use 1 million context window LLMs.

Yes, if the model someone is using only has 200k token limit, that would immediately suggest to me that it really isn't a sophisticated enough model.

Most of my coding sessions end up being about 350k tokens long when I finish, it wouldn't even fit in a 200k context. And that isn't counting the cache-reads by subagents, etc.

It's worth spending some time with the best Opus / GPT model, to at least get a sense of what the frontier is like.

>Why are files so bloated in the first place? Because AI prefers adding new code over modifying existing code, and it rarely deletes anything.

Did you ask it to delete stuff or consolidate functionality? Did you ask it to reuse certain available implementations? Or do you use it as a black box, letting it do all the design and code, and not caring to steer it, except with some high level request ("build x")?

If it's the latter, if we treat a (non-actually-intelligent, generative) AI as a hands-off developer and remove ourselves from the loop, we get exactly what you mention in the rant.

But nothing forces us to use it like this (except the craze of "vibe coding"). Use it as a carefully monitored and steered coding assistant.

It's slower that way? That slowness is a requirement to ingest the expertise/knowledge/taste of a human developer in the mix. It's what avoids an avalance of slop to be commited and become part of the codebase unchecked.

That's why all the focus on maximazing speed, and removing the humans from the loop, are misguided.

When LLMs are ready to removed humans from the loop, we'll know: we'd be out of a job. As long as we have one, our role is to act as a quality bottlenect, not to open the floodgates.

You mention two very specific aspects of AI producing code:

- "It hyper-focuses on the current task and couldn't care less if its changes break other parts of the system." - "Long context = instant brain damage"

This is why I quickly discovered that I had to turn AI into a knowledgable, patient tutor rather than let it code for me. I am thoroughly at the helm for all decisions big and small - I don't let AI touch the code anymore.

Yo can also do this better using just ChatGPT because it forces you to ask better questions independent of your code

Which is a lot cheaper in the end :)

Anthropic did a study where people who worked like this understood their systems a lot better than and were basically as fast as AI maximalists.

Plus it’s so much cheaper… that has to matter.

The study looks at junior developers unfamiliar with what they're implementing and tutoring->hand coding. Compared to junior developers just going in full AI maximalist.

Arguably most successful AI usage is senior developers that know the programming environment they're working in. Know how far to trust the AI. And carefully review / understand outputs.

The study: https://www.anthropic.com/research/AI-assistance-coding-skil...

this is what i do. i start with correct code and use ai for translation.

this is where i start (c2l code i translate at https://c2l.puter.site):

define..sq.x[* x x

(define (sq x) (* x x))

ai step:

translate this code to python

I have to say the LLMs probably can do a lot of these things properly if you had access to the entire infrastructure for a single project but as you said, it is simply not economical to use. I'd rather have people maintain systems before lock in happens and someone hikes the prices and rug pulls me. In almost all cases you need someone experienced anyway to sign off on the changes it makes or to keep guidelines and guardrails intact.

I don't believe the "you are holding it wrong", "works on my machine", "works on this model" or "do this spec structure" type of arguments to compensate the fundamental issues. The tech simply does not do what is advertised and claimed as it is.

So stop.

I’m serious. Treat it like any other tool. When it helps solves problems, use it. When it makes problems, don’t use it.

There are a lot of people and an enormous amount of money trying to make hands off agentic happen, but the happiest and most effective enthusiasts I know do not give up control: they go function by function and class by class, generating or writing as they see fit.

The goal is to make useful software. At least, I think that’s still true?

Couldn't agree more. Honestly, I don't believe in 'loop engineering' after working with AI these past few months, I've seen a lot of its decisions are really unreliable — and if you let it loop-engineer all night long, it's definitely going to leave you a pile of shit.
The problem with this affects professional coders more than hobby coders. Many jobs are pressuring their developers to use AI tools under threat of termination. Yeah, if you're coding on your free time, you can easily avoid AI. But many corporations have swallowed the AI Kool-Aid and actually require their devs to use AI tools.

The goal, to corporations, has never been to "make useful software". The true goal is "make software that will bring us a revenue stream". If they think they can use AI to do that faster with less human payment, then they'll snap at it. AI doesn't ask for its rights (because it's not AGI, so it doesn't have actual rights). AI just tries to do what its told, and fucks up at doing so at a higher rate than the average human. But corps think it'll be cheaper so they swallow the tales told to them by AI executives who have a highly vested interest in making sure you use their AIaaS.

Hobby coders are coding for the fun of it, and aren't going to use AI to code. They might use AI to help them understand the subject matter better, but the code that hobby coders write is highly unlikely to be AI vibecoded. Evidence: I severely doubt that any demosceners will ever use AI to write the actual demo code.

Can you get, for example in python, a tool that parses the ast and builds a very concise graph of function calls into a map, with file names, so that AI can do tool calls on this before updating any code? Instead of the grepping which is what we have.