The Dory effect

Page content

I am well aware that LLMs have poor memory, but I never imagined that I would suffer the consequences so quickly.

Immagine generata da Google Gemini.

Note to the reader. This article complements the previous one, Antigravity: a driver written by AI, and should be read afterward. However, here’s a brief recap for the lazy readers.

Not knowing how to write a driver for a SPI camera attached to a Raspberry Pi Pico, I asked Gemini 3 Flash for help, working entirely inside Antigravity. After many hours, the agent managed to produce a working Arduino program. Then I made a fatal mistake by asking for even more without taking any precautions.

Premise

The working code generated with such great effort by Gemini 3 Flash assumed the Pico acted as a bridge between my Mac Mini and the SPI camera.1 On the Mac, a Python script commanded image capture, while the actual acquisition was performed by the Pico, running an Arduino program (a sketch in platform jargon) that is essentially C/C++ code adapted for microcontrollers.

Controlling everything from a PC works fine for early tests, but it becomes cumbersome when you want to use such a setup for fieldwork.

Automatic captures

I asked Gemini to modify the code so it would automatically snap an image every N minutes or when a button is pressed, then send the picture to a computer over Wi‑Fi.2

Prompt
[...] However, this means that I need to use a Pico for the capture and another computer, even a Raspberry Pi Zero for commanding the capture process. Would it be possible to do everything on the Pico, eg press a button and perform the capture or via a timed process (defined in the .ino file itself) every N minutes (but there should be a mechanism that sends the images to a computer connected by WiFi, avoiding to fill the pico storage space).

Gemini jumps straight into the work, still using Arduino. In principle, it should be a trivial task, but no matter how hard Gemini tries, the code never works. After many fruitless attempts I got fed up and asked it to revert to the last known‑good version of the program.

Backtracking

And here Gemini hits an unexpected wall because, despite my guidance and constant suggestions, there is absolutely no way to succeed.

Stupidly, I hadn’t kept track of the various code versions as they were generated, and that’s entirely my fault.

On the other hand, even though I am well aware that large language models (LLMs) have a working memory that resembles Dory’s, the blue tang fish, I would have never imagined that these ultra-sophisticated systems couldn’t even retrospectively reconstruct what they’ve already done. Despite having dozens upon dozens of implementation_plan.md, task.md, and walkthrough.md files that detail every previous step. I counted them: for this project alone, Antigravity produced over 250 distinct files.

Going back to a prior state is something that tools like Git and its predecessors – tools that are entirely devoid of any intelligence beyond that of their creators – have been doing flawlessly for more than fifty years). Maybe developers of these intelligent agents could give it a thought, huh?

Epilogue

In the end, stubbornly relying on my notes,3 I managed to get Gemini to repeat everything it had already done. It took hours, it reproduced all the earlier mistakes, but eventually the rebuilt code worked again.

While I was at it, I also had Gemini redo the whole thing for CircuitPython, and that port required many other hours of work and errors. And before getting there, Gemini caused such severe issues that macOS had to disable USB communication with the Pico, forcing me to restart the Mac a couple of times.

Needless to say, this time I had it keep track of every step with git and I also put all the code on GitHub, just in case.

One of the next steps will (hopefully) be MicroPython, but that’s another story.


  1. Why does Arduino struggle so much, despite being a far more mature microcontroller development platform than MicroPython or CircuitPython? Because the camera module I chose isn’t supported on the Raspberry Pi Pico; it only works with classic Raspberry Pis (those running a full OS, such as the Pi 4, 5, or Zero), as well as with the Arduino and ESP286 families of microcontrollers. ↩︎

  2. English isn’t great here; it’s more a stream of thoughts than a polished discourse. But I prefer jotting down whatever comes to mind while writing rather than losing the thread of ideas. ↩︎

  3. I’ll never stress enough how important it is to keep written notes of what you’re doing. At the beginning it seems like a waste of time, yet it’s the best way to avoid losing a huge amount of time later. ↩︎