I've been using Claude Code heavily both at work and at home. During the early days, I struggled to understand when I should have Claude do something for me and when I should do it myself. Now that enough time has past, I'm starting to get better clarity for this question.
Last night, I asked Claude to solve a long-standing mystery for me that would likely have remained a mystery forever without Claude's help. The mystery was to understand what several status bytes returned by a laserdisc player's I/O port meant.
Context: A friend and I created a hardware laserdisc player replacement called Dexter. This device revives old laserdisc player arcade games (such as Dragon's Lair) by replacing the laserdisc player itself but leaving the rest of the original hardware intact. So understanding how the original laserdisc player communicated with the game is important for this project to be successful.
For the arcade game Firefox, I had partial documentation for how the I/O port worked but had to take some guesses for some of the bytes. By reverse engineering the Firefox ROM, I was able to fake Dexter's compatibility enough to get the game working. But it's never sat well with me that these guesses would be permanent.
Well, last night I decided to see what Claude could do. I told Claude to disassemble the laserdisc player's ROM and try to improve on my guesses and come up with some facts instead. Within about 10 minutes, it was finished (this would've taken me months!) and it gave me a nice table with what sounded like very legitimate answers to my question.
I'll pause here to say that this is where AI shines. Next time someone tells you that we don't need AI and we can go back to how things were before, I will cite this example as one case where AI is very beneficial.
Claude then helpfully offered to improve the source code that included my guesses with its newfound knowledge. I told it to proceed.
Now here is where Claude is both good and bad. It saved me a lot of time by making the source code changes for me, but it also had to make several judgment calls behind the scenes.
And this is where AI is Not So Good! To avoid annoying the user, it can't ask the user to make decisions about everything. So it has to make some judgment calls that may or may not be good ones. And when the user has no domain knowledge about the source code, this may be a dangerous responsibility to delegate to Claude.
Here's Claude's initial attempt at modifying the source code: https://github.com/RulecityLLC/LaserdiscPlayerCommandInterpreters/commit/992122560450291755b0fb5a05d6e99118a41ae9
It did a pretty good job. But it casually introduced a breaking change that most people wouldn't have thought twice about. Since I wrote the original code, I caught this one quickly:
It made a judgment call to change a previously idempotent method into a method that could only be called once per field. This type of change could have drastic consequences for any code that depends on this function. It had been years since I worked on this code in relation to Dexter, so I couldn't remember whether this type of change would have actually broken something, but decades of programming experience has taught me that one doesn't just casually make breaking changes like this in a library used by unknown (or even known) clients.
And this is where humans remain essential. As amazing as Claude is at so many things, this type of mistake is really a rookie mistake that only a junior developer would make (ok, I'll admit that many senior developers could also make this kind of mistake).
And as the architect of this source code, I quickly saw a solution to the problem. Instead of changing the contract for an existing idempotent method, I saw that we could just modify another existing method to solve the same problem. So I told Claude as much, and it fixed the problem quickly:
So here's how I imagine that Claude went about solving the original problem.
- It saw that some state needed to be added to the interpreter
- It saw multiple functions where the state could be acted upon (the function I preferred and the function it chose)
- It decided not to risk annoying me by asking me to choose which function to put the state changes in. So then it made its own judgment call and got it wrong.
No comments:
Post a Comment