AI Coding Is Gambling - Unless Your Agent Learns
252 HN points say AI coding is pulling a slot machine. They're right about one-shot generation. Wrong about what comes next.
An article called "AI Coding is Gambling" hit 252 points on Hacker News today with nearly 300 comments. The author nails the feeling: using AI to code is like pulling a slot machine. Sometimes you hit, sometimes you miss, and the intermittent reinforcement is what makes it addictive. You're not learning - you're gambling on whether the output happens to be correct.
I've been building with AI coding tools daily for months. The gambling metaphor is accurate for how most people use them. But it's also incomplete, because it assumes the AI can't get better at the task. That assumption is worth questioning.
The one-shot problem
Here's why AI coding feels like gambling: every interaction is independent. You prompt the model, it generates code, and you check if it works. If it doesn't, you prompt again. The model doesn't remember what went wrong last time. It doesn't adjust its approach based on your corrections. Every generation is a fresh roll of the dice.
The author describes this well: "Getting yourself in a state where any change to your entire codebase is trivial to make is intoxicating. Previously we've been burdened by our own cognition and laziness." But the output is "vaguely plausible but often surprisingly wrong."
That's the one-shot problem. The model generates code once, based on a prompt and its training. It doesn't iterate on its own output. It doesn't test its own code. It doesn't measure whether the code it generates tends to work or fail in specific contexts. It just generates.
Gambling is the right word for this. The house edge is whatever the model's error rate is for your specific task, and no amount of prompting changes the underlying distribution.
What changes when the agent learns
But here's what the HN discussion misses: one-shot generation isn't the only architecture. There's a different approach where the coding agent actually improves over time.
We call it RSI - recursively self-improving. The idea isn't complicated: the agent measures its own performance, forms hypotheses about what would improve it, tests those hypotheses, and applies the ones that work. Then it does it again.
Applied to coding, this looks like:
Measurement: The agent tracks which of its code generations pass tests, which cause runtime errors, which get rejected in review. It builds a model of its own failure patterns. Not in a single session - across hundreds of generations.
Hypothesis: The agent identifies patterns. Maybe it consistently mishandles async/await in a specific framework. Maybe its test generation has a blind spot for edge cases involving empty inputs. Maybe it over-relies on deprecated APIs.
Mutation: It adjusts its own approach. Different prompt structures for known failure modes. Additional validation steps before presenting code. Self-generated test cases that target its weak spots.
Testing: It runs the mutated approach against historical tasks where it previously failed. If the mutation improves outcomes, it gets applied. If it doesn't, it gets discarded.
This isn't hypothetical. We run RSI cycles on our trading agents - 215+ outcomes processed, with the system autonomously killing strategies that hit structural failure thresholds. The same architecture applies to coding agents. An agent that tracks its own error patterns and adjusts its approach is categorically different from one that generates code fresh every time.
The soul problem is real, but misframed
The HN article makes a second argument that resonates: AI coding is "bad for the soul" because it robs you of the satisfaction of figuring things out yourself. "My job went from connecting these two things being the hard and reward part, to just mopping up how poorly they've been connected."
This is a real observation. But the framing assumes the human must always be the one figuring things out. For a designer-developer who enjoys the craft, that's a valid personal preference. For production code that needs to ship reliably, the question isn't whether writing it feels good - it's whether the code works.
The gambling analogy breaks down here, too. A gambler never gets better at pulling the lever. But a coding agent that learns from its mistakes gets better at writing code. At some point, the "gambling" metaphor stops being accurate because the odds actually shift.
From gambling to investing
There's a better financial metaphor for what self-improving coding agents do: investing. Not in the "guaranteed returns" sense, but in the compound-interest sense.
Each RSI cycle the agent runs is a small improvement. One cycle might reduce async-related errors by 3%. Another might improve test coverage quality. A third might catch a class of security vulnerability the agent previously missed. Individually, each improvement is marginal. Compounded over hundreds of cycles, the agent's output quality diverges significantly from a one-shot generator.
The HN comments are full of developers describing the same pattern: AI coding works great until you look closer, and then you spend more time debugging than you saved. That's the one-shot experience. It's the experience of using a tool that doesn't learn.
The alternative - an agent that tracks its own failure modes, adjusts its approach, and compounds improvements over time - turns the gambling metaphor on its head. You're not pulling a lever hoping for a jackpot. You're building a system that gets measurably better at writing correct code, cycle after cycle.
That's not gambling. That's engineering.
This article was written with AI assistance. All technical claims, code, and architectural decisions were validated by the author.
About the author
- I'm building payment rails for agent-to-agent payments
Comments
Join the discussionNo comments yet. Be the first to comment.